objc rewriter - more fixes to support compiling the rewritten
test case having instancetype. Fix in rewriter is unrelated to
using of instancetype. Test case uses other feature not yet
supported in the rewriter. There is more work to do, but this
is an ongoing task and not urgent at this time.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139473 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Rewrite/RewriteObjC.cpp b/lib/Rewrite/RewriteObjC.cpp
index db59b51..2e118e8 100644
--- a/lib/Rewrite/RewriteObjC.cpp
+++ b/lib/Rewrite/RewriteObjC.cpp
@@ -420,8 +420,14 @@
else if (T->isObjCQualifiedClassType())
T = Context->getObjCClassType();
else if (T->isObjCObjectPointerType() &&
- T->getPointeeType()->isObjCQualifiedInterfaceType())
- T = Context->getObjCIdType();
+ T->getPointeeType()->isObjCQualifiedInterfaceType()) {
+ if (const ObjCObjectPointerType * OBJPT =
+ T->getAsObjCInterfacePointerType()) {
+ const ObjCInterfaceType *IFaceT = OBJPT->getInterfaceType();
+ T = QualType(IFaceT, 0);
+ T = Context->getPointerType(T);
+ }
+ }
}
// FIXME: This predicate seems like it would be useful to add to ASTContext.
@@ -3124,8 +3130,8 @@
(void)convertBlockPointerToFunctionPointer(t);
ArgTypes.push_back(t);
}
- returnType = OMD->getResultType()->isObjCQualifiedIdType()
- ? Context->getObjCIdType() : OMD->getResultType();
+ returnType = Exp->getType();
+ convertToUnqualifiedObjCType(returnType);
(void)convertBlockPointerToFunctionPointer(returnType);
} else {
returnType = Context->getObjCIdType();