brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.5 KiB · 32785b3 Raw
116 lines · cpp
1// clang-format off2// REQUIRES: lld, x863 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.obj7// RUN: %build --compiler=clang-cl --nodefaultlib --mode=link -o %t.exe -- %t.obj8// RUN: %lldb -f %t.exe -s \9// RUN:     %p/Inputs/s_constant.lldbinit | FileCheck %s10 11// clang-cl cannot generate S_CONSTANT records, but we need to test that we can12// handle them for compatibility with MSVC, which does emit them.  This test13// case was generated by compiling this file with MSVC and copying the bytes14// that they emit for S_CONSTANT records.  Then we compile the same code with15// clang to get a .s file, and replace all S_LDATA32 records with the bytes from16// the S_CONSTANT records.  This way we end up with a .s file that contains17// symbol records that clang-cl won't generate.18 19namespace A {20namespace B {21namespace 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 61using namespace A::B::C;62 63constexpr LargeUnsignedEnum GlobalLUEA = LUE_A;64constexpr LargeUnsignedEnum GlobalLUEB = LUE_B;65constexpr LargeUnsignedEnum GlobalLUEC = LUE_C;66 67constexpr LargeSignedEnum GlobalLSEA = LSE_A;68constexpr LargeSignedEnum GlobalLSEB = LSE_B;69constexpr LargeSignedEnum GlobalLSEC = LSE_C;70 71constexpr UnsignedEnum GlobalUEA = UE_A;72constexpr UnsignedEnum GlobalUEB = UE_B;73constexpr UnsignedEnum GlobalUEC = UE_C;74 75constexpr SignedEnum GlobalSEA = SE_A;76constexpr SignedEnum GlobalSEB = SE_B;77constexpr SignedEnum GlobalSEC = SE_C;78 79constexpr SmallUnsignedEnum GlobalSUEA = SUE_A;80constexpr SmallUnsignedEnum GlobalSUEB = SUE_B;81constexpr SmallUnsignedEnum GlobalSUEC = SUE_C;82 83constexpr SmallSignedEnum GlobalSSEA = SSE_A;84constexpr SmallSignedEnum GlobalSSEB = SSE_B;85constexpr SmallSignedEnum GlobalSSEC = SSE_C;86 87int main(int argc, char **argv) {88  return 0;89}90 91// CHECK: (const A::B::C::LargeUnsignedEnum) GlobalLUEA = LUE_A92// CHECK: (const A::B::C::LargeUnsignedEnum) GlobalLUEB = LUE_B93 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_A98// CHECK: (const A::B::C::LargeSignedEnum) GlobalLSEB = LSE_B99// CHECK: (const A::B::C::LargeSignedEnum) GlobalLSEC = LSE_C100 101// CHECK: (const A::B::C::UnsignedEnum) GlobalUEA = UE_A102// CHECK: (const A::B::C::UnsignedEnum) GlobalUEB = UE_B103// CHECK: (const A::B::C::UnsignedEnum) GlobalUEC = UE_C104 105// CHECK: (const A::B::C::SignedEnum) GlobalSEA = SE_A106// CHECK: (const A::B::C::SignedEnum) GlobalSEB = SE_B107// CHECK: (const A::B::C::SignedEnum) GlobalSEC = SE_C108 109// CHECK: (const A::B::C::SmallUnsignedEnum) GlobalSUEA = SUE_A110// CHECK: (const A::B::C::SmallUnsignedEnum) GlobalSUEB = SUE_B111// CHECK: (const A::B::C::SmallUnsignedEnum) GlobalSUEC = SUE_C112 113// CHECK: (const A::B::C::SmallSignedEnum) GlobalSSEA = SSE_A114// CHECK: (const A::B::C::SmallSignedEnum) GlobalSSEB = SSE_B115// CHECK: (const A::B::C::SmallSignedEnum) GlobalSSEC = SSE_C116