]> granicus.if.org Git - clang/commitdiff
Improves overload completion result chunks.
authorFrancisco Lopes da Silva <oblita@gmail.com>
Wed, 28 Jan 2015 14:17:22 +0000 (14:17 +0000)
committerFrancisco Lopes da Silva <oblita@gmail.com>
Wed, 28 Jan 2015 14:17:22 +0000 (14:17 +0000)
The code building the code completion string for overloads was providing
less detail compared to the one building completion strings for function
declarations. There was no information about optionals and no information
about what's a parameter and what's a function identifier, everything
besides ResultType, CurrentParameter and special characters was classified
as Text.

This makes code completion strings for overload candidates to follow a
pattern very similar, but not identical, to the one in use for function
declarations:

 - return type chunk: ResultType
 - function identifier chunk: Text
 - parameter chunks: Placeholder
 - optional parameter chunks: Optional
 - current parameter chunk: CurrentParameter

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@227309 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Sema/CodeCompleteConsumer.h
lib/Sema/CodeCompleteConsumer.cpp
lib/Sema/SemaCodeComplete.cpp
test/Index/code-completion.cpp
test/Index/complete-call.cpp
test/Index/complete-constructor-params.cpp
test/Index/complete-functor-call.cpp
test/Index/complete-optional-params.cpp [new file with mode: 0644]
test/Index/complete-pointer-and-reference-to-functions.cpp
tools/libclang/CIndexCodeCompletion.cpp

index 92a4e9a42f159cbf847cc8572f1146558198dc75..e3fd66ff3e1315f9746b9178ad27b0fb23d6e1f9 100644 (file)
@@ -885,7 +885,8 @@ public:
     CodeCompletionString *CreateSignatureString(unsigned CurrentArg,
                                                 Sema &S,
                                       CodeCompletionAllocator &Allocator,
-                                      CodeCompletionTUInfo &CCTUInfo) const;
+                                      CodeCompletionTUInfo &CCTUInfo,
+                                      bool IncludeBriefComments) const;
   };
 
   CodeCompleteConsumer(const CodeCompleteOptions &CodeCompleteOpts,
index b2dc2d79616bb8726057a40b515063fac7b0dec8..92d2aeb91897fb2918cf0014b4faddc0477d4b10 100644 (file)
@@ -483,6 +483,31 @@ PrintingCodeCompleteConsumer::ProcessCodeCompleteResults(Sema &SemaRef,
   }
 }
 
+// This function is used solely to preserve the former presentation of overloads
+// by "clang -cc1 -code-completion-at", since CodeCompletionString::getAsString
+// needs to be improved for printing the newer and more detailed overload
+// chunks.
+static std::string getOverloadAsString(const CodeCompletionString &CCS) {
+  std::string Result;
+  llvm::raw_string_ostream OS(Result);
+
+  for (auto &C : CCS) {
+    switch (C.Kind) {
+    case CodeCompletionString::CK_Informative:
+    case CodeCompletionString::CK_ResultType:
+      OS << "[#" << C.Text << "#]";
+      break;
+
+    case CodeCompletionString::CK_CurrentParameter:
+      OS << "<#" << C.Text << "#>";
+      break;
+
+    default: OS << C.Text; break;
+    }
+  }
+  return OS.str();
+}
+
 void 
 PrintingCodeCompleteConsumer::ProcessOverloadCandidates(Sema &SemaRef,
                                                         unsigned CurrentArg,
@@ -491,8 +516,9 @@ PrintingCodeCompleteConsumer::ProcessOverloadCandidates(Sema &SemaRef,
   for (unsigned I = 0; I != NumCandidates; ++I) {
     if (CodeCompletionString *CCS
           = Candidates[I].CreateSignatureString(CurrentArg, SemaRef,
-                                                getAllocator(), CCTUInfo)) {
-      OS << "OVERLOAD: " << CCS->getAsString() << "\n";
+                                                getAllocator(), CCTUInfo,
+                                                includeBriefComments())) {
+      OS << "OVERLOAD: " << getOverloadAsString(*CCS) << "\n";
     }
   }
 }
index ab097d46dd7b02894d67fb41ffb362e751507e15..5aa28cdc6c435ec6086a536b88003b1c9cde9fad 100644 (file)
@@ -2815,73 +2815,116 @@ CodeCompletionResult::CreateCodeCompletionString(ASTContext &Ctx,
   return Result.TakeString();
 }
 
+/// \brief Add function overload parameter chunks to the given code completion
+/// string.
+static void AddOverloadParameterChunks(ASTContext &Context,
+                                       const PrintingPolicy &Policy,
+                                       const FunctionDecl *Function,
+                                       const FunctionProtoType *Prototype,
+                                       CodeCompletionBuilder &Result,
+                                       unsigned CurrentArg,
+                                       unsigned Start = 0,
+                                       bool InOptional = false) {
+  bool FirstParameter = true;
+  unsigned NumParams = Function ? Function->getNumParams()
+                                : Prototype->getNumParams();
+
+  for (unsigned P = Start; P != NumParams; ++P) {
+    if (Function && Function->getParamDecl(P)->hasDefaultArg() && !InOptional) {
+      // When we see an optional default argument, put that argument and
+      // the remaining default arguments into a new, optional string.
+      CodeCompletionBuilder Opt(Result.getAllocator(),
+                                Result.getCodeCompletionTUInfo());
+      if (!FirstParameter)
+        Opt.AddChunk(CodeCompletionString::CK_Comma);
+      // Optional sections are nested.
+      AddOverloadParameterChunks(Context, Policy, Function, Prototype, Opt,
+                                 CurrentArg, P, /*InOptional=*/true);
+      Result.AddOptionalChunk(Opt.TakeString());
+      return;
+    }
+
+    if (FirstParameter)
+      FirstParameter = false;
+    else
+      Result.AddChunk(CodeCompletionString::CK_Comma);
+
+    InOptional = false;
+
+    // Format the placeholder string.
+    std::string Placeholder;
+    if (Function)
+      Placeholder = FormatFunctionParameter(Context, Policy,
+                                            Function->getParamDecl(P));
+    else
+      Placeholder = Prototype->getParamType(P).getAsString(Policy);
+
+    if (P == CurrentArg)
+      Result.AddCurrentParameterChunk(
+        Result.getAllocator().CopyString(Placeholder));
+    else
+      Result.AddPlaceholderChunk(Result.getAllocator().CopyString(Placeholder));
+  }
+
+  if (Prototype && Prototype->isVariadic()) {
+    CodeCompletionBuilder Opt(Result.getAllocator(),
+                              Result.getCodeCompletionTUInfo());
+    if (!FirstParameter)
+      Opt.AddChunk(CodeCompletionString::CK_Comma);
+
+    if (CurrentArg < NumParams)
+      Opt.AddPlaceholderChunk("...");
+    else
+      Opt.AddCurrentParameterChunk("...");
+
+    Result.AddOptionalChunk(Opt.TakeString());
+  }
+}
+
 CodeCompletionString *
 CodeCompleteConsumer::OverloadCandidate::CreateSignatureString(
-                                                          unsigned CurrentArg,
-                                                               Sema &S,
-                                     CodeCompletionAllocator &Allocator,
-                                     CodeCompletionTUInfo &CCTUInfo) const {
+                                             unsigned CurrentArg, Sema &S,
+                                             CodeCompletionAllocator &Allocator,
+                                             CodeCompletionTUInfo &CCTUInfo,
+                                             bool IncludeBriefComments) const {
   PrintingPolicy Policy = getCompletionPrintingPolicy(S);
 
   // FIXME: Set priority, availability appropriately.
   CodeCompletionBuilder Result(Allocator,CCTUInfo, 1, CXAvailability_Available);
   FunctionDecl *FDecl = getFunction();
-  AddResultTypeChunk(S.Context, Policy, FDecl, Result);
-  const FunctionProtoType *Proto 
+  const FunctionProtoType *Proto
     = dyn_cast<FunctionProtoType>(getFunctionType());
   if (!FDecl && !Proto) {
     // Function without a prototype. Just give the return type and a 
     // highlighted ellipsis.
     const FunctionType *FT = getFunctionType();
-    Result.AddTextChunk(GetCompletionTypeString(FT->getReturnType(), S.Context,
-                                                Policy, Result.getAllocator()));
+    Result.AddResultTypeChunk(Result.getAllocator().CopyString(
+      FT->getReturnType().getAsString(Policy)));
     Result.AddChunk(CodeCompletionString::CK_LeftParen);
     Result.AddChunk(CodeCompletionString::CK_CurrentParameter, "...");
     Result.AddChunk(CodeCompletionString::CK_RightParen);
     return Result.TakeString();
   }
-  
-  if (FDecl)
+
+  if (FDecl) {
+    if (IncludeBriefComments && CurrentArg < FDecl->getNumParams())
+      if (auto RC = S.getASTContext().getRawCommentForAnyRedecl(
+          FDecl->getParamDecl(CurrentArg)))
+        Result.addBriefComment(RC->getBriefText(S.getASTContext()));
+    AddResultTypeChunk(S.Context, Policy, FDecl, Result);
     Result.AddTextChunk(
-                    Result.getAllocator().CopyString(FDecl->getNameAsString()));
-  else
-    Result.AddTextChunk(Result.getAllocator().CopyString(
+      Result.getAllocator().CopyString(FDecl->getNameAsString()));
+  } else {
+    Result.AddResultTypeChunk(
+      Result.getAllocator().CopyString(
         Proto->getReturnType().getAsString(Policy)));
+  }
 
   Result.AddChunk(CodeCompletionString::CK_LeftParen);
-  unsigned NumParams = FDecl ? FDecl->getNumParams() : Proto->getNumParams();
-  for (unsigned I = 0; I != NumParams; ++I) {
-    if (I)
-      Result.AddChunk(CodeCompletionString::CK_Comma);
-    
-    std::string ArgString;
-    QualType ArgType;
-    
-    if (FDecl) {
-      ArgString = FDecl->getParamDecl(I)->getNameAsString();
-      ArgType = FDecl->getParamDecl(I)->getOriginalType();
-    } else {
-      ArgType = Proto->getParamType(I);
-    }
-    
-    ArgType.getAsStringInternal(ArgString, Policy);
-    
-    if (I == CurrentArg)
-      Result.AddChunk(CodeCompletionString::CK_CurrentParameter,
-                      Result.getAllocator().CopyString(ArgString));
-    else
-      Result.AddTextChunk(Result.getAllocator().CopyString(ArgString));
-  }
-  
-  if (Proto && Proto->isVariadic()) {
-    Result.AddChunk(CodeCompletionString::CK_Comma);
-    if (CurrentArg < NumParams)
-      Result.AddTextChunk("...");
-    else
-      Result.AddChunk(CodeCompletionString::CK_CurrentParameter, "...");
-  }
+  AddOverloadParameterChunks(S.getASTContext(), Policy, FDecl, Proto, Result,
+                             CurrentArg);
   Result.AddChunk(CodeCompletionString::CK_RightParen);
-  
+
   return Result.TakeString();
 }
 
@@ -3894,7 +3937,6 @@ void Sema::CodeCompleteCall(Scope *S, Expr *Fn, ArrayRef<Expr *> Args) {
   // results. We may want to revisit this strategy in the future,
   // e.g., by merging the two kinds of results.
 
-  // FIXME: Provide support for highlighting optional parameters.
   // FIXME: Provide support for variadic template functions.
 
   // Ignore type-dependent call expressions entirely.
@@ -3934,7 +3976,7 @@ void Sema::CodeCompleteCall(Scope *S, Expr *Fn, ArrayRef<Expr *> Args) {
     else if (auto DRE = dyn_cast<DeclRefExpr>(NakedFn))
       FD = dyn_cast<FunctionDecl>(DRE->getDecl());
     if (FD) { // We check whether it's a resolved function declaration.
-      if (!getLangOpts().CPlusPlus || 
+      if (!getLangOpts().CPlusPlus ||
           !FD->getType()->getAs<FunctionProtoType>())
         Results.push_back(ResultCandidate(FD));
       else
@@ -3994,7 +4036,6 @@ void Sema::CodeCompleteConstructor(Scope *S, QualType Type, SourceLocation Loc,
 
   // FIXME: Provide support for member initializers.
   // FIXME: Provide support for variadic template constructors.
-  // FIXME: Provide support for highlighting optional parameters.
 
   OverloadCandidateSet CandidateSet(Loc, OverloadCandidateSet::CSK_Normal);
 
index fe5240276ce56e18904d10d6c0e492e493ebfc9c..83aa94374438e02401daa510c1b4eb9b9fdee1ee 100644 (file)
@@ -58,9 +58,9 @@ Z::operator int() const {
 // CHECK-MEMBER-NEXT: Container is complete
 // CHECK-MEMBER-NEXT: Container USR: c:@S@Z
 
-// CHECK-OVERLOAD: OverloadCandidate:{ResultType int &}{Text overloaded}{LeftParen (}{Text Z z}{Comma , }{CurrentParameter int second}{RightParen )}
-// CHECK-OVERLOAD: OverloadCandidate:{ResultType float &}{Text overloaded}{LeftParen (}{Text int i}{Comma , }{CurrentParameter long second}{RightParen )}
-// CHECK-OVERLOAD: OverloadCandidate:{ResultType double &}{Text overloaded}{LeftParen (}{Text float f}{Comma , }{CurrentParameter int second}{RightParen )}
+// CHECK-OVERLOAD: OverloadCandidate:{ResultType int &}{Text overloaded}{LeftParen (}{Placeholder Z z}{Comma , }{CurrentParameter int second}{RightParen )}
+// CHECK-OVERLOAD: OverloadCandidate:{ResultType float &}{Text overloaded}{LeftParen (}{Placeholder int i}{Comma , }{CurrentParameter long second}{RightParen )}
+// CHECK-OVERLOAD: OverloadCandidate:{ResultType double &}{Text overloaded}{LeftParen (}{Placeholder float f}{Comma , }{CurrentParameter int second}{RightParen )}
 // CHECK-OVERLOAD: Completion contexts:
 // CHECK-OVERLOAD-NEXT: Any type
 // CHECK-OVERLOAD-NEXT: Any value
index 67edc2af526936006967447ad785c3fea502e1cb..9750bd6f710042de6519ad50ccb683648b88418f 100644 (file)
@@ -120,8 +120,8 @@ int main() {
 // CHECK-CC2-NEXT: Objective-C interface
 
 // RUN: c-index-test -code-completion-at=%s:49:9 %s | FileCheck -check-prefix=CHECK-CC3 %s
-// CHECK-CC3: OverloadCandidate:{ResultType void}{Text foo_3}{LeftParen (}{CurrentParameter void *}{Comma , }{Text void *}{RightParen )} (1)
-// CHECK-CC3: OverloadCandidate:{ResultType void}{Text foo_3}{LeftParen (}{CurrentParameter int}{Comma , }{Text int}{RightParen )} (1)
+// CHECK-CC3: OverloadCandidate:{ResultType void}{Text foo_3}{LeftParen (}{CurrentParameter void *}{Comma , }{Placeholder void *}{RightParen )} (1)
+// CHECK-CC3: OverloadCandidate:{ResultType void}{Text foo_3}{LeftParen (}{CurrentParameter int}{Comma , }{Placeholder int}{RightParen )} (1)
 // CHECK-CC3: Completion contexts:
 // CHECK-CC3-NEXT: Any type
 // CHECK-CC3-NEXT: Any value
@@ -133,7 +133,7 @@ int main() {
 // CHECK-CC3-NEXT: Objective-C interface
 
 // RUN: c-index-test -code-completion-at=%s:49:12 %s | FileCheck -check-prefix=CHECK-CC4 %s
-// CHECK-CC4: OverloadCandidate:{ResultType void}{Text foo_3}{LeftParen (}{Text int}{Comma , }{CurrentParameter int}{RightParen )} (1)
+// CHECK-CC4: OverloadCandidate:{ResultType void}{Text foo_3}{LeftParen (}{Placeholder int}{Comma , }{CurrentParameter int}{RightParen )} (1)
 // CHECK-CC4: Completion contexts:
 // CHECK-CC4-NEXT: Any type
 // CHECK-CC4-NEXT: Any value
@@ -145,7 +145,7 @@ int main() {
 // CHECK-CC4-NEXT: Objective-C interface
 
 // RUN: c-index-test -code-completion-at=%s:50:11 %s | FileCheck -check-prefix=CHECK-CC5 %s
-// CHECK-CC5: OverloadCandidate:{ResultType void}{Text foo_3}{LeftParen (}{Text void *}{Comma , }{CurrentParameter void *}{RightParen )} (1)
+// CHECK-CC5: OverloadCandidate:{ResultType void}{Text foo_3}{LeftParen (}{Placeholder void *}{Comma , }{CurrentParameter void *}{RightParen )} (1)
 // CHECK-CC5: Completion contexts:
 // CHECK-CC5-NEXT: Any type
 // CHECK-CC5-NEXT: Any value
@@ -157,7 +157,7 @@ int main() {
 // CHECK-CC5-NEXT: Objective-C interface
 
 // RUN: c-index-test -code-completion-at=%s:51:12 %s | FileCheck -check-prefix=CHECK-CC6 %s
-// CHECK-CC6: OverloadCandidate:{ResultType void}{Text foo_4}{LeftParen (}{Text int}{Comma , }{CurrentParameter int}{RightParen )} (1)
+// CHECK-CC6: OverloadCandidate:{ResultType void}{Text foo_4}{LeftParen (}{Placeholder int}{Comma , }{CurrentParameter int}{RightParen )} (1)
 // CHECK-CC6: Completion contexts:
 // CHECK-CC6-NEXT: Any type
 // CHECK-CC6-NEXT: Any value
@@ -169,7 +169,7 @@ int main() {
 // CHECK-CC6-NEXT: Objective-C interface
 
 // RUN: c-index-test -code-completion-at=%s:52:11 %s | FileCheck -check-prefix=CHECK-CC7 %s
-// CHECK-CC7: OverloadCandidate:{ResultType void}{Text foo_4}{LeftParen (}{Text void *}{Comma , }{CurrentParameter int}{RightParen )} (1)
+// CHECK-CC7: OverloadCandidate:{ResultType void}{Text foo_4}{LeftParen (}{Placeholder void *}{Comma , }{CurrentParameter int}{RightParen )} (1)
 // CHECK-CC7: Completion contexts:
 // CHECK-CC7-NEXT: Any type
 // CHECK-CC7-NEXT: Any value
@@ -181,8 +181,8 @@ int main() {
 // CHECK-CC7-NEXT: Objective-C interface
 
 // RUN: c-index-test -code-completion-at=%s:53:12 %s | FileCheck -check-prefix=CHECK-CC8 %s
-// CHECK-CC8: OverloadCandidate:{ResultType void}{Text foo_5}{LeftParen (}{Text int}{Comma , }{CurrentParameter void *}{RightParen )} (1)
-// CHECK-CC8: OverloadCandidate:{ResultType void}{Text foo_5}{LeftParen (}{Text int}{Comma , }{CurrentParameter int}{RightParen )} (1)
+// CHECK-CC8: OverloadCandidate:{ResultType void}{Text foo_5}{LeftParen (}{Placeholder int}{Comma , }{CurrentParameter void *}{RightParen )} (1)
+// CHECK-CC8: OverloadCandidate:{ResultType void}{Text foo_5}{LeftParen (}{Placeholder int}{Comma , }{CurrentParameter int}{RightParen )} (1)
 // CHECK-CC8: Completion contexts:
 // CHECK-CC8-NEXT: Any type
 // CHECK-CC8-NEXT: Any value
@@ -230,7 +230,7 @@ int main() {
 // CHECK-CC11-NEXT: Objective-C interface
 
 // RUN: c-index-test -code-completion-at=%s:57:12 %s | FileCheck -check-prefix=CHECK-CC12 %s
-// CHECK-CC12: OverloadCandidate:{ResultType void}{Text foo_8}{LeftParen (}{Text int}{Comma , }{CurrentParameter int}{RightParen )} (1)
+// CHECK-CC12: OverloadCandidate:{ResultType void}{Text foo_8}{LeftParen (}{Placeholder int}{Comma , }{CurrentParameter int}{RightParen )} (1)
 // CHECK-CC12: Completion contexts:
 // CHECK-CC12-NEXT: Any type
 // CHECK-CC12-NEXT: Any value
@@ -242,7 +242,7 @@ int main() {
 // CHECK-CC12-NEXT: Objective-C interface
 
 // RUN: c-index-test -code-completion-at=%s:58:12 %s | FileCheck -check-prefix=CHECK-CC13 %s
-// CHECK-CC13: OverloadCandidate:{ResultType void}{Text foo_9}{LeftParen (}{Text int}{Comma , }{CurrentParameter T}{RightParen )} (1)
+// CHECK-CC13: OverloadCandidate:{ResultType void}{Text foo_9}{LeftParen (}{Placeholder int}{Comma , }{CurrentParameter T}{RightParen )} (1)
 // CHECK-CC13: Completion contexts:
 // CHECK-CC13-NEXT: Any type
 // CHECK-CC13-NEXT: Any value
@@ -254,7 +254,7 @@ int main() {
 // CHECK-CC13-NEXT: Objective-C interface
 
 // RUN: c-index-test -code-completion-at=%s:59:11 %s | FileCheck -check-prefix=CHECK-CC14 %s
-// CHECK-CC14: OverloadCandidate:{ResultType void}{Text foo_9}{LeftParen (}{Text void *}{Comma , }{CurrentParameter T}{RightParen )} (1)
+// CHECK-CC14: OverloadCandidate:{ResultType void}{Text foo_9}{LeftParen (}{Placeholder void *}{Comma , }{CurrentParameter T}{RightParen )} (1)
 // CHECK-CC14: Completion contexts:
 // CHECK-CC14-NEXT: Any type
 // CHECK-CC14-NEXT: Any value
@@ -266,8 +266,8 @@ int main() {
 // CHECK-CC14-NEXT: Objective-C interface
 
 // RUN: c-index-test -code-completion-at=%s:60:10 %s | FileCheck -check-prefix=CHECK-CC15 %s
-// CHECK-CC15: OverloadCandidate:{ResultType void}{Text foo_10}{LeftParen (}{CurrentParameter U}{Comma , }{Text void *}{Comma , }{Text void *}{RightParen )} (1)
-// CHECK-CC15: OverloadCandidate:{ResultType void}{Text foo_10}{LeftParen (}{CurrentParameter T}{Comma , }{Text int}{Comma , }{Text int}{RightParen )} (1)
+// CHECK-CC15: OverloadCandidate:{ResultType void}{Text foo_10}{LeftParen (}{CurrentParameter U}{Comma , }{Placeholder void *}{Comma , }{Placeholder void *}{RightParen )} (1)
+// CHECK-CC15: OverloadCandidate:{ResultType void}{Text foo_10}{LeftParen (}{CurrentParameter T}{Comma , }{Placeholder int}{Comma , }{Placeholder int}{RightParen )} (1)
 // CHECK-CC15: Completion contexts:
 // CHECK-CC15-NEXT: Any type
 // CHECK-CC15-NEXT: Any value
@@ -279,8 +279,8 @@ int main() {
 // CHECK-CC15-NEXT: Objective-C interface
 
 // RUN: c-index-test -code-completion-at=%s:60:13 %s | FileCheck -check-prefix=CHECK-CC16 %s
-// CHECK-CC16: OverloadCandidate:{ResultType void}{Text foo_10}{LeftParen (}{Text int}{Comma , }{CurrentParameter void *}{Comma , }{Text void *}{RightParen )} (1)
-// CHECK-CC16: OverloadCandidate:{ResultType void}{Text foo_10}{LeftParen (}{Text int}{Comma , }{CurrentParameter int}{Comma , }{Text int}{RightParen )} (1)
+// CHECK-CC16: OverloadCandidate:{ResultType void}{Text foo_10}{LeftParen (}{Placeholder int}{Comma , }{CurrentParameter void *}{Comma , }{Placeholder void *}{RightParen )} (1)
+// CHECK-CC16: OverloadCandidate:{ResultType void}{Text foo_10}{LeftParen (}{Placeholder int}{Comma , }{CurrentParameter int}{Comma , }{Placeholder int}{RightParen )} (1)
 // CHECK-CC16: Completion contexts:
 // CHECK-CC16-NEXT: Any type
 // CHECK-CC16-NEXT: Any value
@@ -292,7 +292,7 @@ int main() {
 // CHECK-CC16-NEXT: Objective-C interface
 
 // RUN: c-index-test -code-completion-at=%s:60:17 %s | FileCheck -check-prefix=CHECK-CC17 %s
-// CHECK-CC17: OverloadCandidate:{ResultType void}{Text foo_10}{LeftParen (}{Text int}{Comma , }{Text int}{Comma , }{CurrentParameter int}{RightParen )} (1)
+// CHECK-CC17: OverloadCandidate:{ResultType void}{Text foo_10}{LeftParen (}{Placeholder int}{Comma , }{Placeholder int}{Comma , }{CurrentParameter int}{RightParen )} (1)
 // CHECK-CC17: Completion contexts:
 // CHECK-CC17-NEXT: Any type
 // CHECK-CC17-NEXT: Any value
@@ -304,7 +304,7 @@ int main() {
 // CHECK-CC17-NEXT: Objective-C interface
 
 // RUN: c-index-test -code-completion-at=%s:61:10 %s | FileCheck -check-prefix=CHECK-CC18 %s
-// CHECK-CC18: OverloadCandidate:{ResultType void}{Text foo_11}{LeftParen (}{CurrentParameter T}{Comma , }{Text U}{RightParen )} (1)
+// CHECK-CC18: OverloadCandidate:{ResultType void}{Text foo_11}{LeftParen (}{CurrentParameter T}{Comma , }{Placeholder U}{RightParen )} (1)
 // CHECK-CC18: Completion contexts:
 // CHECK-CC18-NEXT: Any type
 // CHECK-CC18-NEXT: Any value
@@ -316,7 +316,7 @@ int main() {
 // CHECK-CC18-NEXT: Objective-C interface
 
 // RUN: c-index-test -code-completion-at=%s:61:13 %s | FileCheck -check-prefix=CHECK-CC19 %s
-// CHECK-CC19: OverloadCandidate:{ResultType void}{Text foo_11}{LeftParen (}{Text int}{Comma , }{CurrentParameter U}{RightParen )} (1)
+// CHECK-CC19: OverloadCandidate:{ResultType void}{Text foo_11}{LeftParen (}{Placeholder int}{Comma , }{CurrentParameter U}{RightParen )} (1)
 // CHECK-CC19: Completion contexts:
 // CHECK-CC19-NEXT: Any type
 // CHECK-CC19-NEXT: Any value
@@ -328,7 +328,7 @@ int main() {
 // CHECK-CC19-NEXT: Objective-C interface
 
 // RUN: c-index-test -code-completion-at=%s:62:15 %s | FileCheck -check-prefix=CHECK-CC20 %s
-// CHECK-CC20: OverloadCandidate:{ResultType void}{Text foo_11}{LeftParen (}{CurrentParameter int}{Comma , }{Text U}{RightParen )} (1)
+// CHECK-CC20: OverloadCandidate:{ResultType void}{Text foo_11}{LeftParen (}{CurrentParameter int}{Comma , }{Placeholder U}{RightParen )} (1)
 // CHECK-CC20: Completion contexts:
 // CHECK-CC20-NEXT: Any type
 // CHECK-CC20-NEXT: Any value
@@ -340,7 +340,7 @@ int main() {
 // CHECK-CC20-NEXT: Objective-C interface
 
 // RUN: c-index-test -code-completion-at=%s:62:18 %s | FileCheck -check-prefix=CHECK-CC21 %s
-// CHECK-CC21: OverloadCandidate:{ResultType void}{Text foo_11}{LeftParen (}{Text int}{Comma , }{CurrentParameter U}{RightParen )} (1)
+// CHECK-CC21: OverloadCandidate:{ResultType void}{Text foo_11}{LeftParen (}{Placeholder int}{Comma , }{CurrentParameter U}{RightParen )} (1)
 // CHECK-CC21: Completion contexts:
 // CHECK-CC21-NEXT: Any type
 // CHECK-CC21-NEXT: Any value
@@ -352,7 +352,7 @@ int main() {
 // CHECK-CC21-NEXT: Objective-C interface
 
 // RUN: c-index-test -code-completion-at=%s:63:26 %s | FileCheck -check-prefix=CHECK-CC22 %s
-// CHECK-CC22: OverloadCandidate:{ResultType void}{Text foo_11}{LeftParen (}{Text int}{Comma , }{CurrentParameter void *}{RightParen )} (1)
+// CHECK-CC22: OverloadCandidate:{ResultType void}{Text foo_11}{LeftParen (}{Placeholder int}{Comma , }{CurrentParameter void *}{RightParen )} (1)
 // CHECK-CC22: Completion contexts:
 // CHECK-CC22-NEXT: Any type
 // CHECK-CC22-NEXT: Any value
@@ -364,7 +364,7 @@ int main() {
 // CHECK-CC22-NEXT: Objective-C interface
 
 // RUN: c-index-test -code-completion-at=%s:64:10 %s | FileCheck -check-prefix=CHECK-CC23 %s
-// CHECK-CC23: OverloadCandidate:{ResultType void}{Text foo_12}{LeftParen (}{CurrentParameter int}{Comma , }{Text int}{RightParen )} (1)
+// CHECK-CC23: OverloadCandidate:{ResultType void}{Text foo_12}{LeftParen (}{CurrentParameter int}{Comma , }{Placeholder int}{RightParen )} (1)
 // CHECK-CC23: Completion contexts:
 // CHECK-CC23-NEXT: Any type
 // CHECK-CC23-NEXT: Any value
@@ -376,7 +376,7 @@ int main() {
 // CHECK-CC23-NEXT: Objective-C interface
 
 // RUN: c-index-test -code-completion-at=%s:64:12 %s | FileCheck -check-prefix=CHECK-CC24 %s
-// CHECK-CC24: OverloadCandidate:{ResultType void}{Text foo_12}{LeftParen (}{Text void *}{Comma , }{CurrentParameter void *}{RightParen )} (1)
+// CHECK-CC24: OverloadCandidate:{ResultType void}{Text foo_12}{LeftParen (}{Placeholder void *}{Comma , }{CurrentParameter void *}{RightParen )} (1)
 // CHECK-CC24: Completion contexts:
 // CHECK-CC24-NEXT: Any type
 // CHECK-CC24-NEXT: Any value
@@ -413,8 +413,8 @@ int main() {
 // CHECK-CC26-NEXT: Objective-C interface
 
 // RUN: c-index-test -code-completion-at=%s:69:11 %s | FileCheck -check-prefix=CHECK-CC27 %s
-// CHECK-CC27: OverloadCandidate:{ResultType void}{Text foo_3}{LeftParen (}{CurrentParameter int}{Comma , }{Text int}{RightParen )} (1)
-// CHECK-CC27: OverloadCandidate:{ResultType void}{Text foo_3}{LeftParen (}{CurrentParameter void *}{Comma , }{Text void *}{RightParen )} (1)
+// CHECK-CC27: OverloadCandidate:{ResultType void}{Text foo_3}{LeftParen (}{CurrentParameter int}{Comma , }{Placeholder int}{RightParen )} (1)
+// CHECK-CC27: OverloadCandidate:{ResultType void}{Text foo_3}{LeftParen (}{CurrentParameter void *}{Comma , }{Placeholder void *}{RightParen )} (1)
 // CHECK-CC27: Completion contexts:
 // CHECK-CC27-NEXT: Any type
 // CHECK-CC27-NEXT: Any value
@@ -426,7 +426,7 @@ int main() {
 // CHECK-CC27-NEXT: Objective-C interface
 
 // RUN: c-index-test -code-completion-at=%s:69:14 %s | FileCheck -check-prefix=CHECK-CC28 %s
-// CHECK-CC28: OverloadCandidate:{ResultType void}{Text foo_3}{LeftParen (}{Text int}{Comma , }{CurrentParameter int}{RightParen )} (1)
+// CHECK-CC28: OverloadCandidate:{ResultType void}{Text foo_3}{LeftParen (}{Placeholder int}{Comma , }{CurrentParameter int}{RightParen )} (1)
 // CHECK-CC28: Completion contexts:
 // CHECK-CC28-NEXT: Any type
 // CHECK-CC28-NEXT: Any value
@@ -438,7 +438,7 @@ int main() {
 // CHECK-CC28-NEXT: Objective-C interface
 
 // RUN: c-index-test -code-completion-at=%s:70:13 %s | FileCheck -check-prefix=CHECK-CC29 %s
-// CHECK-CC29: OverloadCandidate:{ResultType void}{Text foo_3}{LeftParen (}{Text void *}{Comma , }{CurrentParameter void *}{RightParen )} (1)
+// CHECK-CC29: OverloadCandidate:{ResultType void}{Text foo_3}{LeftParen (}{Placeholder void *}{Comma , }{CurrentParameter void *}{RightParen )} (1)
 // CHECK-CC29: Completion contexts:
 // CHECK-CC29-NEXT: Any type
 // CHECK-CC29-NEXT: Any value
@@ -450,7 +450,7 @@ int main() {
 // CHECK-CC29-NEXT: Objective-C interface
 
 // RUN: c-index-test -code-completion-at=%s:71:14 %s | FileCheck -check-prefix=CHECK-CC30 %s
-// CHECK-CC30: OverloadCandidate:{ResultType void}{Text foo_4}{LeftParen (}{Text int}{Comma , }{CurrentParameter int}{RightParen )} (1)
+// CHECK-CC30: OverloadCandidate:{ResultType void}{Text foo_4}{LeftParen (}{Placeholder int}{Comma , }{CurrentParameter int}{RightParen )} (1)
 // CHECK-CC30: Completion contexts:
 // CHECK-CC30-NEXT: Any type
 // CHECK-CC30-NEXT: Any value
@@ -462,7 +462,7 @@ int main() {
 // CHECK-CC30-NEXT: Objective-C interface
 
 // RUN: c-index-test -code-completion-at=%s:72:13 %s | FileCheck -check-prefix=CHECK-CC31 %s
-// CHECK-CC31: OverloadCandidate:{ResultType void}{Text foo_4}{LeftParen (}{Text void *}{Comma , }{CurrentParameter int}{RightParen )} (1)
+// CHECK-CC31: OverloadCandidate:{ResultType void}{Text foo_4}{LeftParen (}{Placeholder void *}{Comma , }{CurrentParameter int}{RightParen )} (1)
 // CHECK-CC31: Completion contexts:
 // CHECK-CC31-NEXT: Any type
 // CHECK-CC31-NEXT: Any value
@@ -474,8 +474,8 @@ int main() {
 // CHECK-CC31-NEXT: Objective-C interface
 
 // RUN: c-index-test -code-completion-at=%s:73:14 %s | FileCheck -check-prefix=CHECK-CC32 %s
-// CHECK-CC32: OverloadCandidate:{ResultType void}{Text foo_5}{LeftParen (}{Text int}{Comma , }{CurrentParameter int}{RightParen )} (1)
-// CHECK-CC32: OverloadCandidate:{ResultType void}{Text foo_5}{LeftParen (}{Text int}{Comma , }{CurrentParameter void *}{RightParen )} (1)
+// CHECK-CC32: OverloadCandidate:{ResultType void}{Text foo_5}{LeftParen (}{Placeholder int}{Comma , }{CurrentParameter int}{RightParen )} (1)
+// CHECK-CC32: OverloadCandidate:{ResultType void}{Text foo_5}{LeftParen (}{Placeholder int}{Comma , }{CurrentParameter void *}{RightParen )} (1)
 // CHECK-CC32: Completion contexts:
 // CHECK-CC32-NEXT: Any type
 // CHECK-CC32-NEXT: Any value
@@ -523,7 +523,7 @@ int main() {
 // CHECK-CC35-NEXT: Objective-C interface
 
 // RUN: c-index-test -code-completion-at=%s:77:14 %s | FileCheck -check-prefix=CHECK-CC36 %s
-// CHECK-CC36: OverloadCandidate:{ResultType void}{Text foo_8}{LeftParen (}{Text int}{Comma , }{CurrentParameter int}{RightParen )} (1)
+// CHECK-CC36: OverloadCandidate:{ResultType void}{Text foo_8}{LeftParen (}{Placeholder int}{Comma , }{CurrentParameter int}{RightParen )} (1)
 // CHECK-CC36: Completion contexts:
 // CHECK-CC36-NEXT: Any type
 // CHECK-CC36-NEXT: Any value
@@ -535,7 +535,7 @@ int main() {
 // CHECK-CC36-NEXT: Objective-C interface
 
 // RUN: c-index-test -code-completion-at=%s:78:14 %s | FileCheck -check-prefix=CHECK-CC37 %s
-// CHECK-CC37: OverloadCandidate:{ResultType void}{Text foo_9}{LeftParen (}{Text int}{Comma , }{CurrentParameter T}{RightParen )} (1)
+// CHECK-CC37: OverloadCandidate:{ResultType void}{Text foo_9}{LeftParen (}{Placeholder int}{Comma , }{CurrentParameter T}{RightParen )} (1)
 // CHECK-CC37: Completion contexts:
 // CHECK-CC37-NEXT: Any type
 // CHECK-CC37-NEXT: Any value
@@ -547,7 +547,7 @@ int main() {
 // CHECK-CC37-NEXT: Objective-C interface
 
 // RUN: c-index-test -code-completion-at=%s:79:13 %s | FileCheck -check-prefix=CHECK-CC38 %s
-// CHECK-CC38: OverloadCandidate:{ResultType void}{Text foo_9}{LeftParen (}{Text void *}{Comma , }{CurrentParameter T}{RightParen )} (1)
+// CHECK-CC38: OverloadCandidate:{ResultType void}{Text foo_9}{LeftParen (}{Placeholder void *}{Comma , }{CurrentParameter T}{RightParen )} (1)
 // CHECK-CC38: Completion contexts:
 // CHECK-CC38-NEXT: Any type
 // CHECK-CC38-NEXT: Any value
@@ -559,8 +559,8 @@ int main() {
 // CHECK-CC38-NEXT: Objective-C interface
 
 // RUN: c-index-test -code-completion-at=%s:80:12 %s | FileCheck -check-prefix=CHECK-CC39 %s
-// CHECK-CC39: OverloadCandidate:{ResultType void}{Text foo_10}{LeftParen (}{CurrentParameter T}{Comma , }{Text int}{Comma , }{Text int}{RightParen )} (1)
-// CHECK-CC39: OverloadCandidate:{ResultType void}{Text foo_10}{LeftParen (}{CurrentParameter U}{Comma , }{Text void *}{Comma , }{Text void *}{RightParen )} (1)
+// CHECK-CC39: OverloadCandidate:{ResultType void}{Text foo_10}{LeftParen (}{CurrentParameter T}{Comma , }{Placeholder int}{Comma , }{Placeholder int}{RightParen )} (1)
+// CHECK-CC39: OverloadCandidate:{ResultType void}{Text foo_10}{LeftParen (}{CurrentParameter U}{Comma , }{Placeholder void *}{Comma , }{Placeholder void *}{RightParen )} (1)
 // CHECK-CC39: Completion contexts:
 // CHECK-CC39-NEXT: Any type
 // CHECK-CC39-NEXT: Any value
@@ -572,8 +572,8 @@ int main() {
 // CHECK-CC39-NEXT: Objective-C interface
 
 // RUN: c-index-test -code-completion-at=%s:80:15 %s | FileCheck -check-prefix=CHECK-CC40 %s
-// CHECK-CC40: OverloadCandidate:{ResultType void}{Text foo_10}{LeftParen (}{Text int}{Comma , }{CurrentParameter int}{Comma , }{Text int}{RightParen )} (1)
-// CHECK-CC40: OverloadCandidate:{ResultType void}{Text foo_10}{LeftParen (}{Text int}{Comma , }{CurrentParameter void *}{Comma , }{Text void *}{RightParen )} (1)
+// CHECK-CC40: OverloadCandidate:{ResultType void}{Text foo_10}{LeftParen (}{Placeholder int}{Comma , }{CurrentParameter int}{Comma , }{Placeholder int}{RightParen )} (1)
+// CHECK-CC40: OverloadCandidate:{ResultType void}{Text foo_10}{LeftParen (}{Placeholder int}{Comma , }{CurrentParameter void *}{Comma , }{Placeholder void *}{RightParen )} (1)
 // CHECK-CC40: Completion contexts:
 // CHECK-CC40-NEXT: Any type
 // CHECK-CC40-NEXT: Any value
@@ -585,7 +585,7 @@ int main() {
 // CHECK-CC40-NEXT: Objective-C interface
 
 // RUN: c-index-test -code-completion-at=%s:80:19 %s | FileCheck -check-prefix=CHECK-CC41 %s
-// CHECK-CC41: OverloadCandidate:{ResultType void}{Text foo_10}{LeftParen (}{Text int}{Comma , }{Text int}{Comma , }{CurrentParameter int}{RightParen )} (1)
+// CHECK-CC41: OverloadCandidate:{ResultType void}{Text foo_10}{LeftParen (}{Placeholder int}{Comma , }{Placeholder int}{Comma , }{CurrentParameter int}{RightParen )} (1)
 // CHECK-CC41: Completion contexts:
 // CHECK-CC41-NEXT: Any type
 // CHECK-CC41-NEXT: Any value
@@ -597,7 +597,7 @@ int main() {
 // CHECK-CC41-NEXT: Objective-C interface
 
 // RUN: c-index-test -code-completion-at=%s:81:12 %s | FileCheck -check-prefix=CHECK-CC42 %s
-// CHECK-CC42: OverloadCandidate:{ResultType void}{Text foo_11}{LeftParen (}{CurrentParameter T}{Comma , }{Text U}{RightParen )} (1)
+// CHECK-CC42: OverloadCandidate:{ResultType void}{Text foo_11}{LeftParen (}{CurrentParameter T}{Comma , }{Placeholder U}{RightParen )} (1)
 // CHECK-CC42: Completion contexts:
 // CHECK-CC42-NEXT: Any type
 // CHECK-CC42-NEXT: Any value
@@ -609,7 +609,7 @@ int main() {
 // CHECK-CC42-NEXT: Objective-C interface
 
 // RUN: c-index-test -code-completion-at=%s:81:15 %s | FileCheck -check-prefix=CHECK-CC43 %s
-// CHECK-CC43: OverloadCandidate:{ResultType void}{Text foo_11}{LeftParen (}{Text int}{Comma , }{CurrentParameter U}{RightParen )} (1)
+// CHECK-CC43: OverloadCandidate:{ResultType void}{Text foo_11}{LeftParen (}{Placeholder int}{Comma , }{CurrentParameter U}{RightParen )} (1)
 // CHECK-CC43: Completion contexts:
 // CHECK-CC43-NEXT: Any type
 // CHECK-CC43-NEXT: Any value
@@ -621,7 +621,7 @@ int main() {
 // CHECK-CC43-NEXT: Objective-C interface
 
 // RUN: c-index-test -code-completion-at=%s:82:17 %s | FileCheck -check-prefix=CHECK-CC44 %s
-// CHECK-CC44: OverloadCandidate:{ResultType void}{Text foo_11}{LeftParen (}{CurrentParameter int}{Comma , }{Text U}{RightParen )} (1)
+// CHECK-CC44: OverloadCandidate:{ResultType void}{Text foo_11}{LeftParen (}{CurrentParameter int}{Comma , }{Placeholder U}{RightParen )} (1)
 // CHECK-CC44: Completion contexts:
 // CHECK-CC44-NEXT: Any type
 // CHECK-CC44-NEXT: Any value
@@ -633,7 +633,7 @@ int main() {
 // CHECK-CC44-NEXT: Objective-C interface
 
 // RUN: c-index-test -code-completion-at=%s:82:20 %s | FileCheck -check-prefix=CHECK-CC45 %s
-// CHECK-CC45: OverloadCandidate:{ResultType void}{Text foo_11}{LeftParen (}{Text int}{Comma , }{CurrentParameter U}{RightParen )} (1)
+// CHECK-CC45: OverloadCandidate:{ResultType void}{Text foo_11}{LeftParen (}{Placeholder int}{Comma , }{CurrentParameter U}{RightParen )} (1)
 // CHECK-CC45: Completion contexts:
 // CHECK-CC45-NEXT: Any type
 // CHECK-CC45-NEXT: Any value
@@ -645,7 +645,7 @@ int main() {
 // CHECK-CC45-NEXT: Objective-C interface
 
 // RUN: c-index-test -code-completion-at=%s:83:28 %s | FileCheck -check-prefix=CHECK-CC46 %s
-// CHECK-CC46: OverloadCandidate:{ResultType void}{Text foo_11}{LeftParen (}{Text int}{Comma , }{CurrentParameter void *}{RightParen )} (1)
+// CHECK-CC46: OverloadCandidate:{ResultType void}{Text foo_11}{LeftParen (}{Placeholder int}{Comma , }{CurrentParameter void *}{RightParen )} (1)
 // CHECK-CC46: Completion contexts:
 // CHECK-CC46-NEXT: Any type
 // CHECK-CC46-NEXT: Any value
@@ -657,7 +657,7 @@ int main() {
 // CHECK-CC46-NEXT: Objective-C interface
 
 // RUN: c-index-test -code-completion-at=%s:84:12 %s | FileCheck -check-prefix=CHECK-CC47 %s
-// CHECK-CC47: OverloadCandidate:{ResultType void}{Text foo_12}{LeftParen (}{CurrentParameter int}{Comma , }{Text int}{RightParen )} (1)
+// CHECK-CC47: OverloadCandidate:{ResultType void}{Text foo_12}{LeftParen (}{CurrentParameter int}{Comma , }{Placeholder int}{RightParen )} (1)
 // CHECK-CC47: Completion contexts:
 // CHECK-CC47-NEXT: Any type
 // CHECK-CC47-NEXT: Any value
@@ -669,7 +669,7 @@ int main() {
 // CHECK-CC47-NEXT: Objective-C interface
 
 // RUN: c-index-test -code-completion-at=%s:84:14 %s | FileCheck -check-prefix=CHECK-CC48 %s
-// CHECK-CC48: OverloadCandidate:{ResultType void}{Text foo_12}{LeftParen (}{Text void *}{Comma , }{CurrentParameter void *}{RightParen )} (1)
+// CHECK-CC48: OverloadCandidate:{ResultType void}{Text foo_12}{LeftParen (}{Placeholder void *}{Comma , }{CurrentParameter void *}{RightParen )} (1)
 // CHECK-CC48: Completion contexts:
 // CHECK-CC48-NEXT: Any type
 // CHECK-CC48-NEXT: Any value
@@ -681,7 +681,7 @@ int main() {
 // CHECK-CC48-NEXT: Objective-C interface
 
 // RUN: c-index-test -code-completion-at=%s:85:12 %s | FileCheck -check-prefix=CHECK-CC49 %s
-// CHECK-CC49: OverloadCandidate:{ResultType void}{Text foo_13}{LeftParen (}{CurrentParameter int}{Comma , }{Text T}{Comma , }{Text T}{RightParen )} (1)
+// CHECK-CC49: OverloadCandidate:{ResultType void}{Text foo_13}{LeftParen (}{CurrentParameter int}{Comma , }{Placeholder T}{Comma , }{Placeholder T}{RightParen )} (1)
 // CHECK-CC49: Completion contexts:
 // CHECK-CC49-NEXT: Any type
 // CHECK-CC49-NEXT: Any value
@@ -693,7 +693,7 @@ int main() {
 // CHECK-CC49-NEXT: Objective-C interface
 
 // RUN: c-index-test -code-completion-at=%s:85:15 %s | FileCheck -check-prefix=CHECK-CC50 %s
-// CHECK-CC50: OverloadCandidate:{ResultType void}{Text foo_13}{LeftParen (}{Text int}{Comma , }{CurrentParameter T}{Comma , }{Text T}{RightParen )} (1)
+// CHECK-CC50: OverloadCandidate:{ResultType void}{Text foo_13}{LeftParen (}{Placeholder int}{Comma , }{CurrentParameter T}{Comma , }{Placeholder T}{RightParen )} (1)
 // CHECK-CC50: Completion contexts:
 // CHECK-CC50-NEXT: Any type
 // CHECK-CC50-NEXT: Any value
@@ -705,7 +705,7 @@ int main() {
 // CHECK-CC50-NEXT: Objective-C interface
 
 // RUN: c-index-test -code-completion-at=%s:85:19 %s | FileCheck -check-prefix=CHECK-CC51 %s
-// CHECK-CC51: OverloadCandidate:{ResultType void}{Text foo_13}{LeftParen (}{Text int}{Comma , }{Text int}{Comma , }{CurrentParameter int}{RightParen )} (1)
+// CHECK-CC51: OverloadCandidate:{ResultType void}{Text foo_13}{LeftParen (}{Placeholder int}{Comma , }{Placeholder int}{Comma , }{CurrentParameter int}{RightParen )} (1)
 // CHECK-CC51: Completion contexts:
 // CHECK-CC51-NEXT: Any type
 // CHECK-CC51-NEXT: Any value
index f53586c645c7b84d446e00ef480b79ddfb087116..e5c01df87bd36fc22a462c3977004e476d664914 100644 (file)
@@ -18,7 +18,7 @@ int main() {
 
 // RUN: c-index-test -code-completion-at=%s:11:10 %s | FileCheck -check-prefix=CHECK-CC1 %s
 // CHECK-CC1: OverloadCandidate:{Text S}{LeftParen (}{CurrentParameter const S<int> &}{RightParen )} (1)
-// CHECK-CC1: OverloadCandidate:{Text S}{LeftParen (}{CurrentParameter int}{Comma , }{Text U}{Comma , }{Text U}{RightParen )} (1)
+// CHECK-CC1: OverloadCandidate:{Text S}{LeftParen (}{CurrentParameter int}{Comma , }{Placeholder U}{Comma , }{Placeholder U}{RightParen )} (1)
 // CHECK-CC1: Completion contexts:
 // CHECK-CC1-NEXT: Any type
 // CHECK-CC1-NEXT: Any value
@@ -31,7 +31,7 @@ int main() {
 
 // RUN: c-index-test -code-completion-at=%s:12:10 %s | FileCheck -check-prefix=CHECK-CC2 %s
 // CHECK-CC2: OverloadCandidate:{Text S}{LeftParen (}{CurrentParameter const S<int> &}{RightParen )} (1)
-// CHECK-CC2: OverloadCandidate:{Text S}{LeftParen (}{CurrentParameter int}{Comma , }{Text U}{Comma , }{Text U}{RightParen )} (1)
+// CHECK-CC2: OverloadCandidate:{Text S}{LeftParen (}{CurrentParameter int}{Comma , }{Placeholder U}{Comma , }{Placeholder U}{RightParen )} (1)
 // CHECK-CC2: Completion contexts:
 // CHECK-CC2-NEXT: Any type
 // CHECK-CC2-NEXT: Any value
@@ -43,7 +43,7 @@ int main() {
 // CHECK-CC2-NEXT: Objective-C interface
 
 // RUN: c-index-test -code-completion-at=%s:12:13 %s | FileCheck -check-prefix=CHECK-CC3 %s
-// CHECK-CC3: OverloadCandidate:{Text S}{LeftParen (}{Text int}{Comma , }{CurrentParameter U}{Comma , }{Text U}{RightParen )} (1)
+// CHECK-CC3: OverloadCandidate:{Text S}{LeftParen (}{Placeholder int}{Comma , }{CurrentParameter U}{Comma , }{Placeholder U}{RightParen )} (1)
 // CHECK-CC3: Completion contexts:
 // CHECK-CC3-NEXT: Any type
 // CHECK-CC3-NEXT: Any value
@@ -55,7 +55,7 @@ int main() {
 // CHECK-CC3-NEXT: Objective-C interface
 
 // RUN: c-index-test -code-completion-at=%s:12:17 %s | FileCheck -check-prefix=CHECK-CC4 %s
-// CHECK-CC4: OverloadCandidate:{Text S}{LeftParen (}{Text int}{Comma , }{Text int}{Comma , }{CurrentParameter int}{RightParen )} (1)
+// CHECK-CC4: OverloadCandidate:{Text S}{LeftParen (}{Placeholder int}{Comma , }{Placeholder int}{Comma , }{CurrentParameter int}{RightParen )} (1)
 // CHECK-CC4: Completion contexts:
 // CHECK-CC4-NEXT: Any type
 // CHECK-CC4-NEXT: Any value
@@ -68,7 +68,7 @@ int main() {
 
 // RUN: c-index-test -code-completion-at=%s:13:12 %s | FileCheck -check-prefix=CHECK-CC5 %s
 // CHECK-CC5: OverloadCandidate:{Text S}{LeftParen (}{CurrentParameter const S<int> &}{RightParen )} (1)
-// CHECK-CC5: OverloadCandidate:{Text S}{LeftParen (}{CurrentParameter int}{Comma , }{Text U}{Comma , }{Text U}{RightParen )} (1)
+// CHECK-CC5: OverloadCandidate:{Text S}{LeftParen (}{CurrentParameter int}{Comma , }{Placeholder U}{Comma , }{Placeholder U}{RightParen )} (1)
 // CHECK-CC5: Completion contexts:
 // CHECK-CC5-NEXT: Any type
 // CHECK-CC5-NEXT: Any value
@@ -80,7 +80,7 @@ int main() {
 // CHECK-CC5-NEXT: Objective-C interface
 
 // RUN: c-index-test -code-completion-at=%s:13:15 %s | FileCheck -check-prefix=CHECK-CC6 %s
-// CHECK-CC6: OverloadCandidate:{Text S}{LeftParen (}{Text int}{Comma , }{CurrentParameter U}{Comma , }{Text U}{RightParen )} (1)
+// CHECK-CC6: OverloadCandidate:{Text S}{LeftParen (}{Placeholder int}{Comma , }{CurrentParameter U}{Comma , }{Placeholder U}{RightParen )} (1)
 // CHECK-CC6: Completion contexts:
 // CHECK-CC6-NEXT: Any type
 // CHECK-CC6-NEXT: Any value
@@ -92,7 +92,7 @@ int main() {
 // CHECK-CC6-NEXT: Objective-C interface
 
 // RUN: c-index-test -code-completion-at=%s:13:19 %s | FileCheck -check-prefix=CHECK-CC7 %s
-// CHECK-CC7: OverloadCandidate:{Text S}{LeftParen (}{Text int}{Comma , }{Text int}{Comma , }{CurrentParameter int}{RightParen )} (1)
+// CHECK-CC7: OverloadCandidate:{Text S}{LeftParen (}{Placeholder int}{Comma , }{Placeholder int}{Comma , }{CurrentParameter int}{RightParen )} (1)
 // CHECK-CC7: Completion contexts:
 // CHECK-CC7-NEXT: Any type
 // CHECK-CC7-NEXT: Any value
index 6fac36dd8c187afc5a4cd4c85d21bc219fee7144..b6aed7eb19e26a1102e5601e942faa8280446b66 100644 (file)
@@ -26,7 +26,7 @@ int main() {
 // RUN: c-index-test -code-completion-at=%s:16:5 %s | FileCheck -check-prefix=CHECK-CC1 %s
 // CHECK-CC1: OverloadCandidate:{ResultType void}{Text operator()}{LeftParen (}{CurrentParameter int}{RightParen )} (1)
 // CHECK-CC1: OverloadCandidate:{ResultType void}{Text operator()}{LeftParen (}{CurrentParameter T}{RightParen )} (1)
-// CHECK-CC1: OverloadCandidate:{ResultType void}{Text operator()}{LeftParen (}{CurrentParameter void *}{Comma , }{Text T}{Comma , }{Text T}{RightParen )} (1)
+// CHECK-CC1: OverloadCandidate:{ResultType void}{Text operator()}{LeftParen (}{CurrentParameter void *}{Comma , }{Placeholder T}{Comma , }{Placeholder T}{RightParen )} (1)
 // CHECK-CC1: Completion contexts:
 // CHECK-CC1-NEXT: Any type
 // CHECK-CC1-NEXT: Any value
@@ -40,7 +40,7 @@ int main() {
 // RUN: c-index-test -code-completion-at=%s:17:5 %s | FileCheck -check-prefix=CHECK-CC2 %s
 // CHECK-CC2: OverloadCandidate:{ResultType void}{Text operator()}{LeftParen (}{CurrentParameter int}{RightParen )} (1)
 // CHECK-CC2: OverloadCandidate:{ResultType void}{Text operator()}{LeftParen (}{CurrentParameter T}{RightParen )} (1)
-// CHECK-CC2: OverloadCandidate:{ResultType void}{Text operator()}{LeftParen (}{CurrentParameter void *}{Comma , }{Text T}{Comma , }{Text T}{RightParen )} (1)
+// CHECK-CC2: OverloadCandidate:{ResultType void}{Text operator()}{LeftParen (}{CurrentParameter void *}{Comma , }{Placeholder T}{Comma , }{Placeholder T}{RightParen )} (1)
 // CHECK-CC2: Completion contexts:
 // CHECK-CC2-NEXT: Any type
 // CHECK-CC2-NEXT: Any value
@@ -54,7 +54,7 @@ int main() {
 // RUN: c-index-test -code-completion-at=%s:18:5 %s | FileCheck -check-prefix=CHECK-CC3 %s
 // CHECK-CC3: OverloadCandidate:{ResultType void}{Text operator()}{LeftParen (}{CurrentParameter int}{RightParen )} (1)
 // CHECK-CC3: OverloadCandidate:{ResultType void}{Text operator()}{LeftParen (}{CurrentParameter T}{RightParen )} (1)
-// CHECK-CC3: OverloadCandidate:{ResultType void}{Text operator()}{LeftParen (}{CurrentParameter void *}{Comma , }{Text T}{Comma , }{Text T}{RightParen )} (1)
+// CHECK-CC3: OverloadCandidate:{ResultType void}{Text operator()}{LeftParen (}{CurrentParameter void *}{Comma , }{Placeholder T}{Comma , }{Placeholder T}{RightParen )} (1)
 // CHECK-CC3: Completion contexts:
 // CHECK-CC3-NEXT: Any type
 // CHECK-CC3-NEXT: Any value
@@ -66,7 +66,7 @@ int main() {
 // CHECK-CC3-NEXT: Objective-C interface
 
 // RUN: c-index-test -code-completion-at=%s:18:7 %s | FileCheck -check-prefix=CHECK-CC4 %s
-// CHECK-CC4: OverloadCandidate:{ResultType void}{Text operator()}{LeftParen (}{Text void *}{Comma , }{CurrentParameter T}{Comma , }{Text T}{RightParen )} (1)
+// CHECK-CC4: OverloadCandidate:{ResultType void}{Text operator()}{LeftParen (}{Placeholder void *}{Comma , }{CurrentParameter T}{Comma , }{Placeholder T}{RightParen )} (1)
 // CHECK-CC4: Completion contexts:
 // CHECK-CC4-NEXT: Any type
 // CHECK-CC4-NEXT: Any value
@@ -78,7 +78,7 @@ int main() {
 // CHECK-CC4-NEXT: Objective-C interface
 
 // RUN: c-index-test -code-completion-at=%s:18:10 %s | FileCheck -check-prefix=CHECK-CC5 %s
-// CHECK-CC5: OverloadCandidate:{ResultType void}{Text operator()}{LeftParen (}{Text void *}{Comma , }{Text S<void *>}{Comma , }{CurrentParameter S<void *>}{RightParen )} (1)
+// CHECK-CC5: OverloadCandidate:{ResultType void}{Text operator()}{LeftParen (}{Placeholder void *}{Comma , }{Placeholder S<void *>}{Comma , }{CurrentParameter S<void *>}{RightParen )} (1)
 // CHECK-CC5: Completion contexts:
 // CHECK-CC5-NEXT: Any type
 // CHECK-CC5-NEXT: Any value
@@ -92,7 +92,7 @@ int main() {
 // RUN: c-index-test -code-completion-at=%s:19:17 %s | FileCheck -check-prefix=CHECK-CC6 %s
 // CHECK-CC6: OverloadCandidate:{ResultType void}{Text operator()}{LeftParen (}{CurrentParameter int}{RightParen )} (1)
 // CHECK-CC6: OverloadCandidate:{ResultType void}{Text operator()}{LeftParen (}{CurrentParameter T}{RightParen )} (1)
-// CHECK-CC6: OverloadCandidate:{ResultType void}{Text operator()}{LeftParen (}{CurrentParameter void *}{Comma , }{Text T}{Comma , }{Text T}{RightParen )} (1)
+// CHECK-CC6: OverloadCandidate:{ResultType void}{Text operator()}{LeftParen (}{CurrentParameter void *}{Comma , }{Placeholder T}{Comma , }{Placeholder T}{RightParen )} (1)
 // CHECK-CC6: OverloadCandidate:{ResultType const S<T> *}{Text operator()}{LeftParen (}{CurrentParameter const S<T> &s}{RightParen )} (1)
 // CHECK-CC6: Completion contexts:
 // CHECK-CC6-NEXT: Any type
@@ -107,7 +107,7 @@ int main() {
 // RUN: c-index-test -code-completion-at=%s:19:28 %s | FileCheck -check-prefix=CHECK-CC7 %s
 // CHECK-CC7: OverloadCandidate:{ResultType void}{Text operator()}{LeftParen (}{CurrentParameter int}{RightParen )} (1)
 // CHECK-CC7: OverloadCandidate:{ResultType void}{Text operator()}{LeftParen (}{CurrentParameter T}{RightParen )} (1)
-// CHECK-CC7: OverloadCandidate:{ResultType void}{Text operator()}{LeftParen (}{CurrentParameter int}{Comma , }{Text T}{Comma , }{Text T}{RightParen )} (1)
+// CHECK-CC7: OverloadCandidate:{ResultType void}{Text operator()}{LeftParen (}{CurrentParameter int}{Comma , }{Placeholder T}{Comma , }{Placeholder T}{RightParen )} (1)
 // CHECK-CC7: OverloadCandidate:{ResultType const S<T> *}{Text operator()}{LeftParen (}{CurrentParameter const S<T> &s}{RightParen )} (1)
 // CHECK-CC7: Completion contexts:
 // CHECK-CC7-NEXT: Any type
@@ -120,7 +120,7 @@ int main() {
 // CHECK-CC7-NEXT: Objective-C interface
 
 // RUN: c-index-test -code-completion-at=%s:19:31 %s | FileCheck -check-prefix=CHECK-CC8 %s
-// CHECK-CC8: OverloadCandidate:{ResultType void}{Text operator()}{LeftParen (}{Text int}{Comma , }{CurrentParameter T}{Comma , }{Text T}{RightParen )} (1)
+// CHECK-CC8: OverloadCandidate:{ResultType void}{Text operator()}{LeftParen (}{Placeholder int}{Comma , }{CurrentParameter T}{Comma , }{Placeholder T}{RightParen )} (1)
 // CHECK-CC8: Completion contexts:
 // CHECK-CC8-NEXT: Any type
 // CHECK-CC8-NEXT: Any value
@@ -132,7 +132,7 @@ int main() {
 // CHECK-CC8-NEXT: Objective-C interface
 
 // RUN: c-index-test -code-completion-at=%s:19:35 %s | FileCheck -check-prefix=CHECK-CC9 %s
-// CHECK-CC9: OverloadCandidate:{ResultType void}{Text operator()}{LeftParen (}{Text int}{Comma , }{Text int}{Comma , }{CurrentParameter int}{RightParen )} (1)
+// CHECK-CC9: OverloadCandidate:{ResultType void}{Text operator()}{LeftParen (}{Placeholder int}{Comma , }{Placeholder int}{Comma , }{CurrentParameter int}{RightParen )} (1)
 // CHECK-CC9: Completion contexts:
 // CHECK-CC9-NEXT: Any type
 // CHECK-CC9-NEXT: Any value
@@ -179,7 +179,7 @@ int main() {
 // RUN: c-index-test -code-completion-at=%s:12:28 %s | FileCheck -check-prefix=CHECK-CC13 %s
 // CHECK-CC13: OverloadCandidate:{ResultType void}{Text operator()}{LeftParen (}{CurrentParameter int}{RightParen )} (1)
 // CHECK-CC13: OverloadCandidate:{ResultType void}{Text operator()}{LeftParen (}{CurrentParameter T}{RightParen )} (1)
-// CHECK-CC13: OverloadCandidate:{ResultType void}{Text operator()}{LeftParen (}{CurrentParameter void *}{Comma , }{Text T}{Comma , }{Text T}{RightParen )} (1)
+// CHECK-CC13: OverloadCandidate:{ResultType void}{Text operator()}{LeftParen (}{CurrentParameter void *}{Comma , }{Placeholder T}{Comma , }{Placeholder T}{RightParen )} (1)
 // CHECK-CC13: Completion contexts:
 // CHECK-CC13-NEXT: Any type
 // CHECK-CC13-NEXT: Any value
diff --git a/test/Index/complete-optional-params.cpp b/test/Index/complete-optional-params.cpp
new file mode 100644 (file)
index 0000000..88d8105
--- /dev/null
@@ -0,0 +1,75 @@
+// Note: the run lines follow their respective tests, since line/column
+// matter in this test.
+
+void foo(int a = 42, int = 42);
+void bar(int a, int b = 42, int c = 42);
+void baz(int a = 42, ...);
+struct S{ S(int a = 42, int = 42) {} };
+
+int main() {
+    foo(42, 42);
+    bar(42, 42, 42);
+    baz(42, 42, 42);
+    S s(42, 42);
+}
+
+// RUN: c-index-test -code-completion-at=%s:10:9 %s | FileCheck -check-prefix=CHECK-CC1 %s
+// CHECK-CC1: OverloadCandidate:{ResultType void}{Text foo}{LeftParen (}{Optional {CurrentParameter int a}{Optional {Comma , }{Placeholder int}}}{RightParen )} (1)
+// CHECK-CC1: Completion contexts:
+// CHECK-CC1-NEXT: Any type
+// CHECK-CC1-NEXT: Any value
+// CHECK-CC1-NEXT: Enum tag
+// CHECK-CC1-NEXT: Union tag
+// CHECK-CC1-NEXT: Struct tag
+// CHECK-CC1-NEXT: Class name
+// CHECK-CC1-NEXT: Nested name specifier
+// CHECK-CC1-NEXT: Objective-C interface
+
+// RUN: c-index-test -code-completion-at=%s:11:9 %s | FileCheck -check-prefix=CHECK-CC2 %s
+// CHECK-CC2: OverloadCandidate:{ResultType void}{Text bar}{LeftParen (}{CurrentParameter int a}{Optional {Comma , }{Placeholder int b}{Optional {Comma , }{Placeholder int c}}}{RightParen )} (1)
+// CHECK-CC2: Completion contexts:
+// CHECK-CC2-NEXT: Any type
+// CHECK-CC2-NEXT: Any value
+// CHECK-CC2-NEXT: Enum tag
+// CHECK-CC2-NEXT: Union tag
+// CHECK-CC2-NEXT: Struct tag
+// CHECK-CC2-NEXT: Class name
+// CHECK-CC2-NEXT: Nested name specifier
+// CHECK-CC2-NEXT: Objective-C interface
+
+// RUN: c-index-test -code-completion-at=%s:11:16 %s | FileCheck -check-prefix=CHECK-CC3 %s
+// CHECK-CC3: OverloadCandidate:{ResultType void}{Text bar}{LeftParen (}{Placeholder int a}{Optional {Comma , }{Placeholder int b}{Optional {Comma , }{CurrentParameter int c}}}{RightParen )} (1)
+// CHECK-CC3: Completion contexts:
+// CHECK-CC3-NEXT: Any type
+// CHECK-CC3-NEXT: Any value
+// CHECK-CC3-NEXT: Enum tag
+// CHECK-CC3-NEXT: Union tag
+// CHECK-CC3-NEXT: Struct tag
+// CHECK-CC3-NEXT: Class name
+// CHECK-CC3-NEXT: Nested name specifier
+// CHECK-CC3-NEXT: Objective-C interface
+
+// RUN: c-index-test -code-completion-at=%s:12:16 %s | FileCheck -check-prefix=CHECK-CC4 %s
+// CHECK-CC4: OverloadCandidate:{ResultType void}{Text baz}{LeftParen (}{Optional {Placeholder int a}{Optional {Comma , }{CurrentParameter ...}}}{RightParen )} (1)
+// CHECK-CC4: Completion contexts:
+// CHECK-CC4-NEXT: Any type
+// CHECK-CC4-NEXT: Any value
+// CHECK-CC4-NEXT: Enum tag
+// CHECK-CC4-NEXT: Union tag
+// CHECK-CC4-NEXT: Struct tag
+// CHECK-CC4-NEXT: Class name
+// CHECK-CC4-NEXT: Nested name specifier
+// CHECK-CC4-NEXT: Objective-C interface
+
+// RUN: c-index-test -code-completion-at=%s:13:9 %s | FileCheck -check-prefix=CHECK-CC5 %s
+// CHECK-CC5: OverloadCandidate:{Text S}{LeftParen (}{Optional {CurrentParameter int a}{Optional {Comma , }{Placeholder int}}}{RightParen )} (1)
+// CHECK-CC5: OverloadCandidate:{Text S}{LeftParen (}{CurrentParameter const S &}{RightParen )} (1)
+// CHECK-CC5: Completion contexts:
+// CHECK-CC5-NEXT: Any type
+// CHECK-CC5-NEXT: Any value
+// CHECK-CC5-NEXT: Enum tag
+// CHECK-CC5-NEXT: Union tag
+// CHECK-CC5-NEXT: Struct tag
+// CHECK-CC5-NEXT: Class name
+// CHECK-CC5-NEXT: Nested name specifier
+// CHECK-CC5-NEXT: Objective-C interface
index be344b20ddb6d3c2490c05cd05b3268baba173f2..12e6cb9f72494d0abd037a06ff636bdeb9e1cf2c 100644 (file)
@@ -14,7 +14,7 @@ int main() {
 }
 
 // RUN: c-index-test -code-completion-at=%s:10:11 %s | FileCheck -check-prefix=CHECK-CC1 %s
-// CHECK-CC1: OverloadCandidate:{Text void}{LeftParen (}{CurrentParameter int}{RightParen )} (1)
+// CHECK-CC1: OverloadCandidate:{ResultType void}{LeftParen (}{CurrentParameter int}{RightParen )} (1)
 // CHECK-CC1: Completion contexts:
 // CHECK-CC1-NEXT: Any type
 // CHECK-CC1-NEXT: Any value
@@ -26,7 +26,7 @@ int main() {
 // CHECK-CC1-NEXT: Objective-C interface
 
 // RUN: c-index-test -code-completion-at=%s:11:11 %s | FileCheck -check-prefix=CHECK-CC2 %s
-// CHECK-CC2: OverloadCandidate:{Text void}{LeftParen (}{CurrentParameter int}{RightParen )} (1)
+// CHECK-CC2: OverloadCandidate:{ResultType void}{LeftParen (}{CurrentParameter int}{RightParen )} (1)
 // CHECK-CC2: Completion contexts:
 // CHECK-CC2-NEXT: Any type
 // CHECK-CC2-NEXT: Any value
@@ -38,7 +38,7 @@ int main() {
 // CHECK-CC2-NEXT: Objective-C interface
 
 // RUN: c-index-test -code-completion-at=%s:12:18 %s | FileCheck -check-prefix=CHECK-CC3 %s
-// CHECK-CC3: OverloadCandidate:{Text void}{LeftParen (}{Text int}{Comma , }{CurrentParameter ...}{RightParen )} (1)
+// CHECK-CC3: OverloadCandidate:{ResultType void}{LeftParen (}{Placeholder int}{Optional {Comma , }{CurrentParameter ...}}{RightParen )} (1)
 // CHECK-CC3: Completion contexts:
 // CHECK-CC3-NEXT: Any type
 // CHECK-CC3-NEXT: Any value
@@ -50,7 +50,7 @@ int main() {
 // CHECK-CC3-NEXT: Objective-C interface
 
 // RUN: c-index-test -code-completion-at=%s:13:18 %s | FileCheck -check-prefix=CHECK-CC4 %s
-// CHECK-CC4: OverloadCandidate:{Text void}{LeftParen (}{Text int}{Comma , }{CurrentParameter ...}{RightParen )} (1)
+// CHECK-CC4: OverloadCandidate:{ResultType void}{LeftParen (}{Placeholder int}{Optional {Comma , }{CurrentParameter ...}}{RightParen )} (1)
 // CHECK-CC4: Completion contexts:
 // CHECK-CC4-NEXT: Any type
 // CHECK-CC4-NEXT: Any value
index 21cd2c9e45ebd4db5886f544175a2c79a4780107..47f2c149af854ccb08ba544315aec566fed5a742 100644 (file)
@@ -619,7 +619,8 @@ namespace {
       for (unsigned I = 0; I != NumCandidates; ++I) {
         CodeCompletionString *StoredCompletion
           = Candidates[I].CreateSignatureString(CurrentArg, S, getAllocator(),
-                                                getCodeCompletionTUInfo());
+                                                getCodeCompletionTUInfo(),
+                                                includeBriefComments());
         
         CXCompletionResult R;
         R.CursorKind = CXCursor_OverloadCandidate;