[llvm] r359090 - [yaml2elf] - Replace a loop with write_zeros(). NFC.
George Rimar via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 24 06:02:16 PDT 2019
Author: grimar
Date: Wed Apr 24 06:02:15 2019
New Revision: 359090
URL: http://llvm.org/viewvc/llvm-project?rev=359090&view=rev
Log:
[yaml2elf] - Replace a loop with write_zeros(). NFC.
And apply clang-format to the method changed.
Modified:
llvm/trunk/tools/yaml2obj/yaml2elf.cpp
Modified: llvm/trunk/tools/yaml2obj/yaml2elf.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/yaml2obj/yaml2elf.cpp?rev=359090&r1=359089&r2=359090&view=diff
==============================================================================
--- llvm/trunk/tools/yaml2obj/yaml2elf.cpp (original)
+++ llvm/trunk/tools/yaml2obj/yaml2elf.cpp Wed Apr 24 06:02:15 2019
@@ -503,17 +503,16 @@ void ELFState<ELFT>::addSymbols(ArrayRef
}
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)
More information about the llvm-commits
mailing list