[llvm-branch-commits] [cfe-branch] r119237 - in /cfe/branches/Apple/whitney: lib/Rewrite/RewriteObjC.cpp test/Rewriter/rewrite-block-pointer.mm
Daniel Dunbar
daniel at zuster.org
Mon Nov 15 13:45:15 PST 2010
Author: ddunbar
Date: Mon Nov 15 15:45:15 2010
New Revision: 119237
URL: http://llvm.org/viewvc/llvm-project?rev=119237&view=rev
Log:
Merge r118286:
--
Author: Fariborz Jahanian <fjahanian at apple.com>
Date: Fri Nov 5 18:34:46 2010 +0000
Proper rewriting of block envokation with
qualified ObjC pointer types in its argument list.
// rdar: //8608902
Modified:
cfe/branches/Apple/whitney/lib/Rewrite/RewriteObjC.cpp
cfe/branches/Apple/whitney/test/Rewriter/rewrite-block-pointer.mm
Modified: cfe/branches/Apple/whitney/lib/Rewrite/RewriteObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/lib/Rewrite/RewriteObjC.cpp?rev=119237&r1=119236&r2=119237&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/lib/Rewrite/RewriteObjC.cpp (original)
+++ cfe/branches/Apple/whitney/lib/Rewrite/RewriteObjC.cpp Mon Nov 15 15:45:15 2010
@@ -404,6 +404,16 @@
return false;
}
+ void convertToUnqualifiedObjCType(QualType &T) {
+ if (T->isObjCQualifiedIdType())
+ T = Context->getObjCIdType();
+ else if (T->isObjCQualifiedClassType())
+ T = Context->getObjCClassType();
+ else if (T->isObjCObjectPointerType() &&
+ T->getPointeeType()->isObjCQualifiedInterfaceType())
+ T = Context->getObjCIdType();
+ }
+
// FIXME: This predicate seems like it would be useful to add to ASTContext.
bool isObjCType(QualType T) {
if (!LangOpts.ObjC1 && !LangOpts.ObjC2)
@@ -4685,7 +4695,8 @@
E = FTP->arg_type_end(); I && (I != E); ++I) {
QualType t = *I;
// Make sure we convert "t (^)(...)" to "t (*)(...)".
- (void)convertBlockPointerToFunctionPointer(t);
+ if (!convertBlockPointerToFunctionPointer(t))
+ convertToUnqualifiedObjCType(t);
ArgTypes.push_back(t);
}
}
@@ -4711,6 +4722,7 @@
MemberExpr *ME = new (Context) MemberExpr(PE, true, FD, SourceLocation(),
FD->getType());
+
CastExpr *FunkCast = NoTypeInfoCStyleCastExpr(Context, PtrToFuncCastType,
CK_Unknown, ME);
PE = new (Context) ParenExpr(SourceLocation(), SourceLocation(), FunkCast);
Modified: cfe/branches/Apple/whitney/test/Rewriter/rewrite-block-pointer.mm
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/test/Rewriter/rewrite-block-pointer.mm?rev=119237&r1=119236&r2=119237&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/test/Rewriter/rewrite-block-pointer.mm (original)
+++ cfe/branches/Apple/whitney/test/Rewriter/rewrite-block-pointer.mm Mon Nov 15 15:45:15 2010
@@ -82,3 +82,9 @@
@interface I @end
@interface INTF @end
void (^BLINT)(I<CoreDAVAccountInfoProvider>* ARG, INTF<CodeProvider, CoreDAVAccountInfoProvider>* ARG1);
+
+void test8608902() {
+ BDVDiscoveryCompletionHandler ppp;
+ ppp(1, 0);
+}
+
More information about the llvm-branch-commits
mailing list