[PATCH] D49964: [DWARF] Refactor DWARF classes to use unified error reporting. NFC.

Paul Robinson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 2 08:04:06 PDT 2018


probinson added inline comments.


================
Comment at: lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp:617
     if (!Value.extractValue(AS, Offset, FormParams))
-      return make_error<StringError>("Error extracting index attribute values.",
-                                     inconvertibleErrorCode());
+      return createStringError(inconvertibleErrorCode(),
+                               "Error extracting index attribute values.");
----------------
jhenderson wrote:
> You missed an inconvertibleErrorCode here...
> 
> Actually, looking at the function itself, it can NEVER fail (always returns true), so this is technically dead code. I'd consider changing the signature of the function to return void. But that should be a separate change. If you are going to do this, I'm okay with it continuing to be inconvertibleErrorCode, but otherwise, maybe io_error?
Re. `extractValue()` there's a place in DWARFDie.cpp that asserts the return value is true; but that's because DIEs come from a section that has actually been parsed already.  Other places that use forms to interpret data are less (ahem) assertive, and this code isn't relying on a pre-parsed section, so I think returning an error would be appropriate.


Repository:
  rL LLVM

https://reviews.llvm.org/D49964





More information about the llvm-commits mailing list