summaryrefslogtreecommitdiffstats
path: root/lldb/tools/debugserver/source/MacOSX
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/tools/debugserver/source/MacOSX
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/tools/debugserver/source/MacOSX')
-rw-r--r--lldb/tools/debugserver/source/MacOSX/DarwinLog/DarwinLogCollector.cpp7
-rw-r--r--lldb/tools/debugserver/source/MacOSX/MachThreadList.cpp12
2 files changed, 11 insertions, 8 deletions
diff --git a/lldb/tools/debugserver/source/MacOSX/DarwinLog/DarwinLogCollector.cpp b/lldb/tools/debugserver/source/MacOSX/DarwinLog/DarwinLogCollector.cpp
index 7af822a066a..be50f04c4d8 100644
--- a/lldb/tools/debugserver/source/MacOSX/DarwinLog/DarwinLogCollector.cpp
+++ b/lldb/tools/debugserver/source/MacOSX/DarwinLog/DarwinLogCollector.cpp
@@ -12,6 +12,7 @@
#include <dlfcn.h>
#include <cinttypes>
+#include <memory>
#include <mutex>
#include <vector>
@@ -229,7 +230,7 @@ public:
"missing from configuration.");
return false;
}
- m_filter_chain_sp.reset(new LogFilterChain(filter_default_accept));
+ m_filter_chain_sp = std::make_shared<LogFilterChain>(filter_default_accept);
DNBLogThreadedIf(LOG_DARWIN_LOG, "DarwinLog no-match rule: %s.",
filter_default_accept ? "accept" : "reject");
@@ -315,8 +316,8 @@ public:
}
// Create the filter.
- filter_sp.reset(
- new LogFilterExactMatch(filter_accepts, target_enum, exact_text));
+ filter_sp = std::make_shared<LogFilterExactMatch>(
+ filter_accepts, target_enum, exact_text);
}
// Add the filter to the chain.
diff --git a/lldb/tools/debugserver/source/MacOSX/MachThreadList.cpp b/lldb/tools/debugserver/source/MacOSX/MachThreadList.cpp
index d133b1e1993..be59fb6a0cf 100644
--- a/lldb/tools/debugserver/source/MacOSX/MachThreadList.cpp
+++ b/lldb/tools/debugserver/source/MacOSX/MachThreadList.cpp
@@ -12,13 +12,15 @@
#include "MachThreadList.h"
-#include <inttypes.h>
-#include <sys/sysctl.h>
-
#include "DNBLog.h"
#include "DNBThreadResumeActions.h"
#include "MachProcess.h"
+#include <inttypes.h>
+#include <sys/sysctl.h>
+
+#include <memory>
+
MachThreadList::MachThreadList()
: m_threads(), m_threads_mutex(PTHREAD_MUTEX_RECURSIVE),
m_is_64_bit(false) {}
@@ -310,8 +312,8 @@ MachThreadList::UpdateThreadList(MachProcess *process, bool update,
currThreads.push_back(thread_sp);
} else {
// We don't have this thread, lets add it.
- thread_sp.reset(new MachThread(process, m_is_64_bit, unique_thread_id,
- mach_port_num));
+ thread_sp = std::make_shared<MachThread>(
+ process, m_is_64_bit, unique_thread_id, mach_port_num);
// Add the new thread regardless of its is user ready state...
// Make sure the thread is ready to be displayed and shown to users
OpenPOWER on IntegriCloud