[Lldb-commits] [lldb] 06412da - [lldb] Use std::make_unique<> (NFC)
Jonas Devlieghere via lldb-commits
lldb-commits at lists.llvm.org
Wed Jun 24 17:48:46 PDT 2020
Author: Jonas Devlieghere
Date: 2020-06-24T17:48:40-07:00
New Revision: 06412dae82376c12bc64b944e6d21141313b5cf1
URL: https://github.com/llvm/llvm-project/commit/06412dae82376c12bc64b944e6d21141313b5cf1
DIFF: https://github.com/llvm/llvm-project/commit/06412dae82376c12bc64b944e6d21141313b5cf1.diff
LOG: [lldb] Use std::make_unique<> (NFC)
Update the rest of lldb to use std::make_unique<>. I used clang-tidy to
automate this, which probably missed cases that are wrapped in ifdefs.
Added:
Modified:
lldb/source/Breakpoint/BreakpointLocation.cpp
lldb/source/Breakpoint/BreakpointOptions.cpp
lldb/source/Breakpoint/WatchpointOptions.cpp
lldb/source/Commands/CommandObjectTarget.cpp
lldb/source/Commands/CommandObjectType.cpp
lldb/source/Core/IOHandler.cpp
lldb/source/Core/IOHandlerCursesGUI.cpp
lldb/source/Expression/IRExecutionUnit.cpp
lldb/source/Expression/Materializer.cpp
lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp
lldb/source/Interpreter/Options.cpp
lldb/source/Interpreter/ScriptInterpreter.cpp
lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
lldb/source/Plugins/ExpressionParser/Clang/ClangFunctionCaller.cpp
lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.cpp
lldb/source/Plugins/ExpressionParser/Clang/CxxModuleHandler.cpp
lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp
lldb/source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.cpp
lldb/source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.cpp
lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp
lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp
lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp
lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
lldb/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp
lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
lldb/source/Plugins/Platform/Android/AdbClient.cpp
lldb/source/Plugins/Process/Utility/HistoryThread.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
lldb/source/Symbol/SymbolContext.cpp
lldb/source/Symbol/SymbolVendor.cpp
lldb/source/Symbol/UnwindTable.cpp
lldb/source/Target/ModuleCache.cpp
lldb/source/Target/Process.cpp
lldb/source/Target/Target.cpp
lldb/source/Target/Thread.cpp
lldb/source/Target/ThreadPlanStepInRange.cpp
Removed:
################################################################################
diff --git a/lldb/source/Breakpoint/BreakpointLocation.cpp b/lldb/source/Breakpoint/BreakpointLocation.cpp
index 646c2e3c628b..93d54c051ee5 100644
--- a/lldb/source/Breakpoint/BreakpointLocation.cpp
+++ b/lldb/source/Breakpoint/BreakpointLocation.cpp
@@ -369,7 +369,7 @@ BreakpointOptions *BreakpointLocation::GetLocationOptions() {
// potentially expensive and we don't want to do that for the simple case
// where someone is just disabling the location.
if (m_options_up == nullptr)
- m_options_up.reset(new BreakpointOptions(false));
+ m_options_up = std::make_unique<BreakpointOptions>(false);
return m_options_up.get();
}
diff --git a/lldb/source/Breakpoint/BreakpointOptions.cpp b/lldb/source/Breakpoint/BreakpointOptions.cpp
index 3886d0329062..0ce7b0f852e8 100644
--- a/lldb/source/Breakpoint/BreakpointOptions.cpp
+++ b/lldb/source/Breakpoint/BreakpointOptions.cpp
@@ -154,7 +154,7 @@ BreakpointOptions::BreakpointOptions(const BreakpointOptions &rhs)
m_ignore_count(rhs.m_ignore_count), m_thread_spec_up(),
m_auto_continue(rhs.m_auto_continue), m_set_flags(rhs.m_set_flags) {
if (rhs.m_thread_spec_up != nullptr)
- m_thread_spec_up.reset(new ThreadSpec(*rhs.m_thread_spec_up));
+ m_thread_spec_up = std::make_unique<ThreadSpec>(*rhs.m_thread_spec_up);
m_condition_text = rhs.m_condition_text;
m_condition_text_hash = rhs.m_condition_text_hash;
}
@@ -170,7 +170,7 @@ operator=(const BreakpointOptions &rhs) {
m_one_shot = rhs.m_one_shot;
m_ignore_count = rhs.m_ignore_count;
if (rhs.m_thread_spec_up != nullptr)
- m_thread_spec_up.reset(new ThreadSpec(*rhs.m_thread_spec_up));
+ m_thread_spec_up = std::make_unique<ThreadSpec>(*rhs.m_thread_spec_up);
m_condition_text = rhs.m_condition_text;
m_condition_text_hash = rhs.m_condition_text_hash;
m_auto_continue = rhs.m_auto_continue;
@@ -223,7 +223,8 @@ void BreakpointOptions::CopyOverSetOptions(const BreakpointOptions &incoming)
}
if (incoming.m_set_flags.Test(eThreadSpec) && incoming.m_thread_spec_up) {
if (!m_thread_spec_up)
- m_thread_spec_up.reset(new ThreadSpec(*incoming.m_thread_spec_up));
+ m_thread_spec_up =
+ std::make_unique<ThreadSpec>(*incoming.m_thread_spec_up);
else
*m_thread_spec_up = *incoming.m_thread_spec_up;
m_set_flags.Set(eThreadSpec);
@@ -509,7 +510,7 @@ const ThreadSpec *BreakpointOptions::GetThreadSpecNoCreate() const {
ThreadSpec *BreakpointOptions::GetThreadSpec() {
if (m_thread_spec_up == nullptr) {
m_set_flags.Set(eThreadSpec);
- m_thread_spec_up.reset(new ThreadSpec());
+ m_thread_spec_up = std::make_unique<ThreadSpec>();
}
return m_thread_spec_up.get();
diff --git a/lldb/source/Breakpoint/WatchpointOptions.cpp b/lldb/source/Breakpoint/WatchpointOptions.cpp
index 609aacf0718b..f01f5ad3dd27 100644
--- a/lldb/source/Breakpoint/WatchpointOptions.cpp
+++ b/lldb/source/Breakpoint/WatchpointOptions.cpp
@@ -36,7 +36,7 @@ WatchpointOptions::WatchpointOptions(const WatchpointOptions &rhs)
m_callback_is_synchronous(rhs.m_callback_is_synchronous),
m_thread_spec_up() {
if (rhs.m_thread_spec_up != nullptr)
- m_thread_spec_up.reset(new ThreadSpec(*rhs.m_thread_spec_up));
+ m_thread_spec_up = std::make_unique<ThreadSpec>(*rhs.m_thread_spec_up);
}
// WatchpointOptions assignment operator
@@ -46,7 +46,7 @@ operator=(const WatchpointOptions &rhs) {
m_callback_baton_sp = rhs.m_callback_baton_sp;
m_callback_is_synchronous = rhs.m_callback_is_synchronous;
if (rhs.m_thread_spec_up != nullptr)
- m_thread_spec_up.reset(new ThreadSpec(*rhs.m_thread_spec_up));
+ m_thread_spec_up = std::make_unique<ThreadSpec>(*rhs.m_thread_spec_up);
return *this;
}
@@ -108,7 +108,7 @@ const ThreadSpec *WatchpointOptions::GetThreadSpecNoCreate() const {
ThreadSpec *WatchpointOptions::GetThreadSpec() {
if (m_thread_spec_up == nullptr)
- m_thread_spec_up.reset(new ThreadSpec());
+ m_thread_spec_up = std::make_unique<ThreadSpec>();
return m_thread_spec_up.get();
}
diff --git a/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp
index ce2fb99fba7d..56d8dc8d9c6d 100644
--- a/lldb/source/Commands/CommandObjectTarget.cpp
+++ b/lldb/source/Commands/CommandObjectTarget.cpp
@@ -4622,8 +4622,8 @@ class CommandObjectTargetStopHookAdd : public CommandObjectParsed,
// First step, make the specifier.
std::unique_ptr<SymbolContextSpecifier> specifier_up;
if (m_options.m_sym_ctx_specified) {
- specifier_up.reset(
- new SymbolContextSpecifier(GetDebugger().GetSelectedTarget()));
+ specifier_up = std::make_unique<SymbolContextSpecifier>(
+ GetDebugger().GetSelectedTarget());
if (!m_options.m_module_name.empty()) {
specifier_up->AddSpecification(
diff --git a/lldb/source/Commands/CommandObjectType.cpp b/lldb/source/Commands/CommandObjectType.cpp
index d6dd4067a3ed..b2020f26621f 100644
--- a/lldb/source/Commands/CommandObjectType.cpp
+++ b/lldb/source/Commands/CommandObjectType.cpp
@@ -1031,8 +1031,8 @@ class CommandObjectTypeFormatterList : public CommandObjectParsed {
std::unique_ptr<RegularExpression> formatter_regex;
if (m_options.m_category_regex.OptionWasSet()) {
- category_regex.reset(new RegularExpression(
- m_options.m_category_regex.GetCurrentValueAsRef()));
+ category_regex = std::make_unique<RegularExpression>(
+ m_options.m_category_regex.GetCurrentValueAsRef());
if (!category_regex->IsValid()) {
result.AppendErrorWithFormat(
"syntax error in category regular expression '%s'",
@@ -1044,8 +1044,8 @@ class CommandObjectTypeFormatterList : public CommandObjectParsed {
if (argc == 1) {
const char *arg = command.GetArgumentAtIndex(0);
- formatter_regex.reset(
- new RegularExpression(llvm::StringRef::withNullAsEmpty(arg)));
+ formatter_regex = std::make_unique<RegularExpression>(
+ llvm::StringRef::withNullAsEmpty(arg));
if (!formatter_regex->IsValid()) {
result.AppendErrorWithFormat("syntax error in regular expression '%s'",
arg);
@@ -2092,7 +2092,8 @@ class CommandObjectTypeCategoryList : public CommandObjectParsed {
if (argc == 1) {
const char *arg = command.GetArgumentAtIndex(0);
- regex.reset(new RegularExpression(llvm::StringRef::withNullAsEmpty(arg)));
+ regex = std::make_unique<RegularExpression>(
+ llvm::StringRef::withNullAsEmpty(arg));
if (!regex->IsValid()) {
result.AppendErrorWithFormat(
"syntax error in category regular expression '%s'", arg);
diff --git a/lldb/source/Core/IOHandler.cpp b/lldb/source/Core/IOHandler.cpp
index cd9531b17a92..6cf09aaa7f9d 100644
--- a/lldb/source/Core/IOHandler.cpp
+++ b/lldb/source/Core/IOHandler.cpp
@@ -253,9 +253,9 @@ IOHandlerEditline::IOHandlerEditline(
m_input_sp && m_input_sp->GetIsRealTerminal();
if (use_editline) {
- m_editline_up.reset(new Editline(editline_name, GetInputFILE(),
- GetOutputFILE(), GetErrorFILE(),
- m_color_prompts));
+ m_editline_up = std::make_unique<Editline>(editline_name, GetInputFILE(),
+ GetOutputFILE(), GetErrorFILE(),
+ m_color_prompts);
m_editline_up->SetIsInputCompleteCallback(IsInputCompleteCallback, this);
m_editline_up->SetAutoCompleteCallback(AutoCompleteCallback, this);
// See if the delegate supports fixing indentation
diff --git a/lldb/source/Core/IOHandlerCursesGUI.cpp b/lldb/source/Core/IOHandlerCursesGUI.cpp
index 49e93cd11dd1..f8fc91772198 100644
--- a/lldb/source/Core/IOHandlerCursesGUI.cpp
+++ b/lldb/source/Core/IOHandlerCursesGUI.cpp
@@ -3910,7 +3910,7 @@ IOHandlerCursesGUI::IOHandlerCursesGUI(Debugger &debugger)
void IOHandlerCursesGUI::Activate() {
IOHandler::Activate();
if (!m_app_ap) {
- m_app_ap.reset(new Application(GetInputFILE(), GetOutputFILE()));
+ m_app_ap = std::make_unique<Application>(GetInputFILE(), GetOutputFILE());
// This is both a window and a menu delegate
std::shared_ptr<ApplicationDelegate> app_delegate_sp(
diff --git a/lldb/source/Expression/IRExecutionUnit.cpp b/lldb/source/Expression/IRExecutionUnit.cpp
index 1bcd6aa918e9..e3c9c1d7fdf5 100644
--- a/lldb/source/Expression/IRExecutionUnit.cpp
+++ b/lldb/source/Expression/IRExecutionUnit.cpp
@@ -265,11 +265,9 @@ void IRExecutionUnit::GetRunnableInfo(Status &error, lldb::addr_t &func_addr,
builder.setEngineKind(llvm::EngineKind::JIT)
.setErrorStr(&error_string)
- .setRelocationModel(triple.isOSBinFormatMachO()
- ? llvm::Reloc::PIC_
- : llvm::Reloc::Static)
- .setMCJITMemoryManager(
- std::unique_ptr<MemoryManager>(new MemoryManager(*this)))
+ .setRelocationModel(triple.isOSBinFormatMachO() ? llvm::Reloc::PIC_
+ : llvm::Reloc::Static)
+ .setMCJITMemoryManager(std::make_unique<MemoryManager>(*this))
.setOptLevel(llvm::CodeGenOpt::Less);
llvm::StringRef mArch;
diff --git a/lldb/source/Expression/Materializer.cpp b/lldb/source/Expression/Materializer.cpp
index 8e96891257e4..dccba5885bd9 100644
--- a/lldb/source/Expression/Materializer.cpp
+++ b/lldb/source/Expression/Materializer.cpp
@@ -399,7 +399,8 @@ uint32_t Materializer::AddPersistentVariable(
lldb::ExpressionVariableSP &persistent_variable_sp,
PersistentVariableDelegate *delegate, Status &err) {
EntityVector::iterator iter = m_entities.insert(m_entities.end(), EntityUP());
- iter->reset(new EntityPersistentVariable(persistent_variable_sp, delegate));
+ *iter = std::make_unique<EntityPersistentVariable>(persistent_variable_sp,
+ delegate);
uint32_t ret = AddStructMember(**iter);
(*iter)->SetOffset(ret);
return ret;
@@ -752,7 +753,7 @@ class EntityVariable : public Materializer::Entity {
uint32_t Materializer::AddVariable(lldb::VariableSP &variable_sp, Status &err) {
EntityVector::iterator iter = m_entities.insert(m_entities.end(), EntityUP());
- iter->reset(new EntityVariable(variable_sp));
+ *iter = std::make_unique<EntityVariable>(variable_sp);
uint32_t ret = AddStructMember(**iter);
(*iter)->SetOffset(ret);
return ret;
@@ -1030,8 +1031,8 @@ uint32_t Materializer::AddResultVariable(const CompilerType &type,
PersistentVariableDelegate *delegate,
Status &err) {
EntityVector::iterator iter = m_entities.insert(m_entities.end(), EntityUP());
- iter->reset(new EntityResultVariable(type, is_program_reference,
- keep_in_memory, delegate));
+ *iter = std::make_unique<EntityResultVariable>(type, is_program_reference,
+ keep_in_memory, delegate);
uint32_t ret = AddStructMember(**iter);
(*iter)->SetOffset(ret);
return ret;
@@ -1147,7 +1148,7 @@ class EntitySymbol : public Materializer::Entity {
uint32_t Materializer::AddSymbol(const Symbol &symbol_sp, Status &err) {
EntityVector::iterator iter = m_entities.insert(m_entities.end(), EntityUP());
- iter->reset(new EntitySymbol(symbol_sp));
+ *iter = std::make_unique<EntitySymbol>(symbol_sp);
uint32_t ret = AddStructMember(**iter);
(*iter)->SetOffset(ret);
return ret;
@@ -1324,7 +1325,7 @@ class EntityRegister : public Materializer::Entity {
uint32_t Materializer::AddRegister(const RegisterInfo ®ister_info,
Status &err) {
EntityVector::iterator iter = m_entities.insert(m_entities.end(), EntityUP());
- iter->reset(new EntityRegister(register_info));
+ *iter = std::make_unique<EntityRegister>(register_info);
uint32_t ret = AddStructMember(**iter);
(*iter)->SetOffset(ret);
return ret;
diff --git a/lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp b/lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp
index 5683330a75c8..3a547ce128d8 100644
--- a/lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp
+++ b/lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp
@@ -209,7 +209,7 @@ ConnectionStatus ConnectionFileDescriptor::Connect(llvm::StringRef path,
// this. For now, we assume we must assume we don't own it.
std::unique_ptr<TCPSocket> tcp_socket;
- tcp_socket.reset(new TCPSocket(fd, false, false));
+ tcp_socket = std::make_unique<TCPSocket>(fd, false, false);
// Try and get a socket option from this file descriptor to see if
// this is a socket and set m_is_socket accordingly.
int resuse;
diff --git a/lldb/source/Interpreter/Options.cpp b/lldb/source/Interpreter/Options.cpp
index fb13bd48e478..c14b6b6ce66a 100644
--- a/lldb/source/Interpreter/Options.cpp
+++ b/lldb/source/Interpreter/Options.cpp
@@ -798,7 +798,8 @@ void Options::HandleOptionArgumentCompletion(
interpreter.GetDebugger().GetSelectedTarget();
// Search filters require a target...
if (target_sp)
- filter_up.reset(new SearchFilterByModule(target_sp, module_spec));
+ filter_up =
+ std::make_unique<SearchFilterByModule>(target_sp, module_spec);
}
break;
}
diff --git a/lldb/source/Interpreter/ScriptInterpreter.cpp b/lldb/source/Interpreter/ScriptInterpreter.cpp
index 5013d993dbee..2dda1bbbff47 100644
--- a/lldb/source/Interpreter/ScriptInterpreter.cpp
+++ b/lldb/source/Interpreter/ScriptInterpreter.cpp
@@ -102,6 +102,5 @@ Status ScriptInterpreter::SetBreakpointCommandCallbackFunction(
std::unique_ptr<ScriptInterpreterLocker>
ScriptInterpreter::AcquireInterpreterLock() {
- return std::unique_ptr<ScriptInterpreterLocker>(
- new ScriptInterpreterLocker());
+ return std::make_unique<ScriptInterpreterLocker>();
}
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
index 08b1ae0ccde2..6b6346b69509 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
@@ -331,7 +331,7 @@ ClangExpressionParser::ClangExpressionParser(
}
// 1. Create a new compiler instance.
- m_compiler.reset(new CompilerInstance());
+ m_compiler = std::make_unique<CompilerInstance>();
// When capturing a reproducer, hook up the file collector with clang to
// collector modules and headers.
@@ -641,12 +641,12 @@ ClangExpressionParser::ClangExpressionParser(
m_compiler->createASTContext();
clang::ASTContext &ast_context = m_compiler->getASTContext();
- m_ast_context.reset(new TypeSystemClang(
- "Expression ASTContext for '" + m_filename + "'", ast_context));
+ m_ast_context = std::make_unique<TypeSystemClang>(
+ "Expression ASTContext for '" + m_filename + "'", ast_context);
std::string module_name("$__lldb_module");
- m_llvm_context.reset(new LLVMContext());
+ m_llvm_context = std::make_unique<LLVMContext>();
m_code_generator.reset(CreateLLVMCodeGen(
m_compiler->getDiagnostics(), module_name,
m_compiler->getHeaderSearchOpts(), m_compiler->getPreprocessorOpts(),
@@ -1047,11 +1047,11 @@ ClangExpressionParser::ParseInternal(DiagnosticManager &diagnostic_manager,
std::unique_ptr<clang::ASTConsumer> Consumer;
if (ast_transformer) {
- Consumer.reset(new ASTConsumerForwarder(ast_transformer));
+ Consumer = std::make_unique<ASTConsumerForwarder>(ast_transformer);
} else if (m_code_generator) {
- Consumer.reset(new ASTConsumerForwarder(m_code_generator.get()));
+ Consumer = std::make_unique<ASTConsumerForwarder>(m_code_generator.get());
} else {
- Consumer.reset(new ASTConsumer());
+ Consumer = std::make_unique<ASTConsumer>();
}
clang::ASTContext &ast_context = m_compiler->getASTContext();
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangFunctionCaller.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangFunctionCaller.cpp
index ea56e429a9d5..0c9ad2021035 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangFunctionCaller.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangFunctionCaller.cpp
@@ -209,8 +209,8 @@ ClangFunctionCaller::CompileFunction(lldb::ThreadSP thread_to_use_sp,
clang::ASTConsumer *
ClangFunctionCaller::ClangFunctionCallerHelper::ASTTransformer(
clang::ASTConsumer *passthrough) {
- m_struct_extractor.reset(new ASTStructExtractor(
- passthrough, m_owner.GetWrapperStructName(), m_owner));
+ m_struct_extractor = std::make_unique<ASTStructExtractor>(
+ passthrough, m_owner.GetWrapperStructName(), m_owner);
return m_struct_extractor.get();
}
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
index f915a699a8e2..95acb883774d 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
@@ -187,9 +187,9 @@ ClangModulesDeclVendorImpl::ClangModulesDeclVendorImpl(
m_parser(std::move(parser)) {
// Initialize our TypeSystemClang.
- m_ast_context.reset(
- new TypeSystemClang("ClangModulesDeclVendor ASTContext",
- m_compiler_instance->getASTContext()));
+ m_ast_context =
+ std::make_unique<TypeSystemClang>("ClangModulesDeclVendor ASTContext",
+ m_compiler_instance->getASTContext());
}
void ClangModulesDeclVendorImpl::ReportModuleExportsHelper(
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
index 2d6de782ced2..a28b4a7fb42c 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
@@ -595,7 +595,7 @@ bool ClangUserExpression::Parse(DiagnosticManager &diagnostic_manager,
// Parse the expression
//
- m_materializer_up.reset(new Materializer());
+ m_materializer_up = std::make_unique<Materializer>();
ResetDeclMap(exe_ctx, m_result_delegate, keep_result_in_memory);
@@ -783,7 +783,7 @@ bool ClangUserExpression::Complete(ExecutionContext &exe_ctx,
// Parse the expression
//
- m_materializer_up.reset(new Materializer());
+ m_materializer_up = std::make_unique<Materializer>();
ResetDeclMap(exe_ctx, m_result_delegate, /*keep result in memory*/ true);
@@ -919,16 +919,16 @@ void ClangUserExpression::ClangUserExpressionHelper::ResetDeclMap(
auto *persistent_vars = llvm::cast<ClangPersistentVariables>(state);
ast_importer = persistent_vars->GetClangASTImporter();
}
- m_expr_decl_map_up.reset(
- new ClangExpressionDeclMap(keep_result_in_memory, &delegate,
- exe_ctx.GetTargetSP(), ast_importer, ctx_obj));
+ m_expr_decl_map_up = std::make_unique<ClangExpressionDeclMap>(
+ keep_result_in_memory, &delegate, exe_ctx.GetTargetSP(), ast_importer,
+ ctx_obj);
}
clang::ASTConsumer *
ClangUserExpression::ClangUserExpressionHelper::ASTTransformer(
clang::ASTConsumer *passthrough) {
- m_result_synthesizer_up.reset(
- new ASTResultSynthesizer(passthrough, m_top_level, m_target));
+ m_result_synthesizer_up = std::make_unique<ASTResultSynthesizer>(
+ passthrough, m_top_level, m_target);
return m_result_synthesizer_up.get();
}
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.cpp
index ae519658e501..25ec982220a0 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.cpp
@@ -167,7 +167,7 @@ void ClangUtilityFunction::ClangUtilityFunctionHelper::ResetDeclMap(
auto *persistent_vars = llvm::cast<ClangPersistentVariables>(state);
ast_importer = persistent_vars->GetClangASTImporter();
}
- m_expr_decl_map_up.reset(
- new ClangExpressionDeclMap(keep_result_in_memory, nullptr,
- exe_ctx.GetTargetSP(), ast_importer, nullptr));
+ m_expr_decl_map_up = std::make_unique<ClangExpressionDeclMap>(
+ keep_result_in_memory, nullptr, exe_ctx.GetTargetSP(), ast_importer,
+ nullptr);
}
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/CxxModuleHandler.cpp b/lldb/source/Plugins/ExpressionParser/Clang/CxxModuleHandler.cpp
index 8fdce858a57c..2f8cf1846ee7 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/CxxModuleHandler.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/CxxModuleHandler.cpp
@@ -66,9 +66,9 @@ emulateLookupInCtxt(Sema &sema, llvm::StringRef name, DeclContext *ctxt) {
IdentifierInfo &ident = sema.getASTContext().Idents.get(name);
std::unique_ptr<LookupResult> lookup_result;
- lookup_result.reset(new LookupResult(sema, DeclarationName(&ident),
- SourceLocation(),
- Sema::LookupOrdinaryName));
+ lookup_result = std::make_unique<LookupResult>(sema, DeclarationName(&ident),
+ SourceLocation(),
+ Sema::LookupOrdinaryName);
// Usually during parsing we already encountered the scopes we would use. But
// here don't have these scopes so we have to emulate the behavior of the
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp b/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp
index 8819b8a773f5..8511e554509a 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp
@@ -1842,7 +1842,7 @@ bool IRForTarget::runOnModule(Module &llvm_module) {
lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
m_module = &llvm_module;
- m_target_data.reset(new DataLayout(m_module));
+ m_target_data = std::make_unique<DataLayout>(m_module);
m_intptr_ty = llvm::Type::getIntNTy(m_module->getContext(),
m_target_data->getPointerSizeInBits());
diff --git a/lldb/source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.cpp b/lldb/source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.cpp
index 61eb8912295f..d4cb726fc7e5 100644
--- a/lldb/source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.cpp
+++ b/lldb/source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.cpp
@@ -159,8 +159,8 @@ EmulateInstructionMIPS::EmulateInstructionMIPS(
target->createMCSubtargetInfo(triple.getTriple(), cpu, features));
assert(m_asm_info.get() && m_subtype_info.get());
- m_context.reset(
- new llvm::MCContext(m_asm_info.get(), m_reg_info.get(), nullptr));
+ m_context = std::make_unique<llvm::MCContext>(m_asm_info.get(),
+ m_reg_info.get(), nullptr);
assert(m_context.get());
m_disasm.reset(target->createMCDisassembler(*m_subtype_info, *m_context));
diff --git a/lldb/source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.cpp b/lldb/source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.cpp
index b8305591749b..4ccaf0de0758 100644
--- a/lldb/source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.cpp
+++ b/lldb/source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.cpp
@@ -163,8 +163,8 @@ EmulateInstructionMIPS64::EmulateInstructionMIPS64(
target->createMCSubtargetInfo(triple.getTriple(), cpu, features));
assert(m_asm_info.get() && m_subtype_info.get());
- m_context.reset(
- new llvm::MCContext(m_asm_info.get(), m_reg_info.get(), nullptr));
+ m_context = std::make_unique<llvm::MCContext>(m_asm_info.get(),
+ m_reg_info.get(), nullptr);
assert(m_context.get());
m_disasm.reset(target->createMCDisassembler(*m_subtype_info, *m_context));
diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp
index 2cf98620687c..06aa861d5f69 100644
--- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp
@@ -16,7 +16,7 @@ using namespace lldb_private;
bool ClassDescriptorV2::Read_objc_class(
Process *process, std::unique_ptr<objc_class_t> &objc_class) const {
- objc_class.reset(new objc_class_t);
+ objc_class = std::make_unique<objc_class_t>();
bool ret = objc_class->Read(process, m_objc_class_ptr);
@@ -197,14 +197,14 @@ bool ClassDescriptorV2::Read_class_row(
return false;
if (class_row_t_flags & RW_REALIZED) {
- class_rw.reset(new class_rw_t);
+ class_rw = std::make_unique<class_rw_t>();
if (!class_rw->Read(process, objc_class.m_data_ptr)) {
class_rw.reset();
return false;
}
- class_ro.reset(new class_ro_t);
+ class_ro = std::make_unique<class_ro_t>();
if (!class_ro->Read(process, class_rw->m_ro_ptr)) {
class_rw.reset();
@@ -212,7 +212,7 @@ bool ClassDescriptorV2::Read_class_row(
return false;
}
} else {
- class_ro.reset(new class_ro_t);
+ class_ro = std::make_unique<class_ro_t>();
if (!class_ro->Read(process, objc_class.m_data_ptr)) {
class_ro.reset();
@@ -357,7 +357,7 @@ bool ClassDescriptorV2::Describe(
if (instance_method_func) {
std::unique_ptr<method_list_t> base_method_list;
- base_method_list.reset(new method_list_t);
+ base_method_list = std::make_unique<method_list_t>();
if (!base_method_list->Read(process, class_ro->m_baseMethods_ptr))
return false;
@@ -365,7 +365,7 @@ bool ClassDescriptorV2::Describe(
return false;
std::unique_ptr<method_t> method;
- method.reset(new method_t);
+ method = std::make_unique<method_t>();
for (uint32_t i = 0, e = base_method_list->m_count; i < e; ++i) {
method->Read(process, base_method_list->m_first_ptr +
diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
index e00ce9d019df..22ea83a57beb 100644
--- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
@@ -250,7 +250,8 @@ Address *AppleObjCRuntime::GetPrintForDebuggerAddr() {
contexts.GetContextAtIndex(0, context);
- m_PrintForDebugger_addr.reset(new Address(context.symbol->GetAddress()));
+ m_PrintForDebugger_addr =
+ std::make_unique<Address>(context.symbol->GetAddress());
}
return m_PrintForDebugger_addr.get();
@@ -346,8 +347,8 @@ bool AppleObjCRuntime::ReadObjCLibrary(const ModuleSP &module_sp) {
// Maybe check here and if we have a handler already, and the UUID of this
// module is the same as the one in the current module, then we don't have to
// reread it?
- m_objc_trampoline_handler_up.reset(
- new AppleObjCTrampolineHandler(m_process->shared_from_this(), module_sp));
+ m_objc_trampoline_handler_up = std::make_unique<AppleObjCTrampolineHandler>(
+ m_process->shared_from_this(), module_sp);
if (m_objc_trampoline_handler_up != nullptr) {
m_read_objc_library = true;
return true;
diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
index 4a07c792eebb..ac9a09394021 100644
--- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
@@ -581,8 +581,8 @@ class CommandObjectObjC_ClassTable_Dump : public CommandObjectParsed {
case 0:
break;
case 1: {
- regex_up.reset(new RegularExpression(
- llvm::StringRef::withNullAsEmpty(command.GetArgumentAtIndex(0))));
+ regex_up = std::make_unique<RegularExpression>(
+ llvm::StringRef::withNullAsEmpty(command.GetArgumentAtIndex(0)));
if (!regex_up->IsValid()) {
result.AppendError(
"invalid argument - please provide a valid regular expression");
@@ -2006,7 +2006,7 @@ void AppleObjCRuntimeV2::WarnIfNoClassesCached(
DeclVendor *AppleObjCRuntimeV2::GetDeclVendor() {
if (!m_decl_vendor_up)
- m_decl_vendor_up.reset(new AppleObjCDeclVendor(*this));
+ m_decl_vendor_up = std::make_unique<AppleObjCDeclVendor>(*this);
return m_decl_vendor_up.get();
}
diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp
index 0fe9dc35a9a7..c96768c9f585 100644
--- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp
@@ -787,7 +787,8 @@ AppleObjCTrampolineHandler::AppleObjCTrampolineHandler(
}
// Build our vtable dispatch handler here:
- m_vtables_up.reset(new AppleObjCVTables(process_sp, m_objc_module_sp));
+ m_vtables_up =
+ std::make_unique<AppleObjCVTables>(process_sp, m_objc_module_sp);
if (m_vtables_up)
m_vtables_up->ReadRegions();
}
diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp
index ba76f68f3f54..b19d3d90d4b7 100644
--- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp
@@ -25,9 +25,9 @@ AppleObjCTypeEncodingParser::AppleObjCTypeEncodingParser(
ObjCLanguageRuntime &runtime)
: ObjCLanguageRuntime::EncodingToType(), m_runtime(runtime) {
if (!m_scratch_ast_ctx_up)
- m_scratch_ast_ctx_up.reset(new TypeSystemClang(
+ m_scratch_ast_ctx_up = std::make_unique<TypeSystemClang>(
"AppleObjCTypeEncodingParser ASTContext",
- runtime.GetProcess()->GetTarget().GetArchitecture().GetTriple()));
+ runtime.GetProcess()->GetTarget().GetArchitecture().GetTriple());
}
std::string AppleObjCTypeEncodingParser::ReadStructName(StringLexer &type) {
diff --git a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
index 6b8a39021cc9..beee2f5b6df7 100644
--- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -903,7 +903,7 @@ size_t ObjectFileELF::ParseDependentModules() {
if (m_filespec_up)
return m_filespec_up->GetSize();
- m_filespec_up.reset(new FileSpecList());
+ m_filespec_up = std::make_unique<FileSpecList>();
if (!ParseSectionHeaders())
return 0;
@@ -2717,7 +2717,7 @@ Symtab *ObjectFileELF::GetSymtab() {
Section *symtab =
section_list->FindSectionByType(eSectionTypeELFSymbolTable, true).get();
if (symtab) {
- m_symtab_up.reset(new Symtab(symtab->GetObjectFile()));
+ m_symtab_up = std::make_unique<Symtab>(symtab->GetObjectFile());
symbol_id += ParseSymbolTable(m_symtab_up.get(), symbol_id, symtab);
}
@@ -2734,7 +2734,7 @@ Symtab *ObjectFileELF::GetSymtab() {
.get();
if (dynsym) {
if (!m_symtab_up)
- m_symtab_up.reset(new Symtab(dynsym->GetObjectFile()));
+ m_symtab_up = std::make_unique<Symtab>(dynsym->GetObjectFile());
symbol_id += ParseSymbolTable(m_symtab_up.get(), symbol_id, dynsym);
}
}
@@ -2761,7 +2761,8 @@ Symtab *ObjectFileELF::GetSymtab() {
assert(reloc_header);
if (m_symtab_up == nullptr)
- m_symtab_up.reset(new Symtab(reloc_section->GetObjectFile()));
+ m_symtab_up =
+ std::make_unique<Symtab>(reloc_section->GetObjectFile());
ParseTrampolineSymbols(m_symtab_up.get(), symbol_id, reloc_header,
reloc_id);
@@ -2771,14 +2772,14 @@ Symtab *ObjectFileELF::GetSymtab() {
if (DWARFCallFrameInfo *eh_frame =
GetModule()->GetUnwindTable().GetEHFrameInfo()) {
if (m_symtab_up == nullptr)
- m_symtab_up.reset(new Symtab(this));
+ m_symtab_up = std::make_unique<Symtab>(this);
ParseUnwindSymbols(m_symtab_up.get(), eh_frame);
}
// If we still don't have any symtab then create an empty instance to avoid
// do the section lookup next time.
if (m_symtab_up == nullptr)
- m_symtab_up.reset(new Symtab(this));
+ m_symtab_up = std::make_unique<Symtab>(this);
// In the event that there's no symbol entry for the entry point we'll
// artificially create one. We delegate to the symtab object the figuring
diff --git a/lldb/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp b/lldb/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp
index 93cef12fef49..93c2c9f945fe 100644
--- a/lldb/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp
+++ b/lldb/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp
@@ -120,7 +120,7 @@ Symtab *ObjectFileJIT::GetSymtab() {
if (module_sp) {
std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex());
if (m_symtab_up == nullptr) {
- m_symtab_up.reset(new Symtab(this));
+ m_symtab_up = std::make_unique<Symtab>(this);
std::lock_guard<std::recursive_mutex> symtab_guard(
m_symtab_up->GetMutex());
ObjectFileJITDelegateSP delegate_sp(m_delegate_wp.lock());
@@ -139,7 +139,7 @@ bool ObjectFileJIT::IsStripped() {
void ObjectFileJIT::CreateSections(SectionList &unified_section_list) {
if (!m_sections_up) {
- m_sections_up.reset(new SectionList());
+ m_sections_up = std::make_unique<SectionList>();
ObjectFileJITDelegateSP delegate_sp(m_delegate_wp.lock());
if (delegate_sp) {
delegate_sp->PopulateSectionList(this, *m_sections_up);
diff --git a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
index cbcac7b464e6..6c2f22b837c5 100644
--- a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
+++ b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
@@ -1253,7 +1253,7 @@ Symtab *ObjectFileMachO::GetSymtab() {
if (module_sp) {
std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex());
if (m_symtab_up == nullptr) {
- m_symtab_up.reset(new Symtab(this));
+ m_symtab_up = std::make_unique<Symtab>(this);
std::lock_guard<std::recursive_mutex> symtab_guard(
m_symtab_up->GetMutex());
ParseSymtab();
@@ -1820,7 +1820,7 @@ void ObjectFileMachO::CreateSections(SectionList &unified_section_list) {
if (m_sections_up)
return;
- m_sections_up.reset(new SectionList());
+ m_sections_up = std::make_unique<SectionList>();
lldb::offset_t offset = MachHeaderSizeFromMagic(m_header.magic);
// bool dump_sections = false;
diff --git a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
index 0a5a1d318fbe..7d0f4535bf9e 100644
--- a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
+++ b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
@@ -640,7 +640,7 @@ Symtab *ObjectFilePECOFF::GetSymtab() {
std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex());
if (m_symtab_up == nullptr) {
SectionList *sect_list = GetSectionList();
- m_symtab_up.reset(new Symtab(this));
+ m_symtab_up = std::make_unique<Symtab>(this);
std::lock_guard<std::recursive_mutex> guard(m_symtab_up->GetMutex());
const uint32_t num_syms = m_coff_header.nsyms;
@@ -868,7 +868,7 @@ SectionType ObjectFilePECOFF::GetSectionType(llvm::StringRef sect_name,
void ObjectFilePECOFF::CreateSections(SectionList &unified_section_list) {
if (m_sections_up)
return;
- m_sections_up.reset(new SectionList());
+ m_sections_up = std::make_unique<SectionList>();
ModuleSP module_sp(GetModule());
if (module_sp) {
diff --git a/lldb/source/Plugins/Platform/Android/AdbClient.cpp b/lldb/source/Plugins/Platform/Android/AdbClient.cpp
index 17707118d9c9..ffccd6d628aa 100644
--- a/lldb/source/Plugins/Platform/Android/AdbClient.cpp
+++ b/lldb/source/Plugins/Platform/Android/AdbClient.cpp
@@ -132,7 +132,7 @@ const std::string &AdbClient::GetDeviceID() const { return m_device_id; }
Status AdbClient::Connect() {
Status error;
- m_conn.reset(new ConnectionFileDescriptor);
+ m_conn = std::make_unique<ConnectionFileDescriptor>();
std::string port = "5037";
if (const char *env_port = std::getenv("ANDROID_ADB_SERVER_PORT")) {
port = env_port;
diff --git a/lldb/source/Plugins/Process/Utility/HistoryThread.cpp b/lldb/source/Plugins/Process/Utility/HistoryThread.cpp
index 0649cd2f07de..d73b132539f1 100644
--- a/lldb/source/Plugins/Process/Utility/HistoryThread.cpp
+++ b/lldb/source/Plugins/Process/Utility/HistoryThread.cpp
@@ -31,7 +31,8 @@ HistoryThread::HistoryThread(lldb_private::Process &process, lldb::tid_t tid,
m_pcs(pcs), m_extended_unwind_token(LLDB_INVALID_ADDRESS), m_queue_name(),
m_thread_name(), m_originating_unique_thread_id(tid),
m_queue_id(LLDB_INVALID_QUEUE_ID) {
- m_unwinder_up.reset(new HistoryUnwind(*this, pcs, pcs_are_call_addresses));
+ m_unwinder_up =
+ std::make_unique<HistoryUnwind>(*this, pcs, pcs_are_call_addresses);
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT));
LLDB_LOGF(log, "%p HistoryThread::HistoryThread", static_cast<void *>(this));
}
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
index 0fc3e9c4928b..7f5ea806b20e 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -90,7 +90,7 @@ static bool DeclKindIsCXXClass(clang::Decl::Kind decl_kind) {
ClangASTImporter &DWARFASTParserClang::GetClangASTImporter() {
if (!m_clang_ast_importer_up) {
- m_clang_ast_importer_up.reset(new ClangASTImporter);
+ m_clang_ast_importer_up = std::make_unique<ClangASTImporter>();
}
return *m_clang_ast_importer_up;
}
@@ -1783,7 +1783,7 @@ class DWARFASTParserClang::DelayedAddObjCClassProperty {
m_property_getter_name(property_getter_name),
m_property_attributes(property_attributes) {
if (metadata != nullptr) {
- m_metadata_up.reset(new ClangASTMetadata());
+ m_metadata_up = std::make_unique<ClangASTMetadata>();
*m_metadata_up = *metadata;
}
}
@@ -1803,7 +1803,7 @@ class DWARFASTParserClang::DelayedAddObjCClassProperty {
m_property_attributes = rhs.m_property_attributes;
if (rhs.m_metadata_up) {
- m_metadata_up.reset(new ClangASTMetadata());
+ m_metadata_up = std::make_unique<ClangASTMetadata>();
*m_metadata_up = *rhs.m_metadata_up;
}
return *this;
@@ -1835,8 +1835,8 @@ bool DWARFASTParserClang::ParseTemplateDIE(
switch (tag) {
case DW_TAG_GNU_template_parameter_pack: {
- template_param_infos.packed_args.reset(
- new TypeSystemClang::TemplateParameterInfos);
+ template_param_infos.packed_args =
+ std::make_unique<TypeSystemClang::TemplateParameterInfos>();
for (DWARFDIE child_die = die.GetFirstChild(); child_die.IsValid();
child_die = child_die.GetSibling()) {
if (!ParseTemplateDIE(child_die, *template_param_infos.packed_args))
@@ -2354,8 +2354,8 @@ Function *DWARFASTParserClang::ParseFunctionFromDWARF(CompileUnit &comp_unit,
FunctionSP func_sp;
std::unique_ptr<Declaration> decl_up;
if (decl_file != 0 || decl_line != 0 || decl_column != 0)
- decl_up.reset(new Declaration(die.GetCU()->GetFile(decl_file),
- decl_line, decl_column));
+ decl_up = std::make_unique<Declaration>(die.GetCU()->GetFile(decl_file),
+ decl_line, decl_column);
SymbolFileDWARF *dwarf = die.GetDWARF();
// Supply the type _only_ if it has already been parsed
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
index b8d16758246f..dfa40759a7ff 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
@@ -769,7 +769,7 @@ SymbolFileDWARFDwo *DWARFUnit::GetDwoSymbolFile() {
const DWARFDebugAranges &DWARFUnit::GetFunctionAranges() {
if (m_func_aranges_up == nullptr) {
- m_func_aranges_up.reset(new DWARFDebugAranges());
+ m_func_aranges_up = std::make_unique<DWARFDebugAranges>();
const DWARFDebugInfoEntry *die = DIEPtr();
if (die)
die->BuildFunctionAddressRangeTable(this, m_func_aranges_up.get());
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
index d662dcba4cdd..7dd084f24e3e 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -651,7 +651,7 @@ DWARFDebugRanges *SymbolFileDWARF::GetDebugRanges() {
static_cast<void *>(this));
if (m_context.getOrLoadRangesData().GetByteSize() > 0)
- m_ranges.reset(new DWARFDebugRanges());
+ m_ranges = std::make_unique<DWARFDebugRanges>();
if (m_ranges)
m_ranges->Extract(m_context);
@@ -1192,15 +1192,15 @@ size_t SymbolFileDWARF::ParseBlocksRecursive(
(name != nullptr || mangled_name != nullptr)) {
std::unique_ptr<Declaration> decl_up;
if (decl_file != 0 || decl_line != 0 || decl_column != 0)
- decl_up.reset(new Declaration(
+ decl_up = std::make_unique<Declaration>(
comp_unit.GetSupportFiles().GetFileSpecAtIndex(decl_file),
- decl_line, decl_column));
+ decl_line, decl_column);
std::unique_ptr<Declaration> call_up;
if (call_file != 0 || call_line != 0 || call_column != 0)
- call_up.reset(new Declaration(
+ call_up = std::make_unique<Declaration>(
comp_unit.GetSupportFiles().GetFileSpecAtIndex(call_file),
- call_line, call_column));
+ call_line, call_column);
block->SetInlinedFunctionInfo(name, mangled_name, decl_up.get(),
call_up.get());
@@ -1763,7 +1763,7 @@ void SymbolFileDWARF::UpdateExternalModuleListIfNeeded() {
SymbolFileDWARF::GlobalVariableMap &SymbolFileDWARF::GetGlobalAranges() {
if (!m_global_aranges_up) {
- m_global_aranges_up.reset(new GlobalVariableMap());
+ m_global_aranges_up = std::make_unique<GlobalVariableMap>();
ModuleSP module_sp = GetObjectFile()->GetModule();
if (module_sp) {
diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
index a67584a2aa98..972688954c64 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -720,31 +720,31 @@ void TypeSystemClang::CreateASTContext() {
assert(!m_ast_up);
m_ast_owned = true;
- m_language_options_up.reset(new LangOptions());
+ m_language_options_up = std::make_unique<LangOptions>();
ParseLangArgs(*m_language_options_up, clang::Language::ObjCXX,
GetTargetTriple());
- m_identifier_table_up.reset(
- new IdentifierTable(*m_language_options_up, nullptr));
- m_builtins_up.reset(new Builtin::Context());
+ m_identifier_table_up =
+ std::make_unique<IdentifierTable>(*m_language_options_up, nullptr);
+ m_builtins_up = std::make_unique<Builtin::Context>();
- m_selector_table_up.reset(new SelectorTable());
+ m_selector_table_up = std::make_unique<SelectorTable>();
clang::FileSystemOptions file_system_options;
- m_file_manager_up.reset(new clang::FileManager(
- file_system_options, FileSystem::Instance().GetVirtualFileSystem()));
+ m_file_manager_up = std::make_unique<clang::FileManager>(
+ file_system_options, FileSystem::Instance().GetVirtualFileSystem());
llvm::IntrusiveRefCntPtr<DiagnosticIDs> diag_id_sp(new DiagnosticIDs());
- m_diagnostics_engine_up.reset(
- new DiagnosticsEngine(diag_id_sp, new DiagnosticOptions()));
+ m_diagnostics_engine_up =
+ std::make_unique<DiagnosticsEngine>(diag_id_sp, new DiagnosticOptions());
- m_source_manager_up.reset(
- new clang::SourceManager(*m_diagnostics_engine_up, *m_file_manager_up));
- m_ast_up.reset(new ASTContext(*m_language_options_up, *m_source_manager_up,
- *m_identifier_table_up, *m_selector_table_up,
- *m_builtins_up));
+ m_source_manager_up = std::make_unique<clang::SourceManager>(
+ *m_diagnostics_engine_up, *m_file_manager_up);
+ m_ast_up = std::make_unique<ASTContext>(
+ *m_language_options_up, *m_source_manager_up, *m_identifier_table_up,
+ *m_selector_table_up, *m_builtins_up);
- m_diagnostic_consumer_up.reset(new NullDiagnosticConsumer);
+ m_diagnostic_consumer_up = std::make_unique<NullDiagnosticConsumer>();
m_ast_up->getDiagnostics().setClient(m_diagnostic_consumer_up.get(), false);
// This can be NULL if we don't know anything about the architecture or if
@@ -9060,13 +9060,13 @@ void TypeSystemClang::CompleteObjCInterfaceDecl(
DWARFASTParser *TypeSystemClang::GetDWARFParser() {
if (!m_dwarf_ast_parser_up)
- m_dwarf_ast_parser_up.reset(new DWARFASTParserClang(*this));
+ m_dwarf_ast_parser_up = std::make_unique<DWARFASTParserClang>(*this);
return m_dwarf_ast_parser_up.get();
}
PDBASTParser *TypeSystemClang::GetPDBParser() {
if (!m_pdb_ast_parser_up)
- m_pdb_ast_parser_up.reset(new PDBASTParser(*this));
+ m_pdb_ast_parser_up = std::make_unique<PDBASTParser>(*this);
return m_pdb_ast_parser_up.get();
}
@@ -9502,8 +9502,8 @@ TypeSystemClangForExpressions::TypeSystemClangForExpressions(
: TypeSystemClang("scratch ASTContext", triple),
m_target_wp(target.shared_from_this()),
m_persistent_variables(new ClangPersistentVariables) {
- m_scratch_ast_source_up.reset(new ClangASTSource(
- target.shared_from_this(), m_persistent_variables->GetClangASTImporter()));
+ m_scratch_ast_source_up = std::make_unique<ClangASTSource>(
+ target.shared_from_this(), m_persistent_variables->GetClangASTImporter());
m_scratch_ast_source_up->InstallASTContext(*this);
llvm::IntrusiveRefCntPtr<clang::ExternalASTSource> proxy_ast_source(
m_scratch_ast_source_up->CreateProxy());
diff --git a/lldb/source/Symbol/SymbolContext.cpp b/lldb/source/Symbol/SymbolContext.cpp
index 3b120fdf5e02..12c2077154b9 100644
--- a/lldb/source/Symbol/SymbolContext.cpp
+++ b/lldb/source/Symbol/SymbolContext.cpp
@@ -968,7 +968,7 @@ bool SymbolContextSpecifier::AddSpecification(const char *spec_string,
// CompUnits can't necessarily be resolved here, since an inlined function
// might show up in a number of CompUnits. Instead we just convert to a
// FileSpec and store it away.
- m_file_spec_up.reset(new FileSpec(spec_string));
+ m_file_spec_up = std::make_unique<FileSpec>(spec_string);
m_type |= eFileSpecified;
break;
case eLineStartSpecified:
diff --git a/lldb/source/Symbol/SymbolVendor.cpp b/lldb/source/Symbol/SymbolVendor.cpp
index 403ca7a40e89..0a5acbc48eb4 100644
--- a/lldb/source/Symbol/SymbolVendor.cpp
+++ b/lldb/source/Symbol/SymbolVendor.cpp
@@ -51,7 +51,7 @@ SymbolVendor *SymbolVendor::FindPlugin(const lldb::ModuleSP &module_sp,
}
if (!sym_objfile_sp)
sym_objfile_sp = module_sp->GetObjectFile()->shared_from_this();
- instance_up.reset(new SymbolVendor(module_sp));
+ instance_up = std::make_unique<SymbolVendor>(module_sp);
instance_up->AddSymbolFileRepresentation(sym_objfile_sp);
return instance_up.release();
}
diff --git a/lldb/source/Symbol/UnwindTable.cpp b/lldb/source/Symbol/UnwindTable.cpp
index ef6e848e8259..3faa528a339f 100644
--- a/lldb/source/Symbol/UnwindTable.cpp
+++ b/lldb/source/Symbol/UnwindTable.cpp
@@ -57,26 +57,28 @@ void UnwindTable::Initialize() {
SectionSP sect = sl->FindSectionByType(eSectionTypeEHFrame, true);
if (sect.get()) {
- m_eh_frame_up.reset(
- new DWARFCallFrameInfo(*object_file, sect, DWARFCallFrameInfo::EH));
+ m_eh_frame_up = std::make_unique<DWARFCallFrameInfo>(
+ *object_file, sect, DWARFCallFrameInfo::EH);
}
sect = sl->FindSectionByType(eSectionTypeDWARFDebugFrame, true);
if (sect) {
- m_debug_frame_up.reset(
- new DWARFCallFrameInfo(*object_file, sect, DWARFCallFrameInfo::DWARF));
+ m_debug_frame_up = std::make_unique<DWARFCallFrameInfo>(
+ *object_file, sect, DWARFCallFrameInfo::DWARF);
}
sect = sl->FindSectionByType(eSectionTypeCompactUnwind, true);
if (sect) {
- m_compact_unwind_up.reset(new CompactUnwindInfo(*object_file, sect));
+ m_compact_unwind_up =
+ std::make_unique<CompactUnwindInfo>(*object_file, sect);
}
sect = sl->FindSectionByType(eSectionTypeARMexidx, true);
if (sect) {
SectionSP sect_extab = sl->FindSectionByType(eSectionTypeARMextab, true);
if (sect_extab.get()) {
- m_arm_unwind_up.reset(new ArmUnwindInfo(*object_file, sect, sect_extab));
+ m_arm_unwind_up =
+ std::make_unique<ArmUnwindInfo>(*object_file, sect, sect_extab);
}
}
}
diff --git a/lldb/source/Target/ModuleCache.cpp b/lldb/source/Target/ModuleCache.cpp
index cdd33f512c09..20661a7b7a25 100644
--- a/lldb/source/Target/ModuleCache.cpp
+++ b/lldb/source/Target/ModuleCache.cpp
@@ -169,7 +169,7 @@ ModuleLock::ModuleLock(const FileSpec &root_dir_spec, const UUID &uuid,
return;
}
- m_lock.reset(new lldb_private::LockFile(m_file_up->GetDescriptor()));
+ m_lock = std::make_unique<lldb_private::LockFile>(m_file_up->GetDescriptor());
error = m_lock->WriteLock(0, 1);
if (error.Fail())
error.SetErrorStringWithFormat("Failed to lock file: %s",
diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp
index 9cb38556a6ec..78f75981a94d 100644
--- a/lldb/source/Target/Process.cpp
+++ b/lldb/source/Target/Process.cpp
@@ -164,7 +164,8 @@ ProcessProperties::ProcessProperties(lldb_private::Process *process)
[this] { m_process->LoadOperatingSystemPlugin(true); });
}
- m_experimental_properties_up.reset(new ProcessExperimentalProperties());
+ m_experimental_properties_up =
+ std::make_unique<ProcessExperimentalProperties>();
m_collection_sp->AppendProperty(
ConstString(Properties::GetExperimentalSettingsName()),
ConstString("Experimental settings - setting these won't produce "
@@ -2748,7 +2749,7 @@ DataExtractor Process::GetAuxvData() { return DataExtractor(); }
JITLoaderList &Process::GetJITLoaders() {
if (!m_jit_loaders_up) {
- m_jit_loaders_up.reset(new JITLoaderList());
+ m_jit_loaders_up = std::make_unique<JITLoaderList>();
JITLoader::LoadPlugins(this, *m_jit_loaders_up);
}
return *m_jit_loaders_up;
diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp
index 21d2957baf0e..dad56376005c 100644
--- a/lldb/source/Target/Target.cpp
+++ b/lldb/source/Target/Target.cpp
@@ -2458,7 +2458,7 @@ lldb::addr_t Target::GetBreakableLoadAddress(lldb::addr_t addr) {
SourceManager &Target::GetSourceManager() {
if (!m_source_manager_up)
- m_source_manager_up.reset(new SourceManager(shared_from_this()));
+ m_source_manager_up = std::make_unique<SourceManager>(shared_from_this());
return *m_source_manager_up;
}
@@ -3137,7 +3137,7 @@ Target::StopHook::StopHook(const StopHook &rhs)
m_thread_spec_up(), m_active(rhs.m_active),
m_auto_continue(rhs.m_auto_continue) {
if (rhs.m_thread_spec_up)
- m_thread_spec_up.reset(new ThreadSpec(*rhs.m_thread_spec_up));
+ m_thread_spec_up = std::make_unique<ThreadSpec>(*rhs.m_thread_spec_up);
}
Target::StopHook::~StopHook() = default;
@@ -3427,7 +3427,8 @@ TargetProperties::TargetProperties(Target *target)
m_collection_sp->SetValueChangedCallback(
ePropertyDisableSTDIO, [this] { DisableSTDIOValueChangedCallback(); });
- m_experimental_properties_up.reset(new TargetExperimentalProperties());
+ m_experimental_properties_up =
+ std::make_unique<TargetExperimentalProperties>();
m_collection_sp->AppendProperty(
ConstString(Properties::GetExperimentalSettingsName()),
ConstString("Experimental settings - setting these won't produce "
@@ -3437,7 +3438,8 @@ TargetProperties::TargetProperties(Target *target)
m_collection_sp =
std::make_shared<TargetOptionValueProperties>(ConstString("target"));
m_collection_sp->Initialize(g_target_properties);
- m_experimental_properties_up.reset(new TargetExperimentalProperties());
+ m_experimental_properties_up =
+ std::make_unique<TargetExperimentalProperties>();
m_collection_sp->AppendProperty(
ConstString(Properties::GetExperimentalSettingsName()),
ConstString("Experimental settings - setting these won't produce "
diff --git a/lldb/source/Target/Thread.cpp b/lldb/source/Target/Thread.cpp
index 35cde4015986..24cf4bf3ee1e 100644
--- a/lldb/source/Target/Thread.cpp
+++ b/lldb/source/Target/Thread.cpp
@@ -1066,7 +1066,7 @@ ThreadPlanStack &Thread::GetPlans() const {
// ThreadPlanNull as its base plan. That will give the right answers to the
// queries GetDescription makes, and only assert if you try to run the thread.
if (!m_null_plan_stack_up)
- m_null_plan_stack_up.reset(new ThreadPlanStack(*this, true));
+ m_null_plan_stack_up = std::make_unique<ThreadPlanStack>(*this, true);
return *(m_null_plan_stack_up.get());
}
@@ -1859,7 +1859,7 @@ size_t Thread::GetStackFrameStatus(Stream &strm, uint32_t first_frame,
Unwind &Thread::GetUnwinder() {
if (!m_unwinder_up)
- m_unwinder_up.reset(new UnwindLLDB(*this));
+ m_unwinder_up = std::make_unique<UnwindLLDB>(*this);
return *m_unwinder_up;
}
diff --git a/lldb/source/Target/ThreadPlanStepInRange.cpp b/lldb/source/Target/ThreadPlanStepInRange.cpp
index c9a5697e2c6d..c5f81d6665a1 100644
--- a/lldb/source/Target/ThreadPlanStepInRange.cpp
+++ b/lldb/source/Target/ThreadPlanStepInRange.cpp
@@ -311,7 +311,7 @@ void ThreadPlanStepInRange::SetAvoidRegexp(const char *name) {
if (m_avoid_regexp_up)
*m_avoid_regexp_up = RegularExpression(name_ref);
else
- m_avoid_regexp_up.reset(new RegularExpression(name_ref));
+ m_avoid_regexp_up = std::make_unique<RegularExpression>(name_ref);
}
void ThreadPlanStepInRange::SetDefaultFlagValue(uint32_t new_value) {
More information about the lldb-commits
mailing list