Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp =================================================================== --- lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp +++ lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp @@ -1896,18 +1896,16 @@ if (!size) return false; llvm::APInt apint(*size, uval64, is_signed); - template_param_infos.args.push_back( - clang::TemplateArgument(ast, llvm::APSInt(apint, !is_signed), - ClangUtil::GetQualType(clang_type))); - } else { - template_param_infos.args.push_back( - clang::TemplateArgument(ClangUtil::GetQualType(clang_type))); - } + template_param_infos.args.emplace_back( + ast, llvm::APSInt(apint, !is_signed), + ClangUtil::GetQualType(clang_type)); + } else + template_param_infos.args.emplace_back( + ClangUtil::GetQualType(clang_type)); } else { auto *tplt_type = m_ast.CreateTemplateTemplateParmDecl(template_name); template_param_infos.names.push_back(name); - template_param_infos.args.push_back( - clang::TemplateArgument(clang::TemplateName(tplt_type))); + template_param_infos.args.emplace_back(clang::TemplateName(tplt_type)); } } } @@ -2743,10 +2741,10 @@ ClangASTMetadata metadata; metadata.SetUserID(die.GetID()); - delayed_properties.push_back(DelayedAddObjCClassProperty( + delayed_properties.emplace_back( class_clang_type, prop_name, member_type->GetLayoutCompilerType(), ivar_decl, prop_setter_name, prop_getter_name, prop_attributes, - &metadata)); + &metadata); if (ivar_decl) m_ast.SetMetadataAsUserID(ivar_decl, die.GetID()); Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFAbbreviationDeclaration.cpp =================================================================== --- lldb/source/Plugins/SymbolFile/DWARF/DWARFAbbreviationDeclaration.cpp +++ lldb/source/Plugins/SymbolFile/DWARF/DWARFAbbreviationDeclaration.cpp @@ -60,7 +60,7 @@ if (form == DW_FORM_implicit_const) val.value.sval = data.GetULEB128(offset_ptr); - m_attributes.push_back(DWARFAttribute(attr, form, val)); + m_attributes.emplace_back(attr, form, val); } return llvm::make_error( Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFAttribute.h =================================================================== --- lldb/source/Plugins/SymbolFile/DWARF/DWARFAttribute.h +++ lldb/source/Plugins/SymbolFile/DWARF/DWARFAttribute.h @@ -52,8 +52,10 @@ DWARFAttributes(); ~DWARFAttributes(); - void Append(const DWARFUnit *cu, dw_offset_t attr_die_offset, - dw_attr_t attr, dw_form_t form); + void Append(const DWARFUnit *cu, dw_offset_t attr_die_offset, dw_attr_t attr, + dw_form_t form) { + m_infos.emplace_back(cu, attr_die_offset, attr, form); + } const DWARFUnit *CompileUnitAtIndex(uint32_t i) const { return m_infos[i].cu; } @@ -77,6 +79,11 @@ // case we have DW_FORM_ref_addr values dw_offset_t die_offset; DWARFAttribute attr; + + AttributeValue(const DWARFUnit *cu, dw_offset_t die_offset, dw_attr_t attr, + dw_form_t form) + : cu(cu), die_offset(die_offset), + attr(attr, form, DWARFFormValue::ValueType()) {} }; typedef llvm::SmallVector collection; collection m_infos; Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFAttribute.cpp =================================================================== --- lldb/source/Plugins/SymbolFile/DWARF/DWARFAttribute.cpp +++ lldb/source/Plugins/SymbolFile/DWARF/DWARFAttribute.cpp @@ -25,13 +25,6 @@ return UINT32_MAX; } -void DWARFAttributes::Append(const DWARFUnit *cu, dw_offset_t attr_die_offset, - dw_attr_t attr, dw_form_t form) { - AttributeValue attr_value = { - cu, attr_die_offset, {attr, form, DWARFFormValue::ValueType()}}; - m_infos.push_back(attr_value); -} - bool DWARFAttributes::ExtractFormValueAtIndex( uint32_t i, DWARFFormValue &form_value) const { const DWARFUnit *cu = CompileUnitAtIndex(i); Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp =================================================================== --- lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp +++ lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp @@ -382,33 +382,33 @@ parent.GetDeclContext(context); switch (tag) { case DW_TAG_module: - context.push_back({CompilerContextKind::Module, ConstString(GetName())}); + context.emplace_back(CompilerContextKind::Module, ConstString(GetName())); break; case DW_TAG_namespace: - context.push_back({CompilerContextKind::Namespace, ConstString(GetName())}); + context.emplace_back(CompilerContextKind::Namespace, ConstString(GetName())); break; case DW_TAG_structure_type: - context.push_back({CompilerContextKind::Struct, ConstString(GetName())}); + context.emplace_back(CompilerContextKind::Struct, ConstString(GetName())); break; case DW_TAG_union_type: - context.push_back({CompilerContextKind::Union, ConstString(GetName())}); + context.emplace_back(CompilerContextKind::Union, ConstString(GetName())); break; case DW_TAG_class_type: - context.push_back({CompilerContextKind::Class, ConstString(GetName())}); + context.emplace_back(CompilerContextKind::Class, ConstString(GetName())); break; case DW_TAG_enumeration_type: - context.push_back({CompilerContextKind::Enum, ConstString(GetName())}); + context.emplace_back(CompilerContextKind::Enum, ConstString(GetName())); break; case DW_TAG_subprogram: - context.push_back( - {CompilerContextKind::Function, ConstString(GetPubname())}); + context.emplace_back(CompilerContextKind::Function, + ConstString(GetPubname())); break; case DW_TAG_variable: - context.push_back( - {CompilerContextKind::Variable, ConstString(GetPubname())}); + context.emplace_back(CompilerContextKind::Variable, + ConstString(GetPubname())); break; case DW_TAG_typedef: - context.push_back({CompilerContextKind::Typedef, ConstString(GetName())}); + context.emplace_back(CompilerContextKind::Typedef, ConstString(GetName())); break; default: break;