diff options
| author | Fariborz Jahanian <fjahanian@apple.com> | 2012-02-01 22:56:20 +0000 |
|---|---|---|
| committer | Fariborz Jahanian <fjahanian@apple.com> | 2012-02-01 22:56:20 +0000 |
| commit | 30febeb224e0f76ed225e4b1c05e0970b113f1b6 (patch) | |
| tree | b7b2ba53459db212754a3842a0331f2e3315ad57 /clang/test/ARCMT | |
| parent | 3441597f84e8c025eff4c65c3f82c1c0ffa3f764 (diff) | |
| download | bcm5719-llvm-30febeb224e0f76ed225e4b1c05e0970b113f1b6.tar.gz bcm5719-llvm-30febeb224e0f76ed225e4b1c05e0970b113f1b6.zip | |
Look for declaration of CFBridgingRetain/CFBridgingRetain before
changing the diagnostic. Also use correct spelling for both.
llvm-svn: 149554
Diffstat (limited to 'clang/test/ARCMT')
| -rw-r--r-- | clang/test/ARCMT/checking.m | 10 | ||||
| -rw-r--r-- | clang/test/ARCMT/no-canceling-bridge-to-bridge-cast.m | 8 | ||||
| -rw-r--r-- | clang/test/ARCMT/nonobjc-to-objc-cast-2.m | 9 |
3 files changed, 18 insertions, 9 deletions
diff --git a/clang/test/ARCMT/checking.m b/clang/test/ARCMT/checking.m index c9b4bf13c89..0682fd1dde3 100644 --- a/clang/test/ARCMT/checking.m +++ b/clang/test/ARCMT/checking.m @@ -7,6 +7,10 @@ #define NS_AUTOMATED_REFCOUNT_UNAVAILABLE #endif +typedef const void * CFTypeRef; +CFTypeRef CFBridgingRetain(id X); +id CFBridgingRelease(CFTypeRef); + typedef int BOOL; typedef unsigned NSUInteger; @@ -95,7 +99,7 @@ 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 CFBridgeRelease call to transfer ownership of a +1 'CFStringRef' (aka 'const struct __CFString *') into ARC}} \ + // 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; str = (NSString *)(b ? kUTTypeRTF : kUTTypePlainText); @@ -153,10 +157,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 CFBridgeRelease call}} expected-note {{use CFBridgeRetain call}} + // expected-note 2 {{use __bridge to}} 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 CFBridgeRetain call}} + return arg; // expected-error {{requires a bridged cast}} expected-note {{use __bridge}} expected-note {{use CFBridgingRetain call}} } diff --git a/clang/test/ARCMT/no-canceling-bridge-to-bridge-cast.m b/clang/test/ARCMT/no-canceling-bridge-to-bridge-cast.m index fefa3aea635..81841fbf1e8 100644 --- a/clang/test/ARCMT/no-canceling-bridge-to-bridge-cast.m +++ b/clang/test/ARCMT/no-canceling-bridge-to-bridge-cast.m @@ -2,6 +2,8 @@ // DISABLE: mingw32 // rdar://10387088 typedef const void * CFTypeRef; +CFTypeRef CFBridgingRetain(id X); +id CFBridgingRelease(CFTypeRef); extern CFTypeRef CFRetain(CFTypeRef cf); @@ -23,15 +25,15 @@ CFTypeRef CFRetain(CFTypeRef cf); 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 CFBridgeRelease call to transfer ownership of a +1 'CFTypeRef' (aka 'const void *') into ARC}} + // 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 CFBridgeRelease call to transfer ownership of a +1 'CFTypeRef' (aka 'const void *') into ARC}} + // 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 CFBridgeRelease call to transfer ownership of a +1 'CFTypeRef' (aka 'const void *') into ARC}} + // 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/clang/test/ARCMT/nonobjc-to-objc-cast-2.m b/clang/test/ARCMT/nonobjc-to-objc-cast-2.m index 52d635b531b..1ec0089f08e 100644 --- a/clang/test/ARCMT/nonobjc-to-objc-cast-2.m +++ b/clang/test/ARCMT/nonobjc-to-objc-cast-2.m @@ -9,13 +9,16 @@ @end typedef const struct __CFString * CFStringRef; +typedef const void * CFTypeRef; +CFTypeRef CFBridgingRetain(id X); +id CFBridgingRelease(CFTypeRef); 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 CFBridgeRelease 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 CFBridgeRetain call}} expected-note {{use __bridge}} + // 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 f2(NSString *s) { @@ -23,7 +26,7 @@ void f2(NSString *s) { 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 CFBridgeRetain call to make an ARC object available as a +1 'CFStringRef' (aka 'const struct __CFString *')}} + // expected-note{{use CFBridgingRetain call to make an ARC object available as a +1 'CFStringRef' (aka 'const struct __CFString *')}} } CFStringRef f3() { |

