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,
60096009 return false ;
60106010 }
60116011
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+
60126020 return D->hasResilientMetadata (getSwiftModule (), expansion);
60136021}
60146022
Original file line number Diff line number Diff line change @@ -8390,9 +8390,17 @@ void IRGenSILFunction::visitClassMethodInst(swift::ClassMethodInst *i) {
83908390
83918391 auto methodType = i->getType ().castTo <SILFunctionType>();
83928392
8393+ AccessLevel methodAccess = method.getDecl ()->getEffectiveAccess ();
83938394 auto *classDecl = cast<ClassDecl>(method.getDecl ()->getDeclContext ());
83948395 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) {
83968404 shouldUseDispatchThunk = true ;
83978405 } else if (IGM.getOptions ().VirtualFunctionElimination ) {
83988406 // 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