[PATCH] D88097: [llvm-readelf/obj] - Cleanup the code. NFCI.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 24 03:19:33 PDT 2020


grimar marked an inline comment as done.
grimar 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);
----------------
fhahn wrote:
> 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))
> ```
Fixed in rG5bddaf6dbf77085863346d3171023e30972b7323. Thanks!


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