/// [GNU] restrict
///
Parser::TPResult Parser::isCXXDeclarationSpecifier() {
- // Annotate typenames and C++ scope specifiers.
- TryAnnotateTypeOrScopeToken();
-
switch (Tok.getKind()) {
+ case tok::identifier: // foo::bar
+ // Annotate typenames and C++ scope specifiers. If we get one, just
+ // recurse to handle whatever we get.
+ if (TryAnnotateTypeOrScopeToken())
+ return isCXXDeclarationSpecifier();
+ // Otherwise, not a typename.
+ return TPResult::False();
+
+ case tok::coloncolon: // ::foo::bar
+ if (NextToken().is(tok::kw_new) || // ::new
+ NextToken().is(tok::kw_delete)) // ::delete
+ return TPResult::False();
+
+ // Annotate typenames and C++ scope specifiers. If we get one, just
+ // recurse to handle whatever we get.
+ if (TryAnnotateTypeOrScopeToken())
+ return isCXXDeclarationSpecifier();
+ // Otherwise, not a typename.
+ return TPResult::False();
+
// decl-specifier:
// storage-class-specifier
// type-specifier