dmantipov updated this revision to Diff 291838.
dmantipov added a comment.

Minor style adjustments.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D87675/new/

https://reviews.llvm.org/D87675

Files:
  lldb/include/lldb/Symbol/Function.h
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFAbbreviationDeclaration.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFAttribute.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFAttribute.h
  lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugArangeSet.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugArangeSet.h
  lldb/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp
  lldb/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.h
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp

Index: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
===================================================================
--- lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -3638,10 +3638,8 @@
         LocationInCaller = parse_simple_location(i);
     }
 
-    if (LocationInCallee && LocationInCaller) {
-      CallSiteParameter param = {*LocationInCallee, *LocationInCaller};
-      parameters.push_back(param);
-    }
+    if (LocationInCallee && LocationInCaller)
+      parameters.emplace_back(*LocationInCallee, *LocationInCaller);
   }
   return parameters;
 }
Index: lldb/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.h
===================================================================
--- lldb/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.h
+++ lldb/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.h
@@ -72,6 +72,8 @@
   struct Atom {
     AtomType type;
     dw_form_t form;
+
+    Atom(AtomType &type, dw_form_t &form) : type(type), form(form) {}
   };
 
   typedef std::vector<DIEInfo> DIEInfoArray;
Index: lldb/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp
===================================================================
--- lldb/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp
@@ -154,7 +154,7 @@
 }
 
 void DWARFMappedHash::Prologue::AppendAtom(AtomType type, dw_form_t form) {
-  atoms.push_back({type, form});
+  atoms.emplace_back(type, form);
   atom_mask |= 1u << type;
   switch (form) {
   case DW_FORM_indirect:
Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugArangeSet.h
===================================================================
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugArangeSet.h
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugArangeSet.h
@@ -33,6 +33,14 @@
   struct Descriptor {
     dw_addr_t address;
     dw_addr_t length;
+
+    static_assert(sizeof(address) == sizeof(length),
+                  "DWARFDebugArangeSet::Descriptor.address and "
+                  "DWARFDebugArangeSet::Descriptor.length must have same size");
+
+    Descriptor(dw_addr_t address, dw_addr_t length)
+      : address(address), length(length) {}
+
     dw_addr_t end_address() const { return address + length; }
   };
 
Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugArangeSet.cpp
===================================================================
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugArangeSet.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugArangeSet.cpp
@@ -98,23 +98,16 @@
 
   *offset_ptr = m_offset + first_tuple_offset;
 
-  Descriptor arangeDescriptor;
-
-  static_assert(sizeof(arangeDescriptor.address) ==
-                    sizeof(arangeDescriptor.length),
-                "DWARFDebugArangeSet::Descriptor.address and "
-                "DWARFDebugArangeSet::Descriptor.length must have same size");
-
   while (data.ValidOffset(*offset_ptr)) {
-    arangeDescriptor.address = data.GetMaxU64(offset_ptr, m_header.addr_size);
-    arangeDescriptor.length = data.GetMaxU64(offset_ptr, m_header.addr_size);
+    dw_addr_t address = data.GetMaxU64(offset_ptr, m_header.addr_size);
+    dw_attr_t length = data.GetMaxU64(offset_ptr, m_header.addr_size);
 
     // Each set of tuples is terminated by a 0 for the address and 0 for
     // the length.
-    if (!arangeDescriptor.address && !arangeDescriptor.length)
+    if (!address && !length)
       return llvm::ErrorSuccess();
 
-    m_arange_descriptors.push_back(arangeDescriptor);
+    m_arange_descriptors.emplace_back(address, length);
   }
 
   return llvm::make_error<llvm::object::GenericBinaryError>(
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;
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<AttributeValue, 8> 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/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<llvm::object::GenericBinaryError>(
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/include/lldb/Symbol/Function.h
===================================================================
--- lldb/include/lldb/Symbol/Function.h
+++ lldb/include/lldb/Symbol/Function.h
@@ -259,6 +259,10 @@
 struct CallSiteParameter {
   DWARFExpression LocationInCallee;
   DWARFExpression LocationInCaller;
+
+  CallSiteParameter(DWARFExpression &LocationInCallee,
+                    DWARFExpression &LocationInCaller)
+    : LocationInCallee(LocationInCallee), LocationInCaller(LocationInCaller) {}
 };
 
 /// A vector of \c CallSiteParameter.
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to