summaryrefslogtreecommitdiffstats
path: root/clang/tools/CIndex/CIndex.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-03-18 18:23:03 +0000
committerDouglas Gregor <dgregor@apple.com>2010-03-18 18:23:03 +0000
commit78ae2481b650a67e243569609fa681d11daf741f (patch)
tree69616fed5394562ff0fb652d89eb732cecf3843f /clang/tools/CIndex/CIndex.cpp
parent1a5bea2017c66b5c3fec23e76e3e3ed57c750c6b (diff)
downloadbcm5719-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/tools/CIndex/CIndex.cpp')
-rw-r--r--clang/tools/CIndex/CIndex.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/tools/CIndex/CIndex.cpp b/clang/tools/CIndex/CIndex.cpp
index ce2188550bd..47d156c6ceb 100644
--- a/clang/tools/CIndex/CIndex.cpp
+++ b/clang/tools/CIndex/CIndex.cpp
@@ -1765,6 +1765,11 @@ CXCursor clang_getCursorReferenced(CXCursor C) {
return clang_getNullCursor();
}
+ if (C.kind == CXCursor_MacroInstantiation) {
+ if (MacroDefinition *Def = getCursorMacroInstantiation(C)->getDefinition())
+ return MakeMacroDefinitionCursor(Def, CXXUnit);
+ }
+
if (!clang_isReference(C.kind))
return clang_getNullCursor();
@@ -1803,6 +1808,9 @@ CXCursor clang_getCursorDefinition(CXCursor C) {
WasReference = true;
}
+ if (C.kind == CXCursor_MacroInstantiation)
+ return clang_getCursorReferenced(C);
+
if (!clang_isDeclaration(C.kind))
return clang_getNullCursor();
OpenPOWER on IntegriCloud