@@ -28,9 +28,6 @@ static llvm::cl::list<std::string>
2828 llvm::cl::CommaSeparated);
2929static llvm::cl::opt<bool > OptHostSupportsJit (" host-supports-jit" ,
3030 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]" ));
3431
3532static void LLVMErrorHandler (void *UserData, const std::string &Message,
3633 bool GenCrashDiag) {
@@ -81,22 +78,15 @@ int main(int argc, const char **argv) {
8178 static_cast <void *>(&CI ->getDiagnostics ()));
8279
8380 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))
8687 llvm::logAllUnhandledErrors (std::move (Err), llvm::errs (), " error: " );
8788 }
8889
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-
10090 // Our error handler depends on the Diagnostics object, which we're
10191 // potentially about to delete. Uninstall the handler now so that any
10292 // later errors use the default handling behavior instead.
0 commit comments