diff options
author | Jonas Devlieghere <jonas@devlieghere.com> | 2019-02-11 23:13:08 +0000 |
---|---|---|
committer | Jonas Devlieghere <jonas@devlieghere.com> | 2019-02-11 23:13:08 +0000 |
commit | 796ac80b863ed92c3d8bcc296f678ff416afc8a8 (patch) | |
tree | 2d135344aad0612c190b08cf7fd218d98a2a368b /lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp | |
parent | 6cbc92915ae8f5cb1d5b265e15858e79c718e7ba (diff) | |
download | bcm5719-llvm-796ac80b863ed92c3d8bcc296f678ff416afc8a8.tar.gz bcm5719-llvm-796ac80b863ed92c3d8bcc296f678ff416afc8a8.zip |
Use std::make_shared in LLDB (NFC)
Unlike std::make_unique, which is only available since C++14,
std::make_shared is available since C++11. Not only is std::make_shared
a lot more readable compared to ::reset(new), it also performs a single
heap allocation for the object and control block.
Differential revision: https://reviews.llvm.org/D57990
llvm-svn: 353764
Diffstat (limited to 'lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp')
-rw-r--r-- | lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
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; |