1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-18 18:42:46 +02:00
llvm-mirror/tools/llvm-xray
Abhina Sreeskantharajan 3f0b170fdd [SystemZ][z/OS][Windows] Add new OF_TextWithCRLF flag and use this flag instead of OF_Text
Problem:
On SystemZ we need to open text files in text mode. On Windows, files opened in text mode adds a CRLF '\r\n' which may not be desirable.

Solution:
This patch adds two new flags

  - OF_CRLF which indicates that CRLF translation is used.
  - OF_TextWithCRLF = OF_Text | OF_CRLF indicates that the file is text and uses CRLF translation.

Developers should now use either the OF_Text or OF_TextWithCRLF for text files and OF_None for binary files. If the developer doesn't want carriage returns on Windows, they should use OF_Text, if they do want carriage returns on Windows, they should use OF_TextWithCRLF.

So this is the behaviour per platform with my patch:

z/OS:
OF_None: open in binary mode
OF_Text : open in text mode
OF_TextWithCRLF: open in text mode

Windows:
OF_None: open file with no carriage return
OF_Text: open file with no carriage return
OF_TextWithCRLF: open file with carriage return

The Major change is in llvm/lib/Support/Windows/Path.inc to only set text mode if the OF_CRLF is set.
```
  if (Flags & OF_CRLF)
    CrtOpenFlags |= _O_TEXT;
```

These following files are the ones that still use OF_Text which I left unchanged. I modified all these except raw_ostream.cpp in recent patches so I know these were previously in Binary mode on Windows.
./llvm/lib/Support/raw_ostream.cpp
./llvm/lib/TableGen/Main.cpp
./llvm/tools/dsymutil/DwarfLinkerForBinary.cpp
./llvm/unittests/Support/Path.cpp
./clang/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp
./clang/lib/Frontend/CompilerInstance.cpp
./clang/lib/Driver/Driver.cpp
./clang/lib/Driver/ToolChains/Clang.cpp

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D99426
2021-04-06 07:23:31 -04:00
..
CMakeLists.txt Break false dependencies on target libraries 2019-05-23 23:02:56 +00:00
func-id-helper.cpp [llvm-objdump] Add warning messages if disassembly + source for problematic inputs 2019-08-15 05:15:22 +00:00
func-id-helper.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
llvm-xray.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
trie-node.h Use std::foo_t rather than std::foo in LLVM. 2020-02-11 15:12:51 -08:00
xray-account.cpp [SystemZ][z/OS][Windows] Add new OF_TextWithCRLF flag and use this flag instead of OF_Text 2021-04-06 07:23:31 -04:00
xray-account.h [XRay] Account: recursion detection 2020-07-27 10:15:44 +03:00
xray-color-helper.cpp Make llvm::StringRef to std::string conversions explicit. 2020-01-28 23:25:25 +01:00
xray-color-helper.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
xray-converter.cpp [SystemZ][z/OS][Windows] Add new OF_TextWithCRLF flag and use this flag instead of OF_Text 2021-04-06 07:23:31 -04:00
xray-converter.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
xray-extract.cpp [SystemZ][z/OS][Windows] Add new OF_TextWithCRLF flag and use this flag instead of OF_Text 2021-04-06 07:23:31 -04:00
xray-fdr-dump.cpp Switch LLVM to use 64-bit offsets (2/5) 2019-08-06 10:49:40 +00:00
xray-graph-diff.cpp [SystemZ][z/OS][Windows] Add new OF_TextWithCRLF flag and use this flag instead of OF_Text 2021-04-06 07:23:31 -04:00
xray-graph-diff.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
xray-graph.cpp [SystemZ][z/OS][Windows] Add new OF_TextWithCRLF flag and use this flag instead of OF_Text 2021-04-06 07:23:31 -04:00
xray-graph.h [xray] Remove usage of procid_t 2019-06-26 15:42:42 +00:00
xray-registry.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
xray-registry.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
xray-stacks.cpp [llvm] Use the default value of drop_begin (NFC) 2021-01-18 10:16:36 -08:00