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 | 78ae2481b650a67e243569609fa681d11daf741f (patch) | |
tree | 69616fed5394562ff0fb652d89eb732cecf3843f /clang/lib/Lex/PreprocessingRecord.cpp | |
parent | 1a5bea2017c66b5c3fec23e76e3e3ed57c750c6b (diff) | |
download | bcm5719-llvm-78ae2481b650a67e243569609fa681d11daf741f.tar.gz bcm5719-llvm-78ae2481b650a67e243569609fa681d11daf741f.zip |
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.
llvm-svn: 98842
Diffstat (limited to 'clang/lib/Lex/PreprocessingRecord.cpp')
-rw-r--r-- | clang/lib/Lex/PreprocessingRecord.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/clang/lib/Lex/PreprocessingRecord.cpp b/clang/lib/Lex/PreprocessingRecord.cpp index fe081b69bbb..3e0a03b74f8 100644 --- a/clang/lib/Lex/PreprocessingRecord.cpp +++ b/clang/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); } |