r194664 - Revert r194663 and r194647.

Ted Kremenek kremenek at apple.com
Wed Nov 13 20:44:56 PST 2013


Author: kremenek
Date: Wed Nov 13 22:44:56 2013
New Revision: 194664

URL: http://llvm.org/viewvc/llvm-project?rev=194664&view=rev
Log:
Revert r194663 and r194647.

Per feedback from Jordan Rose I realized this wasn't the right way to go.

Modified:
    cfe/trunk/lib/Sema/SemaDecl.cpp
    cfe/trunk/test/SemaObjC/arc-bridged-cast.m

Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=194664&r1=194663&r2=194664&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Wed Nov 13 22:44:56 2013
@@ -1313,18 +1313,6 @@ static bool ShouldDiagnoseUnusedDecl(con
       }
     }
 
-    // Under ARC, some users use __bridge_transfer to automate memory
-    // reclamation of objects that were referenced via C pointers.
-    const Expr *Init = VD->getInit();
-    if (Init) {
-      if (const ExprWithCleanups *EC = dyn_cast<ExprWithCleanups>(Init))
-        Init = EC->getSubExpr();
-      Init = Init->IgnoreParens();
-      if (const ImplicitCastExpr *IC = dyn_cast<ImplicitCastExpr>(Init))
-        if (IC->getCastKind() == CK_ARCConsumeObject)
-          return false;
-    }
-
     // TODO: __attribute__((unused)) templates?
   }
   

Modified: cfe/trunk/test/SemaObjC/arc-bridged-cast.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/arc-bridged-cast.m?rev=194664&r1=194663&r2=194664&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/arc-bridged-cast.m (original)
+++ cfe/trunk/test/SemaObjC/arc-bridged-cast.m Wed Nov 13 22:44:56 2013
@@ -62,14 +62,3 @@ CFTypeRef fixitsWithSpace(id obj) {
   // CHECK: fix-it:"{{.*}}":{59:9-59:9}:"(__bridge CFTypeRef)"
   // CHECK: fix-it:"{{.*}}":{59:9-59:9}:" CFBridgingRetain"
 }
-
-// <rdar://problem/15432770>
-// Suppressed -Wunused-variable when the initializer is a __bridge_transfer cast.
-#pragma clang diagnostic push
-#pragma clang diagnostic warning "-Wunused-variable"
-void rdar15432770_ptr_release(const void *ptr) {
-  void (^block)() = (__bridge_transfer void(^)())ptr; // no-warning
-  // Test that warning is active.
-  int x = 1; // expected-warning {{unused}}
-}
-#pragma clang diagnostic pop





More information about the cfe-commits mailing list