brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.3 KiB · 988c4ae Raw
53 lines · cpp
1// This ensures that DW_OP_deref is inserted when necessary, such as when NRVO2// of a string object occurs in C++.3//4// RUN: %clangxx -O0 -fno-exceptions %target_itanium_abi_host_triple %s -o %t.out -g5// RUN: %test_debuginfo %s %t.out6// RUN: %clangxx -O1 -fno-exceptions %target_itanium_abi_host_triple %s -o %t.out -g7// RUN: %test_debuginfo %s %t.out8// XFAIL: !system-darwin && gdb-clang-incompatibility9// PR3451310volatile int sideeffect = 0;11void __attribute__((noinline)) stop() { sideeffect++; }12 13struct string {14  string() {}15  string(int i) : i(i) {}16  ~string() {}17  int i = 0;18};19string __attribute__((noinline)) get_string() {20  string unused;21  string result = 3;22  // DEBUGGER: break 2323  stop();24  return result;25}26void some_function(int) {}27struct string2 {28  string2() = default;29  string2(string2 &&other) { i = other.i; }30  int i;31};32string2 __attribute__((noinline)) get_string2() {33  string2 result;34  result.i = 5;35  some_function(result.i);36  // Test that the debugger can get the value of result after another37  // function is called.38  // DEBUGGER: break 3939  stop();40  return result;41}42int main() {43  get_string();44  get_string2();45}46 47// DEBUGGER: r48// DEBUGGER: print result.i49// CHECK:  = 350// DEBUGGER: c51// DEBUGGER: print result.i52// CHECK:  = 553