LLVM  16.0.0git
Public Member Functions | List of all members
llvm::SmallVectorMemoryBuffer Class Reference

SmallVector-backed MemoryBuffer instance. More...

#include "llvm/Support/SmallVectorMemoryBuffer.h"

Inheritance diagram for llvm::SmallVectorMemoryBuffer:
Inheritance graph
[legend]
Collaboration diagram for llvm::SmallVectorMemoryBuffer:
Collaboration graph
[legend]

Public Member Functions

 SmallVectorMemoryBuffer (SmallVectorImpl< char > &&SV, bool RequiresNullTerminator=true)
 Construct a SmallVectorMemoryBuffer from the given SmallVector r-value. More...
 
 SmallVectorMemoryBuffer (SmallVectorImpl< char > &&SV, StringRef Name, bool RequiresNullTerminator=true)
 Construct a named SmallVectorMemoryBuffer from the given SmallVector r-value and StringRef. More...
 
 ~SmallVectorMemoryBuffer () override
 
StringRef getBufferIdentifier () const override
 Return an identifier for this buffer, typically the filename it was read from. More...
 
BufferKind getBufferKind () const override
 Return information on the memory mechanism used to support the MemoryBuffer. More...
 
- Public Member Functions inherited from llvm::MemoryBuffer
 MemoryBuffer (const MemoryBuffer &)=delete
 
MemoryBufferoperator= (const MemoryBuffer &)=delete
 
virtual ~MemoryBuffer ()
 
const char * getBufferStart () const
 
const char * getBufferEnd () const
 
size_t getBufferSize () const
 
StringRef getBuffer () const
 
virtual void dontNeedIfMmap ()
 For read-only MemoryBuffer_MMap, mark the buffer as unused in the near future and the kernel can free resources associated with it. More...
 
MemoryBufferRef getMemBufferRef () const
 

Additional Inherited Members

- Public Types inherited from llvm::MemoryBuffer
enum  BufferKind { MemoryBuffer_Malloc, MemoryBuffer_MMap }
 The kind of memory backing used to support the MemoryBuffer. More...
 
- Static Public Member Functions inherited from llvm::MemoryBuffer
static ErrorOr< std::unique_ptr< MemoryBuffer > > getFile (const Twine &Filename, bool IsText=false, bool RequiresNullTerminator=true, bool IsVolatile=false, Optional< Align > Alignment=None)
 Open the specified file as a MemoryBuffer, returning a new MemoryBuffer if successful, otherwise returning null. More...
 
static ErrorOr< std::unique_ptr< MemoryBuffer > > getFileAsStream (const Twine &Filename)
 Read all of the specified file into a MemoryBuffer as a stream (i.e. More...
 
static ErrorOr< std::unique_ptr< MemoryBuffer > > getOpenFileSlice (sys::fs::file_t FD, const Twine &Filename, uint64_t MapSize, int64_t Offset, bool IsVolatile=false, Optional< Align > Alignment=None)
 Given an already-open file descriptor, map some slice of it into a MemoryBuffer. More...
 
static ErrorOr< std::unique_ptr< MemoryBuffer > > getOpenFile (sys::fs::file_t FD, const Twine &Filename, uint64_t FileSize, bool RequiresNullTerminator=true, bool IsVolatile=false, Optional< Align > Alignment=None)
 Given an already-open file descriptor, read the file and return a MemoryBuffer. More...
 
static std::unique_ptr< MemoryBuffergetMemBuffer (StringRef InputData, StringRef BufferName="", bool RequiresNullTerminator=true)
 Open the specified memory range as a MemoryBuffer. More...
 
static std::unique_ptr< MemoryBuffergetMemBuffer (MemoryBufferRef Ref, bool RequiresNullTerminator=true)
 
static std::unique_ptr< MemoryBuffergetMemBufferCopy (StringRef InputData, const Twine &BufferName="")
 Open the specified memory range as a MemoryBuffer, copying the contents and taking ownership of it. More...
 
static ErrorOr< std::unique_ptr< MemoryBuffer > > getSTDIN ()
 Read all of stdin into a file buffer, and return it. More...
 
static ErrorOr< std::unique_ptr< MemoryBuffer > > getFileOrSTDIN (const Twine &Filename, bool IsText=false, bool RequiresNullTerminator=true, Optional< Align > Alignment=None)
 Open the specified file as a MemoryBuffer, or open stdin if the Filename is "-". More...
 
static ErrorOr< std::unique_ptr< MemoryBuffer > > getFileSlice (const Twine &Filename, uint64_t MapSize, uint64_t Offset, bool IsVolatile=false, Optional< Align > Alignment=None)
 Map a subrange of the specified file as a MemoryBuffer. More...
 
- Protected Member Functions inherited from llvm::MemoryBuffer
 MemoryBuffer ()=default
 
void init (const char *BufStart, const char *BufEnd, bool RequiresNullTerminator)
 init - Initialize this MemoryBuffer as a reference to externally allocated memory, memory that we know is already null terminated. More...
 

Detailed Description

SmallVector-backed MemoryBuffer instance.

This class enables efficient construction of MemoryBuffers from SmallVector instances. This is useful for MCJIT and Orc, where object files are streamed into SmallVectors, then inspected using ObjectFile (which takes a MemoryBuffer).

Definition at line 29 of file SmallVectorMemoryBuffer.h.

Constructor & Destructor Documentation

◆ SmallVectorMemoryBuffer() [1/2]

llvm::SmallVectorMemoryBuffer::SmallVectorMemoryBuffer ( SmallVectorImpl< char > &&  SV,
bool  RequiresNullTerminator = true 
)
inline

Construct a SmallVectorMemoryBuffer from the given SmallVector r-value.

Definition at line 32 of file SmallVectorMemoryBuffer.h.

◆ SmallVectorMemoryBuffer() [2/2]

llvm::SmallVectorMemoryBuffer::SmallVectorMemoryBuffer ( SmallVectorImpl< char > &&  SV,
StringRef  Name,
bool  RequiresNullTerminator = true 
)
inline

Construct a named SmallVectorMemoryBuffer from the given SmallVector r-value and StringRef.

Definition at line 39 of file SmallVectorMemoryBuffer.h.

References llvm::MemoryBuffer::init(), string, and this.

◆ ~SmallVectorMemoryBuffer()

SmallVectorMemoryBuffer::~SmallVectorMemoryBuffer ( )
overridedefault

Member Function Documentation

◆ getBufferIdentifier()

StringRef llvm::SmallVectorMemoryBuffer::getBufferIdentifier ( ) const
inlineoverridevirtual

Return an identifier for this buffer, typically the filename it was read from.

Reimplemented from llvm::MemoryBuffer.

Definition at line 52 of file SmallVectorMemoryBuffer.h.

◆ getBufferKind()

BufferKind llvm::SmallVectorMemoryBuffer::getBufferKind ( ) const
inlineoverridevirtual

Return information on the memory mechanism used to support the MemoryBuffer.

Implements llvm::MemoryBuffer.

Definition at line 54 of file SmallVectorMemoryBuffer.h.

References llvm::MemoryBuffer::MemoryBuffer_Malloc.


The documentation for this class was generated from the following files: