diff options
Diffstat (limited to 'llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp')
| -rw-r--r-- | llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp | 35 | 
1 files changed, 17 insertions, 18 deletions
| diff --git a/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp b/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp index 1f0ac6f344b..0080e7a56f4 100644 --- a/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp +++ b/llvm/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); | 

