xref: /llvm-project/clang/test/Interpreter/code-undo.cpp (revision ac6e9e69bac76be2f05a20cea6ea8d69a0b43d1b)
1 // UNSUPPORTED: system-aix
2 // RUN: cat %s | clang-repl | FileCheck %s
3 extern "C" int printf(const char *, ...);
4 int x1 = 0;
5 int x2 = 42;
6 %undo
7 int x2 = 24;
8 auto r1 = printf("x1 = %d\n", x1);
9 // CHECK: x1 = 0
10 auto r2 = printf("x2 = %d\n", x2);
11 // CHECK-NEXT: x2 = 24
12 
foo()13 int foo() { return 1; }
14 %undo
15 int foo() { return 2; }
16 auto r3 = printf("foo() = %d\n", foo());
17 // CHECK-NEXT: foo() = 2
18 
bar()19 inline int bar() { return 42;}
20 auto r4 = bar();
21 %undo
22 auto r5 = bar();
23 
24 %quit
25