LLVM 20.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"

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.
 

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 847 of file FileSystem.h.

Constructor & Destructor Documentation

◆ TempFile()

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

Definition at line 1211 of file Path.cpp.

References llvm::Other.

◆ ~TempFile()

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

Definition at line 1224 of file Path.cpp.

References assert(), and llvm::Done.

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 1212 of file Path.cpp.

References llvm::Other.

Member Data Documentation

◆ FD

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

Definition at line 864 of file FileSystem.h.

Referenced by llvm::localCache().

◆ TmpName

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

Definition at line 861 of file FileSystem.h.

Referenced by llvm::localCache().


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