diff options
author | Bill Wendling <isanbard@gmail.com> | 2013-02-14 19:11:28 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2013-02-14 19:11:28 +0000 |
commit | 31cfc707058ad3f470924cdb3c460c8f50ee76c3 (patch) | |
tree | e348dcc2cde63effaa05a5b6ce6ab051b3326b39 /lib/IR/Core.cpp | |
parent | 7b672ed380cf44894f8b96c52558dcfc136af383 (diff) |
Add two new functions to the C API:
LLVMCreateMemoryBufferWithMemoryRange - exposes MemoryBuffer::getMemBuffer
LLVMCreateMemoryBufferWithMemoryRangeCopy - exposes MemoryBuffer::getMemBufferCopy
Patch by Moritz Maxeiner!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175199 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/IR/Core.cpp')
-rw-r--r-- | lib/IR/Core.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/IR/Core.cpp b/lib/IR/Core.cpp index b696ed06c4..10f870c71f 100644 --- a/lib/IR/Core.cpp +++ b/lib/IR/Core.cpp @@ -2369,6 +2369,29 @@ LLVMBool LLVMCreateMemoryBufferWithSTDIN(LLVMMemoryBufferRef *OutMemBuf, return 1; } +LLVMMemoryBufferRef LLVMCreateMemoryBufferWithMemoryRange( + const char *InputData, + size_t InputDataLength, + const char *BufferName, + bool RequiresNullTerminator) { + + return wrap(MemoryBuffer::getMemBuffer( + StringRef(InputData, InputDataLength), + StringRef(BufferName), + RequiresNullTerminator)); +} + +LLVMMemoryBufferRef LLVMCreateMemoryBufferWithMemoryRangeCopy( + const char *InputData, + size_t InputDataLength, + const char *BufferName) { + + return wrap(MemoryBuffer::getMemBufferCopy( + StringRef(InputData, InputDataLength), + StringRef(BufferName))); +} + + void LLVMDisposeMemoryBuffer(LLVMMemoryBufferRef MemBuf) { delete unwrap(MemBuf); } |