From 504f38da4e2c5ef76e7414f18fdafc71908876e9 Mon Sep 17 00:00:00 2001 From: Zachary Turner Date: Tue, 24 Mar 2015 16:24:50 +0000 Subject: Fix record layout when synthesizing class types. Prior to this patch, we would try to synthesize class types by iterating over a DenseMap of FieldDecls and adding each one to a CXXRecordDecl. Since a DenseMap doesn't provide a deterministic ordering of the elements, this would not add the fields in FieldOffset order, but rather in some random order determined by the memory layout of the DenseMap. This patch fixes the issue by changing DenseMaps to vectors. The ability to lookup a value in the DenseMap was hardly being used, and where it is sufficient to do a vector lookup. Differential Revision: http://reviews.llvm.org/D8512 llvm-svn: 233090 --- .../Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp') diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp index e7c68595b6f..eeb3ef8242a 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp @@ -1474,14 +1474,12 @@ SymbolFileDWARFDebugMap::CompleteObjCInterfaceDecl (void *baton, clang::ObjCInte } } -bool -SymbolFileDWARFDebugMap::LayoutRecordType (void *baton, - const clang::RecordDecl *record_decl, - uint64_t &size, - uint64_t &alignment, - llvm::DenseMap &field_offsets, - llvm::DenseMap &base_offsets, - llvm::DenseMap &vbase_offsets) +bool +SymbolFileDWARFDebugMap::LayoutRecordType( + void *baton, const clang::RecordDecl *record_decl, uint64_t &size, uint64_t &alignment, + std::vector> &field_offsets, + std::vector> &base_offsets, + std::vector> &vbase_offsets) { SymbolFileDWARFDebugMap *symbol_file_dwarf = (SymbolFileDWARFDebugMap *)baton; SymbolFileDWARF *oso_dwarf; -- cgit v1.2.3