Bump SmallString to the minimum required amount for raw_ostream to avoid allocation.

It's is a bit annoying, we should hide this implementation detail better.

llvm-svn: 151284
This commit is contained in:
Benjamin Kramer 2012-02-23 21:15:21 +00:00
parent 56f99527e7
commit 6fe4d97e20

View File

@ -95,7 +95,7 @@ void MCStreamer::EmitIntValue(uint64_t Value, unsigned Size,
/// client having to pass in a MCExpr for constant integers.
void MCStreamer::EmitULEB128IntValue(uint64_t Value, unsigned AddrSpace,
unsigned Padding) {
SmallString<32> Tmp;
SmallString<128> Tmp;
raw_svector_ostream OSE(Tmp);
MCObjectWriter::EncodeULEB128(Value, OSE, Padding);
EmitBytes(OSE.str(), AddrSpace);
@ -104,7 +104,7 @@ void MCStreamer::EmitULEB128IntValue(uint64_t Value, unsigned AddrSpace,
/// EmitSLEB128Value - Special case of EmitSLEB128Value that avoids the
/// client having to pass in a MCExpr for constant integers.
void MCStreamer::EmitSLEB128IntValue(int64_t Value, unsigned AddrSpace) {
SmallString<32> Tmp;
SmallString<128> Tmp;
raw_svector_ostream OSE(Tmp);
MCObjectWriter::EncodeSLEB128(Value, OSE);
EmitBytes(OSE.str(), AddrSpace);