summaryrefslogtreecommitdiffstats
path: root/lldb/source/Commands/CommandObjectCommands.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/Commands/CommandObjectCommands.cpp')
-rw-r--r--lldb/source/Commands/CommandObjectCommands.cpp41
1 files changed, 6 insertions, 35 deletions
diff --git a/lldb/source/Commands/CommandObjectCommands.cpp b/lldb/source/Commands/CommandObjectCommands.cpp
index 584e081c6e8..5e7f272ec22 100644
--- a/lldb/source/Commands/CommandObjectCommands.cpp
+++ b/lldb/source/Commands/CommandObjectCommands.cpp
@@ -553,42 +553,13 @@ protected:
ExecutionContext exe_ctx = GetCommandInterpreter().GetExecutionContext();
m_option_group.NotifyOptionParsingStarting(&exe_ctx);
- const char *remainder = nullptr;
-
- if (raw_command_line[0] == '-') {
- // We have some options and these options MUST end with --.
- const char *end_options = nullptr;
- const char *s = raw_command_line;
- while (s && s[0]) {
- end_options = ::strstr(s, "--");
- if (end_options) {
- end_options += 2; // Get past the "--"
- if (::isspace(end_options[0])) {
- remainder = end_options;
- while (::isspace(*remainder))
- ++remainder;
- break;
- }
- }
- s = end_options;
- }
+ OptionsWithRaw args_with_suffix(raw_command_line);
+ const char *remainder = args_with_suffix.GetRawPart().c_str();
- if (end_options) {
- Args args(
- llvm::StringRef(raw_command_line, end_options - raw_command_line));
- if (!ParseOptions(args, result))
- return false;
-
- Status error(m_option_group.NotifyOptionParsingFinished(&exe_ctx));
- if (error.Fail()) {
- result.AppendError(error.AsCString());
- result.SetStatus(eReturnStatusFailed);
- return false;
- }
- }
- }
- if (nullptr == remainder)
- remainder = raw_command_line;
+ if (args_with_suffix.HasArgs())
+ if (!ParseOptionsAndNotify(args_with_suffix.GetArgs(), result,
+ m_option_group, exe_ctx))
+ return false;
llvm::StringRef raw_command_string(remainder);
Args args(raw_command_string);
OpenPOWER on IntegriCloud