[Lldb-commits] [PATCH] D84305: [lldb/interpreter] Update CommandObject instanciation to use make_shared (NFC)

Med Ismail Bennani via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Jul 22 04:02:25 PDT 2020


mib created this revision.
mib added reviewers: labath, JDevlieghere.
mib added a project: LLDB.
Herald added a subscriber: lldb-commits.

As @labath put it a in D82155 <https://reviews.llvm.org/D82155>, let's make_shared-ify some
the command interpreter CommandObject instantiation.

Signed-off-by: Med Ismail Bennani <medismail.bennani at gmail.com>


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D84305

Files:
  lldb/source/Interpreter/CommandInterpreter.cpp


Index: lldb/source/Interpreter/CommandInterpreter.cpp
===================================================================
--- lldb/source/Interpreter/CommandInterpreter.cpp
+++ lldb/source/Interpreter/CommandInterpreter.cpp
@@ -482,49 +482,46 @@
 
   lldb::ScriptLanguage script_language = m_debugger.GetScriptLanguage();
 
-  m_command_dict["apropos"] = CommandObjectSP(new CommandObjectApropos(*this));
+  m_command_dict["apropos"] = std::make_shared<CommandObjectApropos>(*this);
   m_command_dict["breakpoint"] =
-      CommandObjectSP(new CommandObjectMultiwordBreakpoint(*this));
+      std::make_shared<CommandObjectMultiwordBreakpoint>(*this);
   m_command_dict["command"] =
-      CommandObjectSP(new CommandObjectMultiwordCommands(*this));
+      std::make_shared<CommandObjectMultiwordCommands>(*this);
   m_command_dict["disassemble"] =
-      CommandObjectSP(new CommandObjectDisassemble(*this));
+      std::make_shared<CommandObjectDisassemble>(*this);
   m_command_dict["expression"] =
-      CommandObjectSP(new CommandObjectExpression(*this));
+      std::make_shared<CommandObjectExpression>(*this);
   m_command_dict["frame"] =
-      CommandObjectSP(new CommandObjectMultiwordFrame(*this));
-  m_command_dict["gui"] = CommandObjectSP(new CommandObjectGUI(*this));
-  m_command_dict["help"] = CommandObjectSP(new CommandObjectHelp(*this));
-  m_command_dict["log"] = CommandObjectSP(new CommandObjectLog(*this));
-  m_command_dict["memory"] = CommandObjectSP(new CommandObjectMemory(*this));
-  m_command_dict["platform"] =
-      CommandObjectSP(new CommandObjectPlatform(*this));
-  m_command_dict["plugin"] = CommandObjectSP(new CommandObjectPlugin(*this));
+      std::make_shared<CommandObjectMultiwordFrame>(*this);
+  m_command_dict["gui"] = std::make_shared<CommandObjectGUI>(*this);
+  m_command_dict["help"] = std::make_shared<CommandObjectHelp>(*this);
+  m_command_dict["log"] = std::make_shared<CommandObjectLog>(*this);
+  m_command_dict["memory"] = std::make_shared<CommandObjectMemory>(*this);
+  m_command_dict["platform"] = std::make_shared<CommandObjectPlatform>(*this);
+  m_command_dict["plugin"] = std::make_shared<CommandObjectPlugin>(*this);
   m_command_dict["process"] =
-      CommandObjectSP(new CommandObjectMultiwordProcess(*this));
-  m_command_dict["quit"] = CommandObjectSP(new CommandObjectQuit(*this));
-  m_command_dict["register"] =
-      CommandObjectSP(new CommandObjectRegister(*this));
+      std::make_shared<CommandObjectMultiwordProcess>(*this);
+  m_command_dict["quit"] = std::make_shared<CommandObjectQuit>(*this);
+  m_command_dict["register"] = std::make_shared<CommandObjectRegister>(*this);
   m_command_dict["reproducer"] =
-      CommandObjectSP(new CommandObjectReproducer(*this));
+      std::make_shared<CommandObjectReproducer>(*this);
   m_command_dict["script"] =
-      CommandObjectSP(new CommandObjectScript(*this, script_language));
+      std::make_shared<CommandObjectScript>(*this, script_language);
   m_command_dict["session"] = std::make_shared<CommandObjectSession>(*this);
   m_command_dict["settings"] =
-      CommandObjectSP(new CommandObjectMultiwordSettings(*this));
+      std::make_shared<CommandObjectMultiwordSettings>(*this);
   m_command_dict["source"] =
-      CommandObjectSP(new CommandObjectMultiwordSource(*this));
-  m_command_dict["statistics"] = CommandObjectSP(new CommandObjectStats(*this));
+      std::make_shared<CommandObjectMultiwordSource>(*this);
+  m_command_dict["statistics"] = std::make_shared<CommandObjectStats>(*this);
   m_command_dict["target"] =
-      CommandObjectSP(new CommandObjectMultiwordTarget(*this));
+      std::make_shared<CommandObjectMultiwordTarget>(*this);
   m_command_dict["thread"] =
-      CommandObjectSP(new CommandObjectMultiwordThread(*this));
-  m_command_dict["type"] = CommandObjectSP(new CommandObjectType(*this));
-  m_command_dict["version"] = CommandObjectSP(new CommandObjectVersion(*this));
+      std::make_shared<CommandObjectMultiwordThread>(*this);
+  m_command_dict["type"] = std::make_shared<CommandObjectType>(*this);
+  m_command_dict["version"] = std::make_shared<CommandObjectVersion>(*this);
   m_command_dict["watchpoint"] =
-      CommandObjectSP(new CommandObjectMultiwordWatchpoint(*this));
-  m_command_dict["language"] =
-      CommandObjectSP(new CommandObjectLanguage(*this));
+      std::make_shared<CommandObjectMultiwordWatchpoint>(*this);
+  m_command_dict["language"] = std::make_shared<CommandObjectLanguage>(*this);
 
   // clang-format off
   const char *break_regexes[][2] = {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D84305.279762.patch
Type: text/x-patch
Size: 4568 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20200722/96ea9dcf/attachment.bin>


More information about the lldb-commits mailing list