[PATCH] D106783: [AIX][XCOFF][llvm-readobj] Replace unwrapOrError with reportUniqueWarning
James Henderson via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 29 00:08:35 PDT 2021
jhenderson added inline comments.
================
Comment at: llvm/tools/llvm-readobj/XCOFFDumper.cpp:139
+ if (Error E = ErrOrRelocations.takeError())
+ reportUniqueWarning(std::move(E));
+
----------------
MaryamBen wrote:
> jhenderson wrote:
> > 1) Is this tested?
> > 2) You'll need to break out of or continue this loop here, as `*ErrOrRelocations` will result in referencing invalid memory if there is an error. (reportUniqueWarning reports the warning and continues).
> I don't know how to test it.
> None of the existing tests reports the UniqueWarning
To test this, you'll probably need to craft an XCOFF object (probably using yaml2obj) to trigger the report of the error from `Obj.relocations`. You may need to expand on yaml2obj's existing behaviour to allow creating an invalid input.
Just because something isn't tested already, doesn't mean it shouldn't be now, and this is a good chance to add the testing.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D106783/new/
https://reviews.llvm.org/D106783
More information about the llvm-commits
mailing list