summaryrefslogtreecommitdiffstats
path: root/clang/lib/Parse/ParseStmt.cpp
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2008-12-17 22:19:57 +0000
committerEli Friedman <eli.friedman@gmail.com>2008-12-17 22:19:57 +0000
commit44842d140ffecdb18e12e7c2c2c347fa957ddfa5 (patch)
tree9f4f6a00ae0ddb03ce67847665f49514df2d9821 /clang/lib/Parse/ParseStmt.cpp
parent59727c04965ca5a46611aeae0631329bcd0de9d8 (diff)
downloadbcm5719-llvm-44842d140ffecdb18e12e7c2c2c347fa957ddfa5.tar.gz
bcm5719-llvm-44842d140ffecdb18e12e7c2c2c347fa957ddfa5.zip
Do proper recovery from an invalid switch condiition. Fixes PR3229.
llvm-svn: 61160
Diffstat (limited to 'clang/lib/Parse/ParseStmt.cpp')
-rw-r--r--clang/lib/Parse/ParseStmt.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/clang/lib/Parse/ParseStmt.cpp b/clang/lib/Parse/ParseStmt.cpp
index 9f8771c9193..d22fbb70446 100644
--- a/clang/lib/Parse/ParseStmt.cpp
+++ b/clang/lib/Parse/ParseStmt.cpp
@@ -611,9 +611,10 @@ Parser::OwningStmtResult Parser::ParseSwitchStatement() {
OwningExprResult Cond(Actions);
if (ParseParenExprOrCondition(Cond))
return StmtError();
-
- OwningStmtResult Switch(Actions,
- Actions.ActOnStartOfSwitchStmt(Cond.release()));
+
+ OwningStmtResult Switch(Actions);
+ if (!Cond.isInvalid())
+ Switch = Actions.ActOnStartOfSwitchStmt(Cond.release());
// C99 6.8.4p3 - In C99, the body of the switch statement is a scope, even if
// there is no compound stmt. C90 does not have this clause. We only do this
OpenPOWER on IntegriCloud