diff options
author | Chris Lattner <sabre@nondot.org> | 2007-10-07 07:57:27 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2007-10-07 07:57:27 +0000 |
commit | d7b971bf3de3f2fe3dca498d25badd4c0b1763eb (patch) | |
tree | 7f8f5c4dc2f9c6af2e473262db922b9656d2ec3f | |
parent | f49523d6eac4d5611f1f35d9b1e291fef2424348 (diff) | |
download | bcm5719-llvm-d7b971bf3de3f2fe3dca498d25badd4c0b1763eb.tar.gz bcm5719-llvm-d7b971bf3de3f2fe3dca498d25badd4c0b1763eb.zip |
add a hasMacroDefinition() method to IdentifierInfo, strength reduce a
call to getMacroInfo to call it.
llvm-svn: 42725
-rw-r--r-- | clang/Lex/HeaderSearch.cpp | 3 | ||||
-rw-r--r-- | clang/include/clang/Lex/IdentifierTable.h | 6 |
2 files changed, 8 insertions, 1 deletions
diff --git a/clang/Lex/HeaderSearch.cpp b/clang/Lex/HeaderSearch.cpp index 96c86939b77..00a36eef634 100644 --- a/clang/Lex/HeaderSearch.cpp +++ b/clang/Lex/HeaderSearch.cpp @@ -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; } diff --git a/clang/include/clang/Lex/IdentifierTable.h b/clang/include/clang/Lex/IdentifierTable.h index 44565a33950..a4d10e56e9f 100644 --- a/clang/include/clang/Lex/IdentifierTable.h +++ b/clang/include/clang/Lex/IdentifierTable.h @@ -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 { |