diff options
Diffstat (limited to 'lldb/source/Interpreter/CommandInterpreter.cpp')
-rw-r--r-- | lldb/source/Interpreter/CommandInterpreter.cpp | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp index 1bc5103793b..32bcca83522 100644 --- a/lldb/source/Interpreter/CommandInterpreter.cpp +++ b/lldb/source/Interpreter/CommandInterpreter.cpp @@ -1760,7 +1760,7 @@ int CommandInterpreter::HandleCompletionMatches( look_for_subcommand = true; num_command_matches = 0; matches.DeleteStringAtIndex(0); - parsed_line.AppendArgument(""); + parsed_line.AppendArgument(llvm::StringRef()); cursor_index++; cursor_char_position = 0; } @@ -1842,7 +1842,8 @@ int CommandInterpreter::HandleCompletion( partial_parsed_line.GetArgumentAtIndex(cursor_index); if (cursor_char_position == 0 || current_elem[cursor_char_position - 1] != ' ') { - parsed_line.InsertArgumentAtIndex(cursor_index + 1, "", '\0'); + parsed_line.InsertArgumentAtIndex(cursor_index + 1, llvm::StringRef(), + '\0'); cursor_index++; cursor_char_position = 0; } @@ -1987,21 +1988,23 @@ void CommandInterpreter::BuildAliasCommandArgs(CommandObject *alias_cmd_obj, // this above, make // sure we don't // insert it twice - new_args.AppendArgument(value.c_str()); + new_args + .AppendArgument( + value); } else { if (value_type != OptionParser::eOptionalArgument) - new_args.AppendArgument(option.c_str()); + new_args.AppendArgument(option); if (value.compare("<no-argument>") != 0) { int index = GetOptionArgumentPosition(value.c_str()); if (index == 0) { // value was NOT a positional argument; must be a real value if (value_type != OptionParser::eOptionalArgument) - new_args.AppendArgument(value.c_str()); + new_args.AppendArgument(value); else { char buffer[255]; ::snprintf(buffer, sizeof(buffer), "%s%s", option.c_str(), value.c_str()); - new_args.AppendArgument(buffer); + new_args.AppendArgument(llvm::StringRef(buffer)); } } else if (static_cast<size_t>(index) >= @@ -2023,12 +2026,13 @@ void CommandInterpreter::BuildAliasCommandArgs(CommandObject *alias_cmd_obj, } if (value_type != OptionParser::eOptionalArgument) - new_args.AppendArgument(cmd_args.GetArgumentAtIndex(index)); + new_args.AppendArgument(llvm::StringRef::withNullAsEmpty( + cmd_args.GetArgumentAtIndex(index))); else { char buffer[255]; ::snprintf(buffer, sizeof(buffer), "%s%s", option.c_str(), cmd_args.GetArgumentAtIndex(index)); - new_args.AppendArgument(buffer); + new_args.AppendArgument(llvm::StringRef(buffer)); } used[index] = true; } @@ -2038,7 +2042,8 @@ void CommandInterpreter::BuildAliasCommandArgs(CommandObject *alias_cmd_obj, for (size_t j = 0; j < cmd_args.GetArgumentCount(); ++j) { if (!used[j] && !wants_raw_input) - new_args.AppendArgument(cmd_args.GetArgumentAtIndex(j)); + new_args.AppendArgument( + llvm::StringRef(cmd_args.GetArgumentAtIndex(j))); } cmd_args.Clear(); |