1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 18:54:02 +01:00

[SystemZ][z/OS] Pass OpenFlags when creating tmp files

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.

Reviewed By: amccarth

Differential Revision: https://reviews.llvm.org/D103806
This commit is contained in:
Abhina Sreeskantharajan 2021-06-08 14:44:45 -04:00
parent fca6ba66d2
commit f48a352265
2 changed files with 5 additions and 3 deletions

View File

@ -857,7 +857,8 @@ public:
/// This creates a temporary file with createUniqueFile and schedules it for
/// deletion with sys::RemoveFileOnSignal.
static Expected<TempFile> create(const Twine &Model,
unsigned Mode = all_read | all_write);
unsigned Mode = all_read | all_write,
OpenFlags ExtraFlags = OF_None);
TempFile(TempFile &&Other);
TempFile &operator=(TempFile &&Other);

View File

@ -1288,11 +1288,12 @@ Error TempFile::keep() {
return Error::success();
}
Expected<TempFile> TempFile::create(const Twine &Model, unsigned Mode) {
Expected<TempFile> TempFile::create(const Twine &Model, 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);