|
LLVM 24.0.0git
|
Represents a temporary file. More...
#include "llvm/Support/FileSystem.h"
Public Member Functions | |
| LLVM_ABI | TempFile (TempFile &&Other) |
| LLVM_ABI TempFile & | operator= (TempFile &&Other) |
| LLVM_ABI Error | keep (const Twine &Name) |
| LLVM_ABI std::error_code | keepWithErrorCode (const Twine &Name) |
| Same as keep(const Twine &), but reports errors as std::error_code. | |
| LLVM_ABI Error | keep () |
| LLVM_ABI Error | discard () |
| LLVM_ABI | ~TempFile () |
Static Public Member Functions | |
| static LLVM_ABI Expected< TempFile > | create (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. | |
| static LLVM_ABI ErrorOr< TempFile > | createWithErrorCode (const Twine &Model, unsigned Mode=all_read|all_write, OpenFlags ExtraFlags=OF_None) |
| Same as create(), but reports errors as std::error_code. | |
Public Attributes | |
| std::string | TmpName |
| int | FD = -1 |
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 898 of file FileSystem.h.
| llvm::sys::fs::TempFile::TempFile | ( | TempFile && | Other | ) |
Definition at line 1266 of file Path.cpp.
References llvm::Other.
| llvm::sys::fs::TempFile::~TempFile | ( | ) |
Definition at line 1279 of file Path.cpp.
References assert(), and ~TempFile().
Referenced by ~TempFile().
|
static |
This creates a temporary file with createUniqueFile and schedules it for deletion with sys::RemoveFileOnSignal.
Definition at line 630 of file OnDiskGraphDB.cpp.
References create(), llvm::sys::fs::createUniqueFile(), llvm::errorCodeToError(), and FD.
Referenced by create(), createOnDiskBuffer(), llvm::localCache(), llvm::writeArchive(), llvm::writeToOutput(), and llvm::object::writeUniversalBinary().
|
static |
Same as create(), but reports errors as std::error_code.
Definition at line 1392 of file Path.cpp.
References llvm::consumeError(), llvm::sys::fs::createUniqueFile(), createWithErrorCode(), discard(), FD, H, llvm::make_error_code(), llvm::sys::fs::OF_Delete, llvm::operation_not_permitted, and llvm::sys::RemoveFileOnSignal().
Referenced by createWithErrorCode().
| Error llvm::sys::fs::TempFile::discard | ( | ) |
Definition at line 587 of file OnDiskGraphDB.cpp.
References llvm::sys::fs::closeFile(), llvm::sys::fs::convertFDToNativeFile(), discard(), llvm::errorCodeToError(), FD, llvm::sys::fs::remove(), llvm::Error::success(), and TmpName.
Referenced by createWithErrorCode(), and discard().
| Error llvm::sys::fs::TempFile::keep | ( | ) |
Definition at line 1364 of file Path.cpp.
References assert(), llvm::sys::DontRemoveFileOnSignal(), llvm::errnoAsErrorCode(), llvm::errorCodeToError(), FD, H, keep(), llvm::Error::success(), and TmpName.
Definition at line 610 of file OnDiskGraphDB.cpp.
References assert(), llvm::sys::fs::closeFile(), llvm::sys::fs::convertFDToNativeFile(), llvm::errorCodeToError(), FD, keep(), llvm::sys::fs::rename(), and TmpName.
Same as keep(const Twine &), but reports errors as std::error_code.
Definition at line 1313 of file Path.cpp.
References assert(), llvm::sys::fs::copy_file(), llvm::sys::DontRemoveFileOnSignal(), llvm::errnoAsErrorCode(), FD, H, keepWithErrorCode(), llvm::sys::fs::remove(), llvm::sys::fs::rename(), and TmpName.
Referenced by keepWithErrorCode().
Definition at line 1267 of file Path.cpp.
References FD, operator=(), llvm::Other, and TmpName.
Referenced by operator=().
| int llvm::sys::fs::TempFile::FD = -1 |
Definition at line 919 of file FileSystem.h.
Referenced by create(), createWithErrorCode(), discard(), keep(), keep(), keepWithErrorCode(), and operator=().
| std::string llvm::sys::fs::TempFile::TmpName |
Definition at line 916 of file FileSystem.h.
Referenced by discard(), keep(), keep(), keepWithErrorCode(), and operator=().