Skip to content

Commit 01497e7

Browse files
committed
Force AttributedStmtClass to not be scope parents
1 parent f51db95 commit 01497e7

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

clang/lib/Sema/JumpDiagnostics.cpp

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -310,8 +310,8 @@ void JumpScopeChecker::BuildScopeInformation(Stmt *S,
310310
unsigned &ParentScope = ((isa<Expr>(S) && !isa<StmtExpr>(S))
311311
? origParentScope : independentParentScope);
312312

313-
unsigned StmtsToSkip = 0u;
314-
313+
unsigned StmtsToSkip = 0u;
314+
315315
// If we found a label, remember that it is in ParentScope scope.
316316
switch (S->getStmtClass()) {
317317
case Stmt::AddrLabelExprClass:
@@ -597,15 +597,6 @@ void JumpScopeChecker::BuildScopeInformation(Stmt *S,
597597
LabelAndGotoScopes[S] = ParentScope;
598598
break;
599599

600-
case Stmt::AttributedStmtClass: {
601-
AttributedStmt *AS = cast<AttributedStmt>(S);
602-
if (GetMustTailAttr(AS)) {
603-
LabelAndGotoScopes[AS] = ParentScope;
604-
MustTailStmts.push_back(AS);
605-
}
606-
break;
607-
}
608-
609600
case Stmt::OpenACCComputeConstructClass: {
610601
unsigned NewParentScope = Scopes.size();
611602
OpenACCComputeConstruct *CC = cast<OpenACCComputeConstruct>(S);
@@ -658,6 +649,13 @@ void JumpScopeChecker::BuildScopeInformation(Stmt *S,
658649
Next = SC->getSubStmt();
659650
else if (LabelStmt *LS = dyn_cast<LabelStmt>(SubStmt))
660651
Next = LS->getSubStmt();
652+
else if (AttributedStmt *AS = dyn_cast<AttributedStmt>(SubStmt)){
653+
if (GetMustTailAttr(AS)) {
654+
LabelAndGotoScopes[AS] = ParentScope;
655+
MustTailStmts.push_back(AS);
656+
}
657+
Next = AS->getSubStmt();
658+
}
661659
else
662660
break;
663661

@@ -945,7 +943,7 @@ void JumpScopeChecker::CheckJump(Stmt *From, Stmt *To, SourceLocation DiagLoc,
945943

946944
unsigned FromScope = LabelAndGotoScopes[From];
947945
unsigned ToScope = LabelAndGotoScopes[To];
948-
946+
949947
// Common case: exactly the same scope, which is fine.
950948
if (FromScope == ToScope) return;
951949

0 commit comments

Comments
 (0)