[Lldb-commits] [lldb] r346435 - [lldb] Fix initialization order warnings.

Jorge Gorbe Moya via lldb-commits lldb-commits at lists.llvm.org
Thu Nov 8 11:57:59 PST 2018


Author: jgorbe
Date: Thu Nov  8 11:57:59 2018
New Revision: 346435

URL: http://llvm.org/viewvc/llvm-project?rev=346435&view=rev
Log:
[lldb] Fix initialization order warnings.

Moved the declaration of m_kind below the declaration of cvclass,
cvunion and cvenum. This order is necessary because in one of the
constructors the initialization of m_kind depends on the value of
cvclass.

third_party/llvm/llvm/tools/lldb/source/Plugins/SymbolFile/NativePDB/PdbUtil.cpp:50:7: error: field 'cvclass' will be initialized after field 'm_kind' [-Werror,-Wreorder]
    : cvclass(std::move(c)),
      ^
third_party/llvm/llvm/tools/lldb/source/Plugins/SymbolFile/NativePDB/PdbUtil.cpp:51:14: error: field 'cvclass' is uninitialized when used here [-Werror,-Wuninitialized]
      m_kind(cvclass.Kind == TypeRecordKind::Struct ? Struct : Class) {}

Modified:
    lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbUtil.h

Modified: lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbUtil.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbUtil.h?rev=346435&r1=346434&r2=346435&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbUtil.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbUtil.h Thu Nov  8 11:57:59 2018
@@ -56,12 +56,12 @@ private:
   CVTagRecord(llvm::codeview::ClassRecord &&c);
   CVTagRecord(llvm::codeview::UnionRecord &&u);
   CVTagRecord(llvm::codeview::EnumRecord &&e);
-  Kind m_kind;
   union {
     llvm::codeview::ClassRecord cvclass;
     llvm::codeview::EnumRecord cvenum;
     llvm::codeview::UnionRecord cvunion;
   };
+  Kind m_kind;
 };
 
 struct SegmentOffset {




More information about the lldb-commits mailing list