aboutsummaryrefslogtreecommitdiff
path: root/tools/c-index-test/c-index-test.c
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-10-02 22:49:11 +0000
committerDouglas Gregor <dgregor@apple.com>2010-10-02 22:49:11 +0000
commit358559d8d7b458c5f64941842383a16e61f0828d (patch)
tree60b1e6e49cfa4d1d7e57476eabe74c2c7cb01212 /tools/c-index-test/c-index-test.c
parent3f0fee315cbfa37e0c47904836948e9d0cca9eda (diff)
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
Diffstat (limited to 'tools/c-index-test/c-index-test.c')
-rw-r--r--tools/c-index-test/c-index-test.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/tools/c-index-test/c-index-test.c b/tools/c-index-test/c-index-test.c
index f83162295d..9c5a67d304 100644
--- a/tools/c-index-test/c-index-test.c
+++ b/tools/c-index-test/c-index-test.c
@@ -156,6 +156,8 @@ int parse_remapped_files(int argc, const char **argv, int start_arg,
/* 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 @@ static void PrintCursor(CXCursor Cursor) {
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 @@ static int perform_test_load(CXIndex Idx, CXTranslationUnit TU,
/* 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 perform_test_load_source(int argc, const char **argv,
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))