[clang] [llvm] [z/OS] treat text files as text files so auto-conversion is done (PR #90128)
Owen Pan via cfe-commits
cfe-commits at lists.llvm.org
Wed May 1 00:25:50 PDT 2024
================
@@ -413,8 +413,9 @@ static bool format(StringRef FileName, bool ErrorOnIncompleteFormat = false) {
// On Windows, overwriting a file with an open file mapping doesn't work,
// so read the whole file into memory when formatting in-place.
ErrorOr<std::unique_ptr<MemoryBuffer>> CodeOrErr =
- !OutputXML && Inplace ? MemoryBuffer::getFileAsStream(FileName)
- : MemoryBuffer::getFileOrSTDIN(FileName);
+ !OutputXML && Inplace
+ ? MemoryBuffer::getFileAsStream(FileName)
+ : MemoryBuffer::getFileOrSTDIN(FileName, /*IsText=*/true);
----------------
owenca wrote:
I tested it on Windows and didn't have a problem. I used LF only, CRLF only, and mixed line endings for the following:
```
int i;
int j;
```
Running clang-format through all values of the `LineEnding` option, with and without in-place, seemed ok.
https://github.com/llvm/llvm-project/pull/90128
More information about the cfe-commits
mailing list