2 // This ensures that DW_OP_deref is inserted when necessary, such as when
3 // NRVO of a string object occurs in C++.
5 // REQUIRES: !asan, compiler-rt, lldb
6 // UNSUPPORTED: system-windows
7 // Zorg configures the ASAN stage2 bots to not build the asan
8 // compiler-rt. Only run this test on non-asanified configurations.
10 // RUN: %clang -std=gnu++11 -O0 -glldb -fno-exceptions %s -o %t
11 // RUN: %dexter --fail-lt 1.0 -w \
12 // RUN: --binary %t --debugger 'lldb' -- %s
14 // RUN: %clang -std=gnu++11 -O1 -glldb -fno-exceptions %s -o %t
15 // RUN: %dexter --fail-lt 1.0 -w \
16 // RUN: --binary %t --debugger 'lldb' -- %s
19 volatile int sideeffect
= 0;
20 void __attribute__((noinline
)) stop() { sideeffect
++; }
24 string(int i
) : i(i
) {}
28 string
__attribute__((noinline
)) get_string() {
31 stop(); // DexLabel('string-nrvo')
34 void some_function(int) {}
37 string2(string2
&&other
) { i
= other
.i
; }
40 string2
__attribute__((noinline
)) get_string2() {
43 some_function(output
.i
);
44 // Test that the debugger can get the value of output after another
45 // function is called.
46 stop(); // DexLabel('string2-nrvo')
54 // DexExpectWatchValue('output.i', 3, on_line=ref('string-nrvo'))
55 // DexExpectWatchValue('output.i', 5, on_line=ref('string2-nrvo'))