Skip to content

Commit cc9b4fb

Browse files
committed
[Debuginfo][NFC] Rename error handling functions using the same pattern.
Summary: That patch is extracted from https://reviews.llvm.org/D74308. Currently there are two patterns to name error handling functions: using "Callback" and "Handler". This patch uses "Handler" for all usage places. Reviewers: jhenderson, dblaikie, probinson, aprantl Reviewed By: jhenderson, dblaikie Subscribers: hiraditya, llvm-commits Tags: #llvm, #debug-info Differential Revision: https://reviews.llvm.org/D74354
1 parent b664321 commit cc9b4fb

File tree

4 files changed

+41
-43
lines changed

4 files changed

+41
-43
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -295,10 +295,10 @@ class DWARFContext : public DIContext {
295295
const DWARFDebugLine::LineTable *getLineTableForUnit(DWARFUnit *U);
296296

297297
/// Get a pointer to a parsed line table corresponding to a compile unit.
298-
/// Report any recoverable parsing problems using the callback.
298+
/// Report any recoverable parsing problems using the handler.
299299
Expected<const DWARFDebugLine::LineTable *>
300300
getLineTableForUnit(DWARFUnit *U,
301-
function_ref<void(Error)> RecoverableErrorCallback);
301+
function_ref<void(Error)> RecoverableErrorHandler);
302302

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

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

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ class DWARFDebugLine {
130130
void clear();
131131
void dump(raw_ostream &OS, DIDumpOptions DumpOptions) const;
132132
Error parse(const DWARFDataExtractor &DebugLineData, uint64_t *OffsetPtr,
133-
function_ref<void(Error)> RecoverableErrorCallback,
133+
function_ref<void(Error)> RecoverableErrorHandler,
134134
const DWARFContext &Ctx, const DWARFUnit *U = nullptr);
135135
};
136136

@@ -275,7 +275,7 @@ class DWARFDebugLine {
275275
/// Parse prologue and all rows.
276276
Error parse(DWARFDataExtractor &DebugLineData, uint64_t *OffsetPtr,
277277
const DWARFContext &Ctx, const DWARFUnit *U,
278-
function_ref<void(Error)> RecoverableErrorCallback,
278+
function_ref<void(Error)> RecoverableErrorHandler,
279279
raw_ostream *OS = nullptr);
280280

281281
using RowVector = std::vector<Row>;
@@ -304,7 +304,7 @@ class DWARFDebugLine {
304304
Expected<const LineTable *>
305305
getOrParseLineTable(DWARFDataExtractor &DebugLineData, uint64_t Offset,
306306
const DWARFContext &Ctx, const DWARFUnit *U,
307-
function_ref<void(Error)> RecoverableErrorCallback);
307+
function_ref<void(Error)> RecoverableErrorHandler);
308308

309309
/// Helper to allow for parsing of an entire .debug_line section in sequence.
310310
class SectionParser {
@@ -317,29 +317,27 @@ class DWARFDebugLine {
317317
tu_range TUs);
318318

319319
/// Get the next line table from the section. Report any issues via the
320-
/// callbacks.
320+
/// handlers.
321321
///
322-
/// \param RecoverableErrorCallback - any issues that don't prevent further
323-
/// parsing of the table will be reported through this callback.
324-
/// \param UnrecoverableErrorCallback - any issues that prevent further
325-
/// parsing of the table will be reported through this callback.
322+
/// \param RecoverableErrorHandler - any issues that don't prevent further
323+
/// parsing of the table will be reported through this handler.
324+
/// \param UnrecoverableErrorHandler - any issues that prevent further
325+
/// parsing of the table will be reported through this handler.
326326
/// \param OS - if not null, the parser will print information about the
327327
/// table as it parses it.
328-
LineTable
329-
parseNext(
330-
function_ref<void(Error)> RecoverableErrorCallback,
331-
function_ref<void(Error)> UnrecoverableErrorCallback,
332-
raw_ostream *OS = nullptr);
328+
LineTable parseNext(function_ref<void(Error)> RecoverableErrorHandler,
329+
function_ref<void(Error)> UnrecoverableErrorHandler,
330+
raw_ostream *OS = nullptr);
333331

334332
/// Skip the current line table and go to the following line table (if
335333
/// present) immediately.
336334
///
337-
/// \param RecoverableErrorCallback - report any recoverable prologue
338-
/// parsing issues via this callback.
339-
/// \param UnrecoverableErrorCallback - report any unrecoverable prologue
340-
/// parsing issues via this callback.
341-
void skip(function_ref<void(Error)> RecoverableErrorCallback,
342-
function_ref<void(Error)> UnrecoverableErrorCallback);
335+
/// \param RecoverableErrorHandler - report any recoverable prologue
336+
/// parsing issues via this handler.
337+
/// \param UnrecoverableErrorHandler - report any unrecoverable prologue
338+
/// parsing issues via this handler.
339+
void skip(function_ref<void(Error)> RecoverableErrorHandler,
340+
function_ref<void(Error)> UnrecoverableErrorHandler);
343341

344342
/// Indicates if the parser has parsed as much as possible.
345343
///

llvm/lib/DebugInfo/DWARF/DWARFContext.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -879,7 +879,7 @@ DWARFContext::getLineTableForUnit(DWARFUnit *U) {
879879
}
880880

881881
Expected<const DWARFDebugLine::LineTable *> DWARFContext::getLineTableForUnit(
882-
DWARFUnit *U, function_ref<void(Error)> RecoverableErrorCallback) {
882+
DWARFUnit *U, function_ref<void(Error)> RecoverableErrorHandler) {
883883
if (!Line)
884884
Line.reset(new DWARFDebugLine);
885885

@@ -904,7 +904,7 @@ Expected<const DWARFDebugLine::LineTable *> DWARFContext::getLineTableForUnit(
904904
DWARFDataExtractor lineData(*DObj, U->getLineSection(), isLittleEndian(),
905905
U->getAddressByteSize());
906906
return Line->getOrParseLineTable(lineData, stmtOffset, *this, U,
907-
RecoverableErrorCallback);
907+
RecoverableErrorHandler);
908908
}
909909

910910
void DWARFContext::parseNormalUnits() {

llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ uint64_t DWARFDebugLine::Prologue::getLength() const {
309309

310310
Error DWARFDebugLine::Prologue::parse(
311311
const DWARFDataExtractor &DebugLineData, uint64_t *OffsetPtr,
312-
function_ref<void(Error)> RecoverableErrorCallback, const DWARFContext &Ctx,
312+
function_ref<void(Error)> RecoverableErrorHandler, const DWARFContext &Ctx,
313313
const DWARFUnit *U) {
314314
const uint64_t PrologueOffset = *OffsetPtr;
315315

@@ -365,7 +365,7 @@ Error DWARFDebugLine::Prologue::parse(
365365
if (Error E =
366366
parseV5DirFileTables(DebugLineData, OffsetPtr, FormParams, Ctx, U,
367367
ContentTypes, IncludeDirectories, FileNames)) {
368-
RecoverableErrorCallback(joinErrors(
368+
RecoverableErrorHandler(joinErrors(
369369
createStringError(
370370
errc::invalid_argument,
371371
"parsing line table prologue at 0x%8.8" PRIx64
@@ -384,7 +384,7 @@ Error DWARFDebugLine::Prologue::parse(
384384
ContentTypes, IncludeDirectories, FileNames);
385385

386386
if (*OffsetPtr != EndPrologueOffset) {
387-
RecoverableErrorCallback(createStringError(
387+
RecoverableErrorHandler(createStringError(
388388
errc::invalid_argument,
389389
"parsing line table prologue at 0x%8.8" PRIx64
390390
" should have ended at 0x%8.8" PRIx64 " but it ended at 0x%8.8" PRIx64,
@@ -510,7 +510,7 @@ DWARFDebugLine::getLineTable(uint64_t Offset) const {
510510

511511
Expected<const DWARFDebugLine::LineTable *> DWARFDebugLine::getOrParseLineTable(
512512
DWARFDataExtractor &DebugLineData, uint64_t Offset, const DWARFContext &Ctx,
513-
const DWARFUnit *U, function_ref<void(Error)> RecoverableErrorCallback) {
513+
const DWARFUnit *U, function_ref<void(Error)> RecoverableErrorHandler) {
514514
if (!DebugLineData.isValidOffset(Offset))
515515
return createStringError(errc::invalid_argument, "offset 0x%8.8" PRIx64
516516
" is not a valid debug line section offset",
@@ -521,7 +521,7 @@ Expected<const DWARFDebugLine::LineTable *> DWARFDebugLine::getOrParseLineTable(
521521
LineTable *LT = &Pos.first->second;
522522
if (Pos.second) {
523523
if (Error Err =
524-
LT->parse(DebugLineData, &Offset, Ctx, U, RecoverableErrorCallback))
524+
LT->parse(DebugLineData, &Offset, Ctx, U, RecoverableErrorHandler))
525525
return std::move(Err);
526526
return LT;
527527
}
@@ -531,13 +531,13 @@ Expected<const DWARFDebugLine::LineTable *> DWARFDebugLine::getOrParseLineTable(
531531
Error DWARFDebugLine::LineTable::parse(
532532
DWARFDataExtractor &DebugLineData, uint64_t *OffsetPtr,
533533
const DWARFContext &Ctx, const DWARFUnit *U,
534-
function_ref<void(Error)> RecoverableErrorCallback, raw_ostream *OS) {
534+
function_ref<void(Error)> RecoverableErrorHandler, raw_ostream *OS) {
535535
const uint64_t DebugLineOffset = *OffsetPtr;
536536

537537
clear();
538538

539-
Error PrologueErr = Prologue.parse(DebugLineData, OffsetPtr,
540-
RecoverableErrorCallback, Ctx, U);
539+
Error PrologueErr =
540+
Prologue.parse(DebugLineData, OffsetPtr, RecoverableErrorHandler, Ctx, U);
541541

542542
if (OS) {
543543
// The presence of OS signals verbose dumping.
@@ -555,7 +555,7 @@ Error DWARFDebugLine::LineTable::parse(
555555
assert(DebugLineData.size() > DebugLineOffset &&
556556
"prologue parsing should handle invalid offset");
557557
uint64_t BytesRemaining = DebugLineData.size() - DebugLineOffset;
558-
RecoverableErrorCallback(
558+
RecoverableErrorHandler(
559559
createStringError(errc::invalid_argument,
560560
"line table program with offset 0x%8.8" PRIx64
561561
" has length 0x%8.8" PRIx64 " but only 0x%8.8" PRIx64
@@ -633,7 +633,7 @@ Error DWARFDebugLine::LineTable::parse(
633633
{
634634
uint8_t ExtractorAddressSize = DebugLineData.getAddressSize();
635635
if (ExtractorAddressSize != Len - 1 && ExtractorAddressSize != 0)
636-
RecoverableErrorCallback(createStringError(
636+
RecoverableErrorHandler(createStringError(
637637
errc::invalid_argument,
638638
"mismatching address size at offset 0x%8.8" PRIx64
639639
" expected 0x%2.2" PRIx8 " found 0x%2.2" PRIx64,
@@ -711,7 +711,7 @@ Error DWARFDebugLine::LineTable::parse(
711711
// by the table.
712712
uint64_t End = ExtOffset + Len;
713713
if (*OffsetPtr != End) {
714-
RecoverableErrorCallback(createStringError(
714+
RecoverableErrorHandler(createStringError(
715715
errc::illegal_byte_sequence,
716716
"unexpected line op length at offset 0x%8.8" PRIx64
717717
" expected 0x%2.2" PRIx64 " found 0x%2.2" PRIx64,
@@ -918,7 +918,7 @@ Error DWARFDebugLine::LineTable::parse(
918918
}
919919

920920
if (!State.Sequence.Empty)
921-
RecoverableErrorCallback(createStringError(
921+
RecoverableErrorHandler(createStringError(
922922
errc::illegal_byte_sequence,
923923
"last sequence in debug line table at offset 0x%8.8" PRIx64
924924
" is not terminated",
@@ -1163,31 +1163,31 @@ bool DWARFDebugLine::Prologue::totalLengthIsValid() const {
11631163
}
11641164

11651165
DWARFDebugLine::LineTable DWARFDebugLine::SectionParser::parseNext(
1166-
function_ref<void(Error)> RecoverableErrorCallback,
1167-
function_ref<void(Error)> UnrecoverableErrorCallback, raw_ostream *OS) {
1166+
function_ref<void(Error)> RecoverableErrorHandler,
1167+
function_ref<void(Error)> UnrecoverableErrorHandler, raw_ostream *OS) {
11681168
assert(DebugLineData.isValidOffset(Offset) &&
11691169
"parsing should have terminated");
11701170
DWARFUnit *U = prepareToParse(Offset);
11711171
uint64_t OldOffset = Offset;
11721172
LineTable LT;
11731173
if (Error Err = LT.parse(DebugLineData, &Offset, Context, U,
1174-
RecoverableErrorCallback, OS))
1175-
UnrecoverableErrorCallback(std::move(Err));
1174+
RecoverableErrorHandler, OS))
1175+
UnrecoverableErrorHandler(std::move(Err));
11761176
moveToNextTable(OldOffset, LT.Prologue);
11771177
return LT;
11781178
}
11791179

11801180
void DWARFDebugLine::SectionParser::skip(
1181-
function_ref<void(Error)> RecoverableErrorCallback,
1182-
function_ref<void(Error)> UnrecoverableErrorCallback) {
1181+
function_ref<void(Error)> RecoverableErrorHandler,
1182+
function_ref<void(Error)> UnrecoverableErrorHandler) {
11831183
assert(DebugLineData.isValidOffset(Offset) &&
11841184
"parsing should have terminated");
11851185
DWARFUnit *U = prepareToParse(Offset);
11861186
uint64_t OldOffset = Offset;
11871187
LineTable LT;
11881188
if (Error Err = LT.Prologue.parse(DebugLineData, &Offset,
1189-
RecoverableErrorCallback, Context, U))
1190-
UnrecoverableErrorCallback(std::move(Err));
1189+
RecoverableErrorHandler, Context, U))
1190+
UnrecoverableErrorHandler(std::move(Err));
11911191
moveToNextTable(OldOffset, LT.Prologue);
11921192
}
11931193

0 commit comments

Comments
 (0)