diff options
author | Chris Lattner <sabre@nondot.org> | 2010-01-24 01:50:29 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-01-24 01:50:29 +0000 |
commit | 7e52de4b45286d057b367bb1f9283a1e32d79252 (patch) | |
tree | f4b19a3887ac0e6daada5daa22d8a8751386ef2e /lib/Parse/ParseStmt.cpp | |
parent | 31819f53836eabb6d2dfeca34487d9a960cb6491 (diff) |
fix PR6034, a crash on invalid where the switch stack would get
unbalanced.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94347 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Parse/ParseStmt.cpp')
-rw-r--r-- | lib/Parse/ParseStmt.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/Parse/ParseStmt.cpp b/lib/Parse/ParseStmt.cpp index 21e960aa81..88481e8b06 100644 --- a/lib/Parse/ParseStmt.cpp +++ b/lib/Parse/ParseStmt.cpp @@ -741,19 +741,19 @@ Parser::OwningStmtResult Parser::ParseSwitchStatement(AttributeList *Attr) { // Read the body statement. OwningStmtResult Body(ParseStatement()); - // Pop the body scope if needed. + // Pop the scopes. InnerScope.Exit(); - - if (Body.isInvalid()) { - Body = Actions.ActOnNullStmt(Tok.getLocation()); - // FIXME: Remove the case statement list from the Switch statement. - } - SwitchScope.Exit(); - if (Cond.isInvalid() && !CondVar.get()) + if (Cond.isInvalid() && !CondVar.get()) { + Actions.ActOnSwitchBodyError(SwitchLoc, move(Switch), move(Body)); return StmtError(); + } + if (Body.isInvalid()) + // FIXME: Remove the case statement list from the Switch statement. + Body = Actions.ActOnNullStmt(Tok.getLocation()); + return Actions.ActOnFinishSwitchStmt(SwitchLoc, move(Switch), move(Body)); } |