-
Notifications
You must be signed in to change notification settings - Fork 10.6k
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*/); | ||
|
||
} | ||
} | ||
|
||
SmallVector<ASTNode, 8> BodyItems; | ||
|
||
SourceLoc StartOfBody = Tok.getLoc(); | ||
|
Uh oh!
There was an error while loading. Please reload this page.