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.

llvm-svn: 198542
This commit is contained in:
Alp Toker 2014-01-05 04:17:27 +00:00
parent c77d50a97e
commit c090ae763a
1 changed files with 8 additions and 3 deletions

View File

@ -1285,9 +1285,14 @@ void Parser::ParseKNRParamDeclarations(Declarator &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.