wallace updated this revision to Diff 517399. wallace added a comment. remove whitespace changes
Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D149312/new/ https://reviews.llvm.org/D149312 Files: lldb/include/lldb/Interpreter/CommandInterpreter.h lldb/source/Interpreter/CommandInterpreter.cpp Index: lldb/source/Interpreter/CommandInterpreter.cpp =================================================================== --- lldb/source/Interpreter/CommandInterpreter.cpp +++ lldb/source/Interpreter/CommandInterpreter.cpp @@ -1374,11 +1374,12 @@ return false; } -bool CommandInterpreter::RemoveCommand(llvm::StringRef cmd) { +bool CommandInterpreter::RemoveCommand(llvm::StringRef cmd, bool force) { auto pos = m_command_dict.find(std::string(cmd)); if (pos != m_command_dict.end()) { - if (pos->second->IsRemovable()) { - // Only regular expression objects or python commands are removable + if (force || pos->second->IsRemovable()) { + // Only regular expression objects or python commands are removable under + // normal circumstances. m_command_dict.erase(pos); return true; } Index: lldb/include/lldb/Interpreter/CommandInterpreter.h =================================================================== --- lldb/include/lldb/Interpreter/CommandInterpreter.h +++ lldb/include/lldb/Interpreter/CommandInterpreter.h @@ -324,8 +324,9 @@ lldb::CommandObjectSP &command_obj_sp, llvm::StringRef args_string = llvm::StringRef()); - // Remove a command if it is removable (python or regex command) - bool RemoveCommand(llvm::StringRef cmd); + /// Remove a command if it is removable (python or regex command). If \b force + /// is provided, the command is removed regardless of its removable status. + bool RemoveCommand(llvm::StringRef cmd, bool force = false); bool RemoveAlias(llvm::StringRef alias_name);
Index: lldb/source/Interpreter/CommandInterpreter.cpp =================================================================== --- lldb/source/Interpreter/CommandInterpreter.cpp +++ lldb/source/Interpreter/CommandInterpreter.cpp @@ -1374,11 +1374,12 @@ return false; } -bool CommandInterpreter::RemoveCommand(llvm::StringRef cmd) { +bool CommandInterpreter::RemoveCommand(llvm::StringRef cmd, bool force) { auto pos = m_command_dict.find(std::string(cmd)); if (pos != m_command_dict.end()) { - if (pos->second->IsRemovable()) { - // Only regular expression objects or python commands are removable + if (force || pos->second->IsRemovable()) { + // Only regular expression objects or python commands are removable under + // normal circumstances. m_command_dict.erase(pos); return true; } Index: lldb/include/lldb/Interpreter/CommandInterpreter.h =================================================================== --- lldb/include/lldb/Interpreter/CommandInterpreter.h +++ lldb/include/lldb/Interpreter/CommandInterpreter.h @@ -324,8 +324,9 @@ lldb::CommandObjectSP &command_obj_sp, llvm::StringRef args_string = llvm::StringRef()); - // Remove a command if it is removable (python or regex command) - bool RemoveCommand(llvm::StringRef cmd); + /// Remove a command if it is removable (python or regex command). If \b force + /// is provided, the command is removed regardless of its removable status. + bool RemoveCommand(llvm::StringRef cmd, bool force = false); bool RemoveAlias(llvm::StringRef alias_name);
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits