summaryrefslogtreecommitdiff
path: root/lib/Sema/SemaCodeComplete.cpp
diff options
context:
space:
mode:
authorAlex Lorenz <arphaman@gmail.com>2016-11-23 16:28:34 +0000
committerAlex Lorenz <arphaman@gmail.com>2016-11-23 16:28:34 +0000
commit703d1c6a5d95b747d5c80c7b271d5d4bef5bfd35 (patch)
treee4d01f2dc528c1daec8eeeec11be9ebda0044743 /lib/Sema/SemaCodeComplete.cpp
parent2e60df097d8baa9d0ca441e7fd2ff72d4fecd5d3 (diff)
downloadclang-703d1c6a5d95b747d5c80c7b271d5d4bef5bfd35.tar.gz
[CodeCompletion] Fix incorrect Objective-C block parameter formatting
This commit fixes an incorrectly formatted Objective-C block parameter placeholder in a code completion result. The incorrect parameter had a redundant leading parenthesis. rdar://25224416 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@287771 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaCodeComplete.cpp')
-rw-r--r--lib/Sema/SemaCodeComplete.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/Sema/SemaCodeComplete.cpp b/lib/Sema/SemaCodeComplete.cpp
index 9f770cee03..2a78c981b4 100644
--- a/lib/Sema/SemaCodeComplete.cpp
+++ b/lib/Sema/SemaCodeComplete.cpp
@@ -2264,9 +2264,13 @@ static std::string FormatFunctionParameter(const PrintingPolicy &Policy,
QualType Type = Param->getType().getUnqualifiedType();
if (ObjCMethodParam) {
- Result = "(" + formatObjCParamQualifiers(Param->getObjCDeclQualifier(),
- Type);
- Result += Type.getAsString(Policy) + Result + ")";
+ Result = Type.getAsString(Policy);
+ std::string Quals =
+ formatObjCParamQualifiers(Param->getObjCDeclQualifier(), Type);
+ if (!Quals.empty())
+ Result = "(" + Quals + " " + Result + ")";
+ if (Result.back() != ')')
+ Result += " ";
if (Param->getIdentifier())
Result += Param->getIdentifier()->getName();
} else {
@@ -2275,7 +2279,7 @@ static std::string FormatFunctionParameter(const PrintingPolicy &Policy,
return Result;
}
-
+
// We have the function prototype behind the block pointer type, as it was
// written in the source.
return formatBlockPlaceholder(Policy, Param, Block, BlockProto,