LLVM 20.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.
 
void unmap ()
 Unmap.
 
void dontNeed ()
 
size_t size () const
 
chardata () const
 
const charconst_data () const
 Get a const view of the data.
 

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 1266 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 1268 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 1304 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 1318 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 1170 of file Path.cpp.

References assert().

◆ data()

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

Definition at line 1165 of file Path.cpp.

References assert().

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

◆ dontNeed()

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

Definition at line 1328 of file FileSystem.h.

◆ operator bool()

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

Check if this is a valid mapping.

Definition at line 1321 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 1305 of file FileSystem.h.

References unmap().

◆ size()

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

Definition at line 1160 of file Path.cpp.

References assert().

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

◆ unmap()

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

Unmap.

Definition at line 1324 of file FileSystem.h.

References mapped_file_region().

Referenced by operator=().


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