diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-03-18 18:23:03 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-03-18 18:23:03 +0000 |
commit | bf7efa2742dc94363d3561d284c9d634fc5a780f (patch) | |
tree | 9f62afe36a87f534f78183838c26cc904c9b1a73 /lib/Lex/PreprocessingRecord.cpp | |
parent | 572feb2a190b5e8b04fb06c4ac50ee0f61e93ff0 (diff) |
Explicitly link macro instantiations to macro definitions in the
preprocessing record. Use that link with clang_getCursorReferenced()
and clang_getCursorDefinition() to match instantiations of a macro to
the definition of the macro.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98842 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Lex/PreprocessingRecord.cpp')
-rw-r--r-- | lib/Lex/PreprocessingRecord.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/Lex/PreprocessingRecord.cpp b/lib/Lex/PreprocessingRecord.cpp index fe081b69bb..3e0a03b74f 100644 --- a/lib/Lex/PreprocessingRecord.cpp +++ b/lib/Lex/PreprocessingRecord.cpp @@ -26,12 +26,14 @@ void PopulatePreprocessingRecord::MacroExpands(const Token &Id, Record.addPreprocessedEntity( new (Record) MacroInstantiation(Id.getIdentifierInfo(), Id.getLocation(), - MI->getDefinitionLoc())); + MacroDefinitions[MI])); } void PopulatePreprocessingRecord::MacroDefined(const IdentifierInfo *II, const MacroInfo *MI) { SourceRange R(MI->getDefinitionLoc(), MI->getDefinitionEndLoc()); - Record.addPreprocessedEntity( - new (Record) MacroDefinition(II, MI->getDefinitionLoc(), R)); + MacroDefinition *Def + = new (Record) MacroDefinition(II, MI->getDefinitionLoc(), R); + MacroDefinitions[MI] = Def; + Record.addPreprocessedEntity(Def); } |