aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Commands/CommandObjectMultiword.cpp
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2020-01-28 20:23:46 +0100
committerBenjamin Kramer <benny.kra@googlemail.com>2020-01-28 23:25:25 +0100
commitadcd02683856c30ba6f349279509acecd90063df (patch)
tree7b5927ef2ecab1618842183fac5ebe848f5832dd /lldb/source/Commands/CommandObjectMultiword.cpp
parent5eaf44f99f0a0a3bdfa892892b8aaca841c8dbe0 (diff)
downloadllvm-adcd02683856c30ba6f349279509acecd90063df.zip
llvm-adcd02683856c30ba6f349279509acecd90063df.tar.gz
llvm-adcd02683856c30ba6f349279509acecd90063df.tar.bz2
Make llvm::StringRef to std::string conversions explicit.
This is how it should've been and brings it more in line with std::string_view. There should be no functional change here. This is mostly mechanical from a custom clang-tidy check, with a lot of manual fixups. It uncovers a lot of minor inefficiencies. This doesn't actually modify StringRef yet, I'll do that in a follow-up.
Diffstat (limited to 'lldb/source/Commands/CommandObjectMultiword.cpp')
-rw-r--r--lldb/source/Commands/CommandObjectMultiword.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/lldb/source/Commands/CommandObjectMultiword.cpp b/lldb/source/Commands/CommandObjectMultiword.cpp
index 5bba156..ca0e058 100644
--- a/lldb/source/Commands/CommandObjectMultiword.cpp
+++ b/lldb/source/Commands/CommandObjectMultiword.cpp
@@ -32,7 +32,7 @@ CommandObjectSP CommandObjectMultiword::GetSubcommandSP(llvm::StringRef sub_cmd,
CommandObject::CommandMap::iterator pos;
if (!m_subcommand_dict.empty()) {
- pos = m_subcommand_dict.find(sub_cmd);
+ pos = m_subcommand_dict.find(std::string(sub_cmd));
if (pos != m_subcommand_dict.end()) {
// An exact match; append the sub_cmd to the 'matches' string list.
if (matches)
@@ -50,7 +50,7 @@ CommandObjectSP CommandObjectMultiword::GetSubcommandSP(llvm::StringRef sub_cmd,
// function, since I now know I have an exact match...
sub_cmd = matches->GetStringAtIndex(0);
- pos = m_subcommand_dict.find(sub_cmd);
+ pos = m_subcommand_dict.find(std::string(sub_cmd));
if (pos != m_subcommand_dict.end())
return_cmd_sp = pos->second;
}
@@ -74,9 +74,9 @@ bool CommandObjectMultiword::LoadSubCommand(llvm::StringRef name,
CommandMap::iterator pos;
bool success = true;
- pos = m_subcommand_dict.find(name);
+ pos = m_subcommand_dict.find(std::string(name));
if (pos == m_subcommand_dict.end()) {
- m_subcommand_dict[name] = cmd_obj;
+ m_subcommand_dict[std::string(name)] = cmd_obj;
} else
success = false;
@@ -130,9 +130,9 @@ bool CommandObjectMultiword::Execute(const char *args_string,
error_msg.assign("invalid command ");
error_msg.append("'");
- error_msg.append(GetCommandName());
+ error_msg.append(std::string(GetCommandName()));
error_msg.append(" ");
- error_msg.append(sub_command);
+ error_msg.append(std::string(sub_command));
error_msg.append("'.");
if (num_subcmd_matches > 0) {
@@ -165,7 +165,7 @@ void CommandObjectMultiword::GenerateHelpText(Stream &output_stream) {
std::string indented_command(" ");
indented_command.append(pos->first);
if (pos->second->WantsRawCommandString()) {
- std::string help_text(pos->second->GetHelp());
+ std::string help_text(std::string(pos->second->GetHelp()));
help_text.append(" Expects 'raw' input (see 'help raw-input'.)");
m_interpreter.OutputFormattedHelpText(output_stream,
indented_command.c_str(), "--",