diff options
author | Zancanaro; Carlo <czan8762@plang3.cs.usyd.edu.au> | 2012-09-24 09:58:17 +1000 |
---|---|---|
committer | Zancanaro; Carlo <czan8762@plang3.cs.usyd.edu.au> | 2012-09-24 09:58:17 +1000 |
commit | 222e2a7620e6520ffaf4fc4e69d79c18da31542e (patch) | |
tree | 7bfbc05bfa3b41c8f9d2e56d53a0bc3e310df239 /clang/test/ARCMT/nonobjc-to-objc-cast.m.result | |
parent | 3d206f03985b50beacae843d880bccdc91a9f424 (diff) |
Add the clang library to the repo (with some of my changes, too).
Diffstat (limited to 'clang/test/ARCMT/nonobjc-to-objc-cast.m.result')
-rw-r--r-- | clang/test/ARCMT/nonobjc-to-objc-cast.m.result | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/clang/test/ARCMT/nonobjc-to-objc-cast.m.result b/clang/test/ARCMT/nonobjc-to-objc-cast.m.result new file mode 100644 index 0000000..b50a948 --- /dev/null +++ b/clang/test/ARCMT/nonobjc-to-objc-cast.m.result @@ -0,0 +1,62 @@ +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -fobjc-arc -x objective-c %s.result +// RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fsyntax-only -x objective-c %s > %t +// RUN: diff %t %s.result +// DISABLE: mingw32 + +#include "Common.h" + +@interface NSString : NSObject +-(id)string; +-(id)newString; +@end + +typedef const struct __CFString * CFStringRef; +extern const CFStringRef kUTTypePlainText; +extern const CFStringRef kUTTypeRTF; + +typedef const struct __CFAllocator * CFAllocatorRef; +typedef const struct __CFUUID * CFUUIDRef; + +extern const CFAllocatorRef kCFAllocatorDefault; + +extern CFStringRef CFUUIDCreateString(CFAllocatorRef alloc, CFUUIDRef uuid); + +void f(BOOL b, id p) { + NSString *str = (__bridge NSString *)kUTTypePlainText; + str = (__bridge NSString *)(b ? kUTTypeRTF : kUTTypePlainText); + str = (__bridge NSString *)(b ? kUTTypeRTF : kUTTypePlainText); + str = (NSString *)p; // no change. + + CFUUIDRef _uuid; + NSString *_uuidString = (__bridge_transfer NSString *)CFUUIDCreateString(kCFAllocatorDefault, _uuid); + _uuidString = (__bridge_transfer NSString *)CFUUIDCreateString(kCFAllocatorDefault, _uuid); + _uuidString = (__bridge_transfer NSString *)(CFRetain(_uuid)); +} + +@implementation NSString (StrExt) +- (NSString *)stringEscapedAsURI { + CFStringRef str = (__bridge CFStringRef)self; + CFStringRef str2 = (__bridge CFStringRef)(self); + return self; +} +@end + +extern void consumeParam(CFStringRef CF_CONSUMED p); + +void f2(NSString *s) { + CFStringRef ref = (__bridge CFStringRef)([s string]); + ref = (__bridge CFStringRef)[s string]; + ref = (__bridge CFStringRef)(s.string); + ref = (__bridge_retained CFStringRef)([NSString new]); + ref = (__bridge_retained CFStringRef)([s newString]); + ref = (__bridge_retained CFStringRef)[NSString new]; + ref = (__bridge_retained CFStringRef)([[NSString alloc] init]); + ref = (__bridge_retained CFStringRef)([s string]); + ref = (__bridge_retained CFStringRef)[s string]; + ref = (__bridge_retained CFTypeRef)([s string]); + ref = (__bridge_retained CFTypeRef)(s); + ref = (__bridge_retained CFStringRef)(s); + + consumeParam((__bridge_retained CFStringRef)s); + consumeParam((__bridge_retained CFStringRef)(s)); +} |