-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Remove -enable-astscope-lookup flag #33805
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
Remove -enable-astscope-lookup flag #33805
Conversation
@swift-ci Please smoke test |
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.
So nice to see the old stuff go! My one comment is maybe the title of the PR, and/or the description needs more explanation. The changes go beyond, although may be a consequence of, just removing one flag.
|
||
struct AddLabeledStmt { | ||
StmtChecker ≻ | ||
AddLabeledStmt(StmtChecker &SC, LabeledStmt *LS) : SC(SC) { | ||
// Verify that we don't have label shadowing. | ||
auto sourceFile = SC.DC->getParentSourceFile(); | ||
checkLabeledStmtShadowing(SC.getASTContext(), sourceFile, LS); | ||
|
||
// In any case, remember that we're in this labeled statement so that | ||
// break and continue are aware of it. | ||
SC.ActiveLabeledStmts.push_back(LS); | ||
|
||
// Verify that the ASTScope-based query for active labeled statements | ||
// is equivalent to what we have here. | ||
if (LS->getStartLoc().isValid() && sourceFile && | ||
SC.getASTContext().LangOpts.EnableASTScopeLookup && | ||
!SC.getASTContext().Diags.hadAnyError() && | ||
!SC.LeaveBraceStmtBodyUnchecked) { | ||
// The labeled statements from ASTScope lookup have the | ||
// innermost labeled statement first, so reverse it to | ||
// match the data structure maintained here. | ||
auto activeFromASTScope = ASTScope::lookupLabeledStmts( | ||
sourceFile, LS->getStartLoc()); | ||
assert(activeFromASTScope.front() == LS); | ||
std::reverse(activeFromASTScope.begin(), activeFromASTScope.end()); | ||
if (activeFromASTScope != SC.ActiveLabeledStmts) { | ||
llvm::errs() << "Old: "; | ||
llvm::interleave(SC.ActiveLabeledStmts, [&](LabeledStmt *LS) { | ||
llvm::errs() << LS; | ||
}, [&] { | ||
llvm::errs() << ' '; | ||
}); | ||
llvm::errs() << "\nNew: "; | ||
llvm::interleave(activeFromASTScope, [&](LabeledStmt *LS) { | ||
llvm::errs() << LS; | ||
}, [&] { | ||
llvm::errs() << ' '; | ||
}); | ||
llvm::errs() << "\n"; | ||
} | ||
assert(activeFromASTScope == SC.ActiveLabeledStmts); | ||
} | ||
} | ||
~AddLabeledStmt() { | ||
SC.ActiveLabeledStmts.pop_back(); | ||
} | ||
}; | ||
|
||
struct AddSwitchNest { | ||
StmtChecker &SC; | ||
CaseStmt *OuterFallthroughSource; | ||
CaseStmt *OuterFallthroughDest; | ||
AddSwitchNest(StmtChecker &SC) | ||
: SC(SC), | ||
OuterFallthroughSource(SC.FallthroughSource), | ||
OuterFallthroughDest(SC.FallthroughDest) { | ||
} | ||
|
||
~AddSwitchNest() { | ||
SC.FallthroughSource = OuterFallthroughSource; | ||
SC.FallthroughDest = OuterFallthroughDest; | ||
} | ||
}; |
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.
It's not obvious that this change belongs in a PR named "remove ... flag". Was it only used to cross-check ASTScopes?
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.
This is the old implementation of fall-through case statements. It's no longer needed since we can always use the new implementation. This change is also in a separate commit.
4369aca
to
193cf0d
Compare
@swift-ci Please smoke test |
-enable-astscope-lookup was removed in #33805
No description provided.