brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1023 B · cd91f4c Raw
36 lines · cpp
1//  Test for debug info related to DW_AT_alignment attribute in the struct type.2// RUN: %clang_cc1 -dwarf-version=5 -debug-info-kind=standalone -emit-llvm %s -o - | FileCheck %s3 4// CHECK-DAG: DICompositeType(tag: DW_TAG_structure_type, name: "MyType", {{.*}}, align: 325// CHECK-DAG: DICompositeType(tag: DW_TAG_structure_type, name: "MyType1", {{.*}}, align: 86// CHECK-DAG: DICompositeType(tag: DW_TAG_structure_type, name: "MyType2", {{.*}}, align: 87 8struct MyType {9  int m;10} __attribute__((aligned(1)));11MyType mt;12 13static_assert(alignof(MyType) == 4, "alignof MyType is wrong");14 15struct MyType1 {16  int m;17} __attribute__((packed, aligned(1)));18MyType1 mt1;19 20static_assert(alignof(MyType1) == 1, "alignof MyType1 is wrong");21 22struct MyType2 {23  __attribute__((packed)) int m;24} __attribute__((aligned(1)));25MyType2 mt2;26 27static_assert(alignof(MyType2) == 1, "alignof MyType2 is wrong");28 29#pragma pack(1)30struct MyType3 {31  int m;32};33MyType3 mt3;34 35static_assert(alignof(MyType3) == 1, "alignof MyType3 is wrong");36