[clang] 97105e5 - [libclang] Expose completion result kind in `CXCompletionResult`

Egor Zhdan via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 10 16:16:43 PST 2022


Author: Egor Zhdan
Date: 2022-11-10T16:16:36-08:00
New Revision: 97105e5bf70fae5d9902081e917fd178b57f1717

URL: https://github.com/llvm/llvm-project/commit/97105e5bf70fae5d9902081e917fd178b57f1717
DIFF: https://github.com/llvm/llvm-project/commit/97105e5bf70fae5d9902081e917fd178b57f1717.diff

LOG: [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

Added: 
    

Modified: 
    clang/include/clang-c/Index.h
    clang/test/Index/arc-complete.m
    clang/test/Index/code-completion.cpp
    clang/test/Index/complete-at-directives.m
    clang/test/Index/complete-at-exprstmt.m
    clang/test/Index/complete-declarators.cpp
    clang/test/Index/complete-declarators.m
    clang/test/Index/complete-exprs.c
    clang/test/Index/complete-exprs.cpp
    clang/test/Index/complete-exprs.m
    clang/test/Index/complete-lambdas.cpp
    clang/test/Index/complete-lambdas.mm
    clang/test/Index/complete-memfunc-cvquals.cpp
    clang/test/Index/complete-method-decls.m
    clang/test/Index/complete-modules.m
    clang/test/Index/complete-preprocessor.m
    clang/test/Index/complete-recovery.m
    clang/test/Index/complete-stmt.c
    clang/test/Index/complete-super.cpp
    clang/test/Index/complete-synthesized.m
    clang/test/Index/complete-type-factors.m
    clang/tools/c-index-test/c-index-test.c
    clang/tools/libclang/CIndex.cpp
    clang/tools/libclang/CIndexCodeCompletion.cpp
    clang/tools/libclang/libclang.map

Removed: 
    


################################################################################
diff  --git a/clang/include/clang-c/Index.h b/clang/include/clang-c/Index.h
index e0f6f1c73549f..74c859bf785a5 100644
--- a/clang/include/clang-c/Index.h
+++ b/clang/include/clang-c/Index.h
@@ -2080,6 +2080,23 @@ enum CXCursorKind {
   CXCursor_OverloadCandidate = 700
 };
 
+/**
+ * Describes the kind of result generated.
+ */
+enum CXCompletionResultKind {
+  /** Refers to a declaration. */
+  CXCompletionResult_Declaration = 0,
+
+  /** Refers to a keyword or symbol. */
+  CXCompletionResult_Keyword = 1,
+
+  /** Refers to a macro. */
+  CXCompletionResult_Macro = 2,
+
+  /** Refers to a precomputed pattern. */
+  CXCompletionResult_Pattern = 3
+};
+
 /**
  * A cursor representing some element in the abstract syntax tree for
  * a translation unit.
@@ -4588,6 +4605,8 @@ CINDEX_LINKAGE void clang_disposeTokens(CXTranslationUnit TU, CXToken *Tokens,
  */
 
 /* for debug/testing */
+CINDEX_LINKAGE CXString
+clang_getCompletionResultKindSpelling(enum CXCompletionResultKind Kind);
 CINDEX_LINKAGE CXString clang_getCursorKindSpelling(enum CXCursorKind Kind);
 CINDEX_LINKAGE void clang_getDefinitionSpellingAndExtent(
     CXCursor, const char **startBuf, const char **endBuf, unsigned *startLine,
@@ -4631,12 +4650,17 @@ typedef void *CXCompletionString;
  * A single result of code completion.
  */
 typedef struct {
+  /**
+   * The kind of this completion result.
+   * Useful to distinguish between declarations and keywords.
+   */
+  enum CXCompletionResultKind ResultKind;
+
   /**
    * The kind of entity that this completion refers to.
    *
-   * The cursor kind will be a macro, keyword, or a declaration (one of the
-   * *Decl cursor kinds), describing the entity that the completion is
-   * referring to.
+   * The cursor kind will be a macro or a declaration (one of the *Decl cursor
+   * kinds), describing the entity that the completion is referring to.
    *
    * \todo In the future, we would like to provide a full cursor, to allow
    * the client to extract additional information from declaration.

diff  --git a/clang/test/Index/arc-complete.m b/clang/test/Index/arc-complete.m
index 328983c441ecf..c3fb6f3dcafb1 100644
--- a/clang/test/Index/arc-complete.m
+++ b/clang/test/Index/arc-complete.m
@@ -8,9 +8,9 @@ void test(id x) {
 
 // RUN: c-index-test -code-completion-at=%s:4:4 %s -fobjc-arc -fobjc-nonfragile-abi | FileCheck -check-prefix=CHECK-CC1 %s
 // CHECK-CC1: macro definition:{TypedText __autoreleasing} (70)
-// CHECK-CC1: NotImplemented:{TypedText __bridge}{HorizontalSpace  }{Placeholder type}{RightParen )}{Placeholder expression} (40)
-// CHECK-CC1: NotImplemented:{TypedText __bridge_retained}{HorizontalSpace  }{Placeholder CF type}{RightParen )}{Placeholder expression} (40)
-// CHECK-CC1: NotImplemented:{TypedText __bridge_transfer}{HorizontalSpace  }{Placeholder Objective-C type}{RightParen )}{Placeholder expression} (40)
+// CHECK-CC1: Pattern:{TypedText __bridge}{HorizontalSpace  }{Placeholder type}{RightParen )}{Placeholder expression} (40)
+// CHECK-CC1: Pattern:{TypedText __bridge_retained}{HorizontalSpace  }{Placeholder CF type}{RightParen )}{Placeholder expression} (40)
+// CHECK-CC1: Pattern:{TypedText __bridge_transfer}{HorizontalSpace  }{Placeholder Objective-C type}{RightParen )}{Placeholder expression} (40)
 // CHECK-CC1: macro definition:{TypedText __strong} (70)
 // CHECK-CC1: macro definition:{TypedText __unsafe_unretained} (70)
 // CHECK-CC1: macro definition:{TypedText __weak} (70)

diff  --git a/clang/test/Index/code-completion.cpp b/clang/test/Index/code-completion.cpp
index 00f158f3d09da..ae34be1507ea3 100644
--- a/clang/test/Index/code-completion.cpp
+++ b/clang/test/Index/code-completion.cpp
@@ -82,8 +82,8 @@ void test_template_alias() {
 // CHECK-OVERLOAD-NEXT: Objective-C interface
 
 // RUN: c-index-test -code-completion-at=%s:37:10 %s | FileCheck -check-prefix=CHECK-EXPR %s
-// CHECK-EXPR: NotImplemented:{TypedText int} (50)
-// CHECK-EXPR: NotImplemented:{TypedText long} (50)
+// CHECK-EXPR: Keyword:{TypedText int} (50)
+// CHECK-EXPR: Keyword:{TypedText long} (50)
 // CHECK-EXPR: FieldDecl:{ResultType double}{TypedText member} (17)
 // CHECK-EXPR: FieldDecl:{ResultType int}{Text X::}{TypedText member} (9)
 // CHECK-EXPR: FieldDecl:{ResultType float}{Text Y::}{TypedText member} (18)

diff  --git a/clang/test/Index/complete-at-directives.m b/clang/test/Index/complete-at-directives.m
index 1e97d45162bef..67a45e56a17cb 100644
--- a/clang/test/Index/complete-at-directives.m
+++ b/clang/test/Index/complete-at-directives.m
@@ -24,12 +24,12 @@ @implementation MyClass
 // CHECK-CC3: {TypedText synthesize}{HorizontalSpace  }{Placeholder property}
 
 // RUN: env CINDEXTEST_CODE_COMPLETE_PATTERNS=1 c-index-test -code-completion-at=%s:2:1 %s | FileCheck -check-prefix=CHECK-CC4 %s
-// CHECK-CC4: NotImplemented:{TypedText @class}{HorizontalSpace  }{Placeholder name}
-// CHECK-CC4: NotImplemented:{TypedText @compatibility_alias}{HorizontalSpace  }{Placeholder alias}{HorizontalSpace  }{Placeholder class}
-// CHECK-CC4: NotImplemented:{TypedText @implementation}{HorizontalSpace  }{Placeholder class}
-// CHECK-CC4: NotImplemented:{TypedText @interface}{HorizontalSpace  }{Placeholder class}
-// CHECK-CC4: NotImplemented:{TypedText @protocol}{HorizontalSpace  }{Placeholder protocol}
-// CHECK-CC4: NotImplemented:{TypedText _Bool}
+// CHECK-CC4: Pattern:{TypedText @class}{HorizontalSpace  }{Placeholder name}
+// CHECK-CC4: Pattern:{TypedText @compatibility_alias}{HorizontalSpace  }{Placeholder alias}{HorizontalSpace  }{Placeholder class}
+// CHECK-CC4: Pattern:{TypedText @implementation}{HorizontalSpace  }{Placeholder class}
+// CHECK-CC4: Pattern:{TypedText @interface}{HorizontalSpace  }{Placeholder class}
+// CHECK-CC4: Pattern:{TypedText @protocol}{HorizontalSpace  }{Placeholder protocol}
+// CHECK-CC4: Keyword:{TypedText _Bool}
 // CHECK-CC4: TypedefDecl:{TypedText Class}
 // CHECK-CC4: TypedefDecl:{TypedText id}
 // CHECK-CC4: TypedefDecl:{TypedText SEL}
@@ -41,14 +41,14 @@ @implementation MyClass
 // CHECK-CC5: {TypedText @required}
 
 // RUN: env CINDEXTEST_CODE_COMPLETE_PATTERNS=1 c-index-test -code-completion-at=%s:2:23 %s | FileCheck -check-prefix=CHECK-CC6 %s
-// CHECK-CC6: NotImplemented:{TypedText package}
-// CHECK-CC6: NotImplemented:{TypedText private}
-// CHECK-CC6: NotImplemented:{TypedText protected}
-// CHECK-CC6: NotImplemented:{TypedText public}
+// CHECK-CC6: Keyword:{TypedText package}
+// CHECK-CC6: Keyword:{TypedText private}
+// CHECK-CC6: Keyword:{TypedText protected}
+// CHECK-CC6: Keyword:{TypedText public}
 
 // RUN: env CINDEXTEST_CODE_COMPLETE_PATTERNS=1 c-index-test -code-completion-at=%s:2:22 %s | FileCheck -check-prefix=CHECK-CC7 %s
-// CHECK-CC7: NotImplemented:{TypedText @package}
-// CHECK-CC7: NotImplemented:{TypedText @private}
-// CHECK-CC7: NotImplemented:{TypedText @protected}
-// CHECK-CC7: NotImplemented:{TypedText @public}
-// CHECK-CC7: NotImplemented:{TypedText _Bool}
+// CHECK-CC7: Keyword:{TypedText @package}
+// CHECK-CC7: Keyword:{TypedText @private}
+// CHECK-CC7: Keyword:{TypedText @protected}
+// CHECK-CC7: Keyword:{TypedText @public}
+// CHECK-CC7: Keyword:{TypedText _Bool}

diff  --git a/clang/test/Index/complete-at-exprstmt.m b/clang/test/Index/complete-at-exprstmt.m
index a6d767529af5c..6e45236311da6 100644
--- a/clang/test/Index/complete-at-exprstmt.m
+++ b/clang/test/Index/complete-at-exprstmt.m
@@ -31,25 +31,25 @@ void f() {
 // CHECK-CC2: {TypedText protocol}{LeftParen (}{Placeholder protocol-name}{RightParen )}
 // CHECK-CC2: {TypedText selector}{LeftParen (}{Placeholder selector}{RightParen )}
 // RUN: env CINDEXTEST_CODE_COMPLETE_PATTERNS=1 c-index-test -code-completion-at=%s:9:3 %s | FileCheck -check-prefix=CHECK-CC3 %s
-// CHECK-CC3: NotImplemented:{ResultType char[]}{TypedText @encode}{LeftParen (}{Placeholder type-name}{RightParen )}
-// CHECK-CC3: NotImplemented:{ResultType Protocol *}{TypedText @protocol}{LeftParen (}{Placeholder protocol-name}{RightParen )}
-// CHECK-CC3: NotImplemented:{ResultType SEL}{TypedText @selector}{LeftParen (}{Placeholder selector}{RightParen )}
-// CHECK-CC3: NotImplemented:{TypedText @synchronized}{HorizontalSpace  }{LeftParen (}{Placeholder expression}{RightParen )}{LeftBrace {}{Placeholder statements}{RightBrace }}
-// CHECK-CC3: NotImplemented:{TypedText @throw}{HorizontalSpace  }{Placeholder expression}
-// CHECK-CC3: NotImplemented:{TypedText @try}{LeftBrace {}{Placeholder statements}{RightBrace }}{Text @catch}{LeftParen (}{Placeholder parameter}{RightParen )}{LeftBrace {}{Placeholder statements}{RightBrace }}{Text @finally}{LeftBrace {}{Placeholder statements}{RightBrace }}
-// CHECK-CC3: NotImplemented:{ResultType SEL}{TypedText _cmd}
+// CHECK-CC3: Pattern:{ResultType char[]}{TypedText @encode}{LeftParen (}{Placeholder type-name}{RightParen )}
+// CHECK-CC3: Pattern:{ResultType Protocol *}{TypedText @protocol}{LeftParen (}{Placeholder protocol-name}{RightParen )}
+// CHECK-CC3: Pattern:{ResultType SEL}{TypedText @selector}{LeftParen (}{Placeholder selector}{RightParen )}
+// CHECK-CC3: Pattern:{TypedText @synchronized}{HorizontalSpace  }{LeftParen (}{Placeholder expression}{RightParen )}{LeftBrace {}{Placeholder statements}{RightBrace }}
+// CHECK-CC3: Pattern:{TypedText @throw}{HorizontalSpace  }{Placeholder expression}
+// CHECK-CC3: Pattern:{TypedText @try}{LeftBrace {}{Placeholder statements}{RightBrace }}{Text @catch}{LeftParen (}{Placeholder parameter}{RightParen )}{LeftBrace {}{Placeholder statements}{RightBrace }}{Text @finally}{LeftBrace {}{Placeholder statements}{RightBrace }}
+// CHECK-CC3: Declaration:{ResultType SEL}{TypedText _cmd}
 // CHECK-CC3: ParmDecl:{ResultType int}{TypedText arg}
 // CHECK-CC3: TypedefDecl:{TypedText Class}
 // CHECK-CC3: TypedefDecl:{TypedText id}
 // CHECK-CC3: ObjCIvarDecl:{ResultType int}{TypedText ivar}
 // CHECK-CC3: ObjCInterfaceDecl:{TypedText MyClass}
 // CHECK-CC3: TypedefDecl:{TypedText SEL}
-// CHECK-CC3: NotImplemented:{ResultType MyClass *}{TypedText self}
+// CHECK-CC3: Declaration:{ResultType MyClass *}{TypedText self}
 // RUN: c-index-test -code-completion-at=%s:19:13 %s | FileCheck -check-prefix=CHECK-CC4 %s
-// CHECK-CC4: NotImplemented:{TypedText add:to:} (40)
-// CHECK-CC4: NotImplemented:{TypedText add:to:plus:} (40)
-// CHECK-CC4: NotImplemented:{TypedText myMethod:} (40)
+// CHECK-CC4: Pattern:{TypedText add:to:} (40)
+// CHECK-CC4: Pattern:{TypedText add:to:plus:} (40)
+// CHECK-CC4: Pattern:{TypedText myMethod:} (40)
 // RUN: c-index-test -code-completion-at=%s:19:17 %s | FileCheck -check-prefix=CHECK-CC5 %s
-// CHECK-CC5: NotImplemented:{Informative add:}{TypedText to:} (40)
-// CHECK-CC5: NotImplemented:{Informative add:}{TypedText to:plus:} (40)
+// CHECK-CC5: Pattern:{Informative add:}{TypedText to:} (40)
+// CHECK-CC5: Pattern:{Informative add:}{TypedText to:plus:} (40)
 

diff  --git a/clang/test/Index/complete-declarators.cpp b/clang/test/Index/complete-declarators.cpp
index ccbfde1641c79..17a63fea4b0b5 100644
--- a/clang/test/Index/complete-declarators.cpp
+++ b/clang/test/Index/complete-declarators.cpp
@@ -16,28 +16,28 @@ struct Z {
 
 // RUN: c-index-test -code-completion-at=%s:8:5 %s | FileCheck -check-prefix=CHECK-CC1 %s
 // RUN: env CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_CACHING=1 c-index-test -code-completion-at=%s:8:5 %s | FileCheck -check-prefix=CHECK-CC1 %s
-// CHECK-CC1: NotImplemented:{TypedText const} (40)
+// CHECK-CC1: Keyword:{TypedText const} (40)
 // CHECK-CC1: Namespace:{TypedText N}{Text ::} (75)
-// CHECK-CC1: NotImplemented:{TypedText operator} (40)
-// CHECK-CC1: NotImplemented:{TypedText volatile} (40)
+// CHECK-CC1: Keyword:{TypedText operator} (40)
+// CHECK-CC1: Keyword:{TypedText volatile} (40)
 // RUN: c-index-test -code-completion-at=%s:8:11 %s | FileCheck -check-prefix=CHECK-CC2 %s
 // RUN: env CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_CACHING=1 c-index-test -code-completion-at=%s:8:11 %s | FileCheck -check-prefix=CHECK-CC2 %s
-// CHECK-CC2: NotImplemented:{TypedText const} (40)
+// CHECK-CC2: Keyword:{TypedText const} (40)
 // CHECK-CC2-NOT: Namespace:{TypedText N}{Text ::} (75)
-// CHECK-CC2-NOT: NotImplemented:{TypedText operator} (40)
-// CHECK-CC2: NotImplemented:{TypedText volatile} (40)
+// CHECK-CC2-NOT: Keyword:{TypedText operator} (40)
+// CHECK-CC2: Keyword:{TypedText volatile} (40)
 // RUN: c-index-test -code-completion-at=%s:13:7 %s | FileCheck -check-prefix=CHECK-CC3 %s
 // RUN: env CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_CACHING=1 c-index-test -code-completion-at=%s:13:7 %s | FileCheck -check-prefix=CHECK-CC3 %s
-// CHECK-CC3: NotImplemented:{TypedText const} (40)
+// CHECK-CC3: Keyword:{TypedText const} (40)
 // CHECK-CC3-NOT: Namespace:{TypedText N}{Text ::} (75)
-// CHECK-CC3: NotImplemented:{TypedText operator} (40)
-// CHECK-CC3: NotImplemented:{TypedText volatile} (40)
+// CHECK-CC3: Keyword:{TypedText operator} (40)
+// CHECK-CC3: Keyword:{TypedText volatile} (40)
 // RUN: c-index-test -code-completion-at=%s:14:14 %s | FileCheck -check-prefix=CHECK-CC4 %s
 // RUN: env CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_CACHING=1 c-index-test -code-completion-at=%s:14:14 %s | FileCheck -check-prefix=CHECK-CC4 %s
-// CHECK-CC4: NotImplemented:{TypedText const} (40)
+// CHECK-CC4: Keyword:{TypedText const} (40)
 // CHECK-CC4: Namespace:{TypedText N}{Text ::} (75)
-// CHECK-CC4: NotImplemented:{TypedText operator} (40)
-// CHECK-CC4: NotImplemented:{TypedText volatile} (40)
+// CHECK-CC4: Keyword:{TypedText operator} (40)
+// CHECK-CC4: Keyword:{TypedText volatile} (40)
 // CHECK-CC4: StructDecl:{TypedText Y}{Text ::} (75)
 // CHECK-CC4: StructDecl:{TypedText Z}{Text ::} (75)
 

diff  --git a/clang/test/Index/complete-declarators.m b/clang/test/Index/complete-declarators.m
index b3a60ded110a4..9d4fdb101e270 100644
--- a/clang/test/Index/complete-declarators.m
+++ b/clang/test/Index/complete-declarators.m
@@ -26,62 +26,62 @@ - (boid)method2 {}
 @end
 
 // RUN: c-index-test -code-completion-at=%s:7:4 %s | FileCheck -check-prefix=CHECK-CC0 %s
-// CHECK-CC0: NotImplemented:{TypedText IBAction}{RightParen )}{Placeholder selector}{Colon :}{LeftParen (}{Text id}{RightParen )}{Text sender} (40)
+// CHECK-CC0: Pattern:{TypedText IBAction}{RightParen )}{Placeholder selector}{Colon :}{LeftParen (}{Text id}{RightParen )}{Text sender} (40)
 // CHECK-CC0: macro definition:{TypedText IBAction} (70)
 // CHECK-CC0: macro definition:{TypedText IBOutlet} (70)
 // CHECK-CC0: macro definition:{TypedText IBOutletCollection}{LeftParen (}{Placeholder ClassName}{RightParen )} (70)
 // CHECK-CC0: TypedefDecl:{TypedText id} (50)
-// CHECK-CC0: NotImplemented:{TypedText in} (40)
-// CHECK-CC0: NotImplemented:{TypedText inout} (40)
-// CHECK-CC0: NotImplemented:{TypedText instancetype} (40)
-// CHECK-CC0: NotImplemented:{TypedText int} (50)
-// CHECK-CC0: NotImplemented:{TypedText long} (50)
+// CHECK-CC0: Keyword:{TypedText in} (40)
+// CHECK-CC0: Keyword:{TypedText inout} (40)
+// CHECK-CC0: Keyword:{TypedText instancetype} (40)
+// CHECK-CC0: Keyword:{TypedText int} (50)
+// CHECK-CC0: Keyword:{TypedText long} (50)
 // RUN: c-index-test -code-completion-at=%s:7:19 %s | FileCheck -check-prefix=CHECK-CC1 %s
-// CHECK-CC1-NOT: NotImplemented:{TypedText extern} (40)
-// CHECK-CC1: NotImplemented:{TypedText param1} (40)
+// CHECK-CC1-NOT: Keyword:{TypedText extern} (40)
+// CHECK-CC1: Pattern:{TypedText param1} (40)
 // RUN: c-index-test -code-completion-at=%s:9:15 %s | FileCheck -check-prefix=CHECK-CC2 %s
 // RUN: c-index-test -code-completion-at=%s:15:10 %s | FileCheck -check-prefix=CHECK-CC2 %s
 // RUN: c-index-test -code-completion-at=%s:16:9 %s | FileCheck -check-prefix=CHECK-CC2 %s
-// CHECK-CC2: NotImplemented:{TypedText const} (40)
+// CHECK-CC2: Keyword:{TypedText const} (40)
 // CHECK-CC2-NOT: int
-// CHECK-CC2: NotImplemented:{TypedText restrict} (40)
-// CHECK-CC2: NotImplemented:{TypedText volatile} (40)
+// CHECK-CC2: Keyword:{TypedText restrict} (40)
+// CHECK-CC2: Keyword:{TypedText volatile} (40)
 // RUN: c-index-test -code-completion-at=%s:15:15 %s | FileCheck -check-prefix=CHECK-CC3 %s
 // CHECK-CC3: ParmDecl:{ResultType id}{TypedText param1} (34)
 // CHECK-CC3-NOT: VarDecl:{ResultType int}{TypedText q2}
 // CHECK-CC3-NOT: VarDecl:{ResultType id}{TypedText q}
-// CHECK-CC3: NotImplemented:{ResultType A *}{TypedText self} (34)
-// CHECK-CC3: NotImplemented:{ResultType size_t}{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (40)
+// CHECK-CC3: Declaration:{ResultType A *}{TypedText self} (34)
+// CHECK-CC3: Pattern:{ResultType size_t}{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (40)
 // RUN: c-index-test -code-completion-at=%s:15:15 %s | FileCheck -check-prefix=CHECK-CC4 %s
 // CHECK-CC4: ParmDecl:{ResultType id}{TypedText param1} (34)
 // CHECK-CC4-NOT: VarDecl:{ResultType int}{TypedText q2}
-// CHECK-CC4: NotImplemented:{ResultType A *}{TypedText self} (34)
-// CHECK-CC4: NotImplemented:{ResultType size_t}{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (40)
+// CHECK-CC4: Declaration:{ResultType A *}{TypedText self} (34)
+// CHECK-CC4: Pattern:{ResultType size_t}{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (40)
 // RUN: c-index-test -code-completion-at=%s:23:10 %s | FileCheck -check-prefix=CHECK-CC5 %s
-// CHECK-CC5: NotImplemented:{TypedText _Bool} (50)
-// CHECK-CC5: NotImplemented:{TypedText _Complex} (50)
-// CHECK-CC5: NotImplemented:{TypedText _Imaginary} (50)
+// CHECK-CC5: Keyword:{TypedText _Bool} (50)
+// CHECK-CC5: Keyword:{TypedText _Complex} (50)
+// CHECK-CC5: Keyword:{TypedText _Imaginary} (50)
 // CHECK-CC5: ObjCInterfaceDecl:{TypedText A} (50)
-// CHECK-CC5: NotImplemented:{TypedText char} (50)
+// CHECK-CC5: Keyword:{TypedText char} (50)
 // CHECK-CC5: TypedefDecl:{TypedText Class} (50)
-// CHECK-CC5: NotImplemented:{TypedText const} (50)
-// CHECK-CC5: NotImplemented:{TypedText double} (50)
-// CHECK-CC5: NotImplemented:{TypedText enum} (50)
-// CHECK-CC5: NotImplemented:{TypedText float} (50)
+// CHECK-CC5: Keyword:{TypedText const} (50)
+// CHECK-CC5: Keyword:{TypedText double} (50)
+// CHECK-CC5: Keyword:{TypedText enum} (50)
+// CHECK-CC5: Keyword:{TypedText float} (50)
 // CHECK-CC5: TypedefDecl:{TypedText id} (50)
-// CHECK-CC5: NotImplemented:{TypedText int} (50)
-// CHECK-CC5: NotImplemented:{TypedText long} (50)
-// CHECK-CC5: NotImplemented:{TypedText restrict} (50)
+// CHECK-CC5: Keyword:{TypedText int} (50)
+// CHECK-CC5: Keyword:{TypedText long} (50)
+// CHECK-CC5: Keyword:{TypedText restrict} (50)
 // CHECK-CC5: TypedefDecl:{TypedText SEL} (50)
-// CHECK-CC5: NotImplemented:{TypedText short} (50)
-// CHECK-CC5: NotImplemented:{TypedText signed} (50)
-// CHECK-CC5: NotImplemented:{TypedText struct} (50)
-// CHECK-CC5: NotImplemented:{TypedText typeof}{HorizontalSpace  }{Placeholder expression} (40)
-// CHECK-CC5: NotImplemented:{TypedText typeof}{LeftParen (}{Placeholder type}{RightParen )} (40)
-// CHECK-CC5: NotImplemented:{TypedText union} (50)
-// CHECK-CC5: NotImplemented:{TypedText unsigned} (50)
-// CHECK-CC5: NotImplemented:{TypedText void} (50)
-// CHECK-CC5: NotImplemented:{TypedText volatile} (50)
+// CHECK-CC5: Keyword:{TypedText short} (50)
+// CHECK-CC5: Keyword:{TypedText signed} (50)
+// CHECK-CC5: Keyword:{TypedText struct} (50)
+// CHECK-CC5: Pattern:{TypedText typeof}{HorizontalSpace  }{Placeholder expression} (40)
+// CHECK-CC5: Pattern:{TypedText typeof}{LeftParen (}{Placeholder type}{RightParen )} (40)
+// CHECK-CC5: Keyword:{TypedText union} (50)
+// CHECK-CC5: Keyword:{TypedText unsigned} (50)
+// CHECK-CC5: Keyword:{TypedText void} (50)
+// CHECK-CC5: Keyword:{TypedText volatile} (50)
 
 // Check that there are no duplicate entries if we code-complete after an @implementation
 // RUN: c-index-test -code-completion-at=%s:27:1 %s | FileCheck -check-prefix=CHECK-CC6 %s

diff  --git a/clang/test/Index/complete-exprs.c b/clang/test/Index/complete-exprs.c
index 9beb16deef99b..704d01fa3b896 100644
--- a/clang/test/Index/complete-exprs.c
+++ b/clang/test/Index/complete-exprs.c
@@ -26,12 +26,12 @@ void f5(float f) {
 
 // RUN: c-index-test -code-completion-at=%s:7:10 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC1 %s
 // RUN: env CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_CACHING=1 c-index-test -code-completion-at=%s:7:10 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC1 %s
-// CHECK-CC1: NotImplemented:{TypedText __PRETTY_FUNCTION__} (65)
+// CHECK-CC1: Keyword:{TypedText __PRETTY_FUNCTION__} (65)
 // CHECK-CC1: macro definition:{TypedText __VERSION__} (70)
 // CHECK-CC1: FunctionDecl:{ResultType int}{TypedText f}{LeftParen (}{Placeholder int}{RightParen )} (12) (unavailable)
-// CHECK-CC1-NOT: NotImplemented:{TypedText float} (65)
+// CHECK-CC1-NOT: Keyword:{TypedText float} (65)
 // CHECK-CC1: ParmDecl:{ResultType int}{TypedText j} (8)
-// CHECK-CC1: NotImplemented:{ResultType size_t}{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (40)
+// CHECK-CC1: Pattern:{ResultType size_t}{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (40)
 // RUN: env CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_CACHING=1 c-index-test -code-completion-at=%s:7:10 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC1 %s
 // RUN: c-index-test -code-completion-at=%s:7:14 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC1 %s
 // RUN: env CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_CACHING=1 c-index-test -code-completion-at=%s:7:14 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC1 %s
@@ -41,17 +41,17 @@ void f5(float f) {
 // RUN: c-index-test -code-completion-at=%s:7:2 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC2 %s
 // CHECK-CC2: macro definition:{TypedText __VERSION__} (70)
 // CHECK-CC2: FunctionDecl:{ResultType int}{TypedText f}{LeftParen (}{Placeholder int}{RightParen )} (50)
-// CHECK-CC2: NotImplemented:{TypedText float} (50)
+// CHECK-CC2: Keyword:{TypedText float} (50)
 // CHECK-CC2: ParmDecl:{ResultType int}{TypedText j} (34)
-// CHECK-CC2: NotImplemented:{ResultType size_t}{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (40)
+// CHECK-CC2: Pattern:{ResultType size_t}{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (40)
 // RUN: c-index-test -code-completion-at=%s:11:16 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC4 %s
 // CHECK-CC4: FunctionDecl:{ResultType int}{TypedText f}{LeftParen (}{Placeholder int}{RightParen )} (50)
 // CHECK-CC4: VarDecl:{ResultType struct X}{TypedText f1} (50) (deprecated)
 
 // RUN: c-index-test -code-completion-at=%s:19:3 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC6 %s
 // CHECK-CC6: FunctionDecl:{ResultType void}{TypedText f3}{LeftParen (}{Placeholder const char *, ...}{Text , NULL}{RightParen )} (50)
-// CHECK-CC6: NotImplemented:{TypedText void} (50)
-// CHECK-CC6: NotImplemented:{TypedText volatile} (50)
+// CHECK-CC6: Keyword:{TypedText void} (50)
+// CHECK-CC6: Keyword:{TypedText volatile} (50)
 
 // RUN: c-index-test -code-completion-at=%s:24:4 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC7 %s
 // RUN: env CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_CACHING=1 c-index-test -code-completion-at=%s:24:4 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC7 %s

diff  --git a/clang/test/Index/complete-exprs.cpp b/clang/test/Index/complete-exprs.cpp
index fc60cc560b5c9..57cf33614d392 100644
--- a/clang/test/Index/complete-exprs.cpp
+++ b/clang/test/Index/complete-exprs.cpp
@@ -47,10 +47,10 @@ namespace N {
 
 // RUN: c-index-test -code-completion-at=%s:20:2 %s -std=c++0x | FileCheck -check-prefix=CHECK-CC1 %s
 // RUN: env CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_CACHING=1 c-index-test -code-completion-at=%s:20:2 -std=c++0x %s | FileCheck -check-prefix=CHECK-CC1 %s
-// CHECK-CC1: NotImplemented:{ResultType size_t}{TypedText alignof}{LeftParen (}{Placeholder type}{RightParen )} (40)
-// CHECK-CC1: NotImplemented:{ResultType bool}{TypedText noexcept}{LeftParen (}{Placeholder expression}{RightParen )} (40)
-// CHECK-CC1: NotImplemented:{ResultType std::nullptr_t}{TypedText nullptr} (40)
-// CHECK-CC1: NotImplemented:{TypedText operator} (40)
+// CHECK-CC1: Pattern:{ResultType size_t}{TypedText alignof}{LeftParen (}{Placeholder type}{RightParen )} (40)
+// CHECK-CC1: Pattern:{ResultType bool}{TypedText noexcept}{LeftParen (}{Placeholder expression}{RightParen )} (40)
+// CHECK-CC1: Pattern:{ResultType std::nullptr_t}{TypedText nullptr} (40)
+// CHECK-CC1: Keyword:{TypedText operator} (40)
 // CHECK-CC1-NOT: push_back
 // CHECK-CC1: ClassDecl:{TypedText string} (50)
 // CHECK-CC1: CXXConstructor:{TypedText string}{LeftParen (}{RightParen )} (50)
@@ -67,7 +67,7 @@ namespace N {
 // CHECK-CC2: ClassTemplate:{TypedText vector}{LeftAngle <}{Placeholder typename T}{RightAngle >} (50)
 
 // RUN: c-index-test -code-completion-at=%s:26:15 %s | FileCheck -check-prefix=CHECK-CC3 %s
-// CHECK-CC3: NotImplemented:{TypedText float} (50)
+// CHECK-CC3: Keyword:{TypedText float} (50)
 // CHECK-CC3: FunctionDecl:{ResultType int}{TypedText foo}{LeftParen (}{RightParen )} (50)
 // CHECK-CC3: FunctionDecl:{ResultType void}{TypedText g}{LeftParen (}{RightParen )} (50)
 // CHECK-CC3: ClassTemplate:{TypedText vector}{LeftAngle <}{Placeholder typename T}{RightAngle >} (50)
@@ -75,7 +75,7 @@ namespace N {
 // CHECK-CC3: FunctionTemplate:{TypedText vector}{LeftAngle <}{Placeholder typename T}{RightAngle >}{LeftParen (}{Placeholder InputIterator first}{Comma , }{Placeholder InputIterator last}{RightParen )} (50)
 
 // RUN: c-index-test -code-completion-at=%s:34:1 %s -std=c++0x | FileCheck -check-prefix=CHECK-CC4 %s
-// CHECK-CC4: NotImplemented:{ResultType const X *}{TypedText this} (40)
+// CHECK-CC4: Pattern:{ResultType const X *}{TypedText this} (40)
 
 // RUN: c-index-test -code-completion-at=%s:43:14 %s | FileCheck -check-prefix=CHECK-CC5 %s
 // CHECK-CC5: FieldDecl:{ResultType int}{TypedText member} (8)

diff  --git a/clang/test/Index/complete-exprs.m b/clang/test/Index/complete-exprs.m
index 16eeda9bff4b6..4ffb7e8c89c85 100644
--- a/clang/test/Index/complete-exprs.m
+++ b/clang/test/Index/complete-exprs.m
@@ -18,21 +18,21 @@ - (int)method:(id)param1 {
 @end
 
 // RUN: c-index-test -code-completion-at=%s:13:2 %s | FileCheck -check-prefix=CHECK-CC1 %s
-// CHECK-CC1: NotImplemented:{ResultType NSString *}{TypedText @"}{Placeholder string}{Text "} (40)
-// CHECK-CC1: NotImplemented:{ResultType id}{TypedText @(}{Placeholder expression}{RightParen )} (40)
-// CHECK-CC1: NotImplemented:{ResultType NSArray *}{TypedText @[}{Placeholder objects, ...}{RightBracket ]} (40)
-// CHECK-CC1: NotImplemented:{ResultType NSDictionary *}{TypedText @{}{Placeholder key}{Colon :}{HorizontalSpace  }{Placeholder object, ...}{RightBrace }} (40)
-// CHECK-CC1: NotImplemented:{ResultType SEL}{TypedText _cmd} (80)
+// CHECK-CC1: Pattern:{ResultType NSString *}{TypedText @"}{Placeholder string}{Text "} (40)
+// CHECK-CC1: Pattern:{ResultType id}{TypedText @(}{Placeholder expression}{RightParen )} (40)
+// CHECK-CC1: Pattern:{ResultType NSArray *}{TypedText @[}{Placeholder objects, ...}{RightBracket ]} (40)
+// CHECK-CC1: Pattern:{ResultType NSDictionary *}{TypedText @{}{Placeholder key}{Colon :}{HorizontalSpace  }{Placeholder object, ...}{RightBrace }} (40)
+// CHECK-CC1: Declaration:{ResultType SEL}{TypedText _cmd} (80)
 // CHECK-CC1: TypedefDecl:{TypedText BOOL} (50)
 // CHECK-CC1: macro definition:{TypedText bool} (51)
 // CHECK-CC1: macro definition:{TypedText NO} (65)
-// CHECK-CC1: NotImplemented:{ResultType A *}{TypedText self} (34)
+// CHECK-CC1: Declaration:{ResultType A *}{TypedText self} (34)
 // CHECK-CC1: macro definition:{TypedText YES} (65)
 // RUN: c-index-test -code-completion-at=%s:14:7 %s | FileCheck -check-prefix=CHECK-CC2 %s
 // RUN: env CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_CACHING=1 c-index-test -code-completion-at=%s:14:7 %s | FileCheck -check-prefix=CHECK-CC2 %s
 // CHECK-CC2: TypedefDecl:{TypedText BOOL} (50)
-// CHECK-CC2: NotImplemented:{TypedText char} (50)
-// CHECK-CC2: NotImplemented:{ResultType size_t}{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (40)
+// CHECK-CC2: Keyword:{TypedText char} (50)
+// CHECK-CC2: Pattern:{ResultType size_t}{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (40)
 // RUN: c-index-test -code-completion-at=%s:15:1 -fobjc-arc -fobjc-nonfragile-abi  %s | FileCheck -check-prefix=CHECK-CC3 %s
 // RUN: env CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_CACHING=1 c-index-test -code-completion-at=%s:15:1 -fobjc-arc -fobjc-nonfragile-abi %s | FileCheck -check-prefix=CHECK-CC3 %s
 // CHECK-CC3: FunctionDecl:{ResultType void}{TypedText foo}{LeftParen (}{Placeholder ^bool(id x, A *y)block}{RightParen )} (34)
@@ -42,10 +42,10 @@ - (int)method:(id)param1 {
 // RUN: c-index-test -code-completion-at=%s:15:5 %s | FileCheck -check-prefix=CHECK-CC4 %s
 // RUN: c-index-test -code-completion-at=%s:16:5 %s | FileCheck -check-prefix=CHECK-CC4 %s
 // RUN: c-index-test -code-completion-at=%s:16:14 %s | FileCheck -check-prefix=CHECK-CC4 %s
-// CHECK-CC4: NotImplemented:{ResultType NSArray *}{TypedText @[}{Placeholder objects, ...}{RightBracket ]} (40)
-// CHECK-CC4: NotImplemented:{ResultType NSDictionary *}{TypedText @{}{Placeholder key}{Colon :}{HorizontalSpace  }{Placeholder object, ...}{RightBrace }} (40)
-// CHECK-CC4: NotImplemented:{ResultType SEL}{TypedText _cmd} (80)
+// CHECK-CC4: Pattern:{ResultType NSArray *}{TypedText @[}{Placeholder objects, ...}{RightBracket ]} (40)
+// CHECK-CC4: Pattern:{ResultType NSDictionary *}{TypedText @{}{Placeholder key}{Colon :}{HorizontalSpace  }{Placeholder object, ...}{RightBrace }} (40)
+// CHECK-CC4: Declaration:{ResultType SEL}{TypedText _cmd} (80)
 // CHECK-CC4: macro definition:{TypedText bool} (51)
 // CHECK-CC4: macro definition:{TypedText NO} (65)
-// CHECK-CC4: NotImplemented:{ResultType A *}{TypedText self} (34)
+// CHECK-CC4: Declaration:{ResultType A *}{TypedText self} (34)
 // CHECK-CC4: macro definition:{TypedText YES} (65)

diff  --git a/clang/test/Index/complete-lambdas.cpp b/clang/test/Index/complete-lambdas.cpp
index ba337e45d3a0d..4580327af4b36 100644
--- a/clang/test/Index/complete-lambdas.cpp
+++ b/clang/test/Index/complete-lambdas.cpp
@@ -19,12 +19,12 @@ struct X {
 // RUN: c-index-test -code-completion-at=%s:12:8 -std=c++11 %s | FileCheck -check-prefix=CHECK-CC1 %s
 // CHECK-CC1: VarDecl:{ResultType int}{TypedText inner_local} (34)
 // CHECK-CC1-NEXT: VarDecl:{ResultType int}{TypedText local} (34)
-// CHECK-CC1-NEXT: NotImplemented:{ResultType X *}{TypedText this} (40)
+// CHECK-CC1-NEXT: Pattern:{ResultType X *}{TypedText this} (40)
 // CHECK-CC1-NEXT: ParmDecl:{ResultType int}{TypedText zed} (34)
 
 // RUN: c-index-test -code-completion-at=%s:12:15 -std=c++11 %s | FileCheck -check-prefix=CHECK-CC2 %s
 // CHECK-CC2: VarDecl:{ResultType int}{TypedText inner_local} (34)
-// CHECK-CC2-NEXT: NotImplemented:{ResultType X *}{TypedText this} (40)
+// CHECK-CC2-NEXT: Pattern:{ResultType X *}{TypedText this} (40)
 // CHECK-CC2-NEXT: ParmDecl:{ResultType int}{TypedText zed} (34)
 
 // RUN: c-index-test -code-completion-at=%s:12:21 -std=c++11 %s | FileCheck -check-prefix=CHECK-CC3 %s
@@ -36,7 +36,7 @@ struct X {
 // CHECK-CC4: TypedefDecl:{TypedText id} (50)
 // CHECK-CC4: VarDecl:{ResultType int}{TypedText inner_local} (34)
 // CHECK-CC4: VarDecl:{ResultType int}{TypedText local} (34)
-// CHECK-CC4: NotImplemented:{ResultType X *}{TypedText this} (40)
+// CHECK-CC4: Pattern:{ResultType X *}{TypedText this} (40)
 // CHECK-CC4: ParmDecl:{ResultType int}{TypedText zed} (34)
 
 // RUN: c-index-test -code-completion-at=%s:12:15 -x objective-c++ -std=c++11 %s | FileCheck -check-prefix=CHECK-CC2 %s

diff  --git a/clang/test/Index/complete-lambdas.mm b/clang/test/Index/complete-lambdas.mm
index 049dc1d0e66fe..7ebbceffaaf37 100644
--- a/clang/test/Index/complete-lambdas.mm
+++ b/clang/test/Index/complete-lambdas.mm
@@ -36,14 +36,14 @@ @implementation B
 
 
 // RUN: c-index-test -code-completion-at=%s:16:21 -x objective-c++ -std=c++11 %s | FileCheck -check-prefix=CHECK-CC4 %s
-// CHECK-CC4: NotImplemented:{ResultType B *}{TypedText self} (34)
-// CHECK-CC4: NotImplemented:{ResultType A *}{TypedText super} (40)
+// CHECK-CC4: Declaration:{ResultType B *}{TypedText self} (34)
+// CHECK-CC4: Pattern:{ResultType A *}{TypedText super} (40)
 
 // RUN: c-index-test -code-completion-at=%s:18:10 -x objective-c++ -std=c++11 %s | FileCheck -check-prefix=CHECK-CC1 %s
 
 // RUN: c-index-test -code-completion-at=%s:19:8 -x objective-c++ -std=c++11 %s | FileCheck -check-prefix=CHECK-CC5 %s
-// CHECK-CC5: NotImplemented:{ResultType SEL}{TypedText _cmd} (34)
-// CHECK-CC5-NEXT: NotImplemented:{ResultType B *}{TypedText self} (34)
+// CHECK-CC5: Declaration:{ResultType SEL}{TypedText _cmd} (34)
+// CHECK-CC5-NEXT: Declaration:{ResultType B *}{TypedText self} (34)
 
 // RUN: c-index-test -code-completion-at=%s:20:11 -x objective-c++ -std=c++11 %s | FileCheck -check-prefix=CHECK-CC6 %s
 // CHECK-CC6: ObjCInstanceMethodDecl:{ResultType id}{TypedText instanceMethod:}{Placeholder (int)}{HorizontalSpace  }{TypedText withOther:}{Placeholder (int)} (37)

diff  --git a/clang/test/Index/complete-memfunc-cvquals.cpp b/clang/test/Index/complete-memfunc-cvquals.cpp
index 9068ef840bda2..67d984afcab1a 100644
--- a/clang/test/Index/complete-memfunc-cvquals.cpp
+++ b/clang/test/Index/complete-memfunc-cvquals.cpp
@@ -78,9 +78,9 @@ void Foo::bingo() volatile {
 // CHECK-IMPLICIT-VOLATILE: CXXMethod:{ResultType void}{TypedText bingo}{LeftParen (}{RightParen )}{Informative  volatile} (34)
 
 // RUN: c-index-test -code-completion-at=%s:4:17 %s | FileCheck -check-prefix=CHECK-CVQUAL-AFTER %s
-// CHECK-CVQUAL-AFTER: NotImplemented:{TypedText const} (40)
-// CHECK-CVQUAL-AFTER: NotImplemented:{TypedText volatile} (40)
+// CHECK-CVQUAL-AFTER: Keyword:{TypedText const} (40)
+// CHECK-CVQUAL-AFTER: Keyword:{TypedText volatile} (40)
 
 // RUN: c-index-test -code-completion-at=%s:4:23 %s | FileCheck -check-prefix=CHECK-CVQUAL-AFTER2 %s
-// CHECK-CVQUAL-AFTER2-NOT: NotImplemented:{TypedText const} (40)
-// CHECK-CVQUAL-AFTER2: NotImplemented:{TypedText volatile} (40)
+// CHECK-CVQUAL-AFTER2-NOT: Keyword:{TypedText const} (40)
+// CHECK-CVQUAL-AFTER2: Keyword:{TypedText volatile} (40)

diff  --git a/clang/test/Index/complete-method-decls.m b/clang/test/Index/complete-method-decls.m
index 66c1bc56e8c95..fa184da094124 100644
--- a/clang/test/Index/complete-method-decls.m
+++ b/clang/test/Index/complete-method-decls.m
@@ -151,11 +151,11 @@ -(void)foo {}
 // CHECK-CC8: ObjCInstanceMethodDecl:{ResultType void *}{Informative first:}{TypedText second3:}{Text (float)y3}{HorizontalSpace  }{TypedText third:}{Text (double)z} (35)
 // CHECK-CC8: ObjCInstanceMethodDecl:{ResultType int}{Informative first:}{TypedText second:}{Text (float)y}{HorizontalSpace  }{TypedText third:}{Text (double)z} (8)
 // RUN: env CINDEXTEST_CODE_COMPLETE_PATTERNS=1 c-index-test -code-completion-at=%s:52:19 %s | FileCheck -check-prefix=CHECK-CC9 %s
-// CHECK-CC9: NotImplemented:{TypedText x} (40)
-// CHECK-CC9: NotImplemented:{TypedText xx} (40)
-// CHECK-CC9: NotImplemented:{TypedText xxx} (40)
+// CHECK-CC9: Pattern:{TypedText x} (40)
+// CHECK-CC9: Pattern:{TypedText xx} (40)
+// CHECK-CC9: Pattern:{TypedText xxx} (40)
 // RUN: env CINDEXTEST_CODE_COMPLETE_PATTERNS=1 c-index-test -code-completion-at=%s:52:36 %s | FileCheck -check-prefix=CHECK-CCA %s
-// CHECK-CCA: NotImplemented:{TypedText y2} (40)
+// CHECK-CCA: Pattern:{TypedText y2} (40)
 // RUN: c-index-test -code-completion-at=%s:56:3 %s | FileCheck -check-prefix=CHECK-CCB %s
 // CHECK-CCB: ObjCInstanceMethodDecl:{LeftParen (}{Text int}{RightParen )}{TypedText first:}{LeftParen (}{Text int}{RightParen )}{Text x}{HorizontalSpace  }{TypedText second2:}{LeftParen (}{Text float}{RightParen )}{Text y}{HorizontalSpace  }{TypedText third:}{LeftParen (}{Text double}{RightParen )}{Text z} (40)
 // RUN: c-index-test -code-completion-at=%s:56:8 %s | FileCheck -check-prefix=CHECK-CCC %s
@@ -171,46 +171,46 @@ -(void)foo {}
 // RUN: c-index-test -code-completion-at=%s:60:4 %s | FileCheck -check-prefix=CHECK-CCF %s
 // CHECK-CCF: ObjCInterfaceDecl:{TypedText A} (50)
 // CHECK-CCF: ObjCInterfaceDecl:{TypedText B} (50)
-// CHECK-CCF: NotImplemented:{TypedText bycopy} (40)
-// CHECK-CCF: NotImplemented:{TypedText byref} (40)
-// CHECK-CCF: NotImplemented:{TypedText in} (40)
-// CHECK-CCF: NotImplemented:{TypedText inout} (40)
-// CHECK-CCF: NotImplemented:{TypedText nonnull} (40)
-// CHECK-CCF: NotImplemented:{TypedText nullable} (40)
-// CHECK-CCF: NotImplemented:{TypedText oneway} (40)
-// CHECK-CCF: NotImplemented:{TypedText out} (40)
-// CHECK-CCF: NotImplemented:{TypedText unsigned} (50)
-// CHECK-CCF: NotImplemented:{TypedText void} (50)
-// CHECK-CCF: NotImplemented:{TypedText volatile} (50)
+// CHECK-CCF: Keyword:{TypedText bycopy} (40)
+// CHECK-CCF: Keyword:{TypedText byref} (40)
+// CHECK-CCF: Keyword:{TypedText in} (40)
+// CHECK-CCF: Keyword:{TypedText inout} (40)
+// CHECK-CCF: Keyword:{TypedText nonnull} (40)
+// CHECK-CCF: Keyword:{TypedText nullable} (40)
+// CHECK-CCF: Keyword:{TypedText oneway} (40)
+// CHECK-CCF: Keyword:{TypedText out} (40)
+// CHECK-CCF: Keyword:{TypedText unsigned} (50)
+// CHECK-CCF: Keyword:{TypedText void} (50)
+// CHECK-CCF: Keyword:{TypedText volatile} (50)
 // RUN: c-index-test -code-completion-at=%s:60:11 %s | FileCheck -check-prefix=CHECK-CCG %s
 // CHECK-CCG: ObjCInterfaceDecl:{TypedText A} (50)
 // CHECK-CCG: ObjCInterfaceDecl:{TypedText B} (50)
-// CHECK-CCG-NOT: NotImplemented:{TypedText bycopy} (40)
-// CHECK-CCG-NOT: NotImplemented:{TypedText byref} (40)
-// CHECK-CCG: NotImplemented:{TypedText in} (40)
-// CHECK-CCG: NotImplemented:{TypedText inout} (40)
-// CHECK-CCG-NOT: NotImplemented:{TypedText oneway} (40)
-// CHECK-CCG: NotImplemented:{TypedText out} (40)
-// CHECK-CCG: NotImplemented:{TypedText unsigned} (50)
-// CHECK-CCG: NotImplemented:{TypedText void} (50)
-// CHECK-CCG: NotImplemented:{TypedText volatile} (50)
+// CHECK-CCG-NOT: Keyword:{TypedText bycopy} (40)
+// CHECK-CCG-NOT: Keyword:{TypedText byref} (40)
+// CHECK-CCG: Keyword:{TypedText in} (40)
+// CHECK-CCG: Keyword:{TypedText inout} (40)
+// CHECK-CCG-NOT: Keyword:{TypedText oneway} (40)
+// CHECK-CCG: Keyword:{TypedText out} (40)
+// CHECK-CCG: Keyword:{TypedText unsigned} (50)
+// CHECK-CCG: Keyword:{TypedText void} (50)
+// CHECK-CCG: Keyword:{TypedText volatile} (50)
 // RUN: c-index-test -code-completion-at=%s:60:24 %s | FileCheck -check-prefix=CHECK-CCF %s
 // RUN: c-index-test -code-completion-at=%s:60:27 %s | FileCheck -check-prefix=CHECK-CCH %s
 // CHECK-CCH: ObjCInterfaceDecl:{TypedText A} (50)
 // CHECK-CCH: ObjCInterfaceDecl:{TypedText B} (50)
-// CHECK-CCH: NotImplemented:{TypedText bycopy} (40)
-// CHECK-CCH: NotImplemented:{TypedText byref} (40)
-// CHECK-CCH-NOT: NotImplemented:{TypedText in} (40)
-// CHECK-CCH: NotImplemented:{TypedText inout} (40)
-// CHECK-CCH: NotImplemented:{TypedText oneway} (40)
-// CHECK-CCH: NotImplemented:{TypedText out} (40)
-// CHECK-CCH: NotImplemented:{TypedText unsigned} (50)
-// CHECK-CCH: NotImplemented:{TypedText void} (50)
-// CHECK-CCH: NotImplemented:{TypedText volatile} (50)
+// CHECK-CCH: Keyword:{TypedText bycopy} (40)
+// CHECK-CCH: Keyword:{TypedText byref} (40)
+// CHECK-CCH-NOT: Keyword:{TypedText in} (40)
+// CHECK-CCH: Keyword:{TypedText inout} (40)
+// CHECK-CCH: Keyword:{TypedText oneway} (40)
+// CHECK-CCH: Keyword:{TypedText out} (40)
+// CHECK-CCH: Keyword:{TypedText unsigned} (50)
+// CHECK-CCH: Keyword:{TypedText void} (50)
+// CHECK-CCH: Keyword:{TypedText volatile} (50)
 
 // IBAction completion
 // RUN: c-index-test -code-completion-at=%s:5:4 %s | FileCheck -check-prefix=CHECK-IBACTION %s
-// CHECK-IBACTION: NotImplemented:{TypedText IBAction}{RightParen )}{Placeholder selector}{Colon :}{LeftParen (}{Text id}{RightParen )}{Text sender} (40)
+// CHECK-IBACTION: Pattern:{TypedText IBAction}{RightParen )}{Placeholder selector}{Colon :}{LeftParen (}{Text id}{RightParen )}{Text sender} (40)
 
 // <rdar://problem/8939352>
 // RUN: c-index-test -code-completion-at=%s:68:9 %s | FileCheck -check-prefix=CHECK-8939352 %s
@@ -252,7 +252,7 @@ @implementation CompleteWithoutLeadingPrefix
 @end
 
 // RUN: c-index-test -code-completion-at=%s:250:1 %s | FileCheck -check-prefix=CHECK-COMP-NO-PREFIX %s
-// CHECK-COMP-NO-PREFIX: NotImplemented:{TypedText @end} (40)
+// CHECK-COMP-NO-PREFIX: Keyword:{TypedText @end} (40)
 // CHECK-COMP-NO-PREFIX: ObjCClassMethodDecl:{Text +}{HorizontalSpace  }{LeftParen (}{Text int}{RightParen )}{TypedText aClassMethod:}{LeftParen (}{Text int}{RightParen )}{Text x} (40)
 // CHECK-COMP-NO-PREFIX: ObjCInstanceMethodDecl:{Text -}{HorizontalSpace  }{LeftParen (}{Text void}{RightParen )}{TypedText aMethod} (40)
 // CHECK-COMP-NO-PREFIX: ObjCInterfaceDecl:{TypedText I1}

diff  --git a/clang/test/Index/complete-modules.m b/clang/test/Index/complete-modules.m
index 21f0e4bafe890..466fe02aecec1 100644
--- a/clang/test/Index/complete-modules.m
+++ b/clang/test/Index/complete-modules.m
@@ -14,5 +14,5 @@
 // CHECK-LIBA: ModuleImport:{TypedText Extensions} (50)
 
 // RUN: c-index-test -code-completion-at=%s:4:1 -fmodules-cache-path=%t -fmodules -F %S/Inputs/Frameworks -I %S/Inputs/Headers %s | FileCheck -check-prefix=CHECK-TOP %s
-// CHECK-TOP: NotImplemented:{TypedText @import}{HorizontalSpace  }{Placeholder module} (40)
+// CHECK-TOP: Pattern:{TypedText @import}{HorizontalSpace  }{Placeholder module} (40)
 

diff  --git a/clang/test/Index/complete-preprocessor.m b/clang/test/Index/complete-preprocessor.m
index 1cc2f32b7efa6..a067d914ec742 100644
--- a/clang/test/Index/complete-preprocessor.m
+++ b/clang/test/Index/complete-preprocessor.m
@@ -14,46 +14,46 @@
 FOO(in,t) value;
 
 // RUN: c-index-test -code-completion-at=%s:4:3 %s | FileCheck -check-prefix=CHECK-CC1 %s
-// CHECK-CC1: NotImplemented:{TypedText define}{HorizontalSpace  }{Placeholder macro} (40)
-// CHECK-CC1-NEXT: NotImplemented:{TypedText define}{HorizontalSpace  }{Placeholder macro}{LeftParen (}{Placeholder args}{RightParen )} (40)
-// CHECK-CC1-NEXT: NotImplemented:{TypedText error}{HorizontalSpace  }{Placeholder message} (40)
-// CHECK-CC1-NEXT: NotImplemented:{TypedText if}{HorizontalSpace  }{Placeholder condition} (40)
-// CHECK-CC1-NEXT: NotImplemented:{TypedText ifdef}{HorizontalSpace  }{Placeholder macro} (40)
-// CHECK-CC1-NEXT: NotImplemented:{TypedText ifndef}{HorizontalSpace  }{Placeholder macro} (40)
-// CHECK-CC1-NEXT: NotImplemented:{TypedText import}{HorizontalSpace  }{Text "}{Placeholder header}{Text "} (40)
-// CHECK-CC1-NEXT: NotImplemented:{TypedText import}{HorizontalSpace  }{Text <}{Placeholder header}{Text >} (40)
-// CHECK-CC1-NEXT: NotImplemented:{TypedText include}{HorizontalSpace  }{Text "}{Placeholder header}{Text "} (40)
-// CHECK-CC1-NEXT: NotImplemented:{TypedText include}{HorizontalSpace  }{Text <}{Placeholder header}{Text >} (40)
-// CHECK-CC1-NEXT: NotImplemented:{TypedText include_next}{HorizontalSpace  }{Text "}{Placeholder header}{Text "} (40)
-// CHECK-CC1-NEXT: NotImplemented:{TypedText include_next}{HorizontalSpace  }{Text <}{Placeholder header}{Text >} (40)
-// CHECK-CC1-NEXT: NotImplemented:{TypedText line}{HorizontalSpace  }{Placeholder number} (40)
-// CHECK-CC1-NEXT: NotImplemented:{TypedText line}{HorizontalSpace  }{Placeholder number}{HorizontalSpace  }{Text "}{Placeholder filename}{Text "} (40)
-// CHECK-CC1-NEXT: NotImplemented:{TypedText pragma}{HorizontalSpace  }{Placeholder arguments} (40)
-// CHECK-CC1-NEXT: NotImplemented:{TypedText undef}{HorizontalSpace  }{Placeholder macro} (40)
-// CHECK-CC1-NEXT: NotImplemented:{TypedText warning}{HorizontalSpace  }{Placeholder message} (40)
+// CHECK-CC1: Pattern:{TypedText define}{HorizontalSpace  }{Placeholder macro} (40)
+// CHECK-CC1-NEXT: Pattern:{TypedText define}{HorizontalSpace  }{Placeholder macro}{LeftParen (}{Placeholder args}{RightParen )} (40)
+// CHECK-CC1-NEXT: Pattern:{TypedText error}{HorizontalSpace  }{Placeholder message} (40)
+// CHECK-CC1-NEXT: Pattern:{TypedText if}{HorizontalSpace  }{Placeholder condition} (40)
+// CHECK-CC1-NEXT: Pattern:{TypedText ifdef}{HorizontalSpace  }{Placeholder macro} (40)
+// CHECK-CC1-NEXT: Pattern:{TypedText ifndef}{HorizontalSpace  }{Placeholder macro} (40)
+// CHECK-CC1-NEXT: Pattern:{TypedText import}{HorizontalSpace  }{Text "}{Placeholder header}{Text "} (40)
+// CHECK-CC1-NEXT: Pattern:{TypedText import}{HorizontalSpace  }{Text <}{Placeholder header}{Text >} (40)
+// CHECK-CC1-NEXT: Pattern:{TypedText include}{HorizontalSpace  }{Text "}{Placeholder header}{Text "} (40)
+// CHECK-CC1-NEXT: Pattern:{TypedText include}{HorizontalSpace  }{Text <}{Placeholder header}{Text >} (40)
+// CHECK-CC1-NEXT: Pattern:{TypedText include_next}{HorizontalSpace  }{Text "}{Placeholder header}{Text "} (40)
+// CHECK-CC1-NEXT: Pattern:{TypedText include_next}{HorizontalSpace  }{Text <}{Placeholder header}{Text >} (40)
+// CHECK-CC1-NEXT: Pattern:{TypedText line}{HorizontalSpace  }{Placeholder number} (40)
+// CHECK-CC1-NEXT: Pattern:{TypedText line}{HorizontalSpace  }{Placeholder number}{HorizontalSpace  }{Text "}{Placeholder filename}{Text "} (40)
+// CHECK-CC1-NEXT: Pattern:{TypedText pragma}{HorizontalSpace  }{Placeholder arguments} (40)
+// CHECK-CC1-NEXT: Pattern:{TypedText undef}{HorizontalSpace  }{Placeholder macro} (40)
+// CHECK-CC1-NEXT: Pattern:{TypedText warning}{HorizontalSpace  }{Placeholder message} (40)
 // RUN: c-index-test -code-completion-at=%s:5:2 %s | FileCheck -check-prefix=CHECK-CC2 %s
-// CHECK-CC2: NotImplemented:{TypedText define}{HorizontalSpace  }{Placeholder macro} (40)
-// CHECK-CC2-NEXT: NotImplemented:{TypedText define}{HorizontalSpace  }{Placeholder macro}{LeftParen (}{Placeholder args}{RightParen )} (40)
-// CHECK-CC2-NEXT: NotImplemented:{TypedText elif}{HorizontalSpace  }{Placeholder condition} (40)
-// CHECK-CC2-NEXT: NotImplemented:{TypedText elifdef}{HorizontalSpace  }{Placeholder macro} (40)
-// CHECK-CC2-NEXT: NotImplemented:{TypedText elifndef}{HorizontalSpace  }{Placeholder macro} (40)
-// CHECK-CC2-NEXT: NotImplemented:{TypedText else} (40)
-// CHECK-CC2-NEXT: NotImplemented:{TypedText endif} (40)
-// CHECK-CC2-NEXT: NotImplemented:{TypedText error}{HorizontalSpace  }{Placeholder message} (40)
-// CHECK-CC2-NEXT: NotImplemented:{TypedText if}{HorizontalSpace  }{Placeholder condition} (40)
-// CHECK-CC2-NEXT: NotImplemented:{TypedText ifdef}{HorizontalSpace  }{Placeholder macro} (40)
-// CHECK-CC2-NEXT: NotImplemented:{TypedText ifndef}{HorizontalSpace  }{Placeholder macro} (40)
-// CHECK-CC2-NEXT: NotImplemented:{TypedText import}{HorizontalSpace  }{Text "}{Placeholder header}{Text "} (40)
-// CHECK-CC2-NEXT: NotImplemented:{TypedText import}{HorizontalSpace  }{Text <}{Placeholder header}{Text >} (40)
-// CHECK-CC2-NEXT: NotImplemented:{TypedText include}{HorizontalSpace  }{Text "}{Placeholder header}{Text "} (40)
-// CHECK-CC2-NEXT: NotImplemented:{TypedText include}{HorizontalSpace  }{Text <}{Placeholder header}{Text >} (40)
-// CHECK-CC2-NEXT: NotImplemented:{TypedText include_next}{HorizontalSpace  }{Text "}{Placeholder header}{Text "} (40)
-// CHECK-CC2-NEXT: NotImplemented:{TypedText include_next}{HorizontalSpace  }{Text <}{Placeholder header}{Text >} (40)
-// CHECK-CC2-NEXT: NotImplemented:{TypedText line}{HorizontalSpace  }{Placeholder number} (40)
-// CHECK-CC2-NEXT: NotImplemented:{TypedText line}{HorizontalSpace  }{Placeholder number}{HorizontalSpace  }{Text "}{Placeholder filename}{Text "} (40)
-// CHECK-CC2-NEXT: NotImplemented:{TypedText pragma}{HorizontalSpace  }{Placeholder arguments} (40)
-// CHECK-CC2-NEXT: NotImplemented:{TypedText undef}{HorizontalSpace  }{Placeholder macro} (40)
-// CHECK-CC2-NEXT: NotImplemented:{TypedText warning}{HorizontalSpace  }{Placeholder message} (40)
+// CHECK-CC2: Pattern:{TypedText define}{HorizontalSpace  }{Placeholder macro} (40)
+// CHECK-CC2-NEXT: Pattern:{TypedText define}{HorizontalSpace  }{Placeholder macro}{LeftParen (}{Placeholder args}{RightParen )} (40)
+// CHECK-CC2-NEXT: Pattern:{TypedText elif}{HorizontalSpace  }{Placeholder condition} (40)
+// CHECK-CC2-NEXT: Pattern:{TypedText elifdef}{HorizontalSpace  }{Placeholder macro} (40)
+// CHECK-CC2-NEXT: Pattern:{TypedText elifndef}{HorizontalSpace  }{Placeholder macro} (40)
+// CHECK-CC2-NEXT: Pattern:{TypedText else} (40)
+// CHECK-CC2-NEXT: Pattern:{TypedText endif} (40)
+// CHECK-CC2-NEXT: Pattern:{TypedText error}{HorizontalSpace  }{Placeholder message} (40)
+// CHECK-CC2-NEXT: Pattern:{TypedText if}{HorizontalSpace  }{Placeholder condition} (40)
+// CHECK-CC2-NEXT: Pattern:{TypedText ifdef}{HorizontalSpace  }{Placeholder macro} (40)
+// CHECK-CC2-NEXT: Pattern:{TypedText ifndef}{HorizontalSpace  }{Placeholder macro} (40)
+// CHECK-CC2-NEXT: Pattern:{TypedText import}{HorizontalSpace  }{Text "}{Placeholder header}{Text "} (40)
+// CHECK-CC2-NEXT: Pattern:{TypedText import}{HorizontalSpace  }{Text <}{Placeholder header}{Text >} (40)
+// CHECK-CC2-NEXT: Pattern:{TypedText include}{HorizontalSpace  }{Text "}{Placeholder header}{Text "} (40)
+// CHECK-CC2-NEXT: Pattern:{TypedText include}{HorizontalSpace  }{Text <}{Placeholder header}{Text >} (40)
+// CHECK-CC2-NEXT: Pattern:{TypedText include_next}{HorizontalSpace  }{Text "}{Placeholder header}{Text "} (40)
+// CHECK-CC2-NEXT: Pattern:{TypedText include_next}{HorizontalSpace  }{Text <}{Placeholder header}{Text >} (40)
+// CHECK-CC2-NEXT: Pattern:{TypedText line}{HorizontalSpace  }{Placeholder number} (40)
+// CHECK-CC2-NEXT: Pattern:{TypedText line}{HorizontalSpace  }{Placeholder number}{HorizontalSpace  }{Text "}{Placeholder filename}{Text "} (40)
+// CHECK-CC2-NEXT: Pattern:{TypedText pragma}{HorizontalSpace  }{Placeholder arguments} (40)
+// CHECK-CC2-NEXT: Pattern:{TypedText undef}{HorizontalSpace  }{Placeholder macro} (40)
+// CHECK-CC2-NEXT: Pattern:{TypedText warning}{HorizontalSpace  }{Placeholder message} (40)
 // RUN: c-index-test -code-completion-at=%s:9:8 %s | FileCheck -check-prefix=CHECK-CC3 %s
 // CHECK-CC3: macro definition:{TypedText BAR} (40)
 // CHECK-CC3: macro definition:{TypedText FOO} (40)
@@ -63,16 +63,16 @@
 // CHECK-CC4: macro definition:{TypedText BAR} (70)
 // CHECK-CC4: macro definition:{TypedText FOO}{LeftParen (}{Placeholder a}{Comma , }{Placeholder b}{RightParen )} (70)
 // RUN: c-index-test -code-completion-at=%s:14:5 %s | FileCheck -check-prefix=CHECK-CC5 %s
-// CHECK-CC5: NotImplemented:{TypedText const} (50)
-// CHECK-CC5: NotImplemented:{TypedText double} (50)
-// CHECK-CC5: NotImplemented:{TypedText enum} (50)
-// CHECK-CC5: NotImplemented:{TypedText extern} (40)
-// CHECK-CC5: NotImplemented:{TypedText float} (50)
+// CHECK-CC5: Keyword:{TypedText const} (50)
+// CHECK-CC5: Keyword:{TypedText double} (50)
+// CHECK-CC5: Keyword:{TypedText enum} (50)
+// CHECK-CC5: Keyword:{TypedText extern} (40)
+// CHECK-CC5: Keyword:{TypedText float} (50)
 // CHECK-CC5: macro definition:{TypedText FOO}{LeftParen (}{Placeholder a}{Comma , }{Placeholder b}{RightParen )} (70)
 // CHECK-CC5: TypedefDecl:{TypedText id} (50)
-// CHECK-CC5: NotImplemented:{TypedText inline} (40)
-// CHECK-CC5: NotImplemented:{TypedText int} (50)
-// CHECK-CC5: NotImplemented:{TypedText long} (50)
+// CHECK-CC5: Keyword:{TypedText inline} (40)
+// CHECK-CC5: Keyword:{TypedText int} (50)
+// CHECK-CC5: Keyword:{TypedText long} (50)
 
 // Same tests as above, but with completion caching.
 // RUN: env CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_CACHING=1 c-index-test -code-completion-at=%s:4:2 %s | FileCheck -check-prefix=CHECK-CC1 %s

diff  --git a/clang/test/Index/complete-recovery.m b/clang/test/Index/complete-recovery.m
index bd920eb3ac6e0..3d547c3671cfb 100644
--- a/clang/test/Index/complete-recovery.m
+++ b/clang/test/Index/complete-recovery.m
@@ -18,19 +18,19 @@ - (void)method:(int)x {
 
 // RUN: env CINDEXTEST_CODE_COMPLETE_PATTERNS=1 c-index-test -code-completion-at=%s:9:20 %s 2>%t | FileCheck -check-prefix=CHECK-CC1 %s
 // RUN: not grep error %t
-// CHECK-CC1: NotImplemented:{ResultType char[]}{TypedText @encode}{LeftParen (}{Placeholder type-name}{RightParen )}
-// CHECK-CC1-NOT: NotImplemented:{TypedText _Bool}
+// CHECK-CC1: Pattern:{ResultType char[]}{TypedText @encode}{LeftParen (}{Placeholder type-name}{RightParen )}
+// CHECK-CC1-NOT: Keyword:{TypedText _Bool}
 // CHECK-CC1: VarDecl:{ResultType A *}{TypedText a}
-// CHECK-CC1: NotImplemented:{ResultType size_t}{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )}
+// CHECK-CC1: Pattern:{ResultType size_t}{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )}
 
 // Test case for fix committed in r145441.
 // RUN: env CINDEXTEST_CODE_COMPLETE_PATTERNS=1 c-index-test -code-completion-at=%s:9:20 %s -fms-compatibility | FileCheck -check-prefix=CHECK-CC1 %s
 
 // RUN: env CINDEXTEST_CODE_COMPLETE_PATTERNS=1 c-index-test -code-completion-at=%s:10:25 %s | FileCheck -check-prefix=CHECK-CC2 %s
-// CHECK-CC2: NotImplemented:{ResultType char[]}{TypedText @encode}{LeftParen (}{Placeholder type-name}{RightParen )}
-// CHECK-CC2: NotImplemented:{TypedText _Bool}
+// CHECK-CC2: Pattern:{ResultType char[]}{TypedText @encode}{LeftParen (}{Placeholder type-name}{RightParen )}
+// CHECK-CC2: Keyword:{TypedText _Bool}
 // CHECK-CC2: VarDecl:{ResultType A *}{TypedText a}
-// CHECK-CC2: NotImplemented:{ResultType size_t}{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )}
+// CHECK-CC2: Pattern:{ResultType size_t}{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )}
 // RUN: env CINDEXTEST_CODE_COMPLETE_PATTERNS=1 c-index-test -code-completion-at=%s:12:11 %s | FileCheck -check-prefix=CHECK-CC3 %s
 // CHECK-CC3: ObjCInstanceMethodDecl:{ResultType void}{TypedText method:}{Placeholder (int)} (32)
 // RUN: env CINDEXTEST_CODE_COMPLETE_PATTERNS=1 c-index-test -code-completion-at=%s:13:22 %s | FileCheck -check-prefix=CHECK-CC3 %s

diff  --git a/clang/test/Index/complete-stmt.c b/clang/test/Index/complete-stmt.c
index 78f49745a869d..a0b8fd3714383 100644
--- a/clang/test/Index/complete-stmt.c
+++ b/clang/test/Index/complete-stmt.c
@@ -8,20 +8,20 @@ void f(int x) {
 }
 
 // RUN: env CINDEXTEST_CODE_COMPLETE_PATTERNS=1 c-index-test -code-completion-at=%s:7:4 %s | FileCheck -check-prefix=CHECK-IF-ELSE %s
-// CHECK-IF-ELSE: NotImplemented:{TypedText else}{HorizontalSpace  }{LeftBrace {}{VerticalSpace  }{Placeholder statements}{VerticalSpace  }{RightBrace }} (40)
-// CHECK-IF-ELSE: NotImplemented:{TypedText else if}{HorizontalSpace  }{LeftParen (}{Placeholder expression}{RightParen )}{HorizontalSpace  }{LeftBrace {}{VerticalSpace  }{Placeholder statements}{VerticalSpace  }{RightBrace }} (40)
+// CHECK-IF-ELSE: Pattern:{TypedText else}{HorizontalSpace  }{LeftBrace {}{VerticalSpace  }{Placeholder statements}{VerticalSpace  }{RightBrace }} (40)
+// CHECK-IF-ELSE: Pattern:{TypedText else if}{HorizontalSpace  }{LeftParen (}{Placeholder expression}{RightParen )}{HorizontalSpace  }{LeftBrace {}{VerticalSpace  }{Placeholder statements}{VerticalSpace  }{RightBrace }} (40)
 
 // RUN: c-index-test -code-completion-at=%s:7:4 %s | FileCheck -check-prefix=CHECK-IF-ELSE-SIMPLE %s
-// CHECK-IF-ELSE-SIMPLE: NotImplemented:{TypedText else} (40)
-// CHECK-IF-ELSE-SIMPLE: NotImplemented:{TypedText else if}{HorizontalSpace  }{LeftParen (}{Placeholder expression}{RightParen )} (40)
+// CHECK-IF-ELSE-SIMPLE: Pattern:{TypedText else} (40)
+// CHECK-IF-ELSE-SIMPLE: Pattern:{TypedText else if}{HorizontalSpace  }{LeftParen (}{Placeholder expression}{RightParen )} (40)
 
 // RUN: c-index-test -code-completion-at=%s:6:1 %s | FileCheck -check-prefix=CHECK-STMT %s
-// CHECK-STMT: NotImplemented:{TypedText _Nonnull} (50)
-// CHECK-STMT: NotImplemented:{TypedText _Nullable} (50)
-// CHECK-STMT: NotImplemented:{TypedText char} (50)
-// CHECK-STMT: NotImplemented:{TypedText const} (50)
-// CHECK-STMT: NotImplemented:{TypedText double} (50)
-// CHECK-STMT: NotImplemented:{TypedText enum} (50)
+// CHECK-STMT: Keyword:{TypedText _Nonnull} (50)
+// CHECK-STMT: Keyword:{TypedText _Nullable} (50)
+// CHECK-STMT: Keyword:{TypedText char} (50)
+// CHECK-STMT: Keyword:{TypedText const} (50)
+// CHECK-STMT: Keyword:{TypedText double} (50)
+// CHECK-STMT: Keyword:{TypedText enum} (50)
 // CHECK-STMT: FunctionDecl:{ResultType void}{TypedText f}{LeftParen (}{Placeholder int x}{RightParen )} (50)
 // CHECK-STMT: TypedefDecl:{TypedText Integer} (50)
 // CHECK-STMT: ParmDecl:{ResultType int}{TypedText x} (34)

diff  --git a/clang/test/Index/complete-super.cpp b/clang/test/Index/complete-super.cpp
index 92d3f7f585f3b..11766ceb6f316 100644
--- a/clang/test/Index/complete-super.cpp
+++ b/clang/test/Index/complete-super.cpp
@@ -32,16 +32,16 @@ void B::bar(float real) {
 // CHECK-FOO-QUAL: CXXMethod:{TypedText foo}{LeftParen (}{Placeholder a}{Comma , }{Placeholder b}{RightParen )} (20)
 
 // RUN: c-index-test -code-completion-at=%s:5:1 %s | FileCheck -check-prefix=CHECK-ACCESS %s
-// CHECK-ACCESS: NotImplemented:{TypedText private} (40)
-// CHECK-ACCESS: NotImplemented:{TypedText protected} (40)
-// CHECK-ACCESS: NotImplemented:{TypedText public} (40)
+// CHECK-ACCESS: Pattern:{TypedText private} (40)
+// CHECK-ACCESS: Pattern:{TypedText protected} (40)
+// CHECK-ACCESS: Pattern:{TypedText public} (40)
 
 // RUN: env CINDEXTEST_CODE_COMPLETE_PATTERNS=1 c-index-test -code-completion-at=%s:5:1 %s | FileCheck -check-prefix=CHECK-ACCESS-PATTERN %s
-// CHECK-ACCESS-PATTERN: NotImplemented:{TypedText private}{Colon :} (40)
-// CHECK-ACCESS-PATTERN: NotImplemented:{TypedText protected}{Colon :} (40)
-// CHECK-ACCESS-PATTERN: NotImplemented:{TypedText public}{Colon :} (40)
+// CHECK-ACCESS-PATTERN: Pattern:{TypedText private}{Colon :} (40)
+// CHECK-ACCESS-PATTERN: Pattern:{TypedText protected}{Colon :} (40)
+// CHECK-ACCESS-PATTERN: Pattern:{TypedText public}{Colon :} (40)
 
 // RUN: env CINDEXTEST_CODE_COMPLETE_PATTERNS=1 c-index-test -code-completion-at=%s:10:12 %s | FileCheck -check-prefix=CHECK-INHERITANCE-PATTERN %s
-// CHECK-INHERITANCE-PATTERN: NotImplemented:{TypedText private} (40)
-// CHECK-INHERITANCE-PATTERN: NotImplemented:{TypedText protected} (40)
-// CHECK-INHERITANCE-PATTERN: NotImplemented:{TypedText public} (40)
+// CHECK-INHERITANCE-PATTERN: Pattern:{TypedText private} (40)
+// CHECK-INHERITANCE-PATTERN: Pattern:{TypedText protected} (40)
+// CHECK-INHERITANCE-PATTERN: Pattern:{TypedText public} (40)

diff  --git a/clang/test/Index/complete-synthesized.m b/clang/test/Index/complete-synthesized.m
index 8c848fc18b51a..87e442e5cc049 100644
--- a/clang/test/Index/complete-synthesized.m
+++ b/clang/test/Index/complete-synthesized.m
@@ -39,7 +39,7 @@ - (short)method3 {
 // RUN: c-index-test -code-completion-at=%s:30:2 -target x86_64-apple-macosx10.7 -fobjc-nonfragile-abi %s | FileCheck %s
 // RUN: c-index-test -code-completion-at=%s:34:2 -target x86_64-apple-macosx10.7 -fobjc-nonfragile-abi %s | FileCheck %s
 
-// CHECK: NotImplemented:{TypedText _Bool} (50)
+// CHECK: Keyword:{TypedText _Bool} (50)
 // CHECK: ObjCIvarDecl:{ResultType float}{TypedText _prop2} (35)
 // CHECK-NOT: prop2
 // CHECK-NOT: prop3

diff  --git a/clang/test/Index/complete-type-factors.m b/clang/test/Index/complete-type-factors.m
index fcd51284bf0b4..36c63b520847c 100644
--- a/clang/test/Index/complete-type-factors.m
+++ b/clang/test/Index/complete-type-factors.m
@@ -43,7 +43,7 @@ void test2(A *a) {
 // CHECK-CC1: EnumConstantDecl:{ResultType enum Priority}{TypedText Low} (32)
 // CHECK-CC1: ParmDecl:{ResultType enum Priority}{TypedText priority} (17)
 // CHECK-CC1: EnumConstantDecl:{ResultType enum Color}{TypedText Red} (32)
-// CHECK-CC1: NotImplemented:{ResultType size_t}{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (40)
+// CHECK-CC1: Pattern:{ResultType size_t}{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (40)
 // CHECK-CC1: FunctionDecl:{ResultType enum Priority}{TypedText test1}{LeftParen (}{Placeholder enum Priority priority}{Comma , }{Placeholder enum Color color}{Comma , }{Placeholder int integer}{RightParen )} (25)
 // RUN: c-index-test -code-completion-at=%s:17:18 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC2 %s
 // CHECK-CC2: EnumConstantDecl:{ResultType enum Color}{TypedText Blue} (16)
@@ -57,7 +57,7 @@ void test2(A *a) {
 // CHECK-CC2: EnumConstantDecl:{ResultType enum Priority}{TypedText Low} (65)
 // CHECK-CC2: ParmDecl:{ResultType enum Priority}{TypedText priority} (34)
 // CHECK-CC2: EnumConstantDecl:{ResultType enum Color}{TypedText Red} (16)
-// CHECK-CC2: NotImplemented:{ResultType size_t}{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (40)
+// CHECK-CC2: Pattern:{ResultType size_t}{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (40)
 // CHECK-CC2: FunctionDecl:{ResultType enum Priority}{TypedText test1}{LeftParen (}{Placeholder enum Priority priority}{Comma , }{Placeholder enum Color color}{Comma , }{Placeholder int integer}{RightParen )} (50)
 // RUN: c-index-test -code-completion-at=%s:18:10 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC3 %s
 // CHECK-CC3: EnumConstantDecl:{ResultType enum Color}{TypedText Blue} (65)
@@ -73,7 +73,7 @@ void test2(A *a) {
 // CHECK-CC3: EnumConstantDecl:{ResultType enum Priority}{TypedText Low} (16)
 // CHECK-CC3: ParmDecl:{ResultType enum Priority}{TypedText priority} (8)
 // CHECK-CC3: EnumConstantDecl:{ResultType enum Color}{TypedText Red} (65)
-// CHECK-CC3: NotImplemented:{ResultType size_t}{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (40)
+// CHECK-CC3: Pattern:{ResultType size_t}{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (40)
 // CHECK-CC3: FunctionDecl:{ResultType enum Priority}{TypedText test1}{LeftParen (}{Placeholder enum Priority priority}{Comma , }{Placeholder enum Color color}{Comma , }{Placeholder int integer}{RightParen )} (12)
 // RUN: c-index-test -code-completion-at=%s:19:9 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC4 %s
 // CHECK-CC4: EnumConstantDecl:{ResultType enum Color}{TypedText Blue} (65)
@@ -89,7 +89,7 @@ void test2(A *a) {
 // CHECK-CC4: EnumConstantDecl:{ResultType enum Priority}{TypedText Low} (65)
 // CHECK-CC4: ParmDecl:{ResultType enum Priority}{TypedText priority} (34)
 // CHECK-CC4: EnumConstantDecl:{ResultType enum Color}{TypedText Red} (65)
-// CHECK-CC4: NotImplemented:{ResultType size_t}{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (40)
+// CHECK-CC4: Pattern:{ResultType size_t}{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (40)
 // CHECK-CC4: FunctionDecl:{ResultType enum Priority}{TypedText test1}{LeftParen (}{Placeholder enum Priority priority}{Comma , }{Placeholder enum Color color}{Comma , }{Placeholder int integer}{RightParen )} (50)
 // RUN: c-index-test -code-completion-at=%s:21:9 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC4 %s
 // RUN: c-index-test -code-completion-at=%s:22:7 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC6 %s
@@ -107,7 +107,7 @@ void test2(A *a) {
 // CHECK-CC6: EnumConstantDecl:{ResultType enum Priority}{TypedText Low} (65)
 // CHECK-CC6: ParmDecl:{ResultType enum Priority}{TypedText priority} (34)
 // CHECK-CC6: EnumConstantDecl:{ResultType enum Color}{TypedText Red} (16)
-// CHECK-CC6: NotImplemented:{ResultType size_t}{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (40)
+// CHECK-CC6: Pattern:{ResultType size_t}{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (40)
 // CHECK-CC6: FunctionDecl:{ResultType enum Priority}{TypedText test1}{LeftParen (}{Placeholder enum Priority priority}{Comma , }{Placeholder enum Color color}{Comma , }{Placeholder int integer}{RightParen )} (50)
 // RUN: c-index-test -code-completion-at=%s:31:13 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC7 %s
 // RUN: c-index-test -code-completion-at=%s:32:13 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC7 %s

diff  --git a/clang/tools/c-index-test/c-index-test.c b/clang/tools/c-index-test/c-index-test.c
index 108b44524cc8a..4d49dfaab28f0 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;

diff  --git a/clang/tools/libclang/CIndex.cpp b/clang/tools/libclang/CIndex.cpp
index ee6773531cfda..0f47a6cab400e 100644
--- a/clang/tools/libclang/CIndex.cpp
+++ b/clang/tools/libclang/CIndex.cpp
@@ -5403,6 +5403,22 @@ CXString clang_getCursorDisplayName(CXCursor C) {
   return clang_getCursorSpelling(C);
 }
 
+CXString
+clang_getCompletionResultKindSpelling(enum CXCompletionResultKind Kind) {
+  switch (Kind) {
+  case CXCompletionResult_Declaration:
+    return cxstring::createRef("Declaration");
+  case CXCompletionResult_Keyword:
+    return cxstring::createRef("Keyword");
+  case CXCompletionResult_Macro:
+    return cxstring::createRef("Macro");
+  case CXCompletionResult_Pattern:
+    return cxstring::createRef("Pattern");
+  }
+
+  llvm_unreachable("Unhandled CXCompletionResultKind");
+}
+
 CXString clang_getCursorKindSpelling(enum CXCursorKind Kind) {
   switch (Kind) {
   case CXCursor_FunctionDecl:

diff  --git a/clang/tools/libclang/CIndexCodeCompletion.cpp b/clang/tools/libclang/CIndexCodeCompletion.cpp
index 0d75970f2f652..9cfa71016c25d 100644
--- a/clang/tools/libclang/CIndexCodeCompletion.cpp
+++ b/clang/tools/libclang/CIndexCodeCompletion.cpp
@@ -586,6 +586,20 @@ namespace {
                                                   includeBriefComments());
         
         CXCompletionResult R;
+        switch (Results[I].Kind) {
+        case CodeCompletionResult::RK_Declaration:
+          R.ResultKind = CXCompletionResult_Declaration;
+          break;
+        case CodeCompletionResult::RK_Keyword:
+          R.ResultKind = CXCompletionResult_Keyword;
+          break;
+        case CodeCompletionResult::RK_Macro:
+          R.ResultKind = CXCompletionResult_Macro;
+          break;
+        case CodeCompletionResult::RK_Pattern:
+          R.ResultKind = CXCompletionResult_Pattern;
+          break;
+        }
         R.CursorKind = Results[I].CursorKind;
         R.CompletionString = StoredCompletion;
         StoredResults.push_back(R);
@@ -666,6 +680,7 @@ namespace {
                                                 includeBriefComments(), Braced);
 
         CXCompletionResult R;
+        R.ResultKind = CXCompletionResult_Declaration;
         R.CursorKind = CXCursor_OverloadCandidate;
         R.CompletionString = StoredCompletion;
         StoredResults.push_back(R);

diff  --git a/clang/tools/libclang/libclang.map b/clang/tools/libclang/libclang.map
index 331ad5760d12e..41603b4360b41 100644
--- a/clang/tools/libclang/libclang.map
+++ b/clang/tools/libclang/libclang.map
@@ -4,6 +4,11 @@
 # On platforms where versions scripts are not used, this file will be used to
 # generate a list of exports for libclang.so
 
+LLVM_15 {
+  global:
+    clang_getCompletionResultKindSpelling;
+};
+
 LLVM_13 {
   global:
     clang_BlockCommandComment_getArgText;


        


More information about the cfe-commits mailing list