Don't use LLVMRustStringWriteImpl outside of RawRustStringOstream

This commit is contained in:
Zalathar 2024-11-03 18:23:59 +11:00
parent 6295686a37
commit 730626dbd9
2 changed files with 4 additions and 3 deletions

View File

@ -1624,5 +1624,6 @@ extern "C" void LLVMRustComputeLTOCacheKey(RustStringRef KeyOut,
CfiFunctionDefs, CfiFunctionDecls);
#endif
LLVMRustStringWriteImpl(KeyOut, Key.c_str(), Key.size());
auto OS = RawRustStringOstream(KeyOut);
OS << Key.str();
}

View File

@ -1510,8 +1510,8 @@ LLVMRustUnpackSMDiagnostic(LLVMSMDiagnosticRef DRef, RustStringRef MessageOut,
const SourceMgr &LSM = *D.getSourceMgr();
const MemoryBuffer *LBuf =
LSM.getMemoryBuffer(LSM.FindBufferContainingLoc(D.getLoc()));
LLVMRustStringWriteImpl(BufferOut, LBuf->getBufferStart(),
LBuf->getBufferSize());
auto BufferOS = RawRustStringOstream(BufferOut);
BufferOS << LBuf->getBuffer();
*LocOut = D.getLoc().getPointer() - LBuf->getBufferStart();