| 1 |
// REQUIRES: host-supports-jit |
| 2 |
// clang-repl can be called from the prompt in non-interactive mode as a |
| 3 |
// calculator in shell scripts, for example. In that case if there is an error |
| 4 |
// we should set the exit code as failure. |
| 5 |
// RUN: not clang-repl "int x = 10;" "int y=7; err;" "int y = 10;" |
| 6 |
|
| 7 |
// In interactive (REPL) mode, we can have errors but we should exit with |
| 8 |
// success because errors in the input code are part of the interactive use. |
| 9 |
// RUN: cat %s | clang-repl | FileCheck %s |
| 10 |
|
| 11 |
// However, interactive mode should fail when we specified -verify and there |
| 12 |
// was a diagnostic mismatches. This will make the testsuite fail as intended. |
| 13 |
// RUN: cat %s | not clang-repl -Xcc -Xclang -Xcc -verify | FileCheck %s |
| 14 |
|
| 15 |
BOOM! // expected-error {{intended to fail the -verify test}} |
| 16 |
extern "C" int printf(const char *, ...); |
| 17 |
int i = 42; |
| 18 |
auto r1 = printf("i = %d\n", i); |
| 19 |
// CHECK: i = 42 |
| 20 |
|
| 21 |
1aap = 42; // expected-error {{invalid digit 'a' in decimal constant}} |
| 22 |
1aap = 42; i = 5; // expected-error {{invalid digit 'a' in decimal constant}} |
| 23 |
|
| 24 |
printf("i = %d\n", i); |
| 25 |
// CHECK: i = 42 |
| 26 |
|
| 27 |
%quit |