]> granicus.if.org Git - clang/commitdiff
Introduce proper spacing after the Objective-C parameter qualifiers
authorDouglas Gregor <dgregor@apple.com>
Wed, 9 Nov 2011 02:13:45 +0000 (02:13 +0000)
committerDouglas Gregor <dgregor@apple.com>
Wed, 9 Nov 2011 02:13:45 +0000 (02:13 +0000)
(bycopy, inout, etc.). Fixes <rdar://problem/10402900>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144157 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaCodeComplete.cpp
test/Index/complete-objc-message.m

index 2bff705060e9c09d965c3f570bed807bf8c5d7b1..3d2d0930d87f3bb1abe622f7de9f885a2883616f 100644 (file)
@@ -1998,25 +1998,20 @@ static void MaybeAddSentinel(ASTContext &Context, NamedDecl *FunctionOrMethod,
     }
 }
 
-static void appendWithSpace(std::string &Result, StringRef Text) {
-  if (!Result.empty())
-    Result += ' ';
-  Result += Text.str();
-}
 static std::string formatObjCParamQualifiers(unsigned ObjCQuals) {
   std::string Result;
   if (ObjCQuals & Decl::OBJC_TQ_In)
-    appendWithSpace(Result, "in");
+    Result += "in ";
   else if (ObjCQuals & Decl::OBJC_TQ_Inout)
-    appendWithSpace(Result, "inout");
+    Result += "inout ";
   else if (ObjCQuals & Decl::OBJC_TQ_Out)
-    appendWithSpace(Result, "out");
+    Result += "out ";
   if (ObjCQuals & Decl::OBJC_TQ_Bycopy)
-    appendWithSpace(Result, "bycopy");
+    Result += "bycopy ";
   else if (ObjCQuals & Decl::OBJC_TQ_Byref)
-    appendWithSpace(Result, "byref");
+    Result += "byref ";
   if (ObjCQuals & Decl::OBJC_TQ_Oneway)
-    appendWithSpace(Result, "oneway");
+    Result += "oneway ";
   return Result;
 }
 
index 955ab6f144f9fd99d7e46d91d116a0a2a36f0baa..fc25ef8bc679b455509ab488d7b63bc979c2e70b 100644 (file)
@@ -333,4 +333,4 @@ void test_DO(DO *d, A* a) {
 // RUN: c-index-test -code-completion-at=%s:175:12 %s | FileCheck -check-prefix=CHECK-CLASS-RESULT %s
 
 // RUN: c-index-test -code-completion-at=%s:189:6 %s | FileCheck -check-prefix=CHECK-DISTRIB-OBJECTS %s
-// CHECK-DISTRIB-OBJECTS: ObjCInstanceMethodDecl:{ResultType void}{TypedText method:}{Placeholder (in bycopyA *)}{HorizontalSpace  }{TypedText result:}{Placeholder (out byrefA **)} (35)
+// CHECK-DISTRIB-OBJECTS: ObjCInstanceMethodDecl:{ResultType void}{TypedText method:}{Placeholder (in bycopy A *)}{HorizontalSpace  }{TypedText result:}{Placeholder (out byref A **)} (35)