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
diff --git a/lldb/source/Symbol/CompactUnwindInfo.cpp b/lldb/source/Symbol/CompactUnwindInfo.cpp
index 20987a0..f28bb36 100644
--- a/lldb/source/Symbol/CompactUnwindInfo.cpp
+++ b/lldb/source/Symbol/CompactUnwindInfo.cpp
@@ -17,10 +17,12 @@
#include "lldb/Utility/DataBufferHeap.h"
#include "lldb/Utility/Log.h"
#include "lldb/Utility/StreamString.h"
-#include <algorithm>
#include "llvm/Support/MathExtras.h"
+#include <algorithm>
+#include <memory>
+
using namespace lldb;
using namespace lldb_private;
@@ -263,8 +265,8 @@
// have a live process and can read them out of memory.
if (process_sp.get() == nullptr)
return;
- m_section_contents_if_encrypted.reset(
- new DataBufferHeap(m_section_sp->GetByteSize(), 0));
+ m_section_contents_if_encrypted =
+ std::make_shared<DataBufferHeap>(m_section_sp->GetByteSize(), 0);
Status error;
if (process_sp->ReadMemory(
m_section_sp->GetLoadBaseAddress(&process_sp->GetTarget()),