diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2020-01-28 20:23:46 +0100 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2020-01-28 23:25:25 +0100 |
commit | adcd02683856c30ba6f349279509acecd90063df (patch) | |
tree | 7b5927ef2ecab1618842183fac5ebe848f5832dd /lldb/source/Commands/CommandObjectCommands.cpp | |
parent | 5eaf44f99f0a0a3bdfa892892b8aaca841c8dbe0 (diff) | |
download | llvm-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/CommandObjectCommands.cpp')
-rw-r--r-- | lldb/source/Commands/CommandObjectCommands.cpp | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/lldb/source/Commands/CommandObjectCommands.cpp b/lldb/source/Commands/CommandObjectCommands.cpp index 83f6239..cf5125d 100644 --- a/lldb/source/Commands/CommandObjectCommands.cpp +++ b/lldb/source/Commands/CommandObjectCommands.cpp @@ -652,8 +652,8 @@ protected: } // Save these in std::strings since we're going to shift them off. - const std::string alias_command(args[0].ref()); - const std::string actual_command(args[1].ref()); + const std::string alias_command(std::string(args[0].ref())); + const std::string actual_command(std::string(args[1].ref())); args.Shift(); // Shift the alias command word off the argument vector. args.Shift(); // Shift the old command word off the argument vector. @@ -1114,12 +1114,12 @@ protected: } if (!check_only) { - std::string regex(regex_sed.substr(first_separator_char_pos + 1, - second_separator_char_pos - - first_separator_char_pos - 1)); - std::string subst(regex_sed.substr(second_separator_char_pos + 1, - third_separator_char_pos - - second_separator_char_pos - 1)); + std::string regex(std::string(regex_sed.substr( + first_separator_char_pos + 1, + second_separator_char_pos - first_separator_char_pos - 1))); + std::string subst(std::string(regex_sed.substr( + second_separator_char_pos + 1, + third_separator_char_pos - second_separator_char_pos - 1))); m_regex_cmd_up->AddRegexCommand(regex.c_str(), subst.c_str()); } return error; @@ -1150,10 +1150,10 @@ private: switch (short_option) { case 'h': - m_help.assign(option_arg); + m_help.assign(std::string(option_arg)); break; case 's': - m_syntax.assign(option_arg); + m_syntax.assign(std::string(option_arg)); break; default: llvm_unreachable("Unimplemented option"); @@ -1526,15 +1526,15 @@ protected: switch (short_option) { case 'f': if (!option_arg.empty()) - m_funct_name = option_arg; + m_funct_name = std::string(option_arg); break; case 'c': if (!option_arg.empty()) - m_class_name = option_arg; + m_class_name = std::string(option_arg); break; case 'h': if (!option_arg.empty()) - m_short_help = option_arg; + m_short_help = std::string(option_arg); break; case 's': m_synchronicity = @@ -1643,7 +1643,7 @@ protected: } // Store the options in case we get multi-line input - m_cmd_name = command[0].ref(); + m_cmd_name = std::string(command[0].ref()); m_short_help.assign(m_options.m_short_help); m_synchronicity = m_options.m_synchronicity; |