LLVM  14.0.0git
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
llvm::sys::fs::TempFile Class Reference

Represents a temporary file. More...

#include "llvm/Support/FileSystem.h"

Collaboration diagram for llvm::sys::fs::TempFile:
Collaboration graph
[legend]

Public Member Functions

 TempFile (TempFile &&Other)
 
TempFileoperator= (TempFile &&Other)
 
Error keep (const Twine &Name)
 
Error keep ()
 
Error discard ()
 
 ~TempFile ()
 

Static Public Member Functions

static Expected< TempFilecreate (const Twine &Model, unsigned Mode=all_read|all_write, OpenFlags ExtraFlags=OF_None)
 This creates a temporary file with createUniqueFile and schedules it for deletion with sys::RemoveFileOnSignal. More...
 

Public Attributes

std::string TmpName
 
int FD = -1
 

Detailed Description

Represents a temporary file.

The temporary file must be eventually discarded or given a final name and kept.

The destructor doesn't implicitly discard because there is no way to properly handle errors in a destructor.

Definition at line 849 of file FileSystem.h.

Constructor & Destructor Documentation

◆ TempFile()

llvm::sys::fs::TempFile::TempFile ( TempFile &&  Other)

Definition at line 1187 of file Path.cpp.

References move, and Other.

◆ ~TempFile()

llvm::sys::fs::TempFile::~TempFile ( )

Definition at line 1196 of file Path.cpp.

References assert().

Member Function Documentation

◆ create()

Expected< TempFile > llvm::sys::fs::TempFile::create ( const Twine Model,
unsigned  Mode = all_read | all_write,
OpenFlags  ExtraFlags = OF_None 
)
static

◆ discard()

Error llvm::sys::fs::TempFile::discard ( )

◆ keep() [1/2]

Error llvm::sys::fs::TempFile::keep ( )

◆ keep() [2/2]

Error llvm::sys::fs::TempFile::keep ( const Twine Name)

◆ operator=()

TempFile & llvm::sys::fs::TempFile::operator= ( TempFile &&  Other)

Definition at line 1188 of file Path.cpp.

References FD, move, Other, and TmpName.

Member Data Documentation

◆ FD

int llvm::sys::fs::TempFile::FD = -1

Definition at line 866 of file FileSystem.h.

Referenced by create(), discard(), keep(), llvm::lto::localCache(), and operator=().

◆ TmpName

std::string llvm::sys::fs::TempFile::TmpName

Definition at line 863 of file FileSystem.h.

Referenced by discard(), keep(), llvm::lto::localCache(), and operator=().


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