aboutsummaryrefslogtreecommitdiffstats
path: root/lib/IR/Core.cpp
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2013-02-14 19:11:28 +0000
committerBill Wendling <isanbard@gmail.com>2013-02-14 19:11:28 +0000
commit31cfc707058ad3f470924cdb3c460c8f50ee76c3 (patch)
treee348dcc2cde63effaa05a5b6ce6ab051b3326b39 /lib/IR/Core.cpp
parent7b672ed380cf44894f8b96c52558dcfc136af383 (diff)
downloadexternal_llvm-31cfc707058ad3f470924cdb3c460c8f50ee76c3.zip
external_llvm-31cfc707058ad3f470924cdb3c460c8f50ee76c3.tar.gz
external_llvm-31cfc707058ad3f470924cdb3c460c8f50ee76c3.tar.bz2
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.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/IR/Core.cpp b/lib/IR/Core.cpp
index b696ed0..10f870c 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);
}