forked from OSchip/llvm-project
Add two new functions to the C API:
LLVMCreateMemoryBufferWithMemoryRange - exposes MemoryBuffer::getMemBuffer LLVMCreateMemoryBufferWithMemoryRangeCopy - exposes MemoryBuffer::getMemBufferCopy Patch by Moritz Maxeiner! llvm-svn: 175199
This commit is contained in:
parent
0ee809b71c
commit
526276af71
|
@ -2548,6 +2548,13 @@ LLVMBool LLVMCreateMemoryBufferWithContentsOfFile(const char *Path,
|
|||
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);
|
||||
|
||||
/**
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue