// 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();
}
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;
}
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;
}
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);
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();
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
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;
}
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();
}
// 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(
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'",
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);
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);
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
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(
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;
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;
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;
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;
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;
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;
// 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;
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;
}
std::unique_ptr<ScriptInterpreterLocker>
ScriptInterpreter::AcquireInterpreterLock() {
- return std::unique_ptr<ScriptInterpreterLocker>(
- new ScriptInterpreterLocker());
+ return std::make_unique<ScriptInterpreterLocker>();
}
}
// 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.
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(),
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();
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();
}
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(
// 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);
// 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);
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();
}
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);
}
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
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());
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));
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));
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);
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();
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();
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;
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 +
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();
// 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;
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");
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();
}
}
// 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();
}
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) {
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;
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);
}
.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);
}
}
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);
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
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());
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);
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();
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;
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;
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) {
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;
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));
}
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;
}
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;
}
}
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;
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))
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
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());
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);
(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());
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) {
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
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();
}
: 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());
// 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:
}
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();
}
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);
}
}
}
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",
[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 "
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;
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;
}
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;
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 "
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 "
// 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());
}
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;
}
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) {