[PATCH] D103806: [SystemZ][z/OS] Pass OpenFlags when creating tmp files
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rG0e8506debae3: [SystemZ][z/OS] Pass OpenFlags when creating tmp files (authored by abhina.sreeskantharajan). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D103806/new/ https://reviews.llvm.org/D103806 Files: clang/lib/Frontend/CompilerInstance.cpp llvm/include/llvm/Support/FileSystem.h llvm/lib/Support/Path.cpp Index: llvm/lib/Support/Path.cpp === --- llvm/lib/Support/Path.cpp +++ llvm/lib/Support/Path.cpp @@ -1288,11 +1288,12 @@ return Error::success(); } -Expected TempFile::create(const Twine , unsigned Mode) { +Expected TempFile::create(const Twine , unsigned Mode, +OpenFlags ExtraFlags) { int FD; SmallString<128> ResultPath; if (std::error_code EC = - createUniqueFile(Model, FD, ResultPath, OF_Delete, Mode)) + createUniqueFile(Model, FD, ResultPath, OF_Delete | ExtraFlags, Mode)) return errorCodeToError(EC); TempFile Ret(ResultPath, FD); Index: llvm/include/llvm/Support/FileSystem.h === --- llvm/include/llvm/Support/FileSystem.h +++ llvm/include/llvm/Support/FileSystem.h @@ -857,7 +857,8 @@ /// This creates a temporary file with createUniqueFile and schedules it for /// deletion with sys::RemoveFileOnSignal. static Expected create(const Twine , - unsigned Mode = all_read | all_write); + unsigned Mode = all_read | all_write, + OpenFlags ExtraFlags = OF_None); TempFile(TempFile &); TempFile =(TempFile &); Index: clang/lib/Frontend/CompilerInstance.cpp === --- clang/lib/Frontend/CompilerInstance.cpp +++ clang/lib/Frontend/CompilerInstance.cpp @@ -828,7 +828,9 @@ TempPath += OutputExtension; TempPath += ".tmp"; Expected ExpectedFile = -llvm::sys::fs::TempFile::create(TempPath); +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); llvm::Error E = handleErrors( ExpectedFile.takeError(), [&](const llvm::ECError ) -> llvm::Error { Index: llvm/lib/Support/Path.cpp === --- llvm/lib/Support/Path.cpp +++ llvm/lib/Support/Path.cpp @@ -1288,11 +1288,12 @@ return Error::success(); } -Expected TempFile::create(const Twine , unsigned Mode) { +Expected TempFile::create(const Twine , unsigned Mode, +OpenFlags ExtraFlags) { int FD; SmallString<128> ResultPath; if (std::error_code EC = - createUniqueFile(Model, FD, ResultPath, OF_Delete, Mode)) + createUniqueFile(Model, FD, ResultPath, OF_Delete | ExtraFlags, Mode)) return errorCodeToError(EC); TempFile Ret(ResultPath, FD); Index: llvm/include/llvm/Support/FileSystem.h === --- llvm/include/llvm/Support/FileSystem.h +++ llvm/include/llvm/Support/FileSystem.h @@ -857,7 +857,8 @@ /// This creates a temporary file with createUniqueFile and schedules it for /// deletion with sys::RemoveFileOnSignal. static Expected create(const Twine , - unsigned Mode = all_read | all_write); + unsigned Mode = all_read | all_write, + OpenFlags ExtraFlags = OF_None); TempFile(TempFile &); TempFile =(TempFile &); Index: clang/lib/Frontend/CompilerInstance.cpp === --- clang/lib/Frontend/CompilerInstance.cpp +++ clang/lib/Frontend/CompilerInstance.cpp @@ -828,7 +828,9 @@ TempPath += OutputExtension; TempPath += ".tmp"; Expected ExpectedFile = -llvm::sys::fs::TempFile::create(TempPath); +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); llvm::Error E = handleErrors( ExpectedFile.takeError(), [&](const llvm::ECError ) -> llvm::Error { ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D103806: [SystemZ][z/OS] Pass OpenFlags when creating tmp files
amccarth accepted this revision. amccarth added a comment. This revision is now accepted and ready to land. LGTM Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D103806/new/ https://reviews.llvm.org/D103806 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D103806: [SystemZ][z/OS] Pass OpenFlags when creating tmp files
abhina.sreeskantharajan updated this revision to Diff 350386. abhina.sreeskantharajan added a comment. Address rnk's comments and rename to ExtraFlags Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D103806/new/ https://reviews.llvm.org/D103806 Files: clang/lib/Frontend/CompilerInstance.cpp llvm/include/llvm/Support/FileSystem.h llvm/lib/Support/Path.cpp Index: llvm/lib/Support/Path.cpp === --- llvm/lib/Support/Path.cpp +++ llvm/lib/Support/Path.cpp @@ -1288,11 +1288,12 @@ return Error::success(); } -Expected TempFile::create(const Twine , unsigned Mode) { +Expected TempFile::create(const Twine , unsigned Mode, +OpenFlags ExtraFlags) { int FD; SmallString<128> ResultPath; if (std::error_code EC = - createUniqueFile(Model, FD, ResultPath, OF_Delete, Mode)) + createUniqueFile(Model, FD, ResultPath, OF_Delete | ExtraFlags, Mode)) return errorCodeToError(EC); TempFile Ret(ResultPath, FD); Index: llvm/include/llvm/Support/FileSystem.h === --- llvm/include/llvm/Support/FileSystem.h +++ llvm/include/llvm/Support/FileSystem.h @@ -857,7 +857,8 @@ /// This creates a temporary file with createUniqueFile and schedules it for /// deletion with sys::RemoveFileOnSignal. static Expected create(const Twine , - unsigned Mode = all_read | all_write); + unsigned Mode = all_read | all_write, + OpenFlags ExtraFlags = OF_None); TempFile(TempFile &); TempFile =(TempFile &); Index: clang/lib/Frontend/CompilerInstance.cpp === --- clang/lib/Frontend/CompilerInstance.cpp +++ clang/lib/Frontend/CompilerInstance.cpp @@ -828,7 +828,9 @@ TempPath += OutputExtension; TempPath += ".tmp"; Expected ExpectedFile = -llvm::sys::fs::TempFile::create(TempPath); +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); llvm::Error E = handleErrors( ExpectedFile.takeError(), [&](const llvm::ECError ) -> llvm::Error { Index: llvm/lib/Support/Path.cpp === --- llvm/lib/Support/Path.cpp +++ llvm/lib/Support/Path.cpp @@ -1288,11 +1288,12 @@ return Error::success(); } -Expected TempFile::create(const Twine , unsigned Mode) { +Expected TempFile::create(const Twine , unsigned Mode, +OpenFlags ExtraFlags) { int FD; SmallString<128> ResultPath; if (std::error_code EC = - createUniqueFile(Model, FD, ResultPath, OF_Delete, Mode)) + createUniqueFile(Model, FD, ResultPath, OF_Delete | ExtraFlags, Mode)) return errorCodeToError(EC); TempFile Ret(ResultPath, FD); Index: llvm/include/llvm/Support/FileSystem.h === --- llvm/include/llvm/Support/FileSystem.h +++ llvm/include/llvm/Support/FileSystem.h @@ -857,7 +857,8 @@ /// This creates a temporary file with createUniqueFile and schedules it for /// deletion with sys::RemoveFileOnSignal. static Expected create(const Twine , - unsigned Mode = all_read | all_write); + unsigned Mode = all_read | all_write, + OpenFlags ExtraFlags = OF_None); TempFile(TempFile &); TempFile =(TempFile &); Index: clang/lib/Frontend/CompilerInstance.cpp === --- clang/lib/Frontend/CompilerInstance.cpp +++ clang/lib/Frontend/CompilerInstance.cpp @@ -828,7 +828,9 @@ TempPath += OutputExtension; TempPath += ".tmp"; Expected ExpectedFile = -llvm::sys::fs::TempFile::create(TempPath); +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); llvm::Error E = handleErrors( ExpectedFile.takeError(), [&](const llvm::ECError ) -> llvm::Error { ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D103806: [SystemZ][z/OS] Pass OpenFlags when creating tmp files
rnk added inline comments. Comment at: llvm/lib/Support/Path.cpp:1295 SmallString<128> ResultPath; - if (std::error_code EC = - createUniqueFile(Model, FD, ResultPath, OF_Delete, Mode)) + if (std::error_code EC = createUniqueFile(Model, FD, ResultPath, Flags, Mode)) return errorCodeToError(EC); abhina.sreeskantharajan wrote: > rnk wrote: > > Instead of requiring the caller to add `OF_Delete`, I think it would be > > better to pass `OF_Delete | Flags` here. > Sure, I'll make that change. Do you think we should change the name to > "ExtraFlags" to indicate there is a default, or is the current name is fine? That seems reasonable to me, I like `ExtraFlags`. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D103806/new/ https://reviews.llvm.org/D103806 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D103806: [SystemZ][z/OS] Pass OpenFlags when creating tmp files
abhina.sreeskantharajan added inline comments. Comment at: llvm/lib/Support/Path.cpp:1295 SmallString<128> ResultPath; - if (std::error_code EC = - createUniqueFile(Model, FD, ResultPath, OF_Delete, Mode)) + if (std::error_code EC = createUniqueFile(Model, FD, ResultPath, Flags, Mode)) return errorCodeToError(EC); rnk wrote: > Instead of requiring the caller to add `OF_Delete`, I think it would be > better to pass `OF_Delete | Flags` here. Sure, I'll make that change. Do you think we should change the name to "ExtraFlags" to indicate there is a default, or is the current name is fine? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D103806/new/ https://reviews.llvm.org/D103806 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D103806: [SystemZ][z/OS] Pass OpenFlags when creating tmp files
rnk added a comment. I see, thanks. Comment at: llvm/lib/Support/Path.cpp:1295 SmallString<128> ResultPath; - if (std::error_code EC = - createUniqueFile(Model, FD, ResultPath, OF_Delete, Mode)) + if (std::error_code EC = createUniqueFile(Model, FD, ResultPath, Flags, Mode)) return errorCodeToError(EC); Instead of requiring the caller to add `OF_Delete`, I think it would be better to pass `OF_Delete | Flags` here. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D103806/new/ https://reviews.llvm.org/D103806 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D103806: [SystemZ][z/OS] Pass OpenFlags when creating tmp files
abhina.sreeskantharajan created this revision. Herald added subscribers: dexonsmith, hiraditya. abhina.sreeskantharajan requested review of this revision. Herald added projects: clang, LLVM. Herald added subscribers: llvm-commits, cfe-commits. This patch https://reviews.llvm.org/D102876 caused some lit regressions on z/OS because tmp files were no longer being opened based on binary/text mode. This patch passes OpenFlags when creating tmp files so we can open files in different modes. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D103806 Files: clang/lib/Frontend/CompilerInstance.cpp llvm/include/llvm/Support/FileSystem.h llvm/lib/Support/Path.cpp Index: llvm/lib/Support/Path.cpp === --- llvm/lib/Support/Path.cpp +++ llvm/lib/Support/Path.cpp @@ -1288,11 +1288,11 @@ return Error::success(); } -Expected TempFile::create(const Twine , unsigned Mode) { +Expected TempFile::create(const Twine , unsigned Mode, +OpenFlags Flags) { int FD; SmallString<128> ResultPath; - if (std::error_code EC = - createUniqueFile(Model, FD, ResultPath, OF_Delete, Mode)) + if (std::error_code EC = createUniqueFile(Model, FD, ResultPath, Flags, Mode)) return errorCodeToError(EC); TempFile Ret(ResultPath, FD); Index: llvm/include/llvm/Support/FileSystem.h === --- llvm/include/llvm/Support/FileSystem.h +++ llvm/include/llvm/Support/FileSystem.h @@ -857,7 +857,8 @@ /// This creates a temporary file with createUniqueFile and schedules it for /// deletion with sys::RemoveFileOnSignal. static Expected create(const Twine , - unsigned Mode = all_read | all_write); + unsigned Mode = all_read | all_write, + OpenFlags Flags = OF_Delete); TempFile(TempFile &); TempFile =(TempFile &); Index: clang/lib/Frontend/CompilerInstance.cpp === --- clang/lib/Frontend/CompilerInstance.cpp +++ clang/lib/Frontend/CompilerInstance.cpp @@ -828,7 +828,10 @@ TempPath += OutputExtension; TempPath += ".tmp"; Expected ExpectedFile = -llvm::sys::fs::TempFile::create(TempPath); +llvm::sys::fs::TempFile::create( +TempPath, llvm::sys::fs::all_read | llvm::sys::fs::all_write, +llvm::sys::fs::OF_Delete | +(Binary ? llvm::sys::fs::OF_None : llvm::sys::fs::OF_Text)); llvm::Error E = handleErrors( ExpectedFile.takeError(), [&](const llvm::ECError ) -> llvm::Error { Index: llvm/lib/Support/Path.cpp === --- llvm/lib/Support/Path.cpp +++ llvm/lib/Support/Path.cpp @@ -1288,11 +1288,11 @@ return Error::success(); } -Expected TempFile::create(const Twine , unsigned Mode) { +Expected TempFile::create(const Twine , unsigned Mode, +OpenFlags Flags) { int FD; SmallString<128> ResultPath; - if (std::error_code EC = - createUniqueFile(Model, FD, ResultPath, OF_Delete, Mode)) + if (std::error_code EC = createUniqueFile(Model, FD, ResultPath, Flags, Mode)) return errorCodeToError(EC); TempFile Ret(ResultPath, FD); Index: llvm/include/llvm/Support/FileSystem.h === --- llvm/include/llvm/Support/FileSystem.h +++ llvm/include/llvm/Support/FileSystem.h @@ -857,7 +857,8 @@ /// This creates a temporary file with createUniqueFile and schedules it for /// deletion with sys::RemoveFileOnSignal. static Expected create(const Twine , - unsigned Mode = all_read | all_write); + unsigned Mode = all_read | all_write, + OpenFlags Flags = OF_Delete); TempFile(TempFile &); TempFile =(TempFile &); Index: clang/lib/Frontend/CompilerInstance.cpp === --- clang/lib/Frontend/CompilerInstance.cpp +++ clang/lib/Frontend/CompilerInstance.cpp @@ -828,7 +828,10 @@ TempPath += OutputExtension; TempPath += ".tmp"; Expected ExpectedFile = -llvm::sys::fs::TempFile::create(TempPath); +llvm::sys::fs::TempFile::create( +TempPath, llvm::sys::fs::all_read | llvm::sys::fs::all_write, +llvm::sys::fs::OF_Delete | +(Binary ? llvm::sys::fs::OF_None : llvm::sys::fs::OF_Text)); llvm::Error E = handleErrors( ExpectedFile.takeError(), [&](const llvm::ECError ) -> llvm::Error { ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits