[cfe-commits] r133622 - in /cfe/trunk: lib/Sema/SemaExprObjC.cpp test/SemaObjC/arc.m
Fariborz Jahanian
fjahanian at apple.com
Wed Jun 22 09:36:45 PDT 2011
Author: fjahanian
Date: Wed Jun 22 11:36:45 2011
New Revision: 133622
URL: http://llvm.org/viewvc/llvm-project?rev=133622&view=rev
Log:
objc-arc: Allow unbridged cast of retainable object to
integral as it is not transferring ownership..
// rdar://9619861
Modified:
cfe/trunk/lib/Sema/SemaExprObjC.cpp
cfe/trunk/test/SemaObjC/arc.m
Modified: cfe/trunk/lib/Sema/SemaExprObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprObjC.cpp?rev=133622&r1=133621&r2=133622&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExprObjC.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprObjC.cpp Wed Jun 22 11:36:45 2011
@@ -1620,7 +1620,7 @@
ARCConversionTypeClass exprACTC = classifyTypeForARCConversion(castExprType);
ARCConversionTypeClass castACTC = classifyTypeForARCConversion(castType);
if (exprACTC == castACTC) return;
- if (exprACTC && castType->isBooleanType()) return;
+ if (exprACTC && castType->isIntegralType(Context)) return;
// Allow casts between pointers to lifetime types (e.g., __strong id*)
// and pointers to void (e.g., cv void *). Casting from void* to lifetime*
Modified: cfe/trunk/test/SemaObjC/arc.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/arc.m?rev=133622&r1=133621&r2=133622&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/arc.m (original)
+++ cfe/trunk/test/SemaObjC/arc.m Wed Jun 22 11:36:45 2011
@@ -563,3 +563,12 @@
: (*x).ivar; // expected-error {{dereferencing a __weak pointer is not allowed}}
}
+// rdar://9619861
+extern int printf(const char*, ...);
+typedef long intptr_t;
+
+int Test33(id someid) {
+ printf( "Hello%ld", (intptr_t)someid);
+ return (int)someid;
+}
+
More information about the cfe-commits
mailing list