forked from OSchip/llvm-project
Continue parsing an expression list even after an error is encountered.
Otherwise, multiple errors such as having unknown identifiers for two arguments won't be diagnosed properly (e.g. only the first one would have a diagnostic message if typo correction fails even though both would be diagnosed if typo correction suggests a replacement). llvm-svn: 213003
This commit is contained in:
parent
6a10223d4a
commit
22101f9689
|
@ -2309,6 +2309,7 @@ bool Parser::ParseExpressionList(SmallVectorImpl<Expr*> &Exprs,
|
|||
Expr *Data,
|
||||
ArrayRef<Expr *> Args),
|
||||
Expr *Data) {
|
||||
bool SawError = false;
|
||||
while (1) {
|
||||
if (Tok.is(tok::code_completion)) {
|
||||
if (Completer)
|
||||
|
@ -2328,13 +2329,15 @@ bool Parser::ParseExpressionList(SmallVectorImpl<Expr*> &Exprs,
|
|||
|
||||
if (Tok.is(tok::ellipsis))
|
||||
Expr = Actions.ActOnPackExpansion(Expr.get(), ConsumeToken());
|
||||
if (Expr.isInvalid())
|
||||
return true;
|
||||
|
||||
Exprs.push_back(Expr.get());
|
||||
if (Expr.isInvalid()) {
|
||||
SkipUntil(tok::comma, tok::r_paren, StopBeforeMatch);
|
||||
SawError = true;
|
||||
} else {
|
||||
Exprs.push_back(Expr.get());
|
||||
}
|
||||
|
||||
if (Tok.isNot(tok::comma))
|
||||
return false;
|
||||
return SawError;
|
||||
// Move to the next argument, remember where the comma was.
|
||||
CommaLocs.push_back(ConsumeToken());
|
||||
}
|
||||
|
|
|
@ -67,3 +67,9 @@ void func_16992 () {
|
|||
int x3 = __alignof int; // expected-error {{expected parentheses around type name in __alignof expression}}
|
||||
int x4 = _Alignof int; // expected-error {{expected parentheses around type name in _Alignof expression}}
|
||||
}
|
||||
|
||||
void callee(double, double);
|
||||
void test8() {
|
||||
callee(foobar, // expected-error {{use of undeclared identifier 'foobar'}}
|
||||
fizbin); // expected-error {{use of undeclared identifier 'fizbin'}}
|
||||
}
|
||||
|
|
|
@ -4,5 +4,6 @@
|
|||
// Test that GNU C extension __builtin_types_compatible_p() is not available in C++ mode.
|
||||
|
||||
int f() {
|
||||
return __builtin_types_compatible_p(int, const int); // expected-error{{}}
|
||||
return __builtin_types_compatible_p(int, const int); // expected-error{{expected '(' for function-style cast or type construction}} \
|
||||
// expected-error{{expected expression}}
|
||||
}
|
||||
|
|
|
@ -27,7 +27,8 @@ int func2 (int arg) {
|
|||
if (TestClass.setterOnly) { // expected-error {{no getter method for read from property}}
|
||||
TestClass.setterOnly = 1;
|
||||
}
|
||||
func(TestClass.setterOnly + 1, x); // expected-error {{no getter method for read from property}}
|
||||
func(TestClass.setterOnly + 1, x); // expected-error {{no getter method for read from property}} \
|
||||
// expected-error {{use of undeclared identifier 'x'}}
|
||||
int i = TestClass.setterOnly + 1; // expected-error {{no getter method for read from property}}
|
||||
return TestClass.setterOnly + 1; // expected-error {{no getter method for read from property}}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue