[CodeCompletion] Format block parameter placeholders in implicit property
setters using the block type information that's obtained from the property
rdar://12604235
llvm-svn: 297628
diff --git a/clang/lib/Sema/SemaCodeComplete.cpp b/clang/lib/Sema/SemaCodeComplete.cpp
index 9b71a3f..ea4a33d 100644
--- a/clang/lib/Sema/SemaCodeComplete.cpp
+++ b/clang/lib/Sema/SemaCodeComplete.cpp
@@ -2288,6 +2288,15 @@
FunctionProtoTypeLoc BlockProto;
findTypeLocationForBlockDecl(Param->getTypeSourceInfo(), Block, BlockProto,
SuppressBlock);
+ // Try to retrieve the block type information from the property if this is a
+ // parameter in a setter.
+ if (!Block && ObjCMethodParam &&
+ cast<ObjCMethodDecl>(Param->getDeclContext())->isPropertyAccessor()) {
+ if (const auto *PD = cast<ObjCMethodDecl>(Param->getDeclContext())
+ ->findPropertyDecl(/*CheckOverrides=*/false))
+ findTypeLocationForBlockDecl(PD->getTypeSourceInfo(), Block, BlockProto,
+ SuppressBlock);
+ }
if (!Block) {
// We were unable to find a FunctionProtoTypeLoc with parameter names