From 31cfc707058ad3f470924cdb3c460c8f50ee76c3 Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Thu, 14 Feb 2013 19:11:28 +0000 Subject: 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 --- lib/IR/Core.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'lib/IR/Core.cpp') 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); } -- cgit v1.2.3-18-g5258