1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 11:02:59 +02:00
llvm-mirror/tools/llvm-exegesis/lib
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
..
AArch64 Renovate CMake files in the llvm-exegesis tool. 2021-02-10 14:22:55 -05:00
Mips Renovate CMake files in the llvm-exegesis tool. 2021-02-10 14:22:55 -05:00
PowerPC Renovate CMake files in the llvm-exegesis tool. 2021-02-10 14:22:55 -05:00
X86 [llvm-exegesis] Don't erroneously refuse to measure POPCNT instruction 2021-04-04 14:38:26 +03:00
Analysis.cpp [llvm] Use llvm::find_if (NFC) 2021-01-11 18:48:06 -08:00
Analysis.h
Assembler.cpp [GlobalISel] Base implementation for sret demotion. 2021-01-06 10:30:50 +05:30
Assembler.h
BenchmarkCode.h
BenchmarkResult.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
BenchmarkResult.h
BenchmarkRunner.cpp [tools] Use llvm::append_range (NFC) 2021-01-05 21:15:56 -08:00
BenchmarkRunner.h
Clustering.cpp
Clustering.h
CMakeLists.txt Renovate CMake files in the llvm-exegesis tool. 2021-02-10 14:22:55 -05:00
CodeTemplate.cpp
CodeTemplate.h
Error.cpp
Error.h
LatencyBenchmarkRunner.cpp
LatencyBenchmarkRunner.h
LlvmState.cpp [llvm][clang][mlir] Add checks for the return values from Target::createXXX to prevent protential null deref 2020-11-21 21:04:12 -08:00
LlvmState.h
MCInstrDescView.cpp [WebAssembly] Support single-floating-point immediate value 2021-02-04 18:05:06 -08:00
MCInstrDescView.h
ParallelSnippetGenerator.cpp
ParallelSnippetGenerator.h
PerfHelper.cpp
PerfHelper.h
RegisterAliasing.cpp
RegisterAliasing.h
RegisterValue.cpp
RegisterValue.h
SchedClassResolution.cpp [llvm] Use llvm::find_if (NFC) 2021-01-11 18:48:06 -08:00
SchedClassResolution.h
SerialSnippetGenerator.cpp Avoid shuffle self-assignment in EXPENSIVE_CHECKS builds 2021-03-10 11:17:34 +00:00
SerialSnippetGenerator.h
SnippetFile.cpp [llvm-exegesis] SnippetFile: do create source manager in MCContext 2021-04-04 15:58:39 +03:00
SnippetFile.h
SnippetGenerator.cpp
SnippetGenerator.h
SnippetRepetitor.cpp
SnippetRepetitor.h
Target.cpp [llvm] Use *::empty (NFC) 2021-01-16 09:40:55 -08:00
Target.h Re-land "[llvm-exegesis] Save target state before running the benchmark." 2020-11-04 09:46:55 +01:00
TargetSelect.h
UopsBenchmarkRunner.cpp
UopsBenchmarkRunner.h