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