]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/CodeGenObjC/arc-unbridged-cast.m
Vendor import of clang release_30 branch r142614:
[FreeBSD/FreeBSD.git] / test / CodeGenObjC / arc-unbridged-cast.m
1 // RUN: %clang_cc1 -triple x86_64-apple-darwin11 -emit-llvm  -fobjc-arc -o - %s | FileCheck %s
2 // rdar://9744349
3
4 typedef const struct __CFString * CFStringRef;
5
6 @interface I 
7 @property CFStringRef P;
8 - (CFStringRef) CFMeth __attribute__((cf_returns_retained));
9 - (CFStringRef) newSomething;
10 - (CFStringRef) P __attribute__((cf_returns_retained));
11 @end
12
13 @implementation I
14 @synthesize P;
15 - (id) Meth {
16     I* p1 = (id)[p1 P];
17     id p2 = (id)[p1 CFMeth];
18     id p3 = (id)[p1 newSomething];
19     return (id) p1.P;
20 }
21 - (CFStringRef) CFMeth { return 0; }
22 - (CFStringRef) newSomething { return 0; }
23 - (CFStringRef) P { return 0; }
24 - (void) setP : (CFStringRef)arg {}
25 @end
26
27 // rdar://9544832
28 CFStringRef SomeOtherFunc() __attribute__((cf_returns_retained));
29 id MMM()
30 {
31   id obj = (id)((CFStringRef) __builtin___CFStringMakeConstantString ("" "Some CF String" ""));
32   return 0;
33 }
34
35 // CHECK-NOT: call i8* @objc_retainAutoreleasedReturnValue