diff options
Diffstat (limited to 'lldb/source/Plugins')
53 files changed, 333 insertions, 223 deletions
diff --git a/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp b/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp index f1b8d64b6f6..d8f3e3d36d0 100644 --- a/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp +++ b/lldb/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/lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp b/lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp index 1e4dc3f60ba..a9e643acc4a 100644 --- a/lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp +++ b/lldb/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/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp index 6f7e93d170f..c561eb401f5 100644 --- a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp +++ b/lldb/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/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp index 96d9db5dd50..b90ba241749 100644 --- a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp +++ b/lldb/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/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp index fbc468250ff..316f06295ea 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp +++ b/lldb/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/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp index 27985d02dfd..a2231307381 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp +++ b/lldb/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/lldb/source/Plugins/InstrumentationRuntime/MainThreadChecker/MainThreadCheckerRuntime.cpp b/lldb/source/Plugins/InstrumentationRuntime/MainThreadChecker/MainThreadCheckerRuntime.cpp index b23254c8d00..297dd2b58cb 100644 --- a/lldb/source/Plugins/InstrumentationRuntime/MainThreadChecker/MainThreadCheckerRuntime.cpp +++ b/lldb/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/lldb/source/Plugins/InstrumentationRuntime/TSan/TSanRuntime.cpp b/lldb/source/Plugins/InstrumentationRuntime/TSan/TSanRuntime.cpp index 3c195accbd9..aa615837c20 100644 --- a/lldb/source/Plugins/InstrumentationRuntime/TSan/TSanRuntime.cpp +++ b/lldb/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/lldb/source/Plugins/InstrumentationRuntime/UBSan/UBSanRuntime.cpp b/lldb/source/Plugins/InstrumentationRuntime/UBSan/UBSanRuntime.cpp index e400b8160c4..8445954be0a 100644 --- a/lldb/source/Plugins/InstrumentationRuntime/UBSan/UBSanRuntime.cpp +++ b/lldb/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/lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp b/lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp index 7b19ca48476..857ef4632a0 100644 --- a/lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp +++ b/lldb/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/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp index fde99473701..1b177829363 100644 --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp +++ b/lldb/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/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp index 96e2c098ebf..cd7f332c61e 100644 --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp +++ b/lldb/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/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp index aeb8294b7a8..bd748448336 100644 --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp +++ b/lldb/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/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.cpp index 85fd6620c90..bbfd8075db9 100644 --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.cpp +++ b/lldb/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/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp index bae1da0edd6..b6739345c85 100644 --- a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp +++ b/lldb/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/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp index 4046082c02c..dc583815d65 100644 --- a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp +++ b/lldb/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/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp b/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp index 7ef0611a48c..32cee742e48 100644 --- a/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp +++ b/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp @@ -9,6 +9,7 @@ #ifndef LLDB_DISABLE_PYTHON #include "OperatingSystemPython.h" + #include "Plugins/Process/Utility/DynamicRegisterInfo.h" #include "Plugins/Process/Utility/RegisterContextDummy.h" #include "Plugins/Process/Utility/RegisterContextMemory.h" @@ -31,6 +32,8 @@ #include "lldb/Utility/StreamString.h" #include "lldb/Utility/StructuredData.h" +#include <memory> + using namespace lldb; using namespace lldb_private; @@ -259,8 +262,8 @@ ThreadSP OperatingSystemPython::CreateThreadFromThreadInfo( if (!thread_sp) { if (did_create_ptr) *did_create_ptr = true; - thread_sp.reset( - new ThreadMemory(*m_process, tid, name, queue, reg_data_addr)); + thread_sp = std::make_shared<ThreadMemory>(*m_process, tid, name, queue, + reg_data_addr); } if (core_number < core_thread_list.GetSize(false)) { @@ -321,8 +324,8 @@ OperatingSystemPython::CreateRegisterContextForThread(Thread *thread, "= 0x%" PRIx64 ", 0x%" PRIx64 ", reg_data_addr = 0x%" PRIx64 ") creating memory register context", thread->GetID(), thread->GetProtocolID(), reg_data_addr); - reg_ctx_sp.reset(new RegisterContextMemory( - *thread, 0, *GetDynamicRegisterInfo(), reg_data_addr)); + reg_ctx_sp = std::make_shared<RegisterContextMemory>( + *thread, 0, *GetDynamicRegisterInfo(), reg_data_addr); } else { // No register data address is provided, query the python plug-in to let it // make up the data as it sees fit @@ -355,8 +358,8 @@ OperatingSystemPython::CreateRegisterContextForThread(Thread *thread, log->Printf("OperatingSystemPython::CreateRegisterContextForThread (tid " "= 0x%" PRIx64 ") forcing a dummy register context", thread->GetID()); - reg_ctx_sp.reset(new RegisterContextDummy( - *thread, 0, target.GetArchitecture().GetAddressByteSize())); + reg_ctx_sp = std::make_shared<RegisterContextDummy>( + *thread, 0, target.GetArchitecture().GetAddressByteSize()); } return reg_ctx_sp; } diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp index 10a931e768c..68d53c2ca28 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp +++ b/lldb/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/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp index 30b1b41e289..8aa1d144a10 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp +++ b/lldb/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/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp b/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp index ef13bd73346..f95dc23c3d8 100644 --- a/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp +++ b/lldb/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/lldb/source/Plugins/Process/MacOSX-Kernel/ThreadKDP.cpp b/lldb/source/Plugins/Process/MacOSX-Kernel/ThreadKDP.cpp index d0e78a8e74d..341c6329ad6 100644 --- a/lldb/source/Plugins/Process/MacOSX-Kernel/ThreadKDP.cpp +++ b/lldb/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/lldb/source/Plugins/Process/Utility/HistoryThread.cpp b/lldb/source/Plugins/Process/Utility/HistoryThread.cpp index fc3b1f158d7..a2b71b587d4 100644 --- a/lldb/source/Plugins/Process/Utility/HistoryThread.cpp +++ b/lldb/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/lldb/source/Plugins/Process/Utility/HistoryUnwind.cpp b/lldb/source/Plugins/Process/Utility/HistoryUnwind.cpp index 71119a5c498..023469d4c07 100644 --- a/lldb/source/Plugins/Process/Utility/HistoryUnwind.cpp +++ b/lldb/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/lldb/source/Plugins/Process/Utility/RegisterContextDarwin_arm.cpp b/lldb/source/Plugins/Process/Utility/RegisterContextDarwin_arm.cpp index bcb58d2a538..10609ce88fa 100644 --- a/lldb/source/Plugins/Process/Utility/RegisterContextDarwin_arm.cpp +++ b/lldb/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/lldb/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.cpp b/lldb/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.cpp index 0fd71205a79..308cf151909 100644 --- a/lldb/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.cpp +++ b/lldb/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/lldb/source/Plugins/Process/Utility/RegisterContextDarwin_i386.cpp b/lldb/source/Plugins/Process/Utility/RegisterContextDarwin_i386.cpp index 742644d4d8e..161af9f8c32 100644 --- a/lldb/source/Plugins/Process/Utility/RegisterContextDarwin_i386.cpp +++ b/lldb/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/lldb/source/Plugins/Process/Utility/RegisterContextDarwin_x86_64.cpp b/lldb/source/Plugins/Process/Utility/RegisterContextDarwin_x86_64.cpp index 35fc2a15732..c611f6239b8 100644 --- a/lldb/source/Plugins/Process/Utility/RegisterContextDarwin_x86_64.cpp +++ b/lldb/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/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp b/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp index 423b2e53c66..10199f742f5 100644 --- a/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp +++ b/lldb/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/lldb/source/Plugins/Process/Utility/ThreadMemory.cpp b/lldb/source/Plugins/Process/Utility/ThreadMemory.cpp index 735bfea2fcb..80b04bb14f7 100644 --- a/lldb/source/Plugins/Process/Utility/ThreadMemory.cpp +++ b/lldb/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/lldb/source/Plugins/Process/Utility/UnwindMacOSXFrameBackchain.cpp b/lldb/source/Plugins/Process/Utility/UnwindMacOSXFrameBackchain.cpp index b66be377598..4a35637cffb 100644 --- a/lldb/source/Plugins/Process/Utility/UnwindMacOSXFrameBackchain.cpp +++ b/lldb/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/lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp b/lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp index 1445cffb381..708609aad03 100644 --- a/lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp +++ b/lldb/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/lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm.cpp b/lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm.cpp index b0eb1c8a7e9..fa05c457fc6 100644 --- a/lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm.cpp +++ b/lldb/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/lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm64.cpp b/lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm64.cpp index fb817e5e590..e477c438ba1 100644 --- a/lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm64.cpp +++ b/lldb/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/lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_mips64.cpp b/lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_mips64.cpp index 75844d213d9..e15ba78c2cc 100644 --- a/lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_mips64.cpp +++ b/lldb/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/lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_powerpc.cpp b/lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_powerpc.cpp index ed899d98dae..6984bf4ee9b 100644 --- a/lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_powerpc.cpp +++ b/lldb/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/lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_ppc64le.cpp b/lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_ppc64le.cpp index 945d444704b..0eebf474f60 100644 --- a/lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_ppc64le.cpp +++ b/lldb/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/lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_s390x.cpp b/lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_s390x.cpp index 5a99250b769..d84fc3e7439 100644 --- a/lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_s390x.cpp +++ b/lldb/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/lldb/source/Plugins/Process/elf-core/ThreadElfCore.cpp b/lldb/source/Plugins/Process/elf-core/ThreadElfCore.cpp index 83900d5be36..409163554d6 100644 --- a/lldb/source/Plugins/Process/elf-core/ThreadElfCore.cpp +++ b/lldb/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/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp index 2e88ecbeab1..75d264295ab 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp +++ b/lldb/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/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp index 53fdcb77bf4..c588b022ac8 100644 --- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp +++ b/lldb/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/lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp index 261b5c919a7..9f9fcca71bc 100644 --- a/lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp +++ b/lldb/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/lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp b/lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp index 1e703133c66..05f378d7f4a 100644 --- a/lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp +++ b/lldb/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/lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp b/lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp index ef94f47b4a4..91075cce036 100644 --- a/lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp +++ b/lldb/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/lldb/source/Plugins/Process/minidump/ThreadMinidump.cpp b/lldb/source/Plugins/Process/minidump/ThreadMinidump.cpp index 340ed3c1aff..44880970c06 100644 --- a/lldb/source/Plugins/Process/minidump/ThreadMinidump.cpp +++ b/lldb/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/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp index 89f789f86e6..294c4b005d8 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp +++ b/lldb/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/lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp b/lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp index f5bf13036e4..5b6c9e5e26b 100644 --- a/lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp +++ b/lldb/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/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp index 32832917ccf..5b50e92a157 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp +++ b/lldb/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/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp index 1be4a3124b6..1c0bc94e943 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp +++ b/lldb/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/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp index 5fe3001ecf5..90572c02e13 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ b/lldb/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/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp index 1c4651addd1..5fca171e0e3 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp +++ b/lldb/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/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp b/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp index de68411be50..c875f88325f 100644 --- a/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp +++ b/lldb/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/lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp b/lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp index 6dca6b650f5..513bdb3cc5c 100644 --- a/lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp +++ b/lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp @@ -29,6 +29,8 @@ #include "SystemRuntimeMacOSX.h" +#include <memory> + using namespace lldb; using namespace lldb_private; @@ -495,9 +497,9 @@ ThreadSP SystemRuntimeMacOSX::GetExtendedBacktraceThread(ThreadSP real_thread, bool stop_id_is_valid = true; if (item.stop_id == 0) stop_id_is_valid = false; - originating_thread_sp.reset(new HistoryThread( + originating_thread_sp = std::make_shared<HistoryThread>( *m_process, item.enqueuing_thread_id, item.enqueuing_callstack, - item.stop_id, stop_id_is_valid)); + item.stop_id, stop_id_is_valid); originating_thread_sp->SetExtendedBacktraceToken( item.item_that_enqueued_this); originating_thread_sp->SetQueueName( @@ -540,9 +542,9 @@ SystemRuntimeMacOSX::GetExtendedBacktraceFromItemRef(lldb::addr_t item_ref) { bool stop_id_is_valid = true; if (item.stop_id == 0) stop_id_is_valid = false; - return_thread_sp.reset(new HistoryThread( + return_thread_sp = std::make_shared<HistoryThread>( *m_process, item.enqueuing_thread_id, item.enqueuing_callstack, - item.stop_id, stop_id_is_valid)); + item.stop_id, stop_id_is_valid); return_thread_sp->SetExtendedBacktraceToken(item.item_that_enqueued_this); return_thread_sp->SetQueueName(item.enqueuing_queue_label.c_str()); return_thread_sp->SetQueueID(item.enqueuing_queue_serialnum); @@ -567,10 +569,10 @@ SystemRuntimeMacOSX::GetExtendedBacktraceForQueueItem(QueueItemSP queue_item_sp, if (queue_item_sp->GetStopID() == 0) stop_id_is_valid = false; - extended_thread_sp.reset( - new HistoryThread(*m_process, queue_item_sp->GetEnqueueingThreadID(), - queue_item_sp->GetEnqueueingBacktrace(), - queue_item_sp->GetStopID(), stop_id_is_valid)); + extended_thread_sp = std::make_shared<HistoryThread>( + *m_process, queue_item_sp->GetEnqueueingThreadID(), + queue_item_sp->GetEnqueueingBacktrace(), queue_item_sp->GetStopID(), + stop_id_is_valid); extended_thread_sp->SetExtendedBacktraceToken( queue_item_sp->GetItemThatEnqueuedThis()); extended_thread_sp->SetQueueName(queue_item_sp->GetQueueLabel().c_str()); diff --git a/lldb/source/Plugins/UnwindAssembly/x86/x86AssemblyInspectionEngine.cpp b/lldb/source/Plugins/UnwindAssembly/x86/x86AssemblyInspectionEngine.cpp index 615d35b9198..c8468181eef 100644 --- a/lldb/source/Plugins/UnwindAssembly/x86/x86AssemblyInspectionEngine.cpp +++ b/lldb/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; |

