RegisterCoalescer: Fix creating full / empty subrange on undef subreg use (#117936)
[llvm-project.git] / lldb / test / Shell / SymbolFile / NativePDB / bitfields.cpp
blob72085f019e4d84086a07f94bd38c52310b4842a8
1 // clang-format off
2 // REQUIRES: lld, x86
4 // Test various interesting cases for AST reconstruction.
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: %lldb -f %t.exe -s \
8 // RUN: %p/Inputs/bitfields.lldbinit 2>&1 | FileCheck %s
10 // Test trivial versions of each tag type.
11 struct Struct {
12 int A : 5 = 6;
13 int B : 7 = 8;
14 unsigned C : 3 = 2;
15 unsigned D : 15 = 12345;
16 char E : 1 = 0;
17 char F : 2 = 1;
18 char G : 3 = 2;
19 // H should be at offset 0 of a new byte.
20 char H : 3 = 3;
23 constexpr Struct TheStruct;
26 int main(int argc, char **argv) {
27 return TheStruct.A;
30 // CHECK: (lldb) target variable -T TheStruct
31 // CHECK: (const Struct) TheStruct = {
32 // CHECK: (int:5) A = 6
33 // CHECK: (int:7) B = 8
34 // CHECK: (unsigned int:3) C = 2
35 // CHECK: (unsigned int:15) D = 12345
36 // CHECK: (char:1) E = '\0'
37 // CHECK: (char:2) F = '\x01'
38 // CHECK: (char:3) G = '\x02'
39 // CHECK: (char:3) H = '\x03'
40 // CHECK: }
42 // CHECK: target modules dump ast
43 // CHECK: Dumping clang ast for 1 modules.
44 // CHECK: TranslationUnitDecl {{.*}}
45 // CHECK: |-CXXRecordDecl {{.*}} struct Struct definition
46 // CHECK: | |-FieldDecl {{.*}} A 'int'
47 // CHECK: | | `-IntegerLiteral {{.*}} 'int' 5
48 // CHECK: | |-FieldDecl {{.*}} B 'int'
49 // CHECK: | | `-IntegerLiteral {{.*}} 'int' 7
50 // CHECK: | |-FieldDecl {{.*}} C 'unsigned int'
51 // CHECK: | | `-IntegerLiteral {{.*}} 'int' 3
52 // CHECK: | |-FieldDecl {{.*}} D 'unsigned int'
53 // CHECK: | | `-IntegerLiteral {{.*}} 'int' 15
54 // CHECK: | |-FieldDecl {{.*}} E 'char'
55 // CHECK: | | `-IntegerLiteral {{.*}} 'int' 1
56 // CHECK: | |-FieldDecl {{.*}} F 'char'
57 // CHECK: | | `-IntegerLiteral {{.*}} 'int' 2
58 // CHECK: | |-FieldDecl {{.*}} G 'char'
59 // CHECK: | | `-IntegerLiteral {{.*}} 'int' 3
60 // CHECK: | `-FieldDecl {{.*}} H 'char'
61 // CHECK: | `-IntegerLiteral {{.*}} 'int' 3