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

Nicolas Guillemot via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 25 17:33:04 PST 2020


nlguillemot 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);
----------------
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.


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