[Lldb-commits] [lldb] r357056 - Fix a "memset clearing an object of non-trivial type" warning in DWARFFormValue

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Wed Mar 27 03:02:36 PDT 2019


Author: labath
Date: Wed Mar 27 03:02:36 2019
New Revision: 357056

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

This is diagnosed by gcc-8. The ValueType struct already has a default
constructor which performs zero-initialization, so we can just call that
instead of using memset.

Modified:
    lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp?rev=357056&r1=357055&r2=357056&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp Wed Mar 27 03:02:36 2019
@@ -115,7 +115,7 @@ DWARFFormValue::DWARFFormValue(const DWA
 void DWARFFormValue::Clear() {
   m_cu = nullptr;
   m_form = 0;
-  memset(&m_value, 0, sizeof(m_value));
+  m_value = ValueTypeTag();
 }
 
 bool DWARFFormValue::ExtractValue(const DWARFDataExtractor &data,




More information about the lldb-commits mailing list