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/SymbolFileDWARF.h | |
| 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/SymbolFileDWARF.h')
| -rw-r--r-- | lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h | 32 |
1 files changed, 13 insertions, 19 deletions
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h index 5ebb60e1367..4551d6ef56b 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h @@ -151,22 +151,16 @@ public: clang::DeclarationName Name, llvm::SmallVectorImpl <clang::NamedDecl *> *results); - static bool - 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 - LayoutRecordType (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); + static bool + LayoutRecordType(void *baton, const clang::RecordDecl *record_decl, uint64_t &size, uint64_t &alignment, + std::vector<std::pair<const clang::FieldDecl *, uint64_t>> &FieldOffsets, + std::vector<std::pair<const clang::CXXRecordDecl *, clang::CharUnits>> &BaseOffsets, + std::vector<std::pair<const clang::CXXRecordDecl *, clang::CharUnits>> &VirtualBaseOffsets); + + bool LayoutRecordType(const clang::RecordDecl *record_decl, uint64_t &size, uint64_t &alignment, + std::vector<std::pair<const clang::FieldDecl *, uint64_t>> &FieldOffsets, + std::vector<std::pair<const clang::CXXRecordDecl *, clang::CharUnits>> &BaseOffsets, + std::vector<std::pair<const clang::CXXRecordDecl *, clang::CharUnits>> &VirtualBaseOffsets); struct LayoutInfo { @@ -180,9 +174,9 @@ public: } uint64_t bit_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; + 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; }; //------------------------------------------------------------------ // PluginInterface protocol |

