[Lldb-commits] [lldb] r366692 - ELF: Fix a "memset clearing object of non-trivial type" warning

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Mon Jul 22 07:29:29 PDT 2019


Author: labath
Date: Mon Jul 22 07:29:29 2019
New Revision: 366692

URL: http://llvm.org/viewvc/llvm-project?rev=366692&view=rev
Log:
ELF: Fix a "memset clearing object of non-trivial type" warning

Just delete the memset as the ELFHeader constructor already
zero-initializes the object. Also clean up the ObjectFileELF
constructors/desctructors while I'm in there.

Modified:
    lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
    lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.h

Modified: lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp?rev=366692&r1=366691&r2=366692&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp (original)
+++ lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp Mon Jul 22 07:29:29 2019
@@ -721,27 +721,16 @@ ObjectFileELF::ObjectFileELF(const lldb:
                              DataBufferSP &data_sp, lldb::offset_t data_offset,
                              const FileSpec *file, lldb::offset_t file_offset,
                              lldb::offset_t length)
-    : ObjectFile(module_sp, file, file_offset, length, data_sp, data_offset),
-      m_header(), m_uuid(), m_gnu_debuglink_file(), m_gnu_debuglink_crc(0),
-      m_program_headers(), m_section_headers(), m_dynamic_symbols(),
-      m_filespec_up(), m_entry_point_address(), m_arch_spec() {
+    : ObjectFile(module_sp, file, file_offset, length, data_sp, data_offset) {
   if (file)
     m_file = *file;
-  ::memset(&m_header, 0, sizeof(m_header));
 }
 
 ObjectFileELF::ObjectFileELF(const lldb::ModuleSP &module_sp,
                              DataBufferSP &header_data_sp,
                              const lldb::ProcessSP &process_sp,
                              addr_t header_addr)
-    : ObjectFile(module_sp, process_sp, header_addr, header_data_sp),
-      m_header(), m_uuid(), m_gnu_debuglink_file(), m_gnu_debuglink_crc(0),
-      m_program_headers(), m_section_headers(), m_dynamic_symbols(),
-      m_filespec_up(), m_entry_point_address(), m_arch_spec() {
-  ::memset(&m_header, 0, sizeof(m_header));
-}
-
-ObjectFileELF::~ObjectFileELF() {}
+    : ObjectFile(module_sp, process_sp, header_addr, header_data_sp) {}
 
 bool ObjectFileELF::IsExecutable() const {
   return ((m_header.e_type & ET_EXEC) != 0) || (m_header.e_entry != 0);

Modified: lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.h?rev=366692&r1=366691&r2=366692&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.h (original)
+++ lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.h Mon Jul 22 07:29:29 2019
@@ -56,8 +56,6 @@ struct ELFNote {
 /// the ObjectFile protocol.
 class ObjectFileELF : public lldb_private::ObjectFile {
 public:
-  ~ObjectFileELF() override;
-
   // Static Functions
   static void Initialize();
 
@@ -190,7 +188,7 @@ private:
 
   /// ELF .gnu_debuglink file and crc data if available.
   std::string m_gnu_debuglink_file;
-  uint32_t m_gnu_debuglink_crc;
+  uint32_t m_gnu_debuglink_crc = 0;
 
   /// Collection of program headers.
   ProgramHeaderColl m_program_headers;




More information about the lldb-commits mailing list