summaryrefslogtreecommitdiffstats
path: root/lldb/source/Interpreter/CommandInterpreter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/Interpreter/CommandInterpreter.cpp')
-rw-r--r--lldb/source/Interpreter/CommandInterpreter.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp
index eed403866ae..44ba511ed5b 100644
--- a/lldb/source/Interpreter/CommandInterpreter.cpp
+++ b/lldb/source/Interpreter/CommandInterpreter.cpp
@@ -624,12 +624,10 @@ CommandInterpreter::AddCommand (const char *name, const lldb::CommandObjectSP &c
if (name && name[0])
{
std::string name_sstr(name);
- if (!can_replace)
- {
- if (m_command_dict.find (name_sstr) != m_command_dict.end())
- return false;
- }
- if (m_command_dict[name_sstr]->IsRemovable() == false)
+ bool found = (m_command_dict.find (name_sstr) != m_command_dict.end());
+ if (found && !can_replace)
+ return false;
+ if (found && m_command_dict[name_sstr]->IsRemovable() == false)
return false;
m_command_dict[name_sstr] = cmd_sp;
return true;
OpenPOWER on IntegriCloud