TryAnnotateTypeOrScopeToken and TryAnnotateCXXScopeToken can
only be called when they might be needed now, so make them assert
that their current token is :: or identifier.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61662 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Parse/Parser.cpp b/lib/Parse/Parser.cpp
index 02ddb68..16f0837 100644
--- a/lib/Parse/Parser.cpp
+++ b/lib/Parse/Parser.cpp
@@ -747,10 +747,10 @@
/// Note that this routine emits an error if you call it with ::new or ::delete
/// as the current tokens, so only call it in contexts where these are invalid.
bool Parser::TryAnnotateTypeOrScopeToken(const Token *GlobalQualifier) {
- // FIXME: what about template-ids?
- if (Tok.is(tok::annot_qualtypename) || Tok.is(tok::annot_cxxscope))
- return false;
-
+ assert((Tok.is(tok::identifier) || Tok.is(tok::coloncolon)) &&
+ "Cannot be a type or scope token!");
+
+ // FIXME: Implement template-ids
CXXScopeSpec SS;
if (getLang().CPlusPlus)
MaybeParseCXXScopeSpecifier(SS, GlobalQualifier);
@@ -818,9 +818,8 @@
bool Parser::TryAnnotateCXXScopeToken() {
assert(getLang().CPlusPlus &&
"Call sites of this function should be guarded by checking for C++");
-
- if (Tok.is(tok::annot_cxxscope))
- return false;
+ assert((Tok.is(tok::identifier) || Tok.is(tok::coloncolon)) &&
+ "Cannot be a type or scope token!");
CXXScopeSpec SS;
if (!MaybeParseCXXScopeSpecifier(SS))