aboutsummaryrefslogtreecommitdiff
path: root/clang/tools/c-index-test/c-index-test.c
diff options
context:
space:
mode:
authorEgor Zhdan <e_zhdan@apple.com>2022-10-31 15:46:43 -0700
committerEgor Zhdan <e_zhdan@apple.com>2022-11-10 16:16:36 -0800
commit97105e5bf70fae5d9902081e917fd178b57f1717 (patch)
tree69abfc900d49fe1402fc69aeb0769e7e96fc0ffc /clang/tools/c-index-test/c-index-test.c
parent48321eea9679e1d8c5a30f4027e1aa49738aebf3 (diff)
downloadllvm-97105e5bf70fae5d9902081e917fd178b57f1717.zip
llvm-97105e5bf70fae5d9902081e917fd178b57f1717.tar.gz
llvm-97105e5bf70fae5d9902081e917fd178b57f1717.tar.bz2
[libclang] Expose completion result kind in `CXCompletionResult`
This allows clients of libclang to check whether a completion result is a keyword. Previously, keywords had `CursorKind == CXCursor_NotImplemented` and it wasn't trivial to distinguish a keyword from a pattern. This change moves `CodeCompletionResult::ResultKind` to `clang-c` under a new name `CXCompletionResultKind`. It also tweaks `c-index-test` to print the result kind instead of `NotImplemented`, and adjusts the tests for the new output. rdar://91852088 Differential Revision: https://reviews.llvm.org/D136844
Diffstat (limited to 'clang/tools/c-index-test/c-index-test.c')
-rw-r--r--clang/tools/c-index-test/c-index-test.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/clang/tools/c-index-test/c-index-test.c b/clang/tools/c-index-test/c-index-test.c
index 108b445..4d49dfa 100644
--- a/clang/tools/c-index-test/c-index-test.c
+++ b/clang/tools/c-index-test/c-index-test.c
@@ -2512,7 +2512,10 @@ static void print_completion_result(CXTranslationUnit translation_unit,
unsigned index,
FILE *file) {
CXCompletionResult *completion_result = completion_results->Results + index;
- CXString ks = clang_getCursorKindSpelling(completion_result->CursorKind);
+ CXString ks =
+ completion_result->CursorKind == CXCursor_NotImplemented
+ ? clang_getCompletionResultKindSpelling(completion_result->ResultKind)
+ : clang_getCursorKindSpelling(completion_result->CursorKind);
unsigned annotationCount;
enum CXCursorKind ParentKind;
CXString ParentName;