44 lines · c
1// RUN: %clang_cc1 -Werror -triple i386-linux -Wno-strict-prototypes -emit-llvm -o - %s | FileCheck %s2 3// Test that different order of declarations is acceptable and that4// implementing different redeclarations is acceptable.5 6typedef union {7 int i;8 float f;9} TU __attribute__((transparent_union));10 11// CHECK-LABEL: define{{.*}} void @f0(i32 %tu.coerce)12// CHECK: %tu = alloca %union.TU, align 413// CHECK: %coerce.dive = getelementptr inbounds nuw %union.TU, ptr %tu, i32 0, i32 014// CHECK: store i32 %tu.coerce, ptr %coerce.dive, align 415void f0(TU tu) {}16void f0(int i);17 18// CHECK-LABEL: define{{.*}} void @f1(i32 noundef %tu.coerce)19// CHECK: %tu = alloca %union.TU, align 420// CHECK: %coerce.dive = getelementptr inbounds nuw %union.TU, ptr %tu, i32 0, i32 021// CHECK: store i32 %tu.coerce, ptr %coerce.dive, align 422void f1(int i);23void f1(TU tu) {}24 25// CHECK-LABEL: define{{.*}} void @f2(i32 noundef %i)26// CHECK: %i.addr = alloca i32, align 427// CHECK: store i32 %i, ptr %i.addr, align 428void f2(TU tu);29void f2(int i) {}30 31// CHECK-LABEL: define{{.*}} void @f3(i32 noundef %i)32// CHECK: %i.addr = alloca i32, align 433// CHECK: store i32 %i, ptr %i.addr, align 434void f3(int i) {}35void f3(TU tu);36 37// Also test functions with parameters specified K&R style.38// CHECK-LABEL: define{{.*}} void @knrStyle(i32 noundef %tu.coerce)39// CHECK: %tu = alloca %union.TU, align 440// CHECK: %coerce.dive = getelementptr inbounds nuw %union.TU, ptr %tu, i32 0, i32 041// CHECK: store i32 %tu.coerce, ptr %coerce.dive, align 442void knrStyle(int i);43void knrStyle(tu) TU tu; {}44