[PATCH] D44560: [DWARF] Rework debug line parsing to use llvm::Error and callbacks

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 19 10:27:29 PDT 2018


jhenderson added inline comments.


================
Comment at: include/llvm/DebugInfo/DWARF/DWARFDebugLine.h:310
+      const DWARFContext &Ctx, const DWARFUnit *U,
+      std::function<void(StringRef)> MinorIssueCallback = warn);
 
----------------
JDevlieghere wrote:
> s/MinorIssueCallback/WarnCallback/
Oops, well spotted!


================
Comment at: lib/DebugInfo/DWARF/DWARFContext.cpp:437
       unsigned OldOffset = Offset;
-      if (!LineTable.Prologue.parse(LineData, &Offset, *this, U))
+      Error Err = LineTable.Prologue.parse(LineData, &Offset, *this, U);
+      bool FoundError(Err);
----------------
JDevlieghere wrote:
> Not sure if this much better, but this way you don't need to "check" the error twice?
> ```
> if (Error Err = LineTable.Prologue.parse(LineData, &Offset, *this, U)) 
>   if (handleDebugLineParseErrors(std::move(Err)))
>     break;
> else if (!DumpOffset || OldOffset == *DumpOffset))
>   LineTable.dump(OS, DumpOpts);
> ```
Thanks I prefer that (the boolean usage looked ugly). I've made the same change above for .debug_line.


Repository:
  rL LLVM

https://reviews.llvm.org/D44560





More information about the llvm-commits mailing list