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 <}