File tree 2 files changed +17
-1
lines changed
2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -6012,6 +6012,14 @@ bool IRGenModule::hasResilientMetadata(ClassDecl *D,
6012
6012
return false ;
6013
6013
}
6014
6014
6015
+ // Because the debugger can extend non public types outside of their module,
6016
+ // also check that "D" is *not* resilient from the module that contains
6017
+ // "asViewedFromRootClass".
6018
+ if (Context.LangOpts .DebuggerSupport && asViewedFromRootClass &&
6019
+ !D->hasResilientMetadata (asViewedFromRootClass->getModuleContext (),
6020
+ expansion))
6021
+ return false ;
6022
+
6015
6023
return D->hasResilientMetadata (getSwiftModule (), expansion);
6016
6024
}
6017
6025
Original file line number Diff line number Diff line change @@ -8387,9 +8387,17 @@ void IRGenSILFunction::visitClassMethodInst(swift::ClassMethodInst *i) {
8387
8387
8388
8388
auto methodType = i->getType ().castTo <SILFunctionType>();
8389
8389
8390
+ AccessLevel methodAccess = method.getDecl ()->getEffectiveAccess ();
8390
8391
auto *classDecl = cast<ClassDecl>(method.getDecl ()->getDeclContext ());
8391
8392
bool shouldUseDispatchThunk = false ;
8392
- if (IGM.hasResilientMetadata (classDecl, ResilienceExpansion::Maximal)) {
8393
+ // Because typechecking for the debugger has more lax rules, check the access
8394
+ // level of the getter to decide whether to use a dispatch thunk for the
8395
+ // debugger.
8396
+ bool shouldUseDispatchThunkIfInDebugger =
8397
+ !classDecl->getASTContext ().LangOpts .DebuggerSupport ||
8398
+ methodAccess == AccessLevel::Public;
8399
+ if (IGM.hasResilientMetadata (classDecl, ResilienceExpansion::Maximal) &&
8400
+ shouldUseDispatchThunkIfInDebugger) {
8393
8401
shouldUseDispatchThunk = true ;
8394
8402
} else if (IGM.getOptions ().VirtualFunctionElimination ) {
8395
8403
// For VFE, use a thunk if the target class is in another module. This
You can’t perform that action at this time.
0 commit comments