LLVM API Documentation

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Functions
MemoryBuffer.cpp File Reference
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/ADT/OwningPtr.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/Config/config.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 "llvm/Support/system_error.h"
#include <cassert>
#include <cerrno>
#include <cstdio>
#include <cstring>
#include <new>
#include <sys/stat.h>
#include <sys/types.h>
#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 error_code getMemoryBufferForStream (int FD, StringRef BufferName, OwningPtr< MemoryBuffer > &result)
 
static error_code getFileAux (const char *Filename, OwningPtr< MemoryBuffer > &result, int64_t FileSize, bool RequiresNullTerminator)
 
static error_code getOpenFileImpl (int FD, const char *Filename, OwningPtr< MemoryBuffer > &Result, uint64_t FileSize, uint64_t MapSize, int64_t Offset, bool RequiresNullTerminator)
 
static bool shouldUseMmap (int FD, size_t FileSize, size_t MapSize, off_t Offset, bool RequiresNullTerminator, int PageSize)
 

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 68 of file MemoryBuffer.cpp.

References llvm::StringRef::data(), llvm::Intrinsic::memcpy, and llvm::StringRef::size().

Referenced by llvm::MemoryBuffer::getNewUninitMemBuffer(), and operator new().

static error_code getFileAux ( const char *  Filename,
OwningPtr< MemoryBuffer > &  result,
int64_t  FileSize,
bool  RequiresNullTerminator 
)
static

Definition at line 261 of file MemoryBuffer.cpp.

References getOpenFileImpl(), and llvm::sys::fs::openFileForRead().

Referenced by llvm::MemoryBuffer::getFile().

static error_code getMemoryBufferForStream ( int  FD,
StringRef  BufferName,
OwningPtr< MemoryBuffer > &  result 
)
static
static error_code getOpenFileImpl ( int  FD,
const char *  Filename,
OwningPtr< MemoryBuffer > &  Result,
uint64_t  FileSize,
uint64_t  MapSize,
int64_t  Offset,
bool  RequiresNullTerminator 
)
static
void* operator new ( size_t  N,
const NamedBufferAlloc &  Alloc 
)

Definition at line 80 of file MemoryBuffer.cpp.

References CopyStringRef(), and N.

static bool shouldUseMmap ( int  FD,
size_t  FileSize,
size_t  MapSize,
off_t  Offset,
bool  RequiresNullTerminator,
int  PageSize 
)
static

Definition at line 275 of file MemoryBuffer.cpp.

References llvm::sys::fs::status().

Referenced by getOpenFileImpl().