aboutsummaryrefslogtreecommitdiff
path: root/tools/c-index-test/c-index-test.c
diff options
context:
space:
mode:
authorErik Verbruggen <erikjv@me.com>2011-10-14 15:31:08 +0000
committerErik Verbruggen <erikjv@me.com>2011-10-14 15:31:08 +0000
commit6164ea1d75385b6fc3c19e5ab9bb686298436a5a (patch)
tree93408352a553eb9fecd58404f4a18ff5676988a8 /tools/c-index-test/c-index-test.c
parent3a919e7110407ae7609bb6edc57aac16a5990661 (diff)
Added clang_getCompletionAnnotation and clang_getCompletionNumAnnotations to
retrieve annotations from completion string. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141953 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.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/tools/c-index-test/c-index-test.c b/tools/c-index-test/c-index-test.c
index 063c4adc90..2a3584b892 100644
--- a/tools/c-index-test/c-index-test.c
+++ b/tools/c-index-test/c-index-test.c
@@ -1033,6 +1033,7 @@ void print_completion_result(CXCompletionResult *completion_result,
CXClientData client_data) {
FILE *file = (FILE *)client_data;
CXString ks = clang_getCursorKindSpelling(completion_result->CursorKind);
+ unsigned annotationCount;
fprintf(file, "%s:", clang_getCString(ks));
clang_disposeString(ks);
@@ -1056,6 +1057,22 @@ void print_completion_result(CXCompletionResult *completion_result,
fprintf(file, " (inaccessible)");
break;
}
+
+ annotationCount = clang_getCompletionNumAnnotations(
+ completion_result->CompletionString);
+ if (annotationCount) {
+ unsigned i;
+ fprintf(file, " (");
+ for (i = 0; i < annotationCount; ++i) {
+ if (i != 0)
+ fprintf(file, ", ");
+ fprintf(file, "\"%s\"",
+ clang_getCString(clang_getCompletionAnnotation(
+ completion_result->CompletionString, i)));
+ }
+ fprintf(file, ")");
+ }
+
fprintf(file, "\n");
}