[PATCH] D57229: [obj2yaml] - Dump the sh_entsize section field.

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 28 05:59:33 PST 2019


jhenderson accepted this revision.
jhenderson added a comment.
This revision is now accepted and ready to land.

LGTM.



================
Comment at: tools/obj2yaml/elf2yaml.cpp:321
+  if (Shdr->sh_entsize)
+    S.EntSize = (llvm::yaml::Hex64)Shdr->sh_entsize;
 
----------------
grimar wrote:
> jhenderson wrote:
> > Why are we casting this, but none of the other fields?
> `EntSize` is the only `Optional<llvm::yaml::Hex64>` here. Without the cast I have an error:
> 
> ```
> 1>D:\Work2\llvm\llvm\tools\obj2yaml\elf2yaml.cpp(321): error C2679: binary '=': no operator found which takes a right-hand operand of type 'const llvm::support::detail::packed_endian_specific_integral<uint32_t,llvm::support::little,1>' (or there is no acceptable conversion)
> 1>D:\Work2\llvm\llvm\include\llvm/ADT/Optional.h(150): note: could be 'llvm::Optional<llvm::yaml::Hex64> &llvm::Optional<llvm::yaml::Hex64>::operator =(const llvm::Optional<llvm::yaml::Hex64> &)'
> 1>D:\Work2\llvm\llvm\include\llvm/ADT/Optional.h(146): note: or       'llvm::Optional<llvm::yaml::Hex64> &llvm::Optional<llvm::yaml::Hex64>::operator =(const T &)'
> 1>        with
> 1>        [
> 1>            T=llvm::yaml::Hex64
> 1>        ]
> 1>D:\Work2\llvm\llvm\include\llvm/ADT/Optional.h(133): note: or       'llvm::Optional<llvm::yaml::Hex64> &llvm::Optional<llvm::yaml::Hex64>::operator =(llvm::Optional<llvm::yaml::Hex64> &&)'
> 1>D:\Work2\llvm\llvm\include\llvm/ADT/Optional.h(129): note: or       'llvm::Optional<llvm::yaml::Hex64> &llvm::Optional<llvm::yaml::Hex64>::operator =(T &&)'
> 1>        with
> 1>        [
> 1>            T=llvm::yaml::Hex64
> 1>        ]
> 1>D:\Work2\llvm\llvm\tools\obj2yaml\elf2yaml.cpp(321): note: while trying to match the argument list '(llvm::Optional<llvm::yaml::Hex64>, const llvm::support::detail::packed_endian_specific_integral<uint32_t,llvm::support::little,1>)'
> 1>D:\Work2\llvm\llvm\tools\obj2yaml\elf2yaml.cpp(315): note: while compiling class template member function 'std::error_code `anonymous-namespace'::ELFDumper<ELFT>::dumpCommonSection(const llvm::object::Elf_Shdr_Impl<ELFT> *,llvm::ELFYAML::Section &)'
> 1>        with
> 1>        [
> 1>            ELFT=llvm::object::ELF32LE
> 1>        ]
> 1>D:\Work2\llvm\llvm\tools\obj2yaml\elf2yaml.cpp(420): note: see reference to function template instantiation 'std::error_code `anonymous-namespace'::ELFDumper<ELFT>::dumpCommonSection(const llvm::object::Elf_Shdr_Impl<ELFT> *,llvm::ELFYAML::Section &)' being compiled
> 1>        with
> 1>        [
> 1>            ELFT=llvm::object::ELF32LE
> 1>        ]
> 1>D:\Work2\llvm\llvm\tools\obj2yaml\elf2yaml.cpp(205): note: while compiling class template member function 'std::error_code `anonymous-namespace'::ELFDumper<ELFT>::dumpSymbols(const llvm::object::Elf_Shdr_Impl<ELFT> *,llvm::ELFYAML::LocalGlobalWeakSymbols &)'
> 1>        with
> 1>        [
> 1>            ELFT=llvm::object::ELF32LE
> 1>        ]
> 1>D:\Work2\llvm\llvm\tools\obj2yaml\elf2yaml.cpp(194): note: see reference to function template instantiation 'std::error_code `anonymous-namespace'::ELFDumper<ELFT>::dumpSymbols(const llvm::object::Elf_Shdr_Impl<ELFT> *,llvm::ELFYAML::LocalGlobalWeakSymbols &)' being compiled
> 1>        with
> 1>        [
> 1>            ELFT=llvm::object::ELF32LE
> 1>        ]
> 1>D:\Work2\llvm\llvm\tools\obj2yaml\elf2yaml.cpp(71): note: while compiling class template member function '`anonymous-namespace'::ELFDumper<ELFT>::ELFDumper(const llvm::object::ELFFile<ELFT> &)'
> 1>        with
> 1>        [
> 1>            ELFT=llvm::object::ELF32LE
> 1>        ]
> 1>D:\Work2\llvm\llvm\tools\obj2yaml\elf2yaml.cpp(523): note: see reference to function template instantiation '`anonymous-namespace'::ELFDumper<ELFT>::ELFDumper(const llvm::object::ELFFile<ELFT> &)' being compiled
> 1>        with
> 1>        [
> 1>            ELFT=llvm::object::ELF32LE
> 1>        ]
> 1>D:\Work2\llvm\llvm\tools\obj2yaml\elf2yaml.cpp(523): note: see reference to class template instantiation '`anonymous-namespace'::ELFDumper<ELFT>' being compiled
> 1>        with
> 1>        [
> 1>            ELFT=llvm::object::ELF32LE
> 1>        ]
> 1>D:\Work2\llvm\llvm\tools\obj2yaml\elf2yaml.cpp(537): note: see reference to function template instantiation 'std::error_code elf2yaml<llvm::object::ELF32LE>(llvm::raw_ostream &,const llvm::object::ELFFile<llvm::object::ELF32LE> &)' being compiled
> 1>D:\Work2\llvm\llvm\tools\obj2yaml\elf2yaml.cpp(321): error C2679: binary '=': no operator found which takes a right-hand operand of type 'const llvm::support::detail::packed_endian_specific_integral<uint32_t,llvm::support::big,1>' (or there is no acceptable conversion)
> 1>D:\Work2\llvm\llvm\include\llvm/ADT/Optional.h(150): note: could be 'llvm::Optional<llvm::yaml::Hex64> &llvm::Optional<llvm::yaml::Hex64>::operator =(const llvm::Optional<llvm::yaml::Hex64> &)'
> 1>D:\Work2\llvm\llvm\include\llvm/ADT/Optional.h(146): note: or       'llvm::Optional<llvm::yaml::Hex64> &llvm::Optional<llvm::yaml::Hex64>::operator =(const T &)'
> 1>        with
> 1>        [
> 1>            T=llvm::yaml::Hex64
> 1>        ]
> 1>D:\Work2\llvm\llvm\include\llvm/ADT/Optional.h(133): note: or       'llvm::Optional<llvm::yaml::Hex64> &llvm::Optional<llvm::yaml::Hex64>::operator =(llvm::Optional<llvm::yaml::Hex64> &&)'
> 1>D:\Work2\llvm\llvm\include\llvm/ADT/Optional.h(129): note: or       'llvm::Optional<llvm::yaml::Hex64> &llvm::Optional<llvm::yaml::Hex64>::operator =(T &&)'
> 1>        with
> 1>        [
> 1>            T=llvm::yaml::Hex64
> 1>        ]
> 1>D:\Work2\llvm\llvm\tools\obj2yaml\elf2yaml.cpp(321): note: while trying to match the argument list '(llvm::Optional<llvm::yaml::Hex64>, const llvm::support::detail::packed_endian_specific_integral<uint32_t,llvm::support::big,1>)'
> 1>D:\Work2\llvm\llvm\tools\obj2yaml\elf2yaml.cpp(315): note: while compiling class template member function 'std::error_code `anonymous-namespace'::ELFDumper<ELFT>::dumpCommonSection(const llvm::object::Elf_Shdr_Impl<ELFT> *,llvm::ELFYAML::Section &)'
> 1>        with
> 1>        [
> 1>            ELFT=llvm::object::ELF32BE
> 1>        ]
> 1>D:\Work2\llvm\llvm\tools\obj2yaml\elf2yaml.cpp(420): note: see reference to function template instantiation 'std::error_code `anonymous-namespace'::ELFDumper<ELFT>::dumpCommonSection(const llvm::object::Elf_Shdr_Impl<ELFT> *,llvm::ELFYAML::Section &)' being compiled
> 1>        with
> 1>        [
> 1>            ELFT=llvm::object::ELF32BE
> 1>        ]
> 1>D:\Work2\llvm\llvm\tools\obj2yaml\elf2yaml.cpp(205): note: while compiling class template member function 'std::error_code `anonymous-namespace'::ELFDumper<ELFT>::dumpSymbols(const llvm::object::Elf_Shdr_Impl<ELFT> *,llvm::ELFYAML::LocalGlobalWeakSymbols &)'
> 1>        with
> 1>        [
> 1>            ELFT=llvm::object::ELF32BE
> 1>        ]
> 1>D:\Work2\llvm\llvm\tools\obj2yaml\elf2yaml.cpp(194): note: see reference to function template instantiation 'std::error_code `anonymous-namespace'::ELFDumper<ELFT>::dumpSymbols(const llvm::object::Elf_Shdr_Impl<ELFT> *,llvm::ELFYAML::LocalGlobalWeakSymbols &)' being compiled
> 1>        with
> 1>        [
> 1>            ELFT=llvm::object::ELF32BE
> 1>        ]
> 1>D:\Work2\llvm\llvm\tools\obj2yaml\elf2yaml.cpp(71): note: while compiling class template member function '`anonymous-namespace'::ELFDumper<ELFT>::ELFDumper(const llvm::object::ELFFile<ELFT> &)'
> 1>        with
> 1>        [
> 1>            ELFT=llvm::object::ELF32BE
> 1>        ]
> 1>D:\Work2\llvm\llvm\tools\obj2yaml\elf2yaml.cpp(523): note: see reference to function template instantiation '`anonymous-namespace'::ELFDumper<ELFT>::ELFDumper(const llvm::object::ELFFile<ELFT> &)' being compiled
> 1>        with
> 1>        [
> 1>            ELFT=llvm::object::ELF32BE
> 1>        ]
> 1>D:\Work2\llvm\llvm\tools\obj2yaml\elf2yaml.cpp(523): note: see reference to class template instantiation '`anonymous-namespace'::ELFDumper<ELFT>' being compiled
> 1>        with
> 1>        [
> 1>            ELFT=llvm::object::ELF32BE
> 1>        ]
> 1>D:\Work2\llvm\llvm\tools\obj2yaml\elf2yaml.cpp(540): note: see reference to function template instantiation 'std::error_code elf2yaml<llvm::object::ELF32BE>(llvm::raw_ostream &,const llvm::object::ELFFile<llvm::object::ELF32BE> &)' being compiled
> 1>D:\Work2\llvm\llvm\tools\obj2yaml\elf2yaml.cpp(321): error C2679: binary '=': no operator found which takes a right-hand operand of type 'const llvm::support::detail::packed_endian_specific_integral<uint64_t,llvm::support::little,1>' (or there is no acceptable conversion)
> 1>D:\Work2\llvm\llvm\include\llvm/ADT/Optional.h(150): note: could be 'llvm::Optional<llvm::yaml::Hex64> &llvm::Optional<llvm::yaml::Hex64>::operator =(const llvm::Optional<llvm::yaml::Hex64> &)'
> 1>D:\Work2\llvm\llvm\include\llvm/ADT/Optional.h(146): note: or       'llvm::Optional<llvm::yaml::Hex64> &llvm::Optional<llvm::yaml::Hex64>::operator =(const T &)'
> 1>        with
> 1>        [
> 1>            T=llvm::yaml::Hex64
> 1>        ]
> 1>D:\Work2\llvm\llvm\include\llvm/ADT/Optional.h(133): note: or       'llvm::Optional<llvm::yaml::Hex64> &llvm::Optional<llvm::yaml::Hex64>::operator =(llvm::Optional<llvm::yaml::Hex64> &&)'
> 1>D:\Work2\llvm\llvm\include\llvm/ADT/Optional.h(129): note: or       'llvm::Optional<llvm::yaml::Hex64> &llvm::Optional<llvm::yaml::Hex64>::operator =(T &&)'
> 1>        with
> 1>        [
> 1>            T=llvm::yaml::Hex64
> 1>        ]
> 1>D:\Work2\llvm\llvm\tools\obj2yaml\elf2yaml.cpp(321): note: while trying to match the argument list '(llvm::Optional<llvm::yaml::Hex64>, const llvm::support::detail::packed_endian_specific_integral<uint64_t,llvm::support::little,1>)'
> 1>D:\Work2\llvm\llvm\tools\obj2yaml\elf2yaml.cpp(315): note: while compiling class template member function 'std::error_code `anonymous-namespace'::ELFDumper<ELFT>::dumpCommonSection(const llvm::object::Elf_Shdr_Impl<ELFT> *,llvm::ELFYAML::Section &)'
> 1>        with
> 1>        [
> 1>            ELFT=llvm::object::ELF64LE
> 1>        ]
> 1>D:\Work2\llvm\llvm\tools\obj2yaml\elf2yaml.cpp(420): note: see reference to function template instantiation 'std::error_code `anonymous-namespace'::ELFDumper<ELFT>::dumpCommonSection(const llvm::object::Elf_Shdr_Impl<ELFT> *,llvm::ELFYAML::Section &)' being compiled
> 1>        with
> 1>        [
> 1>            ELFT=llvm::object::ELF64LE
> 1>        ]
> 1>D:\Work2\llvm\llvm\tools\obj2yaml\elf2yaml.cpp(205): note: while compiling class template member function 'std::error_code `anonymous-namespace'::ELFDumper<ELFT>::dumpSymbols(const llvm::object::Elf_Shdr_Impl<ELFT> *,llvm::ELFYAML::LocalGlobalWeakSymbols &)'
> 1>        with
> 1>        [
> 1>            ELFT=llvm::object::ELF64LE
> 1>        ]
> 1>D:\Work2\llvm\llvm\tools\obj2yaml\elf2yaml.cpp(194): note: see reference to function template instantiation 'std::error_code `anonymous-namespace'::ELFDumper<ELFT>::dumpSymbols(const llvm::object::Elf_Shdr_Impl<ELFT> *,llvm::ELFYAML::LocalGlobalWeakSymbols &)' being compiled
> 1>        with
> 1>        [
> 1>            ELFT=llvm::object::ELF64LE
> 1>        ]
> 1>D:\Work2\llvm\llvm\tools\obj2yaml\elf2yaml.cpp(71): note: while compiling class template member function '`anonymous-namespace'::ELFDumper<ELFT>::ELFDumper(const llvm::object::ELFFile<ELFT> &)'
> 1>        with
> 1>        [
> 1>            ELFT=llvm::object::ELF64LE
> 1>        ]
> 1>D:\Work2\llvm\llvm\tools\obj2yaml\elf2yaml.cpp(523): note: see reference to function template instantiation '`anonymous-namespace'::ELFDumper<ELFT>::ELFDumper(const llvm::object::ELFFile<ELFT> &)' being compiled
> 1>        with
> 1>        [
> 1>            ELFT=llvm::object::ELF64LE
> 1>        ]
> 1>D:\Work2\llvm\llvm\tools\obj2yaml\elf2yaml.cpp(523): note: see reference to class template instantiation '`anonymous-namespace'::ELFDumper<ELFT>' being compiled
> 1>        with
> 1>        [
> 1>            ELFT=llvm::object::ELF64LE
> 1>        ]
> 1>D:\Work2\llvm\llvm\tools\obj2yaml\elf2yaml.cpp(543): note: see reference to function template instantiation 'std::error_code elf2yaml<llvm::object::ELF64LE>(llvm::raw_ostream &,const llvm::object::ELFFile<llvm::object::ELF64LE> &)' being compiled
> 1>D:\Work2\llvm\llvm\tools\obj2yaml\elf2yaml.cpp(321): error C2679: binary '=': no operator found which takes a right-hand operand of type 'const llvm::support::detail::packed_endian_specific_integral<uint64_t,llvm::support::big,1>' (or there is no acceptable conversion)
> 1>D:\Work2\llvm\llvm\include\llvm/ADT/Optional.h(150): note: could be 'llvm::Optional<llvm::yaml::Hex64> &llvm::Optional<llvm::yaml::Hex64>::operator =(const llvm::Optional<llvm::yaml::Hex64> &)'
> 1>D:\Work2\llvm\llvm\include\llvm/ADT/Optional.h(146): note: or       'llvm::Optional<llvm::yaml::Hex64> &llvm::Optional<llvm::yaml::Hex64>::operator =(const T &)'
> 1>        with
> 1>        [
> 1>            T=llvm::yaml::Hex64
> 1>        ]
> 1>D:\Work2\llvm\llvm\include\llvm/ADT/Optional.h(133): note: or       'llvm::Optional<llvm::yaml::Hex64> &llvm::Optional<llvm::yaml::Hex64>::operator =(llvm::Optional<llvm::yaml::Hex64> &&)'
> 1>D:\Work2\llvm\llvm\include\llvm/ADT/Optional.h(129): note: or       'llvm::Optional<llvm::yaml::Hex64> &llvm::Optional<llvm::yaml::Hex64>::operator =(T &&)'
> 1>        with
> 1>        [
> 1>            T=llvm::yaml::Hex64
> 1>        ]
> 1>D:\Work2\llvm\llvm\tools\obj2yaml\elf2yaml.cpp(321): note: while trying to match the argument list '(llvm::Optional<llvm::yaml::Hex64>, const llvm::support::detail::packed_endian_specific_integral<uint64_t,llvm::support::big,1>)'
> 1>D:\Work2\llvm\llvm\tools\obj2yaml\elf2yaml.cpp(315): note: while compiling class template member function 'std::error_code `anonymous-namespace'::ELFDumper<ELFT>::dumpCommonSection(const llvm::object::Elf_Shdr_Impl<ELFT> *,llvm::ELFYAML::Section &)'
> 1>        with
> 1>        [
> 1>            ELFT=llvm::object::ELF64BE
> 1>        ]
> 1>D:\Work2\llvm\llvm\tools\obj2yaml\elf2yaml.cpp(420): note: see reference to function template instantiation 'std::error_code `anonymous-namespace'::ELFDumper<ELFT>::dumpCommonSection(const llvm::object::Elf_Shdr_Impl<ELFT> *,llvm::ELFYAML::Section &)' being compiled
> 1>        with
> 1>        [
> 1>            ELFT=llvm::object::ELF64BE
> 1>        ]
> 1>D:\Work2\llvm\llvm\tools\obj2yaml\elf2yaml.cpp(205): note: while compiling class template member function 'std::error_code `anonymous-namespace'::ELFDumper<ELFT>::dumpSymbols(const llvm::object::Elf_Shdr_Impl<ELFT> *,llvm::ELFYAML::LocalGlobalWeakSymbols &)'
> 1>        with
> 1>        [
> 1>            ELFT=llvm::object::ELF64BE
> 1>        ]
> 1>D:\Work2\llvm\llvm\tools\obj2yaml\elf2yaml.cpp(194): note: see reference to function template instantiation 'std::error_code `anonymous-namespace'::ELFDumper<ELFT>::dumpSymbols(const llvm::object::Elf_Shdr_Impl<ELFT> *,llvm::ELFYAML::LocalGlobalWeakSymbols &)' being compiled
> 1>        with
> 1>        [
> 1>            ELFT=llvm::object::ELF64BE
> 1>        ]
> 1>D:\Work2\llvm\llvm\tools\obj2yaml\elf2yaml.cpp(71): note: while compiling class template member function '`anonymous-namespace'::ELFDumper<ELFT>::ELFDumper(const llvm::object::ELFFile<ELFT> &)'
> 1>        with
> 1>        [
> 1>            ELFT=llvm::object::ELF64BE
> 1>        ]
> 1>D:\Work2\llvm\llvm\tools\obj2yaml\elf2yaml.cpp(523): note: see reference to function template instantiation '`anonymous-namespace'::ELFDumper<ELFT>::ELFDumper(const llvm::object::ELFFile<ELFT> &)' being compiled
> 1>        with
> 1>        [
> 1>            ELFT=llvm::object::ELF64BE
> 1>        ]
> 1>D:\Work2\llvm\llvm\tools\obj2yaml\elf2yaml.cpp(523): note: see reference to class template instantiation '`anonymous-namespace'::ELFDumper<ELFT>' being compiled
> 1>        with
> 1>        [
> 1>            ELFT=llvm::object::ELF64BE
> 1>        ]
> 1>D:\Work2\llvm\llvm\tools\obj2yaml\elf2yaml.cpp(546): note: see reference to function template instantiation 'std::error_code elf2yaml<llvm::object::ELF64BE>(llvm::raw_ostream &,const llvm::object::ELFFile<llvm::object::ELF64BE> &)' being compiled
> 1>Done building project "obj2yaml.vcxproj" -- FAILED.
> ```
Okay. Use static_cast, I think, unless there's precedent for C-style casts in this project.


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

https://reviews.llvm.org/D57229





More information about the llvm-commits mailing list