summaryrefslogtreecommitdiff
path: root/test/CodeGenObjCXX/arc-returns-inner-reference-ptr.mm
blob: fa9b4219f54a1c2e9bb4c1068c42d0f36e70477f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fobjc-arc -o - %s | FileCheck %s
// rdar://10139365

@interface Test58
- (char* &) interior __attribute__((objc_returns_inner_pointer));
- (int&)reference_to_interior_int __attribute__((objc_returns_inner_pointer));
@end

void foo() {
   Test58 *ptr;
   char *c = [(ptr) interior];

   int i = [(ptr) reference_to_interior_int];
}

// CHECK: [[T0:%.*]] = load {{%.*}} {{%.*}}, align 8
// CHECK: [[T1:%.*]] = bitcast {{%.*}} [[T0]] to i8*
// call i8* @llvm.objc.retainAutorelease(i8* [[T1]]) nounwind
// CHECK: [[T2:%.*]] = load {{%.*}} {{%.*}}, align 8
// CHECK: [[T3:%.*]] = bitcast {{%.*}} [[T2]] to i8*
// call i8* @llvm.objc.retainAutorelease(i8* [[T3]]) nounwind