egorzhdan updated this revision to Diff 471838.
egorzhdan added a comment.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

Fix clangd compilation


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D136844/new/

https://reviews.llvm.org/D136844

Files:
  clang-tools-extra/clangd/CodeComplete.cpp
  clang-tools-extra/clangd/CodeCompletionStrings.cpp
  clang-tools-extra/clangd/Quality.cpp
  clang/include/clang-c/Index.h
  clang/include/clang/Sema/CodeCompleteConsumer.h
  clang/lib/Frontend/ASTUnit.cpp
  clang/lib/Sema/CodeCompleteConsumer.cpp
  clang/lib/Sema/SemaCodeComplete.cpp
  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
  lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp

Index: lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
===================================================================
--- lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
+++ lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
@@ -859,15 +859,15 @@
                            CodeCompletionResult Result) override {
     // This code is mostly copied from CodeCompleteConsumer.
     switch (Result.Kind) {
-    case CodeCompletionResult::RK_Declaration:
+    case CXCompletionResult_Declaration:
       return !(
           Result.Declaration->getIdentifier() &&
           Result.Declaration->getIdentifier()->getName().startswith(Filter));
-    case CodeCompletionResult::RK_Keyword:
+    case CXCompletionResult_Keyword:
       return !StringRef(Result.Keyword).startswith(Filter);
-    case CodeCompletionResult::RK_Macro:
+    case CXCompletionResult_Macro:
       return !Result.Macro->getName().startswith(Filter);
-    case CodeCompletionResult::RK_Pattern:
+    case CXCompletionResult_Pattern:
       return !StringRef(Result.Pattern->getAsString()).startswith(Filter);
     }
     // If we trigger this assert or the above switch yields a warning, then
@@ -894,7 +894,7 @@
     std::string Description;
     // Handle the different completion kinds that come from the Sema.
     switch (R.Kind) {
-    case CodeCompletionResult::RK_Declaration: {
+    case CXCompletionResult_Declaration: {
       const NamedDecl *D = R.Declaration;
       ToInsert = R.Declaration->getNameAsString();
       // If we have a function decl that has no arguments we want to
@@ -920,13 +920,13 @@
       }
       break;
     }
-    case CodeCompletionResult::RK_Keyword:
+    case CXCompletionResult_Keyword:
       ToInsert = R.Keyword;
       break;
-    case CodeCompletionResult::RK_Macro:
+    case CXCompletionResult_Macro:
       ToInsert = R.Macro->getName().str();
       break;
-    case CodeCompletionResult::RK_Pattern:
+    case CXCompletionResult_Pattern:
       ToInsert = R.Pattern->getTypedText();
       break;
     }
Index: clang/tools/libclang/libclang.map
===================================================================
--- clang/tools/libclang/libclang.map
+++ clang/tools/libclang/libclang.map
@@ -4,6 +4,10 @@
 # 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;
Index: clang/tools/libclang/CIndexCodeCompletion.cpp
===================================================================
--- clang/tools/libclang/CIndexCodeCompletion.cpp
+++ clang/tools/libclang/CIndexCodeCompletion.cpp
@@ -586,6 +586,7 @@
                                                   includeBriefComments());
         
         CXCompletionResult R;
+        R.ResultKind = Results[I].Kind;
         R.CursorKind = Results[I].CursorKind;
         R.CompletionString = StoredCompletion;
         StoredResults.push_back(R);
@@ -666,6 +667,7 @@
                                                 includeBriefComments(), Braced);
 
         CXCompletionResult R;
+        R.ResultKind = CXCompletionResult_Declaration;
         R.CursorKind = CXCursor_OverloadCandidate;
         R.CompletionString = StoredCompletion;
         StoredResults.push_back(R);
Index: clang/tools/libclang/CIndex.cpp
===================================================================
--- clang/tools/libclang/CIndex.cpp
+++ clang/tools/libclang/CIndex.cpp
@@ -5390,6 +5390,22 @@
   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:
Index: clang/tools/c-index-test/c-index-test.c
===================================================================
--- clang/tools/c-index-test/c-index-test.c
+++ clang/tools/c-index-test/c-index-test.c
@@ -2505,7 +2505,10 @@
                                     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;
Index: clang/test/Index/complete-type-factors.m
===================================================================
--- clang/test/Index/complete-type-factors.m
+++ clang/test/Index/complete-type-factors.m
@@ -43,7 +43,7 @@
 // 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 @@
 // 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 @@
 // 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 @@
 // 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 @@
 // 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
Index: clang/test/Index/complete-synthesized.m
===================================================================
--- clang/test/Index/complete-synthesized.m
+++ clang/test/Index/complete-synthesized.m
@@ -39,7 +39,7 @@
 // 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
Index: clang/test/Index/complete-super.cpp
===================================================================
--- clang/test/Index/complete-super.cpp
+++ clang/test/Index/complete-super.cpp
@@ -32,16 +32,16 @@
 // 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)
Index: clang/test/Index/complete-stmt.c
===================================================================
--- clang/test/Index/complete-stmt.c
+++ clang/test/Index/complete-stmt.c
@@ -8,20 +8,20 @@
 }
 
 // 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)
Index: clang/test/Index/complete-recovery.m
===================================================================
--- clang/test/Index/complete-recovery.m
+++ clang/test/Index/complete-recovery.m
@@ -18,19 +18,19 @@
 
 // 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
Index: clang/test/Index/complete-preprocessor.m
===================================================================
--- clang/test/Index/complete-preprocessor.m
+++ 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
Index: clang/test/Index/complete-modules.m
===================================================================
--- clang/test/Index/complete-modules.m
+++ 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)
 
Index: clang/test/Index/complete-method-decls.m
===================================================================
--- clang/test/Index/complete-method-decls.m
+++ clang/test/Index/complete-method-decls.m
@@ -151,11 +151,11 @@
 // 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 @@
 // 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 @@
 @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}
Index: clang/test/Index/complete-memfunc-cvquals.cpp
===================================================================
--- clang/test/Index/complete-memfunc-cvquals.cpp
+++ clang/test/Index/complete-memfunc-cvquals.cpp
@@ -78,9 +78,9 @@
 // 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)
Index: clang/test/Index/complete-lambdas.mm
===================================================================
--- clang/test/Index/complete-lambdas.mm
+++ clang/test/Index/complete-lambdas.mm
@@ -36,14 +36,14 @@
 
 
 // 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)
Index: clang/test/Index/complete-lambdas.cpp
===================================================================
--- clang/test/Index/complete-lambdas.cpp
+++ clang/test/Index/complete-lambdas.cpp
@@ -19,12 +19,12 @@
 // 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 @@
 // 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
Index: clang/test/Index/complete-exprs.m
===================================================================
--- clang/test/Index/complete-exprs.m
+++ clang/test/Index/complete-exprs.m
@@ -18,21 +18,21 @@
 @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 @@
 // 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)
Index: clang/test/Index/complete-exprs.cpp
===================================================================
--- clang/test/Index/complete-exprs.cpp
+++ clang/test/Index/complete-exprs.cpp
@@ -47,10 +47,10 @@
 
 // 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 @@
 // 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 @@
 // 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)
Index: clang/test/Index/complete-exprs.c
===================================================================
--- clang/test/Index/complete-exprs.c
+++ clang/test/Index/complete-exprs.c
@@ -26,12 +26,12 @@
 
 // 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 @@
 // 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
Index: clang/test/Index/complete-declarators.m
===================================================================
--- clang/test/Index/complete-declarators.m
+++ clang/test/Index/complete-declarators.m
@@ -26,62 +26,62 @@
 @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
Index: clang/test/Index/complete-declarators.cpp
===================================================================
--- clang/test/Index/complete-declarators.cpp
+++ clang/test/Index/complete-declarators.cpp
@@ -16,28 +16,28 @@
 
 // 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)
 
Index: clang/test/Index/complete-at-exprstmt.m
===================================================================
--- clang/test/Index/complete-at-exprstmt.m
+++ clang/test/Index/complete-at-exprstmt.m
@@ -31,25 +31,25 @@
 // 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)
 
Index: clang/test/Index/complete-at-directives.m
===================================================================
--- clang/test/Index/complete-at-directives.m
+++ clang/test/Index/complete-at-directives.m
@@ -24,12 +24,12 @@
 // 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 @@
 // 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}
Index: clang/test/Index/code-completion.cpp
===================================================================
--- clang/test/Index/code-completion.cpp
+++ clang/test/Index/code-completion.cpp
@@ -82,8 +82,8 @@
 // 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)
Index: clang/test/Index/arc-complete.m
===================================================================
--- clang/test/Index/arc-complete.m
+++ clang/test/Index/arc-complete.m
@@ -8,9 +8,9 @@
 
 // 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)
Index: clang/lib/Sema/SemaCodeComplete.cpp
===================================================================
--- clang/lib/Sema/SemaCodeComplete.cpp
+++ clang/lib/Sema/SemaCodeComplete.cpp
@@ -1085,7 +1085,7 @@
 void ResultBuilder::MaybeAddResult(Result R, DeclContext *CurContext) {
   assert(!ShadowMaps.empty() && "Must enter into a results scope");
 
-  if (R.Kind != Result::RK_Declaration) {
+  if (R.Kind != CXCompletionResult_Declaration) {
     // For non-declaration results, just add the result.
     Results.push_back(R);
     return;
@@ -1260,7 +1260,7 @@
 
 void ResultBuilder::AddResult(Result R, DeclContext *CurContext,
                               NamedDecl *Hiding, bool InBaseClass = false) {
-  if (R.Kind != Result::RK_Declaration) {
+  if (R.Kind != CXCompletionResult_Declaration) {
     // For non-declaration results, just add the result.
     Results.push_back(R);
     return;
@@ -1384,7 +1384,7 @@
 }
 
 void ResultBuilder::AddResult(Result R) {
-  assert(R.Kind != Result::RK_Declaration &&
+  assert(R.Kind != CXCompletionResult_Declaration &&
          "Declaration results need more context");
   Results.push_back(R);
 }
@@ -2086,7 +2086,7 @@
         Builder.AddPlaceholderChunk("declaration");
         Results.AddResult(Result(Builder.TakeString()));
       } else {
-        Results.AddResult(Result("template", CodeCompletionResult::RK_Keyword));
+        Results.AddResult(Result("template", CXCompletionResult_Keyword));
       }
     }
 
@@ -2164,7 +2164,7 @@
       Builder.AddChunk(CodeCompletionString::CK_RightAngle);
       Results.AddResult(Result(Builder.TakeString()));
     } else {
-      Results.AddResult(Result("template", CodeCompletionResult::RK_Keyword));
+      Results.AddResult(Result("template", CXCompletionResult_Keyword));
     }
 
     AddStorageSpecifiers(CCC, SemaRef.getLangOpts(), Results);
@@ -3293,7 +3293,7 @@
 CodeCompletionString *CodeCompletionResult::CreateCodeCompletionStringForMacro(
     Preprocessor &PP, CodeCompletionAllocator &Allocator,
     CodeCompletionTUInfo &CCTUInfo) {
-  assert(Kind == RK_Macro);
+  assert(Kind == CXCompletionResult_Macro);
   CodeCompletionBuilder Result(Allocator, CCTUInfo, Priority, Availability);
   const MacroInfo *MI = PP.getMacroInfo(Macro);
   Result.AddTypedTextChunk(Result.getAllocator().CopyString(Macro->getName()));
@@ -3346,13 +3346,13 @@
     ASTContext &Ctx, Preprocessor &PP, const CodeCompletionContext &CCContext,
     CodeCompletionAllocator &Allocator, CodeCompletionTUInfo &CCTUInfo,
     bool IncludeBriefComments) {
-  if (Kind == RK_Macro)
+  if (Kind == CXCompletionResult_Macro)
     return CreateCodeCompletionStringForMacro(PP, Allocator, CCTUInfo);
 
   CodeCompletionBuilder Result(Allocator, CCTUInfo, Priority, Availability);
 
   PrintingPolicy Policy = getCompletionPrintingPolicy(Ctx, PP);
-  if (Kind == RK_Pattern) {
+  if (Kind == CXCompletionResult_Pattern) {
     Pattern->Priority = Priority;
     Pattern->Availability = Availability;
 
@@ -3369,11 +3369,11 @@
     return Pattern;
   }
 
-  if (Kind == RK_Keyword) {
+  if (Kind == CXCompletionResult_Keyword) {
     Result.AddTypedTextChunk(Keyword);
     return Result.TakeString();
   }
-  assert(Kind == RK_Declaration && "Missed a result kind?");
+  assert(Kind == CXCompletionResult_Declaration && "Missed a result kind?");
   return createCodeCompletionStringForDecl(
       PP, Ctx, Result, IncludeBriefComments, CCContext, Policy);
 }
@@ -7904,7 +7904,7 @@
   Result *ResultsData = Results.data();
   for (unsigned I = 0, N = Results.size(); I != N; ++I) {
     Result &R = ResultsData[I];
-    if (R.Kind == Result::RK_Declaration &&
+    if (R.Kind == CXCompletionResult_Declaration &&
         isa<ObjCMethodDecl>(R.Declaration)) {
       if (R.Priority <= BestPriority) {
         const ObjCMethodDecl *Method = cast<ObjCMethodDecl>(R.Declaration);
@@ -8585,7 +8585,7 @@
         // advantage over other results whose names don't match so closely.
         if (Results.size() &&
             Results.data()[Results.size() - 1].Kind ==
-                CodeCompletionResult::RK_Declaration &&
+                CXCompletionResult_Declaration &&
             Results.data()[Results.size() - 1].Declaration == Ivar)
           Results.data()[Results.size() - 1].Priority--;
       }
Index: clang/lib/Sema/CodeCompleteConsumer.cpp
===================================================================
--- clang/lib/Sema/CodeCompleteConsumer.cpp
+++ clang/lib/Sema/CodeCompleteConsumer.cpp
@@ -610,14 +610,14 @@
 bool PrintingCodeCompleteConsumer::isResultFilteredOut(
     StringRef Filter, CodeCompletionResult Result) {
   switch (Result.Kind) {
-  case CodeCompletionResult::RK_Declaration:
+  case CXCompletionResult_Declaration:
     return !(Result.Declaration->getIdentifier() &&
              Result.Declaration->getIdentifier()->getName().startswith(Filter));
-  case CodeCompletionResult::RK_Keyword:
+  case CXCompletionResult_Keyword:
     return !StringRef(Result.Keyword).startswith(Filter);
-  case CodeCompletionResult::RK_Macro:
+  case CXCompletionResult_Macro:
     return !Result.Macro->getName().startswith(Filter);
-  case CodeCompletionResult::RK_Pattern:
+  case CXCompletionResult_Pattern:
     return !(Result.Pattern->getTypedText() &&
              StringRef(Result.Pattern->getTypedText()).startswith(Filter));
   }
@@ -639,7 +639,7 @@
       continue;
     OS << "COMPLETION: ";
     switch (Results[I].Kind) {
-    case CodeCompletionResult::RK_Declaration:
+    case CXCompletionResult_Declaration:
       OS << *Results[I].Declaration;
       {
         std::vector<std::string> Tags;
@@ -662,11 +662,11 @@
       }
       break;
 
-    case CodeCompletionResult::RK_Keyword:
+    case CXCompletionResult_Keyword:
       OS << Results[I].Keyword;
       break;
 
-    case CodeCompletionResult::RK_Macro:
+    case CXCompletionResult_Macro:
       OS << Results[I].Macro->getName();
       if (CodeCompletionString *CCS = Results[I].CreateCodeCompletionString(
               SemaRef, Context, getAllocator(), CCTUInfo,
@@ -675,7 +675,7 @@
       }
       break;
 
-    case CodeCompletionResult::RK_Pattern:
+    case CXCompletionResult_Pattern:
       OS << "Pattern : " << Results[I].Pattern->getAsString();
       break;
     }
@@ -758,14 +758,14 @@
 
 void CodeCompletionResult::computeCursorKindAndAvailability(bool Accessible) {
   switch (Kind) {
-  case RK_Pattern:
+  case CXCompletionResult_Pattern:
     if (!Declaration) {
       // Do nothing: Patterns can come with cursor kinds!
       break;
     }
     LLVM_FALLTHROUGH;
 
-  case RK_Declaration: {
+  case CXCompletionResult_Declaration: {
     // Set the availability based on attributes.
     switch (getDeclAvailability(Declaration)) {
     case AR_Available:
@@ -801,8 +801,8 @@
     break;
   }
 
-  case RK_Macro:
-  case RK_Keyword:
+  case CXCompletionResult_Macro:
+  case CXCompletionResult_Keyword:
     llvm_unreachable("Macro and keyword kinds are handled by the constructors");
   }
 
@@ -816,13 +816,13 @@
 /// saved into Saved and the returned StringRef will refer to it.
 StringRef CodeCompletionResult::getOrderedName(std::string &Saved) const {
   switch (Kind) {
-  case RK_Keyword:
+  case CXCompletionResult_Keyword:
     return Keyword;
-  case RK_Pattern:
+  case CXCompletionResult_Pattern:
     return Pattern->getTypedText();
-  case RK_Macro:
+  case CXCompletionResult_Macro:
     return Macro->getName();
-  case RK_Declaration:
+  case CXCompletionResult_Declaration:
     // Handle declarations below.
     break;
   }
Index: clang/lib/Frontend/ASTUnit.cpp
===================================================================
--- clang/lib/Frontend/ASTUnit.cpp
+++ clang/lib/Frontend/ASTUnit.cpp
@@ -385,7 +385,7 @@
 
   for (auto &R : Results) {
     switch (R.Kind) {
-    case Result::RK_Declaration: {
+    case CXCompletionResult_Declaration: {
       bool IsNestedNameSpecifier = false;
       CachedCodeCompletionResult CachedResult;
       CachedResult.Completion = R.CreateCodeCompletionString(
@@ -464,13 +464,13 @@
       break;
     }
 
-    case Result::RK_Keyword:
-    case Result::RK_Pattern:
+    case CXCompletionResult_Keyword:
+    case CXCompletionResult_Pattern:
       // Ignore keywords and patterns; we don't care, since they are so
       // easily regenerated.
       break;
 
-    case Result::RK_Macro: {
+    case CXCompletionResult_Macro: {
       CachedCodeCompletionResult CachedResult;
       CachedResult.Completion = R.CreateCodeCompletionString(
           *TheSema, CCContext, *CachedCompletionAllocator, CCTUInfo,
@@ -1997,9 +1997,8 @@
     return;
   }
 
-  using Result = CodeCompletionResult;
   for (unsigned I = 0; I != NumResults; ++I) {
-    if (Results[I].Kind != Result::RK_Declaration)
+    if (Results[I].Kind != CXCompletionResult_Declaration)
       continue;
 
     unsigned IDNS
Index: clang/include/clang/Sema/CodeCompleteConsumer.h
===================================================================
--- clang/include/clang/Sema/CodeCompleteConsumer.h
+++ clang/include/clang/Sema/CodeCompleteConsumer.h
@@ -751,35 +751,20 @@
 /// Captures a result of code completion.
 class CodeCompletionResult {
 public:
-  /// Describes the kind of result generated.
-  enum ResultKind {
-    /// Refers to a declaration.
-    RK_Declaration = 0,
-
-    /// Refers to a keyword or symbol.
-    RK_Keyword,
-
-    /// Refers to a macro.
-    RK_Macro,
-
-    /// Refers to a precomputed pattern.
-    RK_Pattern
-  };
-
-  /// When Kind == RK_Declaration or RK_Pattern, the declaration we are
+  /// When Kind == CXCompletionResult_Declaration or CXCompletionResult_Pattern, the declaration we are
   /// referring to. In the latter case, the declaration might be NULL.
   const NamedDecl *Declaration = nullptr;
 
   union {
-    /// When Kind == RK_Keyword, the string representing the keyword
+    /// When Kind == CXCompletionResult_Keyword, the string representing the keyword
     /// or symbol's spelling.
     const char *Keyword;
 
-    /// When Kind == RK_Pattern, the code-completion string that
+    /// When Kind == CXCompletionResult_Pattern, the code-completion string that
     /// describes the completion text to insert.
     CodeCompletionString *Pattern;
 
-    /// When Kind == RK_Macro, the identifier that refers to a macro.
+    /// When Kind == CXCompletionResult_Macro, the identifier that refers to a macro.
     const IdentifierInfo *Macro;
   };
 
@@ -791,7 +776,7 @@
   unsigned StartParameter = 0;
 
   /// The kind of result stored here.
-  ResultKind Kind;
+  CXCompletionResultKind Kind;
 
   /// The cursor kind that describes this result.
   CXCursorKind CursorKind;
@@ -861,7 +846,7 @@
   /// corresponding `using decl::qualified::name;` nearby.
   const UsingShadowDecl *ShadowDecl = nullptr;
 
-  /// If the result is RK_Macro, this can store the information about the macro
+  /// If the result is CXCompletionResult_Macro, this can store the information about the macro
   /// definition. This should be set in most cases but can be missing when
   /// the macro has been undefined.
   const MacroInfo *MacroDefInfo = nullptr;
@@ -872,7 +857,7 @@
                        bool QualifierIsInformative = false,
                        bool Accessible = true,
                        std::vector<FixItHint> FixIts = std::vector<FixItHint>())
-      : Declaration(Declaration), Priority(Priority), Kind(RK_Declaration),
+      : Declaration(Declaration), Priority(Priority), Kind(CXCompletionResult_Declaration),
         FixIts(std::move(FixIts)), Hidden(false), InBaseClass(false),
         QualifierIsInformative(QualifierIsInformative),
         StartsNestedNameSpecifier(false), AllParametersAreInformative(false),
@@ -883,7 +868,7 @@
 
   /// Build a result that refers to a keyword or symbol.
   CodeCompletionResult(const char *Keyword, unsigned Priority = CCP_Keyword)
-      : Keyword(Keyword), Priority(Priority), Kind(RK_Keyword),
+      : Keyword(Keyword), Priority(Priority), Kind(CXCompletionResult_Keyword),
         CursorKind(CXCursor_NotImplemented), Hidden(false), InBaseClass(false),
         QualifierIsInformative(false), StartsNestedNameSpecifier(false),
         AllParametersAreInformative(false), DeclaringEntity(false) {}
@@ -892,7 +877,7 @@
   CodeCompletionResult(const IdentifierInfo *Macro,
                        const MacroInfo *MI = nullptr,
                        unsigned Priority = CCP_Macro)
-      : Macro(Macro), Priority(Priority), Kind(RK_Macro),
+      : Macro(Macro), Priority(Priority), Kind(CXCompletionResult_Macro),
         CursorKind(CXCursor_MacroDefinition), Hidden(false), InBaseClass(false),
         QualifierIsInformative(false), StartsNestedNameSpecifier(false),
         AllParametersAreInformative(false), DeclaringEntity(false),
@@ -904,7 +889,7 @@
       CXCursorKind CursorKind = CXCursor_NotImplemented,
       CXAvailabilityKind Availability = CXAvailability_Available,
       const NamedDecl *D = nullptr)
-      : Declaration(D), Pattern(Pattern), Priority(Priority), Kind(RK_Pattern),
+      : Declaration(D), Pattern(Pattern), Priority(Priority), Kind(CXCompletionResult_Pattern),
         CursorKind(CursorKind), Availability(Availability), Hidden(false),
         InBaseClass(false), QualifierIsInformative(false),
         StartsNestedNameSpecifier(false), AllParametersAreInformative(false),
@@ -914,7 +899,7 @@
   /// declaration.
   CodeCompletionResult(CodeCompletionString *Pattern, const NamedDecl *D,
                        unsigned Priority)
-      : Declaration(D), Pattern(Pattern), Priority(Priority), Kind(RK_Pattern),
+      : Declaration(D), Pattern(Pattern), Priority(Priority), Kind(CXCompletionResult_Pattern),
         Hidden(false), InBaseClass(false), QualifierIsInformative(false),
         StartsNestedNameSpecifier(false), AllParametersAreInformative(false),
         DeclaringEntity(false) {
@@ -922,16 +907,16 @@
   }
 
   /// Retrieve the declaration stored in this result. This might be nullptr if
-  /// Kind is RK_Pattern.
+  /// Kind is CXCompletionResult_Pattern.
   const NamedDecl *getDeclaration() const {
-    assert(((Kind == RK_Declaration) || (Kind == RK_Pattern)) &&
+    assert(((Kind == CXCompletionResult_Declaration) || (Kind == CXCompletionResult_Pattern)) &&
            "Not a declaration or pattern result");
     return Declaration;
   }
 
   /// Retrieve the keyword stored in this result.
   const char *getKeyword() const {
-    assert(Kind == RK_Keyword && "Not a keyword result");
+    assert(Kind == CXCompletionResult_Keyword && "Not a keyword result");
     return Keyword;
   }
 
@@ -955,7 +940,7 @@
                                            bool IncludeBriefComments);
   /// Creates a new code-completion string for the macro result. Similar to the
   /// above overloads, except this only requires preprocessor information.
-  /// The result kind must be `RK_Macro`.
+  /// The result kind must be `CXCompletionResult_Macro`.
   CodeCompletionString *
   CreateCodeCompletionStringForMacro(Preprocessor &PP,
                                      CodeCompletionAllocator &Allocator,
@@ -1207,12 +1192,12 @@
 };
 
 /// Get the documentation comment used to produce
-/// CodeCompletionString::BriefComment for RK_Declaration.
+/// CodeCompletionString::BriefComment for CXCompletionResult_Declaration.
 const RawComment *getCompletionComment(const ASTContext &Ctx,
                                        const NamedDecl *Decl);
 
 /// Get the documentation comment used to produce
-/// CodeCompletionString::BriefComment for RK_Pattern.
+/// CodeCompletionString::BriefComment for CXCompletionResult_Pattern.
 const RawComment *getPatternCompletionComment(const ASTContext &Ctx,
                                               const NamedDecl *Decl);
 
Index: clang/include/clang-c/Index.h
===================================================================
--- clang/include/clang-c/Index.h
+++ clang/include/clang-c/Index.h
@@ -2744,6 +2744,23 @@
   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.
@@ -5171,6 +5188,8 @@
  */
 
 /* 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,
@@ -5214,12 +5233,17 @@
  * 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.
Index: clang-tools-extra/clangd/Quality.cpp
===================================================================
--- clang-tools-extra/clangd/Quality.cpp
+++ clang-tools-extra/clangd/Quality.cpp
@@ -83,7 +83,7 @@
 categorize(const CodeCompletionResult &R) {
   if (R.Declaration)
     return categorize(*R.Declaration);
-  if (R.Kind == CodeCompletionResult::RK_Macro)
+  if (R.Kind == CXCompletionResult_Macro)
     return SymbolQualitySignals::Macro;
   // Everything else is a keyword or a pattern. Patterns are mostly keywords
   // too, except a few which we recognize by cursor kind.
@@ -180,7 +180,7 @@
     ImplementationDetail |= isImplementationDetail(SemaCCResult.Declaration);
     if (auto *ID = SemaCCResult.Declaration->getIdentifier())
       ReservedName = ReservedName || isReservedName(ID->getName());
-  } else if (SemaCCResult.Kind == CodeCompletionResult::RK_Macro)
+  } else if (SemaCCResult.Kind == CXCompletionResult_Macro)
     ReservedName =
         ReservedName || isReservedName(SemaCCResult.Macro->getName());
 }
@@ -300,8 +300,8 @@
     const CodeCompletionResult &SemaResult) {
   if (!MainFileSignals)
     return;
-  if ((SemaResult.Kind != CodeCompletionResult::RK_Declaration) &&
-      (SemaResult.Kind != CodeCompletionResult::RK_Pattern))
+  if ((SemaResult.Kind != CXCompletionResult_Declaration) &&
+      (SemaResult.Kind != CXCompletionResult_Pattern))
     return;
   if (const NamedDecl *ND = SemaResult.getDeclaration()) {
     auto ID = getSymbolID(ND);
Index: clang-tools-extra/clangd/CodeCompletionStrings.cpp
===================================================================
--- clang-tools-extra/clangd/CodeCompletionStrings.cpp
+++ clang-tools-extra/clangd/CodeCompletionStrings.cpp
@@ -61,10 +61,11 @@
 std::string getDocComment(const ASTContext &Ctx,
                           const CodeCompletionResult &Result,
                           bool CommentsFromHeaders) {
-  // FIXME: clang's completion also returns documentation for RK_Pattern if they
-  // contain a pattern for ObjC properties. Unfortunately, there is no API to
-  // get this declaration, so we don't show documentation in that case.
-  if (Result.Kind != CodeCompletionResult::RK_Declaration)
+  // FIXME: clang's completion also returns documentation for
+  // CXCompletionResult_Pattern if they contain a pattern for ObjC properties.
+  // Unfortunately, there is no API to get this declaration, so we don't show
+  // documentation in that case.
+  if (Result.Kind != CXCompletionResult_Declaration)
     return "";
   return Result.getDeclaration() ? getDeclComment(Ctx, *Result.getDeclaration())
                                  : "";
Index: clang-tools-extra/clangd/CodeComplete.cpp
===================================================================
--- clang-tools-extra/clangd/CodeComplete.cpp
+++ clang-tools-extra/clangd/CodeComplete.cpp
@@ -136,7 +136,7 @@
 }
 
 CompletionItemKind
-toCompletionItemKind(CodeCompletionResult::ResultKind ResKind,
+toCompletionItemKind(CXCompletionResultKind ResKind,
                      const NamedDecl *Decl,
                      CodeCompletionContext::Kind CtxKind) {
   if (Decl)
@@ -144,14 +144,14 @@
   if (CtxKind == CodeCompletionContext::CCC_IncludedFile)
     return CompletionItemKind::File;
   switch (ResKind) {
-  case CodeCompletionResult::RK_Declaration:
-    llvm_unreachable("RK_Declaration without Decl");
-  case CodeCompletionResult::RK_Keyword:
+  case CXCompletionResult_Declaration:
+    llvm_unreachable("CXCompletionResult_Declaration without Decl");
+  case CXCompletionResult_Keyword:
     return CompletionItemKind::Keyword;
-  case CodeCompletionResult::RK_Macro:
+  case CXCompletionResult_Macro:
     return CompletionItemKind::Text; // unfortunately, there's no 'Macro'
                                      // completion items in LSP.
-  case CodeCompletionResult::RK_Pattern:
+  case CXCompletionResult_Pattern:
     return CompletionItemKind::Snippet;
   }
   llvm_unreachable("Unhandled CodeCompletionResult::ResultKind.");
@@ -305,8 +305,8 @@
       Completion.Name = std::string(llvm::StringRef(SemaCCS->getTypedText()));
       Completion.FilterText = SemaCCS->getAllTypedText();
       if (Completion.Scope.empty()) {
-        if ((C.SemaResult->Kind == CodeCompletionResult::RK_Declaration) ||
-            (C.SemaResult->Kind == CodeCompletionResult::RK_Pattern))
+        if ((C.SemaResult->Kind == CXCompletionResult_Declaration) ||
+            (C.SemaResult->Kind == CXCompletionResult_Pattern))
           if (const auto *D = C.SemaResult->getDeclaration())
             if (const auto *ND = dyn_cast<NamedDecl>(D))
               Completion.Scope = std::string(
@@ -403,7 +403,7 @@
     Bundled.emplace_back();
     BundledEntry &S = Bundled.back();
     if (C.SemaResult) {
-      bool IsPattern = C.SemaResult->Kind == CodeCompletionResult::RK_Pattern;
+      bool IsPattern = C.SemaResult->Kind == CXCompletionResult_Pattern;
       getSignature(*SemaCCS, &S.Signature, &S.SnippetSuffix,
                    &Completion.RequiredQualifier, IsPattern);
       S.ReturnType = getReturnType(*SemaCCS);
@@ -578,16 +578,16 @@
 // Determine the symbol ID for a Sema code completion result, if possible.
 SymbolID getSymbolID(const CodeCompletionResult &R, const SourceManager &SM) {
   switch (R.Kind) {
-  case CodeCompletionResult::RK_Declaration:
-  case CodeCompletionResult::RK_Pattern: {
+  case CXCompletionResult_Declaration:
+  case CXCompletionResult_Pattern: {
     // Computing USR caches linkage, which may change after code completion.
     if (hasUnstableLinkage(R.Declaration))
       return {};
     return clang::clangd::getSymbolID(R.Declaration);
   }
-  case CodeCompletionResult::RK_Macro:
+  case CXCompletionResult_Macro:
     return clang::clangd::getSymbolID(R.Macro->getName(), R.MacroDefInfo, SM);
-  case CodeCompletionResult::RK_Keyword:
+  case CXCompletionResult_Keyword:
     return {};
   }
   llvm_unreachable("unknown CodeCompletionResult kind");
@@ -852,15 +852,15 @@
   // Returned string is owned by this recorder (or the AST).
   llvm::StringRef getName(const CodeCompletionResult &Result) {
     switch (Result.Kind) {
-    case CodeCompletionResult::RK_Declaration:
+    case CXCompletionResult_Declaration:
       if (auto *ID = Result.Declaration->getIdentifier())
         return ID->getName();
       break;
-    case CodeCompletionResult::RK_Keyword:
+    case CXCompletionResult_Keyword:
       return Result.Keyword;
-    case CodeCompletionResult::RK_Macro:
+    case CXCompletionResult_Macro:
       return Result.Macro->getName();
-    case CodeCompletionResult::RK_Pattern:
+    case CXCompletionResult_Pattern:
       break;
     }
     auto *CCS = codeCompletionString(Result);
@@ -1797,7 +1797,7 @@
   llvm::Optional<float> fuzzyScore(const CompletionCandidate &C) {
     // Macros can be very spammy, so we only support prefix completion.
     if (((C.SemaResult &&
-          C.SemaResult->Kind == CodeCompletionResult::RK_Macro) ||
+          C.SemaResult->Kind == CXCompletionResult_Macro) ||
          (C.IndexResult &&
           C.IndexResult->SymInfo.Kind == index::SymbolKind::Macro)) &&
         !C.Name.startswith_insensitive(Filter->pattern()))
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to