1// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fobjc-arc -o - %s | FileCheck %s
2// rdar://10139365
3
4@interface Test58
5- (char* &) interior __attribute__((objc_returns_inner_pointer));
6- (int&)reference_to_interior_int __attribute__((objc_returns_inner_pointer));
7@end
8
9void foo() {
10   Test58 *ptr;
11   char *c = [(ptr) interior];
12
13   int i = [(ptr) reference_to_interior_int];
14}
15
16// CHECK: [[T0:%.*]] = load {{%.*}} {{%.*}}, align 8
17// CHECK: [[T1:%.*]] = bitcast {{%.*}} [[T0]] to i8*
18// call i8* @llvm.objc.retainAutorelease(i8* [[T1]]) nounwind
19// CHECK: [[T2:%.*]] = load {{%.*}} {{%.*}}, align 8
20// CHECK: [[T3:%.*]] = bitcast {{%.*}} [[T2]] to i8*
21// call i8* @llvm.objc.retainAutorelease(i8* [[T3]]) nounwind
22
23