@@ -600,7 +600,11 @@ static NodePointer mangleSILDifferentiabilityWitnessAsNode(
600
600
Node::Kind::IndexSubset, config.resultIndices ->getString ()),
601
601
demangler);
602
602
if (auto genSig = config.derivativeGenericSignature ) {
603
+ #if 0 // STAGING
603
604
ASTMangler genSigMangler(mangler->getASTContext());
605
+ #else
606
+ ASTMangler genSigMangler;
607
+ #endif
604
608
auto genSigSymbol = genSigMangler.mangleGenericSignature (genSig);
605
609
auto demangledGenSig = demangler.demangleSymbol (genSigSymbol);
606
610
assert (demangledGenSig);
@@ -713,8 +717,13 @@ static Type getTypeForDWARFMangling(Type t) {
713
717
}
714
718
715
719
std::string ASTMangler::mangleTypeForDebugger (Type Ty, GenericSignature sig) {
720
+ #if 0 // STAGING
716
721
PrettyStackTraceType prettyStackTrace(Context, "mangling type for debugger",
717
722
Ty);
723
+ #else
724
+ PrettyStackTraceType prettyStackTrace (Ty->getASTContext (), " mangling type for debugger" ,
725
+ Ty);
726
+ #endif
718
727
719
728
DWARFMangling = true ;
720
729
RespectOriginallyDefinedIn = false ;
@@ -1322,7 +1331,11 @@ void ASTMangler::appendType(Type type, GenericSignature sig,
1322
1331
// unless the type alias references a builtin type.
1323
1332
auto underlyingType = aliasTy->getSinglyDesugaredType ();
1324
1333
TypeAliasDecl *decl = aliasTy->getDecl ();
1334
+ #if 0 // STAGING
1325
1335
if (decl->getModuleContext() == Context.TheBuiltinModule) {
1336
+ #else
1337
+ if (decl->getModuleContext () == decl->getASTContext ().TheBuiltinModule ) {
1338
+ #endif
1326
1339
return appendType (underlyingType, sig, forDecl);
1327
1340
}
1328
1341
@@ -2123,8 +2136,13 @@ void ASTMangler::appendImplFunctionType(SILFunctionType *fn,
2123
2136
OpArgs.push_back (' t' );
2124
2137
}
2125
2138
2139
+ #if 0 // STAGING
2126
2140
bool mangleClangType =
2127
2141
Context.LangOpts.UseClangFunctionTypes && fn->hasNonDerivableClangType();
2142
+ #else
2143
+ bool mangleClangType = fn->getASTContext ().LangOpts .UseClangFunctionTypes &&
2144
+ fn->hasNonDerivableClangType ();
2145
+ #endif
2128
2146
2129
2147
auto appendClangTypeToVec = [this , fn](auto &Vec) {
2130
2148
llvm::raw_svector_ostream OpArgsOS (Vec);
@@ -3034,8 +3052,13 @@ void ASTMangler::appendFunctionType(AnyFunctionType *fn, GenericSignature sig,
3034
3052
3035
3053
appendFunctionSignature (fn, sig, forDecl, NoFunctionMangling, isRecursedInto);
3036
3054
3055
+ #if 0 // STAGING
3037
3056
bool mangleClangType =
3038
3057
Context.LangOpts.UseClangFunctionTypes && fn->hasNonDerivableClangType();
3058
+ #else
3059
+ bool mangleClangType = fn->getASTContext ().LangOpts .UseClangFunctionTypes &&
3060
+ fn->hasNonDerivableClangType ();
3061
+ #endif
3039
3062
3040
3063
// Note that we do not currently use thin representations in the AST
3041
3064
// for the types of function decls. This may need to change at some
@@ -3085,8 +3108,13 @@ void ASTMangler::appendClangType(FnType *fn, llvm::raw_svector_ostream &out) {
3085
3108
auto clangType = fn->getClangTypeInfo ().getType ();
3086
3109
SmallString<64 > scratch;
3087
3110
llvm::raw_svector_ostream scratchOS (scratch);
3111
+ #if 0 // STAGING
3088
3112
clang::ASTContext &clangCtx =
3089
3113
Context.getClangModuleLoader()->getClangASTContext();
3114
+ #else
3115
+ clang::ASTContext &clangCtx =
3116
+ fn->getASTContext ().getClangModuleLoader ()->getClangASTContext ();
3117
+ #endif
3090
3118
std::unique_ptr<clang::ItaniumMangleContext> mangler{
3091
3119
clang::ItaniumMangleContext::create (clangCtx, clangCtx.getDiagnostics ())};
3092
3120
mangler->mangleCanonicalTypeName (clang::QualType (clangType, 0 ), scratchOS);
@@ -3112,7 +3140,11 @@ void ASTMangler::appendFunctionSignature(AnyFunctionType *fn,
3112
3140
if (fn->isSendable ())
3113
3141
appendOperator (" Yb" );
3114
3142
if (auto thrownError = fn->getEffectiveThrownErrorType ()) {
3143
+ #if 0 // STAGING
3115
3144
if ((*thrownError)->isEqual(Context.getErrorExistentialType())
3145
+ #else
3146
+ if ((*thrownError)->isEqual (fn->getASTContext ().getErrorExistentialType ())
3147
+ #endif
3116
3148
|| !AllowTypedThrows) {
3117
3149
appendOperator (" K" );
3118
3150
} else {
@@ -3811,7 +3843,11 @@ void ASTMangler::appendClosureEntity(const AbstractClosureExpr *closure) {
3811
3843
// code; the type-checker currently isn't strict about producing typed
3812
3844
// expression nodes when it fails. Once we enforce that, we can remove this.
3813
3845
if (!type)
3846
+ #if 0 // STAGING
3814
3847
type = CanType(ErrorType::get(Context));
3848
+ #else
3849
+ type = CanType (ErrorType::get (closure->getASTContext ()));
3850
+ #endif
3815
3851
3816
3852
auto canType = type->getCanonicalType ();
3817
3853
if (canType->hasLocalArchetype ())
@@ -3882,16 +3918,22 @@ CanType ASTMangler::getDeclTypeForMangling(
3882
3918
genericSig = GenericSignature ();
3883
3919
parentGenericSig = GenericSignature ();
3884
3920
3921
+ #if 0 // STAGING
3922
+ auto &C = Context;
3923
+ #else
3924
+ auto &C = decl->getASTContext ();
3925
+ #endif
3926
+
3885
3927
auto ty = decl->getInterfaceType ()->getReferenceStorageReferent ();
3886
3928
if (ty->hasError ()) {
3887
3929
if (isa<AbstractFunctionDecl>(decl) || isa<EnumElementDecl>(decl) ||
3888
3930
isa<SubscriptDecl>(decl)) {
3889
3931
// FIXME: Verify ExtInfo state is correct, not working by accident.
3890
3932
CanFunctionType::ExtInfo info;
3891
- return CanFunctionType::get ({AnyFunctionType::Param (Context .TheErrorType )},
3892
- Context .TheErrorType , info);
3933
+ return CanFunctionType::get ({AnyFunctionType::Param (C .TheErrorType )},
3934
+ C .TheErrorType , info);
3893
3935
}
3894
- return Context .TheErrorType ;
3936
+ return C .TheErrorType ;
3895
3937
}
3896
3938
3897
3939
// If this declaration predates concurrency, adjust its type to not
@@ -4501,7 +4543,12 @@ void ASTMangler::appendMacroExpansionContext(
4501
4543
if (loc.isInvalid ())
4502
4544
return appendContext (origDC, nullBase, StringRef ());
4503
4545
4546
+ #if 0 // STAGING
4504
4547
SourceManager &sourceMgr = Context.SourceMgr;
4548
+ #else
4549
+ ASTContext &ctx = origDC->getASTContext ();
4550
+ SourceManager &sourceMgr = ctx.SourceMgr ;
4551
+ #endif
4505
4552
4506
4553
auto appendMacroExpansionLoc = [&]() {
4507
4554
appendIdentifier (origDC->getParentModule ()->getName ().str ());
@@ -4579,7 +4626,7 @@ void ASTMangler::appendMacroExpansionContext(
4579
4626
if (auto *macroDecl = decl->getResolvedMacro (attr))
4580
4627
baseName = macroDecl->getBaseName ();
4581
4628
else
4582
- baseName = Context .getIdentifier (" __unknown_macro__" );
4629
+ baseName = ctx .getIdentifier (" __unknown_macro__" );
4583
4630
4584
4631
discriminator = decl->getAttachedMacroDiscriminator (baseName, role, attr);
4585
4632
break ;
0 commit comments