summaryrefslogtreecommitdiffstats
path: root/lldb/source/Interpreter/CommandInterpreter.cpp
diff options
context:
space:
mode:
authorJonas Devlieghere <jonas@devlieghere.com>2019-02-11 23:13:08 +0000
committerJonas Devlieghere <jonas@devlieghere.com>2019-02-11 23:13:08 +0000
commit796ac80b863ed92c3d8bcc296f678ff416afc8a8 (patch)
tree2d135344aad0612c190b08cf7fd218d98a2a368b /lldb/source/Interpreter/CommandInterpreter.cpp
parent6cbc92915ae8f5cb1d5b265e15858e79c718e7ba (diff)
downloadbcm5719-llvm-796ac80b863ed92c3d8bcc296f678ff416afc8a8.tar.gz
bcm5719-llvm-796ac80b863ed92c3d8bcc296f678ff416afc8a8.zip
Use std::make_shared in LLDB (NFC)
Unlike std::make_unique, which is only available since C++14, std::make_shared is available since C++11. Not only is std::make_shared a lot more readable compared to ::reset(new), it also performs a single heap allocation for the object and control block. Differential revision: https://reviews.llvm.org/D57990 llvm-svn: 353764
Diffstat (limited to 'lldb/source/Interpreter/CommandInterpreter.cpp')
-rw-r--r--lldb/source/Interpreter/CommandInterpreter.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp
index 45fb3a05ade..2ec59565438 100644
--- a/lldb/source/Interpreter/CommandInterpreter.cpp
+++ b/lldb/source/Interpreter/CommandInterpreter.cpp
@@ -6,6 +6,7 @@
//
//===----------------------------------------------------------------------===//
+#include <memory>
#include <stdlib.h>
#include <string>
#include <vector>
@@ -366,7 +367,7 @@ void CommandInterpreter::Initialize() {
if (cmd_obj_sp)
AddAlias("image", cmd_obj_sp);
- alias_arguments_vector_sp.reset(new OptionArgVector);
+ alias_arguments_vector_sp = std::make_shared<OptionArgVector>();
cmd_obj_sp = GetCommandSPExact("expression", false);
if (cmd_obj_sp) {
@@ -392,7 +393,7 @@ void CommandInterpreter::Initialize() {
cmd_obj_sp = GetCommandSPExact("process launch", false);
if (cmd_obj_sp) {
- alias_arguments_vector_sp.reset(new OptionArgVector);
+ alias_arguments_vector_sp = std::make_shared<OptionArgVector>();
#if defined(__arm__) || defined(__arm64__) || defined(__aarch64__)
AddAlias("r", cmd_obj_sp, "--");
AddAlias("run", cmd_obj_sp, "--");
@@ -2967,7 +2968,7 @@ CommandInterpreter::GetIOHandler(bool force_create,
flags = eHandleCommandFlagEchoCommand | eHandleCommandFlagPrintResult;
}
- m_command_io_handler_sp.reset(new IOHandlerEditline(
+ m_command_io_handler_sp = std::make_shared<IOHandlerEditline>(
m_debugger, IOHandler::Type::CommandInterpreter,
m_debugger.GetInputFile(), m_debugger.GetOutputFile(),
m_debugger.GetErrorFile(), flags, "lldb", m_debugger.GetPrompt(),
@@ -2975,7 +2976,7 @@ CommandInterpreter::GetIOHandler(bool force_create,
false, // Don't enable multiple line input, just single line commands
m_debugger.GetUseColor(),
0, // Don't show line numbers
- *this));
+ *this);
}
return m_command_io_handler_sp;
}
OpenPOWER on IntegriCloud