r344509 - [CodeComplete] Make sure keyword 'template' is added even when code pattern is disabled.

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


Author: ioeric
Date: Mon Oct 15 05:37:23 2018
New Revision: 344509

URL: http://llvm.org/viewvc/llvm-project?rev=344509&view=rev
Log:
[CodeComplete] Make sure keyword 'template' is added even when code pattern is disabled.

Reviewers: sammccall, hokein

Subscribers: arphaman, cfe-commits

Differential Revision: https://reviews.llvm.org/D53284

Added:
    cfe/trunk/test/Index/complete-template-keywords.cpp
Modified:
    cfe/trunk/lib/Sema/SemaCodeComplete.cpp

Modified: cfe/trunk/lib/Sema/SemaCodeComplete.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaCodeComplete.cpp?rev=344509&r1=344508&r2=344509&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaCodeComplete.cpp (original)
+++ cfe/trunk/lib/Sema/SemaCodeComplete.cpp Mon Oct 15 05:37:23 2018
@@ -1731,6 +1731,8 @@ static void AddOrdinaryNameResults(Sema:
         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 @@ static void AddOrdinaryNameResults(Sema:
       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);

Added: cfe/trunk/test/Index/complete-template-keywords.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/complete-template-keywords.cpp?rev=344509&view=auto
==============================================================================
--- cfe/trunk/test/Index/complete-template-keywords.cpp (added)
+++ cfe/trunk/test/Index/complete-template-keywords.cpp Mon Oct 15 05:37:23 2018
@@ -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 <}




More information about the cfe-commits mailing list