[DebugInfo] Remove redundant argument. [NFC]

Removes the redundant UnitType parameter from verifyUnitContents. I also
fixed  some formatting issues as I was touching the file.

llvm-svn: 342396
This commit is contained in:
Jonas Devlieghere 2018-09-17 14:23:47 +00:00
parent 481cdab919
commit 9d7cecfcbf
2 changed files with 18 additions and 21 deletions

View File

@ -149,11 +149,9 @@ private:
/// - The DIE ranges.
///
/// \param Unit The DWARF Unit to verify.
/// \param UnitType An optional unit type which will be used to verify the
/// type of the unit DIE.
///
/// \returns The number of errors that occurred during verification.
unsigned verifyUnitContents(DWARFUnit &Unit, uint8_t UnitType = 0);
unsigned verifyUnitContents(DWARFUnit &Unit);
/// Verifies the unit headers and contents in a .debug_info or .debug_types
/// section.

View File

@ -93,7 +93,7 @@ bool DWARFVerifier::DieRangeInfo::intersects(const DieRangeInfo &RHS) const {
auto End = Ranges.end();
auto Iter = findRange(RHS.Ranges.front());
for (const auto &R : RHS.Ranges) {
if(Iter == End)
if (Iter == End)
return false;
if (R.HighPC <= Iter->LowPC)
continue;
@ -156,14 +156,14 @@ bool DWARFVerifier::verifyUnitHeader(const DWARFDataExtractor DebugInfoData,
OffsetStart);
if (!ValidLength)
note() << "The length for this unit is too "
"large for the .debug_info provided.\n";
"large for the .debug_info provided.\n";
if (!ValidVersion)
note() << "The 16 bit unit header version is not valid.\n";
if (!ValidType)
note() << "The unit type encoding is not valid.\n";
if (!ValidAbbrevOffset)
note() << "The offset into the .debug_abbrev section is "
"not valid.\n";
"not valid.\n";
if (!ValidAddrSize)
note() << "The address size is unsupported.\n";
}
@ -171,7 +171,7 @@ bool DWARFVerifier::verifyUnitHeader(const DWARFDataExtractor DebugInfoData,
return Success;
}
unsigned DWARFVerifier::verifyUnitContents(DWARFUnit &Unit, uint8_t UnitType) {
unsigned DWARFVerifier::verifyUnitContents(DWARFUnit &Unit) {
unsigned NumUnitErrors = 0;
unsigned NumDies = Unit.getNumDIEs();
for (unsigned I = 0; I < NumDies; ++I) {
@ -197,8 +197,8 @@ unsigned DWARFVerifier::verifyUnitContents(DWARFUnit &Unit, uint8_t UnitType) {
NumUnitErrors++;
}
if (UnitType != 0 &&
!DWARFUnit::isMatchingUnitTypeAndTag(UnitType, Die.getTag())) {
uint8_t UnitType = Unit.getUnitType();
if (!DWARFUnit::isMatchingUnitTypeAndTag(UnitType, Die.getTag())) {
error() << "Compilation unit type (" << dwarf::UnitTypeString(UnitType)
<< ") and root DIE (" << dwarf::TagString(Die.getTag())
<< ") do not match.\n";
@ -288,8 +288,7 @@ unsigned DWARFVerifier::verifyUnitSection(const DWARFSection &S,
case dwarf::DW_UT_split_compile:
case dwarf::DW_UT_compile:
case dwarf::DW_UT_partial:
// UnitType = 0 means that we are
// verifying a compile unit in DWARF v4.
// UnitType = 0 means that we are verifying a compile unit in DWARF v4.
case 0: {
Unit.reset(new DWARFCompileUnit(
DCtx, S, Header, DCtx.getDebugAbbrev(), &DObj.getRangeSection(),
@ -300,7 +299,7 @@ unsigned DWARFVerifier::verifyUnitSection(const DWARFSection &S,
}
default: { llvm_unreachable("Invalid UnitType."); }
}
NumDebugInfoErrors += verifyUnitContents(*Unit, UnitType);
NumDebugInfoErrors += verifyUnitContents(*Unit);
}
hasDIE = DebugInfoData.isValidOffset(Offset);
++UnitIdx;
@ -827,8 +826,8 @@ DWARFVerifier::verifyDebugNamesCULists(const DWARFDebugNames &AccelTable) {
if (Iter->second != NotIndexed) {
error() << formatv("Name Index @ {0:x} references a CU @ {1:x}, but "
"this CU is already indexed by Name Index @ {2:x}\n",
NI.getUnitOffset(), Offset, Iter->second);
"this CU is already indexed by Name Index @ {2:x}\n",
NI.getUnitOffset(), Offset, Iter->second);
continue;
}
Iter->second = NI.getUnitOffset();
@ -1348,17 +1347,17 @@ bool DWARFVerifier::handleAccelTables() {
DataExtractor StrData(D.getStringSection(), DCtx.isLittleEndian(), 0);
unsigned NumErrors = 0;
if (!D.getAppleNamesSection().Data.empty())
NumErrors +=
verifyAppleAccelTable(&D.getAppleNamesSection(), &StrData, ".apple_names");
NumErrors += verifyAppleAccelTable(&D.getAppleNamesSection(), &StrData,
".apple_names");
if (!D.getAppleTypesSection().Data.empty())
NumErrors +=
verifyAppleAccelTable(&D.getAppleTypesSection(), &StrData, ".apple_types");
NumErrors += verifyAppleAccelTable(&D.getAppleTypesSection(), &StrData,
".apple_types");
if (!D.getAppleNamespacesSection().Data.empty())
NumErrors += verifyAppleAccelTable(&D.getAppleNamespacesSection(), &StrData,
".apple_namespaces");
".apple_namespaces");
if (!D.getAppleObjCSection().Data.empty())
NumErrors +=
verifyAppleAccelTable(&D.getAppleObjCSection(), &StrData, ".apple_objc");
NumErrors += verifyAppleAccelTable(&D.getAppleObjCSection(), &StrData,
".apple_objc");
if (!D.getDebugNamesSection().Data.empty())
NumErrors += verifyDebugNames(D.getDebugNamesSection(), StrData);