aboutsummaryrefslogtreecommitdiff
path: root/lib/Parse/ParseStmt.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-05-20 23:20:59 +0000
committerDouglas Gregor <dgregor@apple.com>2010-05-20 23:20:59 +0000
commit4186ff4fc4102f63b7485c2bf89155d3b0899d32 (patch)
tree296cdc67b065640a9226b4851458eaf8dd6b0a4a /lib/Parse/ParseStmt.cpp
parent72a43bbf6802c8fcfd04dcb2be8eafcb0b8fe29c (diff)
Improve parser recovery when a switch condition is invalid; fixes
<rdar://problem/7971948>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104291 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Parse/ParseStmt.cpp')
-rw-r--r--lib/Parse/ParseStmt.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/Parse/ParseStmt.cpp b/lib/Parse/ParseStmt.cpp
index e68e0ead5b..ea364ee2b6 100644
--- a/lib/Parse/ParseStmt.cpp
+++ b/lib/Parse/ParseStmt.cpp
@@ -754,9 +754,10 @@ Parser::OwningStmtResult Parser::ParseSwitchStatement(AttributeList *Attr) {
// FIXME: This is not optimal recovery, but parsing the body is more
// dangerous due to the presence of case and default statements, which
// will have no place to connect back with the switch.
- if (Tok.is(tok::l_brace))
- MatchRHSPunctuation(tok::r_brace, ConsumeBrace());
- else
+ if (Tok.is(tok::l_brace)) {
+ ConsumeBrace();
+ SkipUntil(tok::r_brace, false, false);
+ } else
SkipUntil(tok::semi);
return move(Switch);
}