diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-05-20 23:20:59 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-05-20 23:20:59 +0000 |
commit | 4abc32d033eb348e615a37c61326e31860d0d185 (patch) | |
tree | 0ec671eb72a95d44a25556a3f5d03da3b2701704 /clang/lib/Parse/ParseStmt.cpp | |
parent | 9b48b856ea610a455c04b454d674d50633d54315 (diff) | |
download | bcm5719-llvm-4abc32d033eb348e615a37c61326e31860d0d185.tar.gz bcm5719-llvm-4abc32d033eb348e615a37c61326e31860d0d185.zip |
Improve parser recovery when a switch condition is invalid; fixes
<rdar://problem/7971948>.
llvm-svn: 104291
Diffstat (limited to 'clang/lib/Parse/ParseStmt.cpp')
-rw-r--r-- | clang/lib/Parse/ParseStmt.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/clang/lib/Parse/ParseStmt.cpp b/clang/lib/Parse/ParseStmt.cpp index e68e0ead5b7..ea364ee2b6b 100644 --- a/clang/lib/Parse/ParseStmt.cpp +++ b/clang/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); } |