diff --git a/llvm/include/llvm/Support/raw_ostream.h b/llvm/include/llvm/Support/raw_ostream.h --- a/llvm/include/llvm/Support/raw_ostream.h +++ b/llvm/include/llvm/Support/raw_ostream.h @@ -296,6 +296,8 @@ // changeColor() has no effect until enable_colors() is called. virtual void enable_colors(bool /*enable*/) {} + virtual void clear_error() {} + //===--------------------------------------------------------------------===// // Subclass Interface //===--------------------------------------------------------------------===// @@ -480,7 +482,7 @@ /// Unless explicitly silenced." /// - from The Zen of Python, by Tim Peters /// - void clear_error() { EC = std::error_code(); } + void clear_error() override { EC = std::error_code(); } }; /// This returns a reference to a raw_ostream for standard output. Use it like: diff --git a/llvm/lib/Support/CommandLine.cpp b/llvm/lib/Support/CommandLine.cpp --- a/llvm/lib/Support/CommandLine.cpp +++ b/llvm/lib/Support/CommandLine.cpp @@ -1582,10 +1582,11 @@ // be processed once! MoreHelp.clear(); - // If we had an error processing our arguments, don't let the program execute if (ErrorParsing) { - if (!IgnoreErrors) + if (!IgnoreErrors) { + Errs->clear_error(); exit(1); + } return false; } return true;