187aa9c9eSJonas Devlieghere // clang-format off
2*f152472aSDavid Spickett // REQUIRES: lld, x86
387aa9c9eSJonas Devlieghere
487aa9c9eSJonas Devlieghere // Test that we can display S_CONSTANT records.
587aa9c9eSJonas Devlieghere
687aa9c9eSJonas Devlieghere // RUN: llvm-mc -filetype=obj -triple=x86_64-pc-win32 %p/Inputs/s_constant.s > %t.obj
787aa9c9eSJonas Devlieghere // RUN: %build --compiler=clang-cl --nodefaultlib --mode=link -o %t.exe -- %t.obj
887aa9c9eSJonas Devlieghere // RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -s \
987aa9c9eSJonas Devlieghere // RUN: %p/Inputs/s_constant.lldbinit | FileCheck %s
1087aa9c9eSJonas Devlieghere
1187aa9c9eSJonas Devlieghere // clang-cl cannot generate S_CONSTANT records, but we need to test that we can
1287aa9c9eSJonas Devlieghere // handle them for compatibility with MSVC, which does emit them. This test
1387aa9c9eSJonas Devlieghere // case was generated by compiling this file with MSVC and copying the bytes
1487aa9c9eSJonas Devlieghere // that they emit for S_CONSTANT records. Then we compile the same code with
1587aa9c9eSJonas Devlieghere // clang to get a .s file, and replace all S_LDATA32 records with the bytes from
1687aa9c9eSJonas Devlieghere // the S_CONSTANT records. This way we end up with a .s file that contains
1787aa9c9eSJonas Devlieghere // symbol records that clang-cl won't generate.
1887aa9c9eSJonas Devlieghere
1987aa9c9eSJonas Devlieghere namespace A {
2087aa9c9eSJonas Devlieghere namespace B {
2187aa9c9eSJonas Devlieghere namespace C {
2287aa9c9eSJonas Devlieghere enum LargeUnsignedEnum : unsigned long long {
2387aa9c9eSJonas Devlieghere LUE_A = 0ULL,
2487aa9c9eSJonas Devlieghere LUE_B = 1000ULL,
2587aa9c9eSJonas Devlieghere LUE_C = 18446744073709551600ULL,
2687aa9c9eSJonas Devlieghere };
2787aa9c9eSJonas Devlieghere
2887aa9c9eSJonas Devlieghere enum LargeSignedEnum : long long {
2987aa9c9eSJonas Devlieghere LSE_A = 0LL,
3087aa9c9eSJonas Devlieghere LSE_B = 9223372036854775000LL,
3187aa9c9eSJonas Devlieghere LSE_C = -9223372036854775000LL,
3287aa9c9eSJonas Devlieghere };
3387aa9c9eSJonas Devlieghere
3487aa9c9eSJonas Devlieghere enum UnsignedEnum : unsigned int {
3587aa9c9eSJonas Devlieghere UE_A = 0,
3687aa9c9eSJonas Devlieghere UE_B = 1000,
3787aa9c9eSJonas Devlieghere UE_C = 4294000000,
3887aa9c9eSJonas Devlieghere };
3987aa9c9eSJonas Devlieghere
4087aa9c9eSJonas Devlieghere enum SignedEnum : int {
4187aa9c9eSJonas Devlieghere SE_A = 0,
4287aa9c9eSJonas Devlieghere SE_B = 2147000000,
4387aa9c9eSJonas Devlieghere SE_C = -2147000000,
4487aa9c9eSJonas Devlieghere };
4587aa9c9eSJonas Devlieghere
4687aa9c9eSJonas Devlieghere enum SmallUnsignedEnum : unsigned char {
4787aa9c9eSJonas Devlieghere SUE_A = 0,
4887aa9c9eSJonas Devlieghere SUE_B = 100,
4987aa9c9eSJonas Devlieghere SUE_C = 200,
5087aa9c9eSJonas Devlieghere };
5187aa9c9eSJonas Devlieghere
5287aa9c9eSJonas Devlieghere enum SmallSignedEnum : char {
5387aa9c9eSJonas Devlieghere SSE_A = 0,
5487aa9c9eSJonas Devlieghere SSE_B = 100,
5587aa9c9eSJonas Devlieghere SSE_C = -100,
5687aa9c9eSJonas Devlieghere };
5787aa9c9eSJonas Devlieghere }
5887aa9c9eSJonas Devlieghere }
5987aa9c9eSJonas Devlieghere }
6087aa9c9eSJonas Devlieghere
6187aa9c9eSJonas Devlieghere using namespace A::B::C;
6287aa9c9eSJonas Devlieghere
6387aa9c9eSJonas Devlieghere constexpr LargeUnsignedEnum GlobalLUEA = LUE_A;
6487aa9c9eSJonas Devlieghere constexpr LargeUnsignedEnum GlobalLUEB = LUE_B;
6587aa9c9eSJonas Devlieghere constexpr LargeUnsignedEnum GlobalLUEC = LUE_C;
6687aa9c9eSJonas Devlieghere
6787aa9c9eSJonas Devlieghere constexpr LargeSignedEnum GlobalLSEA = LSE_A;
6887aa9c9eSJonas Devlieghere constexpr LargeSignedEnum GlobalLSEB = LSE_B;
6987aa9c9eSJonas Devlieghere constexpr LargeSignedEnum GlobalLSEC = LSE_C;
7087aa9c9eSJonas Devlieghere
7187aa9c9eSJonas Devlieghere constexpr UnsignedEnum GlobalUEA = UE_A;
7287aa9c9eSJonas Devlieghere constexpr UnsignedEnum GlobalUEB = UE_B;
7387aa9c9eSJonas Devlieghere constexpr UnsignedEnum GlobalUEC = UE_C;
7487aa9c9eSJonas Devlieghere
7587aa9c9eSJonas Devlieghere constexpr SignedEnum GlobalSEA = SE_A;
7687aa9c9eSJonas Devlieghere constexpr SignedEnum GlobalSEB = SE_B;
7787aa9c9eSJonas Devlieghere constexpr SignedEnum GlobalSEC = SE_C;
7887aa9c9eSJonas Devlieghere
7987aa9c9eSJonas Devlieghere constexpr SmallUnsignedEnum GlobalSUEA = SUE_A;
8087aa9c9eSJonas Devlieghere constexpr SmallUnsignedEnum GlobalSUEB = SUE_B;
8187aa9c9eSJonas Devlieghere constexpr SmallUnsignedEnum GlobalSUEC = SUE_C;
8287aa9c9eSJonas Devlieghere
8387aa9c9eSJonas Devlieghere constexpr SmallSignedEnum GlobalSSEA = SSE_A;
8487aa9c9eSJonas Devlieghere constexpr SmallSignedEnum GlobalSSEB = SSE_B;
8587aa9c9eSJonas Devlieghere constexpr SmallSignedEnum GlobalSSEC = SSE_C;
8687aa9c9eSJonas Devlieghere
main(int argc,char ** argv)8787aa9c9eSJonas Devlieghere int main(int argc, char **argv) {
8887aa9c9eSJonas Devlieghere return 0;
8987aa9c9eSJonas Devlieghere }
9087aa9c9eSJonas Devlieghere
9187aa9c9eSJonas Devlieghere // CHECK: (const A::B::C::LargeUnsignedEnum) GlobalLUEA = LUE_A
9287aa9c9eSJonas Devlieghere // CHECK: (const A::B::C::LargeUnsignedEnum) GlobalLUEB = LUE_B
9387aa9c9eSJonas Devlieghere
9487aa9c9eSJonas Devlieghere // X-FAIL: Something is outputting bad debug info here, maybe cl.
9587aa9c9eSJonas Devlieghere // CHECK: (const A::B::C::LargeUnsignedEnum) GlobalLUEC = {{.*}}
9687aa9c9eSJonas Devlieghere
9787aa9c9eSJonas Devlieghere // CHECK: (const A::B::C::LargeSignedEnum) GlobalLSEA = LSE_A
9887aa9c9eSJonas Devlieghere // CHECK: (const A::B::C::LargeSignedEnum) GlobalLSEB = LSE_B
9987aa9c9eSJonas Devlieghere // CHECK: (const A::B::C::LargeSignedEnum) GlobalLSEC = LSE_C
10087aa9c9eSJonas Devlieghere
10187aa9c9eSJonas Devlieghere // CHECK: (const A::B::C::UnsignedEnum) GlobalUEA = UE_A
10287aa9c9eSJonas Devlieghere // CHECK: (const A::B::C::UnsignedEnum) GlobalUEB = UE_B
10387aa9c9eSJonas Devlieghere // CHECK: (const A::B::C::UnsignedEnum) GlobalUEC = UE_C
10487aa9c9eSJonas Devlieghere
10587aa9c9eSJonas Devlieghere // CHECK: (const A::B::C::SignedEnum) GlobalSEA = SE_A
10687aa9c9eSJonas Devlieghere // CHECK: (const A::B::C::SignedEnum) GlobalSEB = SE_B
10787aa9c9eSJonas Devlieghere // CHECK: (const A::B::C::SignedEnum) GlobalSEC = SE_C
10887aa9c9eSJonas Devlieghere
10987aa9c9eSJonas Devlieghere // CHECK: (const A::B::C::SmallUnsignedEnum) GlobalSUEA = SUE_A
11087aa9c9eSJonas Devlieghere // CHECK: (const A::B::C::SmallUnsignedEnum) GlobalSUEB = SUE_B
11187aa9c9eSJonas Devlieghere // CHECK: (const A::B::C::SmallUnsignedEnum) GlobalSUEC = SUE_C
11287aa9c9eSJonas Devlieghere
11387aa9c9eSJonas Devlieghere // CHECK: (const A::B::C::SmallSignedEnum) GlobalSSEA = SSE_A
11487aa9c9eSJonas Devlieghere // CHECK: (const A::B::C::SmallSignedEnum) GlobalSSEB = SSE_B
11587aa9c9eSJonas Devlieghere // CHECK: (const A::B::C::SmallSignedEnum) GlobalSSEC = SSE_C
116