[llvm] r338759 - [DebugInfo/DWARF] Remove redundant iterator type. NFC
Paul Robinson via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 2 12:29:38 PDT 2018
Author: probinson
Date: Thu Aug 2 12:29:38 2018
New Revision: 338759
URL: http://llvm.org/viewvc/llvm-project?rev=338759&view=rev
Log:
[DebugInfo/DWARF] Remove redundant iterator type. NFC
Modified:
llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFContext.h
llvm/trunk/lib/DebugInfo/DWARF/DWARFContext.cpp
llvm/trunk/tools/llvm-dwarfdump/llvm-dwarfdump.cpp
Modified: llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFContext.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFContext.h?rev=338759&r1=338758&r2=338759&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFContext.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFContext.h Thu Aug 2 12:29:38 2018
@@ -132,49 +132,60 @@ public:
bool verify(raw_ostream &OS, DIDumpOptions DumpOpts = {}) override;
- using cu_iterator_range = DWARFUnitVector::iterator_range;
- using tu_iterator_range = DWARFUnitVector::iterator_range;
+ using unit_iterator_range = DWARFUnitVector::iterator_range;
/// Get units from .debug_info in this context.
- cu_iterator_range info_section_units() {
+ unit_iterator_range info_section_units() {
parseNormalUnits();
- return cu_iterator_range(NormalUnits.begin(),
- NormalUnits.begin() +
- NormalUnits.getNumInfoUnits());
+ return unit_iterator_range(NormalUnits.begin(),
+ NormalUnits.begin() +
+ NormalUnits.getNumInfoUnits());
}
/// Get units from .debug_types in this context.
- tu_iterator_range types_section_units() {
+ unit_iterator_range types_section_units() {
parseNormalUnits();
- return tu_iterator_range(
+ return unit_iterator_range(
NormalUnits.begin() + NormalUnits.getNumInfoUnits(), NormalUnits.end());
}
/// Get compile units in this context.
- cu_iterator_range compile_units() { return info_section_units(); }
+ unit_iterator_range compile_units() { return info_section_units(); }
/// Get type units in this context.
- tu_iterator_range type_units() { return types_section_units(); }
+ unit_iterator_range type_units() { return types_section_units(); }
+
+ /// Get all normal compile/type units in this context.
+ unit_iterator_range normal_units() {
+ parseNormalUnits();
+ return unit_iterator_range(NormalUnits.begin(), NormalUnits.end());
+ }
/// Get units from .debug_info..dwo in the DWO context.
- cu_iterator_range dwo_info_section_units() {
+ unit_iterator_range dwo_info_section_units() {
parseDWOUnits();
- return cu_iterator_range(DWOUnits.begin(),
- DWOUnits.begin() + DWOUnits.getNumInfoUnits());
+ return unit_iterator_range(DWOUnits.begin(),
+ DWOUnits.begin() + DWOUnits.getNumInfoUnits());
}
/// Get units from .debug_types.dwo in the DWO context.
- tu_iterator_range dwo_types_section_units() {
+ unit_iterator_range dwo_types_section_units() {
parseDWOUnits();
- return tu_iterator_range(DWOUnits.begin() + DWOUnits.getNumInfoUnits(),
- DWOUnits.end());
+ return unit_iterator_range(DWOUnits.begin() + DWOUnits.getNumInfoUnits(),
+ DWOUnits.end());
}
/// Get compile units in the DWO context.
- cu_iterator_range dwo_compile_units() { return dwo_info_section_units(); }
+ unit_iterator_range dwo_compile_units() { return dwo_info_section_units(); }
/// Get type units in the DWO context.
- tu_iterator_range dwo_type_units() { return dwo_types_section_units(); }
+ unit_iterator_range dwo_type_units() { return dwo_types_section_units(); }
+
+ /// Get all units in the DWO context.
+ unit_iterator_range dwo_units() {
+ parseDWOUnits();
+ return unit_iterator_range(DWOUnits.begin(), DWOUnits.end());
+ }
/// Get the number of compile units in this context.
unsigned getNumCompileUnits() {
Modified: llvm/trunk/lib/DebugInfo/DWARF/DWARFContext.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARF/DWARFContext.cpp?rev=338759&r1=338758&r2=338759&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/DWARF/DWARFContext.cpp (original)
+++ llvm/trunk/lib/DebugInfo/DWARF/DWARFContext.cpp Thu Aug 2 12:29:38 2018
@@ -99,13 +99,10 @@ using ContributionCollection =
// Collect all the contributions to the string offsets table from all units,
// sort them by their starting offsets and remove duplicates.
static ContributionCollection
-collectContributionData(DWARFContext::cu_iterator_range CUs,
- DWARFContext::tu_iterator_range TUs) {
+collectContributionData(DWARFContext::unit_iterator_range Units) {
ContributionCollection Contributions;
- for (const auto &CU : CUs)
- Contributions.push_back(CU->getStringOffsetsTableContribution());
- for (const auto &TU : TUs)
- Contributions.push_back(TU->getStringOffsetsTableContribution());
+ for (const auto &U : Units)
+ Contributions.push_back(U->getStringOffsetsTableContribution());
// Sort the contributions so that any invalid ones are placed at
// the start of the contributions vector. This way they are reported
// first.
@@ -134,9 +131,8 @@ collectContributionData(DWARFContext::cu
static void dumpDWARFv5StringOffsetsSection(
raw_ostream &OS, StringRef SectionName, const DWARFObject &Obj,
const DWARFSection &StringOffsetsSection, StringRef StringSection,
- DWARFContext::cu_iterator_range CUs, DWARFContext::tu_iterator_range TUs,
- bool LittleEndian) {
- auto Contributions = collectContributionData(CUs, TUs);
+ DWARFContext::unit_iterator_range Units, bool LittleEndian) {
+ auto Contributions = collectContributionData(Units);
DWARFDataExtractor StrOffsetExt(Obj, StringOffsetsSection, LittleEndian, 0);
DataExtractor StrData(StringSection, LittleEndian, 0);
uint64_t SectionSize = StringOffsetsSection.Data.size();
@@ -217,15 +213,14 @@ static void dumpStringOffsetsSection(raw
const DWARFObject &Obj,
const DWARFSection &StringOffsetsSection,
StringRef StringSection,
- DWARFContext::cu_iterator_range CUs,
- DWARFContext::tu_iterator_range TUs,
+ DWARFContext::unit_iterator_range Units,
bool LittleEndian, unsigned MaxVersion) {
// If we have at least one (compile or type) unit with DWARF v5 or greater,
// we assume that the section is formatted like a DWARF v5 string offsets
// section.
if (MaxVersion >= 5)
dumpDWARFv5StringOffsetsSection(OS, SectionName, Obj, StringOffsetsSection,
- StringSection, CUs, TUs, LittleEndian);
+ StringSection, Units, LittleEndian);
else {
DataExtractor strOffsetExt(StringOffsetsSection.Data, LittleEndian, 0);
uint32_t offset = 0;
@@ -340,14 +335,14 @@ void DWARFContext::dump(
getDebugAbbrevDWO()->dump(OS);
auto dumpDebugInfo = [&](bool IsExplicit, const char *Name,
- DWARFSection Section, cu_iterator_range CUs) {
+ DWARFSection Section, unit_iterator_range Units) {
if (shouldDump(IsExplicit, Name, DIDT_ID_DebugInfo, Section.Data)) {
if (DumpOffset)
getDIEForOffset(DumpOffset.getValue())
.dump(OS, 0, DumpOpts.noImplicitRecursion());
else
- for (const auto &CU : CUs)
- CU->dump(OS, DumpOpts);
+ for (const auto &U : Units)
+ U->dump(OS, DumpOpts);
}
};
dumpDebugInfo(Explicit, ".debug_info", DObj->getInfoSection(),
@@ -355,15 +350,15 @@ void DWARFContext::dump(
dumpDebugInfo(ExplicitDWO, ".debug_info.dwo", DObj->getInfoDWOSection(),
dwo_info_section_units());
- auto dumpDebugType = [&](const char *Name, tu_iterator_range TUs) {
+ auto dumpDebugType = [&](const char *Name, unit_iterator_range Units) {
OS << '\n' << Name << " contents:\n";
DumpOffset = DumpOffsets[DIDT_ID_DebugTypes];
- for (const auto &TU : TUs)
+ for (const auto &U : Units)
if (DumpOffset)
- TU->getDIEForOffset(*DumpOffset)
+ U->getDIEForOffset(*DumpOffset)
.dump(OS, 0, DumpOpts.noImplicitRecursion());
else
- TU->dump(OS, DumpOpts);
+ U->dump(OS, DumpOpts);
};
if ((DumpType & DIDT_DebugTypes)) {
if (Explicit || getNumTypeUnits())
@@ -546,14 +541,14 @@ void DWARFContext::dump(
DObj->getStringOffsetSection().Data))
dumpStringOffsetsSection(OS, "debug_str_offsets", *DObj,
DObj->getStringOffsetSection(),
- DObj->getStringSection(), compile_units(),
- type_units(), isLittleEndian(), getMaxVersion());
+ DObj->getStringSection(), normal_units(),
+ isLittleEndian(), getMaxVersion());
if (shouldDump(ExplicitDWO, ".debug_str_offsets.dwo", DIDT_ID_DebugStrOffsets,
DObj->getStringOffsetDWOSection().Data))
- dumpStringOffsetsSection(
- OS, "debug_str_offsets.dwo", *DObj, DObj->getStringOffsetDWOSection(),
- DObj->getStringDWOSection(), dwo_compile_units(), dwo_type_units(),
- isLittleEndian(), getMaxVersion());
+ dumpStringOffsetsSection(OS, "debug_str_offsets.dwo", *DObj,
+ DObj->getStringOffsetDWOSection(),
+ DObj->getStringDWOSection(), dwo_units(),
+ isLittleEndian(), getMaxVersion());
if (shouldDump(Explicit, ".gnu_index", DIDT_ID_GdbIndex,
DObj->getGdbIndexSection())) {
Modified: llvm/trunk/tools/llvm-dwarfdump/llvm-dwarfdump.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-dwarfdump/llvm-dwarfdump.cpp?rev=338759&r1=338758&r2=338759&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-dwarfdump/llvm-dwarfdump.cpp (original)
+++ llvm/trunk/tools/llvm-dwarfdump/llvm-dwarfdump.cpp Thu Aug 2 12:29:38 2018
@@ -282,7 +282,8 @@ using HandlerFn = std::function<bool(Obj
/// Print only DIEs that have a certain name.
static void filterByName(const StringSet<> &Names,
- DWARFContext::cu_iterator_range CUs, raw_ostream &OS) {
+ DWARFContext::unit_iterator_range CUs,
+ raw_ostream &OS) {
for (const auto &CU : CUs)
for (const auto &Entry : CU->dies()) {
DWARFDie Die = {CU.get(), &Entry};
@@ -306,7 +307,6 @@ static void filterByName(const StringSet
Die.dump(OS, 0, getDumpOpts());
}
}
-
}
static void getDies(DWARFContext &DICtx, const AppleAcceleratorTable &Accel,
More information about the llvm-commits
mailing list