mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-12-13 02:21:45 +00:00
Fix PR3031 by silencing follow-on errors in invalid declarations.
llvm-svn: 59027
This commit is contained in:
parent
2126a6d3c4
commit
8c5dd730ce
@ -1494,6 +1494,7 @@ void Parser::ParseDirectDeclarator(Declarator &D) {
|
||||
else
|
||||
Diag(Tok, diag::err_expected_ident_lparen); // Expected identifier or '('.
|
||||
D.SetIdentifier(0, Tok.getLocation());
|
||||
D.setInvalidType(true);
|
||||
}
|
||||
|
||||
assert(D.isPastIdentifier() &&
|
||||
|
@ -753,9 +753,10 @@ Sema::ActOnDeclarator(Scope *S, Declarator &D, DeclTy *lastDecl) {
|
||||
// All of these full declarators require an identifier. If it doesn't have
|
||||
// one, the ParsedFreeStandingDeclSpec action should be used.
|
||||
if (II == 0) {
|
||||
Diag(D.getDeclSpec().getSourceRange().getBegin(),
|
||||
diag::err_declarator_need_ident,
|
||||
D.getDeclSpec().getSourceRange(), D.getSourceRange());
|
||||
if (!D.getInvalidType()) // Reject this if we think it is valid.
|
||||
Diag(D.getDeclSpec().getSourceRange().getBegin(),
|
||||
diag::err_declarator_need_ident,
|
||||
D.getDeclSpec().getSourceRange(), D.getSourceRange());
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -32,3 +32,7 @@ int test3(x,
|
||||
|
||||
int test4(x, x) int x; {} /* expected-error {{redefinition of parameter 'x'}} */
|
||||
|
||||
|
||||
// PR3031
|
||||
int (test5), ; // expected-error {{expected identifier or '('}}
|
||||
|
||||
|
@ -16,7 +16,7 @@ int *h = &x;
|
||||
int test() {
|
||||
int a[10];
|
||||
int b[10] = a; // expected-error {{initialization with "{...}" expected}}
|
||||
int +; // expected-error {{expected identifier or '('}} expected-error {{declarator requires an identifier}} expected-error {{parse error}}
|
||||
int +; // expected-error {{expected identifier or '('}} expected-error {{parse error}}
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,8 +1,7 @@
|
||||
// RUN: clang %s -fsyntax-only -verify
|
||||
|
||||
void test() {
|
||||
char = 4; // expected-error {{expected identifier}} expected-error{{declarator requires an identifier}}
|
||||
|
||||
char = 4; // expected-error {{expected identifier}}
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user