[PATCH] D100130: [SystemZ][z/OS][Windows] Add new functions that set Text/Binary mode for Stdin and Stdout based on OpenFlags
Abhina Sree via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 13 11:45:52 PDT 2021
abhina.sreeskantharajan added inline comments.
================
Comment at: llvm/lib/Support/MemoryBuffer.cpp:514-515
// 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);
----------------
Jonathan.Crowther wrote:
> This will no longer call `_setmode(_fileno(stdin), _O_BINARY);` on Windows. Is that expected?
Some background info about the flags: I changed the behaviour of the Flags here https://reviews.llvm.org/D99426 and this patch is an extension of that.
On Windows, we only want to open a file in text mode if the OF_CRLF bit is set with OF_TextWithCRLF. If you see in Windows/Program.inc, we only check the OF_CRLF bit to determine whether to open the file as binary/text. In Unix/Program.inc, we use OF_Text bit to determine whether to open the file as binary/text.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D100130/new/
https://reviews.llvm.org/D100130
More information about the llvm-commits
mailing list