[PATCH] D43958: [llvm-readobj][ELF] Move ELF note parsing into lib/Object

Scott Linder via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 6 12:11:57 PST 2018


scott.linder updated this revision to Diff 137241.
scott.linder added a comment.

Address feedback from Rafael and Tony.

- ProcessNote now accepts a reference, thank you for the catch.
- Removed the `assert` on `Err` in the iterator constructor; the check actually marks the `Error` as "checked", which is incorrect.
- Moved the "whole note" bound checks up into the iterator, unifying the bound checks in once place.

All of the public interfaces are still safe, and there is a bit less waste (not copying around `MaxSize`, not checking the "whole note" bounds multiple times per iteration).

As for Rafael's comment on checking errors in each iteration, there is no need as the iterator is careful to always stop iteration when an error is encountered, so one check after iteration ends should suffice.


https://reviews.llvm.org/D43958

Files:
  include/llvm/BinaryFormat/ELF.h
  include/llvm/Object/ELF.h
  include/llvm/Object/ELFTypes.h
  tools/llvm-readobj/ELFDumper.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D43958.137241.patch
Type: text/x-patch
Size: 13686 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180306/41d0d59c/attachment.bin>


More information about the llvm-commits mailing list