File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -6009,6 +6009,14 @@ bool IRGenModule::hasResilientMetadata(ClassDecl *D,
6009
6009
return false ;
6010
6010
}
6011
6011
6012
+ // Because the debugger can extend non public types outside of their module,
6013
+ // also check that "D" is *not* resilient from the module that contains
6014
+ // "asViewedFromRootClass".
6015
+ if (Context.LangOpts .DebuggerSupport && asViewedFromRootClass &&
6016
+ !D->hasResilientMetadata (asViewedFromRootClass->getModuleContext (),
6017
+ expansion))
6018
+ return false ;
6019
+
6012
6020
return D->hasResilientMetadata (getSwiftModule (), expansion);
6013
6021
}
6014
6022
Original file line number Diff line number Diff line change @@ -8390,9 +8390,17 @@ void IRGenSILFunction::visitClassMethodInst(swift::ClassMethodInst *i) {
8390
8390
8391
8391
auto methodType = i->getType ().castTo <SILFunctionType>();
8392
8392
8393
+ AccessLevel methodAccess = method.getDecl ()->getEffectiveAccess ();
8393
8394
auto *classDecl = cast<ClassDecl>(method.getDecl ()->getDeclContext ());
8394
8395
bool shouldUseDispatchThunk = false ;
8395
- if (IGM.hasResilientMetadata (classDecl, ResilienceExpansion::Maximal)) {
8396
+ // Because typechecking for the debugger has more lax rules, check the access
8397
+ // level of the getter to decide whether to use a dispatch thunk for the
8398
+ // debugger.
8399
+ bool shouldUseDispatchThunkIfInDebugger =
8400
+ !classDecl->getASTContext ().LangOpts .DebuggerSupport ||
8401
+ methodAccess == AccessLevel::Public;
8402
+ if (IGM.hasResilientMetadata (classDecl, ResilienceExpansion::Maximal) &&
8403
+ shouldUseDispatchThunkIfInDebugger) {
8396
8404
shouldUseDispatchThunk = true ;
8397
8405
} else if (IGM.getOptions ().VirtualFunctionElimination ) {
8398
8406
// 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