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 @@ -298,7 +298,7 @@ /// Report any recoverable parsing problems using the callback. Expected getLineTableForUnit(DWARFUnit *U, - std::function RecoverableErrorCallback); + function_ref RecoverableErrorCallback); 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 @@ -280,11 +280,10 @@ void clear(); /// Parse prologue and all rows. - Error parse( - DWARFDataExtractor &DebugLineData, uint64_t *OffsetPtr, - const DWARFContext &Ctx, const DWARFUnit *U, - std::function RecoverableErrorCallback, - raw_ostream *OS = nullptr); + Error parse(DWARFDataExtractor &DebugLineData, uint64_t *OffsetPtr, + const DWARFContext &Ctx, const DWARFUnit *U, + function_ref RecoverableErrorCallback, + raw_ostream *OS = nullptr); using RowVector = std::vector; using RowIter = RowVector::const_iterator; @@ -309,10 +308,10 @@ }; const LineTable *getLineTable(uint64_t Offset) const; - Expected getOrParseLineTable( - DWARFDataExtractor &DebugLineData, uint64_t Offset, - const DWARFContext &Ctx, const DWARFUnit *U, - std::function RecoverableErrorCallback); + Expected + getOrParseLineTable(DWARFDataExtractor &DebugLineData, uint64_t Offset, + const DWARFContext &Ctx, const DWARFUnit *U, + function_ref RecoverableErrorCallback); /// Helper to allow for parsing of an entire .debug_line section in sequence. class SectionParser { 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 @@ -874,7 +874,7 @@ } Expected DWARFContext::getLineTableForUnit( - DWARFUnit *U, std::function RecoverableErrorCallback) { + DWARFUnit *U, function_ref RecoverableErrorCallback) { if (!Line) Line.reset(new DWARFDebugLine); 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 @@ -514,7 +514,7 @@ Expected DWARFDebugLine::getOrParseLineTable( DWARFDataExtractor &DebugLineData, uint64_t Offset, const DWARFContext &Ctx, - const DWARFUnit *U, std::function RecoverableErrorCallback) { + const DWARFUnit *U, function_ref RecoverableErrorCallback) { if (!DebugLineData.isValidOffset(Offset)) return createStringError(errc::invalid_argument, "offset 0x%8.8" PRIx64 " is not a valid debug line section offset", @@ -535,7 +535,7 @@ Error DWARFDebugLine::LineTable::parse( DWARFDataExtractor &DebugLineData, uint64_t *OffsetPtr, const DWARFContext &Ctx, const DWARFUnit *U, - std::function RecoverableErrorCallback, raw_ostream *OS) { + function_ref RecoverableErrorCallback, raw_ostream *OS) { const uint64_t DebugLineOffset = *OffsetPtr; clear();