From: Peter Collingbourne Date: Thu, 17 May 2018 22:11:43 +0000 (+0000) Subject: Support: Add a raw_ostream::write_zeros() function. NFCI. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=02bcd70eea3567cd0577d4ed76031087c1a48ac3;p=clang Support: Add a raw_ostream::write_zeros() function. NFCI. This will eventually replace MCObjectWriter::WriteZeros. Part of PR37466. Differential Revision: https://reviews.llvm.org/D47033 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@332675 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CoverageMappingGen.cpp b/lib/CodeGen/CoverageMappingGen.cpp index 04e2661518..49067ebec3 100644 --- a/lib/CodeGen/CoverageMappingGen.cpp +++ b/lib/CodeGen/CoverageMappingGen.cpp @@ -1372,8 +1372,7 @@ void CoverageMappingModuleGen::emit() { // and coverage mappings is a multiple of 8. if (size_t Rem = OS.str().size() % 8) { CoverageMappingSize += 8 - Rem; - for (size_t I = 0, S = 8 - Rem; I < S; ++I) - OS << '\0'; + OS.write_zeros(8 - Rem); } auto *FilenamesAndMappingsVal = llvm::ConstantDataArray::getString(Ctx, OS.str(), false);