Revert r295138: Instead of a series of string operations, use snprintf().

This broke buildbots.

llvm-svn: 295142
This commit is contained in:
Rui Ueyama 2017-02-15 01:48:33 +00:00
parent f340ca8963
commit 4b58f577cd
1 changed files with 4 additions and 2 deletions

View File

@ -434,8 +434,10 @@ void WinCOFFObjectWriter::SetSectionName(COFFSection &S) {
uint64_t StringTableEntry = Strings.getOffset(S.Name);
if (StringTableEntry <= Max7DecimalOffset) {
snprintf(S.Header.Name, sizeof(S.Header.Name), "/%" PRIu64,
StringTableEntry);
SmallVector<char, COFF::NameSize> Buffer;
Twine('/').concat(Twine(StringTableEntry)).toVector(Buffer);
assert(Buffer.size() <= COFF::NameSize && Buffer.size() >= 2);
std::memcpy(S.Header.Name, Buffer.data(), Buffer.size());
return;
}
if (StringTableEntry <= MaxBase64Offset) {