File tree Expand file tree Collapse file tree 2 files changed +11
-17
lines changed Expand file tree Collapse file tree 2 files changed +11
-17
lines changed Original file line number Diff line number Diff line change 1
- // FIXME: There're some inconsistencies between interactive and non-interactive
2
- // modes. For example, when clang-repl runs in the interactive mode, issues an
3
- // error, and then successfully recovers if we decide it's a success then for
4
- // the non-interactive mode the exit code should be a failure.
5
- // RUN: clang-repl "int x = 10;" "int y=7; err;" "int y = 10;"
6
1
// REQUIRES: host-supports-jit
7
2
// UNSUPPORTED: system-aix
8
- // RUN: cat %s | not clang-repl | FileCheck %s
9
- BOOM!
3
+ // RUN: not clang-repl "int x = 10;" "int y=7; err;" "int y = 10;"
4
+ // RUN: cat %s | clang-repl | FileCheck %s
5
+ // RUN: cat %s | not clang-repl -Xcc -Xclang -Xcc -verify | FileCheck %s
6
+ BOOM! // expected-error {{intended to fail the -verify test}}
10
7
extern " C" int printf (const char *, ...);
11
8
int i = 42 ;
12
9
auto r1 = printf(" i = %d\n " , i);
Original file line number Diff line number Diff line change @@ -215,13 +215,15 @@ int main(int argc, const char **argv) {
215
215
} else
216
216
Interp = ExitOnErr (clang::Interpreter::create (std::move (CI)));
217
217
218
+ bool HasError = false ;
219
+
218
220
for (const std::string &input : OptInputs) {
219
- if (auto Err = Interp->ParseAndExecute (input))
221
+ if (auto Err = Interp->ParseAndExecute (input)) {
220
222
llvm::logAllUnhandledErrors (std::move (Err), llvm::errs (), " error: " );
223
+ HasError = true ;
224
+ }
221
225
}
222
226
223
- bool HasError = false ;
224
-
225
227
if (OptInputs.empty ()) {
226
228
llvm::LineEditor LE (" clang-repl" );
227
229
std::string Input;
@@ -241,18 +243,13 @@ int main(int argc, const char **argv) {
241
243
break ;
242
244
}
243
245
if (Input == R"( %undo)" ) {
244
- if (auto Err = Interp->Undo ()) {
246
+ if (auto Err = Interp->Undo ())
245
247
llvm::logAllUnhandledErrors (std::move (Err), llvm::errs (), " error: " );
246
- HasError = true ;
247
- }
248
248
} else if (Input.rfind (" %lib " , 0 ) == 0 ) {
249
- if (auto Err = Interp->LoadDynamicLibrary (Input.data () + 5 )) {
249
+ if (auto Err = Interp->LoadDynamicLibrary (Input.data () + 5 ))
250
250
llvm::logAllUnhandledErrors (std::move (Err), llvm::errs (), " error: " );
251
- HasError = true ;
252
- }
253
251
} else if (auto Err = Interp->ParseAndExecute (Input)) {
254
252
llvm::logAllUnhandledErrors (std::move (Err), llvm::errs (), " error: " );
255
- HasError = true ;
256
253
}
257
254
258
255
Input = " " ;
You can’t perform that action at this time.
0 commit comments