From a3189a032a14d2eca8971c0a154bb9777043d226 Mon Sep 17 00:00:00 2001 From: Pavel Labath Date: Mon, 22 Jul 2019 14:29:29 +0000 Subject: [PATCH] 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. llvm-svn: 366692 --- .../Plugins/ObjectFile/ELF/ObjectFileELF.cpp | 15 ++------------- .../source/Plugins/ObjectFile/ELF/ObjectFileELF.h | 4 +--- 2 files changed, 3 insertions(+), 16 deletions(-) diff --git a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp index d62afa34bbe8..4bfd593cd542 100644 --- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp +++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp @@ -721,27 +721,16 @@ ObjectFileELF::ObjectFileELF(const lldb::ModuleSP &module_sp, 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); diff --git a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.h b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.h index b63a5d14d4f5..8abe9951d4e0 100644 --- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.h +++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.h @@ -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;