brintos

brintos / llvm-project-archived public Read only

0
0
Text · 980 B · e9b14da Raw
41 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// REQUIRES: system-windows5//6// RUN: %clang_cl /Z7 /Zi %s -o %t7// RUN: %dexter --fail-lt 1.0 -w --binary %t --debugger 'dbgeng' -- %s8 9struct string {10  string() {}11  string(int i) : i(i) {}12  ~string() {}13  int i = 0;14};15string get_string() {16  string unused;17  string result = 3;18  return result; // DexLabel('readresult1')19}20void some_function(int) {}21struct string2 {22  string2() = default;23  string2(string2 &&other) { i = other.i; }24  int i;25};26string2 get_string2() {27  string2 result;28  result.i = 5;29  some_function(result.i);30  // Test that the debugger can get the value of result after another31  // function is called.32  return result; // DexLabel('readresult2')33}34int main() {35  get_string();36  get_string2();37}38 39// DexExpectWatchValue('result.i', 3, on_line=ref('readresult1'))40// DexExpectWatchValue('result.i', 5, on_line=ref('readresult2'))41