Skip to content

Commit 99237f6

Browse files
committed
Fixed call to APInt::toString in SerializeSIL
The toString has been updated so that it doesn't return a std::string anymore. Instead, you have to pass the memory buffer in. This patch cleans that up.
1 parent 102b0c7 commit 99237f6

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

lib/Serialization/SerializeSIL.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1555,26 +1555,26 @@ void SILSerializer::writeSILInstruction(const SILInstruction &SI) {
15551555
case SILInstructionKind::FloatLiteralInst:
15561556
case SILInstructionKind::IntegerLiteralInst: {
15571557
// Use SILOneOperandLayout to specify the type and the literal.
1558-
std::string Str;
1558+
llvm::SmallString<char> Str;
15591559
SILType Ty;
15601560
switch (SI.getKind()) {
15611561
default: llvm_unreachable("Out of sync with parent switch");
15621562
case SILInstructionKind::IntegerLiteralInst:
1563-
Str = cast<IntegerLiteralInst>(&SI)->getValue().toString(10, true);
1563+
cast<IntegerLiteralInst>(&SI)->getValue().toString(Str, 10,
1564+
/*signed*/ true);
15641565
Ty = cast<IntegerLiteralInst>(&SI)->getType();
15651566
break;
15661567
case SILInstructionKind::FloatLiteralInst:
1567-
Str = cast<FloatLiteralInst>(&SI)->getBits().toString(16,
1568-
/*Signed*/false);
1568+
cast<IntegerLiteralInst>(&SI)->getValue().toString(Str, 16,
1569+
/*signed*/ true);
15691570
Ty = cast<FloatLiteralInst>(&SI)->getType();
15701571
break;
15711572
}
15721573
unsigned abbrCode = SILAbbrCodes[SILOneOperandLayout::Code];
1573-
SILOneOperandLayout::emitRecord(Out, ScratchRecord, abbrCode,
1574-
(unsigned)SI.getKind(), 0,
1575-
S.addTypeRef(Ty.getASTType()),
1576-
(unsigned)Ty.getCategory(),
1577-
S.addUniquedStringRef(Str));
1574+
SILOneOperandLayout::emitRecord(
1575+
Out, ScratchRecord, abbrCode, (unsigned)SI.getKind(), 0,
1576+
S.addTypeRef(Ty.getASTType()), (unsigned)Ty.getCategory(),
1577+
S.addUniquedStringRef(Str.str()));
15781578
break;
15791579
}
15801580
case SILInstructionKind::MarkFunctionEscapeInst: {

0 commit comments

Comments
 (0)