LLVM API Documentation

Functions
MemoryBuffer.cpp File Reference
#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>
Include dependency graph for MemoryBuffer.cpp:

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)

Function Documentation

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]
static ErrorOr<std::unique_ptr<MemoryBuffer> > getMemoryBufferForStream ( int  FD,
StringRef  BufferName 
) [static]
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]
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().