class WritableMemoryBuffer

Declaration

class WritableMemoryBuffer : public MemoryBuffer { /* full declaration omitted */ };

Description

This class is an extension of MemoryBuffer, which allows copy-on-write access to the underlying contents. It only supports creation methods that are guaranteed to produce a writable buffer. For example, mapping a file read-only is not supported.

Declared at: llvm/include/llvm/Support/MemoryBuffer.h:169

Inherits from: MemoryBuffer

Member Variables

Method Overview

  • protected WritableMemoryBuffer()
  • public MutableArrayRef<char> getBuffer()
  • public char * getBufferEnd()
  • public char * getBufferStart()
  • public static ErrorOr<std::unique_ptr<WritableMemoryBuffer>> getFile(const llvm::Twine & Filename, bool IsVolatile = false)
  • public static ErrorOr<std::unique_ptr<WritableMemoryBuffer>> getFileSlice(const llvm::Twine & Filename, uint64_t MapSize, uint64_t Offset, bool IsVolatile = false)
  • public static std::unique_ptr<WritableMemoryBuffer> getNewMemBuffer(size_t Size, const llvm::Twine & BufferName = "")
  • public static std::unique_ptr<WritableMemoryBuffer> getNewUninitMemBuffer(size_t Size, const llvm::Twine & BufferName = "")

Inherited from MemoryBuffer:

Methods

WritableMemoryBuffer()

Declared at: llvm/include/llvm/Support/MemoryBuffer.h:171

MutableArrayRef<char> getBuffer()

Declared at: llvm/include/llvm/Support/MemoryBuffer.h:186

char* getBufferEnd()

Declared at: llvm/include/llvm/Support/MemoryBuffer.h:183

char* getBufferStart()

Declared at: llvm/include/llvm/Support/MemoryBuffer.h:180

static ErrorOr<
    std::unique_ptr<WritableMemoryBuffer>>
getFile(const llvm::Twine& Filename,
        bool IsVolatile = false)

Declared at: llvm/include/llvm/Support/MemoryBuffer.h:191

Parameters

const llvm::Twine& Filename
bool IsVolatile = false

static ErrorOr<
    std::unique_ptr<WritableMemoryBuffer>>
getFileSlice(const llvm::Twine& Filename,
             uint64_t MapSize,
             uint64_t Offset,
             bool IsVolatile = false)

Description

Map a subrange of the specified file as a WritableMemoryBuffer.

Declared at: llvm/include/llvm/Support/MemoryBuffer.h:195

Parameters

const llvm::Twine& Filename
uint64_t MapSize
uint64_t Offset
bool IsVolatile = false

static std::unique_ptr<WritableMemoryBuffer>
getNewMemBuffer(
    size_t Size,
    const llvm::Twine& BufferName = "")

Description

Allocate a new zero-initialized MemoryBuffer of the specified size. Note that the caller need not initialize the memory allocated by this method. The memory is owned by the MemoryBuffer object.

Declared at: llvm/include/llvm/Support/MemoryBuffer.h:208

Parameters

size_t Size
const llvm::Twine& BufferName = ""

static std::unique_ptr<WritableMemoryBuffer>
getNewUninitMemBuffer(
    size_t Size,
    const llvm::Twine& BufferName = "")

Description

Allocate a new MemoryBuffer of the specified size that is not initialized. Note that the caller should initialize the memory allocated by this method. The memory is owned by the MemoryBuffer object.

Declared at: llvm/include/llvm/Support/MemoryBuffer.h:202

Parameters

size_t Size
const llvm::Twine& BufferName = ""