forked from OSchip/llvm-project
[llvm-readobj] - Fix a warning.
In a post review comments for D88097 it was mentioned that code triggers bunch of warnings 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)) It happens because Elf_Note is always copied here: Elf_Note_Impl<ELFT> operator*() const { assert(Nhdr && "dereferenced ELF note end iterator"); return Elf_Note_Impl<ELFT>(*Nhdr); } This patch fixes the issue by removing a reference.
This commit is contained in:
parent
d4ddf63fc4
commit
5bddaf6dbf
|
@ -5277,7 +5277,7 @@ template <class ELFT> void GNUStyle<ELFT>::printNotes() {
|
|||
PrintHeader(expectedToOptional(this->Obj.getSectionName(S)), S.sh_offset,
|
||||
S.sh_size);
|
||||
Error Err = Error::success();
|
||||
for (const Elf_Note &Note : this->Obj.notes(S, Err))
|
||||
for (const Elf_Note Note : this->Obj.notes(S, Err))
|
||||
ProcessNote(Note);
|
||||
if (Err)
|
||||
reportError(std::move(Err), this->FileName);
|
||||
|
@ -5296,7 +5296,7 @@ template <class ELFT> void GNUStyle<ELFT>::printNotes() {
|
|||
continue;
|
||||
PrintHeader(/*SecName=*/None, P.p_offset, P.p_filesz);
|
||||
Error Err = Error::success();
|
||||
for (const Elf_Note &Note : this->Obj.notes(P, Err))
|
||||
for (const Elf_Note Note : this->Obj.notes(P, Err))
|
||||
ProcessNote(Note);
|
||||
if (Err)
|
||||
reportError(std::move(Err), this->FileName);
|
||||
|
|
Loading…
Reference in New Issue