Skip to content

Commit f3815ad

Browse files
committed
Improve legibility of conditional
Commit bceb817 made the following edits: ``` 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) { shouldUseDispatchThunk = true; } else if (IGM.getOptions().VirtualFunctionElimination) { // For VFE, use a thunk if the target class is in another module. This ``` This commit refactors the conditional that make it more obvious that only the LLDB code path is meant to be affected.
1 parent 3cae38d commit f3815ad

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/IRGen/IRGenSIL.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8432,9 +8432,9 @@ void IRGenSILFunction::visitClassMethodInst(swift::ClassMethodInst *i) {
84328432
// level of the getter to decide whether to use a dispatch thunk for the
84338433
// debugger.
84348434
bool shouldUseDispatchThunkIfInDebugger =
8435-
!classDecl->getASTContext().LangOpts.DebuggerSupport ||
8435+
classDecl->getASTContext().LangOpts.DebuggerSupport &&
84368436
methodAccess >= AccessLevel::Public;
8437-
if (IGM.hasResilientMetadata(classDecl, ResilienceExpansion::Maximal) &&
8437+
if (IGM.hasResilientMetadata(classDecl, ResilienceExpansion::Maximal) ||
84388438
shouldUseDispatchThunkIfInDebugger) {
84398439
shouldUseDispatchThunk = true;
84408440
} else if (IGM.getOptions().VirtualFunctionElimination) {

0 commit comments

Comments
 (0)