From: George Rimar Date: Wed, 24 Apr 2019 13:02:15 +0000 (+0000) Subject: [yaml2elf] - Replace a loop with write_zeros(). NFC. X-Git-Tag: llvmorg-10-init~7133 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b49e192a37b40f0e7249df3fe6cea187858531e9;p=platform%2Fupstream%2Fllvm.git [yaml2elf] - Replace a loop with write_zeros(). NFC. And apply clang-format to the method changed. llvm-svn: 359090 --- diff --git a/llvm/tools/yaml2obj/yaml2elf.cpp b/llvm/tools/yaml2obj/yaml2elf.cpp index a30093a..974acbd 100644 --- a/llvm/tools/yaml2obj/yaml2elf.cpp +++ b/llvm/tools/yaml2obj/yaml2elf.cpp @@ -503,17 +503,16 @@ void ELFState::addSymbols(ArrayRef Symbols, } template -void -ELFState::writeSectionContent(Elf_Shdr &SHeader, - const ELFYAML::RawContentSection &Section, - ContiguousBlobAccumulator &CBA) { +void ELFState::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)