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 @@ -6012,6 +6012,14 @@ bool IRGenModule::hasResilientMetadata(ClassDecl *D,
60126012 return false ;
60136013 }
60146014
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+
60156023 return D->hasResilientMetadata (getSwiftModule (), expansion);
60166024}
60176025
Original file line number Diff line number Diff line change @@ -8387,9 +8387,17 @@ void IRGenSILFunction::visitClassMethodInst(swift::ClassMethodInst *i) {
83878387
83888388 auto methodType = i->getType ().castTo <SILFunctionType>();
83898389
8390+ AccessLevel methodAccess = method.getDecl ()->getEffectiveAccess ();
83908391 auto *classDecl = cast<ClassDecl>(method.getDecl ()->getDeclContext ());
83918392 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) {
83938401 shouldUseDispatchThunk = true ;
83948402 } else if (IGM.getOptions ().VirtualFunctionElimination ) {
83958403 // 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