eliminate string compares when checking for the 'defined' token.
llvm-svn: 39216
This commit is contained in:
parent
c5b966f893
commit
2bb8a95389
|
@ -67,7 +67,7 @@ static bool EvaluateValue(int &Result, LexerToken &PeekTok, DefinedTracker &DT,
|
|||
if (IdentifierInfo *II = PeekTok.getIdentifierInfo()) {
|
||||
// If this identifier isn't 'defined' and it wasn't macro expanded, it turns
|
||||
// into a simple 0.
|
||||
if (strcmp(II->getName(), "defined")) {
|
||||
if (II->getPPKeywordID() != tok::pp_defined) {
|
||||
Result = 0;
|
||||
PP.LexNonComment(PeekTok);
|
||||
return false;
|
||||
|
|
|
@ -1087,8 +1087,7 @@ void Preprocessor::ReadMacroName(LexerToken &MacroNameTok, char isDefineUndef) {
|
|||
} else if (0) {
|
||||
// FIXME: C++. Error if defining a C++ named operator.
|
||||
|
||||
} else if (isDefineUndef && II->getName()[0] == 'd' && // defined
|
||||
!strcmp(II->getName()+1, "efined")) {
|
||||
} else if (isDefineUndef && II->getPPKeywordID() == tok::pp_defined) {
|
||||
// Error if defining "defined": C99 6.10.8.4.
|
||||
Diag(MacroNameTok, diag::err_defined_macro_name);
|
||||
} else if (isDefineUndef && II->getMacroInfo() &&
|
||||
|
|
|
@ -51,6 +51,7 @@ PPKEYWORD(ifndef)
|
|||
PPKEYWORD(elif)
|
||||
PPKEYWORD(else)
|
||||
PPKEYWORD(endif)
|
||||
PPKEYWORD(defined)
|
||||
|
||||
// C99 6.10.2 - Source File Inclusion.
|
||||
PPKEYWORD(include)
|
||||
|
|
Loading…
Reference in New Issue