1 // clang-format off
2 // REQUIRES: lld
3
4 // Test that we can display S_CONSTANT records.
5
6 // RUN: llvm-mc -filetype=obj -triple=x86_64-pc-win32 %p/Inputs/s_constant.s > %t.obj
7 // RUN: %build --compiler=clang-cl --nodefaultlib --mode=link -o %t.exe -- %t.obj
8 // RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -s \
9 // RUN: %p/Inputs/s_constant.lldbinit | FileCheck %s
10
11 // clang-cl cannot generate S_CONSTANT records, but we need to test that we can
12 // handle them for compatibility with MSVC, which does emit them. This test
13 // case was generated by compiling this file with MSVC and copying the bytes
14 // that they emit for S_CONSTANT records. Then we compile the same code with
15 // clang to get a .s file, and replace all S_LDATA32 records with the bytes from
16 // the S_CONSTANT records. This way we end up with a .s file that contains
17 // symbol records that clang-cl won't generate.
18
19 namespace A {
20 namespace B {
21 namespace C {
22 enum LargeUnsignedEnum : unsigned long long {
23 LUE_A = 0ULL,
24 LUE_B = 1000ULL,
25 LUE_C = 18446744073709551600ULL,
26 };
27
28 enum LargeSignedEnum : long long {
29 LSE_A = 0LL,
30 LSE_B = 9223372036854775000LL,
31 LSE_C = -9223372036854775000LL,
32 };
33
34 enum UnsignedEnum : unsigned int {
35 UE_A = 0,
36 UE_B = 1000,
37 UE_C = 4294000000,
38 };
39
40 enum SignedEnum : int {
41 SE_A = 0,
42 SE_B = 2147000000,
43 SE_C = -2147000000,
44 };
45
46 enum SmallUnsignedEnum : unsigned char {
47 SUE_A = 0,
48 SUE_B = 100,
49 SUE_C = 200,
50 };
51
52 enum SmallSignedEnum : char {
53 SSE_A = 0,
54 SSE_B = 100,
55 SSE_C = -100,
56 };
57 }
58 }
59 }
60
61 using namespace A::B::C;
62
63 constexpr LargeUnsignedEnum GlobalLUEA = LUE_A;
64 constexpr LargeUnsignedEnum GlobalLUEB = LUE_B;
65 constexpr LargeUnsignedEnum GlobalLUEC = LUE_C;
66
67 constexpr LargeSignedEnum GlobalLSEA = LSE_A;
68 constexpr LargeSignedEnum GlobalLSEB = LSE_B;
69 constexpr LargeSignedEnum GlobalLSEC = LSE_C;
70
71 constexpr UnsignedEnum GlobalUEA = UE_A;
72 constexpr UnsignedEnum GlobalUEB = UE_B;
73 constexpr UnsignedEnum GlobalUEC = UE_C;
74
75 constexpr SignedEnum GlobalSEA = SE_A;
76 constexpr SignedEnum GlobalSEB = SE_B;
77 constexpr SignedEnum GlobalSEC = SE_C;
78
79 constexpr SmallUnsignedEnum GlobalSUEA = SUE_A;
80 constexpr SmallUnsignedEnum GlobalSUEB = SUE_B;
81 constexpr SmallUnsignedEnum GlobalSUEC = SUE_C;
82
83 constexpr SmallSignedEnum GlobalSSEA = SSE_A;
84 constexpr SmallSignedEnum GlobalSSEB = SSE_B;
85 constexpr SmallSignedEnum GlobalSSEC = SSE_C;
86
main(int argc,char ** argv)87 int main(int argc, char **argv) {
88 return 0;
89 }
90
91 // CHECK: (const A::B::C::LargeUnsignedEnum) GlobalLUEA = LUE_A
92 // CHECK: (const A::B::C::LargeUnsignedEnum) GlobalLUEB = LUE_B
93
94 // X-FAIL: Something is outputting bad debug info here, maybe cl.
95 // CHECK: (const A::B::C::LargeUnsignedEnum) GlobalLUEC = {{.*}}
96
97 // CHECK: (const A::B::C::LargeSignedEnum) GlobalLSEA = LSE_A
98 // CHECK: (const A::B::C::LargeSignedEnum) GlobalLSEB = LSE_B
99 // CHECK: (const A::B::C::LargeSignedEnum) GlobalLSEC = LSE_C
100
101 // CHECK: (const A::B::C::UnsignedEnum) GlobalUEA = UE_A
102 // CHECK: (const A::B::C::UnsignedEnum) GlobalUEB = UE_B
103 // CHECK: (const A::B::C::UnsignedEnum) GlobalUEC = UE_C
104
105 // CHECK: (const A::B::C::SignedEnum) GlobalSEA = SE_A
106 // CHECK: (const A::B::C::SignedEnum) GlobalSEB = SE_B
107 // CHECK: (const A::B::C::SignedEnum) GlobalSEC = SE_C
108
109 // CHECK: (const A::B::C::SmallUnsignedEnum) GlobalSUEA = SUE_A
110 // CHECK: (const A::B::C::SmallUnsignedEnum) GlobalSUEB = SUE_B
111 // CHECK: (const A::B::C::SmallUnsignedEnum) GlobalSUEC = SUE_C
112
113 // CHECK: (const A::B::C::SmallSignedEnum) GlobalSSEA = SSE_A
114 // CHECK: (const A::B::C::SmallSignedEnum) GlobalSSEB = SSE_B
115 // CHECK: (const A::B::C::SmallSignedEnum) GlobalSSEC = SSE_C
116