r220802 - [Objective-C]. revert r220740,r220727

Fariborz Jahanian fjahanian at apple.com
Tue Oct 28 10:26:32 PDT 2014


Author: fjahanian
Date: Tue Oct 28 12:26:21 2014
New Revision: 220802

URL: http://llvm.org/viewvc/llvm-project?rev=220802&view=rev
Log:
[Objective-C]. revert r220740,r220727


Modified:
    cfe/trunk/include/clang/Basic/DiagnosticGroups.td
    cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
    cfe/trunk/lib/Sema/SemaExprObjC.cpp
    cfe/trunk/test/SemaObjC/arc-cfbridge-warning.m

Modified: cfe/trunk/include/clang/Basic/DiagnosticGroups.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticGroups.td?rev=220802&r1=220801&r2=220802&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticGroups.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticGroups.td Tue Oct 28 12:26:21 2014
@@ -422,7 +422,6 @@ def : DiagGroup<"arc-abi">;
 def ARCUnsafeRetainedAssign : DiagGroup<"arc-unsafe-retained-assign">;
 def ARCRetainCycles : DiagGroup<"arc-retain-cycles">;
 def ARCNonPodMemAccess : DiagGroup<"arc-non-pod-memaccess">;
-def ARCBridgeCastRelease : DiagGroup<"arc-bridge-cast-release">;
 def AutomaticReferenceCounting : DiagGroup<"arc",
                                            [ARCUnsafeRetainedAssign,
                                             ARCRetainCycles,

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=220802&r1=220801&r2=220802&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Tue Oct 28 12:26:21 2014
@@ -4459,11 +4459,6 @@ def note_arc_retain_cycle_owner : Note<
 def warn_arc_object_memaccess : Warning<
   "%select{destination for|source of}0 this %1 call is a pointer to "
   "ownership-qualified type %2">, InGroup<ARCNonPodMemAccess>;
-  
-def warn_arc_consumed_object_released : Warning<
-  "__bridge cast of collection literal of type %1 to bridgeable "
-  "type %0 causes early release of the collection">,
-  InGroup<ARCBridgeCastRelease>, DefaultError;
 
 let CategoryName = "ARC and @properties" in {
 

Modified: cfe/trunk/lib/Sema/SemaExprObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprObjC.cpp?rev=220802&r1=220801&r2=220802&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExprObjC.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprObjC.cpp Tue Oct 28 12:26:21 2014
@@ -4075,22 +4075,11 @@ ExprResult Sema::BuildObjCBridgedCast(So
     // Okay: id -> CF
     CK = CK_BitCast;
     switch (Kind) {
-      case OBC_Bridge: {
-        const ImplicitCastExpr *implCE = dyn_cast<ImplicitCastExpr>(SubExpr);
-        while (implCE && implCE->getCastKind() ==  CK_BitCast)
-          implCE = dyn_cast<ImplicitCastExpr>(implCE->getSubExpr());
-        if (implCE && (implCE->getCastKind() == CK_ARCConsumeObject))
-          if (const Expr *LitExp = implCE->getSubExpr())
-            if ((isa<ObjCArrayLiteral>(LitExp) ||
-                 isa<ObjCDictionaryLiteral>(LitExp)) &&
-                T->isCARCBridgableType())
-              Diag(BridgeKeywordLoc, diag::warn_arc_consumed_object_released)
-                << T << implCE->getType();
-        // Reclaiming a value that's going to be __bridge-casted to CF
-        // is very dangerous, so we don't do it.
-        SubExpr = maybeUndoReclaimObject(SubExpr);
-        break;
-      }
+    case OBC_Bridge:
+      // Reclaiming a value that's going to be __bridge-casted to CF
+      // is very dangerous, so we don't do it.
+      SubExpr = maybeUndoReclaimObject(SubExpr);
+      break;
       
     case OBC_BridgeRetained:        
       // Produce the object before casting it.

Modified: cfe/trunk/test/SemaObjC/arc-cfbridge-warning.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/arc-cfbridge-warning.m?rev=220802&r1=220801&r2=220802&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/arc-cfbridge-warning.m (original)
+++ cfe/trunk/test/SemaObjC/arc-cfbridge-warning.m Tue Oct 28 12:26:21 2014
@@ -1,41 +0,0 @@
-// RUN: %clang_cc1 -fsyntax-only -x objective-c -fobjc-arc -verify -Wno-objc-root-class %s
-// rdar://18768214
-
-
- at class NSArray;
-typedef const struct __attribute__((objc_bridge(NSArray))) __CFArray * CFArrayRef;
- at class NSString;
-typedef const void * CFTypeRef;
-
-typedef const struct __attribute__((objc_bridge(NSString))) __CFString * CFStringRef;
-
-typedef long NSInteger;
-typedef unsigned long NSUInteger;
-
- at interface NSObject {
-    Class isa __attribute__((deprecated));
-}
-+ (void)initialize;
-- (instancetype)init;
-+ (instancetype)new;
-+ (instancetype)alloc;
-- (void)dealloc;
- at end
-
- at interface NSArray : NSObject
- at property (readonly) NSUInteger count;
-- (id)objectAtIndex:(NSUInteger)index;
-- (instancetype)init __attribute__((objc_designated_initializer));
-- (instancetype)initWithObjects:(const id [])objects count:(NSUInteger)cnt __attribute__((objc_designated_initializer));
-+ (instancetype)array;
-+ (instancetype)arrayWithObject:(id)anObject;
-+ (instancetype)arrayWithObjects:(const id [])objects count:(NSUInteger)cnt;
-+ (instancetype)arrayWithObjects:(id)firstObj, ... __attribute__((sentinel(0,1)));
- at end
-
-static CFStringRef _s;
-
-CFArrayRef _array()
-{
-    return (__bridge CFArrayRef)@[(__bridge NSString *)_s]; // expected-error {{__bridge cast of collection literal of type 'NSArray *' to bridgeable type 'CFArrayRef' (aka 'const struct __CFArray *') causes early release of the collection}}
-}





More information about the cfe-commits mailing list