summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaStmt.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-01-24 01:50:29 +0000
committerChris Lattner <sabre@nondot.org>2010-01-24 01:50:29 +0000
commit8fd2d01118d8ae82f0b08e298806f245eb694b4b (patch)
treeeb857ed0f7e05ac2968e601afb6dbfa70aa3b1b9 /clang/lib/Sema/SemaStmt.cpp
parent11092645da7762699ed31726492f6fe961a8df7d (diff)
downloadbcm5719-llvm-8fd2d01118d8ae82f0b08e298806f245eb694b4b.tar.gz
bcm5719-llvm-8fd2d01118d8ae82f0b08e298806f245eb694b4b.zip
fix PR6034, a crash on invalid where the switch stack would get
unbalanced. llvm-svn: 94347
Diffstat (limited to 'clang/lib/Sema/SemaStmt.cpp')
-rw-r--r--clang/lib/Sema/SemaStmt.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaStmt.cpp b/clang/lib/Sema/SemaStmt.cpp
index 0c207fa6e87..4653c77c86a 100644
--- a/clang/lib/Sema/SemaStmt.cpp
+++ b/clang/lib/Sema/SemaStmt.cpp
@@ -482,6 +482,16 @@ static bool CheckCXXSwitchCondition(Sema &S, SourceLocation SwitchLoc,
return false;
}
+/// ActOnSwitchBodyError - This is called if there is an error parsing the
+/// body of the switch stmt instead of ActOnFinishSwitchStmt.
+void Sema::ActOnSwitchBodyError(SourceLocation SwitchLoc, StmtArg Switch,
+ StmtArg Body) {
+ // Keep the switch stack balanced.
+ assert(getSwitchStack().back() == (SwitchStmt*)Switch.get() &&
+ "switch stack missing push/pop!");
+ getSwitchStack().pop_back();
+}
+
Action::OwningStmtResult
Sema::ActOnFinishSwitchStmt(SourceLocation SwitchLoc, StmtArg Switch,
StmtArg Body) {
OpenPOWER on IntegriCloud