Index: clang-tools-extra/clang-move/tool/ClangMoveMain.cpp =================================================================== --- clang-tools-extra/clang-move/tool/ClangMoveMain.cpp +++ clang-tools-extra/clang-move/tool/ClangMoveMain.cpp @@ -30,8 +30,8 @@ std::error_code CreateNewFile(const llvm::Twine &path) { int fd = 0; - if (std::error_code ec = - llvm::sys::fs::openFileForWrite(path, fd, llvm::sys::fs::F_Text)) + if (std::error_code ec = llvm::sys::fs::openFileDescriptorForWrite( + path, fd, llvm::sys::fs::F_Text)) return ec; return llvm::sys::Process::SafelyCloseFileDescriptor(fd); Index: clang/lib/Basic/VirtualFileSystem.cpp =================================================================== --- clang/lib/Basic/VirtualFileSystem.cpp +++ clang/lib/Basic/VirtualFileSystem.cpp @@ -258,7 +258,8 @@ RealFileSystem::openFileForRead(const Twine &Name) { int FD; SmallString<256> RealName; - if (std::error_code EC = sys::fs::openFileForRead(Name, FD, &RealName)) + if (std::error_code EC = + sys::fs::openFileDescriptorForRead(Name, FD, &RealName)) return EC; return std::unique_ptr(new RealFile(FD, Name.str(), RealName.str())); } Index: clang/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp =================================================================== --- clang/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp +++ clang/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp @@ -238,10 +238,8 @@ << "-" << i << ".html"; llvm::sys::path::append(Model, Directory, filename.str()); - EC = llvm::sys::fs::openFileForWrite(Model, - FD, - llvm::sys::fs::F_RW | - llvm::sys::fs::F_Excl); + EC = llvm::sys::fs::openFileDescriptorForWrite( + Model, FD, llvm::sys::fs::F_RW | llvm::sys::fs::F_Excl); if (EC && EC != llvm::errc::file_exists) { llvm::errs() << "warning: could not create file '" << Model << "': " << EC.message() << '\n'; Index: lld/ELF/Filesystem.cpp =================================================================== --- lld/ELF/Filesystem.cpp +++ lld/ELF/Filesystem.cpp @@ -56,7 +56,7 @@ // Instead we open the file and unlink it on this thread. The unlink is fast // since the open fd guarantees that it is not removing the last reference. int FD; - std::error_code EC = sys::fs::openFileForRead(Path, FD); + std::error_code EC = sys::fs::openFileDescriptorForRead(Path, FD); sys::fs::remove(Path); // close and therefore remove TempPath in background. Index: lldb/source/Core/Debugger.cpp =================================================================== --- lldb/source/Core/Debugger.cpp +++ lldb/source/Core/Debugger.cpp @@ -1242,7 +1242,7 @@ flags |= llvm::sys::fs::F_Append; int FD; if (std::error_code ec = - llvm::sys::fs::openFileForWrite(log_file, FD, flags)) { + llvm::sys::fs::openFileDescriptorForWrite(log_file, FD, flags)) { error_stream << "Unable to open log file: " << ec.message(); return false; } Index: llvm/include/llvm/Support/FileSystem.h =================================================================== --- llvm/include/llvm/Support/FileSystem.h +++ llvm/include/llvm/Support/FileSystem.h @@ -841,15 +841,16 @@ /// @param Mode The access permissions of the file, represented in octal. /// @returns errc::success if \a Name has been opened, otherwise a /// platform-specific error_code. -std::error_code openFileForWrite(const Twine &Name, int &ResultFD, - OpenFlags Flags, unsigned Mode = 0666); +std::error_code openFileDescriptorForWrite(const Twine &Name, int &ResultFD, + OpenFlags Flags, + unsigned Mode = 0666); /// @brief Opens the file with the given name in a write-only or read-write -/// mode, returning its open file descriptor. If the file does not exist, it -/// is created. +/// mode, returning either a native file object, or an error. If the file does +/// not exist, it is created. /// /// The caller is responsible for closing the freeing the file once they are -/// finished with it. +/// finished with it by using the `closeFile` function. /// /// @param Name The path of the file to open, relative or absolute. /// @param Flags Additional flags used to determine whether the file should be @@ -857,8 +858,8 @@ /// @param Mode The access permissions of the file, represented in octal. /// @returns a platform-specific file descriptor if \a Name has been opened, /// otherwise an error object. -Expected openNativeFileForWrite(const Twine &Name, OpenFlags Flags, - unsigned Mode = 0666); +Expected openFileForWrite(const Twine &Name, OpenFlags Flags, + unsigned Mode = 0666); /// @brief Opens the file with the given name in a read-only mode, returning /// its open file descriptor. @@ -874,14 +875,15 @@ /// location. /// @returns errc::success if \a Name has been opened, otherwise a /// platform-specific error_code. -std::error_code openFileForRead(const Twine &Name, int &ResultFD, - SmallVectorImpl *RealPath = nullptr); +std::error_code +openFileDescriptorForRead(const Twine &Name, int &ResultFD, + SmallVectorImpl *RealPath = nullptr); /// @brief Opens the file with the given name in a read-only mode, returning -/// its open file descriptor. +/// either a native file object, or an error. /// /// The caller is responsible for closing the freeing the file once they are -/// finished with it. +/// finished with it by using the `closeFile` function. /// /// @param Name The path of the file to open, relative or absolute. /// @param RealPath If nonnull, extra work is done to determine the real path @@ -889,9 +891,8 @@ /// location. /// @returns a platform-specific file descriptor if \a Name has been opened, /// otherwise an error object. -Expected -openNativeFileForRead(const Twine &Name, - SmallVectorImpl *RealPath = nullptr); +Expected openFileForRead(const Twine &Name, + SmallVectorImpl *RealPath = nullptr); /// @brief Close the file object. This should be used instead of ::close for /// portability. Index: llvm/lib/Object/ArchiveWriter.cpp =================================================================== --- llvm/lib/Object/ArchiveWriter.cpp +++ llvm/lib/Object/ArchiveWriter.cpp @@ -75,7 +75,7 @@ bool Deterministic) { sys::fs::file_status Status; int FD; - if (auto EC = sys::fs::openFileForRead(FileName, FD)) + if (auto EC = sys::fs::openFileDescriptorForRead(FileName, FD)) return errorCodeToError(EC); assert(FD != -1); Index: llvm/lib/Support/FileOutputBuffer.cpp =================================================================== --- llvm/lib/Support/FileOutputBuffer.cpp +++ llvm/lib/Support/FileOutputBuffer.cpp @@ -84,7 +84,7 @@ Error commit() override { int FD; std::error_code EC; - if (auto EC = openFileForWrite(FinalPath, FD, fs::F_None, Mode)) + if (auto EC = openFileDescriptorForWrite(FinalPath, FD, fs::F_None, Mode)) return errorCodeToError(EC); raw_fd_ostream OS(FD, /*shouldClose=*/true, /*unbuffered=*/true); OS << StringRef((const char *)Buffer.base(), Buffer.size()); Index: llvm/lib/Support/MemoryBuffer.cpp =================================================================== --- llvm/lib/Support/MemoryBuffer.cpp +++ llvm/lib/Support/MemoryBuffer.cpp @@ -244,7 +244,7 @@ getFileAux(const Twine &Filename, int64_t FileSize, uint64_t MapSize, uint64_t Offset, bool RequiresNullTerminator, bool IsVolatile) { int FD; - std::error_code EC = sys::fs::openFileForRead(Filename, FD); + std::error_code EC = sys::fs::openFileDescriptorForRead(Filename, FD); if (EC) return EC; @@ -364,7 +364,7 @@ getReadWriteFile(const Twine &Filename, uint64_t FileSize, uint64_t MapSize, uint64_t Offset) { int FD; - std::error_code EC = sys::fs::openFileForWrite( + std::error_code EC = sys::fs::openFileDescriptorForWrite( Filename, FD, sys::fs::F_RW | sys::fs::F_NoTrunc); if (EC) @@ -518,7 +518,7 @@ ErrorOr> MemoryBuffer::getFileAsStream(const Twine &Filename) { int FD; - std::error_code EC = sys::fs::openFileForRead(Filename, FD); + std::error_code EC = sys::fs::openFileDescriptorForRead(Filename, FD); if (EC) return EC; ErrorOr> Ret = Index: llvm/lib/Support/Path.cpp =================================================================== --- llvm/lib/Support/Path.cpp +++ llvm/lib/Support/Path.cpp @@ -200,9 +200,9 @@ // Try to open + create the file. switch (Type) { case FS_File: { - if (std::error_code EC = - sys::fs::openFileForWrite(Twine(ResultPath.begin()), ResultFD, - Flags | sys::fs::F_Excl, Mode)) { + if (std::error_code EC = sys::fs::openFileDescriptorForWrite( + Twine(ResultPath.begin()), ResultFD, Flags | sys::fs::F_Excl, + Mode)) { if (EC == errc::file_exists) goto retry_random_path; return EC; @@ -927,9 +927,9 @@ std::error_code copy_file(const Twine &From, const Twine &To) { int ReadFD, WriteFD; - if (std::error_code EC = openFileForRead(From, ReadFD)) + if (std::error_code EC = openFileDescriptorForRead(From, ReadFD)) return EC; - if (std::error_code EC = openFileForWrite(To, WriteFD, F_None)) { + if (std::error_code EC = openFileDescriptorForWrite(To, WriteFD, F_None)) { close(ReadFD); return EC; } @@ -981,7 +981,7 @@ ErrorOr md5_contents(const Twine &Path) { int FD; - if (auto EC = openFileForRead(Path, FD)) + if (auto EC = openFileDescriptorForRead(Path, FD)) return EC; auto Result = md5_contents(FD); Index: llvm/lib/Support/TarWriter.cpp =================================================================== --- llvm/lib/Support/TarWriter.cpp +++ llvm/lib/Support/TarWriter.cpp @@ -160,7 +160,8 @@ Expected> TarWriter::create(StringRef OutputPath, StringRef BaseDir) { int FD; - if (std::error_code EC = openFileForWrite(OutputPath, FD, sys::fs::F_None)) + if (std::error_code EC = + openFileDescriptorForWrite(OutputPath, FD, sys::fs::F_None)) return make_error("cannot open " + OutputPath, EC); return std::unique_ptr(new TarWriter(FD, BaseDir)); } Index: llvm/lib/Support/Unix/Path.inc =================================================================== --- llvm/lib/Support/Unix/Path.inc +++ llvm/lib/Support/Unix/Path.inc @@ -722,8 +722,8 @@ } #endif -std::error_code openFileForRead(const Twine &Name, int &ResultFD, - SmallVectorImpl *RealPath) { +std::error_code openFileDescriptorForRead(const Twine &Name, int &ResultFD, + SmallVectorImpl *RealPath) { SmallString<128> Storage; StringRef P = Name.toNullTerminatedStringRef(Storage); int OpenFlags = O_RDONLY; @@ -764,17 +764,18 @@ return std::error_code(); } -Expected openNativeFileForRead(const Twine &Name, - SmallVectorImpl *RealPath) { +Expected openFileForRead(const Twine &Name, + SmallVectorImpl *RealPath) { file_t ResultFD; - std::error_code EC = openFileForRead(Name, ResultFD, RealPath); + std::error_code EC = openFileDescriptorForRead(Name, ResultFD, RealPath); if (EC) return errorCodeToError(EC); return ResultFD; } -std::error_code openFileForWrite(const Twine &Name, int &ResultFD, - sys::fs::OpenFlags Flags, unsigned Mode) { +std::error_code openFileDescriptorForWrite(const Twine &Name, int &ResultFD, + sys::fs::OpenFlags Flags, + unsigned Mode) { // Verify that we don't have both "append" and "excl". assert((!(Flags & sys::fs::F_Excl) || !(Flags & sys::fs::F_Append)) && "Cannot specify both 'excl' and 'append' file creation flags!"); @@ -810,10 +811,10 @@ return std::error_code(); } -Expected openNativeFileForWrite(const Twine &Name, OpenFlags Flags, - unsigned Mode) { +Expected openFileForWrite(const Twine &Name, OpenFlags Flags, + unsigned Mode) { file_t ResultFD; - std::error_code EC = openFileForWrite(Name, ResultFD, Flags, Mode); + std::error_code EC = openFileDescriptorForWrite(Name, ResultFD, Flags, Mode); if (EC) return errorCodeToError(EC); return ResultFD; Index: llvm/lib/Support/Windows/Path.inc =================================================================== --- llvm/lib/Support/Windows/Path.inc +++ llvm/lib/Support/Windows/Path.inc @@ -1067,14 +1067,14 @@ return std::error_code(); } -std::error_code openFileForRead(const Twine &Name, int &ResultFD, - SmallVectorImpl *RealPath) { - Expected NativeFile = openNativeFileForRead(Name, RealPath); +std::error_code openFileDescriptorForRead(const Twine &Name, int &ResultFD, + SmallVectorImpl *RealPath) { + Expected NativeFile = openFileForRead(Name, RealPath); return nativeFileToFd(std::move(NativeFile), ResultFD, 0); } -Expected openNativeFileForRead(const Twine &Name, - SmallVectorImpl *RealPath) { +Expected openFileForRead(const Twine &Name, + SmallVectorImpl *RealPath) { SmallVector PathUTF16; if (std::error_code EC = widenPath(Name, PathUTF16)) @@ -1104,8 +1104,9 @@ return H; } -std::error_code openFileForWrite(const Twine &Name, int &ResultFD, - sys::fs::OpenFlags Flags, unsigned Mode) { +std::error_code openFileDescriptorForWrite(const Twine &Name, int &ResultFD, + sys::fs::OpenFlags Flags, + unsigned Mode) { int OpenFlags = 0; if (Flags & F_Append) OpenFlags |= _O_APPEND; @@ -1113,12 +1114,12 @@ if (Flags & F_Text) OpenFlags |= _O_TEXT; - Expected NativeFile = openNativeFileForWrite(Name, Flags, Mode); + Expected NativeFile = openFileForWrite(Name, Flags, Mode); return nativeFileToFd(std::move(NativeFile), ResultFD, OpenFlags); } -Expected openNativeFileForWrite(const Twine &Name, OpenFlags Flags, - unsigned Mode) { +Expected openFileForWrite(const Twine &Name, OpenFlags Flags, + unsigned Mode) { // Verify that we don't have both "append" and "excl". assert((!(Flags & sys::fs::F_Excl) || !(Flags & sys::fs::F_Append)) && "Cannot specify both 'excl' and 'append' file creation flags!"); @@ -1239,7 +1240,8 @@ return directoryRealPath(path, dest); int fd; - if (std::error_code EC = llvm::sys::fs::openFileForRead(path, fd, &dest)) + if (std::error_code EC = + llvm::sys::fs::openFileDescriptorForRead(path, fd, &dest)) return EC; ::close(fd); return std::error_code(); Index: llvm/lib/Support/raw_ostream.cpp =================================================================== --- llvm/lib/Support/raw_ostream.cpp +++ llvm/lib/Support/raw_ostream.cpp @@ -511,7 +511,7 @@ } int FD; - EC = sys::fs::openFileForWrite(Filename, FD, Flags); + EC = sys::fs::openFileDescriptorForWrite(Filename, FD, Flags); if (EC) return -1; Index: llvm/lib/XRay/InstrumentationMap.cpp =================================================================== --- llvm/lib/XRay/InstrumentationMap.cpp +++ llvm/lib/XRay/InstrumentationMap.cpp @@ -174,7 +174,7 @@ auto E = ObjectFileOrError.takeError(); // We try to load it as YAML if the ELF load didn't work. int Fd; - if (sys::fs::openFileForRead(Filename, Fd)) + if (sys::fs::openFileDescriptorForRead(Filename, Fd)) return std::move(E); uint64_t FileSize; Index: llvm/lib/XRay/Trace.cpp =================================================================== --- llvm/lib/XRay/Trace.cpp +++ llvm/lib/XRay/Trace.cpp @@ -630,7 +630,7 @@ Expected llvm::xray::loadTraceFile(StringRef Filename, bool Sort) { int Fd; - if (auto EC = sys::fs::openFileForRead(Filename, Fd)) { + if (auto EC = sys::fs::openFileDescriptorForRead(Filename, Fd)) { return make_error( Twine("Cannot read log from '") + Filename + "'", EC); } Index: llvm/tools/gold/gold-plugin.cpp =================================================================== --- llvm/tools/gold/gold-plugin.cpp +++ llvm/tools/gold/gold-plugin.cpp @@ -787,7 +787,7 @@ if (TaskID > 0) NewFilename += utostr(TaskID); std::error_code EC = - sys::fs::openFileForWrite(NewFilename, FD, sys::fs::F_None); + sys::fs::openFileDescriptorForWrite(NewFilename, FD, sys::fs::F_None); if (EC) message(LDPL_FATAL, "Could not open file %s: %s", NewFilename.c_str(), EC.message().c_str()); Index: llvm/tools/llvm-ar/llvm-ar.cpp =================================================================== --- llvm/tools/llvm-ar/llvm-ar.cpp +++ llvm/tools/llvm-ar/llvm-ar.cpp @@ -389,8 +389,8 @@ sys::fs::perms Mode = ModeOrErr.get(); int FD; - failIfError(sys::fs::openFileForWrite(sys::path::filename(Name), FD, - sys::fs::F_None, Mode), + failIfError(sys::fs::openFileDescriptorForWrite(sys::path::filename(Name), FD, + sys::fs::F_None, Mode), Name); { Index: llvm/tools/llvm-cov/TestingSupport.cpp =================================================================== --- llvm/tools/llvm-cov/TestingSupport.cpp +++ llvm/tools/llvm-cov/TestingSupport.cpp @@ -75,8 +75,8 @@ return 1; int FD; - if (auto Err = - sys::fs::openFileForWrite(OutputFilename, FD, sys::fs::F_None)) { + if (auto Err = sys::fs::openFileDescriptorForWrite(OutputFilename, FD, + sys::fs::F_None)) { errs() << "error: " << Err.message() << "\n"; return 1; } Index: llvm/tools/llvm-exegesis/lib/BenchmarkResult.cpp =================================================================== --- llvm/tools/llvm-exegesis/lib/BenchmarkResult.cpp +++ llvm/tools/llvm-exegesis/lib/BenchmarkResult.cpp @@ -108,7 +108,7 @@ } else { int ResultFD = 0; llvm::cantFail(llvm::errorCodeToError( - openFileForWrite(Filename, ResultFD, llvm::sys::fs::F_Text))); + openFileDescriptorForWrite(Filename, ResultFD, llvm::sys::fs::F_Text))); llvm::raw_fd_ostream Ostr(ResultFD, true /*shouldClose*/); writeYamlTo(Ostr); } Index: llvm/unittests/Support/Host.cpp =================================================================== --- llvm/unittests/Support/Host.cpp +++ llvm/unittests/Support/Host.cpp @@ -194,7 +194,7 @@ ASSERT_EQ(0, RetCode); int FD = 0; - ASSERT_NO_ERROR(fs::openFileForRead(OutputPath, FD)); + ASSERT_NO_ERROR(fs::openFileDescriptorForRead(OutputPath, FD)); off_t Size = ::lseek(FD, 0, SEEK_END); ASSERT_NE(-1, Size); ::lseek(FD, 0, SEEK_SET); Index: llvm/unittests/Support/LockFileManagerTest.cpp =================================================================== --- llvm/unittests/Support/LockFileManagerTest.cpp +++ llvm/unittests/Support/LockFileManagerTest.cpp @@ -60,7 +60,8 @@ sys::path::append(TmpFileLock, "file.lock-000"); int FD; - EC = sys::fs::openFileForWrite(StringRef(TmpFileLock), FD, sys::fs::F_None); + EC = sys::fs::openFileDescriptorForWrite(StringRef(TmpFileLock), FD, + sys::fs::F_None); ASSERT_FALSE(EC); int Ret = close(FD); Index: llvm/unittests/Support/MemoryBufferTest.cpp =================================================================== --- llvm/unittests/Support/MemoryBufferTest.cpp +++ llvm/unittests/Support/MemoryBufferTest.cpp @@ -147,7 +147,7 @@ if (Reopen) { OF.close(); - EXPECT_FALSE(sys::fs::openFileForRead(TestPath.c_str(), TestFD)); + EXPECT_FALSE(sys::fs::openFileDescriptorForRead(TestPath.c_str(), TestFD)); } ErrorOr Buf = Index: llvm/unittests/Support/Path.cpp =================================================================== --- llvm/unittests/Support/Path.cpp +++ llvm/unittests/Support/Path.cpp @@ -1063,7 +1063,7 @@ // Map it back in read-only { int FD; - EC = fs::openFileForRead(Twine(TempPath), FD); + EC = fs::openFileDescriptorForRead(Twine(TempPath), FD); ASSERT_NO_ERROR(EC); fs::mapped_file_region mfr(FD, fs::mapped_file_region::readonly, Size, 0, EC); ASSERT_NO_ERROR(EC); @@ -1219,8 +1219,8 @@ // Open the file for read int FileDescriptor2; SmallString<64> ResultPath; - ASSERT_NO_ERROR( - fs::openFileForRead(Twine(TempPath), FileDescriptor2, &ResultPath)) + ASSERT_NO_ERROR(fs::openFileDescriptorForRead(Twine(TempPath), + FileDescriptor2, &ResultPath)) // If we succeeded, check that the paths are the same (modulo case): if (!ResultPath.empty()) { Index: llvm/unittests/Support/ProgramTest.cpp =================================================================== --- llvm/unittests/Support/ProgramTest.cpp +++ llvm/unittests/Support/ProgramTest.cpp @@ -332,7 +332,7 @@ ASSERT_NO_ERROR(sys::writeFileWithEncoding(file_pathname.c_str(), utf8_text, sys::WEM_UTF16)); int fd = 0; - ASSERT_NO_ERROR(fs::openFileForRead(file_pathname.c_str(), fd)); + ASSERT_NO_ERROR(fs::openFileDescriptorForRead(file_pathname.c_str(), fd)); #if defined(_WIN32) char buf[18]; ASSERT_EQ(::read(fd, buf, 18), 18); Index: llvm/unittests/Support/ReplaceFileTest.cpp =================================================================== --- llvm/unittests/Support/ReplaceFileTest.cpp +++ llvm/unittests/Support/ReplaceFileTest.cpp @@ -31,7 +31,8 @@ std::error_code CreateFileWithContent(const SmallString<128> &FilePath, const StringRef &content) { int FD = 0; - if (std::error_code ec = fs::openFileForWrite(FilePath, FD, fs::F_None)) + if (std::error_code ec = + fs::openFileDescriptorForWrite(FilePath, FD, fs::F_None)) return ec; const bool ShouldClose = true; @@ -60,7 +61,7 @@ bool FileHasContent(StringRef File, StringRef Content) { int FD = 0; - auto EC = fs::openFileForRead(File, FD); + auto EC = fs::openFileDescriptorForRead(File, FD); (void)EC; assert(!EC); ScopedFD EventuallyCloseIt(FD); @@ -86,7 +87,7 @@ { // Open the target file for reading. int ReadFD = 0; - ASSERT_NO_ERROR(fs::openFileForRead(TargetFileName, ReadFD)); + ASSERT_NO_ERROR(fs::openFileDescriptorForRead(TargetFileName, ReadFD)); ScopedFD EventuallyCloseIt(ReadFD); // Confirm we can replace the file while it is open. @@ -145,7 +146,7 @@ // a temporary name. int TargetFD; std::error_code EC; - ASSERT_NO_ERROR(fs::openFileForRead(TargetFileName, TargetFD)); + ASSERT_NO_ERROR(fs::openFileDescriptorForRead(TargetFileName, TargetFD)); ScopedFD X(TargetFD); sys::fs::mapped_file_region MFR( TargetFD, sys::fs::mapped_file_region::readonly, 10, 0, EC); @@ -159,7 +160,7 @@ // or directory when trying to open it. int Tmp1FD; EXPECT_EQ(errc::permission_denied, - fs::openFileForRead(TargetTmp1FileName, Tmp1FD)); + fs::openFileDescriptorForRead(TargetTmp1FileName, Tmp1FD)); #endif } Index: llvm/unittests/Support/raw_pwrite_stream_test.cpp =================================================================== --- llvm/unittests/Support/raw_pwrite_stream_test.cpp +++ llvm/unittests/Support/raw_pwrite_stream_test.cpp @@ -60,7 +60,7 @@ const char *ParentPath = getenv("RAW_PWRITE_TEST_FILE"); if (ParentPath) { Path = ParentPath; - ASSERT_NO_ERROR(sys::fs::openFileForRead(Path, FD)); + ASSERT_NO_ERROR(sys::fs::openFileDescriptorForRead(Path, FD)); } else { ASSERT_NO_ERROR(sys::fs::createTemporaryFile("foo", "bar", FD, Path)); setenv("RAW_PWRITE_TEST_FILE", Path.c_str(), true); @@ -84,7 +84,7 @@ #ifdef LLVM_ON_UNIX TEST(raw_pwrite_ostreamTest, TestDevNull) { int FD; - sys::fs::openFileForWrite("/dev/null", FD, sys::fs::F_None); + sys::fs::openFileDescriptorForWrite("/dev/null", FD, sys::fs::F_None); raw_fd_ostream OS(FD, true); OS << "abcd"; StringRef Test = "test";