[llvm] [DebugInfo] Separate error generation from reporting in DWARFHeaderUnit::extract (PR #68242)

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 4 11:35:19 PDT 2023


================
@@ -89,9 +89,12 @@ void fixupIndexV4(DWARFContext &C, DWARFUnitIndex &Index) {
     DWARFDataExtractor Data(DObj, S, C.isLittleEndian(), 0);
     while (Data.isValidOffset(Offset)) {
       DWARFUnitHeader Header;
-      if (!Header.extract(C, Data, &Offset, DWARFSectionKind::DW_SECT_INFO)) {
+      if (Error ExtractionErr = Header.extract(
+              C, Data, &Offset, DWARFSectionKind::DW_SECT_INFO)) {
         logAllUnhandledErrors(
-            createError("Failed to parse CU header in DWP file"), errs());
+            joinErrors(createError("Failed to parse CU header in DWP file"),
+                       std::move(ExtractionErr)),
+            errs());
----------------
dwblaikie wrote:

Presumably this improves the error handling by producing a single error with the outer/contextual message, then the underlying root cause? (rather than printing two separate errors - inner then outer) - could that behavior/improvement be tested?

https://github.com/llvm/llvm-project/pull/68242


More information about the llvm-commits mailing list