LLVM 22.0.0git
llvm::sys::fs::TempFile Class Reference

Represents a temporary file. More...

#include "llvm/Support/FileSystem.h"

Public Member Functions

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

Static Public Member Functions

static LLVM_ABI 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 857 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 ~TempFile().

Referenced by ~TempFile().

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]

◆ operator=()

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

Definition at line 1212 of file Path.cpp.

References FD, operator=(), llvm::Other, and TmpName.

Referenced by operator=().

Member Data Documentation

◆ FD

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

Definition at line 874 of file FileSystem.h.

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

◆ TmpName

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

Definition at line 871 of file FileSystem.h.

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


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