diff --git a/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp b/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp --- a/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp +++ b/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp @@ -38,10 +38,9 @@ DWARFSectionKind SectionKind) { const DWARFObject &D = C.getDWARFObj(); addUnitsImpl(C, D, Section, C.getDebugAbbrev(), &D.getRangesSection(), - &D.getLocSection(), D.getStrSection(), - D.getStrOffsetsSection(), &D.getAddrSection(), - D.getLineSection(), D.isLittleEndian(), false, false, - SectionKind); + &D.getLocSection(), D.getStrSection(), D.getStrOffsetsSection(), + &D.getAddrSection(), D.getLineSection(), D.isLittleEndian(), + false, false, SectionKind); } void DWARFUnitVector::addUnitsForDWOSection(DWARFContext &C, @@ -49,11 +48,11 @@ DWARFSectionKind SectionKind, bool Lazy) { const DWARFObject &D = C.getDWARFObj(); - addUnitsImpl(C, D, DWOSection, C.getDebugAbbrevDWO(), &D.getRangesDWOSection(), - &D.getLocDWOSection(), D.getStrDWOSection(), - D.getStrOffsetsDWOSection(), &D.getAddrSection(), - D.getLineDWOSection(), C.isLittleEndian(), true, Lazy, - SectionKind); + addUnitsImpl(C, D, DWOSection, C.getDebugAbbrevDWO(), + &D.getRangesDWOSection(), &D.getLocDWOSection(), + D.getStrDWOSection(), D.getStrOffsetsDWOSection(), + &D.getAddrSection(), D.getLineDWOSection(), C.isLittleEndian(), + true, Lazy, SectionKind); } void DWARFUnitVector::addUnitsImpl( @@ -87,12 +86,12 @@ std::unique_ptr U; if (Header.isTypeUnit()) U = std::make_unique(Context, InfoSection, Header, DA, - RS, LocSection, SS, SOS, AOS, LS, - LE, IsDWO, *this); + RS, LocSection, SS, SOS, AOS, LS, + LE, IsDWO, *this); else - U = std::make_unique(Context, InfoSection, Header, - DA, RS, LocSection, SS, SOS, - AOS, LS, LE, IsDWO, *this); + U = std::make_unique(Context, InfoSection, Header, DA, + RS, LocSection, SS, SOS, AOS, LS, + LE, IsDWO, *this); return U; }; } @@ -305,17 +304,18 @@ // Parse the rangelist table header, including the optional array of offsets // following it (DWARF v5 and later). -template -static Expected -parseListTableHeader(DWARFDataExtractor &DA, uint64_t Offset, - DwarfFormat Format) { +template +static Expected parseListTableHeader(DWARFDataExtractor &DA, + uint64_t Offset, + DwarfFormat Format) { // We are expected to be called with Offset 0 or pointing just past the table // header. Correct Offset in the latter case so that it points to the start // of the header. if (Offset > 0) { uint64_t HeaderSize = DWARFListTableHeader::getHeaderSize(Format); if (Offset < HeaderSize) - return createStringError(errc::invalid_argument, "did not detect a valid" + return createStringError(errc::invalid_argument, + "did not detect a valid" " list table with base = 0x%" PRIx64 "\n", Offset); Offset -= HeaderSize; @@ -365,8 +365,8 @@ uint32_t Depth = 0; bool IsCUDie = true; - while (DIE.extractFast(*this, &DIEOffset, DebugInfoData, NextCUOffset, - Depth)) { + while ( + DIE.extractFast(*this, &DIEOffset, DebugInfoData, NextCUOffset, Depth)) { if (IsCUDie) { if (AppendCUDie) Dies.push_back(DIE); @@ -391,7 +391,7 @@ if (Depth > 0) --Depth; if (Depth == 0) - break; // We are done with this compile unit! + break; // We are done with this compile unit! } } @@ -727,9 +727,8 @@ return R->second.second; } -void -DWARFUnit::getInlinedChainForAddress(uint64_t Address, - SmallVectorImpl &InlinedChain) { +void DWARFUnit::getInlinedChainForAddress( + uint64_t Address, SmallVectorImpl &InlinedChain) { assert(InlinedChain.empty()); // Try to look for subprogram DIEs in the DWO file. parseDWO(); @@ -745,7 +744,7 @@ } if (SubroutineDIE.getTag() == DW_TAG_inlined_subroutine) InlinedChain.push_back(SubroutineDIE); - SubroutineDIE = SubroutineDIE.getParent(); + SubroutineDIE = SubroutineDIE.getParent(); } } @@ -869,7 +868,8 @@ if (ValidationSize >= Size) if (DA.isValidOffsetForDataOfSize((uint32_t)Base, ValidationSize)) return *this; - return createStringError(errc::invalid_argument, "length exceeds section size"); + return createStringError(errc::invalid_argument, + "length exceeds section size"); } // Look for a DWARF64-formatted contribution to the string offsets table @@ -877,10 +877,13 @@ static Expected parseDWARF64StringOffsetsTableHeader(DWARFDataExtractor &DA, uint64_t Offset) { if (!DA.isValidOffsetForDataOfSize(Offset, 16)) - return createStringError(errc::invalid_argument, "section offset exceeds section size"); + return createStringError(errc::invalid_argument, + "section offset exceeds section size"); if (DA.getU32(&Offset) != dwarf::DW_LENGTH_DWARF64) - return createStringError(errc::invalid_argument, "32 bit contribution referenced from a 64 bit unit"); + return createStringError( + errc::invalid_argument, + "32 bit contribution referenced from a 64 bit unit"); uint64_t Size = DA.getU64(&Offset); uint8_t Version = DA.getU16(&Offset); @@ -895,7 +898,8 @@ static Expected parseDWARF32StringOffsetsTableHeader(DWARFDataExtractor &DA, uint64_t Offset) { if (!DA.isValidOffsetForDataOfSize(Offset, 8)) - return createStringError(errc::invalid_argument, "section offset exceeds section size"); + return createStringError(errc::invalid_argument, + "section offset exceeds section size"); uint32_t ContributionSize = DA.getU32(&Offset); if (ContributionSize >= dwarf::DW_LENGTH_lo_reserved) @@ -917,7 +921,8 @@ switch (Format) { case dwarf::DwarfFormat::DWARF64: { if (Offset < 16) - return createStringError(errc::invalid_argument, "insufficient space for 64 bit header prefix"); + return createStringError(errc::invalid_argument, + "insufficient space for 64 bit header prefix"); auto DescOrError = parseDWARF64StringOffsetsTableHeader(DA, Offset - 16); if (!DescOrError) return DescOrError.takeError(); @@ -926,7 +931,8 @@ } case dwarf::DwarfFormat::DWARF32: { if (Offset < 8) - return createStringError(errc::invalid_argument, "insufficient space for 32 bit header prefix"); + return createStringError(errc::invalid_argument, + "insufficient space for 32 bit header prefix"); auto DescOrError = parseDWARF32StringOffsetsTableHeader(DA, Offset - 8); if (!DescOrError) return DescOrError.takeError(); @@ -951,7 +957,7 @@ } Expected> -DWARFUnit::determineStringOffsetsTableContributionDWO(DWARFDataExtractor & DA) { +DWARFUnit::determineStringOffsetsTableContributionDWO(DWARFDataExtractor &DA) { assert(IsDWO); uint64_t Offset = 0; auto IndexEntry = Header.getIndexEntry(); @@ -964,7 +970,8 @@ return None; Offset += Header.getFormat() == dwarf::DwarfFormat::DWARF32 ? 8 : 16; // Look for a valid contribution at the given offset. - auto DescOrError = parseDWARFStringOffsetsTableHeader(DA, Header.getFormat(), Offset); + auto DescOrError = + parseDWARFStringOffsetsTableHeader(DA, Header.getFormat(), Offset); if (!DescOrError) return DescOrError.takeError(); return *DescOrError;