-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Fix miscompilations for debugger because of resilience #78728
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8380,9 +8380,17 @@ void IRGenSILFunction::visitClassMethodInst(swift::ClassMethodInst *i) { | |
SILDeclRef method = i->getMember().getOverriddenVTableEntry(); | ||
auto methodType = i->getType().castTo<SILFunctionType>(); | ||
|
||
AccessLevel methodAccess = method.getDecl()->getEffectiveAccess(); | ||
auto *classDecl = cast<ClassDecl>(method.getDecl()->getDeclContext()); | ||
bool shouldUseDispatchThunk = false; | ||
if (IGM.hasResilientMetadata(classDecl, ResilienceExpansion::Maximal)) { | ||
// Because typechecking for the debugger has more lax rules, check the access | ||
// level of the getter to decide whether to use a dispatch thunk for the | ||
// debugger. | ||
bool shouldUseDispatchThunkIfInDebugger = | ||
!classDecl->getASTContext().LangOpts.DebuggerSupport || | ||
methodAccess == AccessLevel::Public; | ||
if (IGM.hasResilientMetadata(classDecl, ResilienceExpansion::Maximal) && | ||
shouldUseDispatchThunkIfInDebugger) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can this be tested by compiling Swift code to IR and passing -debugger-support? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I tried that but it's not enough. To look up private classes LLDB implements the |
||
shouldUseDispatchThunk = true; | ||
} else if (IGM.getOptions().VirtualFunctionElimination) { | ||
// For VFE, use a thunk if the target class is in another module. This | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IGM.Context