diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-10-02 22:49:11 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-10-02 22:49:11 +0000 |
commit | 97c7571ef3f958e6600f5768cf4f75404a09f0d3 (patch) | |
tree | 4bc2a9e9f7c767d17521669fa4711ad8cc2a9c30 /clang/tools/c-index-test/c-index-test.c | |
parent | 743bc472ac9a411838246581ec26ec74884fee2a (diff) | |
download | llvm-97c7571ef3f958e6600f5768cf4f75404a09f0d3.zip llvm-97c7571ef3f958e6600f5768cf4f75404a09f0d3.tar.gz llvm-97c7571ef3f958e6600f5768cf4f75404a09f0d3.tar.bz2 |
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.
llvm-svn: 115428
Diffstat (limited to 'clang/tools/c-index-test/c-index-test.c')
-rw-r--r-- | clang/tools/c-index-test/c-index-test.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/clang/tools/c-index-test/c-index-test.c b/clang/tools/c-index-test/c-index-test.c index f831622..9c5a67d 100644 --- a/clang/tools/c-index-test/c-index-test.c +++ b/clang/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)) |