diff options
-rw-r--r-- | clang/lib/Sema/SemaCodeComplete.cpp | 4 | ||||
-rw-r--r-- | clang/test/CodeCompletion/templates.cpp | 9 |
2 files changed, 12 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaCodeComplete.cpp b/clang/lib/Sema/SemaCodeComplete.cpp index e4c4264d9dc..ade6e46d1bc 100644 --- a/clang/lib/Sema/SemaCodeComplete.cpp +++ b/clang/lib/Sema/SemaCodeComplete.cpp @@ -3653,6 +3653,10 @@ CodeCompleteConsumer::OverloadCandidate::CreateSignatureString( unsigned CurrentArg, Sema &S, CodeCompletionAllocator &Allocator, CodeCompletionTUInfo &CCTUInfo, bool IncludeBriefComments) const { PrintingPolicy Policy = getCompletionPrintingPolicy(S); + // Show signatures of constructors as they are declared: + // vector(int n) rather than vector<string>(int n) + // This is less noisy without being less clear, and avoids tricky cases. + Policy.SuppressTemplateArgsInCXXConstructors = true; // FIXME: Set priority, availability appropriately. CodeCompletionBuilder Result(Allocator, CCTUInfo, 1, diff --git a/clang/test/CodeCompletion/templates.cpp b/clang/test/CodeCompletion/templates.cpp index 32a7b2125fe..f9811f44647 100644 --- a/clang/test/CodeCompletion/templates.cpp +++ b/clang/test/CodeCompletion/templates.cpp @@ -24,5 +24,12 @@ void f() { // CHECK-CC2: foo // CHECK-CC2: in_base // CHECK-CC2: stop - +} + +template <typename> struct X; +template <typename T> struct X<T*> { X(double); }; +X<int*> x(42); +// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:32:11 %s -o - | FileCheck -check-prefix=CHECK-CONSTRUCTOR %s +// CHECK-CONSTRUCTOR: OVERLOAD: X(<#double#>) +// (rather than X<type-parameter-0-0 *>(<#double#>) |