[PATCH] D88097: [llvm-readelf/obj] - Cleanup the code. NFCI.
Florian Hahn via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 24 02:55:22 PDT 2020
fhahn added inline comments.
================
Comment at: llvm/tools/llvm-readobj/ELFDumper.cpp:5298
Error Err = Error::success();
- for (auto Note : this->Obj.notes(S, Err))
+ for (const Elf_Note &Note : this->Obj.notes(S, Err))
ProcessNote(Note);
----------------
Using a reference here is misleading, as Elf_Note will always be copied. With a recent version of Apple clang this change triggers a bunch of warnings throughout the file of the form:
```
llvm/tools/llvm-readobj/ELFDumper.cpp:5299:28: warning: loop variable 'Note' is always a copy because the range of type 'iterator_range<llvm::object::ELFFile<llvm::object::ELFType<llvm::support::big, true> >::Elf_Note_Iterator>' (aka 'iterator_range<Elf_Note_Iterator_Impl<ELFType<(llvm::support::endianness)0U, true> > >') does not return a reference [-Wrange-loop-analysis]
for (const Elf_Note &Note : this->Obj.notes(P, Err))
```
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D88097/new/
https://reviews.llvm.org/D88097
More information about the llvm-commits
mailing list