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 | 9c46de446d18f4a28446cb798d4131bd05515699 (patch) | |
tree | 336f7733ff699e5da458d09aec7b5bbcf349a0c1 | |
parent | 6d9a3e648d6bf6b347174152f191bd1377528f8c (diff) |
add a hasMacroDefinition() method to IdentifierInfo, strength reduce a
call to getMacroInfo to call it.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42725 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | Lex/HeaderSearch.cpp | 3 | ||||
-rw-r--r-- | include/clang/Lex/IdentifierTable.h | 6 |
2 files changed, 8 insertions, 1 deletions
diff --git a/Lex/HeaderSearch.cpp b/Lex/HeaderSearch.cpp index 96c86939b7..00a36eef63 100644 --- a/Lex/HeaderSearch.cpp +++ b/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/include/clang/Lex/IdentifierTable.h b/include/clang/Lex/IdentifierTable.h index 44565a3395..a4d10e56e9 100644 --- a/include/clang/Lex/IdentifierTable.h +++ b/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 { |