From 7c3c5bec07b9523a704bc7ba4bbb4e7995511b1c Mon Sep 17 00:00:00 2001 From: Nico Weber Date: Tue, 23 Sep 2014 04:09:56 +0000 Subject: Revert r197496, as it broke REVERTIBLE_TYPE_TRAITs from PCH files. Also add a test to make sure that this doesn't break again. Fixes PR21036. llvm-svn: 218292 --- clang/lib/Parse/Parser.cpp | 24 +++--------------------- 1 file changed, 3 insertions(+), 21 deletions(-) (limited to 'clang/lib/Parse/Parser.cpp') diff --git a/clang/lib/Parse/Parser.cpp b/clang/lib/Parse/Parser.cpp index 808e4266aee..6dcbaf6bb29 100644 --- a/clang/lib/Parse/Parser.cpp +++ b/clang/lib/Parse/Parser.cpp @@ -1431,34 +1431,16 @@ Parser::TryAnnotateName(bool IsAddressOfOperand, } bool Parser::TryKeywordIdentFallback(bool DisableKeyword) { - assert(!Tok.is(tok::identifier) && !Tok.isAnnotation()); + assert(Tok.isNot(tok::identifier)); Diag(Tok, diag::ext_keyword_as_ident) << PP.getSpelling(Tok) << DisableKeyword; - if (DisableKeyword) { - IdentifierInfo *II = Tok.getIdentifierInfo(); - ContextualKeywords[II] = Tok.getKind(); - II->RevertTokenIDToIdentifier(); - } + if (DisableKeyword) + Tok.getIdentifierInfo()->RevertTokenIDToIdentifier(); Tok.setKind(tok::identifier); return true; } -bool Parser::TryIdentKeywordUpgrade() { - assert(Tok.is(tok::identifier)); - const IdentifierInfo *II = Tok.getIdentifierInfo(); - assert(II->hasRevertedTokenIDToIdentifier()); - // If we find that this is in fact the name of a type trait, - // update the token kind in place and parse again to treat it as - // the appropriate kind of type trait. - llvm::SmallDenseMap::iterator Known = - ContextualKeywords.find(II); - if (Known == ContextualKeywords.end()) - return false; - Tok.setKind(Known->second); - return true; -} - /// TryAnnotateTypeOrScopeToken - If the current token position is on a /// typename (possibly qualified in C++) or a C++ scope specifier not followed /// by a typename, TryAnnotateTypeOrScopeToken will replace one or more tokens -- cgit v1.2.3