r198542 - Tweak the parse recovery in r198540
Alp Toker
alp at nuanti.com
Sat Jan 4 20:17:27 PST 2014
Author: alp
Date: Sat Jan 4 22:17:27 2014
New Revision: 198542
URL: http://llvm.org/viewvc/llvm-project?rev=198542&view=rev
Log:
Tweak the parse recovery in r198540
Cover a hypothetical case when we might not have reached the final argument
declaration for some reason during recovery, and split out for readability.
Modified:
cfe/trunk/lib/Parse/Parser.cpp
Modified: cfe/trunk/lib/Parse/Parser.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/Parser.cpp?rev=198542&r1=198541&r2=198542&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/Parser.cpp (original)
+++ cfe/trunk/lib/Parse/Parser.cpp Sat Jan 4 22:17:27 2014
@@ -1285,9 +1285,14 @@ void Parser::ParseKNRParamDeclarations(D
ParseDeclarator(ParmDeclarator);
}
- // Consume ';' or recover by skipping to the mandatory function body.
- if (ExpectAndConsumeSemi(diag::err_expected_semi_declaration))
- SkipUntil(tok::l_brace, StopBeforeMatch);
+ // Consume ';' and continue parsing.
+ if (!ExpectAndConsumeSemi(diag::err_expected_semi_declaration))
+ continue;
+
+ // Otherwise recover by skipping to next semi or mandatory function body.
+ if (SkipUntil(tok::l_brace, StopAtSemi | StopBeforeMatch))
+ break;
+ TryConsumeToken(tok::semi);
}
// The actions module must verify that all arguments were declared.
More information about the cfe-commits
mailing list