diff options
author | Chris Lattner <sabre@nondot.org> | 2007-10-07 08:04:56 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2007-10-07 08:04:56 +0000 |
commit | 0edde55077cc3cb9fffeba19f5936f05a68c8e2b (patch) | |
tree | 1720ab38e92d73fba41b8f3195f55f6c1831e1b6 | |
parent | 9c46de446d18f4a28446cb798d4131bd05515699 (diff) |
change calls to getMacroInfo into hasMacroDefinition() where possible.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42726 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | Lex/PPExpressions.cpp | 9 | ||||
-rw-r--r-- | Lex/Pragma.cpp | 2 | ||||
-rw-r--r-- | Lex/Preprocessor.cpp | 6 |
3 files changed, 9 insertions, 8 deletions
diff --git a/Lex/PPExpressions.cpp b/Lex/PPExpressions.cpp index 2a18cfd610..fb745068fd 100644 --- a/Lex/PPExpressions.cpp +++ b/Lex/PPExpressions.cpp @@ -100,17 +100,18 @@ static bool EvaluateValue(llvm::APSInt &Result, Token &PeekTok, } // Otherwise, we got an identifier, is it defined to something? - Result = II->getMacroInfo() != 0; + Result = II->hasMacroDefinition(); Result.setIsUnsigned(false); // Result is signed intmax_t. // If there is a macro, mark it used. if (Result != 0 && ValueLive) { - II->getMacroInfo()->setIsUsed(true); + MacroInfo *Macro = II->getMacroInfo(); + Macro->setIsUsed(true); // If this is the first use of a target-specific macro, warn about it. - if (II->getMacroInfo()->isTargetSpecific()) { + if (Macro->isTargetSpecific()) { // Don't warn on second use. - II->getMacroInfo()->setIsTargetSpecific(false); + Macro->setIsTargetSpecific(false); PP.getTargetInfo().DiagnoseNonPortability(PeekTok.getLocation(), diag::port_target_macro_use); } diff --git a/Lex/Pragma.cpp b/Lex/Pragma.cpp index 4d90e31c64..89725ae8e9 100644 --- a/Lex/Pragma.cpp +++ b/Lex/Pragma.cpp @@ -210,7 +210,7 @@ void Preprocessor::HandlePragmaPoison(Token &PoisonTok) { if (II->isPoisoned()) continue; // If this is a macro identifier, emit a warning. - if (II->getMacroInfo()) + if (II->hasMacroDefinition()) Diag(Tok, diag::pp_poisoning_existing_macro); // Finally, poison it! diff --git a/Lex/Preprocessor.cpp b/Lex/Preprocessor.cpp index f43eae1c98..2d53fe7915 100644 --- a/Lex/Preprocessor.cpp +++ b/Lex/Preprocessor.cpp @@ -533,7 +533,7 @@ static bool isTrivialSingleTokenExpansion(const MacroInfo *MI, // If the identifier is a macro, and if that macro is enabled, it may be // expanded so it's not a trivial expansion. - if (II->getMacroInfo() && II->getMacroInfo()->isEnabled() && + if (II->hasMacroDefinition() && II->getMacroInfo()->isEnabled() && // Fast expanding "#define X X" is ok, because X would be disabled. II != MacroIdent) return false; @@ -1116,7 +1116,7 @@ bool Preprocessor::HandleEndOfFile(Token &Result, bool isEndOfMacro) { for (IdentifierTable::iterator I = Identifiers.begin(), E = Identifiers.end(); I != E; ++I) { const IdentifierInfo &II = I->getValue(); - if (II.getMacroInfo() && !II.getMacroInfo()->isUsed()) + if (II.hasMacroDefinition() && !II.getMacroInfo()->isUsed()) Diag(II.getMacroInfo()->getDefinitionLoc(), diag::pp_macro_not_used); } } @@ -1188,7 +1188,7 @@ void Preprocessor::ReadMacroName(Token &MacroNameTok, char isDefineUndef) { } 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() && + } else if (isDefineUndef && II->hasMacroDefinition() && II->getMacroInfo()->isBuiltinMacro()) { // Error if defining "__LINE__" and other builtins: C99 6.10.8.4. if (isDefineUndef == 1) |