]> granicus.if.org Git - clang/commitdiff
Add initial USR support for macro definitions.
authorTed Kremenek <kremenek@apple.com>
Sun, 11 Apr 2010 22:20:34 +0000 (22:20 +0000)
committerTed Kremenek <kremenek@apple.com>
Sun, 11 Apr 2010 22:20:34 +0000 (22:20 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100997 91177308-0d34-0410-b5e6-96231b3b80d8

tools/CIndex/CIndexUSRs.cpp

index a2cb0402820c8df4c7873381d063a2f8d1583802..a2be617d8a883b61c8f11de41ef329732c855cac 100644 (file)
@@ -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("");
 }