LLVM API Documentation
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/Config/config.h"
#include "llvm/Support/Errc.h"
#include "llvm/Support/Errno.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/Process.h"
#include "llvm/Support/Program.h"
#include <cassert>
#include <cerrno>
#include <cstdio>
#include <cstring>
#include <new>
#include <sys/types.h>
#include <system_error>
#include <unistd.h>
Go to the source code of this file.
Functions | |
static void | CopyStringRef (char *Memory, StringRef Data) |
void * | operator new (size_t N, const NamedBufferAlloc &Alloc) |
static ErrorOr < std::unique_ptr < MemoryBuffer > > | getMemoryBufferForStream (int FD, StringRef BufferName) |
static ErrorOr < std::unique_ptr < MemoryBuffer > > | getFileAux (const char *Filename, int64_t FileSize, bool RequiresNullTerminator, bool IsVolatileSize) |
static ErrorOr < std::unique_ptr < MemoryBuffer > > | getOpenFileImpl (int FD, const char *Filename, uint64_t FileSize, uint64_t MapSize, int64_t Offset, bool RequiresNullTerminator, bool IsVolatileSize) |
static bool | shouldUseMmap (int FD, size_t FileSize, size_t MapSize, off_t Offset, bool RequiresNullTerminator, int PageSize, bool IsVolatileSize) |
static void CopyStringRef | ( | char * | Memory, |
StringRef | Data | ||
) | [static] |
CopyStringRef - Copies contents of a StringRef into a block of memory and null-terminates it.
Definition at line 60 of file MemoryBuffer.cpp.
References llvm::StringRef::data(), llvm::LibFunc::memcpy, and llvm::StringRef::size().
Referenced by llvm::MemoryBuffer::getNewUninitMemBuffer(), and operator new().
static ErrorOr< std::unique_ptr< MemoryBuffer > > getFileAux | ( | const char * | Filename, |
int64_t | FileSize, | ||
bool | RequiresNullTerminator, | ||
bool | IsVolatileSize | ||
) | [static] |
Definition at line 247 of file MemoryBuffer.cpp.
References getOpenFileImpl(), llvm::sys::fs::openFileForRead(), and llvm::MipsISD::Ret.
Referenced by llvm::MemoryBuffer::getFile().
static ErrorOr<std::unique_ptr<MemoryBuffer> > getMemoryBufferForStream | ( | int | FD, |
StringRef | BufferName | ||
) | [static] |
Definition at line 209 of file MemoryBuffer.cpp.
References llvm::SmallVectorTemplateCommon< char >::end(), llvm::MemoryBuffer::getMemBufferCopy(), llvm::LibFunc::read, llvm::SmallVectorImpl< char >::reserve(), llvm::SmallVectorImpl< char >::set_size(), and llvm::SmallVectorTemplateCommon< char >::size().
Referenced by getOpenFileImpl(), and llvm::MemoryBuffer::getSTDIN().
static ErrorOr< std::unique_ptr< MemoryBuffer > > getOpenFileImpl | ( | int | FD, |
const char * | Filename, | ||
uint64_t | FileSize, | ||
uint64_t | MapSize, | ||
int64_t | Offset, | ||
bool | RequiresNullTerminator, | ||
bool | IsVolatileSize | ||
) | [static] |
Definition at line 318 of file MemoryBuffer.cpp.
References llvm::sys::fs::block_file, llvm::sys::process::get_self(), getMemoryBufferForStream(), llvm::MemoryBuffer::getNewUninitMemBuffer(), llvm::sys::fs::file_status::getSize(), llvm::make_error_code(), llvm::LibFunc::memset, llvm::not_enough_memory, llvm::sys::self_process::page_size(), llvm::LibFunc::pread, llvm::LibFunc::read, llvm::sys::fs::regular_file, shouldUseMmap(), llvm::sys::fs::status(), and llvm::sys::fs::file_status::type().
Referenced by getFileAux(), llvm::MemoryBuffer::getOpenFile(), and llvm::MemoryBuffer::getOpenFileSlice().
void* operator new | ( | size_t | N, |
const NamedBufferAlloc & | Alloc | ||
) |
Definition at line 72 of file MemoryBuffer.cpp.
References CopyStringRef(), and operator new().
static bool shouldUseMmap | ( | int | FD, |
size_t | FileSize, | ||
size_t | MapSize, | ||
off_t | Offset, | ||
bool | RequiresNullTerminator, | ||
int | PageSize, | ||
bool | IsVolatileSize | ||
) | [static] |
Definition at line 261 of file MemoryBuffer.cpp.
References llvm::sys::fs::file_status::getSize(), and llvm::sys::fs::status().
Referenced by getOpenFileImpl().