From 468784fe49f3c10a245a0f71866ab289e172949a Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Mon, 17 Sep 2018 14:23:47 +0000 Subject: [PATCH] [DebugInfo] Remove redundant argument. [NFC] Removes the redundant UnitType parameter from verifyUnitContents. I also fixed some formatting issues as I was touching the file. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@342396 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/DebugInfo/DWARF/DWARFVerifier.h | 4 +--- lib/DebugInfo/DWARF/DWARFVerifier.cpp | 35 ++++++++++++++-------------- 2 files changed, 18 insertions(+), 21 deletions(-) diff --git a/include/llvm/DebugInfo/DWARF/DWARFVerifier.h b/include/llvm/DebugInfo/DWARF/DWARFVerifier.h index 54636773a48..2920b16ea39 100644 --- a/include/llvm/DebugInfo/DWARF/DWARFVerifier.h +++ b/include/llvm/DebugInfo/DWARF/DWARFVerifier.h @@ -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. diff --git a/lib/DebugInfo/DWARF/DWARFVerifier.cpp b/lib/DebugInfo/DWARF/DWARFVerifier.cpp index 1f0ac6f344b..0080e7a56f4 100644 --- a/lib/DebugInfo/DWARF/DWARFVerifier.cpp +++ b/lib/DebugInfo/DWARF/DWARFVerifier.cpp @@ -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); -- 2.11.0