When providing a block literal as a code completion for a

function/method argument, include the parameter name and always
include parentheses (even for zero-parameter blocks). Otherwise, the
block literal placeholder '^' can look very weird.

llvm-svn: 115444
This commit is contained in:
Douglas Gregor
2010-10-02 23:49:58 +00:00
parent f717f3ae61
commit af25cfaae0
2 changed files with 20 additions and 5 deletions

View File

@@ -1910,6 +1910,8 @@ static std::string FormatFunctionParameter(ASTContext &Context,
if (Block->getNumArgs() == 0) {
if (Block->getTypePtr()->isVariadic())
Result += "(...)";
else
Result += "(void)";
} else {
Result += "(";
for (unsigned I = 0, N = Block->getNumArgs(); I != N; ++I) {
@@ -1923,6 +1925,9 @@ static std::string FormatFunctionParameter(ASTContext &Context,
Result += ")";
}
if (Param->getIdentifier())
Result += Param->getIdentifier()->getName();
return Result;
}