From: Jonas Devlieghere Date: Thu, 25 Jun 2020 00:44:33 +0000 (-0700) Subject: [lldb] Use std::make_unique<> (NFC) X-Git-Tag: llvmorg-12-init~2015 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=06412dae82376c12bc64b944e6d21141313b5cf1;p=platform%2Fupstream%2Fllvm.git [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. --- diff --git a/lldb/source/Breakpoint/BreakpointLocation.cpp b/lldb/source/Breakpoint/BreakpointLocation.cpp index 646c2e3..93d54c0 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(false); return m_options_up.get(); } diff --git a/lldb/source/Breakpoint/BreakpointOptions.cpp b/lldb/source/Breakpoint/BreakpointOptions.cpp index 3886d03..0ce7b0f 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(*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(*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(*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(); } return m_thread_spec_up.get(); diff --git a/lldb/source/Breakpoint/WatchpointOptions.cpp b/lldb/source/Breakpoint/WatchpointOptions.cpp index 609aacf..f01f5ad 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(*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(*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(); return m_thread_spec_up.get(); } diff --git a/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp index ce2fb99..56d8dc8 100644 --- a/lldb/source/Commands/CommandObjectTarget.cpp +++ b/lldb/source/Commands/CommandObjectTarget.cpp @@ -4622,8 +4622,8 @@ protected: // First step, make the specifier. std::unique_ptr specifier_up; if (m_options.m_sym_ctx_specified) { - specifier_up.reset( - new SymbolContextSpecifier(GetDebugger().GetSelectedTarget())); + specifier_up = std::make_unique( + 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 d6dd406..b2020f2 100644 --- a/lldb/source/Commands/CommandObjectType.cpp +++ b/lldb/source/Commands/CommandObjectType.cpp @@ -1031,8 +1031,8 @@ protected: std::unique_ptr 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( + m_options.m_category_regex.GetCurrentValueAsRef()); if (!category_regex->IsValid()) { result.AppendErrorWithFormat( "syntax error in category regular expression '%s'", @@ -1044,8 +1044,8 @@ protected: if (argc == 1) { const char *arg = command.GetArgumentAtIndex(0); - formatter_regex.reset( - new RegularExpression(llvm::StringRef::withNullAsEmpty(arg))); + formatter_regex = std::make_unique( + llvm::StringRef::withNullAsEmpty(arg)); if (!formatter_regex->IsValid()) { result.AppendErrorWithFormat("syntax error in regular expression '%s'", arg); @@ -2092,7 +2092,8 @@ protected: if (argc == 1) { const char *arg = command.GetArgumentAtIndex(0); - regex.reset(new RegularExpression(llvm::StringRef::withNullAsEmpty(arg))); + regex = std::make_unique( + 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 cd9531b..6cf09aa 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_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 49e93cd..f8fc917 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(GetInputFILE(), GetOutputFILE()); // This is both a window and a menu delegate std::shared_ptr app_delegate_sp( diff --git a/lldb/source/Expression/IRExecutionUnit.cpp b/lldb/source/Expression/IRExecutionUnit.cpp index 1bcd6aa..e3c9c1d 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(new MemoryManager(*this))) + .setRelocationModel(triple.isOSBinFormatMachO() ? llvm::Reloc::PIC_ + : llvm::Reloc::Static) + .setMCJITMemoryManager(std::make_unique(*this)) .setOptLevel(llvm::CodeGenOpt::Less); llvm::StringRef mArch; diff --git a/lldb/source/Expression/Materializer.cpp b/lldb/source/Expression/Materializer.cpp index 8e96891..dccba588 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(persistent_variable_sp, + delegate); uint32_t ret = AddStructMember(**iter); (*iter)->SetOffset(ret); return ret; @@ -752,7 +753,7 @@ private: 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(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(type, is_program_reference, + keep_in_memory, delegate); uint32_t ret = AddStructMember(**iter); (*iter)->SetOffset(ret); return ret; @@ -1147,7 +1148,7 @@ private: 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(symbol_sp); uint32_t ret = AddStructMember(**iter); (*iter)->SetOffset(ret); return ret; @@ -1324,7 +1325,7 @@ private: 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(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 5683330..3a547ce 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 tcp_socket; - tcp_socket.reset(new TCPSocket(fd, false, false)); + tcp_socket = std::make_unique(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 fb13bd4..c14b6b6 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(target_sp, module_spec); } break; } diff --git a/lldb/source/Interpreter/ScriptInterpreter.cpp b/lldb/source/Interpreter/ScriptInterpreter.cpp index 5013d99..2dda1bb 100644 --- a/lldb/source/Interpreter/ScriptInterpreter.cpp +++ b/lldb/source/Interpreter/ScriptInterpreter.cpp @@ -102,6 +102,5 @@ Status ScriptInterpreter::SetBreakpointCommandCallbackFunction( std::unique_ptr ScriptInterpreter::AcquireInterpreterLock() { - return std::unique_ptr( - new ScriptInterpreterLocker()); + return std::make_unique(); } diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp index 08b1ae0..6b6346b 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(); // 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( + "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(); 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 Consumer; if (ast_transformer) { - Consumer.reset(new ASTConsumerForwarder(ast_transformer)); + Consumer = std::make_unique(ast_transformer); } else if (m_code_generator) { - Consumer.reset(new ASTConsumerForwarder(m_code_generator.get())); + Consumer = std::make_unique(m_code_generator.get()); } else { - Consumer.reset(new ASTConsumer()); + Consumer = std::make_unique(); } 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 ea56e42..0c9ad20 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( + 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 f915a69..95acb88 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("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 2d6de78..a28b4a7 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(); 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(); ResetDeclMap(exe_ctx, m_result_delegate, /*keep result in memory*/ true); @@ -919,16 +919,16 @@ void ClangUserExpression::ClangUserExpressionHelper::ResetDeclMap( auto *persistent_vars = llvm::cast(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( + 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( + 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 ae51965..25ec982 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(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( + 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 8fdce85..2f8cf18 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 lookup_result; - lookup_result.reset(new LookupResult(sema, DeclarationName(&ident), - SourceLocation(), - Sema::LookupOrdinaryName)); + lookup_result = std::make_unique(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 8819b8a..8511e55 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(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 61eb891..d4cb726 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(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 b830559..4ccaf0d 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(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 2cf9862..06aa861 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) const { - objc_class.reset(new objc_class_t); + objc_class = std::make_unique(); 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(); 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(); 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(); 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 base_method_list; - base_method_list.reset(new method_list_t); + base_method_list = std::make_unique(); 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; - method.reset(new method_t); + method = std::make_unique(); 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 e00ce9d..22ea83a 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
(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( + 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 4a07c79..ac9a093 100644 --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp @@ -581,8 +581,8 @@ protected: case 0: break; case 1: { - regex_up.reset(new RegularExpression( - llvm::StringRef::withNullAsEmpty(command.GetArgumentAtIndex(0)))); + regex_up = std::make_unique( + 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(*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 0fe9dc3..c96768c 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(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 ba76f68..b19d3d9 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( "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 6b8a3902..beee2f5 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(); 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->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(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(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(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(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 93cef12..93c2c9f 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 guard(module_sp->GetMutex()); if (m_symtab_up == nullptr) { - m_symtab_up.reset(new Symtab(this)); + m_symtab_up = std::make_unique(this); std::lock_guard 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(); 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 cbcac7b..6c2f22b 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 guard(module_sp->GetMutex()); if (m_symtab_up == nullptr) { - m_symtab_up.reset(new Symtab(this)); + m_symtab_up = std::make_unique(this); std::lock_guard 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(); 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 0a5a1d3..7d0f453 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 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(this); std::lock_guard 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(); 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 1770711..ffccd6d 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(); 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 0649cd2..d73b132 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(*this, pcs, pcs_are_call_addresses); Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT)); LLDB_LOGF(log, "%p HistoryThread::HistoryThread", static_cast(this)); } diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp index 0fc3e9c..7f5ea80 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(); } return *m_clang_ast_importer_up; } @@ -1783,7 +1783,7 @@ public: 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(); *m_metadata_up = *metadata; } } @@ -1803,7 +1803,7 @@ public: m_property_attributes = rhs.m_property_attributes; if (rhs.m_metadata_up) { - m_metadata_up.reset(new ClangASTMetadata()); + m_metadata_up = std::make_unique(); *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(); 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 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(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 b8d1675..dfa4075 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(); 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 d662dcb..7dd084f 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(this)); if (m_context.getOrLoadRangesData().GetByteSize() > 0) - m_ranges.reset(new DWARFDebugRanges()); + m_ranges = std::make_unique(); if (m_ranges) m_ranges->Extract(m_context); @@ -1192,15 +1192,15 @@ size_t SymbolFileDWARF::ParseBlocksRecursive( (name != nullptr || mangled_name != nullptr)) { std::unique_ptr decl_up; if (decl_file != 0 || decl_line != 0 || decl_column != 0) - decl_up.reset(new Declaration( + decl_up = std::make_unique( comp_unit.GetSupportFiles().GetFileSpecAtIndex(decl_file), - decl_line, decl_column)); + decl_line, decl_column); std::unique_ptr call_up; if (call_file != 0 || call_line != 0 || call_column != 0) - call_up.reset(new Declaration( + call_up = std::make_unique( 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(); 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 a67584a..9726889 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(); 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(*m_language_options_up, nullptr); + m_builtins_up = std::make_unique(); - m_selector_table_up.reset(new SelectorTable()); + m_selector_table_up = std::make_unique(); 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( + file_system_options, FileSystem::Instance().GetVirtualFileSystem()); llvm::IntrusiveRefCntPtr diag_id_sp(new DiagnosticIDs()); - m_diagnostics_engine_up.reset( - new DiagnosticsEngine(diag_id_sp, new DiagnosticOptions())); + m_diagnostics_engine_up = + std::make_unique(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( + *m_diagnostics_engine_up, *m_file_manager_up); + m_ast_up = std::make_unique( + *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(); 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(*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(*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( + target.shared_from_this(), m_persistent_variables->GetClangASTImporter()); m_scratch_ast_source_up->InstallASTContext(*this); llvm::IntrusiveRefCntPtr proxy_ast_source( m_scratch_ast_source_up->CreateProxy()); diff --git a/lldb/source/Symbol/SymbolContext.cpp b/lldb/source/Symbol/SymbolContext.cpp index 3b120fd..12c2077 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(spec_string); m_type |= eFileSpecified; break; case eLineStartSpecified: diff --git a/lldb/source/Symbol/SymbolVendor.cpp b/lldb/source/Symbol/SymbolVendor.cpp index 403ca7a..0a5acbc 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(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 ef6e848..3faa528 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( + *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( + *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(*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(*object_file, sect, sect_extab); } } } diff --git a/lldb/source/Target/ModuleCache.cpp b/lldb/source/Target/ModuleCache.cpp index cdd33f5..20661a7 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(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 9cb3855..78f7598 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(); 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(); 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 21d2957..dad5637 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(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(*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(); 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(ConstString("target")); m_collection_sp->Initialize(g_target_properties); - m_experimental_properties_up.reset(new TargetExperimentalProperties()); + m_experimental_properties_up = + std::make_unique(); 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 35cde40..24cf4bf 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(*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(*this); return *m_unwinder_up; } diff --git a/lldb/source/Target/ThreadPlanStepInRange.cpp b/lldb/source/Target/ThreadPlanStepInRange.cpp index c9a5697..c5f81d6 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(name_ref); } void ThreadPlanStepInRange::SetDefaultFlagValue(uint32_t new_value) {