Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / Interpreter / execute-stmts.cpp
blob2d4c17e0c91e661a5f622459e9ba775ea8f38bd6
1 // REQUIRES: host-supports-jit
2 // UNSUPPORTED: system-aix
3 // RUN: cat %s | clang-repl -Xcc -Xclang -Xcc -verify | FileCheck %s
4 // RUN: %clang_cc1 -verify -fincremental-extensions -emit-llvm -o - %s \
5 // RUN: | FileCheck --check-prefix=CODEGEN-CHECK %s
7 // expected-no-diagnostics
9 //CODEGEN-CHECK-COUNT-2: define internal void @__stmts__
10 //CODEGEN-CHECK-NOT: define internal void @__stmts__
13 extern "C" int printf(const char*,...);
15 template <typename T> T call() { printf("called\n"); return T(); }
16 call<int>();
17 // CHECK: called
19 int i = 1;
20 ++i;
21 printf("i = %d\n", i);
22 // CHECK: i = 2
24 namespace Ns { void f(){ i++; } }
25 Ns::f();
27 void g() { ++i; }
28 g();
29 ::g();
31 printf("i = %d\n", i);
32 // CHECK-NEXT: i = 5
34 for (; i > 4; --i) printf("i = %d\n", i);
35 // CHECK-NEXT: i = 5
37 {++i;}
39 for (; i > 4; --i) { printf("i = %d\n", i); };
40 // CHECK-NEXT: i = 5
42 int j = i; printf("j = %d\n", j);
43 // CHECK-NEXT: j = 4