From f388d17d7cad33afee059b0fe8d6c7b2b3e6899e Mon Sep 17 00:00:00 2001 From: Tatyana Krasnukha Date: Tue, 26 Feb 2019 14:50:40 +0000 Subject: [PATCH] Fix error handling in Options::Parse Moved `if (error.Fail())` to correct place to catch all faulty cases such as "unknown or ambiguous option" which was ignored before. llvm-svn: 354883 --- lldb/source/Interpreter/Options.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lldb/source/Interpreter/Options.cpp b/lldb/source/Interpreter/Options.cpp index 87e09e5..a6c0b49 100644 --- a/lldb/source/Interpreter/Options.cpp +++ b/lldb/source/Interpreter/Options.cpp @@ -1436,10 +1436,11 @@ llvm::Expected Options::Parse(const Args &args, } else { error.SetErrorStringWithFormat("invalid option with value '%i'", val); } - if (error.Fail()) - return error.ToError(); } + if (error.Fail()) + return error.ToError(); + argv.erase(argv.begin(), argv.begin() + OptionParser::GetOptionIndex()); return ReconstituteArgsAfterParsing(argv, args); } -- 2.7.4