4 // Make sure class layout is correct.
5 // RUN: %clang_cl --target=x86_64-windows-msvc -Od -Z7 -c /Fo%t.obj -- %s
6 // RUN: lld-link -debug:full -nodefaultlib -entry:main %t.obj -out:%t.exe -pdb:%t.pdb
7 // RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -s \
8 // RUN: %p/Inputs/class_layout.lldbinit 2>&1 | FileCheck %s
10 // CHECK: (lldb) expr a
11 // CHECK-NEXT: (A) $0 = (d1 = 'a', d2 = 1, d3 = 2, d4 = 'b')
12 // CHECK-NEXT: (lldb) expr b.c
13 // CHECK-NEXT: (char) $1 = 'a'
14 // CHECK-NEXT: (lldb) expr b.u.c
15 // CHECK-NEXT: (char[2]) $2 = "b"
16 // CHECK-NEXT: (lldb) expr b.u.i
17 // CHECK-NEXT: (int) $3 = 98
18 // CHECK-NEXT: (lldb) expr c
19 // CHECK-NEXT: (C) $4 = {
20 // CHECK-NEXT: c = 'a'
24 // CHECK-NEXT: c1 = 'b'
28 // CHECK-NEXT: x = ([0] = 66, [1] = 67, [2] = 68)
30 // CHECK-NEXT: c3 = 'c'
33 // CHECK-NEXT: c4 = 'B'
35 // CHECK-NEXT: x = ([0] = 67, [1] = 68, [2] = 99)
38 // CHECK-NEXT: x = ([0] = 69, [1] = 70, [2] = 71)
45 // CHECK-NEXT: x = ([0] = 98, [1] = 66, [2] = 67)
47 // CHECK-NEXT: c2 = 'D'
51 // CHECK-NEXT: (lldb) type lookup C
52 // CHECK-NEXT: struct C {
53 // CHECK-NEXT: char c;
55 // CHECK-NEXT: union {
56 // CHECK-NEXT: struct {
57 // CHECK-NEXT: char c1;
58 // CHECK-NEXT: union {
59 // CHECK-NEXT: struct {
61 // CHECK-NEXT: char c3;
63 // CHECK-NEXT: struct {
64 // CHECK-NEXT: char c4;
70 // CHECK-NEXT: struct {
72 // CHECK-NEXT: char c2;
79 // Test packed stuct layout.
80 struct __attribute__((packed
, aligned(1))) A
{
87 struct __attribute__((packed
, aligned(1))) B
{
95 // Test struct layout with anonymous union/struct.
125 A a
= {'a', 1, 2, 'b'};
127 C c
= {.c
= 'a', .x
= 65, .c1
= 'b', .s3
= {66, 67, 68}, .c3
= 'c', .s1
={69, 70, 71}};