summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
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
commit796ac80b863ed92c3d8bcc296f678ff416afc8a8 (patch)
tree2d135344aad0612c190b08cf7fd218d98a2a368b /lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
parent6cbc92915ae8f5cb1d5b265e15858e79c718e7ba (diff)
downloadbcm5719-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/SymbolFile/DWARF/SymbolFileDWARF.cpp')
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp21
1 files changed, 11 insertions, 10 deletions
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);
}
}
OpenPOWER on IntegriCloud