aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2010-04-11 22:20:34 +0000
committerTed Kremenek <kremenek@apple.com>2010-04-11 22:20:34 +0000
commitfa8231dae543924399428db2d1364eb6eed29fee (patch)
treee0965224825c73ed9e657a564995f175a8abec1b
parentc3ef91d784a08efbda6fac063215a163552a8e75 (diff)
Add initial USR support for macro definitions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100997 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--tools/CIndex/CIndexUSRs.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/tools/CIndex/CIndexUSRs.cpp b/tools/CIndex/CIndexUSRs.cpp
index a2cb040282..a2be617d8a 100644
--- a/tools/CIndex/CIndexUSRs.cpp
+++ b/tools/CIndex/CIndexUSRs.cpp
@@ -281,8 +281,18 @@ static CXString getDeclCursorUSR(const CXCursor &C) {
extern "C" {
CXString clang_getCursorUSR(CXCursor C) {
- if (clang_isDeclaration(clang_getCursorKind(C)))
+ const CXCursorKind &K = clang_getCursorKind(C);
+
+ if (clang_isDeclaration(K))
return getDeclCursorUSR(C);
+
+ if (K == CXCursor_MacroDefinition) {
+ StringUSRGenerator SUG;
+ SUG << "macro@"
+ << cxcursor::getCursorMacroDefinition(C)->getName()->getNameStart();
+ return createCXString(SUG.str(), true);
+ }
+
return createCXString("");
}