diff options
-rw-r--r-- | tools/CIndex/CIndexUSRs.cpp | 12 |
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(""); } |