[PATCH][llvm-c] Create Memory Buffer with memory ranges

Moritz Maxeiner moritzmaxeiner at googlemail.com
Thu Feb 14 04:57:00 PST 2013


On 2/13/2013 10:25 PM, Bill Wendling wrote:
> On Feb 13, 2013, at 11:33 AM, Moritz Maxeiner <moritzmaxeiner at googlemail.com> wrote:
>
>> On 2/13/2013 7:55 PM, Chris Lattner wrote:
>>> On Feb 13, 2013, at 3:59 AM, Moritz Maxeiner <moritzmaxeiner at googlemail.com> wrote:
>>>
>>> LGTM!
>>>
>>> -Chris
>> Awesome!
>> So... anything else that I need to/should/can do to get this committed?
>>
>>
>> Lastly, if you don't have commit access you can ask someone who does to commit it for you. :)

Since I have no commit access (and the developer page states it is only 
given to people who have already submitted
multiple high-quality patches + this is my first patch, not counting the 
bug fix I sent that hasn't been reviewed yet)
could I please trouble you with committing the patch for me?
Thank you in advance,
   - Moritz

-------------- next part --------------
Index: lib/IR/Core.cpp
===================================================================
--- lib/IR/Core.cpp	(revision 175052)
+++ lib/IR/Core.cpp	(working copy)
@@ -2369,6 +2369,29 @@
   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);
 }
Index: include/llvm-c/Core.h
===================================================================
--- include/llvm-c/Core.h	(revision 175052)
+++ include/llvm-c/Core.h	(working copy)
@@ -2548,6 +2548,13 @@
                                                   char **OutMessage);
 LLVMBool LLVMCreateMemoryBufferWithSTDIN(LLVMMemoryBufferRef *OutMemBuf,
                                          char **OutMessage);
+LLVMMemoryBufferRef LLVMCreateMemoryBufferWithMemoryRange(const char *InputData,
+                                                          size_t InputDataLength,
+                                                          const char *BufferName,
+                                                          bool RequiresNullTerminator);
+LLVMMemoryBufferRef LLVMCreateMemoryBufferWithMemoryRangeCopy(const char *InputData,
+                                                              size_t InputDataLength,
+                                                              const char *BufferName);
 void LLVMDisposeMemoryBuffer(LLVMMemoryBufferRef MemBuf);
 
 /**


More information about the llvm-commits mailing list