summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.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/SystemRuntime/MacOSX/SystemRuntimeMacOSX.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/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp')
-rw-r--r--lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp b/lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp
index 6dca6b650f5..513bdb3cc5c 100644
--- a/lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp
+++ b/lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp
@@ -29,6 +29,8 @@
#include "SystemRuntimeMacOSX.h"
+#include <memory>
+
using namespace lldb;
using namespace lldb_private;
@@ -495,9 +497,9 @@ ThreadSP SystemRuntimeMacOSX::GetExtendedBacktraceThread(ThreadSP real_thread,
bool stop_id_is_valid = true;
if (item.stop_id == 0)
stop_id_is_valid = false;
- originating_thread_sp.reset(new HistoryThread(
+ originating_thread_sp = std::make_shared<HistoryThread>(
*m_process, item.enqueuing_thread_id, item.enqueuing_callstack,
- item.stop_id, stop_id_is_valid));
+ item.stop_id, stop_id_is_valid);
originating_thread_sp->SetExtendedBacktraceToken(
item.item_that_enqueued_this);
originating_thread_sp->SetQueueName(
@@ -540,9 +542,9 @@ SystemRuntimeMacOSX::GetExtendedBacktraceFromItemRef(lldb::addr_t item_ref) {
bool stop_id_is_valid = true;
if (item.stop_id == 0)
stop_id_is_valid = false;
- return_thread_sp.reset(new HistoryThread(
+ return_thread_sp = std::make_shared<HistoryThread>(
*m_process, item.enqueuing_thread_id, item.enqueuing_callstack,
- item.stop_id, stop_id_is_valid));
+ item.stop_id, stop_id_is_valid);
return_thread_sp->SetExtendedBacktraceToken(item.item_that_enqueued_this);
return_thread_sp->SetQueueName(item.enqueuing_queue_label.c_str());
return_thread_sp->SetQueueID(item.enqueuing_queue_serialnum);
@@ -567,10 +569,10 @@ SystemRuntimeMacOSX::GetExtendedBacktraceForQueueItem(QueueItemSP queue_item_sp,
if (queue_item_sp->GetStopID() == 0)
stop_id_is_valid = false;
- extended_thread_sp.reset(
- new HistoryThread(*m_process, queue_item_sp->GetEnqueueingThreadID(),
- queue_item_sp->GetEnqueueingBacktrace(),
- queue_item_sp->GetStopID(), stop_id_is_valid));
+ extended_thread_sp = std::make_shared<HistoryThread>(
+ *m_process, queue_item_sp->GetEnqueueingThreadID(),
+ queue_item_sp->GetEnqueueingBacktrace(), queue_item_sp->GetStopID(),
+ stop_id_is_valid);
extended_thread_sp->SetExtendedBacktraceToken(
queue_item_sp->GetItemThatEnqueuedThis());
extended_thread_sp->SetQueueName(queue_item_sp->GetQueueLabel().c_str());
OpenPOWER on IntegriCloud