diff options
Diffstat (limited to 'lldb/source/Commands')
-rw-r--r-- | lldb/source/Commands/CommandObjectApropos.cpp | 6 | ||||
-rw-r--r-- | lldb/source/Commands/CommandObjectCommands.cpp | 6 | ||||
-rw-r--r-- | lldb/source/Commands/CommandObjectMultiword.cpp | 4 | ||||
-rw-r--r-- | lldb/source/Commands/CommandObjectType.cpp | 8 |
4 files changed, 8 insertions, 16 deletions
diff --git a/lldb/source/Commands/CommandObjectApropos.cpp b/lldb/source/Commands/CommandObjectApropos.cpp index 957de475569..d336a1652a9 100644 --- a/lldb/source/Commands/CommandObjectApropos.cpp +++ b/lldb/source/Commands/CommandObjectApropos.cpp @@ -65,10 +65,8 @@ bool CommandObjectApropos::DoExecute(Args &args, CommandReturnObject &result) { "The following commands may relate to '%s':\n", args[0].c_str()); size_t max_len = 0; - for (size_t i = 0; i < commands_found.GetSize(); ++i) { - size_t len = strlen(commands_found.GetStringAtIndex(i)); - if (len > max_len) - max_len = len; + for (const std::string &command : commands_found) { + max_len = std::max(max_len, command.size()); } for (size_t i = 0; i < commands_found.GetSize(); ++i) diff --git a/lldb/source/Commands/CommandObjectCommands.cpp b/lldb/source/Commands/CommandObjectCommands.cpp index e7f99e2316c..65fc8869edf 100644 --- a/lldb/source/Commands/CommandObjectCommands.cpp +++ b/lldb/source/Commands/CommandObjectCommands.cpp @@ -966,11 +966,9 @@ protected: if (m_regex_cmd_up) { StringList lines; if (lines.SplitIntoLines(data)) { - const size_t num_lines = lines.GetSize(); bool check_only = false; - for (size_t i = 0; i < num_lines; ++i) { - llvm::StringRef bytes_strref(lines[i]); - Status error = AppendRegexSubstitution(bytes_strref, check_only); + for (const std::string &line : lines) { + Status error = AppendRegexSubstitution(line, check_only); if (error.Fail()) { if (!GetDebugger().GetCommandInterpreter().GetBatchCommandMode()) { StreamSP out_stream = GetDebugger().GetAsyncOutputStream(); diff --git a/lldb/source/Commands/CommandObjectMultiword.cpp b/lldb/source/Commands/CommandObjectMultiword.cpp index 4011cceb8a2..eeda1fed25c 100644 --- a/lldb/source/Commands/CommandObjectMultiword.cpp +++ b/lldb/source/Commands/CommandObjectMultiword.cpp @@ -136,9 +136,9 @@ bool CommandObjectMultiword::Execute(const char *args_string, if (num_subcmd_matches > 0) { error_msg.append(" Possible completions:"); - for (size_t i = 0; i < matches.GetSize(); i++) { + for (const std::string &match : matches) { error_msg.append("\n\t"); - error_msg.append(matches.GetStringAtIndex(i)); + error_msg.append(match); } } error_msg.append("\n"); diff --git a/lldb/source/Commands/CommandObjectType.cpp b/lldb/source/Commands/CommandObjectType.cpp index 496f856a253..f5d82a26249 100644 --- a/lldb/source/Commands/CommandObjectType.cpp +++ b/lldb/source/Commands/CommandObjectType.cpp @@ -195,9 +195,7 @@ public: Status error; - for (size_t i = 0; i < options->m_target_types.GetSize(); i++) { - const char *type_name = - options->m_target_types.GetStringAtIndex(i); + for (const std::string &type_name : options->m_target_types) { CommandObjectTypeSummaryAdd::AddSummary( ConstString(type_name), script_format, (options->m_regex @@ -437,9 +435,7 @@ protected: Status error; - for (size_t i = 0; i < options->m_target_types.GetSize(); i++) { - const char *type_name = - options->m_target_types.GetStringAtIndex(i); + for (const std::string &type_name : options->m_target_types) { ConstString const_type_name(type_name); if (const_type_name) { if (!CommandObjectTypeSynthAdd::AddSynth( |