diff options
author | Kazu Hirata <kazu@google.com> | 2024-10-15 07:37:00 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-15 07:37:00 -0700 |
commit | a7b7af7ad5c45fba87d9b423752601865cdfbee2 (patch) | |
tree | 74d00007b2a4bf31293924a637107f86c8847f03 /lldb/source/Commands/CommandObjectMultiword.cpp | |
parent | b43cfa7e45dfd252dcf8de6a753558e698a216d2 (diff) | |
download | llvm-a7b7af7ad5c45fba87d9b423752601865cdfbee2.zip llvm-a7b7af7ad5c45fba87d9b423752601865cdfbee2.tar.gz llvm-a7b7af7ad5c45fba87d9b423752601865cdfbee2.tar.bz2 |
[lldb] Avoid repeated map lookups (NFC) (#112315)
Diffstat (limited to 'lldb/source/Commands/CommandObjectMultiword.cpp')
-rw-r--r-- | lldb/source/Commands/CommandObjectMultiword.cpp | 11 |
1 files changed, 1 insertions, 10 deletions
diff --git a/lldb/source/Commands/CommandObjectMultiword.cpp b/lldb/source/Commands/CommandObjectMultiword.cpp index ab3369c..484d902 100644 --- a/lldb/source/Commands/CommandObjectMultiword.cpp +++ b/lldb/source/Commands/CommandObjectMultiword.cpp @@ -84,16 +84,7 @@ bool CommandObjectMultiword::LoadSubCommand(llvm::StringRef name, lldbassert((&GetCommandInterpreter() == &cmd_obj_sp->GetCommandInterpreter()) && "tried to add a CommandObject from a different interpreter"); - CommandMap::iterator pos; - bool success = true; - - pos = m_subcommand_dict.find(std::string(name)); - if (pos == m_subcommand_dict.end()) { - m_subcommand_dict[std::string(name)] = cmd_obj_sp; - } else - success = false; - - return success; + return m_subcommand_dict.try_emplace(std::string(name), cmd_obj_sp).second; } llvm::Error CommandObjectMultiword::LoadUserSubcommand( |