TempPath = File;
TempPath += "-%%%%%%%%";
int fd;
- if (llvm::sys::fs::unique_file(TempPath.str(), fd, TempPath,
- /*makeAbsolute=*/false))
+ if (llvm::sys::fs::createUniqueFile(TempPath.str(), fd, TempPath))
return true;
// FIXME: Can we somehow regenerate the stat cache here, or do we need to
TempPath = OutFile;
TempPath += "-%%%%%%%%";
int fd;
- llvm::error_code EC = llvm::sys::fs::unique_file(
- TempPath.str(), fd, TempPath, /*makeAbsolute=*/ false, 0664);
+ llvm::error_code EC =
+ llvm::sys::fs::createUniqueFile(TempPath.str(), fd, TempPath);
if (CreateMissingDirectories &&
EC == llvm::errc::no_such_file_or_directory) {
StringRef Parent = llvm::sys::path::parent_path(OutputPath);
EC = llvm::sys::fs::create_directories(Parent);
if (!EC) {
- EC = llvm::sys::fs::unique_file(TempPath.str(), fd, TempPath,
- /*makeAbsolute=*/ false, 0664);
+ EC = llvm::sys::fs::createUniqueFile(TempPath.str(), fd, TempPath);
}
}
TempFilename = Filename;
TempFilename += "-%%%%%%%%";
int FD;
- if (llvm::sys::fs::unique_file(TempFilename.str(), FD, TempFilename,
- /*makeAbsolute=*/true, 0664)) {
+ if (llvm::sys::fs::createUniqueFile(TempFilename.str(), FD, TempFilename)) {
AllWritten = false;
Diagnostics.Report(clang::diag::err_unable_to_make_temp)
<< TempFilename;
// Write the global index file to a temporary file.
llvm::SmallString<128> IndexTmpPath;
int TmpFD;
- if (llvm::sys::fs::unique_file(IndexPath + "-%%%%%%%%", TmpFD, IndexTmpPath))
+ if (llvm::sys::fs::createUniqueFile(IndexPath + "-%%%%%%%%", TmpFD,
+ IndexTmpPath))
return EC_IOError;
// Open the temporary global index file for output.
SmallString<128> Model, ResultPath;
llvm::sys::path::append(Model, Directory, "report-%%%%%%.html");
- if (llvm::error_code EC = llvm::sys::fs::unique_file(
- Model.str(), FD, ResultPath, false,
- llvm::sys::fs::all_read | llvm::sys::fs::all_write)) {
+ if (llvm::error_code EC =
+ llvm::sys::fs::createUniqueFile(Model.str(), FD, ResultPath)) {
llvm::errs() << "warning: could not create file in '" << Directory
<< "': " << EC.message() << '\n';
return;
--- /dev/null
+// REQUIRES: shell
+
+// RUN: umask 000
+// RUN: %clang_cc1 -emit-llvm-bc %s -o %t
+// RUN: ls -l %t | FileCheck --check-prefix=CHECK000 %s
+// CHECK000: rw-rw-rw-
+
+// RUN: umask 002
+// RUN: %clang_cc1 -emit-llvm-bc %s -o %t
+// RUN: ls -l %t | FileCheck --check-prefix=CHECK002 %s
+// CHECK002: rw-rw-r--