diff options
author | Zachary Turner <zturner@google.com> | 2015-03-24 16:24:50 +0000 |
---|---|---|
committer | Zachary Turner <zturner@google.com> | 2015-03-24 16:24:50 +0000 |
commit | 504f38da4e2c5ef76e7414f18fdafc71908876e9 (patch) | |
tree | 3a2070d2784730fb1444072f52dc97b27ebbc98d /lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp | |
parent | 186d2cbd1d746493d03be6a535b91ee2354effd9 (diff) | |
download | bcm5719-llvm-504f38da4e2c5ef76e7414f18fdafc71908876e9.tar.gz bcm5719-llvm-504f38da4e2c5ef76e7414f18fdafc71908876e9.zip |
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
Diffstat (limited to 'lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp')
-rw-r--r-- | lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp | 14 |
1 files changed, 6 insertions, 8 deletions
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 <const clang::FieldDecl *, uint64_t> &field_offsets, - llvm::DenseMap <const clang::CXXRecordDecl *, clang::CharUnits> &base_offsets, - llvm::DenseMap <const clang::CXXRecordDecl *, clang::CharUnits> &vbase_offsets) +bool +SymbolFileDWARFDebugMap::LayoutRecordType( + void *baton, const clang::RecordDecl *record_decl, uint64_t &size, uint64_t &alignment, + std::vector<std::pair<const clang::FieldDecl *, uint64_t>> &field_offsets, + std::vector<std::pair<const clang::CXXRecordDecl *, clang::CharUnits>> &base_offsets, + std::vector<std::pair<const clang::CXXRecordDecl *, clang::CharUnits>> &vbase_offsets) { SymbolFileDWARFDebugMap *symbol_file_dwarf = (SymbolFileDWARFDebugMap *)baton; SymbolFileDWARF *oso_dwarf; |