Fix <rdar://problem/5874697> Rewriter: method arguments with complex types not being rewritten properly.

llvm-svn: 49925
diff --git a/clang/Driver/RewriteObjC.cpp b/clang/Driver/RewriteObjC.cpp
index ebab81f..f666588 100644
--- a/clang/Driver/RewriteObjC.cpp
+++ b/clang/Driver/RewriteObjC.cpp
@@ -720,12 +720,14 @@
   for (unsigned i = 0; i < OMD->getNumParams(); i++) {
     ParmVarDecl *PDecl = OMD->getParamDecl(i);
     ResultStr += ", ";
-    if (PDecl->getType()->isObjCQualifiedIdType())
-      ResultStr += "id";
-    else
-      ResultStr += PDecl->getType().getAsString();
-    ResultStr += " ";
-    ResultStr += PDecl->getName();
+    if (PDecl->getType()->isObjCQualifiedIdType()) {
+      ResultStr += "id ";
+      ResultStr += PDecl->getName();
+    } else {
+      std::string Name = PDecl->getName();
+      PDecl->getType().getAsStringInternal(Name);
+      ResultStr += Name;
+    }
   }
   if (OMD->isVariadic())
     ResultStr += ", ...";