[cfe-commits] r42725 - in /cfe/trunk: Lex/HeaderSearch.cpp include/clang/Lex/IdentifierTable.h

Chris Lattner sabre at nondot.org
Sun Oct 7 00:57:27 PDT 2007


Author: lattner
Date: Sun Oct  7 02:57:27 2007
New Revision: 42725

URL: http://llvm.org/viewvc/llvm-project?rev=42725&view=rev
Log:
add a hasMacroDefinition() method to IdentifierInfo, strength reduce a
call to getMacroInfo to call it.

Modified:
    cfe/trunk/Lex/HeaderSearch.cpp
    cfe/trunk/include/clang/Lex/IdentifierTable.h

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

==============================================================================
--- cfe/trunk/Lex/HeaderSearch.cpp (original)
+++ cfe/trunk/Lex/HeaderSearch.cpp Sun Oct  7 02:57:27 2007
@@ -329,7 +329,8 @@
   
   // Next, check to see if the file is wrapped with #ifndef guards.  If so, and
   // if the macro that guards it is defined, we know the #include has no effect.
-  if (FileInfo.ControllingMacro && FileInfo.ControllingMacro->getMacroInfo()) {
+  if (FileInfo.ControllingMacro &&
+      FileInfo.ControllingMacro->hasMacroDefinition()) {
     ++NumMultiIncludeFileOptzn;
     return false;
   }

Modified: cfe/trunk/include/clang/Lex/IdentifierTable.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Lex/IdentifierTable.h?rev=42725&r1=42724&r2=42725&view=diff

==============================================================================
--- cfe/trunk/include/clang/Lex/IdentifierTable.h (original)
+++ cfe/trunk/include/clang/Lex/IdentifierTable.h Sun Oct  7 02:57:27 2007
@@ -70,6 +70,12 @@
                     GetStringMapEntryFromValue(*this).getKeyLength();
   }
   
+  /// hasMacroDefinition - Return true if this identifier is #defined to some
+  /// other value.
+  bool hasMacroDefinition() const {
+    return HasMacro;
+  }
+  
   /// getMacroInfo - Return macro information about this identifier, or null if
   /// it is not a macro.
   MacroInfo *getMacroInfo() const {





More information about the cfe-commits mailing list