Fix <rdar://problem/5874697> Rewriter: method arguments with complex types not being rewritten properly.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49925 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Driver/RewriteObjC.cpp b/Driver/RewriteObjC.cpp
index ebab81f..f666588 100644
--- a/Driver/RewriteObjC.cpp
+++ b/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 += ", ...";