Skip to content

Commit bd402fc

Browse files
committed
[DebugInfo][NFC] Use function_ref consistently in debug line parsing
This patch fixes an inconsistency where we were using std::function in some places and function_ref in others to pass around the error handling callback. Reviewed by: MaskRay Differential Revision: https://reviews.llvm.org/D71762
1 parent 546c72a commit bd402fc

File tree

4 files changed

+12
-13
lines changed

4 files changed

+12
-13
lines changed

llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ class DWARFContext : public DIContext {
298298
/// Report any recoverable parsing problems using the callback.
299299
Expected<const DWARFDebugLine::LineTable *>
300300
getLineTableForUnit(DWARFUnit *U,
301-
std::function<void(Error)> RecoverableErrorCallback);
301+
function_ref<void(Error)> RecoverableErrorCallback);
302302

303303
DataExtractor getStringExtractor() const {
304304
return DataExtractor(DObj->getStrSection(), false, 0);

llvm/include/llvm/DebugInfo/DWARF/DWARFDebugLine.h

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -280,11 +280,10 @@ class DWARFDebugLine {
280280
void clear();
281281

282282
/// Parse prologue and all rows.
283-
Error parse(
284-
DWARFDataExtractor &DebugLineData, uint64_t *OffsetPtr,
285-
const DWARFContext &Ctx, const DWARFUnit *U,
286-
std::function<void(Error)> RecoverableErrorCallback,
287-
raw_ostream *OS = nullptr);
283+
Error parse(DWARFDataExtractor &DebugLineData, uint64_t *OffsetPtr,
284+
const DWARFContext &Ctx, const DWARFUnit *U,
285+
function_ref<void(Error)> RecoverableErrorCallback,
286+
raw_ostream *OS = nullptr);
288287

289288
using RowVector = std::vector<Row>;
290289
using RowIter = RowVector::const_iterator;
@@ -309,10 +308,10 @@ class DWARFDebugLine {
309308
};
310309

311310
const LineTable *getLineTable(uint64_t Offset) const;
312-
Expected<const LineTable *> getOrParseLineTable(
313-
DWARFDataExtractor &DebugLineData, uint64_t Offset,
314-
const DWARFContext &Ctx, const DWARFUnit *U,
315-
std::function<void(Error)> RecoverableErrorCallback);
311+
Expected<const LineTable *>
312+
getOrParseLineTable(DWARFDataExtractor &DebugLineData, uint64_t Offset,
313+
const DWARFContext &Ctx, const DWARFUnit *U,
314+
function_ref<void(Error)> RecoverableErrorCallback);
316315

317316
/// Helper to allow for parsing of an entire .debug_line section in sequence.
318317
class SectionParser {

llvm/lib/DebugInfo/DWARF/DWARFContext.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -874,7 +874,7 @@ DWARFContext::getLineTableForUnit(DWARFUnit *U) {
874874
}
875875

876876
Expected<const DWARFDebugLine::LineTable *> DWARFContext::getLineTableForUnit(
877-
DWARFUnit *U, std::function<void(Error)> RecoverableErrorCallback) {
877+
DWARFUnit *U, function_ref<void(Error)> RecoverableErrorCallback) {
878878
if (!Line)
879879
Line.reset(new DWARFDebugLine);
880880

llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@ DWARFDebugLine::getLineTable(uint64_t Offset) const {
514514

515515
Expected<const DWARFDebugLine::LineTable *> DWARFDebugLine::getOrParseLineTable(
516516
DWARFDataExtractor &DebugLineData, uint64_t Offset, const DWARFContext &Ctx,
517-
const DWARFUnit *U, std::function<void(Error)> RecoverableErrorCallback) {
517+
const DWARFUnit *U, function_ref<void(Error)> RecoverableErrorCallback) {
518518
if (!DebugLineData.isValidOffset(Offset))
519519
return createStringError(errc::invalid_argument, "offset 0x%8.8" PRIx64
520520
" is not a valid debug line section offset",
@@ -535,7 +535,7 @@ Expected<const DWARFDebugLine::LineTable *> DWARFDebugLine::getOrParseLineTable(
535535
Error DWARFDebugLine::LineTable::parse(
536536
DWARFDataExtractor &DebugLineData, uint64_t *OffsetPtr,
537537
const DWARFContext &Ctx, const DWARFUnit *U,
538-
std::function<void(Error)> RecoverableErrorCallback, raw_ostream *OS) {
538+
function_ref<void(Error)> RecoverableErrorCallback, raw_ostream *OS) {
539539
const uint64_t DebugLineOffset = *OffsetPtr;
540540

541541
clear();

0 commit comments

Comments
 (0)