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