summaryrefslogtreecommitdiffstats
path: root/lldb/source/Interpreter/Options.cpp
diff options
context:
space:
mode:
authorTatyana Krasnukha <tatyana@synopsys.com>2019-02-26 14:50:40 +0000
committerTatyana Krasnukha <tatyana@synopsys.com>2019-02-26 14:50:40 +0000
commitf388d17d7cad33afee059b0fe8d6c7b2b3e6899e (patch)
tree72c95b712c4286c89bcf63b6a5190d7789ede318 /lldb/source/Interpreter/Options.cpp
parent8cb497027d262372d33d56040d513a4935d08b7a (diff)
downloadbcm5719-llvm-f388d17d7cad33afee059b0fe8d6c7b2b3e6899e.tar.gz
bcm5719-llvm-f388d17d7cad33afee059b0fe8d6c7b2b3e6899e.zip
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
Diffstat (limited to 'lldb/source/Interpreter/Options.cpp')
-rw-r--r--lldb/source/Interpreter/Options.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/lldb/source/Interpreter/Options.cpp b/lldb/source/Interpreter/Options.cpp
index 87e09e56a7b..a6c0b49396d 100644
--- a/lldb/source/Interpreter/Options.cpp
+++ b/lldb/source/Interpreter/Options.cpp
@@ -1436,10 +1436,11 @@ llvm::Expected<Args> 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);
}
OpenPOWER on IntegriCloud