Author: Tony Tao Date: 2023-07-24T09:08:37-04:00 New Revision: b4a5b61d7675521e473c37921a2bdf771fd2bd3e
URL: https://github.com/llvm/llvm-project/commit/b4a5b61d7675521e473c37921a2bdf771fd2bd3e DIFF: https://github.com/llvm/llvm-project/commit/b4a5b61d7675521e473c37921a2bdf771fd2bd3e.diff LOG: [SystemZ][z/OS] Add OpenFlags to CreateMissingDirectories path when creating temp files Additional patch to https://reviews.llvm.org/D103806 to add the same flags in the path where the CreateMissingDirectories booleans is set to true. Reviewed By: abhina.sreeskantharajan Differential Revision: https://reviews.llvm.org/D155651 Added: Modified: clang/lib/Frontend/CompilerInstance.cpp Removed: ################################################################################ diff --git a/clang/lib/Frontend/CompilerInstance.cpp b/clang/lib/Frontend/CompilerInstance.cpp index a87e91e3ba5312..92e0b74e38f0af 100644 --- a/clang/lib/Frontend/CompilerInstance.cpp +++ b/clang/lib/Frontend/CompilerInstance.cpp @@ -895,10 +895,12 @@ CompilerInstance::createOutputFileImpl(StringRef OutputPath, bool Binary, TempPath += "-%%%%%%%%"; TempPath += OutputExtension; TempPath += ".tmp"; + llvm::sys::fs::OpenFlags BinaryFlags = + Binary ? llvm::sys::fs::OF_None : llvm::sys::fs::OF_Text; Expected<llvm::sys::fs::TempFile> ExpectedFile = llvm::sys::fs::TempFile::create( TempPath, llvm::sys::fs::all_read | llvm::sys::fs::all_write, - Binary ? llvm::sys::fs::OF_None : llvm::sys::fs::OF_Text); + BinaryFlags); llvm::Error E = handleErrors( ExpectedFile.takeError(), [&](const llvm::ECError &E) -> llvm::Error { @@ -908,7 +910,9 @@ CompilerInstance::createOutputFileImpl(StringRef OutputPath, bool Binary, StringRef Parent = llvm::sys::path::parent_path(OutputPath); EC = llvm::sys::fs::create_directories(Parent); if (!EC) { - ExpectedFile = llvm::sys::fs::TempFile::create(TempPath); + ExpectedFile = llvm::sys::fs::TempFile::create( + TempPath, llvm::sys::fs::all_read | llvm::sys::fs::all_write, + BinaryFlags); if (!ExpectedFile) return llvm::errorCodeToError( llvm::errc::no_such_file_or_directory); _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits