[LLVM][IR] Use splat syntax when printing ConstantExpr based splats. (#116856)
[llvm-project.git] / clang / test / CodeGen / init-randomized-struct-fwd-decl.c
blobfcfeb6ae8c31346e2d56d6d8e79365ce30ff97be
1 // RUN: %clang_cc1 -triple=x86_64-unknown-linux -emit-llvm -frandomize-layout-seed=1234567890abcdef < %s | FileCheck %s
2 // PR60349
4 // Clang will add a forward declaration of "struct bar" and "enum qux" to the
5 // structures. This shouldn't prevent these structures from being randomized.
6 // So the 'f' element shouldn't be at the start of the structure anymore.
8 struct foo {
9 struct bar *(*f)(void);
10 struct bar *(*g)(void);
11 struct bar *(*h)(void);
12 struct bar *(*i)(void);
13 struct bar *(*j)(void);
14 struct bar *(*k)(void);
17 // CHECK-LABEL: define {{.*}}@t1(
18 // CHECK-NOT: getelementptr inbounds %struct.foo, ptr %3, i32 0, i32 0
19 struct bar *t1(struct foo *z) {
20 return z->f();
23 struct baz {
24 enum qux *(*f)(void);
25 enum qux *(*g)(void);
26 enum qux *(*h)(void);
27 enum qux *(*i)(void);
28 enum qux *(*j)(void);
29 enum qux *(*k)(void);
32 // CHECK-LABEL: define {{.*}}@t2(
33 // CHECK-NOT: getelementptr inbounds %struct.baz, ptr %3, i32 0, i32 0
34 enum qux *t2(struct baz *z) {
35 return z->f();