if (I)
Result += ", ";
Result += FormatFunctionParameter(Context, Block->getArg(I));
- }
- if (Block->getTypePtr()->isVariadic()) {
- if (Block->getNumArgs() > 0)
+
+ if (I == N - 1 && Block->getTypePtr()->isVariadic())
Result += ", ...";
- else
- Result += "...";
- } else if (Block->getNumArgs() == 0 && !Context.getLangOptions().CPlusPlus)
+ }
+ if (Block->getTypePtr()->isVariadic() && Block->getNumArgs() == 0)
+ Result += "...";
+ else if (Block->getNumArgs() == 0 && !Context.getLangOptions().CPlusPlus)
Result += "void";
Result += ")";
// Format the placeholder string.
std::string PlaceholderStr = FormatFunctionParameter(Context, Param);
+ if (Function->isVariadic() && P == N - 1)
+ PlaceholderStr += ", ...";
+
// Add the placeholder string.
CCStr->AddPlaceholderChunk(PlaceholderStr);
}
if (const FunctionProtoType *Proto
= Function->getType()->getAs<FunctionProtoType>())
if (Proto->isVariadic()) {
- CCStr->AddPlaceholderChunk(", ...");
+ if (Proto->getNumArgs() == 0)
+ CCStr->AddPlaceholderChunk("...");
MaybeAddSentinel(Context, Function, CCStr);
}
Arg += II->getName().str();
}
+ if (Method->isVariadic() && (P + 1) == PEnd)
+ Arg += ", ...";
+
if (DeclaringEntity)
Result->AddTextChunk(Arg);
else if (AllParametersAreInformative)
}
if (Method->isVariadic()) {
- if (DeclaringEntity)
- Result->AddTextChunk(", ...");
- else if (AllParametersAreInformative)
- Result->AddInformativeChunk(", ...");
- else
- Result->AddPlaceholderChunk(", ...");
+ if (Method->param_size() == 0) {
+ if (DeclaringEntity)
+ Result->AddTextChunk(", ...");
+ else if (AllParametersAreInformative)
+ Result->AddInformativeChunk(", ...");
+ else
+ Result->AddPlaceholderChunk(", ...");
+ }
MaybeAddSentinel(S.Context, Method, Result);
}
Pattern->AddChunk(CodeCompletionString::CK_RightParen);
if (IdentifierInfo *Id = (*P)->getIdentifier())
- Pattern->AddTextChunk(Id->getName());
+ Pattern->AddTextChunk(Id->getName());
}
if (Method->isVariadic()) {
if (Method->param_size() > 0)
Pattern->AddChunk(CodeCompletionString::CK_Comma);
Pattern->AddTextChunk("...");
- }
+ }
if (IsInImplementation && Results.includeCodePatterns()) {
// We will be defining the method here, so add a compound statement.
// CHECK-CCA: {ResultType Class}{TypedText self}
// CHECK-CCA: {TypedText super}
// RUN: c-index-test -code-completion-at=%s:103:6 %s | FileCheck -check-prefix=CHECK-CCB %s
-// CHECK-CCB: ObjCInstanceMethodDecl:{ResultType int}{TypedText Method:}{Placeholder (int)}{Placeholder , ...}
-// CHECK-CCB: ObjCInstanceMethodDecl:{ResultType int}{TypedText SentinelMethod:}{Placeholder (int)}{Placeholder , ...}{Text , nil}
+// CHECK-CCB: ObjCInstanceMethodDecl:{ResultType int}{TypedText Method:}{Placeholder (int), ...}
+// CHECK-CCB: ObjCInstanceMethodDecl:{ResultType int}{TypedText SentinelMethod:}{Placeholder (int), ...}{Text , nil}
// RUN: c-index-test -code-completion-at=%s:116:14 %s | FileCheck -check-prefix=CHECK-CCC %s
// CHECK-CCC: ObjCClassMethodDecl:{ResultType int}{TypedText Method}
// CHECK-CCC: ObjCClassMethodDecl:{ResultType int}{TypedText Method:}{Placeholder (int)}