brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.5 KiB · 42a7110 Raw
57 lines · cpp
1// Purpose:2//     This ensures that DW_OP_deref is inserted when necessary, such as when3//     NRVO of a string object occurs in C++.4//5// REQUIRES: !asan, compiler-rt, lldb6// UNSUPPORTED: system-windows7//           Zorg configures the ASAN stage2 bots to not build the asan8//           compiler-rt. Only run this test on non-asanified configurations.9//10// RUN: %clang++ -std=gnu++11 -O0 -glldb -fno-exceptions %s -o %t11// RUN: %dexter --fail-lt 1.0 -w \12// RUN:     --binary %t %dexter_lldb_args -- %s13//14// RUN: %clang++ -std=gnu++11 -O1 -glldb -fno-exceptions %s -o %t15// RUN: %dexter --fail-lt 1.0 -w \16// RUN:     --binary %t %dexter_lldb_args -- %s17//18// PR3451319volatile int sideeffect = 0;20void __attribute__((noinline)) stop() { sideeffect++; }21 22struct string {23  string() {}24  string(int i) : i(i) {}25  ~string() {}26  int i = 0;27};28string __attribute__((noinline)) get_string() {29  string unused;30  string output = 3;31  stop(); // DexLabel('string-nrvo')32  return output;33}34void some_function(int) {}35struct string2 {36  string2() = default;37  string2(string2 &&other) { i = other.i; }38  int i;39};40string2 __attribute__((noinline)) get_string2() {41  string2 output;42  output.i = 5;43  some_function(output.i);44  // Test that the debugger can get the value of output after another45  // function is called.46  stop(); // DexLabel('string2-nrvo')47  return output;48}49int main() {50  get_string();51  get_string2();52}53 54// DexExpectWatchValue('output.i', 3, on_line=ref('string-nrvo'))55// DexExpectWatchValue('output.i', 5, on_line=ref('string2-nrvo'))56 57