Skip to content

Commit

Permalink
Revert r295138: Instead of a series of string operations, use snprint…
Browse files Browse the repository at this point in the history
…f().

This broke buildbots.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295142 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
rui314 committed Feb 15, 2017
1 parent 7855b94 commit da87ca0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/MC/WinCOFFObjectWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit da87ca0

Please sign in to comment.