aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Support/ToolOutputFile.cpp
diff options
context:
space:
mode:
authorAbhina Sreeskantharajan <Abhina.Sreeskantharajan@ibm.com>2021-03-19 08:09:01 -0400
committerAbhina Sreeskantharajan <Abhina.Sreeskantharajan@ibm.com>2021-03-19 08:09:57 -0400
commit4f750f6ebc412869ce6bb28331313a9c9a9d9af7 (patch)
tree537fc11c22134d3d9700fffe1d2e030d8a470d9a /llvm/lib/Support/ToolOutputFile.cpp
parentc2313a45307e807a6ee08d3b32cf6e4d099849a6 (diff)
downloadllvm-4f750f6ebc412869ce6bb28331313a9c9a9d9af7.zip
llvm-4f750f6ebc412869ce6bb28331313a9c9a9d9af7.tar.gz
llvm-4f750f6ebc412869ce6bb28331313a9c9a9d9af7.tar.bz2
[SystemZ][z/OS] Distinguish between text and binary files on z/OS
This patch consists of the initial changes to help distinguish between text and binary content correctly on z/OS. I would like to get feedback from Windows users on setting OF_None for all ToolOutputFiles. This seems to have been done as an optimization to prevent CRLF translation on Windows in the past. Reviewed By: zibi Differential Revision: https://reviews.llvm.org/D97785
Diffstat (limited to 'llvm/lib/Support/ToolOutputFile.cpp')
-rw-r--r--llvm/lib/Support/ToolOutputFile.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/llvm/lib/Support/ToolOutputFile.cpp b/llvm/lib/Support/ToolOutputFile.cpp
index c2ca97a..3735aac 100644
--- a/llvm/lib/Support/ToolOutputFile.cpp
+++ b/llvm/lib/Support/ToolOutputFile.cpp
@@ -11,6 +11,7 @@
//===----------------------------------------------------------------------===//
#include "llvm/Support/ToolOutputFile.h"
+#include "llvm/ADT/Triple.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/Signals.h"
using namespace llvm;
@@ -45,7 +46,12 @@ ToolOutputFile::ToolOutputFile(StringRef Filename, std::error_code &EC,
EC = std::error_code();
return;
}
- OSHolder.emplace(Filename, EC, Flags);
+
+ // On Windows, we set the OF_None flag even for text files to avoid
+ // CRLF translation.
+ OSHolder.emplace(
+ Filename, EC,
+ llvm::Triple(LLVM_HOST_TRIPLE).isOSWindows() ? sys::fs::OF_None : Flags);
OS = OSHolder.getPointer();
// If open fails, no cleanup is needed.
if (EC)