@@ -600,7 +600,11 @@ static NodePointer mangleSILDifferentiabilityWitnessAsNode(
600600 Node::Kind::IndexSubset, config.resultIndices ->getString ()),
601601 demangler);
602602 if (auto genSig = config.derivativeGenericSignature ) {
603+ #if 0 // STAGING
603604 ASTMangler genSigMangler(mangler->getASTContext());
605+ #else
606+ ASTMangler genSigMangler;
607+ #endif
604608 auto genSigSymbol = genSigMangler.mangleGenericSignature (genSig);
605609 auto demangledGenSig = demangler.demangleSymbol (genSigSymbol);
606610 assert (demangledGenSig);
@@ -713,8 +717,13 @@ static Type getTypeForDWARFMangling(Type t) {
713717}
714718
715719std::string ASTMangler::mangleTypeForDebugger (Type Ty, GenericSignature sig) {
720+ #if 0 // STAGING
716721 PrettyStackTraceType prettyStackTrace(Context, "mangling type for debugger",
717722 Ty);
723+ #else
724+ PrettyStackTraceType prettyStackTrace (Ty->getASTContext (), " mangling type for debugger" ,
725+ Ty);
726+ #endif
718727
719728 DWARFMangling = true ;
720729 RespectOriginallyDefinedIn = false ;
@@ -1322,7 +1331,11 @@ void ASTMangler::appendType(Type type, GenericSignature sig,
13221331 // unless the type alias references a builtin type.
13231332 auto underlyingType = aliasTy->getSinglyDesugaredType ();
13241333 TypeAliasDecl *decl = aliasTy->getDecl ();
1334+ #if 0 // STAGING
13251335 if (decl->getModuleContext() == Context.TheBuiltinModule) {
1336+ #else
1337+ if (decl->getModuleContext () == decl->getASTContext ().TheBuiltinModule ) {
1338+ #endif
13261339 return appendType (underlyingType, sig, forDecl);
13271340 }
13281341
@@ -2123,8 +2136,13 @@ void ASTMangler::appendImplFunctionType(SILFunctionType *fn,
21232136 OpArgs.push_back (' t' );
21242137 }
21252138
2139+ #if 0 // STAGING
21262140 bool mangleClangType =
21272141 Context.LangOpts.UseClangFunctionTypes && fn->hasNonDerivableClangType();
2142+ #else
2143+ bool mangleClangType = fn->getASTContext ().LangOpts .UseClangFunctionTypes &&
2144+ fn->hasNonDerivableClangType ();
2145+ #endif
21282146
21292147 auto appendClangTypeToVec = [this , fn](auto &Vec) {
21302148 llvm::raw_svector_ostream OpArgsOS (Vec);
@@ -3034,8 +3052,13 @@ void ASTMangler::appendFunctionType(AnyFunctionType *fn, GenericSignature sig,
30343052
30353053 appendFunctionSignature (fn, sig, forDecl, NoFunctionMangling, isRecursedInto);
30363054
3055+ #if 0 // STAGING
30373056 bool mangleClangType =
30383057 Context.LangOpts.UseClangFunctionTypes && fn->hasNonDerivableClangType();
3058+ #else
3059+ bool mangleClangType = fn->getASTContext ().LangOpts .UseClangFunctionTypes &&
3060+ fn->hasNonDerivableClangType ();
3061+ #endif
30393062
30403063 // Note that we do not currently use thin representations in the AST
30413064 // 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) {
30853108 auto clangType = fn->getClangTypeInfo ().getType ();
30863109 SmallString<64 > scratch;
30873110 llvm::raw_svector_ostream scratchOS (scratch);
3111+ #if 0 // STAGING
30883112 clang::ASTContext &clangCtx =
30893113 Context.getClangModuleLoader()->getClangASTContext();
3114+ #else
3115+ clang::ASTContext &clangCtx =
3116+ fn->getASTContext ().getClangModuleLoader ()->getClangASTContext ();
3117+ #endif
30903118 std::unique_ptr<clang::ItaniumMangleContext> mangler{
30913119 clang::ItaniumMangleContext::create (clangCtx, clangCtx.getDiagnostics ())};
30923120 mangler->mangleCanonicalTypeName (clang::QualType (clangType, 0 ), scratchOS);
@@ -3112,7 +3140,11 @@ void ASTMangler::appendFunctionSignature(AnyFunctionType *fn,
31123140 if (fn->isSendable ())
31133141 appendOperator (" Yb" );
31143142 if (auto thrownError = fn->getEffectiveThrownErrorType ()) {
3143+ #if 0 // STAGING
31153144 if ((*thrownError)->isEqual(Context.getErrorExistentialType())
3145+ #else
3146+ if ((*thrownError)->isEqual (fn->getASTContext ().getErrorExistentialType ())
3147+ #endif
31163148 || !AllowTypedThrows) {
31173149 appendOperator (" K" );
31183150 } else {
@@ -3811,7 +3843,11 @@ void ASTMangler::appendClosureEntity(const AbstractClosureExpr *closure) {
38113843 // code; the type-checker currently isn't strict about producing typed
38123844 // expression nodes when it fails. Once we enforce that, we can remove this.
38133845 if (!type)
3846+ #if 0 // STAGING
38143847 type = CanType(ErrorType::get(Context));
3848+ #else
3849+ type = CanType (ErrorType::get (closure->getASTContext ()));
3850+ #endif
38153851
38163852 auto canType = type->getCanonicalType ();
38173853 if (canType->hasLocalArchetype ())
@@ -3882,16 +3918,22 @@ CanType ASTMangler::getDeclTypeForMangling(
38823918 genericSig = GenericSignature ();
38833919 parentGenericSig = GenericSignature ();
38843920
3921+ #if 0 // STAGING
3922+ auto &C = Context;
3923+ #else
3924+ auto &C = decl->getASTContext ();
3925+ #endif
3926+
38853927 auto ty = decl->getInterfaceType ()->getReferenceStorageReferent ();
38863928 if (ty->hasError ()) {
38873929 if (isa<AbstractFunctionDecl>(decl) || isa<EnumElementDecl>(decl) ||
38883930 isa<SubscriptDecl>(decl)) {
38893931 // FIXME: Verify ExtInfo state is correct, not working by accident.
38903932 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);
38933935 }
3894- return Context .TheErrorType ;
3936+ return C .TheErrorType ;
38953937 }
38963938
38973939 // If this declaration predates concurrency, adjust its type to not
@@ -4501,7 +4543,12 @@ void ASTMangler::appendMacroExpansionContext(
45014543 if (loc.isInvalid ())
45024544 return appendContext (origDC, nullBase, StringRef ());
45034545
4546+ #if 0 // STAGING
45044547 SourceManager &sourceMgr = Context.SourceMgr;
4548+ #else
4549+ ASTContext &ctx = origDC->getASTContext ();
4550+ SourceManager &sourceMgr = ctx.SourceMgr ;
4551+ #endif
45054552
45064553 auto appendMacroExpansionLoc = [&]() {
45074554 appendIdentifier (origDC->getParentModule ()->getName ().str ());
@@ -4579,7 +4626,7 @@ void ASTMangler::appendMacroExpansionContext(
45794626 if (auto *macroDecl = decl->getResolvedMacro (attr))
45804627 baseName = macroDecl->getBaseName ();
45814628 else
4582- baseName = Context .getIdentifier (" __unknown_macro__" );
4629+ baseName = ctx .getIdentifier (" __unknown_macro__" );
45834630
45844631 discriminator = decl->getAttachedMacroDiscriminator (baseName, role, attr);
45854632 break ;
0 commit comments