diff options
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Support/FileOutputBuffer.cpp | 4 | ||||
-rw-r--r-- | llvm/lib/Support/LockFileManager.cpp | 7 | ||||
-rw-r--r-- | llvm/lib/Support/Path.cpp | 11 |
3 files changed, 16 insertions, 6 deletions
diff --git a/llvm/lib/Support/FileOutputBuffer.cpp b/llvm/lib/Support/FileOutputBuffer.cpp index 1ee69b60234..fbfda317e75 100644 --- a/llvm/lib/Support/FileOutputBuffer.cpp +++ b/llvm/lib/Support/FileOutputBuffer.cpp @@ -65,8 +65,8 @@ error_code FileOutputBuffer::create(StringRef FilePath, // Create new file in same directory but with random name. SmallString<128> TempFilePath; int FD; - EC = sys::fs::unique_file(Twine(FilePath) + ".tmp%%%%%%%", - FD, TempFilePath, false, 0644); + EC = sys::fs::createUniqueFile(Twine(FilePath) + ".tmp%%%%%%%", + FD, TempFilePath); if (EC) return EC; diff --git a/llvm/lib/Support/LockFileManager.cpp b/llvm/lib/Support/LockFileManager.cpp index 2917e273bce..21c4d4070d2 100644 --- a/llvm/lib/Support/LockFileManager.cpp +++ b/llvm/lib/Support/LockFileManager.cpp @@ -78,10 +78,9 @@ LockFileManager::LockFileManager(StringRef FileName) UniqueLockFileName += "-%%%%%%%%"; int UniqueLockFileID; if (error_code EC - = sys::fs::unique_file(UniqueLockFileName.str(), - UniqueLockFileID, - UniqueLockFileName, - /*makeAbsolute=*/false)) { + = sys::fs::createUniqueFile(UniqueLockFileName.str(), + UniqueLockFileID, + UniqueLockFileName)) { Error = EC; return; } diff --git a/llvm/lib/Support/Path.cpp b/llvm/lib/Support/Path.cpp index 36fb9f3a4bf..58c7c96c662 100644 --- a/llvm/lib/Support/Path.cpp +++ b/llvm/lib/Support/Path.cpp @@ -654,6 +654,17 @@ error_code unique_file(const Twine &Model, SmallVectorImpl<char> &ResultPath, return createUniqueEntity(Model, Dummy, ResultPath, MakeAbsolute, 0, FS_Name); } +error_code createUniqueFile(const Twine &Model, int &ResultFd, + SmallVectorImpl<char> &ResultPath, unsigned Mode) { + return createUniqueEntity(Model, ResultFd, ResultPath, false, Mode, FS_File); +} + +error_code createUniqueFile(const Twine &Model, + SmallVectorImpl<char> &ResultPath) { + int Dummy; + return createUniqueEntity(Model, Dummy, ResultPath, false, 0, FS_Name); +} + static error_code createTemporaryFile(const Twine &Model, int &ResultFD, llvm::SmallVectorImpl<char> &ResultPath, FSEntity Type) { |