Fix a problem where a semantic error confused error recovery to the point
where the parser emitted bogus diagnostics. Before, when compiling: struct A { int X; } someA; int func(int, struct A); int test1(void *P, int C) { return func(((C*40) + *P) / 42+P, someA); } we emitted: bug3.c:7:25: error: invalid operands to binary expression ('int' and 'void') return func(((C*40) + *P) / 42+P, someA); ~~~~~~ ^ ~~ bug3.c:7:31: error: expected ')' return func(((C*40) + *P) / 42+P, someA); ^ bug3.c:7:16: error: to match this '(' return func(((C*40) + *P) / 42+P, someA); ^ now we only emit the first. llvm-svn: 39474
This commit is contained in:
parent
67ca9252f8
commit
de5a472e02
|
@ -630,9 +630,11 @@ Parser::ExprResult Parser::ParsePostfixExpressionSuffix(ExprResult LHS) {
|
|||
if (Tok.getKind() != tok::r_paren) {
|
||||
while (1) {
|
||||
ExprResult ArgExpr = ParseAssignmentExpression();
|
||||
if (ArgExpr.isInvalid)
|
||||
if (ArgExpr.isInvalid) {
|
||||
ArgExprsOk = false;
|
||||
else
|
||||
SkipUntil(tok::r_paren);
|
||||
break;
|
||||
} else
|
||||
ArgExprs.push_back(ArgExpr.Val);
|
||||
|
||||
if (Tok.getKind() != tok::comma)
|
||||
|
@ -650,7 +652,8 @@ Parser::ExprResult Parser::ParsePostfixExpressionSuffix(ExprResult LHS) {
|
|||
&CommaLocs[0], Tok.getLocation());
|
||||
}
|
||||
|
||||
MatchRHSPunctuation(tok::r_paren, Loc);
|
||||
if (ArgExprsOk)
|
||||
MatchRHSPunctuation(tok::r_paren, Loc);
|
||||
break;
|
||||
}
|
||||
case tok::arrow: // postfix-expression: p-e '->' identifier
|
||||
|
|
Loading…
Reference in New Issue