[PATCH] D78983: [ELF] Add --print-archive-stats=
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 28 01:02:12 PDT 2020
MaskRay marked an inline comment as done.
MaskRay added inline comments.
================
Comment at: lld/ELF/InputFiles.cpp:1171
+ Error err = Error::success();
+ for (const Archive::Child &c : file->children(err)) {
+ (void)c;
----------------
alexshap wrote:
> 1. what about
> std::distance(file->child_begin(err), file->child_end()); ?
> 2. just curious why is the error consumed ? e.g. alternatively this could return Expected<...>
1. `difference_type` for these iterator types is not defined so `std::distance` can't be used:
```
/usr/lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/stl_iterator_base_funcs.h:138:5: note: candidate template ignored: substitution failure
[with _InputIterator = llvm::fallible_iterator<llvm::object::Archive::ChildFallibleIterator>]: no type named 'difference_type' in 'std::iterator_trai
ts<llvm::fallible_iterator<llvm::object::Archive::ChildFallibleIterator> >'
```
> 2. just curious why is the error consumed ? e.g. alternatively this could return Expected<...>
--whole-archive and a special case call `getArchiveMembers`. When the control flow reaches here, `err` will guaranteed to be success. For the rest the archive may be corrupted but we just don't care about the error here.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D78983/new/
https://reviews.llvm.org/D78983
More information about the llvm-commits
mailing list