diff options
author | Chris Lattner <sabre@nondot.org> | 2008-12-13 20:12:40 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2008-12-13 20:12:40 +0000 |
commit | 77c76ae3deed9cf2ac8a4f5ce46abc6e2fa1604a (patch) | |
tree | 6f89d86b015f9696339c4df71dab43f726ec1791 /clang/lib/Lex/PPDirectives.cpp | |
parent | 1c89be021632e5f119dd584d8a5273a2603644ee (diff) | |
download | bcm5719-llvm-77c76ae3deed9cf2ac8a4f5ce46abc6e2fa1604a.tar.gz bcm5719-llvm-77c76ae3deed9cf2ac8a4f5ce46abc6e2fa1604a.zip |
eliminate the isCXXNamedOperator function and some string compares and
use identifierinfo instead. Patch by Chris Goller!
llvm-svn: 60992
Diffstat (limited to 'clang/lib/Lex/PPDirectives.cpp')
-rw-r--r-- | clang/lib/Lex/PPDirectives.cpp | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/clang/lib/Lex/PPDirectives.cpp b/clang/lib/Lex/PPDirectives.cpp index 300ec0bb756..0e4dc9f34e7 100644 --- a/clang/lib/Lex/PPDirectives.cpp +++ b/clang/lib/Lex/PPDirectives.cpp @@ -31,13 +31,6 @@ void Preprocessor::DiscardUntilEndOfDirective() { } while (Tmp.isNot(tok::eom)); } -/// isCXXNamedOperator - Returns "true" if the token is a named operator in C++. -static bool isCXXNamedOperator(const std::string &Spelling) { - return Spelling == "and" || Spelling == "bitand" || Spelling == "bitor" || - Spelling == "compl" || Spelling == "not" || Spelling == "not_eq" || - Spelling == "or" || Spelling == "xor"; -} - /// ReadMacroName - Lex and validate a macro name, which occurs after a /// #define or #undef. This sets the token kind to eom and discards the rest /// of the macro line if the macro name is invalid. isDefineUndef is 1 if @@ -56,7 +49,8 @@ void Preprocessor::ReadMacroName(Token &MacroNameTok, char isDefineUndef) { IdentifierInfo *II = MacroNameTok.getIdentifierInfo(); if (II == 0) { std::string Spelling = getSpelling(MacroNameTok); - if (isCXXNamedOperator(Spelling)) + const IdentifierInfo &Info = Identifiers.get(Spelling); + if (Info.isCPlusPlusOperatorKeyword()) // C++ 2.5p2: Alternative tokens behave the same as its primary token // except for their spellings. Diag(MacroNameTok, diag::err_pp_operator_used_as_macro_name) << Spelling; |