[RISCV][NFC] Remove Redundant Inline Asm Logic (#124202)
[llvm-project.git] / lldb / test / Shell / SymbolFile / DWARF / packed.cpp
blob6a794a012a6e53c85d09b2b8e457f2fc1c5f9db1
1 // XFAIL: target-windows
2 // RUN: %clangxx_host -gdwarf -o %t %s
3 // RUN: %lldb %t \
4 // RUN: -o "expr alignof(packed)" \
5 // RUN: -o "expr sizeof(packed)" \
6 // RUN: -o "expr alignof(packed_and_aligned)" \
7 // RUN: -o "expr sizeof(packed_and_aligned)" \
8 // RUN: -o "expr alignof(derived)" \
9 // RUN: -o "expr sizeof(derived)" \
10 // RUN: -o exit | FileCheck %s
12 struct __attribute__((packed)) packed {
13 int x;
14 char y;
15 int z;
16 } g_packed_struct;
17 static_assert(alignof(packed) == 1);
18 static_assert(sizeof(packed) == 9);
20 // CHECK: (lldb) expr alignof(packed)
21 // CHECK-NEXT: ${{.*}} = 1
22 // CHECK: (lldb) expr sizeof(packed)
23 // CHECK-NEXT: ${{.*}} = 9
25 struct __attribute__((packed, aligned(16))) packed_and_aligned {
26 int x;
27 char y;
28 int z;
29 } g_packed_and_aligned_struct;
30 static_assert(alignof(packed_and_aligned) == 16);
31 static_assert(sizeof(packed_and_aligned) == 16);
33 // CHECK: (lldb) expr alignof(packed_and_aligned)
34 // CHECK-NEXT: ${{.*}} = 16
35 // CHECK: (lldb) expr sizeof(packed_and_aligned)
36 // CHECK-NEXT: ${{.*}} = 16
38 struct __attribute__((packed)) packed_base { int x; };
39 static_assert(alignof(packed_base) == 1);
41 struct derived : packed, packed_base {} g_derived;
42 static_assert(alignof(derived) == 1);
43 static_assert(sizeof(derived) == 13);
45 // CHECK: (lldb) expr alignof(derived)
46 // CHECK-NEXT: ${{.*}} = 1
47 // CHECK: (lldb) expr sizeof(derived)
48 // CHECK-NEXT: ${{.*}} = 13
50 int main() {}