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