]> granicus.if.org Git - clang/commitdiff
add a hasMacroDefinition() method to IdentifierInfo, strength reduce a
authorChris Lattner <sabre@nondot.org>
Sun, 7 Oct 2007 07:57:27 +0000 (07:57 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 7 Oct 2007 07:57:27 +0000 (07:57 +0000)
call to getMacroInfo to call it.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42725 91177308-0d34-0410-b5e6-96231b3b80d8

Lex/HeaderSearch.cpp
include/clang/Lex/IdentifierTable.h

index 96c86939b77d8ab57a0229bd53d6aa24eae7ebef..00a36eef63456320a5f7edfb3f7b77c234d14df8 100644 (file)
@@ -329,7 +329,8 @@ bool HeaderSearch::ShouldEnterIncludeFile(const FileEntry *File, bool isImport){
   
   // 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;
   }
index 44565a33950ddee4fb51b1234ee741c1a8f32d7a..a4d10e56e9f4d64daa6d16a5844fe42a95464d45 100644 (file)
@@ -70,6 +70,12 @@ public:
                     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 {