[cfe-commits] r60992 - /cfe/trunk/lib/Lex/PPDirectives.cpp
Chris Lattner
sabre at nondot.org
Sat Dec 13 12:12:40 PST 2008
Author: lattner
Date: Sat Dec 13 14:12:40 2008
New Revision: 60992
URL: http://llvm.org/viewvc/llvm-project?rev=60992&view=rev
Log:
eliminate the isCXXNamedOperator function and some string compares and
use identifierinfo instead. Patch by Chris Goller!
Modified:
cfe/trunk/lib/Lex/PPDirectives.cpp
Modified: cfe/trunk/lib/Lex/PPDirectives.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/PPDirectives.cpp?rev=60992&r1=60991&r2=60992&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/PPDirectives.cpp (original)
+++ cfe/trunk/lib/Lex/PPDirectives.cpp Sat Dec 13 14:12:40 2008
@@ -31,13 +31,6 @@
} 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 @@
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;
More information about the cfe-commits
mailing list