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
This commit is contained in:
Pavel Labath 2019-07-22 14:29:29 +00:00
parent 4379a40088
commit a3189a032a
2 changed files with 3 additions and 16 deletions

View File

@ -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);

View File

@ -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;