diff options
author | Chris Lattner <sabre@nondot.org> | 2009-01-05 01:24:05 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-01-05 01:24:05 +0000 |
commit | 7452c6fc567ea1799f617395d0fa4c7ed075e5d9 (patch) | |
tree | cf8673af65634475376dc897ff1e3b5352368993 /lib/Parse/Parser.cpp | |
parent | 835c909696ecd1e1f128297089d1def8d1a6f7cd (diff) |
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
Diffstat (limited to 'lib/Parse/Parser.cpp')
-rw-r--r-- | lib/Parse/Parser.cpp | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/lib/Parse/Parser.cpp b/lib/Parse/Parser.cpp index 02ddb6823f..16f0837240 100644 --- a/lib/Parse/Parser.cpp +++ b/lib/Parse/Parser.cpp @@ -747,10 +747,10 @@ Parser::OwningExprResult Parser::ParseSimpleAsm() { /// 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::TryAnnotateTypeOrScopeToken(const Token *GlobalQualifier) { 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)) |