From: Ted Kremenek Date: Sun, 11 Apr 2010 22:20:34 +0000 (+0000) Subject: Add initial USR support for macro definitions. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fa8231dae543924399428db2d1364eb6eed29fee;p=clang Add initial USR support for macro definitions. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100997 91177308-0d34-0410-b5e6-96231b3b80d8 --- 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(""); }