Skip to content

Commit 82f783d

Browse files
committed
getNamedLoopOrSwitch() should return nullptr if there is no label
1 parent c6d433d commit 82f783d

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

clang/lib/AST/Stmt.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1491,5 +1491,7 @@ const Stmt *LabelStmt::getInnermostLabeledStmt() const {
14911491
}
14921492

14931493
const Stmt *LoopControlStmt::getNamedLoopOrSwitch() const {
1494+
if (!hasLabelTarget())
1495+
return nullptr;
14941496
return getLabelDecl()->getStmt()->getInnermostLabeledStmt();
14951497
}

0 commit comments

Comments
 (0)