diff options
author | Alex Lorenz <arphaman@gmail.com> | 2017-03-13 15:43:42 +0000 |
---|---|---|
committer | Alex Lorenz <arphaman@gmail.com> | 2017-03-13 15:43:42 +0000 |
commit | 6bf4a58b511ce5a83d91836689eb47c05721cea8 (patch) | |
tree | 1f4631c99b721847235ef899a531cc29f26d915f /clang/lib/Sema/SemaCodeComplete.cpp | |
parent | 27f5ff66cc5a07a535046bc158a6844cb684422e (diff) | |
download | bcm5719-llvm-6bf4a58b511ce5a83d91836689eb47c05721cea8.tar.gz bcm5719-llvm-6bf4a58b511ce5a83d91836689eb47c05721cea8.zip |
[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
Diffstat (limited to 'clang/lib/Sema/SemaCodeComplete.cpp')
-rw-r--r-- | clang/lib/Sema/SemaCodeComplete.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaCodeComplete.cpp b/clang/lib/Sema/SemaCodeComplete.cpp index 9b71a3f0876..ea4a33d3f57 100644 --- a/clang/lib/Sema/SemaCodeComplete.cpp +++ b/clang/lib/Sema/SemaCodeComplete.cpp @@ -2288,6 +2288,15 @@ static std::string FormatFunctionParameter(const PrintingPolicy &Policy, 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 |