aboutsummaryrefslogtreecommitdiff
path: root/source
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
commit3feca93d161bef6ecf8238e338d83e9d6813402e (patch)
tree8ba3f140453de71aa1c3233144fcf92d6beec0e4 /source
parent16152679c4178a5b3cc44159875d2ac6a97bb94c (diff)
downloadlldb-3feca93d161bef6ecf8238e338d83e9d6813402e.tar.gz
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 git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@353764 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'source')
-rw-r--r--source/API/SBCommandInterpreter.cpp18
-rw-r--r--source/API/SBData.cpp31
-rw-r--r--source/API/SBInstruction.cpp5
-rw-r--r--source/API/SBThread.cpp4
-rw-r--r--source/API/SBThreadPlan.cpp4
-rw-r--r--source/API/SBTrace.cpp4
-rw-r--r--source/API/SBTraceOptions.cpp4
-rw-r--r--source/API/SBType.cpp6
-rw-r--r--source/API/SBTypeEnumMember.cpp8
-rw-r--r--source/API/SBValue.cpp4
-rw-r--r--source/Breakpoint/Breakpoint.cpp6
-rw-r--r--source/Commands/CommandObjectBreakpoint.cpp7
-rw-r--r--source/Commands/CommandObjectFrame.cpp10
-rw-r--r--source/Commands/CommandObjectMemory.cpp15
-rw-r--r--source/Commands/CommandObjectType.cpp33
-rw-r--r--source/Core/IOHandler.cpp23
-rw-r--r--source/Core/ModuleList.cpp9
-rw-r--r--source/Core/ValueObject.cpp6
-rw-r--r--source/DataFormatters/StringPrinter.cpp4
-rw-r--r--source/Expression/Materializer.cpp10
-rw-r--r--source/Expression/REPL.cpp8
-rw-r--r--source/Host/posix/ConnectionFileDescriptorPosix.cpp13
-rw-r--r--source/Interpreter/CommandInterpreter.cpp9
-rw-r--r--source/Interpreter/Property.cpp55
-rw-r--r--source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp10
-rw-r--r--source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp5
-rw-r--r--source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp6
-rw-r--r--source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp4
-rw-r--r--source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp3
-rw-r--r--source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp10
-rw-r--r--source/Plugins/InstrumentationRuntime/MainThreadChecker/MainThreadCheckerRuntime.cpp4
-rw-r--r--source/Plugins/InstrumentationRuntime/TSan/TSanRuntime.cpp4
-rw-r--r--source/Plugins/InstrumentationRuntime/UBSan/UBSanRuntime.cpp4
-rw-r--r--source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp6
-rw-r--r--source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp5
-rw-r--r--source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp8
-rw-r--r--source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp11
-rw-r--r--source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.cpp7
-rw-r--r--source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp10
-rw-r--r--source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp22
-rw-r--r--source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp15
-rw-r--r--source/Plugins/Platform/MacOSX/PlatformDarwin.cpp7
-rw-r--r--source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp6
-rw-r--r--source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp13
-rw-r--r--source/Plugins/Process/MacOSX-Kernel/ThreadKDP.cpp17
-rw-r--r--source/Plugins/Process/Utility/HistoryThread.cpp10
-rw-r--r--source/Plugins/Process/Utility/HistoryUnwind.cpp6
-rw-r--r--source/Plugins/Process/Utility/RegisterContextDarwin_arm.cpp4
-rw-r--r--source/Plugins/Process/Utility/RegisterContextDarwin_arm64.cpp4
-rw-r--r--source/Plugins/Process/Utility/RegisterContextDarwin_i386.cpp8
-rw-r--r--source/Plugins/Process/Utility/RegisterContextDarwin_x86_64.cpp4
-rw-r--r--source/Plugins/Process/Utility/RegisterContextLLDB.cpp16
-rw-r--r--source/Plugins/Process/Utility/ThreadMemory.cpp7
-rw-r--r--source/Plugins/Process/Utility/UnwindMacOSXFrameBackchain.cpp6
-rw-r--r--source/Plugins/Process/elf-core/ProcessElfCore.cpp5
-rw-r--r--source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm.cpp6
-rw-r--r--source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm64.cpp7
-rw-r--r--source/Plugins/Process/elf-core/RegisterContextPOSIXCore_mips64.cpp10
-rw-r--r--source/Plugins/Process/elf-core/RegisterContextPOSIXCore_powerpc.cpp14
-rw-r--r--source/Plugins/Process/elf-core/RegisterContextPOSIXCore_ppc64le.cpp18
-rw-r--r--source/Plugins/Process/elf-core/RegisterContextPOSIXCore_s390x.cpp10
-rw-r--r--source/Plugins/Process/elf-core/ThreadElfCore.cpp34
-rw-r--r--source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp6
-rw-r--r--source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp19
-rw-r--r--source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp8
-rw-r--r--source/Plugins/Process/mach-core/ProcessMachCore.cpp8
-rw-r--r--source/Plugins/Process/minidump/ProcessMinidump.cpp8
-rw-r--r--source/Plugins/Process/minidump/ThreadMinidump.cpp19
-rw-r--r--source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp11
-rw-r--r--source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp7
-rw-r--r--source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp51
-rw-r--r--source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp4
-rw-r--r--source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp21
-rw-r--r--source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp19
-rw-r--r--source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp7
-rw-r--r--source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp18
-rw-r--r--source/Plugins/UnwindAssembly/x86/x86AssemblyInspectionEngine.cpp4
-rw-r--r--source/Symbol/Block.cpp6
-rw-r--r--source/Symbol/ClangASTImporter.cpp4
-rw-r--r--source/Symbol/CompactUnwindInfo.cpp8
-rw-r--r--source/Symbol/FuncUnwinders.cpp35
-rw-r--r--source/Target/CPPLanguageRuntime.cpp12
-rw-r--r--source/Target/Memory.cpp9
-rw-r--r--source/Target/Platform.cpp3
-rw-r--r--source/Target/Process.cpp15
-rw-r--r--source/Target/StackFrame.cpp6
-rw-r--r--source/Target/StackFrameList.cpp20
-rw-r--r--source/Target/Target.cpp45
-rw-r--r--source/Target/Thread.cpp17
-rw-r--r--source/Target/ThreadPlanCallFunction.cpp6
-rw-r--r--source/Target/ThreadPlanStepOut.cpp11
91 files changed, 621 insertions, 428 deletions
diff --git a/source/API/SBCommandInterpreter.cpp b/source/API/SBCommandInterpreter.cpp
index e3332a824..16740868f 100644
--- a/source/API/SBCommandInterpreter.cpp
+++ b/source/API/SBCommandInterpreter.cpp
@@ -25,6 +25,8 @@
#include "lldb/API/SBStringList.h"
#include "lldb/API/SBTarget.h"
+#include <memory>
+
using namespace lldb;
using namespace lldb_private;
@@ -555,8 +557,8 @@ lldb::SBCommand SBCommandInterpreter::AddMultiwordCommand(const char *name,
lldb::SBCommand SBCommandInterpreter::AddCommand(
const char *name, lldb::SBCommandPluginInterface *impl, const char *help) {
lldb::CommandObjectSP new_command_sp;
- new_command_sp.reset(new CommandPluginInterfaceImplementation(
- *m_opaque_ptr, name, impl, help));
+ new_command_sp = std::make_shared<CommandPluginInterfaceImplementation>(
+ *m_opaque_ptr, name, impl, help);
if (new_command_sp &&
m_opaque_ptr->AddUserCommand(name, new_command_sp, true))
@@ -569,8 +571,8 @@ SBCommandInterpreter::AddCommand(const char *name,
lldb::SBCommandPluginInterface *impl,
const char *help, const char *syntax) {
lldb::CommandObjectSP new_command_sp;
- new_command_sp.reset(new CommandPluginInterfaceImplementation(
- *m_opaque_ptr, name, impl, help, syntax));
+ new_command_sp = std::make_shared<CommandPluginInterfaceImplementation>(
+ *m_opaque_ptr, name, impl, help, syntax);
if (new_command_sp &&
m_opaque_ptr->AddUserCommand(name, new_command_sp, true))
@@ -631,8 +633,8 @@ lldb::SBCommand SBCommand::AddCommand(const char *name,
if (!m_opaque_sp->IsMultiwordObject())
return lldb::SBCommand();
lldb::CommandObjectSP new_command_sp;
- new_command_sp.reset(new CommandPluginInterfaceImplementation(
- m_opaque_sp->GetCommandInterpreter(), name, impl, help));
+ new_command_sp = std::make_shared<CommandPluginInterfaceImplementation>(
+ m_opaque_sp->GetCommandInterpreter(), name, impl, help);
if (new_command_sp && m_opaque_sp->LoadSubCommand(name, new_command_sp))
return lldb::SBCommand(new_command_sp);
return lldb::SBCommand();
@@ -646,8 +648,8 @@ lldb::SBCommand SBCommand::AddCommand(const char *name,
if (!m_opaque_sp->IsMultiwordObject())
return lldb::SBCommand();
lldb::CommandObjectSP new_command_sp;
- new_command_sp.reset(new CommandPluginInterfaceImplementation(
- m_opaque_sp->GetCommandInterpreter(), name, impl, help, syntax));
+ new_command_sp = std::make_shared<CommandPluginInterfaceImplementation>(
+ m_opaque_sp->GetCommandInterpreter(), name, impl, help, syntax);
if (new_command_sp && m_opaque_sp->LoadSubCommand(name, new_command_sp))
return lldb::SBCommand(new_command_sp);
return lldb::SBCommand();
diff --git a/source/API/SBData.cpp b/source/API/SBData.cpp
index d808ff22f..54a97614a 100644
--- a/source/API/SBData.cpp
+++ b/source/API/SBData.cpp
@@ -6,8 +6,6 @@
//
//===----------------------------------------------------------------------===//
-#include <inttypes.h>
-
#include "lldb/API/SBData.h"
#include "lldb/API/SBError.h"
#include "lldb/API/SBStream.h"
@@ -18,6 +16,9 @@
#include "lldb/Utility/Log.h"
#include "lldb/Utility/Stream.h"
+#include <cinttypes>
+#include <memory>
+
using namespace lldb;
using namespace lldb_private;
@@ -381,7 +382,7 @@ void SBData::SetData(lldb::SBError &error, const void *buf, size_t size,
lldb::ByteOrder endian, uint8_t addr_size) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
if (!m_opaque_sp.get())
- m_opaque_sp.reset(new DataExtractor(buf, size, endian, addr_size));
+ m_opaque_sp = std::make_shared<DataExtractor>(buf, size, endian, addr_size);
else
{
m_opaque_sp->SetData(buf, size, endian);
@@ -530,8 +531,8 @@ bool SBData::SetDataFromCString(const char *data) {
lldb::DataBufferSP buffer_sp(new DataBufferHeap(data, data_len));
if (!m_opaque_sp.get())
- m_opaque_sp.reset(
- new DataExtractor(buffer_sp, GetByteOrder(), GetAddressByteSize()));
+ m_opaque_sp = std::make_shared<DataExtractor>(buffer_sp, GetByteOrder(),
+ GetAddressByteSize());
else
m_opaque_sp->SetData(buffer_sp);
@@ -560,8 +561,8 @@ bool SBData::SetDataFromUInt64Array(uint64_t *array, size_t array_len) {
lldb::DataBufferSP buffer_sp(new DataBufferHeap(array, data_len));
if (!m_opaque_sp.get())
- m_opaque_sp.reset(
- new DataExtractor(buffer_sp, GetByteOrder(), GetAddressByteSize()));
+ m_opaque_sp = std::make_shared<DataExtractor>(buffer_sp, GetByteOrder(),
+ GetAddressByteSize());
else
m_opaque_sp->SetData(buffer_sp);
@@ -592,8 +593,8 @@ bool SBData::SetDataFromUInt32Array(uint32_t *array, size_t array_len) {
lldb::DataBufferSP buffer_sp(new DataBufferHeap(array, data_len));
if (!m_opaque_sp.get())
- m_opaque_sp.reset(
- new DataExtractor(buffer_sp, GetByteOrder(), GetAddressByteSize()));
+ m_opaque_sp = std::make_shared<DataExtractor>(buffer_sp, GetByteOrder(),
+ GetAddressByteSize());
else
m_opaque_sp->SetData(buffer_sp);
@@ -624,8 +625,8 @@ bool SBData::SetDataFromSInt64Array(int64_t *array, size_t array_len) {
lldb::DataBufferSP buffer_sp(new DataBufferHeap(array, data_len));
if (!m_opaque_sp.get())
- m_opaque_sp.reset(
- new DataExtractor(buffer_sp, GetByteOrder(), GetAddressByteSize()));
+ m_opaque_sp = std::make_shared<DataExtractor>(buffer_sp, GetByteOrder(),
+ GetAddressByteSize());
else
m_opaque_sp->SetData(buffer_sp);
@@ -656,8 +657,8 @@ bool SBData::SetDataFromSInt32Array(int32_t *array, size_t array_len) {
lldb::DataBufferSP buffer_sp(new DataBufferHeap(array, data_len));
if (!m_opaque_sp.get())
- m_opaque_sp.reset(
- new DataExtractor(buffer_sp, GetByteOrder(), GetAddressByteSize()));
+ m_opaque_sp = std::make_shared<DataExtractor>(buffer_sp, GetByteOrder(),
+ GetAddressByteSize());
else
m_opaque_sp->SetData(buffer_sp);
@@ -688,8 +689,8 @@ bool SBData::SetDataFromDoubleArray(double *array, size_t array_len) {
lldb::DataBufferSP buffer_sp(new DataBufferHeap(array, data_len));
if (!m_opaque_sp.get())
- m_opaque_sp.reset(
- new DataExtractor(buffer_sp, GetByteOrder(), GetAddressByteSize()));
+ m_opaque_sp = std::make_shared<DataExtractor>(buffer_sp, GetByteOrder(),
+ GetAddressByteSize());
else
m_opaque_sp->SetData(buffer_sp);
diff --git a/source/API/SBInstruction.cpp b/source/API/SBInstruction.cpp
index 5b3c0aac2..abc390b24 100644
--- a/source/API/SBInstruction.cpp
+++ b/source/API/SBInstruction.cpp
@@ -10,6 +10,7 @@
#include "lldb/API/SBAddress.h"
#include "lldb/API/SBFrame.h"
+
#include "lldb/API/SBInstruction.h"
#include "lldb/API/SBStream.h"
#include "lldb/API/SBTarget.h"
@@ -25,6 +26,8 @@
#include "lldb/Utility/DataBufferHeap.h"
#include "lldb/Utility/DataExtractor.h"
+#include <memory>
+
//----------------------------------------------------------------------
// We recently fixed a leak in one of the Instruction subclasses where the
// instruction will only hold a weak reference to the disassembler to avoid a
@@ -190,7 +193,7 @@ lldb::InstructionSP SBInstruction::GetOpaque() {
void SBInstruction::SetOpaque(const lldb::DisassemblerSP &disasm_sp,
const lldb::InstructionSP &inst_sp) {
- m_opaque_sp.reset(new InstructionImpl(disasm_sp, inst_sp));
+ m_opaque_sp = std::make_shared<InstructionImpl>(disasm_sp, inst_sp);
}
bool SBInstruction::GetDescription(lldb::SBStream &s) {
diff --git a/source/API/SBThread.cpp b/source/API/SBThread.cpp
index d19758b0f..9d4cb1562 100644
--- a/source/API/SBThread.cpp
+++ b/source/API/SBThread.cpp
@@ -44,6 +44,8 @@
#include "lldb/API/SBValue.h"
#include "lldb/lldb-enumerations.h"
+#include <memory>
+
using namespace lldb;
using namespace lldb_private;
@@ -290,7 +292,7 @@ bool SBThread::GetStopReasonExtendedInfoAsJSON(lldb::SBStream &stream) {
SBThreadCollection
SBThread::GetStopReasonExtendedBacktraces(InstrumentationRuntimeType type) {
ThreadCollectionSP threads;
- threads.reset(new ThreadCollection());
+ threads = std::make_shared<ThreadCollection>();
std::unique_lock<std::recursive_mutex> lock;
ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
diff --git a/source/API/SBThreadPlan.cpp b/source/API/SBThreadPlan.cpp
index ba645cba3..cca06df82 100644
--- a/source/API/SBThreadPlan.cpp
+++ b/source/API/SBThreadPlan.cpp
@@ -41,6 +41,8 @@
#include "lldb/API/SBThreadPlan.h"
#include "lldb/API/SBValue.h"
+#include <memory>
+
using namespace lldb;
using namespace lldb_private;
@@ -58,7 +60,7 @@ SBThreadPlan::SBThreadPlan(const SBThreadPlan &rhs)
SBThreadPlan::SBThreadPlan(lldb::SBThread &sb_thread, const char *class_name) {
Thread *thread = sb_thread.get();
if (thread)
- m_opaque_sp.reset(new ThreadPlanPython(*thread, class_name));
+ m_opaque_sp = std::make_shared<ThreadPlanPython>(*thread, class_name);
}
//----------------------------------------------------------------------
diff --git a/source/API/SBTrace.cpp b/source/API/SBTrace.cpp
index b4e7f654b..daccdec63 100644
--- a/source/API/SBTrace.cpp
+++ b/source/API/SBTrace.cpp
@@ -12,6 +12,8 @@
#include "lldb/API/SBTrace.h"
#include "lldb/API/SBTraceOptions.h"
+#include <memory>
+
using namespace lldb;
using namespace lldb_private;
@@ -92,7 +94,7 @@ void SBTrace::SetTraceUID(lldb::user_id_t uid) {
}
SBTrace::SBTrace() {
- m_trace_impl_sp.reset(new TraceImpl);
+ m_trace_impl_sp = std::make_shared<TraceImpl>();
if (m_trace_impl_sp)
m_trace_impl_sp->uid = LLDB_INVALID_UID;
}
diff --git a/source/API/SBTraceOptions.cpp b/source/API/SBTraceOptions.cpp
index a041f740b..e48f1dcfc 100644
--- a/source/API/SBTraceOptions.cpp
+++ b/source/API/SBTraceOptions.cpp
@@ -13,11 +13,13 @@
#include "lldb/Utility/Log.h"
#include "lldb/Utility/TraceOptions.h"
+#include <memory>
+
using namespace lldb;
using namespace lldb_private;
SBTraceOptions::SBTraceOptions() {
- m_traceoptions_sp.reset(new TraceOptions());
+ m_traceoptions_sp = std::make_shared<TraceOptions>();
}
lldb::TraceType SBTraceOptions::getType() const {
diff --git a/source/API/SBType.cpp b/source/API/SBType.cpp
index 6f7d5c75b..b67f9bc84 100644
--- a/source/API/SBType.cpp
+++ b/source/API/SBType.cpp
@@ -20,6 +20,8 @@
#include "llvm/ADT/APSInt.h"
+#include <memory>
+
using namespace lldb;
using namespace lldb_private;
@@ -82,7 +84,7 @@ SBType::~SBType() {}
TypeImpl &SBType::ref() {
if (m_opaque_sp.get() == NULL)
- m_opaque_sp.reset(new TypeImpl());
+ m_opaque_sp = std::make_shared<TypeImpl>();
return *m_opaque_sp;
}
@@ -670,7 +672,7 @@ void SBTypeMemberFunction::reset(TypeMemberFunctionImpl *type_member_impl) {
TypeMemberFunctionImpl &SBTypeMemberFunction::ref() {
if (!m_opaque_sp)
- m_opaque_sp.reset(new TypeMemberFunctionImpl());
+ m_opaque_sp = std::make_shared<TypeMemberFunctionImpl>();
return *m_opaque_sp.get();
}
diff --git a/source/API/SBTypeEnumMember.cpp b/source/API/SBTypeEnumMember.cpp
index 44569c31a..d8b70a431 100644
--- a/source/API/SBTypeEnumMember.cpp
+++ b/source/API/SBTypeEnumMember.cpp
@@ -14,6 +14,8 @@
#include "lldb/Symbol/Type.h"
#include "lldb/Utility/Stream.h"
+#include <memory>
+
using namespace lldb;
using namespace lldb_private;
@@ -28,14 +30,14 @@ SBTypeEnumMember::SBTypeEnumMember(const SBTypeEnumMember &rhs)
: m_opaque_sp() {
if (this != &rhs) {
if (rhs.IsValid())
- m_opaque_sp.reset(new TypeEnumMemberImpl(rhs.ref()));
+ m_opaque_sp = std::make_shared<TypeEnumMemberImpl>(rhs.ref());
}
}
SBTypeEnumMember &SBTypeEnumMember::operator=(const SBTypeEnumMember &rhs) {
if (this != &rhs) {
if (rhs.IsValid())
- m_opaque_sp.reset(new TypeEnumMemberImpl(rhs.ref()));
+ m_opaque_sp = std::make_shared<TypeEnumMemberImpl>(rhs.ref());
}
return *this;
}
@@ -74,7 +76,7 @@ void SBTypeEnumMember::reset(TypeEnumMemberImpl *type_member_impl) {
TypeEnumMemberImpl &SBTypeEnumMember::ref() {
if (m_opaque_sp.get() == NULL)
- m_opaque_sp.reset(new TypeEnumMemberImpl());
+ m_opaque_sp = std::make_shared<TypeEnumMemberImpl>();
return *m_opaque_sp.get();
}
diff --git a/source/API/SBValue.cpp b/source/API/SBValue.cpp
index b83a4effc..439c55e60 100644
--- a/source/API/SBValue.cpp
+++ b/source/API/SBValue.cpp
@@ -46,6 +46,8 @@
#include "lldb/API/SBTarget.h"
#include "lldb/API/SBThread.h"
+#include <memory>
+
using namespace lldb;
using namespace lldb_private;
@@ -485,7 +487,7 @@ SBType SBValue::GetType() {
lldb::ValueObjectSP value_sp(GetSP(locker));
TypeImplSP type_sp;
if (value_sp) {
- type_sp.reset(new TypeImpl(value_sp->GetTypeImpl()));
+ type_sp = std::make_shared<TypeImpl>(value_sp->GetTypeImpl());
sb_type.SetSP(type_sp);
}
if (log) {
diff --git a/source/Breakpoint/Breakpoint.cpp b/source/Breakpoint/Breakpoint.cpp
index 38708e89e..0b315c427 100644
--- a/source/Breakpoint/Breakpoint.cpp
+++ b/source/Breakpoint/Breakpoint.cpp
@@ -29,6 +29,8 @@
#include "lldb/Utility/Stream.h"
#include "lldb/Utility/StreamString.h"
+#include <memory>
+
using namespace lldb;
using namespace lldb_private;
using namespace llvm;
@@ -158,8 +160,8 @@ lldb::BreakpointSP Breakpoint::CreateFromStructuredData(
SearchFilter::GetSerializationKey(), filter_dict);
SearchFilterSP filter_sp;
if (!success)
- filter_sp.reset(
- new SearchFilterForUnconstrainedSearches(target.shared_from_this()));
+ filter_sp = std::make_shared<SearchFilterForUnconstrainedSearches>(
+ target.shared_from_this());
else {
filter_sp = SearchFilter::CreateFromStructuredData(target, *filter_dict,
create_error);
diff --git a/source/Commands/CommandObjectBreakpoint.cpp b/source/Commands/CommandObjectBreakpoint.cpp
index 3996bcf15..b9b0cb557 100644
--- a/source/Commands/CommandObjectBreakpoint.cpp
+++ b/source/Commands/CommandObjectBreakpoint.cpp
@@ -6,8 +6,6 @@
//
//===----------------------------------------------------------------------===//
-#include <vector>
-
#include "CommandObjectBreakpoint.h"
#include "CommandObjectBreakpointCommand.h"
#include "lldb/Breakpoint/Breakpoint.h"
@@ -30,6 +28,9 @@
#include "lldb/Utility/RegularExpression.h"
#include "lldb/Utility/StreamString.h"
+#include <memory>
+#include <vector>
+
using namespace lldb;
using namespace lldb_private;
@@ -615,7 +616,7 @@ public:
m_move_to_nearest_code = eLazyBoolCalculate;
m_source_regex_func_names.clear();
m_python_class.clear();
- m_extra_args_sp.reset(new StructuredData::Dictionary());
+ m_extra_args_sp = std::make_shared<StructuredData::Dictionary>();
m_current_key.clear();
}
diff --git a/source/Commands/CommandObjectFrame.cpp b/source/Commands/CommandObjectFrame.cpp
index 17a0896bc..3b4259b1c 100644
--- a/source/Commands/CommandObjectFrame.cpp
+++ b/source/Commands/CommandObjectFrame.cpp
@@ -5,9 +5,6 @@
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
-
-#include <string>
-
#include "CommandObjectFrame.h"
#include "lldb/Core/Debugger.h"
#include "lldb/Core/Module.h"
@@ -45,6 +42,9 @@
#include "lldb/Utility/StreamString.h"
#include "lldb/Utility/Timer.h"
+#include <memory>
+#include <string>
+
using namespace lldb;
using namespace lldb_private;
@@ -526,9 +526,9 @@ protected:
ConstString(m_option_variable.summary.GetCurrentValue()),
summary_format_sp);
else if (!m_option_variable.summary_string.IsCurrentValueEmpty())
- summary_format_sp.reset(new StringSummaryFormat(
+ summary_format_sp = std::make_shared<StringSummaryFormat>(
TypeSummaryImpl::Flags(),
- m_option_variable.summary_string.GetCurrentValue()));
+ m_option_variable.summary_string.GetCurrentValue());
DumpValueObjectOptions options(m_varobj_options.GetAsDumpOptions(
eLanguageRuntimeDescriptionDisplayVerbosityFull, eFormatDefault,
diff --git a/source/Commands/CommandObjectMemory.cpp b/source/Commands/CommandObjectMemory.cpp
index 439f47557..1f4a369de 100644
--- a/source/Commands/CommandObjectMemory.cpp
+++ b/source/Commands/CommandObjectMemory.cpp
@@ -6,8 +6,6 @@
//
//===----------------------------------------------------------------------===//
-#include <inttypes.h>
-
#include "clang/AST/Decl.h"
#include "CommandObjectMemory.h"
@@ -42,6 +40,9 @@
#include "lldb/lldb-private.h"
+#include <cinttypes>
+#include <memory>
+
using namespace lldb;
using namespace lldb_private;
@@ -652,7 +653,7 @@ protected:
addr = addr + (*size * m_memory_options.m_offset.GetCurrentValue());
} else if (m_format_options.GetFormatValue().GetCurrentValue() !=
eFormatCString) {
- data_sp.reset(new DataBufferHeap(total_byte_size, '\0'));
+ data_sp = std::make_shared<DataBufferHeap>(total_byte_size, '\0');
if (data_sp->GetBytes() == nullptr) {
result.AppendErrorWithFormat(
"can't allocate 0x%" PRIx32
@@ -692,8 +693,9 @@ protected:
item_byte_size = target->GetMaximumSizeOfStringSummary();
if (!m_format_options.GetCountValue().OptionWasSet())
item_count = 1;
- data_sp.reset(new DataBufferHeap((item_byte_size + 1) * item_count,
- '\0')); // account for NULLs as necessary
+ data_sp = std::make_shared<DataBufferHeap>(
+ (item_byte_size + 1) * item_count,
+ '\0'); // account for NULLs as necessary
if (data_sp->GetBytes() == nullptr) {
result.AppendErrorWithFormat(
"can't allocate 0x%" PRIx64
@@ -740,7 +742,8 @@ protected:
if (break_on_no_NULL)
break;
}
- data_sp.reset(new DataBufferHeap(data_sp->GetBytes(), bytes_read + 1));
+ data_sp =
+ std::make_shared<DataBufferHeap>(data_sp->GetBytes(), bytes_read + 1);
}
m_next_addr = addr + bytes_read;
diff --git a/source/Commands/CommandObjectType.cpp b/source/Commands/CommandObjectType.cpp
index 824161508..64ed45967 100644
--- a/source/Commands/CommandObjectType.cpp
+++ b/source/Commands/CommandObjectType.cpp
@@ -8,10 +8,6 @@
#include "CommandObjectType.h"
-#include <algorithm>
-#include <cctype>
-#include <functional>
-
#include "lldb/Core/Debugger.h"
#include "lldb/Core/IOHandler.h"
#include "lldb/DataFormatters/DataVisualization.h"
@@ -39,6 +35,11 @@
#include "llvm/ADT/STLExtras.h"
+#include <algorithm>
+#include <cctype>
+#include <functional>
+#include <memory>
+
using namespace lldb;
using namespace lldb_private;
@@ -205,9 +206,9 @@ public:
// for every type in the list
TypeSummaryImplSP script_format;
- script_format.reset(new ScriptSummaryFormat(
+ script_format = std::make_shared<ScriptSummaryFormat>(
options->m_flags, funct_name_str.c_str(),
- lines.CopyList(" ").c_str()));
+ lines.CopyList(" ").c_str());
Status error;
@@ -449,12 +450,12 @@ protected:
// class
SyntheticChildrenSP synth_provider;
- synth_provider.reset(new ScriptedSyntheticChildren(
+ synth_provider = std::make_shared<ScriptedSyntheticChildren>(
SyntheticChildren::Flags()
.SetCascades(options->m_cascade)
.SetSkipPointers(options->m_skip_pointers)
.SetSkipReferences(options->m_skip_references),
- class_name_str.c_str()));
+ class_name_str.c_str());
lldb::TypeCategoryImplSP category;
DataVisualization::Categories::GetCategory(
@@ -699,18 +700,18 @@ protected:
TypeFormatImplSP entry;
if (m_command_options.m_custom_type_name.empty())
- entry.reset(new TypeFormatImpl_Format(
+ entry = std::make_shared<TypeFormatImpl_Format>(
format, TypeFormatImpl::Flags()
.SetCascades(m_command_options.m_cascade)
.SetSkipPointers(m_command_options.m_skip_pointers)
- .SetSkipReferences(m_command_options.m_skip_references)));
+ .SetSkipReferences(m_command_options.m_skip_references));
else
- entry.reset(new TypeFormatImpl_EnumType(
+ entry = std::make_shared<TypeFormatImpl_EnumType>(
ConstString(m_command_options.m_custom_type_name.c_str()),
TypeFormatImpl::Flags()
.SetCascades(m_command_options.m_cascade)
.SetSkipPointers(m_command_options.m_skip_pointers)
- .SetSkipReferences(m_command_options.m_skip_references)));
+ .SetSkipReferences(m_command_options.m_skip_references));
// now I have a valid format, let's add it to every type
@@ -1352,8 +1353,8 @@ bool CommandObjectTypeSummaryAdd::Execute_ScriptSummary(
std::string code =
(" " + m_options.m_python_function + "(valobj,internal_dict)");
- script_format.reset(
- new ScriptSummaryFormat(m_options.m_flags, funct_name, code.c_str()));
+ script_format = std::make_shared<ScriptSummaryFormat>(
+ m_options.m_flags, funct_name, code.c_str());
ScriptInterpreter *interpreter = m_interpreter.GetScriptInterpreter();
@@ -1389,8 +1390,8 @@ bool CommandObjectTypeSummaryAdd::Execute_ScriptSummary(
std::string code = " " + m_options.m_python_script;
- script_format.reset(new ScriptSummaryFormat(
- m_options.m_flags, funct_name_str.c_str(), code.c_str()));
+ script_format = std::make_shared<ScriptSummaryFormat>(
+ m_options.m_flags, funct_name_str.c_str(), code.c_str());
} else {
// Use an IOHandler to grab Python code from the user
ScriptAddOptions *options =
diff --git a/source/Core/IOHandler.cpp b/source/Core/IOHandler.cpp
index f3d08ed7e..b23f49a94 100644
--- a/source/Core/IOHandler.cpp
+++ b/source/Core/IOHandler.cpp
@@ -995,16 +995,18 @@ public:
bool make_active) {
WindowSP subwindow_sp;
if (m_window) {
- subwindow_sp.reset(new Window(
- name, ::subwin(m_window, bounds.size.height, bounds.size.width,
+ subwindow_sp = std::make_shared<Window>(
+ name,
+ ::subwin(m_window, bounds.size.height, bounds.size.width,
bounds.origin.y, bounds.origin.x),
- true));
+ true);
subwindow_sp->m_is_subwin = true;
} else {
- subwindow_sp.reset(
- new Window(name, ::newwin(bounds.size.height, bounds.size.width,
- bounds.origin.y, bounds.origin.x),
- true));
+ subwindow_sp = std::make_shared<Window>(
+ name,
+ ::newwin(bounds.size.height, bounds.size.width, bounds.origin.y,
+ bounds.origin.x),
+ true);
subwindow_sp->m_is_subwin = false;
}
subwindow_sp->m_parent = this;
@@ -1881,7 +1883,7 @@ public:
WindowSP &GetMainWindow() {
if (!m_window_sp)
- m_window_sp.reset(new Window("main", stdscr, false));
+ m_window_sp = std::make_shared<Window>("main", stdscr, false);
return m_window_sp;
}
@@ -2508,7 +2510,7 @@ public:
return; // Children are already up to date
if (!m_frame_delegate_sp) {
// Always expand the thread item the first time we show it
- m_frame_delegate_sp.reset(new FrameTreeDelegate());
+ m_frame_delegate_sp = std::make_shared<FrameTreeDelegate>();
}
m_stop_id = process_sp->GetStopID();
@@ -2600,7 +2602,8 @@ public:
if (!m_thread_delegate_sp) {
// Always expand the thread item the first time we show it
// item.Expand();
- m_thread_delegate_sp.reset(new ThreadTreeDelegate(m_debugger));
+ m_thread_delegate_sp =
+ std::make_shared<ThreadTreeDelegate>(m_debugger);
}
TreeItem t(&item, *m_thread_delegate_sp, false);
diff --git a/source/Core/ModuleList.cpp b/source/Core/ModuleList.cpp
index a72006cca..26611e957 100644
--- a/source/Core/ModuleList.cpp
+++ b/source/Core/ModuleList.cpp
@@ -87,7 +87,8 @@ enum { ePropertyEnableExternalLookup, ePropertyClangModulesCachePath };
} // namespace
ModuleListProperties::ModuleListProperties() {
- m_collection_sp.reset(new OptionValueProperties(ConstString("symbols")));
+ m_collection_sp =
+ std::make_shared<OptionValueProperties>(ConstString("symbols"));
m_collection_sp->Initialize(g_properties);
llvm::SmallString<128> path;
@@ -829,7 +830,7 @@ Status ModuleList::GetSharedModule(const ModuleSpec &module_spec,
if (module_sp)
return error;
- module_sp.reset(new Module(module_spec));
+ module_sp = std::make_shared<Module>(module_spec);
// Make sure there are a module and an object file since we can specify a
// valid file path with an architecture that might not be in that file. By
// getting the object file we can guarantee that the architecture matches
@@ -871,7 +872,7 @@ Status ModuleList::GetSharedModule(const ModuleSpec &module_spec,
auto resolved_module_spec(module_spec);
resolved_module_spec.GetFileSpec() = search_path_spec;
- module_sp.reset(new Module(resolved_module_spec));
+ module_sp = std::make_shared<Module>(resolved_module_spec);
if (module_sp->GetObjectFile()) {
// If we get in here we got the correct arch, now we just need to
// verify the UUID if one was given
@@ -970,7 +971,7 @@ Status ModuleList::GetSharedModule(const ModuleSpec &module_spec,
}
if (!module_sp) {
- module_sp.reset(new Module(platform_module_spec));
+ module_sp = std::make_shared<Module>(platform_module_spec);
// Make sure there are a module and an object file since we can specify a
// valid file path with an architecture that might not be in that file.
// By getting the object file we can guarantee that the architecture
diff --git a/source/Core/ValueObject.cpp b/source/Core/ValueObject.cpp
index 433733bea..b0a19620a 100644
--- a/source/Core/ValueObject.cpp
+++ b/source/Core/ValueObject.cpp
@@ -928,7 +928,7 @@ bool ValueObject::SetData(DataExtractor &data, Status &error) {
static bool CopyStringDataToBufferSP(const StreamString &source,
lldb::DataBufferSP &destination) {
- destination.reset(new DataBufferHeap(source.GetSize() + 1, 0));
+ destination = std::make_shared<DataBufferHeap>(source.GetSize() + 1, 0);
memcpy(destination->GetBytes(), source.GetString().data(), source.GetSize());
return true;
}
@@ -991,7 +991,7 @@ ValueObject::ReadPointedString(lldb::DataBufferSP &buffer_sp, Status &error,
CopyStringDataToBufferSP(s, buffer_sp);
return {0, was_capped};
}
- buffer_sp.reset(new DataBufferHeap(cstr_len, 0));
+ buffer_sp = std::make_shared<DataBufferHeap>(cstr_len, 0);
memcpy(buffer_sp->GetBytes(), cstr, cstr_len);
return {cstr_len, was_capped};
} else {
@@ -1168,7 +1168,7 @@ const char *ValueObject::GetValueAsCString() {
if (my_format != m_last_format || m_value_str.empty()) {
m_last_format = my_format;
if (!format_sp)
- format_sp.reset(new TypeFormatImpl_Format(my_format));
+ format_sp = std::make_shared<TypeFormatImpl_Format>(my_format);
if (GetValueAsCString(*format_sp.get(), m_value_str)) {
if (!m_value_did_change && m_old_value_valid) {
// The value was gotten successfully, so we consider the value as
diff --git a/source/DataFormatters/StringPrinter.cpp b/source/DataFormatters/StringPrinter.cpp
index 0f040e3dd..4dfe0250c 100644
--- a/source/DataFormatters/StringPrinter.cpp
+++ b/source/DataFormatters/StringPrinter.cpp
@@ -20,6 +20,7 @@
#include <ctype.h>
#include <locale>
+#include <memory>
using namespace lldb;
using namespace lldb_private;
@@ -306,7 +307,8 @@ static bool DumpUTFBufferToStream(
llvm::UTF8 *utf8_data_end_ptr = nullptr;
if (ConvertFunction) {
- utf8_data_buffer_sp.reset(new DataBufferHeap(4 * bufferSPSize, 0));
+ utf8_data_buffer_sp =
+ std::make_shared<DataBufferHeap>(4 * bufferSPSize, 0);
utf8_data_ptr = (llvm::UTF8 *)utf8_data_buffer_sp->GetBytes();
utf8_data_end_ptr = utf8_data_ptr + utf8_data_buffer_sp->GetByteSize();
ConvertFunction(&data_ptr, data_end_ptr, &utf8_data_ptr,
diff --git a/source/Expression/Materializer.cpp b/source/Expression/Materializer.cpp
index 545dcdcb1..0f871fcbe 100644
--- a/source/Expression/Materializer.cpp
+++ b/source/Expression/Materializer.cpp
@@ -23,6 +23,8 @@
#include "lldb/Utility/Log.h"
#include "lldb/Utility/RegisterValue.h"
+#include <memory>
+
using namespace lldb_private;
uint32_t Materializer::AddStructMember(Entity &entity) {
@@ -560,8 +562,8 @@ public:
m_temporary_allocation_size = data.GetByteSize();
- m_original_data.reset(
- new DataBufferHeap(data.GetDataStart(), data.GetByteSize()));
+ m_original_data = std::make_shared<DataBufferHeap>(data.GetDataStart(),
+ data.GetByteSize());
if (!alloc_error.Success()) {
err.SetErrorStringWithFormat(
@@ -1215,8 +1217,8 @@ public:
return;
}
- m_register_contents.reset(new DataBufferHeap(register_data.GetDataStart(),
- register_data.GetByteSize()));
+ m_register_contents = std::make_shared<DataBufferHeap>(
+ register_data.GetDataStart(), register_data.GetByteSize());
Status write_error;
diff --git a/source/Expression/REPL.cpp b/source/Expression/REPL.cpp
index 8a753f56d..08c3ce1f0 100644
--- a/source/Expression/REPL.cpp
+++ b/source/Expression/REPL.cpp
@@ -19,6 +19,8 @@
#include "lldb/Target/Thread.h"
#include "lldb/Utility/AnsiTerminal.h"
+#include <memory>
+
using namespace lldb_private;
REPL::REPL(LLVMCastKind kind, Target &target) : m_target(target), m_kind(kind) {
@@ -71,15 +73,15 @@ std::string REPL::GetSourcePath() {
lldb::IOHandlerSP REPL::GetIOHandler() {
if (!m_io_handler_sp) {
Debugger &debugger = m_target.GetDebugger();
- m_io_handler_sp.reset(
- new IOHandlerEditline(debugger, IOHandler::Type::REPL,
+ m_io_handler_sp = std::make_shared<IOHandlerEditline>(
+ debugger, IOHandler::Type::REPL,
"lldb-repl", // Name of input reader for history
llvm::StringRef("> "), // prompt
llvm::StringRef(". "), // Continuation prompt
true, // Multi-line
true, // The REPL prompt is always colored
1, // Line number
- *this));
+ *this);
// Don't exit if CTRL+C is pressed
static_cast<IOHandlerEditline *>(m_io_handler_sp.get())
diff --git a/source/Host/posix/ConnectionFileDescriptorPosix.cpp b/source/Host/posix/ConnectionFileDescriptorPosix.cpp
index 99c73c52e..6d3d1eae2 100644
--- a/source/Host/posix/ConnectionFileDescriptorPosix.cpp
+++ b/source/Host/posix/ConnectionFileDescriptorPosix.cpp
@@ -31,6 +31,7 @@
#include <unistd.h>
#endif
+#include <memory>
#include <sstream>
#include "llvm/Support/Errno.h"
@@ -86,8 +87,8 @@ ConnectionFileDescriptor::ConnectionFileDescriptor(bool child_processes_inherit)
ConnectionFileDescriptor::ConnectionFileDescriptor(int fd, bool owns_fd)
: Connection(), m_pipe(), m_mutex(), m_shutting_down(false),
m_waiting_for_accept(false), m_child_processes_inherit(false) {
- m_write_sp.reset(new File(fd, owns_fd));
- m_read_sp.reset(new File(fd, false));
+ m_write_sp = std::make_shared<File>(fd, owns_fd);
+ m_read_sp = std::make_shared<File>(fd, false);
Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_CONNECTION |
LIBLLDB_LOG_OBJECT));
@@ -221,8 +222,8 @@ ConnectionStatus ConnectionFileDescriptor::Connect(llvm::StringRef path,
m_read_sp = std::move(tcp_socket);
m_write_sp = m_read_sp;
} else {
- m_read_sp.reset(new File(fd, false));
- m_write_sp.reset(new File(fd, false));
+ m_read_sp = std::make_shared<File>(fd, false);
+ m_write_sp = std::make_shared<File>(fd, false);
}
m_uri = *addr;
return eConnectionStatusSuccess;
@@ -271,8 +272,8 @@ ConnectionStatus ConnectionFileDescriptor::Connect(llvm::StringRef path,
::fcntl(fd, F_SETFL, flags);
}
}
- m_read_sp.reset(new File(fd, true));
- m_write_sp.reset(new File(fd, false));
+ m_read_sp = std::make_shared<File>(fd, true);
+ m_write_sp = std::make_shared<File>(fd, false);
return eConnectionStatusSuccess;
}
#endif
diff --git a/source/Interpreter/CommandInterpreter.cpp b/source/Interpreter/CommandInterpreter.cpp
index 45fb3a05a..2ec595654 100644
--- a/source/Interpreter/CommandInterpreter.cpp
+++ b/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;
}
diff --git a/source/Interpreter/Property.cpp b/source/Interpreter/Property.cpp
index 4cabc3fd2..eafa7afc1 100644
--- a/source/Interpreter/Property.cpp
+++ b/source/Interpreter/Property.cpp
@@ -15,6 +15,8 @@
#include "lldb/Interpreter/OptionValues.h"
#include "lldb/Target/Language.h"
+#include <memory>
+
using namespace lldb;
using namespace lldb_private;
@@ -29,18 +31,20 @@ Property::Property(const PropertyDefinition &definition)
// "definition.default_uint_value" is not used
// "definition.default_cstr_value" as a string value that represents the
// default string value for the architecture/triple
- m_value_sp.reset(new OptionValueArch(definition.default_cstr_value));
+ m_value_sp =
+ std::make_shared<OptionValueArch>(definition.default_cstr_value);
break;
case OptionValue::eTypeArgs:
// "definition.default_uint_value" is always a OptionValue::Type
- m_value_sp.reset(new OptionValueArgs());
+ m_value_sp = std::make_shared<OptionValueArgs>();
break;
case OptionValue::eTypeArray:
// "definition.default_uint_value" is always a OptionValue::Type
- m_value_sp.reset(new OptionValueArray(OptionValue::ConvertTypeToMask(
- (OptionValue::Type)definition.default_uint_value)));
+ m_value_sp =
+ std::make_shared<OptionValueArray>(OptionValue::ConvertTypeToMask(
+ (OptionValue::Type)definition.default_uint_value));
break;
case OptionValue::eTypeBoolean:
@@ -49,11 +53,12 @@ Property::Property(const PropertyDefinition &definition)
// "definition.default_cstr_value" as a string value that represents the
// default value.
if (definition.default_cstr_value)
- m_value_sp.reset(new OptionValueBoolean(OptionArgParser::ToBoolean(
- llvm::StringRef(definition.default_cstr_value), false, nullptr)));
+ m_value_sp =
+ std::make_shared<OptionValueBoolean>(OptionArgParser::ToBoolean(
+ llvm::StringRef(definition.default_cstr_value), false, nullptr));
else
- m_value_sp.reset(
- new OptionValueBoolean(definition.default_uint_value != 0));
+ m_value_sp = std::make_shared<OptionValueBoolean>(
+ definition.default_uint_value != 0);
break;
case OptionValue::eTypeChar: {
@@ -64,8 +69,9 @@ Property::Property(const PropertyDefinition &definition)
}
case OptionValue::eTypeDictionary:
// "definition.default_uint_value" is always a OptionValue::Type
- m_value_sp.reset(new OptionValueDictionary(OptionValue::ConvertTypeToMask(
- (OptionValue::Type)definition.default_uint_value)));
+ m_value_sp =
+ std::make_shared<OptionValueDictionary>(OptionValue::ConvertTypeToMask(
+ (OptionValue::Type)definition.default_uint_value));
break;
case OptionValue::eTypeEnum:
@@ -100,14 +106,14 @@ Property::Property(const PropertyDefinition &definition)
FileSpec file_spec = FileSpec(definition.default_cstr_value);
if (resolve)
FileSystem::Instance().Resolve(file_spec);
- m_value_sp.reset(new OptionValueFileSpec(file_spec, resolve));
+ m_value_sp = std::make_shared<OptionValueFileSpec>(file_spec, resolve);
break;
}
case OptionValue::eTypeFileSpecList:
// "definition.default_uint_value" is not used for a
// OptionValue::eTypeFileSpecList
- m_value_sp.reset(new OptionValueFileSpecList());
+ m_value_sp = std::make_shared<OptionValueFileSpecList>();
break;
case OptionValue::eTypeFormat:
@@ -122,7 +128,7 @@ Property::Property(const PropertyDefinition &definition)
nullptr);
else
new_format = (Format)definition.default_uint_value;
- m_value_sp.reset(new OptionValueFormat(new_format));
+ m_value_sp = std::make_shared<OptionValueFormat>(new_format);
}
break;
@@ -138,29 +144,30 @@ Property::Property(const PropertyDefinition &definition)
llvm::StringRef(definition.default_cstr_value));
else
new_lang = (LanguageType)definition.default_uint_value;
- m_value_sp.reset(new OptionValueLanguage(new_lang));
+ m_value_sp = std::make_shared<OptionValueLanguage>(new_lang);
}
break;
case OptionValue::eTypeFormatEntity:
// "definition.default_cstr_value" as a string value that represents the
// default
- m_value_sp.reset(
- new OptionValueFormatEntity(definition.default_cstr_value));
+ m_value_sp = std::make_shared<OptionValueFormatEntity>(
+ definition.default_cstr_value);
break;
case OptionValue::eTypePathMap:
// "definition.default_uint_value" tells us if notifications should occur
// for path mappings
- m_value_sp.reset(
- new OptionValuePathMappings(definition.default_uint_value != 0));
+ m_value_sp = std::make_shared<OptionValuePathMappings>(
+ definition.default_uint_value != 0);
break;
case OptionValue::eTypeRegex:
// "definition.default_uint_value" is used to the regular expression flags
// "definition.default_cstr_value" the default regular expression value
// value.
- m_value_sp.reset(new OptionValueRegex(definition.default_cstr_value));
+ m_value_sp =
+ std::make_shared<OptionValueRegex>(definition.default_cstr_value);
break;
case OptionValue::eTypeSInt64:
@@ -168,10 +175,10 @@ Property::Property(const PropertyDefinition &definition)
// "definition.default_cstr_value" is NULL, otherwise interpret
// "definition.default_cstr_value" as a string value that represents the
// default value.
- m_value_sp.reset(new OptionValueSInt64(
+ m_value_sp = std::make_shared<OptionValueSInt64>(
definition.default_cstr_value
? StringConvert::ToSInt64(definition.default_cstr_value)
- : definition.default_uint_value));
+ : definition.default_uint_value);
break;
case OptionValue::eTypeUInt64:
@@ -179,10 +186,10 @@ Property::Property(const PropertyDefinition &definition)
// "definition.default_cstr_value" is NULL, otherwise interpret
// "definition.default_cstr_value" as a string value that represents the
// default value.
- m_value_sp.reset(new OptionValueUInt64(
+ m_value_sp = std::make_shared<OptionValueUInt64>(
definition.default_cstr_value
? StringConvert::ToUInt64(definition.default_cstr_value)
- : definition.default_uint_value));
+ : definition.default_uint_value);
break;
case OptionValue::eTypeUUID:
@@ -192,7 +199,7 @@ Property::Property(const PropertyDefinition &definition)
UUID uuid;
if (definition.default_cstr_value)
uuid.SetFromStringRef(definition.default_cstr_value);
- m_value_sp.reset(new OptionValueUUID(uuid));
+ m_value_sp = std::make_shared<OptionValueUUID>(uuid);
}
break;
diff --git a/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp b/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
index f1b8d64b6..d8f3e3d36 100644
--- a/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
+++ b/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
@@ -31,6 +31,8 @@
#include "DynamicLoaderDarwinKernel.h"
+#include <memory>
+
//#define ENABLE_DEBUG_PRINTF // COMMENT THIS LINE OUT PRIOR TO CHECKIN
#ifdef ENABLE_DEBUG_PRINTF
#include <stdio.h>
@@ -87,7 +89,7 @@ public:
}
DynamicLoaderDarwinKernelProperties() : Properties() {
- m_collection_sp.reset(new OptionValueProperties(GetSettingName()));
+ m_collection_sp = std::make_shared<OptionValueProperties>(GetSettingName());
m_collection_sp->Initialize(g_properties);
}
@@ -112,7 +114,7 @@ typedef std::shared_ptr<DynamicLoaderDarwinKernelProperties>
static const DynamicLoaderDarwinKernelPropertiesSP &GetGlobalProperties() {
static DynamicLoaderDarwinKernelPropertiesSP g_settings_sp;
if (!g_settings_sp)
- g_settings_sp.reset(new DynamicLoaderDarwinKernelProperties());
+ g_settings_sp = std::make_shared<DynamicLoaderDarwinKernelProperties>();
return g_settings_sp;
}
@@ -791,8 +793,8 @@ bool DynamicLoaderDarwinKernel::KextImageInfo::LoadImageUsingMemoryModule(
if (IsKernel()) {
if (Symbols::DownloadObjectAndSymbolFile(module_spec, true)) {
if (FileSystem::Instance().Exists(module_spec.GetFileSpec())) {
- m_module_sp.reset(new Module(module_spec.GetFileSpec(),
- target.GetArchitecture()));
+ m_module_sp = std::make_shared<Module>(module_spec.GetFileSpec(),
+ target.GetArchitecture());
if (m_module_sp.get() &&
m_module_sp->MatchesModuleSpec(module_spec)) {
ModuleList loaded_module_list;
diff --git a/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp b/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp
index 1e4dc3f60..a9e643acc 100644
--- a/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp
+++ b/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp
@@ -20,6 +20,8 @@
#include "DynamicLoaderHexagonDYLD.h"
+#include <memory>
+
using namespace lldb;
using namespace lldb_private;
@@ -454,7 +456,8 @@ DynamicLoaderHexagonDYLD::GetStepThroughTrampolinePlan(Thread &thread,
llvm::sort(start, end);
addrs.erase(std::unique(start, end), end);
- thread_plan_sp.reset(new ThreadPlanRunToAddress(thread, addrs, stop));
+ thread_plan_sp =
+ std::make_shared<ThreadPlanRunToAddress>(thread, addrs, stop);
}
return thread_plan_sp;
diff --git a/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp b/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp
index 6f7e93d17..c561eb401 100644
--- a/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp
+++ b/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp
@@ -46,6 +46,8 @@
#include <uuid/uuid.h>
#endif
+#include <memory>
+
using namespace lldb;
using namespace lldb_private;
@@ -939,8 +941,8 @@ DynamicLoaderDarwin::GetStepThroughTrampolinePlan(Thread &thread,
load_addrs.push_back(address.GetLoadAddress(target_sp.get()));
}
}
- thread_plan_sp.reset(
- new ThreadPlanRunToAddress(thread, load_addrs, stop_others));
+ thread_plan_sp = std::make_shared<ThreadPlanRunToAddress>(
+ thread, load_addrs, stop_others);
}
} else {
if (log)
diff --git a/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp b/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
index 96d9db5dd..b90ba2417 100644
--- a/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
+++ b/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
@@ -26,6 +26,7 @@
#include "lldb/Target/ThreadPlanRunToAddress.h"
#include "lldb/Utility/Log.h"
+#include <memory>
using namespace lldb;
using namespace lldb_private;
@@ -497,7 +498,8 @@ DynamicLoaderPOSIXDYLD::GetStepThroughTrampolinePlan(Thread &thread,
llvm::sort(start, end);
addrs.erase(std::unique(start, end), end);
- thread_plan_sp.reset(new ThreadPlanRunToAddress(thread, addrs, stop));
+ thread_plan_sp =
+ std::make_shared<ThreadPlanRunToAddress>(thread, addrs, stop);
}
return thread_plan_sp;
diff --git a/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp b/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
index fbc468250..316f06295 100644
--- a/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
+++ b/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
@@ -26,6 +26,7 @@
#include "clang/AST/ASTContext.h"
#include "clang/AST/RecordLayout.h"
+#include <memory>
#include <vector>
using namespace clang;
@@ -707,7 +708,7 @@ void ClangASTSource::FindExternalVisibleDecls(NameSearchContext &context) {
return; // otherwise we may need to fall back
}
- context.m_namespace_map.reset(new ClangASTImporter::NamespaceMap);
+ context.m_namespace_map = std::make_shared<ClangASTImporter::NamespaceMap>();
if (const NamespaceDecl *namespace_context =
dyn_cast<NamespaceDecl>(context.m_decl_context)) {
diff --git a/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp b/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
index 27985d02d..a22313073 100644
--- a/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
+++ b/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
@@ -6,7 +6,6 @@
//
//===----------------------------------------------------------------------===//
-#include <cctype>
#include "clang/AST/ASTContext.h"
#include "clang/AST/ASTDiagnostic.h"
#include "clang/AST/ExternalASTSource.h"
@@ -89,6 +88,9 @@
#include "lldb/Utility/StreamString.h"
#include "lldb/Utility/StringList.h"
+#include <cctype>
+#include <memory>
+
using namespace clang;
using namespace llvm;
using namespace lldb_private;
@@ -1104,11 +1106,11 @@ lldb_private::Status ClangExpressionParser::PrepareForExecution(
custom_passes.EarlyPasses->run(*llvm_module_ap);
}
- execution_unit_sp.reset(
- new IRExecutionUnit(m_llvm_context, // handed off here
+ execution_unit_sp = std::make_shared<IRExecutionUnit>(
+ m_llvm_context, // handed off here
llvm_module_ap, // handed off here
function_name, exe_ctx.GetTargetSP(), sc,
- m_compiler->getTargetOpts().Features));
+ m_compiler->getTargetOpts().Features);
ClangExpressionHelper *type_system_helper =
dyn_cast<ClangExpressionHelper>(m_expr.GetTypeSystemHelper());
diff --git a/source/Plugins/InstrumentationRuntime/MainThreadChecker/MainThreadCheckerRuntime.cpp b/source/Plugins/InstrumentationRuntime/MainThreadChecker/MainThreadCheckerRuntime.cpp
index b23254c8d..297dd2b58 100644
--- a/source/Plugins/InstrumentationRuntime/MainThreadChecker/MainThreadCheckerRuntime.cpp
+++ b/source/Plugins/InstrumentationRuntime/MainThreadChecker/MainThreadCheckerRuntime.cpp
@@ -24,6 +24,8 @@
#include "lldb/Utility/RegularExpression.h"
#include "Plugins/Process/Utility/HistoryThread.h"
+#include <memory>
+
using namespace lldb;
using namespace lldb_private;
@@ -238,7 +240,7 @@ lldb::ThreadCollectionSP
MainThreadCheckerRuntime::GetBacktracesFromExtendedStopInfo(
StructuredData::ObjectSP info) {
ThreadCollectionSP threads;
- threads.reset(new ThreadCollection());
+ threads = std::make_shared<ThreadCollection>();
ProcessSP process_sp = GetProcessSP();
diff --git a/source/Plugins/InstrumentationRuntime/TSan/TSanRuntime.cpp b/source/Plugins/InstrumentationRuntime/TSan/TSanRuntime.cpp
index 3c195accb..aa615837c 100644
--- a/source/Plugins/InstrumentationRuntime/TSan/TSanRuntime.cpp
+++ b/source/Plugins/InstrumentationRuntime/TSan/TSanRuntime.cpp
@@ -30,6 +30,8 @@
#include "lldb/Utility/RegularExpression.h"
#include "lldb/Utility/Stream.h"
+#include <memory>
+
using namespace lldb;
using namespace lldb_private;
@@ -1050,7 +1052,7 @@ lldb::ThreadCollectionSP
ThreadSanitizerRuntime::GetBacktracesFromExtendedStopInfo(
StructuredData::ObjectSP info) {
ThreadCollectionSP threads;
- threads.reset(new ThreadCollection());
+ threads = std::make_shared<ThreadCollection>();
if (info->GetObjectForDotSeparatedPath("instrumentation_class")
->GetStringValue() != "ThreadSanitizer")
diff --git a/source/Plugins/InstrumentationRuntime/UBSan/UBSanRuntime.cpp b/source/Plugins/InstrumentationRuntime/UBSan/UBSanRuntime.cpp
index e400b8160..8445954be 100644
--- a/source/Plugins/InstrumentationRuntime/UBSan/UBSanRuntime.cpp
+++ b/source/Plugins/InstrumentationRuntime/UBSan/UBSanRuntime.cpp
@@ -31,6 +31,8 @@
#include "lldb/Utility/Stream.h"
#include <ctype.h>
+#include <memory>
+
using namespace lldb;
using namespace lldb_private;
@@ -303,7 +305,7 @@ lldb::ThreadCollectionSP
UndefinedBehaviorSanitizerRuntime::GetBacktracesFromExtendedStopInfo(
StructuredData::ObjectSP info) {
ThreadCollectionSP threads;
- threads.reset(new ThreadCollection());
+ threads = std::make_shared<ThreadCollection>();
ProcessSP process_sp = GetProcessSP();
diff --git a/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp b/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp
index 7b19ca484..857ef4632 100644
--- a/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp
+++ b/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp
@@ -29,6 +29,8 @@
#include "JITLoaderGDB.h"
+#include <memory>
+
using namespace lldb;
using namespace lldb_private;
@@ -70,7 +72,7 @@ public:
}
PluginProperties() {
- m_collection_sp.reset(new OptionValueProperties(GetSettingName()));
+ m_collection_sp = std::make_shared<OptionValueProperties>(GetSettingName());
m_collection_sp->Initialize(g_properties);
}
@@ -402,7 +404,7 @@ JITLoaderSP JITLoaderGDB::CreateInstance(Process *process, bool force) {
JITLoaderSP jit_loader_sp;
ArchSpec arch(process->GetTarget().GetArchitecture());
if (arch.GetTriple().getVendor() != llvm::Triple::Apple)
- jit_loader_sp.reset(new JITLoaderGDB(process));
+ jit_loader_sp = std::make_shared<JITLoaderGDB>(process);
return jit_loader_sp;
}
diff --git a/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp b/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp
index fde994737..1b1778293 100644
--- a/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp
+++ b/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp
@@ -31,6 +31,7 @@
#include "lldb/Utility/Status.h"
#include "lldb/Utility/StreamString.h"
+#include <memory>
#include <vector>
using namespace lldb;
@@ -111,10 +112,10 @@ AppleObjCRuntimeV1::CreateExceptionResolver(Breakpoint *bkpt, bool catch_bp,
BreakpointResolverSP resolver_sp;
if (throw_bp)
- resolver_sp.reset(new BreakpointResolverName(
+ resolver_sp = std::make_shared<BreakpointResolverName>(
bkpt, std::get<1>(GetExceptionThrowLocation()).AsCString(),
eFunctionNameTypeBase, eLanguageTypeUnknown, Breakpoint::Exact, 0,
- eLazyBoolNo));
+ eLazyBoolNo);
// FIXME: don't do catch yet.
return resolver_sp;
}
diff --git a/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp b/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
index 96e2c098e..cd7f332c6 100644
--- a/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
+++ b/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
@@ -8,6 +8,7 @@
#include <stdint.h>
+#include <memory>
#include <string>
#include <vector>
@@ -803,10 +804,10 @@ AppleObjCRuntimeV2::CreateExceptionResolver(Breakpoint *bkpt, bool catch_bp,
BreakpointResolverSP resolver_sp;
if (throw_bp)
- resolver_sp.reset(new BreakpointResolverName(
+ resolver_sp = std::make_shared<BreakpointResolverName>(
bkpt, std::get<1>(GetExceptionThrowLocation()).AsCString(),
eFunctionNameTypeBase, eLanguageTypeUnknown, Breakpoint::Exact, 0,
- eLazyBoolNo));
+ eLazyBoolNo);
// FIXME: We don't do catch breakpoints for ObjC yet.
// Should there be some way for the runtime to specify what it can do in this
// regard?
@@ -2549,7 +2550,8 @@ bool AppleObjCRuntimeV2::NonPointerISACache::EvaluateNonPointerISA(
ObjCLanguageRuntime::EncodingToTypeSP AppleObjCRuntimeV2::GetEncodingToType() {
if (!m_encoding_to_type_sp)
- m_encoding_to_type_sp.reset(new AppleObjCTypeEncodingParser(*this));
+ m_encoding_to_type_sp =
+ std::make_shared<AppleObjCTypeEncodingParser>(*this);
return m_encoding_to_type_sp;
}
diff --git a/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp b/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp
index aeb8294b7..bd7484483 100644
--- a/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp
+++ b/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp
@@ -8,7 +8,6 @@
//===----------------------------------------------------------------------===//
#include "AppleObjCTrampolineHandler.h"
-
#include "AppleThreadPlanStepThroughObjCTrampoline.h"
#include "lldb/Breakpoint/StoppointCallbackContext.h"
@@ -36,6 +35,8 @@
#include "llvm/ADT/STLExtras.h"
+#include <memory>
+
using namespace lldb;
using namespace lldb_private;
@@ -1048,8 +1049,8 @@ AppleObjCTrampolineHandler::GetStepThroughDispatchPlan(Thread &thread,
log->Printf("Found implementation address in cache: 0x%" PRIx64,
impl_addr);
- ret_plan_sp.reset(
- new ThreadPlanRunToAddress(thread, impl_addr, stop_others));
+ ret_plan_sp = std::make_shared<ThreadPlanRunToAddress>(thread, impl_addr,
+ stop_others);
} else {
// We haven't seen this class/selector pair yet. Look it up.
StreamString errors;
@@ -1128,9 +1129,9 @@ AppleObjCTrampolineHandler::GetStepThroughDispatchPlan(Thread &thread,
// is not safe to run only one thread. So we override the
// stop_others value passed in to us here:
const bool trampoline_stop_others = false;
- ret_plan_sp.reset(new AppleThreadPlanStepThroughObjCTrampoline(
+ ret_plan_sp = std::make_shared<AppleThreadPlanStepThroughObjCTrampoline>(
thread, this, dispatch_values, isa_addr, sel_addr,
- trampoline_stop_others));
+ trampoline_stop_others);
if (log) {
StreamString s;
ret_plan_sp->GetDescription(&s, eDescriptionLevelFull);
diff --git a/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.cpp b/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.cpp
index 85fd6620c..bbfd8075d 100644
--- a/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.cpp
+++ b/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.cpp
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
#include "AppleThreadPlanStepThroughObjCTrampoline.h"
+
#include "AppleObjCTrampolineHandler.h"
#include "lldb/Expression/DiagnosticManager.h"
#include "lldb/Expression/FunctionCaller.h"
@@ -20,6 +21,8 @@
#include "lldb/Target/ThreadPlanStepOut.h"
#include "lldb/Utility/Log.h"
+#include <memory>
+
using namespace lldb;
using namespace lldb_private;
@@ -183,8 +186,8 @@ bool AppleThreadPlanStepThroughObjCTrampoline::ShouldStop(Event *event_ptr) {
// Extract the target address from the value:
- m_run_to_sp.reset(
- new ThreadPlanRunToAddress(m_thread, target_so_addr, m_stop_others));
+ m_run_to_sp = std::make_shared<ThreadPlanRunToAddress>(
+ m_thread, target_so_addr, m_stop_others);
m_thread.QueueThreadPlan(m_run_to_sp, false);
m_run_to_sp->SetPrivate(true);
return false;
diff --git a/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp b/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
index bae1da0ed..b6739345c 100644
--- a/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
+++ b/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
@@ -6,8 +6,6 @@
//
//===----------------------------------------------------------------------===//
-#include "llvm/ADT/StringSwitch.h"
-
#include "RenderScriptRuntime.h"
#include "RenderScriptScriptGroup.h"
@@ -40,6 +38,10 @@
#include "lldb/Utility/RegularExpression.h"
#include "lldb/Utility/Status.h"
+#include "llvm/ADT/StringSwitch.h"
+
+#include <memory>
+
using namespace lldb;
using namespace lldb_private;
using namespace lldb_renderscript;
@@ -1211,7 +1213,7 @@ void RenderScriptRuntime::CaptureDebugHintScriptGroup2(
}
}
if (!group) {
- group.reset(new RSScriptGroupDescriptor);
+ group = std::make_shared<RSScriptGroupDescriptor>();
group->m_name = group_name;
m_scriptGroups.push_back(group);
} else {
@@ -2854,7 +2856,7 @@ bool RenderScriptRuntime::LoadModule(const lldb::ModuleSP &module_sp) {
switch (GetModuleKind(module_sp)) {
case eModuleKindKernelObj: {
RSModuleDescriptorSP module_desc;
- module_desc.reset(new RSModuleDescriptor(module_sp));
+ module_desc = std::make_shared<RSModuleDescriptor>(module_sp);
if (module_desc->ParseRSInfo()) {
m_rsmodules.push_back(module_desc);
module_desc->WarnIfVersionMismatch(GetProcess()
diff --git a/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp b/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
index 4046082c0..dc583815d 100644
--- a/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
+++ b/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
@@ -59,6 +59,8 @@
#include <uuid/uuid.h>
#endif
+#include <memory>
+
#define THUMB_ADDRESS_BIT_MASK 0xfffffffffffffffeull
using namespace lldb;
using namespace lldb_private;
@@ -1645,7 +1647,7 @@ void ObjectFileMachO::ProcessSegmentCommand(const load_command &load_cmd_,
// conflict with any of the sections.
SectionSP segment_sp;
if (add_section && (const_segname || is_core)) {
- segment_sp.reset(new Section(
+ segment_sp = std::make_shared<Section>(
module_sp, // Module to which this section belongs
this, // Object file to which this sections belongs
++context.NextSegmentIdx
@@ -1663,7 +1665,7 @@ void ObjectFileMachO::ProcessSegmentCommand(const load_command &load_cmd_,
load_cmd.filesize, // Size in bytes of this section as found
// in the file
0, // Segments have no alignment information
- load_cmd.flags)); // Flags for this section
+ load_cmd.flags); // Flags for this section
segment_sp->SetIsEncrypted(segment_is_encrypted);
m_sections_ap->AddSection(segment_sp);
@@ -1784,7 +1786,7 @@ void ObjectFileMachO::ProcessSegmentCommand(const load_command &load_cmd_,
}
} else {
// Create a fake section for the section's named segment
- segment_sp.reset(new Section(
+ segment_sp = std::make_shared<Section>(
segment_sp, // Parent section
module_sp, // Module to which this section belongs
this, // Object file to which this section belongs
@@ -1805,7 +1807,7 @@ void ObjectFileMachO::ProcessSegmentCommand(const load_command &load_cmd_,
// this section as
// found in the file
sect64.align,
- load_cmd.flags)); // Flags for this section
+ load_cmd.flags); // Flags for this section
segment_sp->SetIsFake(true);
segment_sp->SetPermissions(segment_permissions);
m_sections_ap->AddSection(segment_sp);
@@ -5525,19 +5527,23 @@ ObjectFileMachO::GetThreadContextAtIndex(uint32_t idx,
switch (m_header.cputype) {
case llvm::MachO::CPU_TYPE_ARM64:
- reg_ctx_sp.reset(new RegisterContextDarwin_arm64_Mach(thread, data));
+ reg_ctx_sp =
+ std::make_shared<RegisterContextDarwin_arm64_Mach>(thread, data);
break;
case llvm::MachO::CPU_TYPE_ARM:
- reg_ctx_sp.reset(new RegisterContextDarwin_arm_Mach(thread, data));
+ reg_ctx_sp =
+ std::make_shared<RegisterContextDarwin_arm_Mach>(thread, data);
break;
case llvm::MachO::CPU_TYPE_I386:
- reg_ctx_sp.reset(new RegisterContextDarwin_i386_Mach(thread, data));
+ reg_ctx_sp =
+ std::make_shared<RegisterContextDarwin_i386_Mach>(thread, data);
break;
case llvm::MachO::CPU_TYPE_X86_64:
- reg_ctx_sp.reset(new RegisterContextDarwin_x86_64_Mach(thread, data));
+ reg_ctx_sp =
+ std::make_shared<RegisterContextDarwin_x86_64_Mach>(thread, data);
break;
}
}
diff --git a/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp b/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp
index 7ef0611a4..32cee742e 100644
--- a/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp
+++ b/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;
}
diff --git a/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp b/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
index 10a931e76..68d53c2ca 100644
--- a/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
+++ b/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
@@ -11,6 +11,7 @@
#include <string.h>
#include <algorithm>
+#include <memory>
#include <mutex>
#include "lldb/Breakpoint/BreakpointLocation.h"
@@ -262,7 +263,7 @@ lldb_private::Status PlatformDarwin::GetSharedModuleWithLocalCache(
module_spec.GetFileSpec().GetFilename().AsCString());
ModuleSpec local_spec(module_cache_spec,
module_spec.GetArchitecture());
- module_sp.reset(new Module(local_spec));
+ module_sp = std::make_shared<Module>(local_spec);
module_sp->SetPlatformFileSpec(module_spec.GetFileSpec());
return Status();
}
@@ -300,7 +301,7 @@ lldb_private::Status PlatformDarwin::GetSharedModuleWithLocalCache(
}
ModuleSpec local_spec(module_cache_spec, module_spec.GetArchitecture());
- module_sp.reset(new Module(local_spec));
+ module_sp = std::make_shared<Module>(local_spec);
module_sp->SetPlatformFileSpec(module_spec.GetFileSpec());
Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM));
if (log)
@@ -328,7 +329,7 @@ lldb_private::Status PlatformDarwin::GetSharedModuleWithLocalCache(
module_spec.GetFileSpec().GetDirectory().AsCString(),
module_spec.GetFileSpec().GetFilename().AsCString());
ModuleSpec local_spec(module_cache_spec, module_spec.GetArchitecture());
- module_sp.reset(new Module(local_spec));
+ module_sp = std::make_shared<Module>(local_spec);
module_sp->SetPlatformFileSpec(module_spec.GetFileSpec());
return Status();
} else
diff --git a/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp b/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp
index 30b1b41e2..8aa1d144a 100644
--- a/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp
+++ b/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp
@@ -35,6 +35,8 @@
#include <CoreFoundation/CoreFoundation.h>
+#include <memory>
+
#include "Host/macosx/cfcpp/CFCBundle.h"
using namespace lldb;
@@ -200,7 +202,7 @@ public:
}
PlatformDarwinKernelProperties() : Properties() {
- m_collection_sp.reset(new OptionValueProperties(GetSettingName()));
+ m_collection_sp = std::make_shared<OptionValueProperties>(GetSettingName());
m_collection_sp->Initialize(g_properties);
}
@@ -228,7 +230,7 @@ typedef std::shared_ptr<PlatformDarwinKernelProperties>
static const PlatformDarwinKernelPropertiesSP &GetGlobalProperties() {
static PlatformDarwinKernelPropertiesSP g_settings_sp;
if (!g_settings_sp)
- g_settings_sp.reset(new PlatformDarwinKernelProperties());
+ g_settings_sp = std::make_shared<PlatformDarwinKernelProperties>();
return g_settings_sp;
}
diff --git a/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp b/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
index ef13bd733..f95dc23c3 100644
--- a/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
+++ b/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
@@ -9,6 +9,7 @@
#include <errno.h>
#include <stdlib.h>
+#include <memory>
#include <mutex>
#include "lldb/Core/Debugger.h"
@@ -63,7 +64,7 @@ public:
}
PluginProperties() : Properties() {
- m_collection_sp.reset(new OptionValueProperties(GetSettingName()));
+ m_collection_sp = std::make_shared<OptionValueProperties>(GetSettingName());
m_collection_sp->Initialize(g_properties);
}
@@ -81,7 +82,7 @@ typedef std::shared_ptr<PluginProperties> ProcessKDPPropertiesSP;
static const ProcessKDPPropertiesSP &GetGlobalPluginProperties() {
static ProcessKDPPropertiesSP g_settings_sp;
if (!g_settings_sp)
- g_settings_sp.reset(new PluginProperties());
+ g_settings_sp = std::make_shared<PluginProperties>();
return g_settings_sp;
}
@@ -108,7 +109,7 @@ lldb::ProcessSP ProcessKDP::CreateInstance(TargetSP target_sp,
const FileSpec *crash_file_path) {
lldb::ProcessSP process_sp;
if (crash_file_path == NULL)
- process_sp.reset(new ProcessKDP(target_sp, listener_sp));
+ process_sp = std::make_shared<ProcessKDP>(target_sp, listener_sp);
return process_sp;
}
@@ -505,7 +506,7 @@ lldb::ThreadSP ProcessKDP::GetKernelThread() {
ThreadSP thread_sp(m_kernel_thread_wp.lock());
if (!thread_sp) {
- thread_sp.reset(new ThreadKDP(*this, g_kernel_tid));
+ thread_sp = std::make_shared<ThreadKDP>(*this, g_kernel_tid);
m_kernel_thread_wp = thread_sp;
}
return thread_sp;
@@ -1030,7 +1031,7 @@ public:
CommandObject *ProcessKDP::GetPluginCommandObject() {
if (!m_command_sp)
- m_command_sp.reset(new CommandObjectMultiwordProcessKDP(
- GetTarget().GetDebugger().GetCommandInterpreter()));
+ m_command_sp = std::make_shared<CommandObjectMultiwordProcessKDP>(
+ GetTarget().GetDebugger().GetCommandInterpreter());
return m_command_sp.get();
}
diff --git a/source/Plugins/Process/MacOSX-Kernel/ThreadKDP.cpp b/source/Plugins/Process/MacOSX-Kernel/ThreadKDP.cpp
index d0e78a8e7..341c6329a 100644
--- a/source/Plugins/Process/MacOSX-Kernel/ThreadKDP.cpp
+++ b/source/Plugins/Process/MacOSX-Kernel/ThreadKDP.cpp
@@ -29,6 +29,8 @@
#include "RegisterContextKDP_i386.h"
#include "RegisterContextKDP_x86_64.h"
+#include <memory>
+
using namespace lldb;
using namespace lldb_private;
@@ -98,19 +100,20 @@ ThreadKDP::CreateRegisterContextForFrame(StackFrame *frame) {
->GetCommunication()
.GetCPUType()) {
case llvm::MachO::CPU_TYPE_ARM:
- reg_ctx_sp.reset(new RegisterContextKDP_arm(*this, concrete_frame_idx));
+ reg_ctx_sp =
+ std::make_shared<RegisterContextKDP_arm>(*this, concrete_frame_idx);
break;
case llvm::MachO::CPU_TYPE_ARM64:
- reg_ctx_sp.reset(
- new RegisterContextKDP_arm64(*this, concrete_frame_idx));
+ reg_ctx_sp = std::make_shared<RegisterContextKDP_arm64>(
+ *this, concrete_frame_idx);
break;
case llvm::MachO::CPU_TYPE_I386:
- reg_ctx_sp.reset(
- new RegisterContextKDP_i386(*this, concrete_frame_idx));
+ reg_ctx_sp = std::make_shared<RegisterContextKDP_i386>(
+ *this, concrete_frame_idx);
break;
case llvm::MachO::CPU_TYPE_X86_64:
- reg_ctx_sp.reset(
- new RegisterContextKDP_x86_64(*this, concrete_frame_idx));
+ reg_ctx_sp = std::make_shared<RegisterContextKDP_x86_64>(
+ *this, concrete_frame_idx);
break;
default:
llvm_unreachable("Add CPU type support in KDP");
diff --git a/source/Plugins/Process/Utility/HistoryThread.cpp b/source/Plugins/Process/Utility/HistoryThread.cpp
index fc3b1f158..a2b71b587 100644
--- a/source/Plugins/Process/Utility/HistoryThread.cpp
+++ b/source/Plugins/Process/Utility/HistoryThread.cpp
@@ -9,6 +9,7 @@
#include "lldb/lldb-private.h"
#include "Plugins/Process/Utility/HistoryThread.h"
+
#include "Plugins/Process/Utility/HistoryUnwind.h"
#include "Plugins/Process/Utility/RegisterContextHistory.h"
@@ -16,6 +17,8 @@
#include "lldb/Target/StackFrameList.h"
#include "lldb/Utility/Log.h"
+#include <memory>
+
using namespace lldb;
using namespace lldb_private;
@@ -48,8 +51,8 @@ HistoryThread::~HistoryThread() {
lldb::RegisterContextSP HistoryThread::GetRegisterContext() {
RegisterContextSP rctx;
if (m_pcs.size() > 0) {
- rctx.reset(new RegisterContextHistory(
- *this, 0, GetProcess()->GetAddressByteSize(), m_pcs[0]));
+ rctx = std::make_shared<RegisterContextHistory>(
+ *this, 0, GetProcess()->GetAddressByteSize(), m_pcs[0]);
}
return rctx;
}
@@ -64,7 +67,8 @@ lldb::StackFrameListSP HistoryThread::GetStackFrameList() {
std::unique_lock<std::mutex> lock(m_framelist_mutex);
lock.unlock();
if (m_framelist.get() == NULL) {
- m_framelist.reset(new StackFrameList(*this, StackFrameListSP(), true));
+ m_framelist =
+ std::make_shared<StackFrameList>(*this, StackFrameListSP(), true);
}
return m_framelist;
diff --git a/source/Plugins/Process/Utility/HistoryUnwind.cpp b/source/Plugins/Process/Utility/HistoryUnwind.cpp
index 71119a5c4..023469d4c 100644
--- a/source/Plugins/Process/Utility/HistoryUnwind.cpp
+++ b/source/Plugins/Process/Utility/HistoryUnwind.cpp
@@ -16,6 +16,8 @@
#include "lldb/Target/Target.h"
#include "lldb/Target/Thread.h"
+#include <memory>
+
using namespace lldb;
using namespace lldb_private;
@@ -42,9 +44,9 @@ HistoryUnwind::DoCreateRegisterContextForFrame(StackFrame *frame) {
addr_t pc = frame->GetFrameCodeAddress().GetLoadAddress(
&frame->GetThread()->GetProcess()->GetTarget());
if (pc != LLDB_INVALID_ADDRESS) {
- rctx.reset(new RegisterContextHistory(
+ rctx = std::make_shared<RegisterContextHistory>(
*frame->GetThread().get(), frame->GetConcreteFrameIndex(),
- frame->GetThread()->GetProcess()->GetAddressByteSize(), pc));
+ frame->GetThread()->GetProcess()->GetAddressByteSize(), pc);
}
}
return rctx;
diff --git a/source/Plugins/Process/Utility/RegisterContextDarwin_arm.cpp b/source/Plugins/Process/Utility/RegisterContextDarwin_arm.cpp
index bcb58d2a5..10609ce88 100644
--- a/source/Plugins/Process/Utility/RegisterContextDarwin_arm.cpp
+++ b/source/Plugins/Process/Utility/RegisterContextDarwin_arm.cpp
@@ -19,6 +19,8 @@
#include "Plugins/Process/Utility/InstructionUtils.h"
+#include <memory>
+
// Support building against older versions of LLVM, this macro was added
// recently.
#ifndef LLVM_EXTENSION
@@ -1296,7 +1298,7 @@ bool RegisterContextDarwin_arm::WriteRegister(const RegisterInfo *reg_info,
bool RegisterContextDarwin_arm::ReadAllRegisterValues(
lldb::DataBufferSP &data_sp) {
- data_sp.reset(new DataBufferHeap(REG_CONTEXT_SIZE, 0));
+ data_sp = std::make_shared<DataBufferHeap>(REG_CONTEXT_SIZE, 0);
if (data_sp && ReadGPR(false) == KERN_SUCCESS &&
ReadFPU(false) == KERN_SUCCESS && ReadEXC(false) == KERN_SUCCESS) {
uint8_t *dst = data_sp->GetBytes();
diff --git a/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.cpp b/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.cpp
index 0fd71205a..308cf1519 100644
--- a/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.cpp
+++ b/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.cpp
@@ -23,6 +23,8 @@
#include "Plugins/Process/Utility/InstructionUtils.h"
+#include <memory>
+
// Support building against older versions of LLVM, this macro was added
// recently.
#ifndef LLVM_EXTENSION
@@ -648,7 +650,7 @@ bool RegisterContextDarwin_arm64::WriteRegister(const RegisterInfo *reg_info,
bool RegisterContextDarwin_arm64::ReadAllRegisterValues(
lldb::DataBufferSP &data_sp) {
- data_sp.reset(new DataBufferHeap(REG_CONTEXT_SIZE, 0));
+ data_sp = std::make_shared<DataBufferHeap>(REG_CONTEXT_SIZE, 0);
if (data_sp && ReadGPR(false) == KERN_SUCCESS &&
ReadFPU(false) == KERN_SUCCESS && ReadEXC(false) == KERN_SUCCESS) {
uint8_t *dst = data_sp->GetBytes();
diff --git a/source/Plugins/Process/Utility/RegisterContextDarwin_i386.cpp b/source/Plugins/Process/Utility/RegisterContextDarwin_i386.cpp
index 742644d4d..161af9f8c 100644
--- a/source/Plugins/Process/Utility/RegisterContextDarwin_i386.cpp
+++ b/source/Plugins/Process/Utility/RegisterContextDarwin_i386.cpp
@@ -6,8 +6,6 @@
//
//===----------------------------------------------------------------------===//
-#include <stddef.h>
-
#include "lldb/Utility/DataBufferHeap.h"
#include "lldb/Utility/DataExtractor.h"
#include "lldb/Utility/Endian.h"
@@ -17,6 +15,10 @@
#include "llvm/ADT/STLExtras.h"
#include "llvm/Support/Compiler.h"
+#include <stddef.h>
+
+#include <memory>
+
// Support building against older versions of LLVM, this macro was added
// recently.
#ifndef LLVM_EXTENSION
@@ -831,7 +833,7 @@ bool RegisterContextDarwin_i386::WriteRegister(const RegisterInfo *reg_info,
bool RegisterContextDarwin_i386::ReadAllRegisterValues(
lldb::DataBufferSP &data_sp) {
- data_sp.reset(new DataBufferHeap(REG_CONTEXT_SIZE, 0));
+ data_sp = std::make_shared<DataBufferHeap>(REG_CONTEXT_SIZE, 0);
if (data_sp && ReadGPR(false) == 0 && ReadFPU(false) == 0 &&
ReadEXC(false) == 0) {
uint8_t *dst = data_sp->GetBytes();
diff --git a/source/Plugins/Process/Utility/RegisterContextDarwin_x86_64.cpp b/source/Plugins/Process/Utility/RegisterContextDarwin_x86_64.cpp
index 35fc2a157..c611f6239 100644
--- a/source/Plugins/Process/Utility/RegisterContextDarwin_x86_64.cpp
+++ b/source/Plugins/Process/Utility/RegisterContextDarwin_x86_64.cpp
@@ -10,6 +10,8 @@
#include <stdarg.h>
#include <stddef.h>
+#include <memory>
+
#include "lldb/Utility/DataBufferHeap.h"
#include "lldb/Utility/DataExtractor.h"
#include "lldb/Utility/Endian.h"
@@ -909,7 +911,7 @@ bool RegisterContextDarwin_x86_64::WriteRegister(const RegisterInfo *reg_info,
bool RegisterContextDarwin_x86_64::ReadAllRegisterValues(
lldb::DataBufferSP &data_sp) {
- data_sp.reset(new DataBufferHeap(REG_CONTEXT_SIZE, 0));
+ data_sp = std::make_shared<DataBufferHeap>(REG_CONTEXT_SIZE, 0);
if (data_sp && ReadGPR(false) == 0 && ReadFPU(false) == 0 &&
ReadEXC(false) == 0) {
uint8_t *dst = data_sp->GetBytes();
diff --git a/source/Plugins/Process/Utility/RegisterContextLLDB.cpp b/source/Plugins/Process/Utility/RegisterContextLLDB.cpp
index 423b2e53c..10199f742 100644
--- a/source/Plugins/Process/Utility/RegisterContextLLDB.cpp
+++ b/source/Plugins/Process/Utility/RegisterContextLLDB.cpp
@@ -34,6 +34,8 @@
#include "RegisterContextLLDB.h"
+#include <memory>
+
using namespace lldb;
using namespace lldb_private;
@@ -369,7 +371,8 @@ void RegisterContextLLDB::InitializeNonZerothFrame() {
if (abi) {
m_fast_unwind_plan_sp.reset();
- m_full_unwind_plan_sp.reset(new UnwindPlan(lldb::eRegisterKindGeneric));
+ m_full_unwind_plan_sp =
+ std::make_shared<UnwindPlan>(lldb::eRegisterKindGeneric);
abi->CreateDefaultUnwindPlan(*m_full_unwind_plan_sp);
if (m_frame_type != eSkipFrame) // don't override eSkipFrame
{
@@ -716,8 +719,8 @@ UnwindPlanSP RegisterContextLLDB::GetFullUnwindPlanForFrame() {
Process *process = exe_ctx.GetProcessPtr();
ABI *abi = process ? process->GetABI().get() : NULL;
if (abi) {
- arch_default_unwind_plan_sp.reset(
- new UnwindPlan(lldb::eRegisterKindGeneric));
+ arch_default_unwind_plan_sp =
+ std::make_shared<UnwindPlan>(lldb::eRegisterKindGeneric);
abi->CreateDefaultUnwindPlan(*arch_default_unwind_plan_sp);
} else {
UnwindLogMsg(
@@ -752,7 +755,8 @@ UnwindPlanSP RegisterContextLLDB::GetFullUnwindPlanForFrame() {
process->GetLoadAddressPermissions(current_pc_addr, permissions) &&
(permissions & ePermissionsExecutable) == 0)) {
if (abi) {
- unwind_plan_sp.reset(new UnwindPlan(lldb::eRegisterKindGeneric));
+ unwind_plan_sp =
+ std::make_shared<UnwindPlan>(lldb::eRegisterKindGeneric);
abi->CreateFunctionEntryUnwindPlan(*unwind_plan_sp);
m_frame_type = eNormalFrame;
return unwind_plan_sp;
@@ -793,7 +797,7 @@ UnwindPlanSP RegisterContextLLDB::GetFullUnwindPlanForFrame() {
DWARFCallFrameInfo *eh_frame =
pc_module_sp->GetObjectFile()->GetUnwindTable().GetEHFrameInfo();
if (eh_frame) {
- unwind_plan_sp.reset(new UnwindPlan(lldb::eRegisterKindGeneric));
+ unwind_plan_sp = std::make_shared<UnwindPlan>(lldb::eRegisterKindGeneric);
if (eh_frame->GetUnwindPlan(m_current_pc, *unwind_plan_sp))
return unwind_plan_sp;
else
@@ -803,7 +807,7 @@ UnwindPlanSP RegisterContextLLDB::GetFullUnwindPlanForFrame() {
ArmUnwindInfo *arm_exidx =
pc_module_sp->GetObjectFile()->GetUnwindTable().GetArmUnwindInfo();
if (arm_exidx) {
- unwind_plan_sp.reset(new UnwindPlan(lldb::eRegisterKindGeneric));
+ unwind_plan_sp = std::make_shared<UnwindPlan>(lldb::eRegisterKindGeneric);
if (arm_exidx->GetUnwindPlan(exe_ctx.GetTargetRef(), m_current_pc,
*unwind_plan_sp))
return unwind_plan_sp;
diff --git a/source/Plugins/Process/Utility/ThreadMemory.cpp b/source/Plugins/Process/Utility/ThreadMemory.cpp
index 735bfea2f..80b04bb14 100644
--- a/source/Plugins/Process/Utility/ThreadMemory.cpp
+++ b/source/Plugins/Process/Utility/ThreadMemory.cpp
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
#include "Plugins/Process/Utility/ThreadMemory.h"
+
#include "Plugins/Process/Utility/RegisterContextThreadMemory.h"
#include "lldb/Target/OperatingSystem.h"
#include "lldb/Target/Process.h"
@@ -15,6 +16,8 @@
#include "lldb/Target/StopInfo.h"
#include "lldb/Target/Unwind.h"
+#include <memory>
+
using namespace lldb;
using namespace lldb_private;
@@ -44,8 +47,8 @@ void ThreadMemory::ClearStackFrames() {
RegisterContextSP ThreadMemory::GetRegisterContext() {
if (!m_reg_context_sp)
- m_reg_context_sp.reset(
- new RegisterContextThreadMemory(*this, m_register_data_addr));
+ m_reg_context_sp = std::make_shared<RegisterContextThreadMemory>(
+ *this, m_register_data_addr);
return m_reg_context_sp;
}
diff --git a/source/Plugins/Process/Utility/UnwindMacOSXFrameBackchain.cpp b/source/Plugins/Process/Utility/UnwindMacOSXFrameBackchain.cpp
index b66be3775..4a35637cf 100644
--- a/source/Plugins/Process/Utility/UnwindMacOSXFrameBackchain.cpp
+++ b/source/Plugins/Process/Utility/UnwindMacOSXFrameBackchain.cpp
@@ -17,6 +17,8 @@
#include "RegisterContextMacOSXFrameBackchain.h"
+#include <memory>
+
using namespace lldb;
using namespace lldb_private;
@@ -65,8 +67,8 @@ UnwindMacOSXFrameBackchain::DoCreateRegisterContextForFrame(StackFrame *frame) {
uint32_t concrete_idx = frame->GetConcreteFrameIndex();
const uint32_t frame_count = GetFrameCount();
if (concrete_idx < frame_count)
- reg_ctx_sp.reset(new RegisterContextMacOSXFrameBackchain(
- m_thread, concrete_idx, m_cursors[concrete_idx]));
+ reg_ctx_sp = std::make_shared<RegisterContextMacOSXFrameBackchain>(
+ m_thread, concrete_idx, m_cursors[concrete_idx]);
return reg_ctx_sp;
}
diff --git a/source/Plugins/Process/elf-core/ProcessElfCore.cpp b/source/Plugins/Process/elf-core/ProcessElfCore.cpp
index 1445cffb3..708609aad 100644
--- a/source/Plugins/Process/elf-core/ProcessElfCore.cpp
+++ b/source/Plugins/Process/elf-core/ProcessElfCore.cpp
@@ -8,6 +8,7 @@
#include <stdlib.h>
+#include <memory>
#include <mutex>
#include "lldb/Core/Module.h"
@@ -65,8 +66,8 @@ lldb::ProcessSP ProcessElfCore::CreateInstance(lldb::TargetSP target_sp,
lldb::offset_t data_offset = 0;
if (elf_header.Parse(data, &data_offset)) {
if (elf_header.e_type == llvm::ELF::ET_CORE)
- process_sp.reset(
- new ProcessElfCore(target_sp, listener_sp, *crash_file));
+ process_sp = std::make_shared<ProcessElfCore>(target_sp, listener_sp,
+ *crash_file);
}
}
}
diff --git a/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm.cpp b/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm.cpp
index b0eb1c8a7..fa05c457f 100644
--- a/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm.cpp
+++ b/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm.cpp
@@ -11,14 +11,16 @@
#include "lldb/Target/Thread.h"
#include "lldb/Utility/RegisterValue.h"
+#include <memory>
+
using namespace lldb_private;
RegisterContextCorePOSIX_arm::RegisterContextCorePOSIX_arm(
Thread &thread, RegisterInfoInterface *register_info,
const DataExtractor &gpregset, llvm::ArrayRef<CoreNote> notes)
: RegisterContextPOSIX_arm(thread, 0, register_info) {
- m_gpr_buffer.reset(
- new DataBufferHeap(gpregset.GetDataStart(), gpregset.GetByteSize()));
+ m_gpr_buffer = std::make_shared<DataBufferHeap>(gpregset.GetDataStart(),
+ gpregset.GetByteSize());
m_gpr.SetData(m_gpr_buffer);
m_gpr.SetByteOrder(gpregset.GetByteOrder());
}
diff --git a/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm64.cpp b/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm64.cpp
index fb817e5e5..e477c438b 100644
--- a/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm64.cpp
+++ b/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm64.cpp
@@ -7,18 +7,21 @@
//===----------------------------------------------------------------------===//
#include "RegisterContextPOSIXCore_arm64.h"
+
#include "Plugins/Process/elf-core/RegisterUtilities.h"
#include "lldb/Target/Thread.h"
#include "lldb/Utility/RegisterValue.h"
+#include <memory>
+
using namespace lldb_private;
RegisterContextCorePOSIX_arm64::RegisterContextCorePOSIX_arm64(
Thread &thread, RegisterInfoInterface *register_info,
const DataExtractor &gpregset, llvm::ArrayRef<CoreNote> notes)
: RegisterContextPOSIX_arm64(thread, 0, register_info) {
- m_gpr_buffer.reset(
- new DataBufferHeap(gpregset.GetDataStart(), gpregset.GetByteSize()));
+ m_gpr_buffer = std::make_shared<DataBufferHeap>(gpregset.GetDataStart(),
+ gpregset.GetByteSize());
m_gpr.SetData(m_gpr_buffer);
m_gpr.SetByteOrder(gpregset.GetByteOrder());
}
diff --git a/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_mips64.cpp b/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_mips64.cpp
index 75844d213..e15ba78c2 100644
--- a/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_mips64.cpp
+++ b/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_mips64.cpp
@@ -11,21 +11,23 @@
#include "lldb/Target/Thread.h"
#include "lldb/Utility/RegisterValue.h"
+#include <memory>
+
using namespace lldb_private;
RegisterContextCorePOSIX_mips64::RegisterContextCorePOSIX_mips64(
Thread &thread, RegisterInfoInterface *register_info,
const DataExtractor &gpregset, llvm::ArrayRef<CoreNote> notes)
: RegisterContextPOSIX_mips64(thread, 0, register_info) {
- m_gpr_buffer.reset(
- new DataBufferHeap(gpregset.GetDataStart(), gpregset.GetByteSize()));
+ m_gpr_buffer = std::make_shared<DataBufferHeap>(gpregset.GetDataStart(),
+ gpregset.GetByteSize());
m_gpr.SetData(m_gpr_buffer);
m_gpr.SetByteOrder(gpregset.GetByteOrder());
DataExtractor fpregset = getRegset(
notes, register_info->GetTargetArchitecture().GetTriple(), FPR_Desc);
- m_fpr_buffer.reset(
- new DataBufferHeap(fpregset.GetDataStart(), fpregset.GetByteSize()));
+ m_fpr_buffer = std::make_shared<DataBufferHeap>(fpregset.GetDataStart(),
+ fpregset.GetByteSize());
m_fpr.SetData(m_fpr_buffer);
m_fpr.SetByteOrder(fpregset.GetByteOrder());
}
diff --git a/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_powerpc.cpp b/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_powerpc.cpp
index ed899d98d..6984bf4ee 100644
--- a/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_powerpc.cpp
+++ b/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_powerpc.cpp
@@ -12,27 +12,29 @@
#include "lldb/Utility/DataBufferHeap.h"
#include "lldb/Utility/RegisterValue.h"
+#include <memory>
+
using namespace lldb_private;
RegisterContextCorePOSIX_powerpc::RegisterContextCorePOSIX_powerpc(
Thread &thread, RegisterInfoInterface *register_info,
const DataExtractor &gpregset, llvm::ArrayRef<CoreNote> notes)
: RegisterContextPOSIX_powerpc(thread, 0, register_info) {
- m_gpr_buffer.reset(
- new DataBufferHeap(gpregset.GetDataStart(), gpregset.GetByteSize()));
+ m_gpr_buffer = std::make_shared<DataBufferHeap>(gpregset.GetDataStart(),
+ gpregset.GetByteSize());
m_gpr.SetData(m_gpr_buffer);
m_gpr.SetByteOrder(gpregset.GetByteOrder());
ArchSpec arch = register_info->GetTargetArchitecture();
DataExtractor fpregset = getRegset(notes, arch.GetTriple(), FPR_Desc);
- m_fpr_buffer.reset(
- new DataBufferHeap(fpregset.GetDataStart(), fpregset.GetByteSize()));
+ m_fpr_buffer = std::make_shared<DataBufferHeap>(fpregset.GetDataStart(),
+ fpregset.GetByteSize());
m_fpr.SetData(m_fpr_buffer);
m_fpr.SetByteOrder(fpregset.GetByteOrder());
DataExtractor vregset = getRegset(notes, arch.GetTriple(), PPC_VMX_Desc);
- m_vec_buffer.reset(
- new DataBufferHeap(vregset.GetDataStart(), vregset.GetByteSize()));
+ m_vec_buffer = std::make_shared<DataBufferHeap>(vregset.GetDataStart(),
+ vregset.GetByteSize());
m_vec.SetData(m_vec_buffer);
m_vec.SetByteOrder(vregset.GetByteOrder());
}
diff --git a/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_ppc64le.cpp b/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_ppc64le.cpp
index 945d44470..0eebf474f 100644
--- a/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_ppc64le.cpp
+++ b/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_ppc64le.cpp
@@ -15,33 +15,35 @@
#include "Plugins/Process/Utility/lldb-ppc64le-register-enums.h"
#include "Plugins/Process/elf-core/RegisterUtilities.h"
+#include <memory>
+
using namespace lldb_private;
RegisterContextCorePOSIX_ppc64le::RegisterContextCorePOSIX_ppc64le(
Thread &thread, RegisterInfoInterface *register_info,
const DataExtractor &gpregset, llvm::ArrayRef<CoreNote> notes)
: RegisterContextPOSIX_ppc64le(thread, 0, register_info) {
- m_gpr_buffer.reset(
- new DataBufferHeap(gpregset.GetDataStart(), gpregset.GetByteSize()));
+ m_gpr_buffer = std::make_shared<DataBufferHeap>(gpregset.GetDataStart(),
+ gpregset.GetByteSize());
m_gpr.SetData(m_gpr_buffer);
m_gpr.SetByteOrder(gpregset.GetByteOrder());
ArchSpec arch = register_info->GetTargetArchitecture();
DataExtractor fpregset = getRegset(notes, arch.GetTriple(), FPR_Desc);
- m_fpr_buffer.reset(
- new DataBufferHeap(fpregset.GetDataStart(), fpregset.GetByteSize()));
+ m_fpr_buffer = std::make_shared<DataBufferHeap>(fpregset.GetDataStart(),
+ fpregset.GetByteSize());
m_fpr.SetData(m_fpr_buffer);
m_fpr.SetByteOrder(fpregset.GetByteOrder());
DataExtractor vmxregset = getRegset(notes, arch.GetTriple(), PPC_VMX_Desc);
- m_vmx_buffer.reset(
- new DataBufferHeap(vmxregset.GetDataStart(), vmxregset.GetByteSize()));
+ m_vmx_buffer = std::make_shared<DataBufferHeap>(vmxregset.GetDataStart(),
+ vmxregset.GetByteSize());
m_vmx.SetData(m_vmx_buffer);
m_vmx.SetByteOrder(vmxregset.GetByteOrder());
DataExtractor vsxregset = getRegset(notes, arch.GetTriple(), PPC_VSX_Desc);
- m_vsx_buffer.reset(
- new DataBufferHeap(vsxregset.GetDataStart(), vsxregset.GetByteSize()));
+ m_vsx_buffer = std::make_shared<DataBufferHeap>(vsxregset.GetDataStart(),
+ vsxregset.GetByteSize());
m_vsx.SetData(m_vsx_buffer);
m_vsx.SetByteOrder(vsxregset.GetByteOrder());
}
diff --git a/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_s390x.cpp b/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_s390x.cpp
index 5a99250b7..d84fc3e74 100644
--- a/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_s390x.cpp
+++ b/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_s390x.cpp
@@ -12,21 +12,23 @@
#include "lldb/Utility/DataBufferHeap.h"
#include "lldb/Utility/RegisterValue.h"
+#include <memory>
+
using namespace lldb_private;
RegisterContextCorePOSIX_s390x::RegisterContextCorePOSIX_s390x(
Thread &thread, RegisterInfoInterface *register_info,
const DataExtractor &gpregset, llvm::ArrayRef<CoreNote> notes)
: RegisterContextPOSIX_s390x(thread, 0, register_info) {
- m_gpr_buffer.reset(
- new DataBufferHeap(gpregset.GetDataStart(), gpregset.GetByteSize()));
+ m_gpr_buffer = std::make_shared<DataBufferHeap>(gpregset.GetDataStart(),
+ gpregset.GetByteSize());
m_gpr.SetData(m_gpr_buffer);
m_gpr.SetByteOrder(gpregset.GetByteOrder());
DataExtractor fpregset = getRegset(
notes, register_info->GetTargetArchitecture().GetTriple(), FPR_Desc);
- m_fpr_buffer.reset(
- new DataBufferHeap(fpregset.GetDataStart(), fpregset.GetByteSize()));
+ m_fpr_buffer = std::make_shared<DataBufferHeap>(fpregset.GetDataStart(),
+ fpregset.GetByteSize());
m_fpr.SetData(m_fpr_buffer);
m_fpr.SetByteOrder(fpregset.GetByteOrder());
}
diff --git a/source/Plugins/Process/elf-core/ThreadElfCore.cpp b/source/Plugins/Process/elf-core/ThreadElfCore.cpp
index 83900d5be..409163554 100644
--- a/source/Plugins/Process/elf-core/ThreadElfCore.cpp
+++ b/source/Plugins/Process/elf-core/ThreadElfCore.cpp
@@ -38,6 +38,8 @@
#include "RegisterContextPOSIXCore_x86_64.h"
#include "ThreadElfCore.h"
+#include <memory>
+
using namespace lldb;
using namespace lldb_private;
@@ -186,40 +188,40 @@ ThreadElfCore::CreateRegisterContextForFrame(StackFrame *frame) {
switch (arch.GetMachine()) {
case llvm::Triple::aarch64:
- m_thread_reg_ctx_sp.reset(new RegisterContextCorePOSIX_arm64(
- *this, reg_interface, m_gpregset_data, m_notes));
+ m_thread_reg_ctx_sp = std::make_shared<RegisterContextCorePOSIX_arm64>(
+ *this, reg_interface, m_gpregset_data, m_notes);
break;
case llvm::Triple::arm:
- m_thread_reg_ctx_sp.reset(new RegisterContextCorePOSIX_arm(
- *this, reg_interface, m_gpregset_data, m_notes));
+ m_thread_reg_ctx_sp = std::make_shared<RegisterContextCorePOSIX_arm>(
+ *this, reg_interface, m_gpregset_data, m_notes);
break;
case llvm::Triple::mipsel:
case llvm::Triple::mips:
- m_thread_reg_ctx_sp.reset(new RegisterContextCorePOSIX_mips64(
- *this, reg_interface, m_gpregset_data, m_notes));
+ m_thread_reg_ctx_sp = std::make_shared<RegisterContextCorePOSIX_mips64>(
+ *this, reg_interface, m_gpregset_data, m_notes);
break;
case llvm::Triple::mips64:
case llvm::Triple::mips64el:
- m_thread_reg_ctx_sp.reset(new RegisterContextCorePOSIX_mips64(
- *this, reg_interface, m_gpregset_data, m_notes));
+ m_thread_reg_ctx_sp = std::make_shared<RegisterContextCorePOSIX_mips64>(
+ *this, reg_interface, m_gpregset_data, m_notes);
break;
case llvm::Triple::ppc:
case llvm::Triple::ppc64:
- m_thread_reg_ctx_sp.reset(new RegisterContextCorePOSIX_powerpc(
- *this, reg_interface, m_gpregset_data, m_notes));
+ m_thread_reg_ctx_sp = std::make_shared<RegisterContextCorePOSIX_powerpc>(
+ *this, reg_interface, m_gpregset_data, m_notes);
break;
case llvm::Triple::ppc64le:
- m_thread_reg_ctx_sp.reset(new RegisterContextCorePOSIX_ppc64le(
- *this, reg_interface, m_gpregset_data, m_notes));
+ m_thread_reg_ctx_sp = std::make_shared<RegisterContextCorePOSIX_ppc64le>(
+ *this, reg_interface, m_gpregset_data, m_notes);
break;
case llvm::Triple::systemz:
- m_thread_reg_ctx_sp.reset(new RegisterContextCorePOSIX_s390x(
- *this, reg_interface, m_gpregset_data, m_notes));
+ m_thread_reg_ctx_sp = std::make_shared<RegisterContextCorePOSIX_s390x>(
+ *this, reg_interface, m_gpregset_data, m_notes);
break;
case llvm::Triple::x86:
case llvm::Triple::x86_64:
- m_thread_reg_ctx_sp.reset(new RegisterContextCorePOSIX_x86_64(
- *this, reg_interface, m_gpregset_data, m_notes));
+ m_thread_reg_ctx_sp = std::make_shared<RegisterContextCorePOSIX_x86_64>(
+ *this, reg_interface, m_gpregset_data, m_notes);
break;
default:
break;
diff --git a/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp b/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp
index 2e88ecbea..75d264295 100644
--- a/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp
+++ b/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp
@@ -22,6 +22,8 @@
#include "Utility/ARM_ehframe_Registers.h"
#include "lldb/Utility/StringExtractorGDBRemote.h"
+#include <memory>
+
using namespace lldb;
using namespace lldb_private;
using namespace lldb_private::process_gdb_remote;
@@ -488,8 +490,8 @@ bool GDBRemoteRegisterContext::ReadAllRegisterValues(
// ReadRegisterBytes saves the contents of the register in to the
// m_reg_data buffer
}
- data_sp.reset(new DataBufferHeap(m_reg_data.GetDataStart(),
- m_reg_info.GetRegisterDataByteSize()));
+ data_sp = std::make_shared<DataBufferHeap>(
+ m_reg_data.GetDataStart(), m_reg_info.GetRegisterDataByteSize());
return true;
} else {
diff --git a/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
index 53fdcb77b..c588b022a 100644
--- a/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ b/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -23,6 +23,7 @@
#include <algorithm>
#include <csignal>
#include <map>
+#include <memory>
#include <mutex>
#include <sstream>
@@ -124,7 +125,7 @@ public:
}
PluginProperties() : Properties() {
- m_collection_sp.reset(new OptionValueProperties(GetSettingName()));
+ m_collection_sp = std::make_shared<OptionValueProperties>(GetSettingName());
m_collection_sp->Initialize(g_properties);
}
@@ -152,7 +153,7 @@ typedef std::shared_ptr<PluginProperties> ProcessKDPPropertiesSP;
static const ProcessKDPPropertiesSP &GetGlobalPluginProperties() {
static ProcessKDPPropertiesSP g_settings_sp;
if (!g_settings_sp)
- g_settings_sp.reset(new PluginProperties());
+ g_settings_sp = std::make_shared<PluginProperties>();
return g_settings_sp;
}
@@ -246,7 +247,7 @@ ProcessGDBRemote::CreateInstance(lldb::TargetSP target_sp,
const FileSpec *crash_file_path) {
lldb::ProcessSP process_sp;
if (crash_file_path == NULL)
- process_sp.reset(new ProcessGDBRemote(target_sp, listener_sp));
+ process_sp = std::make_shared<ProcessGDBRemote>(target_sp, listener_sp);
return process_sp;
}
@@ -1708,7 +1709,7 @@ bool ProcessGDBRemote::UpdateThreadList(ThreadList &old_thread_list,
ThreadSP thread_sp(
old_thread_list_copy.RemoveThreadByProtocolID(tid, false));
if (!thread_sp) {
- thread_sp.reset(new ThreadGDBRemote(*this, tid));
+ thread_sp = std::make_shared<ThreadGDBRemote>(*this, tid);
LLDB_LOGV(log, "Making new thread: {0} for thread ID: {1:x}.",
thread_sp.get(), thread_sp->GetID());
} else {
@@ -1824,7 +1825,7 @@ ThreadSP ProcessGDBRemote::SetThreadStopInfo(
if (!thread_sp) {
// Create the thread if we need to
- thread_sp.reset(new ThreadGDBRemote(*this, tid));
+ thread_sp = std::make_shared<ThreadGDBRemote>(*this, tid);
m_thread_list_real.AddThread(thread_sp);
}
}
@@ -4060,8 +4061,8 @@ const DataBufferSP ProcessGDBRemote::GetAuxvData() {
if (m_gdb_comm.SendPacketsAndConcatenateResponses("qXfer:auxv:read::",
response_string) ==
GDBRemoteCommunication::PacketResult::Success)
- buf.reset(new DataBufferHeap(response_string.c_str(),
- response_string.length()));
+ buf = std::make_shared<DataBufferHeap>(response_string.c_str(),
+ response_string.length());
}
return buf;
}
@@ -5424,7 +5425,7 @@ public:
CommandObject *ProcessGDBRemote::GetPluginCommandObject() {
if (!m_command_sp)
- m_command_sp.reset(new CommandObjectMultiwordProcessGDBRemote(
- GetTarget().GetDebugger().GetCommandInterpreter()));
+ m_command_sp = std::make_shared<CommandObjectMultiwordProcessGDBRemote>(
+ GetTarget().GetDebugger().GetCommandInterpreter());
return m_command_sp.get();
}
diff --git a/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp b/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp
index 261b5c919..9f9fcca71 100644
--- a/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp
+++ b/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp
@@ -20,10 +20,12 @@
#include "lldb/Utility/DataExtractor.h"
#include "lldb/Utility/State.h"
#include "lldb/Utility/StreamString.h"
+#include "lldb/Utility/StringExtractorGDBRemote.h"
#include "ProcessGDBRemote.h"
#include "ProcessGDBRemoteLog.h"
-#include "lldb/Utility/StringExtractorGDBRemote.h"
+
+#include <memory>
using namespace lldb;
using namespace lldb_private;
@@ -307,9 +309,9 @@ ThreadGDBRemote::CreateRegisterContextForFrame(StackFrame *frame) {
// supported.
bool read_all_registers_at_once =
!gdb_process->GetGDBRemote().GetpPacketSupported(GetID());
- reg_ctx_sp.reset(new GDBRemoteRegisterContext(
+ reg_ctx_sp = std::make_shared<GDBRemoteRegisterContext>(
*this, concrete_frame_idx, gdb_process->m_register_info,
- read_all_registers_at_once));
+ read_all_registers_at_once);
}
} else {
Unwind *unwinder = GetUnwinder();
diff --git a/source/Plugins/Process/mach-core/ProcessMachCore.cpp b/source/Plugins/Process/mach-core/ProcessMachCore.cpp
index 1e703133c..05f378d7f 100644
--- a/source/Plugins/Process/mach-core/ProcessMachCore.cpp
+++ b/source/Plugins/Process/mach-core/ProcessMachCore.cpp
@@ -12,7 +12,6 @@
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/Threading.h"
-#include <mutex>
#include "lldb/Core/Debugger.h"
#include "lldb/Core/Module.h"
@@ -39,6 +38,9 @@
#include "Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h"
#include "Plugins/ObjectFile/Mach-O/ObjectFileMachO.h"
+#include <memory>
+#include <mutex>
+
using namespace lldb;
using namespace lldb_private;
@@ -70,8 +72,8 @@ lldb::ProcessSP ProcessMachCore::CreateInstance(lldb::TargetSP target_sp,
llvm::MachO::mach_header mach_header;
if (ObjectFileMachO::ParseHeader(data, &data_offset, mach_header)) {
if (mach_header.filetype == llvm::MachO::MH_CORE)
- process_sp.reset(
- new ProcessMachCore(target_sp, listener_sp, *crash_file));
+ process_sp = std::make_shared<ProcessMachCore>(target_sp, listener_sp,
+ *crash_file);
}
}
}
diff --git a/source/Plugins/Process/minidump/ProcessMinidump.cpp b/source/Plugins/Process/minidump/ProcessMinidump.cpp
index ef94f47b4..91075cce0 100644
--- a/source/Plugins/Process/minidump/ProcessMinidump.cpp
+++ b/source/Plugins/Process/minidump/ProcessMinidump.cpp
@@ -7,6 +7,7 @@
//===----------------------------------------------------------------------===//
#include "ProcessMinidump.h"
+
#include "ThreadMinidump.h"
#include "lldb/Core/DumpDataExtractor.h"
@@ -34,8 +35,7 @@
#include "Plugins/Process/Utility/StopInfoMachException.h"
-// C includes
-// C++ includes
+#include <memory>
using namespace lldb;
using namespace lldb_private;
@@ -644,7 +644,7 @@ public:
CommandObject *ProcessMinidump::GetPluginCommandObject() {
if (!m_command_sp)
- m_command_sp.reset(new CommandObjectMultiwordProcessMinidump(
- GetTarget().GetDebugger().GetCommandInterpreter()));
+ m_command_sp = std::make_shared<CommandObjectMultiwordProcessMinidump>(
+ GetTarget().GetDebugger().GetCommandInterpreter());
return m_command_sp.get();
}
diff --git a/source/Plugins/Process/minidump/ThreadMinidump.cpp b/source/Plugins/Process/minidump/ThreadMinidump.cpp
index 340ed3c1a..44880970c 100644
--- a/source/Plugins/Process/minidump/ThreadMinidump.cpp
+++ b/source/Plugins/Process/minidump/ThreadMinidump.cpp
@@ -7,6 +7,7 @@
//===----------------------------------------------------------------------===//
#include "ThreadMinidump.h"
+
#include "ProcessMinidump.h"
#include "RegisterContextMinidump_ARM.h"
@@ -26,6 +27,7 @@
#include "lldb/Utility/DataExtractor.h"
#include "lldb/Utility/Log.h"
+#include <memory>
using namespace lldb;
using namespace lldb_private;
@@ -71,8 +73,9 @@ ThreadMinidump::CreateRegisterContextForFrame(StackFrame *frame) {
lldb::DataBufferSP buf =
ConvertMinidumpContext_x86_32(m_gpregset_data, reg_interface);
DataExtractor gpregset(buf, lldb::eByteOrderLittle, 4);
- m_thread_reg_ctx_sp.reset(new RegisterContextCorePOSIX_x86_64(
- *this, reg_interface, gpregset, {}));
+ m_thread_reg_ctx_sp = std::make_shared<RegisterContextCorePOSIX_x86_64>(
+ *this, reg_interface, gpregset,
+ llvm::ArrayRef<lldb_private::CoreNote>());
break;
}
case llvm::Triple::x86_64: {
@@ -80,22 +83,24 @@ ThreadMinidump::CreateRegisterContextForFrame(StackFrame *frame) {
lldb::DataBufferSP buf =
ConvertMinidumpContext_x86_64(m_gpregset_data, reg_interface);
DataExtractor gpregset(buf, lldb::eByteOrderLittle, 8);
- m_thread_reg_ctx_sp.reset(new RegisterContextCorePOSIX_x86_64(
- *this, reg_interface, gpregset, {}));
+ m_thread_reg_ctx_sp = std::make_shared<RegisterContextCorePOSIX_x86_64>(
+ *this, reg_interface, gpregset,
+ llvm::ArrayRef<lldb_private::CoreNote>());
break;
}
case llvm::Triple::aarch64: {
DataExtractor data(m_gpregset_data.data(), m_gpregset_data.size(),
lldb::eByteOrderLittle, 8);
- m_thread_reg_ctx_sp.reset(new RegisterContextMinidump_ARM64(*this, data));
+ m_thread_reg_ctx_sp =
+ std::make_shared<RegisterContextMinidump_ARM64>(*this, data);
break;
}
case llvm::Triple::arm: {
DataExtractor data(m_gpregset_data.data(), m_gpregset_data.size(),
lldb::eByteOrderLittle, 8);
const bool apple = arch.GetTriple().getVendor() == llvm::Triple::Apple;
- m_thread_reg_ctx_sp.reset(
- new RegisterContextMinidump_ARM(*this, data, apple));
+ m_thread_reg_ctx_sp =
+ std::make_shared<RegisterContextMinidump_ARM>(*this, data, apple);
break;
}
default:
diff --git a/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp b/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
index 89f789f86..294c4b005 100644
--- a/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
+++ b/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
@@ -22,6 +22,7 @@
#include <stdio.h>
#include <stdlib.h>
+#include <memory>
#include <mutex>
#include <string>
@@ -811,7 +812,7 @@ bool ScriptInterpreterPython::ExecuteOneLine(
join_read_thread = true;
FILE *outfile_handle =
fdopen(pipe.ReleaseWriteFileDescriptor(), "w");
- output_file_sp.reset(new StreamFile(outfile_handle, true));
+ output_file_sp = std::make_shared<StreamFile>(outfile_handle, true);
error_file_sp = output_file_sp;
if (outfile_handle)
::setbuf(outfile_handle, nullptr);
@@ -827,12 +828,12 @@ bool ScriptInterpreterPython::ExecuteOneLine(
debugger.AdoptTopIOHandlerFilesIfInvalid(input_file_sp, output_file_sp,
error_file_sp);
} else {
- input_file_sp.reset(new StreamFile());
+ input_file_sp = std::make_shared<StreamFile>();
FileSystem::Instance().Open(input_file_sp->GetFile(),
FileSpec(FileSystem::DEV_NULL),
File::eOpenOptionRead);
- output_file_sp.reset(new StreamFile());
+ output_file_sp = std::make_shared<StreamFile>();
FileSystem::Instance().Open(output_file_sp->GetFile(),
FileSpec(FileSystem::DEV_NULL),
File::eOpenOptionWrite);
@@ -2220,7 +2221,7 @@ bool ScriptInterpreterPython::GetScriptedSummary(
}
if (new_callee && old_callee != new_callee)
- callee_wrapper_sp.reset(new StructuredPythonObject(new_callee));
+ callee_wrapper_sp = std::make_shared<StructuredPythonObject>(new_callee);
return ret_val;
}
@@ -2879,7 +2880,7 @@ bool ScriptInterpreterPython::LoadScriptingModule(
ScriptInterpreter::eScriptReturnTypeOpaqueObject,
&module_pyobj) &&
module_pyobj)
- module_sp->reset(new StructuredPythonObject(module_pyobj));
+ *module_sp = std::make_shared<StructuredPythonObject>(module_pyobj);
}
return true;
diff --git a/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp b/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp
index f5bf13036..5b6c9e5e2 100644
--- a/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp
+++ b/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp
@@ -8,10 +8,9 @@
#include "StructuredDataDarwinLog.h"
-// C includes
#include <string.h>
-// C++ includes
+#include <memory>
#include <sstream>
#include "lldb/Breakpoint/StoppointCallbackContext.h"
@@ -144,7 +143,7 @@ public:
}
StructuredDataDarwinLogProperties() : Properties() {
- m_collection_sp.reset(new OptionValueProperties(GetSettingName()));
+ m_collection_sp = std::make_shared<OptionValueProperties>(GetSettingName());
m_collection_sp->Initialize(g_properties);
}
@@ -171,7 +170,7 @@ using StructuredDataDarwinLogPropertiesSP =
static const StructuredDataDarwinLogPropertiesSP &GetGlobalProperties() {
static StructuredDataDarwinLogPropertiesSP g_settings_sp;
if (!g_settings_sp)
- g_settings_sp.reset(new StructuredDataDarwinLogProperties());
+ g_settings_sp = std::make_shared<StructuredDataDarwinLogProperties>();
return g_settings_sp;
}
diff --git a/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp b/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
index 32832917c..5b50e92a1 100644
--- a/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ b/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -43,6 +43,7 @@
#include "clang/AST/DeclTemplate.h"
#include <map>
+#include <memory>
#include <vector>
//#define ENABLE_DEBUG_PRINTF // COMMENT OUT THIS LINE PRIOR TO CHECKIN
@@ -522,10 +523,10 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc,
}
}
- type_sp.reset(
- new Type(die.GetID(), dwarf, type_name_const_str, byte_size, NULL,
- DIERef(encoding_uid).GetUID(dwarf), encoding_data_type,
- &decl, clang_type, resolve_state));
+ type_sp = std::make_shared<Type>(
+ die.GetID(), dwarf, type_name_const_str, byte_size, nullptr,
+ DIERef(encoding_uid).GetUID(dwarf), encoding_data_type, &decl,
+ clang_type, resolve_state);
dwarf->GetDIEToType()[die.GetDIE()] = type_sp.get();
} break;
@@ -842,10 +843,10 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc,
// parameters in any class methods need it for the clang types for
// function prototypes.
LinkDeclContextToDIE(m_ast.GetDeclContextForType(clang_type), die);
- type_sp.reset(new Type(die.GetID(), dwarf, type_name_const_str,
- byte_size, NULL, LLDB_INVALID_UID,
- Type::eEncodingIsUID, &decl, clang_type,
- Type::eResolveStateForward));
+ type_sp = std::make_shared<Type>(
+ die.GetID(), dwarf, type_name_const_str, byte_size, nullptr,
+ LLDB_INVALID_UID, Type::eEncodingIsUID, &decl, clang_type,
+ Type::eResolveStateForward);
type_sp->SetIsCompleteObjCClass(is_complete_objc_class);
@@ -1102,10 +1103,10 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc,
LinkDeclContextToDIE(
ClangASTContext::GetDeclContextForType(clang_type), die);
- type_sp.reset(new Type(
- die.GetID(), dwarf, type_name_const_str, byte_size, NULL,
+ type_sp = std::make_shared<Type>(
+ die.GetID(), dwarf, type_name_const_str, byte_size, nullptr,
DIERef(encoding_form).GetUID(dwarf), Type::eEncodingIsUID, &decl,
- clang_type, Type::eResolveStateForward));
+ clang_type, Type::eResolveStateForward);
if (ClangASTContext::StartTagDeclarationDefinition(clang_type)) {
if (die.HasChildren()) {
@@ -1651,10 +1652,10 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc,
}
}
}
- type_sp.reset(new Type(die.GetID(), dwarf, type_name_const_str,
- llvm::None, NULL, LLDB_INVALID_UID,
- Type::eEncodingIsUID, &decl, clang_type,
- Type::eResolveStateFull));
+ type_sp = std::make_shared<Type>(
+ die.GetID(), dwarf, type_name_const_str, llvm::None, nullptr,
+ LLDB_INVALID_UID, Type::eEncodingIsUID, &decl, clang_type,
+ Type::eResolveStateFull);
assert(type_sp.get());
} break;
@@ -1802,10 +1803,11 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc,
m_ast.CreateArrayType(array_element_type, 0, is_vector);
}
ConstString empty_name;
- type_sp.reset(new Type(
+ type_sp = std::make_shared<Type>(
die.GetID(), dwarf, empty_name, array_element_bit_stride / 8,
- NULL, DIERef(type_die_form).GetUID(dwarf), Type::eEncodingIsUID,
- &decl, clang_type, Type::eResolveStateFull));
+ nullptr, DIERef(type_die_form).GetUID(dwarf),
+ Type::eEncodingIsUID, &decl, clang_type,
+ Type::eResolveStateFull);
type_sp->SetEncodingType(element_type);
m_ast.SetMetadataAsUserID(clang_type.GetOpaqueQualType(),
die.GetID());
@@ -1849,10 +1851,10 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc,
if (llvm::Optional<uint64_t> clang_type_size =
clang_type.GetByteSize(nullptr)) {
byte_size = *clang_type_size;
- type_sp.reset(new Type(die.GetID(), dwarf, type_name_const_str,
- byte_size, NULL, LLDB_INVALID_UID,
- Type::eEncodingIsUID, NULL, clang_type,
- Type::eResolveStateForward));
+ type_sp = std::make_shared<Type>(
+ die.GetID(), dwarf, type_name_const_str, byte_size, nullptr,
+ LLDB_INVALID_UID, Type::eEncodingIsUID, nullptr, clang_type,
+ Type::eResolveStateForward);
}
}
@@ -2652,10 +2654,11 @@ Function *DWARFASTParserClang::ParseFunctionFromDWARF(CompileUnit &comp_unit,
if (dwarf->FixupAddress(func_range.GetBaseAddress())) {
const user_id_t func_user_id = die.GetID();
- func_sp.reset(new Function(&comp_unit,
+ func_sp =
+ std::make_shared<Function>(&comp_unit,
func_user_id, // UserID is the DIE offset
func_user_id, func_name, func_type,
- func_range)); // first address range
+ func_range); // first address range
if (func_sp.get() != NULL) {
if (frame_base.IsValid())
diff --git a/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp b/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp
index 1be4a3124..1c0bc94e9 100644
--- a/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp
+++ b/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp
@@ -11,6 +11,8 @@
//#define ENABLE_DEBUG_PRINTF // DO NOT LEAVE THIS DEFINED: DEBUG ONLY!!!
#include <assert.h>
+#include <memory>
+
#include "lldb/Core/FileSpecList.h"
#include "lldb/Core/Module.h"
#include "lldb/Host/Host.h"
@@ -48,7 +50,7 @@ void DWARFDebugLine::Parse(const DWARFDataExtractor &debug_line_data) {
// DEBUG_PRINTF("m_lineTableMap[0x%8.8x] = line_table_sp\n",
// debug_line_offset);
m_lineTableMap[debug_line_offset] = line_table_sp;
- line_table_sp.reset(new LineTable);
+ line_table_sp = std::make_shared<LineTable>();
} else
++offset; // Try next byte in line table
}
diff --git a/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
index 5fe3001ec..90572c02e 100644
--- a/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ b/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -73,6 +73,7 @@
#include "llvm/Support/FileSystem.h"
#include <map>
+#include <memory>
#include <ctype.h>
#include <string.h>
@@ -130,7 +131,7 @@ public:
}
PluginProperties() {
- m_collection_sp.reset(new OptionValueProperties(GetSettingName()));
+ m_collection_sp = std::make_shared<OptionValueProperties>(GetSettingName());
m_collection_sp->Initialize(g_properties);
}
@@ -770,9 +771,9 @@ lldb::CompUnitSP SymbolFileDWARF::ParseCompileUnit(DWARFUnit *dwarf_cu,
cu_die.GetAttributeValueAsUnsigned(DW_AT_language, 0));
bool is_optimized = dwarf_cu->GetIsOptimized();
- cu_sp.reset(new CompileUnit(
+ cu_sp = std::make_shared<CompileUnit>(
module_sp, dwarf_cu, cu_file_spec, dwarf_cu->GetID(),
- cu_language, is_optimized ? eLazyBoolYes : eLazyBoolNo));
+ cu_language, is_optimized ? eLazyBoolYes : eLazyBoolNo);
if (cu_sp) {
// If we just created a compile unit with an invalid file spec,
// try and get the first entry in the supports files from the
@@ -3126,7 +3127,7 @@ size_t SymbolFileDWARF::ParseVariablesForContext(const SymbolContext &sc) {
VariableListSP variables(sc.comp_unit->GetVariableList(false));
if (variables.get() == NULL) {
- variables.reset(new VariableList());
+ variables = std::make_shared<VariableList>();
sc.comp_unit->SetVariableList(variables);
DIEArray die_offsets;
@@ -3540,10 +3541,10 @@ VariableSP SymbolFileDWARF::ParseVariableDIE(const SymbolContext &sc,
type_sp->GetType()->GetByteSize().getValueOr(0),
die.GetCU()->GetAddressByteSize());
- var_sp.reset(new Variable(die.GetID(), name, mangled, type_sp, scope,
- symbol_context_scope, scope_ranges, &decl,
- location, is_external, is_artificial,
- is_static_member));
+ var_sp = std::make_shared<Variable>(
+ die.GetID(), name, mangled, type_sp, scope, symbol_context_scope,
+ scope_ranges, &decl, location, is_external, is_artificial,
+ is_static_member);
var_sp->SetLocationIsConstantValueData(location_is_const_value_data);
} else {
@@ -3641,7 +3642,7 @@ size_t SymbolFileDWARF::ParseVariables(const SymbolContext &sc,
if (sc.comp_unit != NULL) {
variable_list_sp = sc.comp_unit->GetVariableList(false);
if (variable_list_sp.get() == NULL) {
- variable_list_sp.reset(new VariableList());
+ variable_list_sp = std::make_shared<VariableList>();
}
} else {
GetObjectFile()->GetModule()->ReportError(
@@ -3680,7 +3681,7 @@ size_t SymbolFileDWARF::ParseVariables(const SymbolContext &sc,
const bool can_create = false;
variable_list_sp = block->GetBlockVariableList(can_create);
if (variable_list_sp.get() == NULL) {
- variable_list_sp.reset(new VariableList());
+ variable_list_sp = std::make_shared<VariableList>();
block->SetVariableList(variable_list_sp);
}
}
diff --git a/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp b/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
index 1c4651add..5fca171e0 100644
--- a/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
+++ b/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
@@ -7,7 +7,6 @@
//===----------------------------------------------------------------------===//
#include "SymbolFileDWARFDebugMap.h"
-
#include "DWARFDebugAranges.h"
#include "lldb/Core/Module.h"
@@ -35,6 +34,8 @@
#include "LogChannelDWARF.h"
#include "SymbolFileDWARF.h"
+#include <memory>
+
using namespace lldb;
using namespace lldb_private;
@@ -411,7 +412,7 @@ Module *SymbolFileDWARFDebugMap::GetModuleByCompUnitInfo(
comp_unit_info->oso_sp = pos->second;
} else {
ObjectFile *obj_file = GetObjectFile();
- comp_unit_info->oso_sp.reset(new OSOInfo());
+ comp_unit_info->oso_sp = std::make_shared<OSOInfo>();
m_oso_map[{comp_unit_info->oso_path, comp_unit_info->oso_mod_time}] =
comp_unit_info->oso_sp;
const char *oso_path = comp_unit_info->oso_path.GetCString();
@@ -455,11 +456,10 @@ Module *SymbolFileDWARFDebugMap::GetModuleByCompUnitInfo(
.getArchName()
.str()
.c_str());
- comp_unit_info->oso_sp->module_sp.reset(new DebugMapModule(
+ comp_unit_info->oso_sp->module_sp = std::make_shared<DebugMapModule>(
obj_file->GetModule(), GetCompUnitInfoIndex(comp_unit_info), oso_file,
- oso_arch, oso_object ? &oso_object : NULL, 0,
- oso_object ? comp_unit_info->oso_mod_time
- : llvm::sys::TimePoint<>()));
+ oso_arch, oso_object ? &oso_object : nullptr, 0,
+ oso_object ? comp_unit_info->oso_mod_time : llvm::sys::TimePoint<>());
}
}
if (comp_unit_info->oso_sp)
@@ -581,9 +581,10 @@ CompUnitSP SymbolFileDWARFDebugMap::ParseCompileUnitAtIndex(uint32_t cu_idx) {
// User zero as the ID to match the compile unit at offset zero in each
// .o file since each .o file can only have one compile unit for now.
lldb::user_id_t cu_id = 0;
- m_compile_unit_infos[cu_idx].compile_unit_sp.reset(
- new CompileUnit(m_obj_file->GetModule(), NULL, so_file_spec, cu_id,
- eLanguageTypeUnknown, eLazyBoolCalculate));
+ m_compile_unit_infos[cu_idx].compile_unit_sp =
+ std::make_shared<CompileUnit>(
+ m_obj_file->GetModule(), nullptr, so_file_spec, cu_id,
+ eLanguageTypeUnknown, eLazyBoolCalculate);
if (m_compile_unit_infos[cu_idx].compile_unit_sp) {
// Let our symbol vendor know about this compile unit
diff --git a/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp b/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp
index de68411be..c875f8832 100644
--- a/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp
+++ b/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp
@@ -7,6 +7,7 @@
//===----------------------------------------------------------------------===//
#include "SymbolFileSymtab.h"
+
#include "lldb/Core/Module.h"
#include "lldb/Core/PluginManager.h"
#include "lldb/Symbol/CompileUnit.h"
@@ -19,6 +20,8 @@
#include "lldb/Utility/RegularExpression.h"
#include "lldb/Utility/Timer.h"
+#include <memory>
+
using namespace lldb;
using namespace lldb_private;
@@ -123,9 +126,9 @@ CompUnitSP SymbolFileSymtab::ParseCompileUnitAtIndex(uint32_t idx) {
const Symbol *cu_symbol =
m_obj_file->GetSymtab()->SymbolAtIndex(m_source_indexes[idx]);
if (cu_symbol)
- cu_sp.reset(new CompileUnit(m_obj_file->GetModule(), NULL,
+ cu_sp = std::make_shared<CompileUnit>(m_obj_file->GetModule(), nullptr,
cu_symbol->GetName().AsCString(), 0,
- eLanguageTypeUnknown, eLazyBoolNo));
+ eLanguageTypeUnknown, eLazyBoolNo);
}
return cu_sp;
}
diff --git a/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp b/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp
index 6dca6b650..513bdb3cc 100644
--- a/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp
+++ b/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());
diff --git a/source/Plugins/UnwindAssembly/x86/x86AssemblyInspectionEngine.cpp b/source/Plugins/UnwindAssembly/x86/x86AssemblyInspectionEngine.cpp
index 615d35b91..c8468181e 100644
--- a/source/Plugins/UnwindAssembly/x86/x86AssemblyInspectionEngine.cpp
+++ b/source/Plugins/UnwindAssembly/x86/x86AssemblyInspectionEngine.cpp
@@ -8,6 +8,8 @@
#include "x86AssemblyInspectionEngine.h"
+#include <memory>
+
#include "llvm-c/Disassembler.h"
#include "lldb/Core/Address.h"
@@ -1172,7 +1174,7 @@ bool x86AssemblyInspectionEngine::AugmentUnwindPlanFromCallSite(
*new_row = *original_last_row;
new_row->SetOffset(offset);
unwind_plan.AppendRow(new_row);
- row.reset(new UnwindPlan::Row());
+ row = std::make_shared<UnwindPlan::Row>();
*row = *new_row;
reinstate_unwind_state = false;
unwind_plan_updated = true;
diff --git a/source/Symbol/Block.cpp b/source/Symbol/Block.cpp
index 0d317c539..6a0c37b72 100644
--- a/source/Symbol/Block.cpp
+++ b/source/Symbol/Block.cpp
@@ -16,6 +16,8 @@
#include "lldb/Symbol/VariableList.h"
#include "lldb/Utility/Log.h"
+#include <memory>
+
using namespace lldb;
using namespace lldb_private;
@@ -363,8 +365,8 @@ void Block::AddChild(const BlockSP &child_block_sp) {
void Block::SetInlinedFunctionInfo(const char *name, const char *mangled,
const Declaration *decl_ptr,
const Declaration *call_decl_ptr) {
- m_inlineInfoSP.reset(
- new InlineFunctionInfo(name, mangled, decl_ptr, call_decl_ptr));
+ m_inlineInfoSP = std::make_shared<InlineFunctionInfo>(name, mangled, decl_ptr,
+ call_decl_ptr);
}
VariableListSP Block::GetBlockVariableList(bool can_create) {
diff --git a/source/Symbol/ClangASTImporter.cpp b/source/Symbol/ClangASTImporter.cpp
index a1c6408fd..96d9227cb 100644
--- a/source/Symbol/ClangASTImporter.cpp
+++ b/source/Symbol/ClangASTImporter.cpp
@@ -18,6 +18,8 @@
#include "clang/AST/DeclObjC.h"
#include "llvm/Support/raw_ostream.h"
+#include <memory>
+
using namespace lldb_private;
using namespace clang;
@@ -765,7 +767,7 @@ void ClangASTImporter::BuildNamespaceMap(const clang::NamespaceDecl *decl) {
NamespaceMapSP new_map;
- new_map.reset(new NamespaceMap);
+ new_map = std::make_shared<NamespaceMap>();
if (context_md->m_map_completer) {
std::string namespace_string = decl->getDeclName().getAsString();
diff --git a/source/Symbol/CompactUnwindInfo.cpp b/source/Symbol/CompactUnwindInfo.cpp
index 20987a0a2..f28bb362f 100644
--- a/source/Symbol/CompactUnwindInfo.cpp
+++ b/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 @@ void CompactUnwindInfo::ScanIndex(const ProcessSP &process_sp) {
// 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()),
diff --git a/source/Symbol/FuncUnwinders.cpp b/source/Symbol/FuncUnwinders.cpp
index ee7bf608c..07b4f0526 100644
--- a/source/Symbol/FuncUnwinders.cpp
+++ b/source/Symbol/FuncUnwinders.cpp
@@ -23,6 +23,8 @@
#include "lldb/Target/Thread.h"
#include "lldb/Target/UnwindAssembly.h"
+#include <memory>
+
using namespace lldb;
using namespace lldb_private;
@@ -110,8 +112,8 @@ UnwindPlanSP FuncUnwinders::GetEHFrameUnwindPlan(Target &target,
current_pc.SetOffset(current_pc.GetOffset() + current_offset);
DWARFCallFrameInfo *eh_frame = m_unwind_table.GetEHFrameInfo();
if (eh_frame) {
- m_unwind_plan_eh_frame_sp.reset(
- new UnwindPlan(lldb::eRegisterKindGeneric));
+ m_unwind_plan_eh_frame_sp =
+ std::make_shared<UnwindPlan>(lldb::eRegisterKindGeneric);
if (!eh_frame->GetUnwindPlan(current_pc, *m_unwind_plan_eh_frame_sp))
m_unwind_plan_eh_frame_sp.reset();
}
@@ -132,8 +134,8 @@ UnwindPlanSP FuncUnwinders::GetDebugFrameUnwindPlan(Target &target,
current_pc.SetOffset(current_pc.GetOffset() + current_offset);
DWARFCallFrameInfo *debug_frame = m_unwind_table.GetDebugFrameInfo();
if (debug_frame) {
- m_unwind_plan_debug_frame_sp.reset(
- new UnwindPlan(lldb::eRegisterKindGeneric));
+ m_unwind_plan_debug_frame_sp =
+ std::make_shared<UnwindPlan>(lldb::eRegisterKindGeneric);
if (!debug_frame->GetUnwindPlan(current_pc,
*m_unwind_plan_debug_frame_sp))
m_unwind_plan_debug_frame_sp.reset();
@@ -155,8 +157,8 @@ UnwindPlanSP FuncUnwinders::GetArmUnwindUnwindPlan(Target &target,
current_pc.SetOffset(current_pc.GetOffset() + current_offset);
ArmUnwindInfo *arm_unwind_info = m_unwind_table.GetArmUnwindInfo();
if (arm_unwind_info) {
- m_unwind_plan_arm_unwind_sp.reset(
- new UnwindPlan(lldb::eRegisterKindGeneric));
+ m_unwind_plan_arm_unwind_sp =
+ std::make_shared<UnwindPlan>(lldb::eRegisterKindGeneric);
if (!arm_unwind_info->GetUnwindPlan(target, current_pc,
*m_unwind_plan_arm_unwind_sp))
m_unwind_plan_arm_unwind_sp.reset();
@@ -189,7 +191,8 @@ UnwindPlanSP FuncUnwinders::GetEHFrameAugmentedUnwindPlan(Target &target,
if (!eh_frame_plan)
return m_unwind_plan_eh_frame_augmented_sp;
- m_unwind_plan_eh_frame_augmented_sp.reset(new UnwindPlan(*eh_frame_plan));
+ m_unwind_plan_eh_frame_augmented_sp =
+ std::make_shared<UnwindPlan>(*eh_frame_plan);
// Augment the eh_frame instructions with epilogue descriptions if necessary
// so the UnwindPlan can be used at any instruction in the function.
@@ -231,8 +234,8 @@ FuncUnwinders::GetDebugFrameAugmentedUnwindPlan(Target &target, Thread &thread,
if (!debug_frame_plan)
return m_unwind_plan_debug_frame_augmented_sp;
- m_unwind_plan_debug_frame_augmented_sp.reset(
- new UnwindPlan(*debug_frame_plan));
+ m_unwind_plan_debug_frame_augmented_sp =
+ std::make_shared<UnwindPlan>(*debug_frame_plan);
// Augment the debug_frame instructions with epilogue descriptions if
// necessary so the UnwindPlan can be used at any instruction in the
@@ -262,7 +265,8 @@ UnwindPlanSP FuncUnwinders::GetAssemblyUnwindPlan(Target &target,
UnwindAssemblySP assembly_profiler_sp(GetUnwindAssemblyProfiler(target));
if (assembly_profiler_sp) {
- m_unwind_plan_assembly_sp.reset(new UnwindPlan(lldb::eRegisterKindGeneric));
+ m_unwind_plan_assembly_sp =
+ std::make_shared<UnwindPlan>(lldb::eRegisterKindGeneric);
if (!assembly_profiler_sp->GetNonCallSiteUnwindPlanFromAssembly(
m_range, thread, *m_unwind_plan_assembly_sp)) {
m_unwind_plan_assembly_sp.reset();
@@ -364,7 +368,8 @@ UnwindPlanSP FuncUnwinders::GetUnwindPlanFastUnwind(Target &target,
UnwindAssemblySP assembly_profiler_sp(GetUnwindAssemblyProfiler(target));
if (assembly_profiler_sp) {
- m_unwind_plan_fast_sp.reset(new UnwindPlan(lldb::eRegisterKindGeneric));
+ m_unwind_plan_fast_sp =
+ std::make_shared<UnwindPlan>(lldb::eRegisterKindGeneric);
if (!assembly_profiler_sp->GetFastUnwindPlan(m_range, thread,
*m_unwind_plan_fast_sp)) {
m_unwind_plan_fast_sp.reset();
@@ -385,8 +390,8 @@ UnwindPlanSP FuncUnwinders::GetUnwindPlanArchitectureDefault(Thread &thread) {
if (process_sp) {
ABI *abi = process_sp->GetABI().get();
if (abi) {
- m_unwind_plan_arch_default_sp.reset(
- new UnwindPlan(lldb::eRegisterKindGeneric));
+ m_unwind_plan_arch_default_sp =
+ std::make_shared<UnwindPlan>(lldb::eRegisterKindGeneric);
if (!abi->CreateDefaultUnwindPlan(*m_unwind_plan_arch_default_sp)) {
m_unwind_plan_arch_default_sp.reset();
}
@@ -410,8 +415,8 @@ FuncUnwinders::GetUnwindPlanArchitectureDefaultAtFunctionEntry(Thread &thread) {
if (process_sp) {
ABI *abi = process_sp->GetABI().get();
if (abi) {
- m_unwind_plan_arch_default_at_func_entry_sp.reset(
- new UnwindPlan(lldb::eRegisterKindGeneric));
+ m_unwind_plan_arch_default_at_func_entry_sp =
+ std::make_shared<UnwindPlan>(lldb::eRegisterKindGeneric);
if (!abi->CreateFunctionEntryUnwindPlan(
*m_unwind_plan_arch_default_at_func_entry_sp)) {
m_unwind_plan_arch_default_at_func_entry_sp.reset();
diff --git a/source/Target/CPPLanguageRuntime.cpp b/source/Target/CPPLanguageRuntime.cpp
index f3d3ad5a5..ead8d7893 100644
--- a/source/Target/CPPLanguageRuntime.cpp
+++ b/source/Target/CPPLanguageRuntime.cpp
@@ -11,6 +11,8 @@
#include <string.h>
+#include <memory>
+
#include "llvm/ADT/StringRef.h"
#include "lldb/Symbol/Block.h"
@@ -327,16 +329,16 @@ CPPLanguageRuntime::GetStepThroughTrampolinePlan(Thread &thread,
value_sp->GetValueIsValid()) {
// We found the std::function wrapped callable and we have its address.
// We now create a ThreadPlan to run to the callable.
- ret_plan_sp.reset(new ThreadPlanRunToAddress(
- thread, callable_info.callable_address, stop_others));
+ ret_plan_sp = std::make_shared<ThreadPlanRunToAddress>(
+ thread, callable_info.callable_address, stop_others);
return ret_plan_sp;
} else {
// We are in std::function but we could not obtain the callable.
// We create a ThreadPlan to keep stepping through using the address range
// of the current function.
- ret_plan_sp.reset(new ThreadPlanStepInRange(thread, range_of_curr_func,
- sc, eOnlyThisThread,
- eLazyBoolYes, eLazyBoolYes));
+ ret_plan_sp = std::make_shared<ThreadPlanStepInRange>(
+ thread, range_of_curr_func, sc, eOnlyThisThread, eLazyBoolYes,
+ eLazyBoolYes);
return ret_plan_sp;
}
}
diff --git a/source/Target/Memory.cpp b/source/Target/Memory.cpp
index b3540a4fc..c0597b687 100644
--- a/source/Target/Memory.cpp
+++ b/source/Target/Memory.cpp
@@ -7,13 +7,16 @@
//===----------------------------------------------------------------------===//
#include "lldb/Target/Memory.h"
-#include <inttypes.h>
+
#include "lldb/Core/RangeMap.h"
#include "lldb/Target/Process.h"
#include "lldb/Utility/DataBufferHeap.h"
#include "lldb/Utility/Log.h"
#include "lldb/Utility/State.h"
+#include <cinttypes>
+#include <memory>
+
using namespace lldb;
using namespace lldb_private;
@@ -357,8 +360,8 @@ AllocatedMemoryCache::AllocatePage(uint32_t byte_size, uint32_t permissions,
}
if (addr != LLDB_INVALID_ADDRESS) {
- block_sp.reset(
- new AllocatedBlock(addr, page_byte_size, permissions, chunk_size));
+ block_sp = std::make_shared<AllocatedBlock>(addr, page_byte_size,
+ permissions, chunk_size);
m_memory_map.insert(std::make_pair(permissions, block_sp));
}
return block_sp;
diff --git a/source/Target/Platform.cpp b/source/Target/Platform.cpp
index 86f69d1d0..a93913b25 100644
--- a/source/Target/Platform.cpp
+++ b/source/Target/Platform.cpp
@@ -9,6 +9,7 @@
#include <algorithm>
#include <csignal>
#include <fstream>
+#include <memory>
#include <vector>
#include "llvm/Support/FileSystem.h"
@@ -78,7 +79,7 @@ ConstString PlatformProperties::GetSettingName() {
}
PlatformProperties::PlatformProperties() {
- m_collection_sp.reset(new OptionValueProperties(GetSettingName()));
+ m_collection_sp = std::make_shared<OptionValueProperties>(GetSettingName());
m_collection_sp->Initialize(g_properties);
auto module_cache_dir = GetModuleCacheDirectory();
diff --git a/source/Target/Process.cpp b/source/Target/Process.cpp
index d9b2b833b..58d85a2d7 100644
--- a/source/Target/Process.cpp
+++ b/source/Target/Process.cpp
@@ -7,6 +7,7 @@
//===----------------------------------------------------------------------===//
#include <atomic>
+#include <memory>
#include <mutex>
#include "llvm/Support/ScopedPrinter.h"
@@ -163,15 +164,15 @@ ProcessProperties::ProcessProperties(lldb_private::Process *process)
{
if (process == nullptr) {
// Global process properties, set them up one time
- m_collection_sp.reset(
- new ProcessOptionValueProperties(ConstString("process")));
+ m_collection_sp =
+ std::make_shared<ProcessOptionValueProperties>(ConstString("process"));
m_collection_sp->Initialize(g_properties);
m_collection_sp->AppendProperty(
ConstString("thread"), ConstString("Settings specific to threads."),
true, Thread::GetGlobalProperties()->GetValueProperties());
} else {
- m_collection_sp.reset(
- new ProcessOptionValueProperties(Process::GetGlobalProperties().get()));
+ m_collection_sp = std::make_shared<ProcessOptionValueProperties>(
+ Process::GetGlobalProperties().get());
m_collection_sp->SetValueChangedCallback(
ePropertyPythonOSPluginPath,
ProcessProperties::OptionValueChangedCallback, this);
@@ -4670,7 +4671,8 @@ void Process::SetSTDIOFileDescriptor(int fd) {
// Now read thread is set up, set up input reader.
if (!m_process_input_reader)
- m_process_input_reader.reset(new IOHandlerProcessSTDIO(this, fd));
+ m_process_input_reader =
+ std::make_shared<IOHandlerProcessSTDIO>(this, fd);
}
}
}
@@ -5944,7 +5946,8 @@ ThreadCollectionSP Process::GetHistoryThreads(lldb::addr_t addr) {
return threads;
}
- threads.reset(new ThreadCollection(memory_history->GetHistoryThreads(addr)));
+ threads = std::make_shared<ThreadCollection>(
+ memory_history->GetHistoryThreads(addr));
return threads;
}
diff --git a/source/Target/StackFrame.cpp b/source/Target/StackFrame.cpp
index d0f7835ef..0b5b394e5 100644
--- a/source/Target/StackFrame.cpp
+++ b/source/Target/StackFrame.cpp
@@ -33,6 +33,8 @@
#include "lldb/lldb-enumerations.h"
+#include <memory>
+
using namespace lldb;
using namespace lldb_private;
@@ -422,7 +424,7 @@ VariableList *StackFrame::GetVariableList(bool get_file_globals) {
const bool get_child_variables = true;
const bool can_create = true;
const bool stop_if_child_block_is_inlined_function = true;
- m_variable_list_sp.reset(new VariableList());
+ m_variable_list_sp = std::make_shared<VariableList>();
frame_block->AppendBlockVariables(can_create, get_child_variables,
stop_if_child_block_is_inlined_function,
[](Variable *v) { return true; },
@@ -1173,7 +1175,7 @@ ValueObjectSP StackFrame::TrackGlobalVariable(const VariableSP &variable_sp,
VariableList *var_list = GetVariableList(true);
// If this frame has no variables, create a new list
if (var_list == nullptr)
- m_variable_list_sp.reset(new VariableList());
+ m_variable_list_sp = std::make_shared<VariableList>();
// Add the global/static variable to this frame
m_variable_list_sp->AddVariable(variable_sp);
diff --git a/source/Target/StackFrameList.cpp b/source/Target/StackFrameList.cpp
index 3a97c1375..a36fba45c 100644
--- a/source/Target/StackFrameList.cpp
+++ b/source/Target/StackFrameList.cpp
@@ -24,6 +24,8 @@
#include "lldb/Utility/Log.h"
#include "llvm/ADT/SmallPtrSet.h"
+#include <memory>
+
//#define DEBUG_STACK_FRAMES 1
using namespace lldb;
@@ -465,9 +467,9 @@ void StackFrameList::GetFramesUpTo(uint32_t end_idx) {
pc = reg_ctx_sp->GetPC();
}
- unwind_frame_sp.reset(new StackFrame(m_thread.shared_from_this(),
- m_frames.size(), idx, reg_ctx_sp,
- cfa, pc, nullptr));
+ unwind_frame_sp = std::make_shared<StackFrame>(
+ m_thread.shared_from_this(), m_frames.size(), idx, reg_ctx_sp,
+ cfa, pc, nullptr);
m_frames.push_back(unwind_frame_sp);
}
} else {
@@ -483,9 +485,9 @@ void StackFrameList::GetFramesUpTo(uint32_t end_idx) {
break;
}
const bool cfa_is_valid = true;
- unwind_frame_sp.reset(
- new StackFrame(m_thread.shared_from_this(), m_frames.size(), idx, cfa,
- cfa_is_valid, pc, StackFrame::Kind::Regular, nullptr));
+ unwind_frame_sp = std::make_shared<StackFrame>(
+ m_thread.shared_from_this(), m_frames.size(), idx, cfa, cfa_is_valid,
+ pc, StackFrame::Kind::Regular, nullptr);
// Create synthetic tail call frames between the previous frame and the
// newly-found frame. The new frame's index may change after this call,
@@ -663,9 +665,9 @@ StackFrameSP StackFrameList::GetFrameAtIndex(uint32_t idx) {
addr_t pc, cfa;
if (unwinder->GetFrameInfoAtIndex(idx, cfa, pc)) {
const bool cfa_is_valid = true;
- frame_sp.reset(new StackFrame(m_thread.shared_from_this(), idx, idx,
- cfa, cfa_is_valid, pc,
- StackFrame::Kind::Regular, nullptr));
+ frame_sp = std::make_shared<StackFrame>(
+ m_thread.shared_from_this(), idx, idx, cfa, cfa_is_valid, pc,
+ StackFrame::Kind::Regular, nullptr);
Function *function =
frame_sp->GetSymbolContext(eSymbolContextFunction).function;
diff --git a/source/Target/Target.cpp b/source/Target/Target.cpp
index bc0bdae0f..9fbd9fb36 100644
--- a/source/Target/Target.cpp
+++ b/source/Target/Target.cpp
@@ -57,6 +57,8 @@
#include "lldb/Utility/State.h"
#include "lldb/Utility/StreamString.h"
#include "lldb/Utility/Timer.h"
+
+#include <memory>
#include <mutex>
using namespace lldb;
@@ -497,12 +499,13 @@ Target::GetSearchFilterForModule(const FileSpec *containingModule) {
if (containingModule != nullptr) {
// TODO: We should look into sharing module based search filters
// across many breakpoints like we do for the simple target based one
- filter_sp.reset(
- new SearchFilterByModule(shared_from_this(), *containingModule));
+ filter_sp = std::make_shared<SearchFilterByModule>(shared_from_this(),
+ *containingModule);
} else {
if (!m_search_filter_sp)
- m_search_filter_sp.reset(
- new SearchFilterForUnconstrainedSearches(shared_from_this()));
+ m_search_filter_sp =
+ std::make_shared<SearchFilterForUnconstrainedSearches>(
+ shared_from_this());
filter_sp = m_search_filter_sp;
}
return filter_sp;
@@ -514,12 +517,13 @@ Target::GetSearchFilterForModuleList(const FileSpecList *containingModules) {
if (containingModules && containingModules->GetSize() != 0) {
// TODO: We should look into sharing module based search filters
// across many breakpoints like we do for the simple target based one
- filter_sp.reset(
- new SearchFilterByModuleList(shared_from_this(), *containingModules));
+ filter_sp = std::make_shared<SearchFilterByModuleList>(shared_from_this(),
+ *containingModules);
} else {
if (!m_search_filter_sp)
- m_search_filter_sp.reset(
- new SearchFilterForUnconstrainedSearches(shared_from_this()));
+ m_search_filter_sp =
+ std::make_shared<SearchFilterForUnconstrainedSearches>(
+ shared_from_this());
filter_sp = m_search_filter_sp;
}
return filter_sp;
@@ -536,11 +540,11 @@ SearchFilterSP Target::GetSearchFilterForModuleAndCUList(
// We could make a special "CU List only SearchFilter". Better yet was if
// these could be composable, but that will take a little reworking.
- filter_sp.reset(new SearchFilterByModuleListAndCU(
- shared_from_this(), FileSpecList(), *containingSourceFiles));
+ filter_sp = std::make_shared<SearchFilterByModuleListAndCU>(
+ shared_from_this(), FileSpecList(), *containingSourceFiles);
} else {
- filter_sp.reset(new SearchFilterByModuleListAndCU(
- shared_from_this(), *containingModules, *containingSourceFiles));
+ filter_sp = std::make_shared<SearchFilterByModuleListAndCU>(
+ shared_from_this(), *containingModules, *containingSourceFiles);
}
return filter_sp;
}
@@ -604,7 +608,8 @@ Target::CreateScriptedBreakpoint(const llvm::StringRef class_name,
} else if (has_modules) {
filter_sp = GetSearchFilterForModuleList(containingModules);
} else {
- filter_sp.reset(new SearchFilterForUnconstrainedSearches(shared_from_this()));
+ filter_sp = std::make_shared<SearchFilterForUnconstrainedSearches>(
+ shared_from_this());
}
StructuredDataImpl *extra_args_impl = new StructuredDataImpl();
@@ -847,7 +852,7 @@ WatchpointSP Target::CreateWatchpoint(lldb::addr_t addr, size_t size,
}
if (!wp_sp) {
- wp_sp.reset(new Watchpoint(*this, addr, size, type));
+ wp_sp = std::make_shared<Watchpoint>(*this, addr, size, type);
wp_sp->SetWatchpointType(kind, notify);
m_watchpoint_list.Add(wp_sp, true);
}
@@ -1024,7 +1029,7 @@ Status Target::SerializeBreakpointsToFile(const FileSpec &file,
}
if (!break_store_ptr) {
- break_store_sp.reset(new StructuredData::Array());
+ break_store_sp = std::make_shared<StructuredData::Array>();
break_store_ptr = break_store_sp.get();
}
@@ -2290,7 +2295,7 @@ ClangASTContext *Target::GetScratchClangASTContext(bool create_on_demand) {
ClangASTImporterSP Target::GetClangASTImporter() {
if (m_valid) {
if (!m_ast_importer_sp) {
- m_ast_importer_sp.reset(new ClangASTImporter());
+ m_ast_importer_sp = std::make_shared<ClangASTImporter>();
}
return m_ast_importer_sp;
}
@@ -3591,8 +3596,8 @@ TargetExperimentalProperties::TargetExperimentalProperties()
TargetProperties::TargetProperties(Target *target)
: Properties(), m_launch_info() {
if (target) {
- m_collection_sp.reset(
- new TargetOptionValueProperties(target, Target::GetGlobalProperties()));
+ m_collection_sp = std::make_shared<TargetOptionValueProperties>(
+ target, Target::GetGlobalProperties());
// Set callbacks to update launch_info whenever "settins set" updated any
// of these properties
@@ -3640,8 +3645,8 @@ TargetProperties::TargetProperties(Target *target)
DisableASLRValueChangedCallback(this, nullptr);
DisableSTDIOValueChangedCallback(this, nullptr);
} else {
- m_collection_sp.reset(
- new TargetOptionValueProperties(ConstString("target")));
+ m_collection_sp =
+ std::make_shared<TargetOptionValueProperties>(ConstString("target"));
m_collection_sp->Initialize(g_properties);
m_experimental_properties_up.reset(new TargetExperimentalProperties());
m_collection_sp->AppendProperty(
diff --git a/source/Target/Thread.cpp b/source/Target/Thread.cpp
index 2a9065e27..2bdaa9873 100644
--- a/source/Target/Thread.cpp
+++ b/source/Target/Thread.cpp
@@ -50,6 +50,8 @@
#include "lldb/Utility/StreamString.h"
#include "lldb/lldb-enumerations.h"
+#include <memory>
+
using namespace lldb;
using namespace lldb_private;
@@ -121,12 +123,12 @@ public:
ThreadProperties::ThreadProperties(bool is_global) : Properties() {
if (is_global) {
- m_collection_sp.reset(
- new ThreadOptionValueProperties(ConstString("thread")));
+ m_collection_sp =
+ std::make_shared<ThreadOptionValueProperties>(ConstString("thread"));
m_collection_sp->Initialize(g_properties);
} else
- m_collection_sp.reset(
- new ThreadOptionValueProperties(Thread::GetGlobalProperties().get()));
+ m_collection_sp = std::make_shared<ThreadOptionValueProperties>(
+ Thread::GetGlobalProperties().get());
}
ThreadProperties::~ThreadProperties() = default;
@@ -1383,9 +1385,9 @@ ThreadPlanSP Thread::QueueThreadPlanForStepOverRange(
const SymbolContext &addr_context, lldb::RunMode stop_other_threads,
Status &status, LazyBool step_out_avoids_code_withoug_debug_info) {
ThreadPlanSP thread_plan_sp;
- thread_plan_sp.reset(new ThreadPlanStepOverRange(
+ thread_plan_sp = std::make_shared<ThreadPlanStepOverRange>(
*this, range, addr_context, stop_other_threads,
- step_out_avoids_code_withoug_debug_info));
+ step_out_avoids_code_withoug_debug_info);
status = QueueThreadPlan(thread_plan_sp, abort_other_plans);
return thread_plan_sp;
@@ -1603,7 +1605,8 @@ StackFrameListSP Thread::GetStackFrameList() {
if (m_curr_frames_sp) {
frame_list_sp = m_curr_frames_sp;
} else {
- frame_list_sp.reset(new StackFrameList(*this, m_prev_frames_sp, true));
+ frame_list_sp =
+ std::make_shared<StackFrameList>(*this, m_prev_frames_sp, true);
m_curr_frames_sp = frame_list_sp;
}
return frame_list_sp;
diff --git a/source/Target/ThreadPlanCallFunction.cpp b/source/Target/ThreadPlanCallFunction.cpp
index bf2a2ac2e..0c488dee1 100644
--- a/source/Target/ThreadPlanCallFunction.cpp
+++ b/source/Target/ThreadPlanCallFunction.cpp
@@ -24,6 +24,8 @@
#include "lldb/Utility/Log.h"
#include "lldb/Utility/Stream.h"
+#include <memory>
+
using namespace lldb;
using namespace lldb_private;
@@ -404,8 +406,8 @@ void ThreadPlanCallFunction::DidPush() {
GetThread().SetStopInfoToNothing();
#ifndef SINGLE_STEP_EXPRESSIONS
- m_subplan_sp.reset(
- new ThreadPlanRunToAddress(m_thread, m_start_addr, m_stop_other_threads));
+ m_subplan_sp = std::make_shared<ThreadPlanRunToAddress>(
+ m_thread, m_start_addr, m_stop_other_threads);
m_thread.QueueThreadPlan(m_subplan_sp, false);
m_subplan_sp->SetPrivate(true);
diff --git a/source/Target/ThreadPlanStepOut.cpp b/source/Target/ThreadPlanStepOut.cpp
index 146d72fd4..2683ec3aa 100644
--- a/source/Target/ThreadPlanStepOut.cpp
+++ b/source/Target/ThreadPlanStepOut.cpp
@@ -23,6 +23,8 @@
#include "lldb/Target/ThreadPlanStepThrough.h"
#include "lldb/Utility/Log.h"
+#include <memory>
+
using namespace lldb;
using namespace lldb_private;
@@ -84,9 +86,9 @@ ThreadPlanStepOut::ThreadPlanStepOut(
if (frame_idx > 0) {
// First queue a plan that gets us to this inlined frame, and when we get
// there we'll queue a second plan that walks us out of this frame.
- m_step_out_to_inline_plan_sp.reset(new ThreadPlanStepOut(
+ m_step_out_to_inline_plan_sp = std::make_shared<ThreadPlanStepOut>(
m_thread, nullptr, false, stop_others, eVoteNoOpinion, eVoteNoOpinion,
- frame_idx - 1, eLazyBoolNo, continue_to_next_branch));
+ frame_idx - 1, eLazyBoolNo, continue_to_next_branch);
static_cast<ThreadPlanStepOut *>(m_step_out_to_inline_plan_sp.get())
->SetShouldStopHereCallbacks(nullptr, nullptr);
m_step_out_to_inline_plan_sp->SetPrivate(true);
@@ -449,8 +451,9 @@ bool ThreadPlanStepOut::QueueInlinedStepPlan(bool queue_now) {
m_stop_others ? lldb::eOnlyThisThread : lldb::eAllThreads;
const LazyBool avoid_no_debug = eLazyBoolNo;
- m_step_through_inline_plan_sp.reset(new ThreadPlanStepOverRange(
- m_thread, inline_range, inlined_sc, run_mode, avoid_no_debug));
+ m_step_through_inline_plan_sp =
+ std::make_shared<ThreadPlanStepOverRange>(
+ m_thread, inline_range, inlined_sc, run_mode, avoid_no_debug);
ThreadPlanStepOverRange *step_through_inline_plan_ptr =
static_cast<ThreadPlanStepOverRange *>(
m_step_through_inline_plan_sp.get());