From 4ae7d04eaf4a734896673a1cff56b703c7db318e Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Thu, 14 Nov 2013 04:44:56 +0000 Subject: [PATCH] Revert r194663 and r194647. Per feedback from Jordan Rose I realized this wasn't the right way to go. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194664 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Sema/SemaDecl.cpp | 12 ------------ test/SemaObjC/arc-bridged-cast.m | 11 ----------- 2 files changed, 23 deletions(-) diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index 9c6f8f6740..d5ba089f73 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -1313,18 +1313,6 @@ static bool ShouldDiagnoseUnusedDecl(const NamedDecl *D) { } } - // 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(Init)) - Init = EC->getSubExpr(); - Init = Init->IgnoreParens(); - if (const ImplicitCastExpr *IC = dyn_cast(Init)) - if (IC->getCastKind() == CK_ARCConsumeObject) - return false; - } - // TODO: __attribute__((unused)) templates? } diff --git a/test/SemaObjC/arc-bridged-cast.m b/test/SemaObjC/arc-bridged-cast.m index 3707b9ec8a..439d382116 100644 --- a/test/SemaObjC/arc-bridged-cast.m +++ b/test/SemaObjC/arc-bridged-cast.m @@ -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" } - -// -// 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 -- 2.40.0