summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/SymbolFile
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2015-03-24 18:56:08 +0000
committerZachary Turner <zturner@google.com>2015-03-24 18:56:08 +0000
commita98fac28aa7636998158a3ac1bf764bf14ca8570 (patch)
treea6b5bbeacc6f7feb5e675d412084a99e6b4061d9 /lldb/source/Plugins/SymbolFile
parent0783ab9a7f92318830d94d41857c36726cf84eaa (diff)
downloadbcm5719-llvm-a98fac28aa7636998158a3ac1bf764bf14ca8570.tar.gz
bcm5719-llvm-a98fac28aa7636998158a3ac1bf764bf14ca8570.zip
Fix error introduced by changing function signatures.
Since ClangASTSource::layoutRecordType() was overriding a virtual function in the base, this was inadvertently causing a new method to be introduced rather than an override. To fix this all method signatures are changed back to taking DenseMaps, and the `override` keyword is added to make sure this type of error doesn't happen again. To keep the original fix intact, which is that fields and bases must be added in offset order, the ImportOffsetMap() function now copies the DenseMap into a vector and then sorts the vector on the value type (e.g. the offset) before iterating over the sorted vector and inserting the items. llvm-svn: 233099
Diffstat (limited to 'lldb/source/Plugins/SymbolFile')
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp70
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h21
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp10
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h9
4 files changed, 59 insertions, 51 deletions
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
index 6df5768e964..a546542ca91 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -2074,7 +2074,7 @@ SymbolFileDWARF::ParseChildMembers
accessibility,
anon_field_info.bit_size);
- layout_info.field_offsets.push_back(
+ layout_info.field_offsets.insert(
std::make_pair(unnamed_bitfield_decl, anon_field_info.bit_offset));
}
}
@@ -2126,7 +2126,7 @@ SymbolFileDWARF::ParseChildMembers
GetClangASTContext().SetMetadataAsUserID (field_decl, MakeUserID(die->GetOffset()));
- layout_info.field_offsets.push_back(std::make_pair(field_decl, field_bit_offset));
+ layout_info.field_offsets.insert(std::make_pair(field_decl, field_bit_offset));
}
else
{
@@ -2287,7 +2287,7 @@ SymbolFileDWARF::ParseChildMembers
}
else
{
- layout_info.base_offsets.push_back(
+ layout_info.base_offsets.insert(
std::make_pair(base_class_clang_type.GetAsCXXRecordDecl(),
clang::CharUnits::fromQuantity(member_byte_offset)));
}
@@ -2670,36 +2670,46 @@ SymbolFileDWARF::ResolveClangOpaqueTypeDefinition (ClangASTType &clang_type)
static_cast<uint32_t>(layout_info.base_offsets.size()),
static_cast<uint32_t>(layout_info.vbase_offsets.size()));
- for (const auto &entry : layout_info.field_offsets)
+ uint32_t idx;
+ {
+ llvm::DenseMap<const clang::FieldDecl *, uint64_t>::const_iterator pos,
+ end = layout_info.field_offsets.end();
+ for (idx = 0, pos = layout_info.field_offsets.begin(); pos != end; ++pos, ++idx)
{
GetObjectFile()->GetModule()->LogMessage(
log, "SymbolFileDWARF::ResolveClangOpaqueTypeDefinition (clang_type = %p) field[%u] = "
"{ bit_offset=%u, name='%s' }",
- static_cast<void *>(clang_type.GetOpaqueQualType()), entry.first->getFieldIndex(),
- static_cast<uint32_t>(entry.second), entry.first->getNameAsString().c_str());
+ static_cast<void *>(clang_type.GetOpaqueQualType()), idx,
+ static_cast<uint32_t>(pos->second), pos->first->getNameAsString().c_str());
+ }
}
- uint32_t idx = 0;
- for (const auto &entry : layout_info.base_offsets)
{
- GetObjectFile()->GetModule()->LogMessage(
- log, "SymbolFileDWARF::ResolveClangOpaqueTypeDefinition (clang_type = %p) base[%u] = { "
- "byte_offset=%u, name='%s' }",
- clang_type.GetOpaqueQualType(), idx, (uint32_t)entry.second.getQuantity(),
- entry.first->getNameAsString().c_str());
- ++idx;
+ llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits>::const_iterator base_pos,
+ base_end = layout_info.base_offsets.end();
+ for (idx = 0, base_pos = layout_info.base_offsets.begin(); base_pos != base_end;
+ ++base_pos, ++idx)
+ {
+ GetObjectFile()->GetModule()->LogMessage(
+ log, "SymbolFileDWARF::ResolveClangOpaqueTypeDefinition (clang_type = %p) base[%u] "
+ "= { byte_offset=%u, name='%s' }",
+ clang_type.GetOpaqueQualType(), idx, (uint32_t)base_pos->second.getQuantity(),
+ base_pos->first->getNameAsString().c_str());
+ }
}
-
- idx = 0;
- for (const auto &entry : layout_info.vbase_offsets)
{
- GetObjectFile()->GetModule()->LogMessage(
- log, "SymbolFileDWARF::ResolveClangOpaqueTypeDefinition (clang_type = %p) vbase[%u] = "
- "{ byte_offset=%u, name='%s' }",
- static_cast<void *>(clang_type.GetOpaqueQualType()), idx,
- static_cast<uint32_t>(entry.second.getQuantity()),
- entry.first->getNameAsString().c_str());
- ++idx;
+ llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits>::const_iterator vbase_pos,
+ vbase_end = layout_info.vbase_offsets.end();
+ for (idx = 0, vbase_pos = layout_info.vbase_offsets.begin(); vbase_pos != vbase_end;
+ ++vbase_pos, ++idx)
+ {
+ GetObjectFile()->GetModule()->LogMessage(
+ log, "SymbolFileDWARF::ResolveClangOpaqueTypeDefinition (clang_type = %p) "
+ "vbase[%u] = { byte_offset=%u, name='%s' }",
+ static_cast<void *>(clang_type.GetOpaqueQualType()), idx,
+ static_cast<uint32_t>(vbase_pos->second.getQuantity()),
+ vbase_pos->first->getNameAsString().c_str());
+ }
}
}
m_record_decl_to_layout_map.insert(std::make_pair(record_decl, layout_info));
@@ -7933,9 +7943,9 @@ SymbolFileDWARF::FindExternalVisibleDeclsByName (void *baton,
bool
SymbolFileDWARF::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)
+ 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)
{
SymbolFileDWARF *symbol_file_dwarf = (SymbolFileDWARF *)baton;
return symbol_file_dwarf->LayoutRecordType (record_decl, size, alignment, field_offsets, base_offsets, vbase_offsets);
@@ -7943,9 +7953,9 @@ SymbolFileDWARF::LayoutRecordType(void *baton, const clang::RecordDecl *record_d
bool
SymbolFileDWARF::LayoutRecordType(const clang::RecordDecl *record_decl, uint64_t &bit_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)
+ 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)
{
Log *log (LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_INFO));
RecordDeclToLayoutMap::iterator pos = m_record_decl_to_layout_map.find (record_decl);
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
index 4551d6ef56b..981e3551460 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
@@ -151,16 +151,15 @@ 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,
- 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);
+ 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,
- 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);
+ 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);
struct LayoutInfo
{
@@ -174,9 +173,9 @@ public:
}
uint64_t bit_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;
+ 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;
};
//------------------------------------------------------------------
// PluginInterface protocol
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
index eeb3ef8242a..9636028d0f5 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
@@ -1475,11 +1475,11 @@ SymbolFileDWARFDebugMap::CompleteObjCInterfaceDecl (void *baton, clang::ObjCInte
}
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::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)
{
SymbolFileDWARFDebugMap *symbol_file_dwarf = (SymbolFileDWARFDebugMap *)baton;
SymbolFileDWARF *oso_dwarf;
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
index cecd6396784..d4400eb78e6 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
@@ -103,11 +103,10 @@ public:
static void
CompleteObjCInterfaceDecl (void *baton, clang::ObjCInterfaceDecl *);
- 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);
+ 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);
//------------------------------------------------------------------
// PluginInterface protocol
OpenPOWER on IntegriCloud