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
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user