summaryrefslogtreecommitdiffstats
path: root/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
diff options
context:
space:
mode:
authorPaul Robinson <paul.robinson@sony.com>2018-08-01 20:43:47 +0000
committerPaul Robinson <paul.robinson@sony.com>2018-08-01 20:43:47 +0000
commit143eaeab539b1f8cff3e4ea139aaf219ee117da6 (patch)
tree6146f25714f1f3395afa7c7f6f214cd8b90507d7 /llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
parent624169f72e89b9f688a9ff4b74c357f6584ae185 (diff)
downloadbcm5719-llvm-143eaeab539b1f8cff3e4ea139aaf219ee117da6.tar.gz
bcm5719-llvm-143eaeab539b1f8cff3e4ea139aaf219ee117da6.zip
[DebugInfo/DWARF] [1/4] De-templatize DWARFUnitSection. NFC
This is patch 1 of 4 NFC refactorings to handle type units and compile units more consistently and with less concern about the object-file section that they came from. Patch 1 replaces the templated DWARFUnitSection with a non-templated version. That is, instead of being a SmallVector of pointers to a specific unit kind, it is not a SmallVector of pointers to the base class for both type and compile units. Virtual methods are magic. Differential Revision: https://reviews.llvm.org/D49741 llvm-svn: 338628
Diffstat (limited to 'llvm/lib/DebugInfo/DWARF/DWARFContext.cpp')
-rw-r--r--llvm/lib/DebugInfo/DWARF/DWARFContext.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
index 9d2554ff9e2..a26ebba0a21 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
@@ -584,11 +584,11 @@ void DWARFContext::dump(
}
DWARFCompileUnit *DWARFContext::getDWOCompileUnitForHash(uint64_t Hash) {
- DWOCUs.parseDWO(*this, DObj->getInfoDWOSection(), true);
+ DWOCUs.parseDWO(*this, DObj->getInfoDWOSection(), DW_SECT_INFO, true);
if (const auto &CUI = getCUIndex()) {
if (const auto *R = CUI.getFromHash(Hash))
- return DWOCUs.getUnitForIndexEntry(*R);
+ return dyn_cast_or_null<DWARFCompileUnit>(DWOCUs.getUnitForIndexEntry(*R));
return nullptr;
}
@@ -607,7 +607,7 @@ DWARFCompileUnit *DWARFContext::getDWOCompileUnitForHash(uint64_t Hash) {
continue;
}
if (DWOCU->getDWOId() == Hash)
- return DWOCU.get();
+ return dyn_cast<DWARFCompileUnit>(DWOCU.get());
}
return nullptr;
}
@@ -690,10 +690,10 @@ const DWARFDebugLoc *DWARFContext::getDebugLoc() {
return Loc.get();
Loc.reset(new DWARFDebugLoc);
- // Assume all compile units have the same address byte size.
+ // Assume all units have the same address byte size.
if (getNumCompileUnits()) {
DWARFDataExtractor LocData(*DObj, DObj->getLocSection(), isLittleEndian(),
- getCompileUnitAtIndex(0)->getAddressByteSize());
+ getUnitAtIndex(0)->getAddressByteSize());
Loc->parse(LocData);
}
return Loc.get();
@@ -707,7 +707,7 @@ const DWARFDebugLocDWO *DWARFContext::getDebugLocDWO() {
// Assume all compile units have the same address byte size.
if (getNumCompileUnits()) {
DataExtractor LocData(DObj->getLocDWOSection().Data, isLittleEndian(),
- getCompileUnitAtIndex(0)->getAddressByteSize());
+ getUnitAtIndex(0)->getAddressByteSize());
LocDWO->parse(LocData);
}
return LocDWO.get();
@@ -844,7 +844,7 @@ Expected<const DWARFDebugLine::LineTable *> DWARFContext::getLineTableForUnit(
}
void DWARFContext::parseCompileUnits() {
- CUs.parse(*this, DObj->getInfoSection());
+ CUs.parse(*this, DObj->getInfoSection(), DW_SECT_INFO);
}
void DWARFContext::parseTypeUnits() {
@@ -852,12 +852,12 @@ void DWARFContext::parseTypeUnits() {
return;
DObj->forEachTypesSections([&](const DWARFSection &S) {
TUs.emplace_back();
- TUs.back().parse(*this, S);
+ TUs.back().parse(*this, S, DW_SECT_TYPES);
});
}
void DWARFContext::parseDWOCompileUnits() {
- DWOCUs.parseDWO(*this, DObj->getInfoDWOSection());
+ DWOCUs.parseDWO(*this, DObj->getInfoDWOSection(), DW_SECT_INFO);
}
void DWARFContext::parseDWOTypeUnits() {
@@ -865,13 +865,13 @@ void DWARFContext::parseDWOTypeUnits() {
return;
DObj->forEachTypesDWOSections([&](const DWARFSection &S) {
DWOTUs.emplace_back();
- DWOTUs.back().parseDWO(*this, S);
+ DWOTUs.back().parseDWO(*this, S, DW_SECT_TYPES);
});
}
DWARFCompileUnit *DWARFContext::getCompileUnitForOffset(uint32_t Offset) {
parseCompileUnits();
- return CUs.getUnitForOffset(Offset);
+ return dyn_cast_or_null<DWARFCompileUnit>(CUs.getUnitForOffset(Offset));
}
DWARFCompileUnit *DWARFContext::getCompileUnitForAddress(uint64_t Address) {
OpenPOWER on IntegriCloud