Skip to content

Commit

Permalink
Return invalid statement results on error.
Browse files Browse the repository at this point in the history
  • Loading branch information
Bill Wendling committed Oct 29, 2011
1 parent 9a37167 commit 601557c
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions lib/Parse/Parser.cpp
Expand Up @@ -833,12 +833,12 @@ Parser::StmtResult Parser::ParseIMPLICITStmt() {

DeclSpec DS;
if (ParseDeclarationTypeSpec(DS))
return true;
return StmtResult();

if (!EatIfPresent(tok::l_paren)) {
Diag.ReportError(Tok.getLocation(),
"expected '(' in IMPLICIT statement");
return StmtResult();
return StmtResult(true);
}

SmallVector<std::pair<const IdentifierInfo*,
Expand All @@ -848,7 +848,7 @@ Parser::StmtResult Parser::ParseIMPLICITStmt() {
if (Tok.isNot(tok::identifier) || First->getName().size() > 1) {
Diag.ReportError(Tok.getLocation(),
"expected a letter");
return StmtResult();
return StmtResult(true);
}

Lex();
Expand All @@ -859,7 +859,7 @@ Parser::StmtResult Parser::ParseIMPLICITStmt() {
if (Tok.isNot(tok::identifier) || Second->getName().size() > 1) {
Diag.ReportError(Tok.getLocation(),
"expected a letter");
return StmtResult();
return StmtResult(true);
}

Lex();
Expand All @@ -868,9 +868,11 @@ Parser::StmtResult Parser::ParseIMPLICITStmt() {
LetterSpecs.push_back(std::make_pair(First, Second));
} while (EatIfPresent(tok::comma));

if (!EatIfPresent(tok::r_paren))
if (!EatIfPresent(tok::r_paren)) {
Diag.ReportError(Tok.getLocation(),
"expected ')' in IMPLICIT statement");
return StmtResult(true);
}

return Actions.ActOnIMPLICIT(Context, Loc, DS, LetterSpecs, StmtLabel);
}
Expand Down

0 comments on commit 601557c

Please sign in to comment.