aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.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/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp
parent6cbc92915ae8f5cb1d5b265e15858e79c718e7ba (diff)
downloadllvm-796ac80b863ed92c3d8bcc296f678ff416afc8a8.zip
llvm-796ac80b863ed92c3d8bcc296f678ff416afc8a8.tar.gz
llvm-796ac80b863ed92c3d8bcc296f678ff416afc8a8.tar.bz2
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/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp')
-rw-r--r--lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp b/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp
index 7ef0611..32cee74 100644
--- a/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp
+++ b/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp
@@ -9,6 +9,7 @@
#ifndef LLDB_DISABLE_PYTHON
#include "OperatingSystemPython.h"
+
#include "Plugins/Process/Utility/DynamicRegisterInfo.h"
#include "Plugins/Process/Utility/RegisterContextDummy.h"
#include "Plugins/Process/Utility/RegisterContextMemory.h"
@@ -31,6 +32,8 @@
#include "lldb/Utility/StreamString.h"
#include "lldb/Utility/StructuredData.h"
+#include <memory>
+
using namespace lldb;
using namespace lldb_private;
@@ -259,8 +262,8 @@ ThreadSP OperatingSystemPython::CreateThreadFromThreadInfo(
if (!thread_sp) {
if (did_create_ptr)
*did_create_ptr = true;
- thread_sp.reset(
- new ThreadMemory(*m_process, tid, name, queue, reg_data_addr));
+ thread_sp = std::make_shared<ThreadMemory>(*m_process, tid, name, queue,
+ reg_data_addr);
}
if (core_number < core_thread_list.GetSize(false)) {
@@ -321,8 +324,8 @@ OperatingSystemPython::CreateRegisterContextForThread(Thread *thread,
"= 0x%" PRIx64 ", 0x%" PRIx64 ", reg_data_addr = 0x%" PRIx64
") creating memory register context",
thread->GetID(), thread->GetProtocolID(), reg_data_addr);
- reg_ctx_sp.reset(new RegisterContextMemory(
- *thread, 0, *GetDynamicRegisterInfo(), reg_data_addr));
+ reg_ctx_sp = std::make_shared<RegisterContextMemory>(
+ *thread, 0, *GetDynamicRegisterInfo(), reg_data_addr);
} else {
// No register data address is provided, query the python plug-in to let it
// make up the data as it sees fit
@@ -355,8 +358,8 @@ OperatingSystemPython::CreateRegisterContextForThread(Thread *thread,
log->Printf("OperatingSystemPython::CreateRegisterContextForThread (tid "
"= 0x%" PRIx64 ") forcing a dummy register context",
thread->GetID());
- reg_ctx_sp.reset(new RegisterContextDummy(
- *thread, 0, target.GetArchitecture().GetAddressByteSize()));
+ reg_ctx_sp = std::make_shared<RegisterContextDummy>(
+ *thread, 0, target.GetArchitecture().GetAddressByteSize());
}
return reg_ctx_sp;
}