mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-25 13:24:46 +00:00
Introduce LLVMWriteBitcodeToMemoryBuffer C API function.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219643 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -45,6 +45,9 @@ int LLVMWriteBitcodeToFD(LLVMModuleRef M, int FD, int ShouldClose,
|
|||||||
descriptor. Returns 0 on success. Closes the Handle. */
|
descriptor. Returns 0 on success. Closes the Handle. */
|
||||||
int LLVMWriteBitcodeToFileHandle(LLVMModuleRef M, int Handle);
|
int LLVMWriteBitcodeToFileHandle(LLVMModuleRef M, int Handle);
|
||||||
|
|
||||||
|
/** Writes a module to a new memory buffer and returns it. */
|
||||||
|
LLVMMemoryBufferRef LLVMWriteBitcodeToMemoryBuffer(LLVMModuleRef M);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
@@ -39,3 +39,11 @@ int LLVMWriteBitcodeToFD(LLVMModuleRef M, int FD, int ShouldClose,
|
|||||||
int LLVMWriteBitcodeToFileHandle(LLVMModuleRef M, int FileHandle) {
|
int LLVMWriteBitcodeToFileHandle(LLVMModuleRef M, int FileHandle) {
|
||||||
return LLVMWriteBitcodeToFD(M, FileHandle, true, false);
|
return LLVMWriteBitcodeToFD(M, FileHandle, true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LLVMMemoryBufferRef LLVMWriteBitcodeToMemoryBuffer(LLVMModuleRef M) {
|
||||||
|
std::string Data;
|
||||||
|
raw_string_ostream OS(Data);
|
||||||
|
|
||||||
|
WriteBitcodeToFile(unwrap(M), OS);
|
||||||
|
return wrap(MemoryBuffer::getMemBufferCopy(OS.str()).release());
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user