@@ -28,9 +28,6 @@ static llvm::cl::list<std::string>
28
28
llvm::cl::CommaSeparated);
29
29
static llvm::cl::opt<bool > OptHostSupportsJit (" host-supports-jit" ,
30
30
llvm::cl::Hidden);
31
- static llvm::cl::list<std::string> OptInputs (llvm::cl::Positional,
32
- llvm::cl::ZeroOrMore,
33
- llvm::cl::desc (" [code to run]" ));
34
31
35
32
static void LLVMErrorHandler (void *UserData, const std::string &Message,
36
33
bool GenCrashDiag) {
@@ -81,22 +78,15 @@ int main(int argc, const char **argv) {
81
78
static_cast <void *>(&CI->getDiagnostics ()));
82
79
83
80
auto Interp = ExitOnErr (clang::Interpreter::create (std::move (CI)));
84
- for (const std::string &input : OptInputs) {
85
- if (auto Err = Interp->ParseAndExecute (input))
81
+ llvm::LineEditor LE (" clang-repl" );
82
+ // FIXME: Add LE.setListCompleter
83
+ while (llvm::Optional<std::string> Line = LE.readLine ()) {
84
+ if (*Line == " quit" )
85
+ break ;
86
+ if (auto Err = Interp->ParseAndExecute (*Line))
86
87
llvm::logAllUnhandledErrors (std::move (Err), llvm::errs (), " error: " );
87
88
}
88
89
89
- if (OptInputs.empty ()) {
90
- llvm::LineEditor LE (" clang-repl" );
91
- // FIXME: Add LE.setListCompleter
92
- while (llvm::Optional<std::string> Line = LE.readLine ()) {
93
- if (*Line == " quit" )
94
- break ;
95
- if (auto Err = Interp->ParseAndExecute (*Line))
96
- llvm::logAllUnhandledErrors (std::move (Err), llvm::errs (), " error: " );
97
- }
98
- }
99
-
100
90
// Our error handler depends on the Diagnostics object, which we're
101
91
// potentially about to delete. Uninstall the handler now so that any
102
92
// later errors use the default handling behavior instead.
0 commit comments