@@ -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" );
@@ -1304,7 +1304,7 @@ void ASTMangler::appendType(Type type, GenericSignature sig,
1304
1304
appendType (bfa->getElementType (), sig, forDecl);
1305
1305
return appendOperator (" BV" );
1306
1306
}
1307
-
1307
+
1308
1308
case TypeKind::SILToken:
1309
1309
return appendOperator (" Bt" );
1310
1310
case TypeKind::BuiltinVector:
@@ -1596,7 +1596,7 @@ void ASTMangler::appendType(Type type, GenericSignature sig,
1596
1596
return appendOpaqueTypeArchetype (
1597
1597
opaqueType, opaqueDecl, opaqueType->getSubstitutions (), sig, forDecl);
1598
1598
}
1599
-
1599
+
1600
1600
case TypeKind::DynamicSelf: {
1601
1601
auto dynamicSelf = cast<DynamicSelfType>(tybase);
1602
1602
if (dynamicSelf->getSelfType ()->getAnyNominal ()) {
@@ -1654,13 +1654,13 @@ void ASTMangler::appendType(Type type, GenericSignature sig,
1654
1654
addTypeSubstitution (DepTy, sig);
1655
1655
return ;
1656
1656
}
1657
-
1657
+
1658
1658
case TypeKind::Function:
1659
1659
appendFunctionType (cast<FunctionType>(tybase), sig,
1660
1660
/* autoclosure*/ false ,
1661
1661
forDecl);
1662
1662
return ;
1663
-
1663
+
1664
1664
case TypeKind::SILBox: {
1665
1665
auto box = cast<SILBoxType>(tybase);
1666
1666
auto layout = box->getLayout ();
@@ -2110,7 +2110,7 @@ void ASTMangler::appendImplFunctionType(SILFunctionType *fn,
2110
2110
if (fn->getInvocationSubstitutions ()) {
2111
2111
OpArgs.push_back (' I' );
2112
2112
}
2113
-
2113
+
2114
2114
if (fn->isPolymorphic () && fn->isPseudogeneric ())
2115
2115
OpArgs.push_back (' P' );
2116
2116
@@ -2217,7 +2217,7 @@ void ASTMangler::appendImplFunctionType(SILFunctionType *fn,
2217
2217
}
2218
2218
2219
2219
GenericSignature sig = fn->getSubstGenericSignature ();
2220
-
2220
+
2221
2221
// Mangle the parameters.
2222
2222
for (auto param : fn->getParameters ()) {
2223
2223
OpArgs.push_back (getParamConvention (param.getConvention ()));
@@ -2507,7 +2507,7 @@ void ASTMangler::appendContext(const DeclContext *ctx,
2507
2507
if (auto ctor = dyn_cast<ConstructorDecl>(fn)) {
2508
2508
return appendConstructorEntity (ctor, /* allocating*/ false );
2509
2509
}
2510
-
2510
+
2511
2511
if (auto dtor = dyn_cast<DestructorDecl>(fn))
2512
2512
return appendDestructorEntity (dtor, DestructorKind::NonDeallocating);
2513
2513
@@ -2523,7 +2523,7 @@ void ASTMangler::appendContext(const DeclContext *ctx,
2523
2523
auto sd = cast<SubscriptDecl>(ctx);
2524
2524
return appendEntity (sd);
2525
2525
}
2526
-
2526
+
2527
2527
case DeclContextKind::Initializer: {
2528
2528
switch (cast<Initializer>(ctx)->getInitializerKind ()) {
2529
2529
case InitializerKind::DefaultArgument: {
@@ -2591,15 +2591,9 @@ void ASTMangler::appendModule(const ModuleDecl *module,
2591
2591
StringRef ModName = module ->getRealName ().str ();
2592
2592
2593
2593
// If RespectOriginallyDefinedIn is not set, ignore the ABI name only for
2594
- // _Concurrency and swift-syntax (which adds "Compiler" as a prefix when
2595
- // building swift-syntax as part of the compiler).
2596
- // TODO: Mangling for the debugger should respect originally defined in, but
2597
- // as of right now there is not enough information in the mangled name to
2598
- // reconstruct AST types from mangled names when using that attribute.
2594
+ // _Concurrency.
2599
2595
if ((RespectOriginallyDefinedIn ||
2600
- (module ->getName ().str () != SWIFT_CONCURRENCY_NAME &&
2601
- !module ->getABIName ().str ().starts_with (
2602
- SWIFT_MODULE_ABI_NAME_PREFIX))) &&
2596
+ module ->getName ().str () != SWIFT_CONCURRENCY_NAME) &&
2603
2597
module ->getABIName () != module ->getName ())
2604
2598
ModName = module ->getABIName ().str ();
2605
2599
@@ -2647,7 +2641,7 @@ void ASTMangler::appendProtocolName(const ProtocolDecl *protocol,
2647
2641
// Try to use a symbolic reference substitution.
2648
2642
if (tryMangleSubstitution (protocol))
2649
2643
return ;
2650
-
2644
+
2651
2645
appendSymbolicReference (protocol);
2652
2646
// Substitutions can refer back to the symbolic reference.
2653
2647
addSubstitution (protocol);
@@ -2906,7 +2900,7 @@ void ASTMangler::appendAnyGenericType(const GenericTypeDecl *decl,
2906
2900
if (tryMangleSubstitution (cast<TypeAliasDecl>(decl)))
2907
2901
return ;
2908
2902
}
2909
-
2903
+
2910
2904
// Try to mangle a symbolic reference for a nominal type.
2911
2905
if (nominal && canSymbolicReference (nominal)) {
2912
2906
appendSymbolicReference (nominal);
@@ -2940,7 +2934,7 @@ void ASTMangler::appendAnyGenericType(const GenericTypeDecl *decl,
2940
2934
// Mangle ObjC classes using their runtime names.
2941
2935
auto interface = dyn_cast<clang::ObjCInterfaceDecl>(namedDecl);
2942
2936
auto protocol = dyn_cast<clang::ObjCProtocolDecl>(namedDecl);
2943
-
2937
+
2944
2938
if (UseObjCRuntimeNames && interface) {
2945
2939
appendIdentifier (interface->getObjCRuntimeNameAsString ());
2946
2940
} else if (UseObjCRuntimeNames && protocol) {
@@ -3192,7 +3186,7 @@ getDefaultOwnership(const ValueDecl *forDecl) {
3192
3186
if (!forFuncDecl) {
3193
3187
return ParamSpecifier::Borrowing;
3194
3188
}
3195
-
3189
+
3196
3190
if (isa<ConstructorDecl>(forFuncDecl)) {
3197
3191
return ParamSpecifier::Consuming;
3198
3192
} else if (auto accessor = dyn_cast<AccessorDecl>(forFuncDecl)) {
@@ -3204,7 +3198,7 @@ getDefaultOwnership(const ValueDecl *forDecl) {
3204
3198
return ParamSpecifier::Borrowing;
3205
3199
}
3206
3200
}
3207
-
3201
+
3208
3202
return ParamSpecifier::Borrowing;
3209
3203
}
3210
3204
@@ -3254,7 +3248,7 @@ void ASTMangler::appendFunctionInputType(
3254
3248
AnyFunctionType *fnType, ArrayRef<AnyFunctionType::Param> params,
3255
3249
GenericSignature sig, const ValueDecl *forDecl, bool isRecursedInto) {
3256
3250
auto defaultSpecifier = getDefaultOwnership (forDecl);
3257
-
3251
+
3258
3252
switch (params.size ()) {
3259
3253
case 0 :
3260
3254
appendOperator (" y" );
@@ -3704,7 +3698,7 @@ void ASTMangler::appendGenericSignatureParts(
3704
3698
// Mangle the number of parameters.
3705
3699
unsigned depth = 0 ;
3706
3700
unsigned count = 0 ;
3707
-
3701
+
3708
3702
// Since it's unlikely (but not impossible) to have zero generic parameters
3709
3703
// at a depth, encode indexes starting from 1, and use a special mangling
3710
3704
// for zero.
@@ -3716,7 +3710,7 @@ void ASTMangler::appendGenericSignatureParts(
3716
3710
else
3717
3711
OpBuffer << Index (count - 1 );
3718
3712
};
3719
-
3713
+
3720
3714
// As a special case, mangle nothing if there's a single generic parameter
3721
3715
// at the initial depth.
3722
3716
for (auto param : params) {
@@ -3966,7 +3960,7 @@ void ASTMangler::appendDeclType(const ValueDecl *decl,
3966
3960
} else {
3967
3961
appendType (type, sig, decl);
3968
3962
}
3969
-
3963
+
3970
3964
// Mangle the generic signature, if any.
3971
3965
if (genericSig
3972
3966
&& appendGenericSignature (genericSig, parentGenericSig, base)) {
@@ -4069,7 +4063,7 @@ void ASTMangler::appendEntity(const ValueDecl *decl,
4069
4063
void ASTMangler::appendEntity (const ValueDecl *decl) {
4070
4064
assert (!isa<ConstructorDecl>(decl));
4071
4065
assert (!isa<DestructorDecl>(decl));
4072
-
4066
+
4073
4067
// Handle accessors specially, they are mangled as modifiers on the accessed
4074
4068
// declaration.
4075
4069
if (auto accessor = dyn_cast<AccessorDecl>(decl)) {
@@ -4616,7 +4610,7 @@ void ASTMangler::appendMacroExpansionContext(
4616
4610
case GeneratedSourceInfo::AttributeFromClang:
4617
4611
return appendMacroExpansionLoc ();
4618
4612
}
4619
-
4613
+
4620
4614
switch (generatedSourceInfo->kind ) {
4621
4615
// Freestanding macros
4622
4616
#define FREESTANDING_MACRO_ROLE (Name, Description ) \
0 commit comments