Lines Matching refs:MemoryBuffer
1 //===--- MemoryBuffer.cpp - Memory Buffer implementation ------------------===//
10 // This file implements the MemoryBuffer interface.
14 #include "llvm/Support/MemoryBuffer.h"
38 // MemoryBuffer implementation itself.
41 MemoryBuffer::~MemoryBuffer() { }
43 /// init - Initialize this MemoryBuffer as a reference to externally allocated
45 void MemoryBuffer::init(const char *BufStart, const char *BufEnd,
82 /// MemoryBufferMem - Named MemoryBuffer pointing to a block of memory.
83 class MemoryBufferMem : public MemoryBuffer {
100 static ErrorOr<std::unique_ptr<MemoryBuffer>>
104 std::unique_ptr<MemoryBuffer>
105 MemoryBuffer::getMemBuffer(StringRef InputData, StringRef BufferName,
109 return std::unique_ptr<MemoryBuffer>(Ret);
112 std::unique_ptr<MemoryBuffer>
113 MemoryBuffer::getMemBuffer(MemoryBufferRef Ref, bool RequiresNullTerminator) {
114 return std::unique_ptr<MemoryBuffer>(getMemBuffer(
118 std::unique_ptr<MemoryBuffer>
119 MemoryBuffer::getMemBufferCopy(StringRef InputData, const Twine &BufferName) {
120 std::unique_ptr<MemoryBuffer> Buf =
129 std::unique_ptr<MemoryBuffer>
130 MemoryBuffer::getNewUninitMemBuffer(size_t Size, const Twine &BufferName) {
131 // Allocate space for the MemoryBuffer, the data and the name. It is important
132 // that MemoryBuffer and data are aligned so PointerIntPair works with them.
152 return std::unique_ptr<MemoryBuffer>(Ret);
155 std::unique_ptr<MemoryBuffer>
156 MemoryBuffer::getNewMemBuffer(size_t Size, StringRef BufferName) {
157 std::unique_ptr<MemoryBuffer> SB = getNewUninitMemBuffer(Size, BufferName);
164 ErrorOr<std::unique_ptr<MemoryBuffer>>
165 MemoryBuffer::getFileOrSTDIN(const Twine &Filename, int64_t FileSize,
175 ErrorOr<std::unique_ptr<MemoryBuffer>>
176 MemoryBuffer::getFileSlice(const Twine &FilePath, uint64_t MapSize,
183 // MemoryBuffer::getFile implementation.
190 class MemoryBufferMMapFile : public MemoryBuffer {
227 static ErrorOr<std::unique_ptr<MemoryBuffer>>
243 return MemoryBuffer::getMemBufferCopy(Buffer, BufferName);
247 ErrorOr<std::unique_ptr<MemoryBuffer>>
248 MemoryBuffer::getFile(const Twine &Filename, int64_t FileSize,
254 static ErrorOr<std::unique_ptr<MemoryBuffer>>
259 static ErrorOr<std::unique_ptr<MemoryBuffer>>
267 ErrorOr<std::unique_ptr<MemoryBuffer>> Ret =
330 static ErrorOr<std::unique_ptr<MemoryBuffer>>
362 std::unique_ptr<MemoryBuffer> Result(
369 std::unique_ptr<MemoryBuffer> Buf =
370 MemoryBuffer::getNewUninitMemBuffer(MapSize, Filename);
408 ErrorOr<std::unique_ptr<MemoryBuffer>>
409 MemoryBuffer::getOpenFile(int FD, const Twine &Filename, uint64_t FileSize,
415 ErrorOr<std::unique_ptr<MemoryBuffer>>
416 MemoryBuffer::getOpenFileSlice(int FD, const Twine &Filename, uint64_t MapSize,
423 ErrorOr<std::unique_ptr<MemoryBuffer>> MemoryBuffer::getSTDIN() {
433 MemoryBufferRef MemoryBuffer::getMemBufferRef() const {