[PATCH] D92018: [llvm-readelf/obj] - Deduplicate the logic that prints notes. NFCI.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 25 23:25:15 PST 2020


grimar marked an inline comment as done.
grimar added inline comments.


================
Comment at: llvm/tools/llvm-readobj/ELFDumper.cpp:5562
+      Error Err = Error::success();
+      for (const typename ELFT::Note &Note : Obj.notes(S, Err))
+        ProcessNoteFn(Note);
----------------
nlguillemot wrote:
> This line gives a warning with clang's "range-loop analysis" diagnostic:
> 
> ```
> error: 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 [-Werror,-Wrange-loop-analysis]
>       for (const typename ELFT::Note &Note : Obj.notes(S, Err))
> ```
> 
> It can be fixed by removing the ampersand.
Fixed in rGc3673ea65df576535c85397dfe36624bd09fe47b, thanks!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D92018



More information about the llvm-commits mailing list