1 // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -fobjc-arc -x objective-c %s.result
2 // RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fsyntax-only -x objective-c %s > %t
3 // RUN: diff %t %s.result
7 typedef const struct __CFString * CFStringRef;
8 extern const CFStringRef kUTTypePlainText;
9 extern const CFStringRef kUTTypeRTF;
10 extern CFStringRef kNonConst;
12 typedef const struct __CFAllocator * CFAllocatorRef;
13 typedef const struct __CFUUID * CFUUIDRef;
15 extern const CFAllocatorRef kCFAllocatorDefault;
17 extern CFStringRef CFUUIDCreateString(CFAllocatorRef alloc, CFUUIDRef uuid);
20 CFStringRef sref_member;
23 @interface NSString : NSObject {
31 void f(BOOL b, id p) {
32 NSString *str = (NSString *)kUTTypePlainText; // no change
33 str = b ? kUTTypeRTF : kUTTypePlainText; // no change
34 str = (NSString *)(b ? kUTTypeRTF : kUTTypePlainText); // no change
35 str = (NSString *)p; // no change.
37 str = (NSString *)kNonConst;
38 str = b ? kUTTypeRTF : kNonConst;
39 str = (NSString *)(b ? kUTTypeRTF : kNonConst);
42 NSString *_uuidString = (NSString *)CFUUIDCreateString(kCFAllocatorDefault, _uuid);
43 _uuidString = [(NSString *)CFUUIDCreateString(kCFAllocatorDefault, _uuid) autorelease];
44 _uuidString = CFRetain(_uuid);
47 @implementation NSString (StrExt)
48 - (NSString *)stringEscapedAsURI {
49 CFStringRef str = (CFStringRef)self;
50 CFStringRef str2 = self;
55 @implementation NSString
60 return strS->sref_member;
62 -(id)newString { return 0; }
65 extern void consumeParam(CFStringRef CF_CONSUMED p);
67 void f2(NSString *s) {
68 CFStringRef ref = [s string];
69 ref = (CFStringRef)[s string];
73 ref = (CFStringRef)[NSString new];
74 ref = [[NSString alloc] init];
75 ref = [[s string] retain];
76 ref = CFRetain((CFStringRef)[s string]);
77 ref = CFRetain([s string]);
81 consumeParam((CFStringRef)s);