[cfe-commits] r100997 - /cfe/trunk/tools/CIndex/CIndexUSRs.cpp

Ted Kremenek kremenek at apple.com
Sun Apr 11 15:20:34 PDT 2010


Author: kremenek
Date: Sun Apr 11 17:20:34 2010
New Revision: 100997

URL: http://llvm.org/viewvc/llvm-project?rev=100997&view=rev
Log:
Add initial USR support for macro definitions.

Modified:
    cfe/trunk/tools/CIndex/CIndexUSRs.cpp

Modified: cfe/trunk/tools/CIndex/CIndexUSRs.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/CIndex/CIndexUSRs.cpp?rev=100997&r1=100996&r2=100997&view=diff
==============================================================================
--- cfe/trunk/tools/CIndex/CIndexUSRs.cpp (original)
+++ cfe/trunk/tools/CIndex/CIndexUSRs.cpp Sun Apr 11 17:20:34 2010
@@ -281,8 +281,18 @@
 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("");
 }
 





More information about the cfe-commits mailing list