[cfe-commits] r42726 - in /cfe/trunk/Lex: PPExpressions.cpp Pragma.cpp Preprocessor.cpp

Chris Lattner sabre at nondot.org
Sun Oct 7 01:04:57 PDT 2007


Author: lattner
Date: Sun Oct  7 03:04:56 2007
New Revision: 42726

URL: http://llvm.org/viewvc/llvm-project?rev=42726&view=rev
Log:
change calls to getMacroInfo into hasMacroDefinition() where possible.

Modified:
    cfe/trunk/Lex/PPExpressions.cpp
    cfe/trunk/Lex/Pragma.cpp
    cfe/trunk/Lex/Preprocessor.cpp

Modified: cfe/trunk/Lex/PPExpressions.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Lex/PPExpressions.cpp?rev=42726&r1=42725&r2=42726&view=diff

==============================================================================
--- cfe/trunk/Lex/PPExpressions.cpp (original)
+++ cfe/trunk/Lex/PPExpressions.cpp Sun Oct  7 03:04:56 2007
@@ -100,17 +100,18 @@
     }
     
     // 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);
       }

Modified: cfe/trunk/Lex/Pragma.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Lex/Pragma.cpp?rev=42726&r1=42725&r2=42726&view=diff

==============================================================================
--- cfe/trunk/Lex/Pragma.cpp (original)
+++ cfe/trunk/Lex/Pragma.cpp Sun Oct  7 03:04:56 2007
@@ -210,7 +210,7 @@
     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!

Modified: cfe/trunk/Lex/Preprocessor.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Lex/Preprocessor.cpp?rev=42726&r1=42725&r2=42726&view=diff

==============================================================================
--- cfe/trunk/Lex/Preprocessor.cpp (original)
+++ cfe/trunk/Lex/Preprocessor.cpp Sun Oct  7 03:04:56 2007
@@ -533,7 +533,7 @@
   
   // 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 @@
     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 @@
   } 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)





More information about the cfe-commits mailing list