diff options
author | Abhina Sreeskantharajan <Abhina.Sreeskantharajan@ibm.com> | 2021-04-16 08:06:35 -0400 |
---|---|---|
committer | Abhina Sreeskantharajan <Abhina.Sreeskantharajan@ibm.com> | 2021-04-16 08:09:19 -0400 |
commit | 3be2ba0ba38a1799d937a0ef302fb792d12d75a8 (patch) | |
tree | 5c76a75e9743976cd3277ab089a8c63ccb89770a /llvm/lib/Support/MemoryBuffer.cpp | |
parent | 23f8993f32d7aaf3e5cf0cbafd087a46acb0a523 (diff) | |
download | llvm-3be2ba0ba38a1799d937a0ef302fb792d12d75a8.zip llvm-3be2ba0ba38a1799d937a0ef302fb792d12d75a8.tar.gz llvm-3be2ba0ba38a1799d937a0ef302fb792d12d75a8.tar.bz2 |
[SystemZ][z/OS][Windows] Add new functions that set Text/Binary mode for Stdin and Stdout based on OpenFlags
On Windows, we want to open a file in Binary mode if OF_CRLF bit is not set. On z/OS, we want to open a file in Binary mode if the OF_Text bit is not set.
This patch creates two new functions called ChangeStdinMode and ChangeStdoutMode which will take OpenFlags as an arg to determine which mode to set stdin and stdout to. This will enable patches like https://reviews.llvm.org/D100056 to not affect Windows when setting the OF_Text flag for raw_fd_streams.
Reviewed By: rnk
Differential Revision: https://reviews.llvm.org/D100130
Diffstat (limited to 'llvm/lib/Support/MemoryBuffer.cpp')
-rw-r--r-- | llvm/lib/Support/MemoryBuffer.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Support/MemoryBuffer.cpp b/llvm/lib/Support/MemoryBuffer.cpp index dbdf41f..49524f3 100644 --- a/llvm/lib/Support/MemoryBuffer.cpp +++ b/llvm/lib/Support/MemoryBuffer.cpp @@ -512,7 +512,7 @@ ErrorOr<std::unique_ptr<MemoryBuffer>> MemoryBuffer::getSTDIN() { // // FIXME: That isn't necessarily true, we should try to mmap stdin and // fallback if it fails. - sys::ChangeStdinToBinary(); + sys::ChangeStdinMode(sys::fs::OF_Text); return getMemoryBufferForStream(sys::fs::getStdinHandle(), "<stdin>"); } |