-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Fix the evil fallthrough bug #23687
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
Fix the evil fallthrough bug #23687
Changes from all commits
8311f2b
ed94b13
7b0d845
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 |
---|---|---|
|
@@ -2476,6 +2476,20 @@ ParserResult<CaseStmt> Parser::parseStmtCase(bool IsActive) { | |
|
||
assert(!CaseLabelItems.empty() && "did not parse any labels?!"); | ||
|
||
// Add a scope so that the parser can find our body bound decls if it emits | ||
// optimized accesses. | ||
Optional<Scope> BodyScope; | ||
if (CaseBodyDecls) { | ||
BodyScope.emplace(this, ScopeKind::CaseVars); | ||
for (auto *v : *CaseBodyDecls) { | ||
setLocalDiscriminator(v); | ||
// If we had any bad redefinitions, we already diagnosed them against the | ||
// first case label item. | ||
if (v->hasName()) | ||
addToScope(v, false /*diagnoseRedefinitions*/); | ||
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. Is this always going to be a redefinition? 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. Yes. 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. Maybe add a new entry point, like addRedefinitionToScope(), that changes the logic around and asserts if its not a redefinition. 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. SGTM 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. Actually that is not what we want. We actually just do not want 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. @slavapestov ping? |
||
} | ||
} | ||
|
||
SmallVector<ASTNode, 8> BodyItems; | ||
|
||
SourceLoc StartOfBody = Tok.getLoc(); | ||
|
Uh oh!
There was an error while loading. Please reload this page.