[PATCH] D55235: llvm-objcopy: Improve/simplify llvm::Error handling during notes iteration

David Blaikie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 3 14:58:20 PST 2018


dblaikie added a comment.

Ah, think I found a better solution - since lhames is out of town, this might be good enough that I'll commit it now & can leave the discussion for another time.

By clearing the error in the iterator ctor, then setting it to success or failure when the iterator is incremented to the end (or a premature error state) - any iteration that reaches the end must check the error, but early returns during the iteration don't have to check the Error.

@jakehehrlich - seems there's some missing test coverage, though. Neither of the tests in the original commit fail if the note is not found (so the iteration over teh notes does reach the end, and the error should be checked - if I remove the error checking there, seems nothing fails). Is that possible to test?  Could you please add a test whenever you get a chance & let me know, so we can check that this change I'm proposing/committing would've caught missing error handling in such a case?


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55235/new/

https://reviews.llvm.org/D55235





More information about the llvm-commits mailing list