aboutsummaryrefslogtreecommitdiff
path: root/include/clang/Lex
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2013-01-18 20:59:01 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2013-01-18 20:59:01 +0000
commitf953276b6165dc7e8f4679cce4d0e7c649cd4232 (patch)
treee44223a276407d349f886ece8bb4eccdd1eba122 /include/clang/Lex
parent55fc3a767b9945bd1f311f2339dcaa8761da5661 (diff)
[PCH/Modules] Re-apply r172620 and r172629, now with 100% less infinite loops!
Makes sure that a deserialized macro is only added to the preprocessor macro definitions only once. Unfortunately I couldn't get a reduced test case. rdar://13016031 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172843 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Lex')
-rw-r--r--include/clang/Lex/MacroInfo.h8
-rw-r--r--include/clang/Lex/Preprocessor.h3
2 files changed, 9 insertions, 2 deletions
diff --git a/include/clang/Lex/MacroInfo.h b/include/clang/Lex/MacroInfo.h
index aeedd735e3..c6b44a9422 100644
--- a/include/clang/Lex/MacroInfo.h
+++ b/include/clang/Lex/MacroInfo.h
@@ -169,6 +169,14 @@ public:
/// \brief Get previous definition of the macro with the same name.
MacroInfo *getPreviousDefinition() { return PreviousDefinition; }
+ /// \brief Get the first definition in the chain.
+ MacroInfo *getFirstDefinition() {
+ MacroInfo *MI = this;
+ while (MI->PreviousDefinition)
+ MI = MI->PreviousDefinition;
+ return MI;
+ }
+
/// \brief Find macro definition active in the specified source location. If
/// this macro was not defined there, return NULL.
const MacroInfo *findDefinitionAtLoc(SourceLocation L,
diff --git a/include/clang/Lex/Preprocessor.h b/include/clang/Lex/Preprocessor.h
index 24b6a18881..faaec3517d 100644
--- a/include/clang/Lex/Preprocessor.h
+++ b/include/clang/Lex/Preprocessor.h
@@ -533,8 +533,7 @@ public:
/// \brief Specify a macro for this identifier.
void setMacroInfo(IdentifierInfo *II, MacroInfo *MI);
/// \brief Add a MacroInfo that was loaded from an AST file.
- void addLoadedMacroInfo(IdentifierInfo *II, MacroInfo *MI,
- MacroInfo *Hint = 0);
+ void addLoadedMacroInfo(IdentifierInfo *II, MacroInfo *MI);
/// \brief Make the given MacroInfo, that was loaded from an AST file and
/// previously hidden, visible.
void makeLoadedMacroInfoVisible(IdentifierInfo *II, MacroInfo *MI);