Introduce a new libclang function, clang_getCursorDisplayName(), which
produces a simple "display" name that captures the
arguments/parameters for a function, function template, class
template, or class template specialization.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@115428 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/c-index-test/c-index-test.c b/tools/c-index-test/c-index-test.c
index f831622..9c5a67d 100644
--- a/tools/c-index-test/c-index-test.c
+++ b/tools/c-index-test/c-index-test.c
@@ -156,6 +156,8 @@
 /* Pretty-printing.                                                           */
 /******************************************************************************/
 
+int want_display_name = 0;
+
 static void PrintCursor(CXCursor Cursor) {
   if (clang_isInvalid(Cursor.kind)) {
     CXString ks = clang_getCursorKindSpelling(Cursor.kind);
@@ -171,7 +173,8 @@
     unsigned num_overridden;
 
     ks = clang_getCursorKindSpelling(Cursor.kind);
-    string = clang_getCursorSpelling(Cursor);
+    string = want_display_name? clang_getCursorDisplayName(Cursor) 
+                              : clang_getCursorSpelling(Cursor);
     printf("%s=%s", clang_getCString(ks),
                     clang_getCString(string));
     clang_disposeString(ks);
@@ -604,6 +607,11 @@
 
     /* Perform some simple filtering. */
     if (!strcmp(filter, "all") || !strcmp(filter, "local")) ck = NULL;
+    else if (!strcmp(filter, "all-display") || 
+             !strcmp(filter, "local-display")) {
+      ck = NULL;
+      want_display_name = 1;
+    }
     else if (!strcmp(filter, "none")) K = (enum CXCursorKind) ~0;
     else if (!strcmp(filter, "category")) K = CXCursor_ObjCCategoryDecl;
     else if (!strcmp(filter, "interface")) K = CXCursor_ObjCInterfaceDecl;
@@ -661,7 +669,8 @@
   int result;
   
   Idx = clang_createIndex(/* excludeDeclsFromPCH */
-                          !strcmp(filter, "local") ? 1 : 0,
+                          (!strcmp(filter, "local") || 
+                           !strcmp(filter, "local-display"))? 1 : 0,
                           /* displayDiagnosics=*/1);
 
   if (UseExternalASTs && strlen(UseExternalASTs))