Skip to content

Commit ce512b7

Browse files
committed
[lldb] Minor improvements to AddNamesMatchingPartialString (NFC)
1 parent 89a792e commit ce512b7

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

lldb/include/lldb/Interpreter/CommandObject.h

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,11 @@ int AddNamesMatchingPartialString(
4040
StringList *descriptions = nullptr) {
4141
int number_added = 0;
4242

43-
const bool add_all = cmd_str.empty();
44-
45-
for (auto iter = in_map.begin(), end = in_map.end(); iter != end; iter++) {
46-
if (add_all || (iter->first.find(std::string(cmd_str), 0) == 0)) {
43+
for (const auto &iter : in_map) {
44+
llvm::StringRef full_cmd = iter->first;
45+
if (full_cmd.starts_with(cmd_str)) {
4746
++number_added;
48-
matches.AppendString(iter->first.c_str());
47+
matches.AppendString(iter->first);
4948
if (descriptions)
5049
descriptions->AppendString(iter->second->GetHelp());
5150
}

0 commit comments

Comments
 (0)