r211237 - Objective-C. Revert my patch in r211234.

Fariborz Jahanian fjahanian at apple.com
Wed Jun 18 16:22:38 PDT 2014


Author: fjahanian
Date: Wed Jun 18 18:22:38 2014
New Revision: 211237

URL: http://llvm.org/viewvc/llvm-project?rev=211237&view=rev
Log:
Objective-C. Revert my patch in r211234.


Modified:
    cfe/trunk/lib/Sema/SemaExprObjC.cpp
    cfe/trunk/test/ARCMT/checking.m
    cfe/trunk/test/ARCMT/nonobjc-to-objc-cast.m.result
    cfe/trunk/test/SemaObjC/arc-type-conversion.m
    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=211237&r1=211236&r2=211237&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExprObjC.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprObjC.cpp Wed Jun 18 18:22:38 2014
@@ -3168,9 +3168,7 @@ diagnoseObjCARCConversion(Sema &S, Sourc
   if ((castACTC == ACTC_coreFoundation &&  exprACTC == ACTC_retainable &&
        ObjCBridgeRelatedAttrFromType(castType, TDNDecl)) ||
       (exprACTC == ACTC_coreFoundation && castACTC == ACTC_retainable &&
-       ObjCBridgeRelatedAttrFromType(castExprType, TDNDecl)) ||
-      (exprACTC ==ACTC_voidPtr && castACTC == ACTC_retainable &&
-       CCK == Sema::CCK_ImplicitConversion))
+       ObjCBridgeRelatedAttrFromType(castExprType, TDNDecl)))
     return;
   
   unsigned srcKind = 0;

Modified: cfe/trunk/test/ARCMT/checking.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/ARCMT/checking.m?rev=211237&r1=211236&r2=211237&view=diff
==============================================================================
--- cfe/trunk/test/ARCMT/checking.m (original)
+++ cfe/trunk/test/ARCMT/checking.m Wed Jun 18 18:22:38 2014
@@ -158,8 +158,8 @@ void * cvt(id arg)
   (void)(__autoreleasing id**)voidp_val;
   (void)(void*)voidp_val;
   (void)(void**)arg; // expected-error {{disallowed}}
-  cvt((void*)arg); // expected-error 1 {{requires a bridged cast}} \
-                   // expected-note 1 {{use __bridge to}} expected-note {{use CFBridgingRetain call}}
+  cvt((void*)arg); // expected-error 2 {{requires a bridged cast}} \
+                   // expected-note 2 {{use __bridge to}} expected-note {{use CFBridgingRelease call}} expected-note {{use CFBridgingRetain call}}
   cvt(0);
   (void)(__strong id**)(0);
   return arg; // expected-error {{requires a bridged cast}} expected-note {{use __bridge}} expected-note {{use CFBridgingRetain call}}

Modified: cfe/trunk/test/ARCMT/nonobjc-to-objc-cast.m.result
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/ARCMT/nonobjc-to-objc-cast.m.result?rev=211237&r1=211236&r2=211237&view=diff
==============================================================================
--- cfe/trunk/test/ARCMT/nonobjc-to-objc-cast.m.result (original)
+++ cfe/trunk/test/ARCMT/nonobjc-to-objc-cast.m.result Wed Jun 18 18:22:38 2014
@@ -36,7 +36,7 @@ void f(BOOL b, id p) {
   CFUUIDRef   _uuid;
   NSString *_uuidString = (NSString *)CFBridgingRelease(CFUUIDCreateString(kCFAllocatorDefault, _uuid));
   _uuidString = (NSString *)CFBridgingRelease(CFUUIDCreateString(kCFAllocatorDefault, _uuid));
-  _uuidString = CFRetain(_uuid);
+  _uuidString = CFBridgingRelease(CFRetain(_uuid));
 }
 
 @implementation NSString (StrExt)

Modified: cfe/trunk/test/SemaObjC/arc-type-conversion.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/arc-type-conversion.m?rev=211237&r1=211236&r2=211237&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/arc-type-conversion.m (original)
+++ cfe/trunk/test/SemaObjC/arc-type-conversion.m Wed Jun 18 18:22:38 2014
@@ -16,8 +16,10 @@ void * cvt(id arg)
   (void)(void*)voidp_val;
   (void)(void**)arg; // expected-error {{cast of an Objective-C pointer to 'void **' is disallowed with ARC}}
   cvt((void*)arg); // expected-error {{cast of Objective-C pointer type 'id' to C pointer type 'void *' requires a bridged cast}} \
-                   // expected-note 1 {{use __bridge to convert directly (no change in ownership)}} \
+                   // expected-error {{implicit conversion of C pointer type 'void *' to Objective-C pointer type 'id' requires a bridged cast}} \
+                   // expected-note 2 {{use __bridge to convert directly (no change in ownership)}} \
                    // expected-note {{use CFBridgingRetain call to make an ARC object available as a +1 'void *'}} \
+                   // expected-note {{use CFBridgingRelease call to transfer ownership of a +1 'void *' into ARC}}
   cvt(0);
   (void)(__strong id**)(0);
   return arg; // expected-error {{implicit conversion of Objective-C pointer type 'id' to C pointer type 'void *' requires a bridged cast}} \

Modified: cfe/trunk/test/SemaObjC/arc.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/arc.m?rev=211237&r1=211236&r2=211237&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/arc.m (original)
+++ cfe/trunk/test/SemaObjC/arc.m Wed Jun 18 18:22:38 2014
@@ -285,7 +285,7 @@ void test11(id op, void *vp) {
   b = (nil == vp);
 
   b = (vp == op); // expected-error {{implicit conversion of Objective-C pointer type 'id' to C pointer type 'void *' requires a bridged cast}} expected-note {{use __bridge}} expected-note {{use CFBridgingRetain call}}
-  b = (op == vp);
+  b = (op == vp); // expected-error {{implicit conversion of C pointer type 'void *' to Objective-C pointer type 'id' requires a bridged cast}} expected-note {{use __bridge}} expected-note {{use CFBridgingRelease call}}
 }
 
 void test12(id collection) {
@@ -782,19 +782,3 @@ void foo(NSArray *array) {
     }
   }
 }
-
-// rdar://16627903
-extern void abort();
-#define TKAssertEqual(a, b) do{\
-    __typeof(a) a_res = (a);\
-    __typeof(b) b_res = (b);\
-    if ((a_res) != (b_res)) {\
-        abort();\
-    }\
-}while(0)
-
-int main() {
-  id object;
-  TKAssertEqual(object, nil);
-  TKAssertEqual(object, (id)nil);
-}





More information about the cfe-commits mailing list