John McCall | 8f0e8d2 | 2011-06-15 23:25:17 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -fobjc-arc -x objective-c %s.result |
Argyrios Kyrtzidis | eaed19e | 2011-06-16 00:53:46 +0000 | [diff] [blame] | 2 | // RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -x objective-c %s > %t |
John McCall | 8f0e8d2 | 2011-06-15 23:25:17 +0000 | [diff] [blame] | 3 | // RUN: diff %t %s.result |
| 4 | |
| 5 | #include "Common.h" |
| 6 | |
| 7 | @interface NSString : NSObject |
| 8 | @end |
| 9 | |
| 10 | typedef const struct __CFString * CFStringRef; |
| 11 | extern const CFStringRef kUTTypePlainText; |
| 12 | extern const CFStringRef kUTTypeRTF; |
| 13 | |
| 14 | typedef const struct __CFAllocator * CFAllocatorRef; |
| 15 | typedef const struct __CFUUID * CFUUIDRef; |
| 16 | |
| 17 | extern const CFAllocatorRef kCFAllocatorDefault; |
| 18 | |
| 19 | extern CFStringRef CFUUIDCreateString(CFAllocatorRef alloc, CFUUIDRef uuid); |
| 20 | |
| 21 | void f(BOOL b, id p) { |
| 22 | NSString *str = (__bridge NSString *)kUTTypePlainText; |
| 23 | str = (__bridge NSString *)(b ? kUTTypeRTF : kUTTypePlainText); |
| 24 | str = (__bridge NSString *)(b ? kUTTypeRTF : kUTTypePlainText); |
| 25 | str = (NSString *)p; // no change. |
| 26 | |
John McCall | 8f0e8d2 | 2011-06-15 23:25:17 +0000 | [diff] [blame] | 27 | CFUUIDRef _uuid; |
| 28 | NSString *_uuidString = (__bridge_transfer NSString *)CFUUIDCreateString(kCFAllocatorDefault, _uuid); |
| 29 | _uuidString = (__bridge_transfer NSString *)CFUUIDCreateString(kCFAllocatorDefault, _uuid); |
| 30 | } |
Argyrios Kyrtzidis | 8e2ce7f | 2011-06-20 23:39:20 +0000 | [diff] [blame] | 31 | |
| 32 | @implementation NSString (StrExt) |
| 33 | - (NSString *)stringEscapedAsURI { |
| 34 | CFStringRef str = (__bridge CFStringRef)self; |
| 35 | CFStringRef str2 = (__bridge CFStringRef)(self); |
| 36 | return self; |
| 37 | } |
| 38 | @end |