LLVM API Documentation
#include <MemoryBuffer.h>
Public Member Functions | |
| virtual | ~MemoryBuffer () |
| const char * | getBufferStart () const |
| const char * | getBufferEnd () const |
| size_t | getBufferSize () const |
| virtual const char * | getBufferIdentifier () const |
Static Public Member Functions | |
| static MemoryBuffer * | getFile (const char *Filename, std::string *ErrStr=0, int64_t FileSize=-1) |
| static MemoryBuffer * | getMemBuffer (const char *StartPtr, const char *EndPtr, const char *BufferName="") |
| static MemoryBuffer * | getMemBufferCopy (const char *StartPtr, const char *EndPtr, const char *BufferName="") |
| static MemoryBuffer * | getNewMemBuffer (size_t Size, const char *BufferName="") |
| static MemoryBuffer * | getNewUninitMemBuffer (size_t Size, const char *BufferName="") |
| static MemoryBuffer * | getSTDIN () |
| static MemoryBuffer * | getFileOrSTDIN (const char *Filename, std::string *ErrStr=0, int64_t FileSize=-1) |
| static MemoryBuffer * | getFileOrSTDIN (const std::string &FN, std::string *ErrStr=0, int64_t FileSize=-1) |
Protected Member Functions | |
| MemoryBuffer () | |
| void | init (const char *BufStart, const char *BufEnd) |
| void | initCopyOf (const char *BufStart, const char *BufEnd) |
the file, and that this character will read as '\0'.
Definition at line 27 of file MemoryBuffer.h.
| llvm::MemoryBuffer::MemoryBuffer | ( | ) | [inline, protected] |
Definition at line 35 of file MemoryBuffer.h.
| MemoryBuffer::~MemoryBuffer | ( | ) | [virtual] |
Definition at line 39 of file MemoryBuffer.cpp.
| void MemoryBuffer::init | ( | const char * | BufStart, | |
| const char * | BufEnd | |||
| ) | [protected] |
init - Initialize this MemoryBuffer as a reference to externally allocated memory, memory that we know is already null terminated.
Definition at line 58 of file MemoryBuffer.cpp.
| void MemoryBuffer::initCopyOf | ( | const char * | BufStart, | |
| const char * | BufEnd | |||
| ) | [protected] |
initCopyOf - Initialize this source buffer with a copy of the specified memory range. We make the copy so that we can null terminate it successfully.
Definition at line 47 of file MemoryBuffer.cpp.
References llvm::Intrinsic::memcpy.
Referenced by getSTDIN().
| const char* llvm::MemoryBuffer::getBufferStart | ( | ) | const [inline] |
Definition at line 41 of file MemoryBuffer.h.
Referenced by llvm::LLLexer::Error(), llvm::Archive::findModuleDefiningSymbol(), llvm::Archive::getAllModules(), llvm::GetBitcodeSymbols(), getNewMemBuffer(), llvm::Archive::isBitcodeArchive(), llvm::LLLexer::LLLexer(), llvm::Archive::mapToMemory(), llvm::BitcodeReader::ParseBitcode(), and llvm::Archive::writeMember().
| const char* llvm::MemoryBuffer::getBufferEnd | ( | ) | const [inline] |
Definition at line 42 of file MemoryBuffer.h.
Referenced by llvm::LLLexer::Error(), llvm::Archive::findModuleDefiningSymbol(), llvm::Archive::findModulesDefiningSymbols(), llvm::Archive::loadArchive(), and llvm::Archive::loadSymbolTable().
| size_t llvm::MemoryBuffer::getBufferSize | ( | ) | const [inline] |
Definition at line 43 of file MemoryBuffer.h.
Referenced by llvm::Archive::checkSignature(), llvm::BitcodeReader::ParseBitcode(), llvm::Archive::writeMember(), and llvm::Archive::writeToDisk().
| virtual const char* llvm::MemoryBuffer::getBufferIdentifier | ( | ) | const [inline, virtual] |
getBufferIdentifier - Return an identifier for this buffer, typically the filename it was read from.
Definition at line 47 of file MemoryBuffer.h.
Referenced by llvm::LLLexer::getFilename(), and llvm::BitcodeReader::ParseBitcode().
| MemoryBuffer * MemoryBuffer::getFile | ( | const char * | Filename, | |
| std::string * | ErrStr = 0, |
|||
| int64_t | FileSize = -1 | |||
| ) | [static] |
getFile - Open the specified file as a MemoryBuffer, returning a new MemoryBuffer if successful, otherwise returning null. If FileSize is specified, this means that the client knows that the file exists and that it has the specified size.
Definition at line 174 of file MemoryBuffer.cpp.
References getNewUninitMemBuffer(), llvm::sys::Process::GetPageSize(), llvm::sys::Path::MapInFilePages(), llvm::OwningPtr< T >::reset(), and llvm::OwningPtr< T >::take().
Referenced by llvm::DiffFilesWithTolerance(), ExpandResponseFiles(), getFileOrSTDIN(), llvm::Archive::mapToMemory(), llvm::Archive::writeMember(), and llvm::Archive::writeToDisk().
| MemoryBuffer * MemoryBuffer::getMemBuffer | ( | const char * | StartPtr, | |
| const char * | EndPtr, | |||
| const char * | BufferName = "" | |||
| ) | [static] |
getMemBuffer - Open the specified memory range as a MemoryBuffer. Note that EndPtr[0] must be a null byte and be accessible!
getMemBuffer - Open the specified memory range as a MemoryBuffer. Note that EndPtr[0] must be a null byte and be accessible!
Definition at line 90 of file MemoryBuffer.cpp.
Referenced by getFileOrSTDIN(), llvm::ParseAssemblyString(), and llvm::SourceFile::SourceFile().
| MemoryBuffer * MemoryBuffer::getMemBufferCopy | ( | const char * | StartPtr, | |
| const char * | EndPtr, | |||
| const char * | BufferName = "" | |||
| ) | [static] |
getMemBufferCopy - Open the specified memory range as a MemoryBuffer, copying the contents and taking ownership of it. This has no requirements on EndPtr[0].
getMemBufferCopy - Open the specified memory range as a MemoryBuffer, copying the contents and taking ownership of it. This has no requirements on EndPtr[0].
Definition at line 99 of file MemoryBuffer.cpp.
| MemoryBuffer * MemoryBuffer::getNewMemBuffer | ( | size_t | Size, | |
| const char * | BufferName = "" | |||
| ) | [static] |
getNewMemBuffer - Allocate a new MemoryBuffer of the specified size that is completely initialized to zeros. Note that the caller should initialize the memory allocated by this method. The memory is owned by the MemoryBuffer object.
getNewMemBuffer - Allocate a new MemoryBuffer of the specified size that is completely initialized to zeros. Note that the caller should initialize the memory allocated by this method. The memory is owned by the MemoryBuffer object.
Definition at line 123 of file MemoryBuffer.cpp.
References getBufferStart(), getNewUninitMemBuffer(), and llvm::Intrinsic::memset.
Referenced by llvm::Archive::findModuleDefiningSymbol(), llvm::Archive::getAllModules(), llvm::GetBitcodeSymbols(), and llvm::Archive::isBitcodeArchive().
| MemoryBuffer * MemoryBuffer::getNewUninitMemBuffer | ( | size_t | Size, | |
| const char * | BufferName = "" | |||
| ) | [static] |
getNewUninitMemBuffer - 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.
getNewUninitMemBuffer - Allocate a new MemoryBuffer of the specified size that is completely initialized to zeros. Note that the caller should initialize the memory allocated by this method. The memory is owned by the MemoryBuffer object.
Definition at line 109 of file MemoryBuffer.cpp.
Referenced by getFile(), and getNewMemBuffer().
| MemoryBuffer * MemoryBuffer::getSTDIN | ( | ) | [static] |
getSTDIN - Read all of stdin into a file buffer, and return it. This returns null if stdin is empty.
Definition at line 250 of file MemoryBuffer.cpp.
References llvm::sys::Program::ChangeStdinToBinary(), and initCopyOf().
Referenced by getFileOrSTDIN(), and llvm::Linker::LinkInFile().
| MemoryBuffer * MemoryBuffer::getFileOrSTDIN | ( | const char * | Filename, | |
| std::string * | ErrStr = 0, |
|||
| int64_t | FileSize = -1 | |||
| ) | [static] |
getFileOrSTDIN - Open the specified file as a MemoryBuffer, or open stdin if the Filename is "-". If an error occurs, this returns null and fills in *ErrStr with a reason. If stdin is empty, this API (unlike getSTDIN) returns an empty buffer.
getFileOrSTDIN - Open the specified file as a MemoryBuffer, or open stdin if the Filename is "-". If an error occurs, this returns null and fills in *ErrStr with a reason. If stdin is empty, this API (unlike getSTDIN) returns an empty buffer.
Definition at line 135 of file MemoryBuffer.cpp.
References getFile(), getMemBuffer(), getSTDIN(), and M.
Referenced by llvm::GetBitcodeSymbols(), getFileOrSTDIN(), getMaterializedModuleProvider(), llvm::ParseAssemblyFile(), and llvm::SourceFile::SourceFile().
| static MemoryBuffer* llvm::MemoryBuffer::getFileOrSTDIN | ( | const std::string & | FN, | |
| std::string * | ErrStr = 0, |
|||
| int64_t | FileSize = -1 | |||
| ) | [inline, static] |
getFileOrSTDIN - Open the specified file as a MemoryBuffer, or open stdin if the Filename is "-". If an error occurs, this returns null and fills in *ErrStr with a reason.
Definition at line 100 of file MemoryBuffer.h.
References getFileOrSTDIN().