summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2013-07-11 05:10:21 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2013-07-11 05:10:21 +0000
commit9ce302ed9c29be8f2e9d83f777d20513c3b22109 (patch)
treec58dd33c4b48cf30f53bb3f158a2c2d641214d95 /clang/lib
parentc6b5e2499edbbbf588470d91ae21719735aefaa7 (diff)
downloadbcm5719-llvm-9ce302ed9c29be8f2e9d83f777d20513c3b22109.tar.gz
bcm5719-llvm-9ce302ed9c29be8f2e9d83f777d20513c3b22109.zip
PR5066: If a declarator cannot have an identifier, and cannot possibly be
followed by an identifier, then diagnose an identifier as being a bogus part of the declarator instead of tripping over it. Improves diagnostics for cases like std::vector<const int *p> my_vec; llvm-svn: 186061
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Parse/ParseDecl.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp
index 7559aa95965..0b276d0b58f 100644
--- a/clang/lib/Parse/ParseDecl.cpp
+++ b/clang/lib/Parse/ParseDecl.cpp
@@ -4696,6 +4696,12 @@ void Parser::ParseDirectDeclarator(Declarator &D) {
D.SetIdentifier(Tok.getIdentifierInfo(), Tok.getLocation());
ConsumeToken();
goto PastIdentifier;
+ } else if (Tok.is(tok::identifier) && D.diagnoseIdentifier()) {
+ Diag(Tok.getLocation(), diag::err_unexpected_unqualified_id)
+ << FixItHint::CreateRemoval(Tok.getLocation());
+ D.SetIdentifier(0, Tok.getLocation());
+ ConsumeToken();
+ goto PastIdentifier;
}
if (Tok.is(tok::l_paren)) {
OpenPOWER on IntegriCloud