Parse: Don't crash when 'typename' shows up in an attribute
isDeclarationSpecifier performs error recovers which jostles the token
stream. Specifically, TryAnnotateTypeOrScopeToken will end up consuming
a typename token which will confuse the attribute parsing machinery as
we no-longer have something identifier-like.
llvm-svn: 224903
diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp
index 64665fc2..c0c0d59 100644
--- a/clang/lib/Parse/ParseDecl.cpp
+++ b/clang/lib/Parse/ParseDecl.cpp
@@ -143,7 +143,8 @@
continue;
// Expect an identifier or declaration specifier (const, int, etc.)
- if (Tok.isNot(tok::identifier) && !isDeclarationSpecifier())
+ if (Tok.isNot(tok::identifier) && !isTypeQualifier() &&
+ !isKnownToBeTypeSpecifier(Tok))
break;
IdentifierInfo *AttrName = Tok.getIdentifierInfo();