summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaStmt.cpp
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2014-12-15 07:46:12 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2014-12-15 07:46:12 +0000
commit418ad3ff107dfde7f6d7c3e87f810fbbb8515ed4 (patch)
tree1b212b144fb3c8b8a0565eb58eb5d40114c401dc /clang/lib/Sema/SemaStmt.cpp
parentc1eeb310d4d420b5053f1b5d413808851bdbe04e (diff)
downloadbcm5719-llvm-418ad3ff107dfde7f6d7c3e87f810fbbb8515ed4.tar.gz
bcm5719-llvm-418ad3ff107dfde7f6d7c3e87f810fbbb8515ed4.zip
Sema: Don't leave switch stack inconsistent when recovering
We would exit Sema::ActOnFinishSwitchStmt early if we didn't have a body. This would leave an extra SwitchStmt on the SwitchStack. This fixes PR21841. llvm-svn: 224237
Diffstat (limited to 'clang/lib/Sema/SemaStmt.cpp')
-rw-r--r--clang/lib/Sema/SemaStmt.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaStmt.cpp b/clang/lib/Sema/SemaStmt.cpp
index 8f6c5c6fe34..0c3bfd50acf 100644
--- a/clang/lib/Sema/SemaStmt.cpp
+++ b/clang/lib/Sema/SemaStmt.cpp
@@ -730,9 +730,10 @@ Sema::ActOnFinishSwitchStmt(SourceLocation SwitchLoc, Stmt *Switch,
assert(SS == getCurFunction()->SwitchStack.back() &&
"switch stack missing push/pop!");
+ getCurFunction()->SwitchStack.pop_back();
+
if (!BodyStmt) return StmtError();
SS->setBody(BodyStmt, SwitchLoc);
- getCurFunction()->SwitchStack.pop_back();
Expr *CondExpr = SS->getCond();
if (!CondExpr) return StmtError();
OpenPOWER on IntegriCloud