LLVM: include/llvm/Support/FileUtilities.h Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
14#ifndef LLVM_SUPPORT_FILEUTILITIES_H
15#define LLVM_SUPPORT_FILEUTILITIES_H
16
21
22#include <system_error>
23
24namespace llvm {
25
26
27
28
29
30
31
32
34 double AbsTol, double RelTol,
35 std::string *Error = nullptr);
36
37
38
39
40
43 bool DeleteIt;
44
45public:
47
49 : DeleteIt(deleteIt) {
50 filename.toVector(Filename);
51 }
52
54 if (DeleteIt) {
55
57 }
58 }
59
60
61
62
63 void setFile(const Twine &filename, bool deleteIt = true) {
64 if (DeleteIt) {
65
67 }
68
69 Filename.clear();
70 filename.toVector(Filename);
71 DeleteIt = deleteIt;
72 }
73
74
75
77};
78
79
80
81
82class FilePermissionsApplier {
83public:
86
87
88
89
92 std::optionalsys::fs::perms OverwritePermissions = std::nullopt);
93
94private:
97
100};
101}
102
103#endif
static cl::opt< std::string > OutputFilename("o", cl::desc("Output filename"), cl::value_desc("filename"), cl::init("-"))
static cl::opt< std::string > InputFilename(cl::Positional, cl::desc(""), cl::init("-"))
Lightweight error class with error context and mandatory checking.
Tagged union holding either a T or a Error.
LLVM_ABI Error apply(StringRef OutputFilename, bool CopyDates=false, std::optional< sys::fs::perms > OverwritePermissions=std::nullopt)
Apply stored permissions to the OutputFilename.
static LLVM_ABI Expected< FilePermissionsApplier > create(StringRef InputFilename)
FileRemover(const Twine &filename, bool deleteIt=true)
Definition FileUtilities.h:48
FileRemover()
Definition FileUtilities.h:46
void setFile(const Twine &filename, bool deleteIt=true)
setFile - Give ownership of the file to the FileRemover so it will be removed when the object is dest...
Definition FileUtilities.h:63
void releaseFile()
releaseFile - Take ownership of the file away from the FileRemover so it will not be removed when the...
Definition FileUtilities.h:76
~FileRemover()
Definition FileUtilities.h:53
SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...
StringRef - Represent a constant reference to a string, i.e.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Represents the result of a call to sys::fs::status().
LLVM_ABI std::error_code remove(const Twine &path, bool IgnoreNonExisting=true)
Remove path.
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ABI int DiffFilesWithTolerance(StringRef FileA, StringRef FileB, double AbsTol, double RelTol, std::string *Error=nullptr)
DiffFilesWithTolerance - Compare the two files specified, returning 0 if the files match,...