@@ -427,7 +427,7 @@ std::string ASTMangler::mangleGlobalInit(const PatternBindingDecl *pd,
427
427
unsigned pbdEntry,
428
428
bool isInitFunc) {
429
429
beginMangling ();
430
-
430
+
431
431
Pattern *pattern = pd->getPattern (pbdEntry);
432
432
bool first = true ;
433
433
pattern->forEachVariable ([&](VarDecl *D) {
@@ -440,13 +440,13 @@ std::string ASTMangler::mangleGlobalInit(const PatternBindingDecl *pd,
440
440
appendListSeparator ();
441
441
});
442
442
assert (!first && " no variables in pattern binding?!" );
443
-
443
+
444
444
if (isInitFunc) {
445
445
appendOperator (" WZ" );
446
446
} else {
447
447
appendOperator (" Wz" );
448
448
}
449
-
449
+
450
450
return finalize ();
451
451
}
452
452
@@ -474,7 +474,7 @@ std::string ASTMangler::mangleReabstractionThunkHelper(
474
474
appendOperator (" Ty" );
475
475
else
476
476
appendOperator (" TR" );
477
-
477
+
478
478
if (GlobalActorBound) {
479
479
appendType (GlobalActorBound, GenSig);
480
480
appendOperator (" TU" );
@@ -1303,7 +1303,7 @@ void ASTMangler::appendType(Type type, GenericSignature sig,
1303
1303
appendType (bfa->getElementType (), sig, forDecl);
1304
1304
return appendOperator (" BV" );
1305
1305
}
1306
-
1306
+
1307
1307
case TypeKind::SILToken:
1308
1308
return appendOperator (" Bt" );
1309
1309
case TypeKind::BuiltinVector:
@@ -1580,7 +1580,7 @@ void ASTMangler::appendType(Type type, GenericSignature sig,
1580
1580
return appendOpaqueTypeArchetype (
1581
1581
opaqueType, opaqueDecl, opaqueType->getSubstitutions (), sig, forDecl);
1582
1582
}
1583
-
1583
+
1584
1584
case TypeKind::DynamicSelf: {
1585
1585
auto dynamicSelf = cast<DynamicSelfType>(tybase);
1586
1586
if (dynamicSelf->getSelfType ()->getAnyNominal ()) {
@@ -1638,13 +1638,13 @@ void ASTMangler::appendType(Type type, GenericSignature sig,
1638
1638
addTypeSubstitution (DepTy, sig);
1639
1639
return ;
1640
1640
}
1641
-
1641
+
1642
1642
case TypeKind::Function:
1643
1643
appendFunctionType (cast<FunctionType>(tybase), sig,
1644
1644
/* autoclosure*/ false ,
1645
1645
forDecl);
1646
1646
return ;
1647
-
1647
+
1648
1648
case TypeKind::SILBox: {
1649
1649
auto box = cast<SILBoxType>(tybase);
1650
1650
auto layout = box->getLayout ();
@@ -2094,7 +2094,7 @@ void ASTMangler::appendImplFunctionType(SILFunctionType *fn,
2094
2094
if (fn->getInvocationSubstitutions ()) {
2095
2095
OpArgs.push_back (' I' );
2096
2096
}
2097
-
2097
+
2098
2098
if (fn->isPolymorphic () && fn->isPseudogeneric ())
2099
2099
OpArgs.push_back (' P' );
2100
2100
@@ -2201,7 +2201,7 @@ void ASTMangler::appendImplFunctionType(SILFunctionType *fn,
2201
2201
}
2202
2202
2203
2203
GenericSignature sig = fn->getSubstGenericSignature ();
2204
-
2204
+
2205
2205
// Mangle the parameters.
2206
2206
for (auto param : fn->getParameters ()) {
2207
2207
OpArgs.push_back (getParamConvention (param.getConvention ()));
@@ -2491,7 +2491,7 @@ void ASTMangler::appendContext(const DeclContext *ctx,
2491
2491
if (auto ctor = dyn_cast<ConstructorDecl>(fn)) {
2492
2492
return appendConstructorEntity (ctor, /* allocating*/ false );
2493
2493
}
2494
-
2494
+
2495
2495
if (auto dtor = dyn_cast<DestructorDecl>(fn))
2496
2496
return appendDestructorEntity (dtor, DestructorKind::NonDeallocating);
2497
2497
@@ -2507,7 +2507,7 @@ void ASTMangler::appendContext(const DeclContext *ctx,
2507
2507
auto sd = cast<SubscriptDecl>(ctx);
2508
2508
return appendEntity (sd);
2509
2509
}
2510
-
2510
+
2511
2511
case DeclContextKind::Initializer: {
2512
2512
switch (cast<Initializer>(ctx)->getInitializerKind ()) {
2513
2513
case InitializerKind::DefaultArgument: {
@@ -2575,15 +2575,9 @@ void ASTMangler::appendModule(const ModuleDecl *module,
2575
2575
StringRef ModName = module ->getRealName ().str ();
2576
2576
2577
2577
// If RespectOriginallyDefinedIn is not set, ignore the ABI name only for
2578
- // _Concurrency and swift-syntax (which adds "Compiler" as a prefix when
2579
- // building swift-syntax as part of the compiler).
2580
- // TODO: Mangling for the debugger should respect originally defined in, but
2581
- // as of right now there is not enough information in the mangled name to
2582
- // reconstruct AST types from mangled names when using that attribute.
2578
+ // _Concurrency.
2583
2579
if ((RespectOriginallyDefinedIn ||
2584
- (module ->getName ().str () != SWIFT_CONCURRENCY_NAME &&
2585
- !module ->getABIName ().str ().starts_with (
2586
- SWIFT_MODULE_ABI_NAME_PREFIX))) &&
2580
+ module ->getName ().str () != SWIFT_CONCURRENCY_NAME) &&
2587
2581
module ->getABIName () != module ->getName ())
2588
2582
ModName = module ->getABIName ().str ();
2589
2583
@@ -2631,7 +2625,7 @@ void ASTMangler::appendProtocolName(const ProtocolDecl *protocol,
2631
2625
// Try to use a symbolic reference substitution.
2632
2626
if (tryMangleSubstitution (protocol))
2633
2627
return ;
2634
-
2628
+
2635
2629
appendSymbolicReference (protocol);
2636
2630
// Substitutions can refer back to the symbolic reference.
2637
2631
addSubstitution (protocol);
@@ -2890,7 +2884,7 @@ void ASTMangler::appendAnyGenericType(const GenericTypeDecl *decl,
2890
2884
if (tryMangleSubstitution (cast<TypeAliasDecl>(decl)))
2891
2885
return ;
2892
2886
}
2893
-
2887
+
2894
2888
// Try to mangle a symbolic reference for a nominal type.
2895
2889
if (nominal && canSymbolicReference (nominal)) {
2896
2890
appendSymbolicReference (nominal);
@@ -2924,7 +2918,7 @@ void ASTMangler::appendAnyGenericType(const GenericTypeDecl *decl,
2924
2918
// Mangle ObjC classes using their runtime names.
2925
2919
auto interface = dyn_cast<clang::ObjCInterfaceDecl>(namedDecl);
2926
2920
auto protocol = dyn_cast<clang::ObjCProtocolDecl>(namedDecl);
2927
-
2921
+
2928
2922
if (UseObjCRuntimeNames && interface) {
2929
2923
appendIdentifier (interface->getObjCRuntimeNameAsString ());
2930
2924
} else if (UseObjCRuntimeNames && protocol) {
@@ -3176,7 +3170,7 @@ getDefaultOwnership(const ValueDecl *forDecl) {
3176
3170
if (!forFuncDecl) {
3177
3171
return ParamSpecifier::Borrowing;
3178
3172
}
3179
-
3173
+
3180
3174
if (isa<ConstructorDecl>(forFuncDecl)) {
3181
3175
return ParamSpecifier::Consuming;
3182
3176
} else if (auto accessor = dyn_cast<AccessorDecl>(forFuncDecl)) {
@@ -3188,7 +3182,7 @@ getDefaultOwnership(const ValueDecl *forDecl) {
3188
3182
return ParamSpecifier::Borrowing;
3189
3183
}
3190
3184
}
3191
-
3185
+
3192
3186
return ParamSpecifier::Borrowing;
3193
3187
}
3194
3188
@@ -3238,7 +3232,7 @@ void ASTMangler::appendFunctionInputType(
3238
3232
AnyFunctionType *fnType, ArrayRef<AnyFunctionType::Param> params,
3239
3233
GenericSignature sig, const ValueDecl *forDecl, bool isRecursedInto) {
3240
3234
auto defaultSpecifier = getDefaultOwnership (forDecl);
3241
-
3235
+
3242
3236
switch (params.size ()) {
3243
3237
case 0 :
3244
3238
appendOperator (" y" );
@@ -3688,7 +3682,7 @@ void ASTMangler::appendGenericSignatureParts(
3688
3682
// Mangle the number of parameters.
3689
3683
unsigned depth = 0 ;
3690
3684
unsigned count = 0 ;
3691
-
3685
+
3692
3686
// Since it's unlikely (but not impossible) to have zero generic parameters
3693
3687
// at a depth, encode indexes starting from 1, and use a special mangling
3694
3688
// for zero.
@@ -3700,7 +3694,7 @@ void ASTMangler::appendGenericSignatureParts(
3700
3694
else
3701
3695
OpBuffer << Index (count - 1 );
3702
3696
};
3703
-
3697
+
3704
3698
// As a special case, mangle nothing if there's a single generic parameter
3705
3699
// at the initial depth.
3706
3700
for (auto param : params) {
@@ -3950,7 +3944,7 @@ void ASTMangler::appendDeclType(const ValueDecl *decl,
3950
3944
} else {
3951
3945
appendType (type, sig, decl);
3952
3946
}
3953
-
3947
+
3954
3948
// Mangle the generic signature, if any.
3955
3949
if (genericSig
3956
3950
&& appendGenericSignature (genericSig, parentGenericSig, base)) {
@@ -4053,7 +4047,7 @@ void ASTMangler::appendEntity(const ValueDecl *decl,
4053
4047
void ASTMangler::appendEntity (const ValueDecl *decl) {
4054
4048
assert (!isa<ConstructorDecl>(decl));
4055
4049
assert (!isa<DestructorDecl>(decl));
4056
-
4050
+
4057
4051
// Handle accessors specially, they are mangled as modifiers on the accessed
4058
4052
// declaration.
4059
4053
if (auto accessor = dyn_cast<AccessorDecl>(decl)) {
@@ -4601,7 +4595,7 @@ void ASTMangler::appendMacroExpansionContext(
4601
4595
case GeneratedSourceInfo::AttributeFromClang:
4602
4596
return appendMacroExpansionLoc ();
4603
4597
}
4604
-
4598
+
4605
4599
switch (generatedSourceInfo->kind ) {
4606
4600
// Freestanding macros
4607
4601
#define FREESTANDING_MACRO_ROLE (Name, Description ) \
0 commit comments