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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@115444 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaCodeComplete.cpp b/lib/Sema/SemaCodeComplete.cpp
index 64a96db..ae82ceb 100644
--- a/lib/Sema/SemaCodeComplete.cpp
+++ b/lib/Sema/SemaCodeComplete.cpp
@@ -1910,6 +1910,8 @@
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 @@
Result += ")";
}
+ if (Param->getIdentifier())
+ Result += Param->getIdentifier()->getName();
+
return Result;
}