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); CfiFunctionDefs, CfiFunctionDecls);
#endif #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 SourceMgr &LSM = *D.getSourceMgr();
const MemoryBuffer *LBuf = const MemoryBuffer *LBuf =
LSM.getMemoryBuffer(LSM.FindBufferContainingLoc(D.getLoc())); LSM.getMemoryBuffer(LSM.FindBufferContainingLoc(D.getLoc()));
LLVMRustStringWriteImpl(BufferOut, LBuf->getBufferStart(), auto BufferOS = RawRustStringOstream(BufferOut);
LBuf->getBufferSize()); BufferOS << LBuf->getBuffer();
*LocOut = D.getLoc().getPointer() - LBuf->getBufferStart(); *LocOut = D.getLoc().getPointer() - LBuf->getBufferStart();