[lldb] Replace calls to new with std::make_shared<> (NFC)

This commit is contained in:
Jonas Devlieghere 2020-06-19 11:17:00 -07:00
parent 416be2255e
commit 827c012297
4 changed files with 24 additions and 19 deletions

View File

@ -7,10 +7,11 @@
//===----------------------------------------------------------------------===//
#include "lldb/Interpreter/OptionValue.h"
#include "lldb/Interpreter/OptionValues.h"
#include "lldb/Utility/StringList.h"
#include <memory>
using namespace lldb;
using namespace lldb_private;
@ -505,37 +506,37 @@ lldb::OptionValueSP OptionValue::CreateValueFromCStringForTypeMask(
lldb::OptionValueSP value_sp;
switch (type_mask) {
case 1u << eTypeArch:
value_sp.reset(new OptionValueArch());
value_sp = std::make_shared<OptionValueArch>();
break;
case 1u << eTypeBoolean:
value_sp.reset(new OptionValueBoolean(false));
value_sp = std::make_shared<OptionValueBoolean>(false);
break;
case 1u << eTypeChar:
value_sp.reset(new OptionValueChar('\0'));
value_sp = std::make_shared<OptionValueChar>('\0');
break;
case 1u << eTypeFileSpec:
value_sp.reset(new OptionValueFileSpec());
value_sp = std::make_shared<OptionValueFileSpec>();
break;
case 1u << eTypeFormat:
value_sp.reset(new OptionValueFormat(eFormatInvalid));
value_sp = std::make_shared<OptionValueFormat>(eFormatInvalid);
break;
case 1u << eTypeFormatEntity:
value_sp.reset(new OptionValueFormatEntity(nullptr));
value_sp = std::make_shared<OptionValueFormatEntity>(nullptr);
break;
case 1u << eTypeLanguage:
value_sp.reset(new OptionValueLanguage(eLanguageTypeUnknown));
value_sp = std::make_shared<OptionValueLanguage>(eLanguageTypeUnknown);
break;
case 1u << eTypeSInt64:
value_sp.reset(new OptionValueSInt64());
value_sp = std::make_shared<OptionValueSInt64>();
break;
case 1u << eTypeString:
value_sp.reset(new OptionValueString());
value_sp = std::make_shared<OptionValueString>();
break;
case 1u << eTypeUInt64:
value_sp.reset(new OptionValueUInt64());
value_sp = std::make_shared<OptionValueUInt64>();
break;
case 1u << eTypeUUID:
value_sp.reset(new OptionValueUUID());
value_sp = std::make_shared<OptionValueUUID>();
break;
}

View File

@ -161,8 +161,9 @@ public:
DiagnosticOptions *m_options = new DiagnosticOptions(opts);
m_options->ShowPresumedLoc = true;
m_options->ShowLevel = false;
m_os.reset(new llvm::raw_string_ostream(m_output));
m_passthrough.reset(new clang::TextDiagnosticPrinter(*m_os, m_options));
m_os = std::make_shared<llvm::raw_string_ostream>(m_output);
m_passthrough =
std::make_shared<clang::TextDiagnosticPrinter>(*m_os, m_options);
}
void ResetManager(DiagnosticManager *manager = nullptr) {

View File

@ -6,8 +6,6 @@
//
//===----------------------------------------------------------------------===//
#include <mutex>
#include "clang/Basic/TargetInfo.h"
#include "clang/Frontend/CompilerInstance.h"
#include "clang/Frontend/FrontendActions.h"
@ -38,6 +36,9 @@
#include "lldb/Utility/Reproducer.h"
#include "lldb/Utility/StreamString.h"
#include <memory>
#include <mutex>
using namespace lldb_private;
namespace {
@ -130,8 +131,9 @@ StoringDiagnosticConsumer::StoringDiagnosticConsumer() {
m_log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS);
clang::DiagnosticOptions *m_options = new clang::DiagnosticOptions();
m_os.reset(new llvm::raw_string_ostream(m_output));
m_diag_printer.reset(new clang::TextDiagnosticPrinter(*m_os, m_options));
m_os = std::make_shared<llvm::raw_string_ostream>(m_output);
m_diag_printer =
std::make_shared<clang::TextDiagnosticPrinter>(*m_os, m_options);
}
void StoringDiagnosticConsumer::HandleDiagnostic(

View File

@ -428,7 +428,8 @@ protected:
void InitSearchFilter(lldb::TargetSP target) {
if (!m_filtersp)
m_filtersp.reset(new SearchFilterForUnconstrainedSearches(target));
m_filtersp =
std::make_shared<SearchFilterForUnconstrainedSearches>(target);
}
void FixupScriptDetails(lldb_renderscript::RSModuleDescriptorSP rsmodule_sp);