aboutsummaryrefslogtreecommitdiff
path: root/test/ARCMT
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2012-07-26 23:17:04 +0000
committerFariborz Jahanian <fjahanian@apple.com>2012-07-26 23:17:04 +0000
commit304efd5962eaca7179f43846fff1880a5e5e873c (patch)
treef037665749ebe2304331eb086f2e227e832a7f5f /test/ARCMT
parent61b135a20b9e0ee7c4fe7ce4fdbc1815c5ff66ff (diff)
objc-arc: When objects with known CF semantics are assigned to
retainable types in arc, only suggest CFBridgingRelease/ CFBridgingRetain and not the confusing __bridge casts. // rdar://11923822 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160839 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/ARCMT')
-rw-r--r--test/ARCMT/checking.m5
-rw-r--r--test/ARCMT/no-canceling-bridge-to-bridge-cast.m3
-rw-r--r--test/ARCMT/nonobjc-to-objc-cast-2.m5
3 files changed, 3 insertions, 10 deletions
diff --git a/test/ARCMT/checking.m b/test/ARCMT/checking.m
index 3ad911e10a..9d2d15053a 100644
--- a/test/ARCMT/checking.m
+++ b/test/ARCMT/checking.m
@@ -101,7 +101,6 @@ void test1(A *a, BOOL b, struct UnsafeS *unsafeS) {
CFStringRef cfstr;
NSString *str = (NSString *)cfstr; // expected-error {{cast of C pointer type 'CFStringRef' (aka 'const struct __CFString *') to Objective-C pointer type 'NSString *' requires a bridged cast}} \
- // expected-note {{use __bridge to convert directly (no change in ownership)}} \
// expected-note {{use CFBridgingRelease call to transfer ownership of a +1 'CFStringRef' (aka 'const struct __CFString *') into ARC}} \
str = (NSString *)kUTTypePlainText;
str = b ? kUTTypeRTF : kUTTypePlainText;
@@ -160,10 +159,10 @@ void * cvt(id arg)
(void)(void*)voidp_val;
(void)(void**)arg; // expected-error {{disallowed}}
cvt((void*)arg); // expected-error 2 {{requires a bridged cast}} \
- // expected-note 2 {{use __bridge to}} expected-note {{use CFBridgingRelease call}} expected-note {{use CFBridgingRetain call}}
+ expected-note {{use CFBridgingRelease call}} expected-note {{use CFBridgingRetain call}}
cvt(0);
(void)(__strong id**)(0);
- return arg; // expected-error {{requires a bridged cast}} expected-note {{use __bridge}} expected-note {{use CFBridgingRetain call}}
+ return arg; // expected-error {{requires a bridged cast}} expected-note {{use CFBridgingRetain call}}
}
diff --git a/test/ARCMT/no-canceling-bridge-to-bridge-cast.m b/test/ARCMT/no-canceling-bridge-to-bridge-cast.m
index 81841fbf1e..a573b9bbc9 100644
--- a/test/ARCMT/no-canceling-bridge-to-bridge-cast.m
+++ b/test/ARCMT/no-canceling-bridge-to-bridge-cast.m
@@ -24,15 +24,12 @@ CFTypeRef CFRetain(CFTypeRef cf);
NSString *result;
result = (id) CFRetain([NSString stringWithFormat:@"PBXLoopMode"]); // expected-error {{cast of C pointer type 'CFTypeRef' (aka 'const void *') to Objective-C pointer type 'id' requires a bridged cast}} \
- // expected-note {{use __bridge to convert directly (no change in ownership)}} \
// expected-note {{use CFBridgingRelease call to transfer ownership of a +1 'CFTypeRef' (aka 'const void *') into ARC}}
result = (id) CFRetain((id)((objc_format))); // expected-error {{cast of C pointer type 'CFTypeRef' (aka 'const void *') to Objective-C pointer type 'id' requires a bridged cast}} \
- // expected-note {{use __bridge to convert directly (no change in ownership)}} \
// expected-note {{use CFBridgingRelease call to transfer ownership of a +1 'CFTypeRef' (aka 'const void *') into ARC}}
result = (id) CFRetain((id)((cf_format))); // expected-error {{cast of C pointer type 'CFTypeRef' (aka 'const void *') to Objective-C pointer type 'id' requires a bridged cast}} \
- // expected-note {{use __bridge to convert directly (no change in ownership)}} \
// expected-note {{use CFBridgingRelease call to transfer ownership of a +1 'CFTypeRef' (aka 'const void *') into ARC}}
result = (id) CFRetain((CFTypeRef)((objc_format)));
diff --git a/test/ARCMT/nonobjc-to-objc-cast-2.m b/test/ARCMT/nonobjc-to-objc-cast-2.m
index 80d694e586..b709afd234 100644
--- a/test/ARCMT/nonobjc-to-objc-cast-2.m
+++ b/test/ARCMT/nonobjc-to-objc-cast-2.m
@@ -29,7 +29,6 @@ struct StrS {
}
-(id)newString {
return sref; // expected-error {{implicit conversion of C pointer type 'CFStringRef' (aka 'const struct __CFString *') to Objective-C pointer type 'id' requires a bridged cast}} \
- // expected-note{{use __bridge to convert directly (no change in ownership)}} \
// expected-note{{use CFBridgingRelease call to transfer ownership of a +1 'CFStringRef' (aka 'const struct __CFString *') into ARC}}
}
@end
@@ -37,16 +36,14 @@ struct StrS {
void f(BOOL b) {
CFStringRef cfstr;
NSString *str = (NSString *)cfstr; // expected-error {{cast of C pointer type 'CFStringRef' (aka 'const struct __CFString *') to Objective-C pointer type 'NSString *' requires a bridged cast}} \
- // expected-note{{use __bridge to convert directly (no change in ownership)}} \
// expected-note{{use CFBridgingRelease call to transfer ownership of a +1 'CFStringRef' (aka 'const struct __CFString *') into ARC}}
- void *vp = str; // expected-error {{requires a bridged cast}} expected-note {{use CFBridgingRetain call}} expected-note {{use __bridge}}
+ void *vp = str; // expected-error {{requires a bridged cast}} expected-note {{use CFBridgingRetain call}}
}
void f2(NSString *s) {
CFStringRef ref;
ref = [(CFStringRef)[s string] retain]; // expected-error {{cast of Objective-C pointer type 'id' to C pointer type 'CFStringRef' (aka 'const struct __CFString *') requires a bridged cast}} \
// expected-error {{bad receiver type 'CFStringRef' (aka 'const struct __CFString *')}} \
- // expected-note{{use __bridge to convert directly (no change in ownership)}} \
// expected-note{{use CFBridgingRetain call to make an ARC object available as a +1 'CFStringRef' (aka 'const struct __CFString *')}}
}