diff options
author | George Rimar <grimar@accesssoftek.com> | 2019-04-24 13:02:15 +0000 |
---|---|---|
committer | George Rimar <grimar@accesssoftek.com> | 2019-04-24 13:02:15 +0000 |
commit | b49e192a37b40f0e7249df3fe6cea187858531e9 (patch) | |
tree | ab382396c0c0753aa7e890fd77d6f1f21b47207d | |
parent | d59c8d30370740c3068e8724983219bf6e841e88 (diff) | |
download | bcm5719-llvm-b49e192a37b40f0e7249df3fe6cea187858531e9.tar.gz bcm5719-llvm-b49e192a37b40f0e7249df3fe6cea187858531e9.zip |
[yaml2elf] - Replace a loop with write_zeros(). NFC.
And apply clang-format to the method changed.
llvm-svn: 359090
-rw-r--r-- | llvm/tools/yaml2obj/yaml2elf.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/llvm/tools/yaml2obj/yaml2elf.cpp b/llvm/tools/yaml2obj/yaml2elf.cpp index a30093a042f..974acbd40c9 100644 --- a/llvm/tools/yaml2obj/yaml2elf.cpp +++ b/llvm/tools/yaml2obj/yaml2elf.cpp @@ -503,17 +503,16 @@ void ELFState<ELFT>::addSymbols(ArrayRef<ELFYAML::Symbol> Symbols, } template <class ELFT> -void -ELFState<ELFT>::writeSectionContent(Elf_Shdr &SHeader, - const ELFYAML::RawContentSection &Section, - ContiguousBlobAccumulator &CBA) { +void ELFState<ELFT>::writeSectionContent( + Elf_Shdr &SHeader, const ELFYAML::RawContentSection &Section, + ContiguousBlobAccumulator &CBA) { assert(Section.Size >= Section.Content.binary_size() && "Section size and section content are inconsistent"); raw_ostream &OS = CBA.getOSAndAlignedOffset(SHeader.sh_offset, SHeader.sh_addralign); Section.Content.writeAsBinary(OS); - for (auto i = Section.Content.binary_size(); i < Section.Size; ++i) - OS.write(0); + OS.write_zeros(Section.Size - Section.Content.binary_size()); + if (Section.EntSize) SHeader.sh_entsize = *Section.EntSize; else if (Section.Type == llvm::ELF::SHT_RELR) |