From 172039a89cf784f8d08bbbe68fa11b6ce251af36 Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Fri, 3 Feb 2012 01:30:34 +0000 Subject: [PATCH] Make error about using bridge casts in non-ARC mode a warning that is default mapped to an error. This is to ease the transition of large apps moving from non-ARC to ARC. llvm-svn: 149659 --- clang/include/clang/Basic/DiagnosticParseKinds.td | 6 ++++-- clang/test/SemaObjC/illegal-nonarc-bridged-cast.m | 7 +++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/clang/include/clang/Basic/DiagnosticParseKinds.td b/clang/include/clang/Basic/DiagnosticParseKinds.td index 047d6ce7dc12..73d7883fbe26 100644 --- a/clang/include/clang/Basic/DiagnosticParseKinds.td +++ b/clang/include/clang/Basic/DiagnosticParseKinds.td @@ -330,8 +330,10 @@ def err_illegal_super_cast : Error< let CategoryName = "ARC Parse Issue" in { def err_arc_bridge_retain : Error< "unknown cast annotation __bridge_retain; did you mean __bridge_retained?">; -def err_arc_bridge_cast_nonarc : Error< - "'%0' casts are only allowed when using ARC">; +def err_arc_bridge_cast_nonarc : Warning< + "'%0' casts are only allowed when using ARC">, + InGroup>, + DefaultError; } def err_objc_illegal_visibility_spec : Error< diff --git a/clang/test/SemaObjC/illegal-nonarc-bridged-cast.m b/clang/test/SemaObjC/illegal-nonarc-bridged-cast.m index b0d1e82475e6..fe6b24a63493 100644 --- a/clang/test/SemaObjC/illegal-nonarc-bridged-cast.m +++ b/clang/test/SemaObjC/illegal-nonarc-bridged-cast.m @@ -35,3 +35,10 @@ void fixits() { id obj1 = (id)CFCreateSomething(); CFTypeRef cf1 = (CFTypeRef)CreateSomething(); } + +#pragma clang diagnostic ignored "-Warc-bridge-casts-disallowed-in-nonarc" + +void to_cf_ignored(id obj) { + CFTypeRef cf1 = (__bridge_retained CFTypeRef)CreateSomething(); // no-warning + CFTypeRef cf3 = (__bridge CFTypeRef)CreateSomething(); // no-warning +}