1 // RUN: %clang_cc1 %s -std=c++11 -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s
2 
3 // For a reference to a complete type, output the dereferenceable attribute (in
4 // any address space).
5 
6 typedef int a __attribute__((address_space(1)));
7 
8 a & foo(a &x, a & y) {
9   return x;
10 }
11 
12 // CHECK: define dereferenceable(4) i32 addrspace(1)* @_Z3fooRU3AS1iS0_(i32 addrspace(1)* dereferenceable(4) %x, i32 addrspace(1)* dereferenceable(4) %y)
13 
14 // For a reference to an incomplete type in an alternate address space, output
15 // neither dereferenceable nor nonnull.
16 
17 class bc;
18 typedef bc b __attribute__((address_space(1)));
19 
20 b & bar(b &x, b & y) {
21   return x;
22 }
23 
24 // CHECK: define %class.bc addrspace(1)* @_Z3barRU3AS12bcS1_(%class.bc addrspace(1)* %x, %class.bc addrspace(1)* %y)
25 
26 // For a reference to an incomplete type in addrspace(0), output nonnull.
27 
28 bc & bar2(bc &x, bc & y) {
29   return x;
30 }
31 
32 // CHECK: define nonnull %class.bc* @_Z4bar2R2bcS0_(%class.bc* nonnull %x, %class.bc* nonnull %y)
33 
34 
35