transparent-union.c revision 41e11a9315f7041c93e409f5d372013204e7cd04
141e11a9315f7041c93e409f5d372013204e7cd04Daniel Dunbar// RUN: %clang_cc1 -triple i386-unknown-unknown -emit-llvm -o %t %s 241e11a9315f7041c93e409f5d372013204e7cd04Daniel Dunbar// RUN: FileCheck < %t %s 341e11a9315f7041c93e409f5d372013204e7cd04Daniel Dunbar// 441e11a9315f7041c93e409f5d372013204e7cd04Daniel Dunbar// FIXME: Note that we don't currently get the ABI right here. f0() should be 541e11a9315f7041c93e409f5d372013204e7cd04Daniel Dunbar// f0(i8*). 641e11a9315f7041c93e409f5d372013204e7cd04Daniel Dunbar 741e11a9315f7041c93e409f5d372013204e7cd04Daniel Dunbartypedef union { 841e11a9315f7041c93e409f5d372013204e7cd04Daniel Dunbar void *f0; 941e11a9315f7041c93e409f5d372013204e7cd04Daniel Dunbar} transp_t0 __attribute__((transparent_union)); 1041e11a9315f7041c93e409f5d372013204e7cd04Daniel Dunbar 1141e11a9315f7041c93e409f5d372013204e7cd04Daniel Dunbarvoid f0(transp_t0 obj); 1241e11a9315f7041c93e409f5d372013204e7cd04Daniel Dunbar 1341e11a9315f7041c93e409f5d372013204e7cd04Daniel Dunbar// CHECK: define void @f1_0(i32* %a0) 1441e11a9315f7041c93e409f5d372013204e7cd04Daniel Dunbar// CHECK: call void @f0(%union.anon* byval %{{.*}}) 1541e11a9315f7041c93e409f5d372013204e7cd04Daniel Dunbar// CHECK: } 1641e11a9315f7041c93e409f5d372013204e7cd04Daniel Dunbarvoid f1_0(int *a0) { 1741e11a9315f7041c93e409f5d372013204e7cd04Daniel Dunbar f0(a0); 1841e11a9315f7041c93e409f5d372013204e7cd04Daniel Dunbar} 1941e11a9315f7041c93e409f5d372013204e7cd04Daniel Dunbar 2041e11a9315f7041c93e409f5d372013204e7cd04Daniel Dunbarvoid f1_1(int *a0) { 2141e11a9315f7041c93e409f5d372013204e7cd04Daniel Dunbar f0((transp_t0) { a0 }); 2241e11a9315f7041c93e409f5d372013204e7cd04Daniel Dunbar} 23