[ELF] Make SyntheticSection parameter order match InputSection
[llvm-project.git] / clang / test / CodeGen / builtins-bpf-preserve-field-info-4.c
blob993f94f8aa6842c7c3f8d9166e447d78730fc55f
1 // REQUIRES: bpf-registered-target
2 // RUN: %clang_cc1 -triple bpf -emit-llvm -debug-info-kind=limited -disable-llvm-passes %s -o - | FileCheck %s
4 #define _(x, y) (__builtin_preserve_enum_value((x), (y)))
6 enum AA {
7 VAL0 = 0,
8 VAL1 = 2,
9 VAL2 = 0xffffffff80000000UL,
11 typedef enum { VAL00, VAL10 = -2, VAL11 = 0xffff8000, } __BB;
13 unsigned unit1() {
14 return _(*(enum AA *)VAL1, 0) + _(*(__BB *)VAL10, 1);
17 unsigned unit2() {
18 return _(*(enum AA *)VAL2, 0) + _(*(__BB *)VAL11, 1);
21 unsigned unit3() {
22 return _(*(enum AA *)VAL0, 0) + _(*(__BB *)VAL00, 1);
25 // CHECK: @0 = private unnamed_addr constant [7 x i8] c"VAL1:2\00", align 1
26 // CHECK: @1 = private unnamed_addr constant [9 x i8] c"VAL10:-2\00", align 1
27 // CHECK: @2 = private unnamed_addr constant [17 x i8] c"VAL2:-2147483648\00", align 1
28 // CHECK: @3 = private unnamed_addr constant [17 x i8] c"VAL11:4294934528\00", align 1
29 // CHECK: @4 = private unnamed_addr constant [7 x i8] c"VAL0:0\00", align 1
30 // CHECK: @5 = private unnamed_addr constant [8 x i8] c"VAL00:0\00", align 1
32 // CHECK: call i64 @llvm.bpf.preserve.enum.value(i32 0, ptr @0, i64 0), !dbg !{{[0-9]+}}, !llvm.preserve.access.index ![[ENUM_AA:[0-9]+]]
33 // CHECK: call i64 @llvm.bpf.preserve.enum.value(i32 1, ptr @1, i64 1), !dbg !{{[0-9]+}}, !llvm.preserve.access.index ![[TYPEDEF_ENUM:[0-9]+]]
35 // CHECK: call i64 @llvm.bpf.preserve.enum.value(i32 2, ptr @2, i64 0), !dbg !{{[0-9]+}}, !llvm.preserve.access.index ![[ENUM_AA]]
36 // CHECK: call i64 @llvm.bpf.preserve.enum.value(i32 3, ptr @3, i64 1), !dbg !{{[0-9]+}}, !llvm.preserve.access.index ![[TYPEDEF_ENUM]]
38 // CHECK: call i64 @llvm.bpf.preserve.enum.value(i32 4, ptr @4, i64 0), !dbg !{{[0-9]+}}, !llvm.preserve.access.index ![[ENUM_AA]]
39 // CHECK: call i64 @llvm.bpf.preserve.enum.value(i32 5, ptr @5, i64 1), !dbg !{{[0-9]+}}, !llvm.preserve.access.index ![[TYPEDEF_ENUM]]
41 // CHECK: ![[ENUM_AA]] = !DICompositeType(tag: DW_TAG_enumeration_type, name: "AA"
42 // CHECK: ![[TYPEDEF_ENUM]] = !DIDerivedType(tag: DW_TAG_typedef, name: "__BB"