[PATCH] D53284: [CodeComplete] Make sure keyword 'template' is added even when code pattern is disabled.

Eric Liu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 15 05:39:23 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rC344509: [CodeComplete] Make sure keyword 'template' is added even when code pattern is… (authored by ioeric, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D53284?vs=169681&id=169685#toc

Repository:
  rC Clang

https://reviews.llvm.org/D53284

Files:
  lib/Sema/SemaCodeComplete.cpp
  test/Index/complete-template-keywords.cpp


Index: lib/Sema/SemaCodeComplete.cpp
===================================================================
--- lib/Sema/SemaCodeComplete.cpp
+++ lib/Sema/SemaCodeComplete.cpp
@@ -1731,6 +1731,8 @@
         Builder.AddChunk(CodeCompletionString::CK_HorizontalSpace);
         Builder.AddPlaceholderChunk("declaration");
         Results.AddResult(Result(Builder.TakeString()));
+      } else {
+        Results.AddResult(Result("template", CodeCompletionResult::RK_Keyword));
       }
     }
 
@@ -1805,6 +1807,8 @@
       Builder.AddPlaceholderChunk("parameters");
       Builder.AddChunk(CodeCompletionString::CK_RightAngle);
       Results.AddResult(Result(Builder.TakeString()));
+    } else {
+      Results.AddResult(Result("template", CodeCompletionResult::RK_Keyword));
     }
 
     AddStorageSpecifiers(CCC, SemaRef.getLangOpts(), Results);
Index: test/Index/complete-template-keywords.cpp
===================================================================
--- test/Index/complete-template-keywords.cpp
+++ test/Index/complete-template-keywords.cpp
@@ -0,0 +1,5 @@
+templ
+// RUN: env c-index-test -code-completion-at=%s:1:5 %s | FileCheck -check-prefix=CHECK-NO-PATTERN %s
+// CHECK-NO-PATTERN: {TypedText template} (1)
+// RUN: env CINDEXTEST_CODE_COMPLETE_PATTERNS=1 c-index-test -code-completion-at=%s:1:5 %s | FileCheck -check-prefix=CHECK-PATTERN %s
+// CHECK-PATTERN: {TypedText template}{LeftAngle <}


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D53284.169685.patch
Type: text/x-patch
Size: 1417 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20181015/b2ec24c6/attachment-0001.bin>


More information about the cfe-commits mailing list