summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/Path.cpp
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2018-06-05 19:58:26 +0000
committerZachary Turner <zturner@google.com>2018-06-05 19:58:26 +0000
commit8ac1c38a7216b6fac46597439d501b28a70ae34e (patch)
treef447d5bc23d43c5cc0fa587aba951944bc62a1e5 /llvm/lib/Support/Path.cpp
parent57e541e87eef1c1e49aad638f9b90484e6f8b7aa (diff)
downloadbcm5719-llvm-8ac1c38a7216b6fac46597439d501b28a70ae34e.tar.gz
bcm5719-llvm-8ac1c38a7216b6fac46597439d501b28a70ae34e.zip
[FileSystem] Remove OpenFlags param from several functions.
There was only one place in the entire codebase where a non default value was being passed, and that place was already hidden in an implementation file. So we can delete the extra parameter and all existing clients continue to work as they always have, while making the interface a bit simpler. Differential Revision: https://reviews.llvm.org/D47789 llvm-svn: 334046
Diffstat (limited to 'llvm/lib/Support/Path.cpp')
-rw-r--r--llvm/lib/Support/Path.cpp30
1 files changed, 16 insertions, 14 deletions
diff --git a/llvm/lib/Support/Path.cpp b/llvm/lib/Support/Path.cpp
index ff41dd47c42..a592ed286fe 100644
--- a/llvm/lib/Support/Path.cpp
+++ b/llvm/lib/Support/Path.cpp
@@ -169,7 +169,7 @@ static std::error_code
createUniqueEntity(const Twine &Model, int &ResultFD,
SmallVectorImpl<char> &ResultPath, bool MakeAbsolute,
unsigned Mode, FSEntity Type,
- sys::fs::OpenFlags Flags = sys::fs::F_None) {
+ sys::fs::OpenFlags Flags = sys::fs::F_RW) {
SmallString<128> ModelStorage;
Model.toVector(ModelStorage);
@@ -756,7 +756,13 @@ std::error_code getUniqueID(const Twine Path, UniqueID &Result) {
std::error_code createUniqueFile(const Twine &Model, int &ResultFd,
SmallVectorImpl<char> &ResultPath,
- unsigned Mode, sys::fs::OpenFlags Flags) {
+ unsigned Mode) {
+ return createUniqueEntity(Model, ResultFd, ResultPath, false, Mode, FS_File);
+}
+
+static std::error_code createUniqueFile(const Twine &Model, int &ResultFd,
+ SmallVectorImpl<char> &ResultPath,
+ unsigned Mode, OpenFlags Flags) {
return createUniqueEntity(Model, ResultFd, ResultPath, false, Mode, FS_File,
Flags);
}
@@ -775,32 +781,28 @@ std::error_code createUniqueFile(const Twine &Model,
static std::error_code
createTemporaryFile(const Twine &Model, int &ResultFD,
- llvm::SmallVectorImpl<char> &ResultPath, FSEntity Type,
- sys::fs::OpenFlags Flags) {
+ llvm::SmallVectorImpl<char> &ResultPath, FSEntity Type) {
SmallString<128> Storage;
StringRef P = Model.toNullTerminatedStringRef(Storage);
assert(P.find_first_of(separators(Style::native)) == StringRef::npos &&
"Model must be a simple filename.");
// Use P.begin() so that createUniqueEntity doesn't need to recreate Storage.
return createUniqueEntity(P.begin(), ResultFD, ResultPath, true,
- owner_read | owner_write, Type, Flags);
+ owner_read | owner_write, Type);
}
static std::error_code
createTemporaryFile(const Twine &Prefix, StringRef Suffix, int &ResultFD,
- llvm::SmallVectorImpl<char> &ResultPath, FSEntity Type,
- sys::fs::OpenFlags Flags = sys::fs::F_None) {
+ llvm::SmallVectorImpl<char> &ResultPath, FSEntity Type) {
const char *Middle = Suffix.empty() ? "-%%%%%%" : "-%%%%%%.";
return createTemporaryFile(Prefix + Middle + Suffix, ResultFD, ResultPath,
- Type, Flags);
+ Type);
}
std::error_code createTemporaryFile(const Twine &Prefix, StringRef Suffix,
int &ResultFD,
- SmallVectorImpl<char> &ResultPath,
- sys::fs::OpenFlags Flags) {
- return createTemporaryFile(Prefix, Suffix, ResultFD, ResultPath, FS_File,
- Flags);
+ SmallVectorImpl<char> &ResultPath) {
+ return createTemporaryFile(Prefix, Suffix, ResultFD, ResultPath, FS_File);
}
std::error_code createTemporaryFile(const Twine &Prefix, StringRef Suffix,
@@ -1177,8 +1179,8 @@ Error TempFile::keep() {
Expected<TempFile> TempFile::create(const Twine &Model, unsigned Mode) {
int FD;
SmallString<128> ResultPath;
- if (std::error_code EC = createUniqueFile(Model, FD, ResultPath, Mode,
- sys::fs::F_RW | sys::fs::F_Delete))
+ if (std::error_code EC =
+ createUniqueFile(Model, FD, ResultPath, Mode, F_Delete | F_RW))
return errorCodeToError(EC);
TempFile Ret(ResultPath, FD);
OpenPOWER on IntegriCloud