[cfe-commits] r150868 - in /cfe/trunk: include/clang/Basic/DiagnosticParseKinds.td lib/Parse/ParseExpr.cpp test/SemaObjC/illegal-nonarc-bridged-cast.m

Ted Kremenek kremenek at apple.com
Fri Feb 17 20:42:39 PST 2012


Author: kremenek
Date: Fri Feb 17 22:42:38 2012
New Revision: 150868

URL: http://llvm.org/viewvc/llvm-project?rev=150868&view=rev
Log:
Change wording of warning about using __bridge casts in non-ARC.

Modified:
    cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
    cfe/trunk/lib/Parse/ParseExpr.cpp
    cfe/trunk/test/SemaObjC/illegal-nonarc-bridged-cast.m

Modified: cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td?rev=150868&r1=150867&r2=150868&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td Fri Feb 17 22:42:38 2012
@@ -330,8 +330,8 @@
 def err_arc_bridge_retain : Error<
   "unknown cast annotation __bridge_retain; did you mean __bridge_retained?">;
 // To be default mapped to an error later.
-def err_arc_bridge_cast_nonarc : Warning<
-  "'%0' casts are only allowed when using ARC">,
+def warn_arc_bridge_cast_nonarc : Warning<
+  "'%0' casts have no effect when not using ARC">,
   InGroup<DiagGroup<"arc-bridge-casts-disallowed-in-nonarc">>;
 }
   

Modified: cfe/trunk/lib/Parse/ParseExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseExpr.cpp?rev=150868&r1=150867&r2=150868&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseExpr.cpp (original)
+++ cfe/trunk/lib/Parse/ParseExpr.cpp Fri Feb 17 22:42:38 2012
@@ -1866,7 +1866,7 @@
     StringRef BridgeCastName = Tok.getName();
     SourceLocation BridgeKeywordLoc = ConsumeToken();
     if (!PP.getSourceManager().isInSystemHeader(BridgeKeywordLoc))
-      Diag(BridgeKeywordLoc, diag::err_arc_bridge_cast_nonarc)
+      Diag(BridgeKeywordLoc, diag::warn_arc_bridge_cast_nonarc)
         << BridgeCastName
         << FixItHint::CreateReplacement(BridgeKeywordLoc, "");
     BridgeCast = false;

Modified: cfe/trunk/test/SemaObjC/illegal-nonarc-bridged-cast.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/illegal-nonarc-bridged-cast.m?rev=150868&r1=150867&r2=150868&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/illegal-nonarc-bridged-cast.m (original)
+++ cfe/trunk/test/SemaObjC/illegal-nonarc-bridged-cast.m Fri Feb 17 22:42:38 2012
@@ -16,19 +16,19 @@
 NSString *CreateNSString();
 
 void from_cf() {
-  id obj1 = (__bridge_transfer id)CFCreateSomething(); // expected-warning {{'__bridge_transfer' casts are only allowed when using ARC}}
-  id obj2 = (__bridge_transfer NSString*)CFCreateString(); // expected-warning {{'__bridge_transfer' casts are only allowed when using ARC}}
-  (__bridge int*)CFCreateSomething();  // expected-warning {{'__bridge' casts are only allowed when using ARC}}  \
+  id obj1 = (__bridge_transfer id)CFCreateSomething(); // expected-warning {{'__bridge_transfer' casts have no effect when not using ARC}}
+  id obj2 = (__bridge_transfer NSString*)CFCreateString(); // expected-warning {{'__bridge_transfer' casts have no effect when not using ARC}}
+  (__bridge int*)CFCreateSomething();  // expected-warning {{'__bridge' casts have no effect when not using ARC}}  \
                                        // expected-warning {{expression result unused}}
-  id obj3 = (__bridge id)CFGetSomething(); // expected-warning {{'__bridge' casts are only allowed when using ARC}}
-  id obj4 = (__bridge NSString*)CFGetString(); // expected-warning {{'__bridge' casts are only allowed when using ARC}}
+  id obj3 = (__bridge id)CFGetSomething(); // expected-warning {{'__bridge' casts have no effect when not using ARC}}
+  id obj4 = (__bridge NSString*)CFGetString(); // expected-warning {{'__bridge' casts have no effect when not using ARC}}
 }
 
 void to_cf(id obj) {
-  CFTypeRef cf1 = (__bridge_retained CFTypeRef)CreateSomething(); // expected-warning {{'__bridge_retained' casts are only allowed when using ARC}}
-  CFStringRef cf2 = (__bridge_retained CFStringRef)CreateNSString(); // expected-warning {{'__bridge_retained' casts are only allowed when using ARC}}
-  CFTypeRef cf3 = (__bridge CFTypeRef)CreateSomething(); // expected-warning {{'__bridge' casts are only allowed when using ARC}}
-  CFStringRef cf4 = (__bridge CFStringRef)CreateNSString(); // expected-warning {{'__bridge' casts are only allowed when using ARC}} 
+  CFTypeRef cf1 = (__bridge_retained CFTypeRef)CreateSomething(); // expected-warning {{'__bridge_retained' casts have no effect when not using ARC}}
+  CFStringRef cf2 = (__bridge_retained CFStringRef)CreateNSString(); // expected-warning {{'__bridge_retained' casts have no effect when not using ARC}}
+  CFTypeRef cf3 = (__bridge CFTypeRef)CreateSomething(); // expected-warning {{'__bridge' casts have no effect when not using ARC}}
+  CFStringRef cf4 = (__bridge CFStringRef)CreateNSString(); // expected-warning {{'__bridge' casts have no effect when not using ARC}} 
 }
 
 void fixits() {





More information about the cfe-commits mailing list