xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGen/transparent-union.c (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -Werror -triple x86_64-linux -emit-llvm -o - %s | FileCheck %s
2*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -Werror -triple i386-linux -emit-llvm -o - %s | FileCheck %s
3*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -Werror -triple armv7-linux -emit-llvm -o - %s | FileCheck %s --check-prefix=ARM
4*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -Werror -triple powerpc64le-linux -emit-llvm -o - %s | FileCheck %s
5*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -Werror -triple aarch64-linux -emit-llvm -o - %s | FileCheck %s
6f4a2713aSLionel Sambuc 
7f4a2713aSLionel Sambuc typedef union {
8f4a2713aSLionel Sambuc   void *f0;
9f4a2713aSLionel Sambuc } transp_t0 __attribute__((transparent_union));
10f4a2713aSLionel Sambuc 
11f4a2713aSLionel Sambuc void f0(transp_t0 obj);
12f4a2713aSLionel Sambuc 
13f4a2713aSLionel Sambuc // CHECK-LABEL: define void @f1_0(i32* %a0)
14*0a6a1f1dSLionel Sambuc // CHECK:  call void @f0(i8* %{{.*}})
15f4a2713aSLionel Sambuc // CHECK:  call void %{{.*}}(i8* %{{[a-z0-9]*}})
16f4a2713aSLionel Sambuc // CHECK: }
17*0a6a1f1dSLionel Sambuc 
18*0a6a1f1dSLionel Sambuc // ARM-LABEL: define arm_aapcscc void @f1_0(i32* %a0)
19*0a6a1f1dSLionel Sambuc // ARM:  call arm_aapcscc void @f0(i8* %{{.*}})
20*0a6a1f1dSLionel Sambuc // ARM:  call arm_aapcscc void %{{.*}}(i8* %{{[a-z0-9]*}})
21*0a6a1f1dSLionel Sambuc // ARM: }
f1_0(int * a0)22f4a2713aSLionel Sambuc void f1_0(int *a0) {
23f4a2713aSLionel Sambuc   void (*f0p)(void *) = f0;
24f4a2713aSLionel Sambuc   f0(a0);
25f4a2713aSLionel Sambuc   f0p(a0);
26f4a2713aSLionel Sambuc }
27f4a2713aSLionel Sambuc 
f1_1(int * a0)28f4a2713aSLionel Sambuc void f1_1(int *a0) {
29f4a2713aSLionel Sambuc   f0((transp_t0) { a0 });
30f4a2713aSLionel Sambuc }
31