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

This broke buildbots.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295142 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rui Ueyama 2017-02-15 01:48:33 +00:00
parent 7855b94bca
commit da87ca0f4c

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) {