@@ -79,14 +79,12 @@ canUseTemporaryForWrite(const StringRef outputPath) {
79
79
// / temporary file that was just created.
80
80
// / \param outputPath The path to the final output file, which is used to decide
81
81
// / where to put the temporary.
82
- // / \param openFlags Controls how the output stream will be opened.
83
82
// /
84
83
// / \returns The path to the temporary file that was opened, or \c None if the
85
84
// / file couldn't be created.
86
85
static Optional<std::string>
87
86
tryToOpenTemporaryFile (Optional<llvm::raw_fd_ostream> &openedStream,
88
- const StringRef outputPath,
89
- const llvm::sys::fs::OpenFlags openFlags) {
87
+ const StringRef outputPath) {
90
88
namespace fs = llvm::sys::fs;
91
89
92
90
// Create a temporary file path.
@@ -102,8 +100,7 @@ tryToOpenTemporaryFile(Optional<llvm::raw_fd_ostream> &openedStream,
102
100
103
101
int fd;
104
102
const unsigned perms = fs::all_read | fs::all_write;
105
- std::error_code EC = fs::createUniqueFile (tempPath, fd, tempPath, perms,
106
- openFlags);
103
+ std::error_code EC = fs::createUniqueFile (tempPath, fd, tempPath, perms);
107
104
108
105
if (EC) {
109
106
// Ignore the specific error; the caller has to fall back to not using a
@@ -118,7 +115,7 @@ tryToOpenTemporaryFile(Optional<llvm::raw_fd_ostream> &openedStream,
118
115
}
119
116
120
117
std::error_code swift::atomicallyWritingToFile (
121
- const StringRef outputPath, const bool binaryMode,
118
+ const StringRef outputPath,
122
119
const llvm::function_ref<void (llvm::raw_pwrite_stream &)> action) {
123
120
namespace fs = llvm::sys::fs;
124
121
@@ -133,11 +130,9 @@ std::error_code swift::atomicallyWritingToFile(
133
130
134
131
Optional<std::string> temporaryPath;
135
132
{
136
- const fs::OpenFlags openFlags = (binaryMode ? fs::F_None : fs::F_Text);
137
-
138
133
Optional<llvm::raw_fd_ostream> OS;
139
134
if (canUseTemporary.get ()) {
140
- temporaryPath = tryToOpenTemporaryFile (OS, outputPath, openFlags );
135
+ temporaryPath = tryToOpenTemporaryFile (OS, outputPath);
141
136
142
137
if (!temporaryPath) {
143
138
assert (!OS.hasValue ());
@@ -149,7 +144,7 @@ std::error_code swift::atomicallyWritingToFile(
149
144
150
145
if (!OS.hasValue ()) {
151
146
std::error_code error;
152
- OS.emplace (outputPath, error, openFlags );
147
+ OS.emplace (outputPath, error, fs::F_None );
153
148
if (error)
154
149
return error;
155
150
}
0 commit comments