1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736
|
//===--- IRGenMangler.h - mangling of IRGen symbols -------------*- C++ -*-===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//
#ifndef SWIFT_IRGEN_IRGENMANGLER_H
#define SWIFT_IRGEN_IRGENMANGLER_H
#include "IRGenModule.h"
#include "swift/AST/ASTMangler.h"
#include "swift/AST/AutoDiff.h"
#include "swift/AST/ProtocolAssociations.h"
#include "swift/IRGen/ValueWitness.h"
#include "llvm/Support/SaveAndRestore.h"
namespace swift {
class ProtocolConformance;
class NormalProtocolConformance;
namespace irgen {
enum class MangledTypeRefRole;
/// A mangling string that includes embedded symbolic references.
struct SymbolicMangling {
std::string String;
std::vector<std::pair<Mangle::ASTMangler::SymbolicReferent, unsigned>>
SymbolicReferences;
unsigned runtimeSizeInBytes() const {
return String.size();
}
};
/// The mangler for all kind of symbols produced in IRGen.
class IRGenMangler : public Mangle::ASTMangler {
public:
IRGenMangler() { }
std::string mangleDispatchThunk(const FuncDecl *func) {
llvm::SaveAndRestore X(AllowInverses, inversesAllowed(func));
beginMangling();
appendEntity(func);
appendOperator("Tj");
return finalize();
}
std::string mangleDerivativeDispatchThunk(
const AbstractFunctionDecl *func,
AutoDiffDerivativeFunctionIdentifier *derivativeId) {
llvm::SaveAndRestore X(AllowInverses, inversesAllowed(func));
beginManglingWithAutoDiffOriginalFunction(func);
auto kind = Demangle::getAutoDiffFunctionKind(derivativeId->getKind());
auto *resultIndices =
autodiff::getFunctionSemanticResultIndices(func,
derivativeId->getParameterIndices());
AutoDiffConfig config(
derivativeId->getParameterIndices(),
resultIndices,
derivativeId->getDerivativeGenericSignature());
appendAutoDiffFunctionParts("TJ", kind, config);
appendOperator("Tj");
return finalize();
}
std::string mangleConstructorDispatchThunk(const ConstructorDecl *ctor,
bool isAllocating) {
llvm::SaveAndRestore X(AllowInverses, inversesAllowed(ctor));
beginMangling();
appendConstructorEntity(ctor, isAllocating);
appendOperator("Tj");
return finalize();
}
std::string mangleMethodDescriptor(const FuncDecl *func) {
llvm::SaveAndRestore X(AllowInverses, inversesAllowed(func));
beginMangling();
appendEntity(func);
appendOperator("Tq");
return finalize();
}
std::string mangleDerivativeMethodDescriptor(
const AbstractFunctionDecl *func,
AutoDiffDerivativeFunctionIdentifier *derivativeId) {
llvm::SaveAndRestore X(AllowInverses, inversesAllowed(func));
beginManglingWithAutoDiffOriginalFunction(func);
auto kind = Demangle::getAutoDiffFunctionKind(derivativeId->getKind());
auto *resultIndices =
autodiff::getFunctionSemanticResultIndices(func,
derivativeId->getParameterIndices());
AutoDiffConfig config(
derivativeId->getParameterIndices(),
resultIndices,
derivativeId->getDerivativeGenericSignature());
appendAutoDiffFunctionParts("TJ", kind, config);
appendOperator("Tq");
return finalize();
}
std::string mangleConstructorMethodDescriptor(const ConstructorDecl *ctor,
bool isAllocating) {
llvm::SaveAndRestore X(AllowInverses, inversesAllowed(ctor));
beginMangling();
appendConstructorEntity(ctor, isAllocating);
appendOperator("Tq");
return finalize();
}
std::string mangleMethodLookupFunction(const ClassDecl *Decl) {
return mangleNominalTypeSymbol(Decl, "Mu");
}
std::string mangleValueWitness(Type type, ValueWitness witness);
std::string mangleValueWitnessTable(Type type) {
const char * const witnessTableOp = "WV";
if (type->isAnyObject()) {
// Special-case for AnyObject, whose witness table is under the old name
// Builtin.UnknownObject, even though we don't use that as a Type anymore.
beginMangling();
appendOperator("BO");
appendOperator(witnessTableOp);
return finalize();
}
return mangleTypeSymbol(type, witnessTableOp);
}
std::string mangleTypeMetadataAccessFunction(Type type) {
return mangleTypeSymbol(type, "Ma");
}
std::string
mangleCanonicalSpecializedGenericTypeMetadataAccessFunction(Type type) {
return mangleTypeSymbol(type, "Mb");
}
std::string mangleTypeMetadataLazyCacheVariable(Type type) {
return mangleTypeSymbol(type, "ML");
}
std::string mangleTypeMetadataDemanglingCacheVariable(Type type) {
return mangleTypeSymbol(type, "MD");
}
std::string mangleTypeFullMetadataFull(Type type) {
return mangleTypeSymbol(type, "Mf");
}
std::string mangleTypeMetadataFull(Type type) {
return mangleTypeSymbol(type, "N");
}
std::string mangleNoncanonicalTypeMetadata(Type type) {
return mangleTypeSymbol(type, "MN");
}
std::string mangleCanonicalPrespecializedGenericTypeCachingOnceToken(
const NominalTypeDecl *decl) {
return mangleNominalTypeSymbol(decl, "Mz");
}
std::string mangleNoncanonicalSpecializedGenericTypeMetadataCache(Type type) {
return mangleTypeSymbol(type, "MJ");
}
std::string mangleTypeMetadataPattern(const NominalTypeDecl *decl) {
return mangleNominalTypeSymbol(decl, "MP");
}
std::string mangleClassMetaClass(const ClassDecl *Decl) {
return mangleNominalTypeSymbol(Decl, "Mm");
}
std::string mangleSpecializedGenericClassMetaClass(const CanType theType) {
return mangleTypeSymbol(theType, "MM");
}
std::string mangleObjCMetadataUpdateFunction(const ClassDecl *Decl) {
return mangleNominalTypeSymbol(Decl, "MU");
}
std::string mangleObjCResilientClassStub(const ClassDecl *Decl) {
return mangleNominalTypeSymbol(Decl, "Ms");
}
std::string mangleFullObjCResilientClassStub(const ClassDecl *Decl) {
return mangleNominalTypeSymbol(Decl, "Mt");
}
std::string mangleClassMetadataBaseOffset(const ClassDecl *Decl) {
return mangleNominalTypeSymbol(Decl, "Mo");
}
std::string mangleNominalTypeDescriptor(const NominalTypeDecl *Decl) {
return mangleNominalTypeSymbol(Decl, "Mn");
}
std::string mangleNominalTypeDescriptorRecord(const NominalTypeDecl *Decl) {
return mangleNominalTypeSymbol(Decl, "Hn");
}
std::string mangleOpaqueTypeDescriptorAccessor(const OpaqueTypeDecl *decl) {
beginMangling();
appendOpaqueDeclName(decl);
appendOperator("Mg");
return finalize();
}
std::string
mangleOpaqueTypeDescriptorAccessorImpl(const OpaqueTypeDecl *decl) {
beginMangling();
appendOpaqueDeclName(decl);
appendOperator("Mh");
return finalize();
}
std::string
mangleOpaqueTypeDescriptorAccessorKey(const OpaqueTypeDecl *decl) {
beginMangling();
appendOpaqueDeclName(decl);
appendOperator("Mj");
return finalize();
}
std::string
mangleOpaqueTypeDescriptorAccessorVar(const OpaqueTypeDecl *decl) {
beginMangling();
appendOpaqueDeclName(decl);
appendOperator("Mk");
return finalize();
}
std::string mangleTypeMetadataInstantiationCache(const NominalTypeDecl *Decl){
return mangleNominalTypeSymbol(Decl, "MI");
}
std::string mangleTypeMetadataInstantiationFunction(
const NominalTypeDecl *Decl) {
return mangleNominalTypeSymbol(Decl, "Mi");
}
std::string mangleTypeMetadataSingletonInitializationCache(
const NominalTypeDecl *Decl) {
return mangleNominalTypeSymbol(Decl, "Ml");
}
std::string mangleTypeMetadataCompletionFunction(const NominalTypeDecl *Decl){
return mangleNominalTypeSymbol(Decl, "Mr");
}
std::string mangleModuleDescriptor(const ModuleDecl *Decl) {
beginMangling();
BaseEntitySignature base(Decl);
appendContext(Decl, base, Decl->getAlternateModuleName());
appendOperator("MXM");
return finalize();
}
std::string mangleExtensionDescriptor(const ExtensionDecl *Decl) {
beginMangling();
BaseEntitySignature base(Decl);
appendContext(Decl, base, Decl->getAlternateModuleName());
appendOperator("MXE");
return finalize();
}
void appendAnonymousDescriptorName(PointerUnion<DeclContext*, VarDecl*> Name){
if (auto DC = Name.dyn_cast<DeclContext *>()) {
BaseEntitySignature nullBase(nullptr);
return appendContext(DC, nullBase, StringRef());
}
if (auto VD = Name.dyn_cast<VarDecl *>()) {
return appendEntity(VD);
}
llvm_unreachable("unknown kind");
}
std::string mangleAnonymousDescriptorName(
PointerUnion<DeclContext*, VarDecl*> Name) {
beginMangling();
appendAnonymousDescriptorName(Name);
return finalize();
}
std::string mangleAnonymousDescriptor(
PointerUnion<DeclContext*, VarDecl*> Name) {
beginMangling();
appendAnonymousDescriptorName(Name);
appendOperator("MXX");
return finalize();
}
std::string mangleBareProtocol(const ProtocolDecl *Decl) {
beginMangling();
appendAnyGenericType(Decl);
return finalize();
}
std::string mangleProtocolDescriptor(const ProtocolDecl *Decl) {
beginMangling();
appendProtocolName(Decl);
appendOperator("Mp");
return finalize();
}
std::string mangleProtocolDescriptorRecord(const ProtocolDecl *Decl) {
beginMangling();
appendProtocolName(Decl);
appendOperator("Hr");
return finalize();
}
std::string mangleProtocolRequirementsBaseDescriptor(
const ProtocolDecl *Decl) {
beginMangling();
appendProtocolName(Decl);
appendOperator("TL");
return finalize();
}
std::string mangleAssociatedTypeDescriptor(
const AssociatedTypeDecl *assocType) {
// Don't optimize away the protocol name, because we need it to distinguish
// among the type descriptors of different protocols.
llvm::SaveAndRestore<bool> optimizeProtocolNames(OptimizeProtocolNames,
false);
beginMangling();
bool isAssocTypeAtDepth = false;
(void)appendAssocType(
assocType->getDeclaredInterfaceType()->castTo<DependentMemberType>(),
nullptr,
isAssocTypeAtDepth);
appendOperator("Tl");
return finalize();
}
std::string mangleAssociatedConformanceDescriptor(
const ProtocolDecl *proto,
CanType subject,
const ProtocolDecl *requirement) {
beginMangling();
appendAnyGenericType(proto);
if (isa<GenericTypeParamType>(subject)) {
appendType(subject, nullptr);
} else {
bool isFirstAssociatedTypeIdentifier = true;
appendAssociatedTypePath(subject, isFirstAssociatedTypeIdentifier);
}
appendProtocolName(requirement);
appendOperator("Tn");
return finalize();
}
std::string mangleBaseConformanceDescriptor(
const ProtocolDecl *proto,
const ProtocolDecl *requirement) {
beginMangling();
appendAnyGenericType(proto);
appendProtocolName(requirement);
appendOperator("Tb");
return finalize();
}
std::string mangleDefaultAssociatedConformanceAccessor(
const ProtocolDecl *proto,
CanType subject,
const ProtocolDecl *requirement) {
beginMangling();
appendAnyGenericType(proto);
bool isFirstAssociatedTypeIdentifier = true;
appendAssociatedTypePath(subject, isFirstAssociatedTypeIdentifier);
appendProtocolName(requirement);
appendOperator("TN");
return finalize();
}
std::string mangleProtocolConformanceDescriptor(
const RootProtocolConformance *conformance);
std::string mangleProtocolConformanceDescriptorRecord(
const RootProtocolConformance *conformance);
std::string mangleProtocolConformanceInstantiationCache(
const RootProtocolConformance *conformance);
std::string manglePropertyDescriptor(const AbstractStorageDecl *storage) {
llvm::SaveAndRestore X(AllowInverses, inversesAllowed(storage));
beginMangling();
appendEntity(storage);
appendOperator("MV");
return finalize();
}
std::string mangleFieldOffset(const ValueDecl *Decl) {
llvm::SaveAndRestore X(AllowInverses, inversesAllowed(Decl));
beginMangling();
appendEntity(Decl);
appendOperator("Wvd");
return finalize();
}
std::string mangleEnumCase(const ValueDecl *Decl) {
beginMangling();
appendEntity(Decl);
appendOperator("WC");
return finalize();
}
std::string mangleProtocolWitnessTablePattern(const ProtocolConformance *C) {
return mangleConformanceSymbol(Type(), C, "Wp");
}
std::string mangleGenericProtocolWitnessTableInstantiationFunction(
const ProtocolConformance *C) {
return mangleConformanceSymbol(Type(), C, "WI");
}
std::string mangleProtocolWitnessTableLazyAccessFunction(Type type,
const ProtocolConformance *C) {
return mangleConformanceSymbol(type, C, "Wl");
}
std::string mangleProtocolWitnessTableLazyCacheVariable(Type type,
const ProtocolConformance *C) {
return mangleConformanceSymbol(type, C, "WL");
}
std::string
mangleAssociatedTypeAccessFunctionDiscriminator(AssociatedType association) {
beginMangling();
appendAnyGenericType(association.getSourceProtocol());
appendIdentifier(association.getAssociation()->getNameStr());
return finalize();
}
std::string mangleAssociatedTypeWitnessTableAccessFunctionDiscriminator(
const AssociatedConformance &conf) {
beginMangling();
appendAnyGenericType(conf.getSourceProtocol());
bool isFirstAssociatedTypeIdentifier = true;
appendAssociatedTypePath(conf.getAssociation(),
isFirstAssociatedTypeIdentifier);
appendAnyGenericType(conf.getAssociatedRequirement());
return finalize();
}
std::string mangleAssociatedTypeWitnessTableAccessFunction(
const ProtocolConformance *Conformance,
CanType AssociatedType,
const ProtocolDecl *Proto) {
beginMangling();
appendProtocolConformance(Conformance);
bool isFirstAssociatedTypeIdentifier = true;
appendAssociatedTypePath(AssociatedType, isFirstAssociatedTypeIdentifier);
appendAnyGenericType(Proto);
appendOperator("WT");
return finalize();
}
std::string mangleBaseWitnessTableAccessFunction(
const ProtocolConformance *Conformance,
const ProtocolDecl *BaseProto) {
beginMangling();
appendProtocolConformance(Conformance);
appendAnyGenericType(BaseProto);
appendOperator("Wb");
return finalize();
}
void appendAssociatedTypePath(CanType associatedType, bool &isFirst) {
if (auto memberType = dyn_cast<DependentMemberType>(associatedType)) {
appendAssociatedTypePath(memberType.getBase(), isFirst);
appendAssociatedTypeName(memberType, nullptr);
appendListSeparator(isFirst);
} else {
assert(isa<GenericTypeParamType>(associatedType));
}
}
void appendExtendedExistentialTypeShape(CanGenericSignature genSig,
CanType shapeType);
void appendExtendedExistentialTypeShapeSymbol(CanGenericSignature genSig,
CanType shapeType,
bool isUnique);
/// Mangle the symbol name for an extended existential type shape.
std::string mangleExtendedExistentialTypeShapeSymbol(
CanGenericSignature genSig,
CanType shapeType,
bool isUnique);
std::string mangleCoroutineContinuationPrototype(CanSILFunctionType type) {
return mangleTypeSymbol(type, "TC");
}
std::string mangleReflectionBuiltinDescriptor(Type type) {
const char * const reflectionDescriptorOp = "MB";
if (type->isAnyObject()) {
// Special-case for AnyObject, whose reflection descriptor is under the
// old name Builtin.UnknownObject, even though we don't use that as a Type
// anymore.
beginMangling();
appendOperator("BO");
appendOperator(reflectionDescriptorOp);
return finalize();
}
return mangleTypeSymbol(type, reflectionDescriptorOp);
}
std::string mangleReflectionFieldDescriptor(Type type) {
return mangleTypeSymbol(type, "MF");
}
std::string mangleReflectionAssociatedTypeDescriptor(
const ProtocolConformance *C) {
return mangleConformanceSymbol(Type(), C, "MA");
}
std::string mangleOutlinedCopyFunction(CanType ty,
CanGenericSignature sig) {
beginMangling();
appendType(ty, sig);
if (sig)
appendGenericSignature(sig);
appendOperator("WOy");
return finalize();
}
std::string mangleOutlinedConsumeFunction(CanType ty,
CanGenericSignature sig) {
beginMangling();
appendType(ty, sig);
if (sig)
appendGenericSignature(sig);
appendOperator("WOe");
return finalize();
}
std::string mangleOutlinedRetainFunction(CanType t,
CanGenericSignature sig) {
beginMangling();
appendType(t, sig);
if (sig)
appendGenericSignature(sig);
appendOperator("WOr");
return finalize();
}
std::string mangleOutlinedReleaseFunction(CanType t,
CanGenericSignature sig) {
beginMangling();
appendType(t, sig);
if (sig)
appendGenericSignature(sig);
appendOperator("WOs");
return finalize();
}
std::string mangleOutlinedInitializeWithTakeFunction(CanType t,
CanGenericSignature sig,
bool noValueWitness) {
beginMangling();
appendType(t, sig);
if (sig)
appendGenericSignature(sig);
appendOperator(noValueWitness ? "WOB" : "WOb");
return finalize();
}
std::string mangleOutlinedInitializeWithCopyFunction(CanType t,
CanGenericSignature sig,
bool noValueWitness) {
beginMangling();
appendType(t, sig);
if (sig)
appendGenericSignature(sig);
appendOperator(noValueWitness ? "WOC" : "WOc");
return finalize();
}
std::string mangleOutlinedAssignWithTakeFunction(CanType t,
CanGenericSignature sig,
bool noValueWitness) {
beginMangling();
appendType(t, sig);
if (sig)
appendGenericSignature(sig);
appendOperator(noValueWitness ? "WOD" : "WOd");
return finalize();
}
std::string mangleOutlinedAssignWithCopyFunction(CanType t,
CanGenericSignature sig,
bool noValueWitness) {
beginMangling();
appendType(t, sig);
if (sig)
appendGenericSignature(sig);
appendOperator(noValueWitness ? "WOF" : "WOf");
return finalize();
}
std::string mangleOutlinedDestroyFunction(CanType t,
CanGenericSignature sig,
bool noValueWitness) {
beginMangling();
appendType(t, sig);
if (sig)
appendGenericSignature(sig);
appendOperator(noValueWitness ? "WOH" : "WOh");
return finalize();
}
std::string mangleOutlinedEnumTagStoreFunction(CanType t,
CanGenericSignature sig,
unsigned enumCaseNum) {
beginMangling();
appendType(t, sig);
if (sig)
appendGenericSignature(sig);
appendOperatorParam("WOi", Index(enumCaseNum));
return finalize();
}
std::string mangleOutlinedEnumProjectDataForLoadFunction(CanType t,
CanGenericSignature sig,
unsigned enumCaseNum) {
beginMangling();
appendType(t, sig);
if (sig)
appendGenericSignature(sig);
appendOperatorParam("WOj", Index(enumCaseNum));
return finalize();
}
std::string mangleOutlinedEnumGetTag(CanType t, CanGenericSignature sig) {
beginMangling();
appendType(t, sig);
if (sig)
appendGenericSignature(sig);
appendOperator("WOg");
return finalize();
}
std::string manglePartialApplyForwarder(StringRef FuncName);
std::string mangleTypeForForeignMetadataUniquing(Type type) {
return mangleTypeWithoutPrefix(type);
}
void configureForSymbolicMangling() {
OptimizeProtocolNames = false;
UseObjCRuntimeNames = true;
}
SymbolicMangling mangleTypeForFlatUniqueTypeRef(CanGenericSignature sig,
CanType ty);
SymbolicMangling mangleTypeForReflection(IRGenModule &IGM,
CanGenericSignature genericSig,
CanType Ty);
std::string mangleTypeForLLVMTypeName(CanType Ty);
std::string mangleProtocolForLLVMTypeName(ProtocolCompositionType *type);
std::string mangleSymbolNameForSymbolicMangling(
const SymbolicMangling &mangling,
MangledTypeRefRole role);
std::string mangleSymbolNameForAssociatedConformanceWitness(
const NormalProtocolConformance *conformance,
CanType associatedType,
const ProtocolDecl *proto);
std::string mangleSymbolNameForMangledMetadataAccessorString(
const char *kind,
CanGenericSignature genericSig,
CanType type);
std::string mangleSymbolNameForMangledConformanceAccessorString(
const char *kind,
CanGenericSignature genericSig,
CanType type,
ProtocolConformanceRef conformance);
std::string mangleSymbolNameForMangledGetEnumTagForLayoutString(CanType type);
std::string
mangleSymbolNameForUnderlyingTypeAccessorString(OpaqueTypeDecl *opaque,
unsigned index);
std::string mangleSymbolNameForUnderlyingWitnessTableAccessorString(
OpaqueTypeDecl *opaque, const Requirement &req, ProtocolDecl *protocol);
std::string mangleSymbolNameForGenericEnvironment(
CanGenericSignature genericSig);
protected:
SymbolicMangling
withSymbolicReferences(IRGenModule &IGM,
llvm::function_ref<void ()> body);
std::string mangleTypeSymbol(Type type, const char *Op) {
beginMangling();
appendType(type, nullptr);
appendOperator(Op);
return finalize();
}
std::string mangleNominalTypeSymbol(const NominalTypeDecl *Decl,
const char *Op) {
beginMangling();
appendAnyGenericType(Decl);
appendOperator(Op);
return finalize();
}
std::string mangleConformanceSymbol(Type type,
const ProtocolConformance *Conformance,
const char *Op);
};
/// Determines if the minimum deployment target's runtime demangler will not
/// understand the mangled name for the given type.
/// \returns true iff the target's runtime does not understand the mangled name.
bool mangledNameIsUnknownToDeployTarget(IRGenModule &IGM, CanType type);
} // end namespace irgen
} // end namespace swift
#endif
|