mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-25 12:12:47 +01:00
Introduce LLVMWriteBitcodeToMemoryBuffer C API function.
llvm-svn: 219643
This commit is contained in:
parent
2c23d39a87
commit
1048907fe6
@ -45,6 +45,9 @@ int LLVMWriteBitcodeToFD(LLVMModuleRef M, int FD, int ShouldClose,
|
||||
descriptor. Returns 0 on success. Closes the 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) {
|
||||
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());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user