LLVM  13.0.0git
Public Types | Public Member Functions | Static Public Member Functions | List of all members
llvm::sys::fs::mapped_file_region Class Reference

This class represents a memory mapped file. More...

#include "llvm/Support/FileSystem.h"

Public Types

enum  mapmode { readonly, readwrite, priv }
 

Public Member Functions

 mapped_file_region ()=default
 
 mapped_file_region (mapped_file_region &&Moved)
 
mapped_file_regionoperator= (mapped_file_region &&Moved)
 
 mapped_file_region (const mapped_file_region &)=delete
 
mapped_file_regionoperator= (const mapped_file_region &)=delete
 
 mapped_file_region (sys::fs::file_t fd, mapmode mode, size_t length, uint64_t offset, std::error_code &ec)
 
 ~mapped_file_region ()
 
 operator bool () const
 Check if this is a valid mapping. More...
 
void unmap ()
 Unmap. More...
 
size_t size () const
 
char * data () const
 
const char * const_data () const
 Get a const view of the data. More...
 

Static Public Member Functions

static int alignment ()
 

Detailed Description

This class represents a memory mapped file.

It is based on boost::iostreams::mapped_file.

Definition at line 1244 of file FileSystem.h.

Member Enumeration Documentation

◆ mapmode

Enumerator
readonly 

May only access map via const_data as read only.

readwrite 

May access map via data and modify it. Written to path.

priv 

May modify via data, but changes are lost on destruction.

Definition at line 1246 of file FileSystem.h.

Constructor & Destructor Documentation

◆ mapped_file_region() [1/4]

llvm::sys::fs::mapped_file_region::mapped_file_region ( )
default

Referenced by unmap().

◆ mapped_file_region() [2/4]

llvm::sys::fs::mapped_file_region::mapped_file_region ( mapped_file_region &&  Moved)
inline

Definition at line 1281 of file FileSystem.h.

◆ mapped_file_region() [3/4]

llvm::sys::fs::mapped_file_region::mapped_file_region ( const mapped_file_region )
delete

◆ mapped_file_region() [4/4]

llvm::sys::fs::mapped_file_region::mapped_file_region ( sys::fs::file_t  fd,
mapmode  mode,
size_t  length,
uint64_t  offset,
std::error_code &  ec 
)
Parameters
fdAn open file descriptor to map. Does not take ownership of fd.

◆ ~mapped_file_region()

llvm::sys::fs::mapped_file_region::~mapped_file_region ( )
inline

Definition at line 1295 of file FileSystem.h.

Member Function Documentation

◆ alignment()

static int llvm::sys::fs::mapped_file_region::alignment ( )
static
Returns
The minimum alignment offset must be.

◆ const_data()

const char * llvm::sys::fs::mapped_file_region::const_data ( ) const

Get a const view of the data.

Modifying this memory has undefined behavior.

Definition at line 1165 of file Path.cpp.

References assert().

◆ data()

char * llvm::sys::fs::mapped_file_region::data ( ) const

Definition at line 1160 of file Path.cpp.

References assert().

Referenced by llvm::xray::loadProfile(), llvm::xray::loadTraceFile(), and loadYAML().

◆ operator bool()

llvm::sys::fs::mapped_file_region::operator bool ( ) const
inlineexplicit

Check if this is a valid mapping.

Definition at line 1298 of file FileSystem.h.

◆ operator=() [1/2]

mapped_file_region& llvm::sys::fs::mapped_file_region::operator= ( const mapped_file_region )
delete

◆ operator=() [2/2]

mapped_file_region& llvm::sys::fs::mapped_file_region::operator= ( mapped_file_region &&  Moved)
inline

Definition at line 1282 of file FileSystem.h.

References unmap().

◆ size()

size_t llvm::sys::fs::mapped_file_region::size ( ) const

Definition at line 1155 of file Path.cpp.

References assert(), and llvm::Check::Size.

Referenced by llvm::xray::loadProfile(), llvm::xray::loadTraceFile(), and loadYAML().

◆ unmap()

void llvm::sys::fs::mapped_file_region::unmap ( )
inline

Unmap.

Definition at line 1301 of file FileSystem.h.

References mapped_file_region().

Referenced by operator=().


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