diff --git a/llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h b/llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h --- a/llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h +++ b/llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h @@ -295,10 +295,10 @@ const DWARFDebugLine::LineTable *getLineTableForUnit(DWARFUnit *U); /// Get a pointer to a parsed line table corresponding to a compile unit. - /// Report any recoverable parsing problems using the callback. + /// Report any recoverable parsing problems using the handler. Expected getLineTableForUnit(DWARFUnit *U, - function_ref RecoverableErrorCallback); + function_ref RecoverableErrorHandler); DataExtractor getStringExtractor() const { return DataExtractor(DObj->getStrSection(), false, 0); diff --git a/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugLine.h b/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugLine.h --- a/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugLine.h +++ b/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugLine.h @@ -130,7 +130,7 @@ void clear(); void dump(raw_ostream &OS, DIDumpOptions DumpOptions) const; Error parse(const DWARFDataExtractor &DebugLineData, uint64_t *OffsetPtr, - function_ref RecoverableErrorCallback, + function_ref RecoverableErrorHandler, const DWARFContext &Ctx, const DWARFUnit *U = nullptr); }; @@ -275,7 +275,7 @@ /// Parse prologue and all rows. Error parse(DWARFDataExtractor &DebugLineData, uint64_t *OffsetPtr, const DWARFContext &Ctx, const DWARFUnit *U, - function_ref RecoverableErrorCallback, + function_ref RecoverableErrorHandler, raw_ostream *OS = nullptr); using RowVector = std::vector; @@ -304,7 +304,7 @@ Expected getOrParseLineTable(DWARFDataExtractor &DebugLineData, uint64_t Offset, const DWARFContext &Ctx, const DWARFUnit *U, - function_ref RecoverableErrorCallback); + function_ref RecoverableErrorHandler); /// Helper to allow for parsing of an entire .debug_line section in sequence. class SectionParser { @@ -317,29 +317,27 @@ tu_range TUs); /// Get the next line table from the section. Report any issues via the - /// callbacks. + /// handlers. /// - /// \param RecoverableErrorCallback - any issues that don't prevent further - /// parsing of the table will be reported through this callback. - /// \param UnrecoverableErrorCallback - any issues that prevent further - /// parsing of the table will be reported through this callback. + /// \param RecoverableErrorHandler - any issues that don't prevent further + /// parsing of the table will be reported through this handler. + /// \param UnrecoverableErrorHandler - any issues that prevent further + /// parsing of the table will be reported through this handler. /// \param OS - if not null, the parser will print information about the /// table as it parses it. - LineTable - parseNext( - function_ref RecoverableErrorCallback, - function_ref UnrecoverableErrorCallback, - raw_ostream *OS = nullptr); + LineTable parseNext(function_ref RecoverableErrorHandler, + function_ref UnrecoverableErrorHandler, + raw_ostream *OS = nullptr); /// Skip the current line table and go to the following line table (if /// present) immediately. /// - /// \param RecoverableErrorCallback - report any recoverable prologue - /// parsing issues via this callback. - /// \param UnrecoverableErrorCallback - report any unrecoverable prologue - /// parsing issues via this callback. - void skip(function_ref RecoverableErrorCallback, - function_ref UnrecoverableErrorCallback); + /// \param RecoverableErrorHandler - report any recoverable prologue + /// parsing issues via this handler. + /// \param UnrecoverableErrorHandler - report any unrecoverable prologue + /// parsing issues via this handler. + void skip(function_ref RecoverableErrorHandler, + function_ref UnrecoverableErrorHandler); /// Indicates if the parser has parsed as much as possible. /// diff --git a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp --- a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp +++ b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp @@ -879,7 +879,7 @@ } Expected DWARFContext::getLineTableForUnit( - DWARFUnit *U, function_ref RecoverableErrorCallback) { + DWARFUnit *U, function_ref RecoverableErrorHandler) { if (!Line) Line.reset(new DWARFDebugLine); @@ -904,7 +904,7 @@ DWARFDataExtractor lineData(*DObj, U->getLineSection(), isLittleEndian(), U->getAddressByteSize()); return Line->getOrParseLineTable(lineData, stmtOffset, *this, U, - RecoverableErrorCallback); + RecoverableErrorHandler); } void DWARFContext::parseNormalUnits() { diff --git a/llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp b/llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp --- a/llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp +++ b/llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp @@ -309,7 +309,7 @@ Error DWARFDebugLine::Prologue::parse( const DWARFDataExtractor &DebugLineData, uint64_t *OffsetPtr, - function_ref RecoverableErrorCallback, const DWARFContext &Ctx, + function_ref RecoverableErrorHandler, const DWARFContext &Ctx, const DWARFUnit *U) { const uint64_t PrologueOffset = *OffsetPtr; @@ -365,7 +365,7 @@ if (Error E = parseV5DirFileTables(DebugLineData, OffsetPtr, FormParams, Ctx, U, ContentTypes, IncludeDirectories, FileNames)) { - RecoverableErrorCallback(joinErrors( + RecoverableErrorHandler(joinErrors( createStringError( errc::invalid_argument, "parsing line table prologue at 0x%8.8" PRIx64 @@ -384,7 +384,7 @@ ContentTypes, IncludeDirectories, FileNames); if (*OffsetPtr != EndPrologueOffset) { - RecoverableErrorCallback(createStringError( + RecoverableErrorHandler(createStringError( errc::invalid_argument, "parsing line table prologue at 0x%8.8" PRIx64 " should have ended at 0x%8.8" PRIx64 " but it ended at 0x%8.8" PRIx64, @@ -510,7 +510,7 @@ Expected DWARFDebugLine::getOrParseLineTable( DWARFDataExtractor &DebugLineData, uint64_t Offset, const DWARFContext &Ctx, - const DWARFUnit *U, function_ref RecoverableErrorCallback) { + const DWARFUnit *U, function_ref RecoverableErrorHandler) { if (!DebugLineData.isValidOffset(Offset)) return createStringError(errc::invalid_argument, "offset 0x%8.8" PRIx64 " is not a valid debug line section offset", @@ -521,7 +521,7 @@ LineTable *LT = &Pos.first->second; if (Pos.second) { if (Error Err = - LT->parse(DebugLineData, &Offset, Ctx, U, RecoverableErrorCallback)) + LT->parse(DebugLineData, &Offset, Ctx, U, RecoverableErrorHandler)) return std::move(Err); return LT; } @@ -531,13 +531,13 @@ Error DWARFDebugLine::LineTable::parse( DWARFDataExtractor &DebugLineData, uint64_t *OffsetPtr, const DWARFContext &Ctx, const DWARFUnit *U, - function_ref RecoverableErrorCallback, raw_ostream *OS) { + function_ref RecoverableErrorHandler, raw_ostream *OS) { const uint64_t DebugLineOffset = *OffsetPtr; clear(); - Error PrologueErr = Prologue.parse(DebugLineData, OffsetPtr, - RecoverableErrorCallback, Ctx, U); + Error PrologueErr = + Prologue.parse(DebugLineData, OffsetPtr, RecoverableErrorHandler, Ctx, U); if (OS) { // The presence of OS signals verbose dumping. @@ -555,7 +555,7 @@ assert(DebugLineData.size() > DebugLineOffset && "prologue parsing should handle invalid offset"); uint64_t BytesRemaining = DebugLineData.size() - DebugLineOffset; - RecoverableErrorCallback( + RecoverableErrorHandler( createStringError(errc::invalid_argument, "line table program with offset 0x%8.8" PRIx64 " has length 0x%8.8" PRIx64 " but only 0x%8.8" PRIx64 @@ -633,7 +633,7 @@ { uint8_t ExtractorAddressSize = DebugLineData.getAddressSize(); if (ExtractorAddressSize != Len - 1 && ExtractorAddressSize != 0) - RecoverableErrorCallback(createStringError( + RecoverableErrorHandler(createStringError( errc::invalid_argument, "mismatching address size at offset 0x%8.8" PRIx64 " expected 0x%2.2" PRIx8 " found 0x%2.2" PRIx64, @@ -711,7 +711,7 @@ // by the table. uint64_t End = ExtOffset + Len; if (*OffsetPtr != End) { - RecoverableErrorCallback(createStringError( + RecoverableErrorHandler(createStringError( errc::illegal_byte_sequence, "unexpected line op length at offset 0x%8.8" PRIx64 " expected 0x%2.2" PRIx64 " found 0x%2.2" PRIx64, @@ -918,7 +918,7 @@ } if (!State.Sequence.Empty) - RecoverableErrorCallback(createStringError( + RecoverableErrorHandler(createStringError( errc::illegal_byte_sequence, "last sequence in debug line table at offset 0x%8.8" PRIx64 " is not terminated", @@ -1163,31 +1163,31 @@ } DWARFDebugLine::LineTable DWARFDebugLine::SectionParser::parseNext( - function_ref RecoverableErrorCallback, - function_ref UnrecoverableErrorCallback, raw_ostream *OS) { + function_ref RecoverableErrorHandler, + function_ref UnrecoverableErrorHandler, raw_ostream *OS) { assert(DebugLineData.isValidOffset(Offset) && "parsing should have terminated"); DWARFUnit *U = prepareToParse(Offset); uint64_t OldOffset = Offset; LineTable LT; if (Error Err = LT.parse(DebugLineData, &Offset, Context, U, - RecoverableErrorCallback, OS)) - UnrecoverableErrorCallback(std::move(Err)); + RecoverableErrorHandler, OS)) + UnrecoverableErrorHandler(std::move(Err)); moveToNextTable(OldOffset, LT.Prologue); return LT; } void DWARFDebugLine::SectionParser::skip( - function_ref RecoverableErrorCallback, - function_ref UnrecoverableErrorCallback) { + function_ref RecoverableErrorHandler, + function_ref UnrecoverableErrorHandler) { assert(DebugLineData.isValidOffset(Offset) && "parsing should have terminated"); DWARFUnit *U = prepareToParse(Offset); uint64_t OldOffset = Offset; LineTable LT; if (Error Err = LT.Prologue.parse(DebugLineData, &Offset, - RecoverableErrorCallback, Context, U)) - UnrecoverableErrorCallback(std::move(Err)); + RecoverableErrorHandler, Context, U)) + UnrecoverableErrorHandler(std::move(Err)); moveToNextTable(OldOffset, LT.Prologue); }