summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2014-02-24 18:20:12 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2014-02-24 18:20:12 +0000
commitac69459e0fe3df04788f5adcb94b1bec8b8cf8ad (patch)
tree6260ace05d8d32042f39b42aead973d7c3ebaf9a
parent137342f198093f68e112cd979782fae27bbb22ab (diff)
Replace the F_Binary flag with a F_Text one.
After this I will set the default back to F_None. The advantage is that before this patch forgetting to set F_Binary would corrupt a file on windows. Forgetting to set F_Text produces one that cannot be read in notepad, which is a better failure mode :-) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202052 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--examples/BrainF/BrainFDriver.cpp2
-rw-r--r--include/llvm/Analysis/DOTGraphTraitsPass.h4
-rw-r--r--include/llvm/Support/FileSystem.h6
-rw-r--r--lib/Analysis/CFGPrinter.cpp4
-rw-r--r--lib/Bitcode/Writer/BitWriter.cpp2
-rw-r--r--lib/CodeGen/MachineVerifier.cpp3
-rw-r--r--lib/CodeGen/RegAllocPBQP.cpp2
-rw-r--r--lib/IR/Core.cpp2
-rw-r--r--lib/IR/GCOV.cpp2
-rw-r--r--lib/LTO/LTOCodeGenerator.cpp2
-rw-r--r--lib/MC/MCParser/DarwinAsmParser.cpp3
-rw-r--r--lib/Support/Path.cpp6
-rw-r--r--lib/Support/Timer.cpp4
-rw-r--r--lib/Support/Windows/Path.inc2
-rw-r--r--lib/Support/raw_ostream.cpp2
-rw-r--r--lib/TableGen/Main.cpp4
-rw-r--r--lib/Target/TargetMachineC.cpp2
-rw-r--r--lib/Transforms/Instrumentation/DebugIR.cpp2
-rw-r--r--lib/Transforms/Instrumentation/GCOVProfiling.cpp2
-rw-r--r--tools/bugpoint/OptimizerDriver.cpp2
-rw-r--r--tools/llc/llc.cpp4
-rw-r--r--tools/lli/lli.cpp2
-rw-r--r--tools/llvm-ar/llvm-ar.cpp2
-rw-r--r--tools/llvm-as/llvm-as.cpp2
-rw-r--r--tools/llvm-dis/llvm-dis.cpp2
-rw-r--r--tools/llvm-extract/llvm-extract.cpp2
-rw-r--r--tools/llvm-link/llvm-link.cpp2
-rw-r--r--tools/llvm-lto/llvm-lto.cpp2
-rw-r--r--tools/llvm-mc/llvm-mc.cpp2
-rw-r--r--tools/llvm-objdump/llvm-objdump.cpp4
-rw-r--r--tools/llvm-profdata/llvm-profdata.cpp2
-rw-r--r--tools/llvm-stress/llvm-stress.cpp2
-rw-r--r--tools/opt/opt.cpp4
-rw-r--r--unittests/Support/Path.cpp6
-rw-r--r--utils/FileUpdate/FileUpdate.cpp2
35 files changed, 50 insertions, 48 deletions
diff --git a/examples/BrainF/BrainFDriver.cpp b/examples/BrainF/BrainFDriver.cpp
index be59c4fc8cb..d726464a527 100644
--- a/examples/BrainF/BrainFDriver.cpp
+++ b/examples/BrainF/BrainFDriver.cpp
@@ -108,7 +108,7 @@ int main(int argc, char **argv) {
if (OutputFilename != "-") {
std::string ErrInfo;
out = new raw_fd_ostream(OutputFilename.c_str(), ErrInfo,
- sys::fs::F_Binary);
+ sys::fs::F_None);
}
}
diff --git a/include/llvm/Analysis/DOTGraphTraitsPass.h b/include/llvm/Analysis/DOTGraphTraitsPass.h
index 6a6abc20e03..fc3fc708df6 100644
--- a/include/llvm/Analysis/DOTGraphTraitsPass.h
+++ b/include/llvm/Analysis/DOTGraphTraitsPass.h
@@ -69,7 +69,7 @@ public:
errs() << "Writing '" << Filename << "'...";
- raw_fd_ostream File(Filename.c_str(), ErrorInfo, sys::fs::F_None);
+ raw_fd_ostream File(Filename.c_str(), ErrorInfo, sys::fs::F_Text);
std::string GraphName = DOTGraphTraits<GraphT>::getGraphName(Graph);
std::string Title = GraphName + " for '" + F.getName().str() + "' function";
@@ -132,7 +132,7 @@ public:
errs() << "Writing '" << Filename << "'...";
- raw_fd_ostream File(Filename.c_str(), ErrorInfo, sys::fs::F_None);
+ raw_fd_ostream File(Filename.c_str(), ErrorInfo, sys::fs::F_Text);
std::string Title = DOTGraphTraits<GraphT>::getGraphName(Graph);
if (ErrorInfo.empty())
diff --git a/include/llvm/Support/FileSystem.h b/include/llvm/Support/FileSystem.h
index 6fa4728f3d3..d975a914ff1 100644
--- a/include/llvm/Support/FileSystem.h
+++ b/include/llvm/Support/FileSystem.h
@@ -578,9 +578,9 @@ enum OpenFlags {
/// with F_Excl.
F_Append = 2,
- /// F_Binary - The file should be opened in binary mode on platforms that
- /// make this distinction.
- F_Binary = 4,
+ /// The file should be opened in text mode on platforms that make this
+ /// distinction.
+ F_Text = 4,
/// Open the file for read and write.
F_RW = 8
diff --git a/lib/Analysis/CFGPrinter.cpp b/lib/Analysis/CFGPrinter.cpp
index 3c67618450c..3f768ce7806 100644
--- a/lib/Analysis/CFGPrinter.cpp
+++ b/lib/Analysis/CFGPrinter.cpp
@@ -80,7 +80,7 @@ namespace {
errs() << "Writing '" << Filename << "'...";
std::string ErrorInfo;
- raw_fd_ostream File(Filename.c_str(), ErrorInfo, sys::fs::F_None);
+ raw_fd_ostream File(Filename.c_str(), ErrorInfo, sys::fs::F_Text);
if (ErrorInfo.empty())
WriteGraph(File, (const Function*)&F);
@@ -114,7 +114,7 @@ namespace {
errs() << "Writing '" << Filename << "'...";
std::string ErrorInfo;
- raw_fd_ostream File(Filename.c_str(), ErrorInfo, sys::fs::F_None);
+ raw_fd_ostream File(Filename.c_str(), ErrorInfo, sys::fs::F_Text);
if (ErrorInfo.empty())
WriteGraph(File, (const Function*)&F, true);
diff --git a/lib/Bitcode/Writer/BitWriter.cpp b/lib/Bitcode/Writer/BitWriter.cpp
index cd1ada22cfd..0275f96fc9b 100644
--- a/lib/Bitcode/Writer/BitWriter.cpp
+++ b/lib/Bitcode/Writer/BitWriter.cpp
@@ -18,7 +18,7 @@ using namespace llvm;
int LLVMWriteBitcodeToFile(LLVMModuleRef M, const char *Path) {
std::string ErrorInfo;
- raw_fd_ostream OS(Path, ErrorInfo, sys::fs::F_Binary);
+ raw_fd_ostream OS(Path, ErrorInfo, sys::fs::F_None);
if (!ErrorInfo.empty())
return -1;
diff --git a/lib/CodeGen/MachineVerifier.cpp b/lib/CodeGen/MachineVerifier.cpp
index d61470c173b..aa89b83e727 100644
--- a/lib/CodeGen/MachineVerifier.cpp
+++ b/lib/CodeGen/MachineVerifier.cpp
@@ -276,7 +276,8 @@ bool MachineVerifier::runOnMachineFunction(MachineFunction &MF) {
raw_ostream *OutFile = 0;
if (OutFileName) {
std::string ErrorInfo;
- OutFile = new raw_fd_ostream(OutFileName, ErrorInfo, sys::fs::F_Append);
+ OutFile = new raw_fd_ostream(OutFileName, ErrorInfo,
+ sys::fs::F_Append | sys::fs::F_Text);
if (!ErrorInfo.empty()) {
errs() << "Error opening '" << OutFileName << "': " << ErrorInfo << '\n';
exit(1);
diff --git a/lib/CodeGen/RegAllocPBQP.cpp b/lib/CodeGen/RegAllocPBQP.cpp
index 56fdb45f4e0..347329591b5 100644
--- a/lib/CodeGen/RegAllocPBQP.cpp
+++ b/lib/CodeGen/RegAllocPBQP.cpp
@@ -595,7 +595,7 @@ bool RegAllocPBQP::runOnMachineFunction(MachineFunction &MF) {
rs << round;
std::string graphFileName(fqn + "." + rs.str() + ".pbqpgraph");
std::string tmp;
- raw_fd_ostream os(graphFileName.c_str(), tmp, sys::fs::F_None);
+ raw_fd_ostream os(graphFileName.c_str(), tmp, sys::fs::F_Text);
DEBUG(dbgs() << "Dumping graph for round " << round << " to \""
<< graphFileName << "\"\n");
problem->getGraph().dump(os);
diff --git a/lib/IR/Core.cpp b/lib/IR/Core.cpp
index dbaf02edf6c..68bc5c5810e 100644
--- a/lib/IR/Core.cpp
+++ b/lib/IR/Core.cpp
@@ -130,7 +130,7 @@ void LLVMDumpModule(LLVMModuleRef M) {
LLVMBool LLVMPrintModuleToFile(LLVMModuleRef M, const char *Filename,
char **ErrorMessage) {
std::string error;
- raw_fd_ostream dest(Filename, error, sys::fs::F_None);
+ raw_fd_ostream dest(Filename, error, sys::fs::F_Text);
if (!error.empty()) {
*ErrorMessage = strdup(error.c_str());
return true;
diff --git a/lib/IR/GCOV.cpp b/lib/IR/GCOV.cpp
index 3311d2ef42e..a0591fffb9a 100644
--- a/lib/IR/GCOV.cpp
+++ b/lib/IR/GCOV.cpp
@@ -482,7 +482,7 @@ void FileInfo::print(StringRef GCNOFile, StringRef GCDAFile) {
std::string CoveragePath = mangleCoveragePath(Filename,
Options.PreservePaths);
std::string ErrorInfo;
- raw_fd_ostream OS(CoveragePath.c_str(), ErrorInfo, sys::fs::F_None);
+ raw_fd_ostream OS(CoveragePath.c_str(), ErrorInfo, sys::fs::F_Text);
if (!ErrorInfo.empty())
errs() << ErrorInfo << "\n";
diff --git a/lib/LTO/LTOCodeGenerator.cpp b/lib/LTO/LTOCodeGenerator.cpp
index 2b37802efc4..fb272ad5134 100644
--- a/lib/LTO/LTOCodeGenerator.cpp
+++ b/lib/LTO/LTOCodeGenerator.cpp
@@ -191,7 +191,7 @@ bool LTOCodeGenerator::writeMergedModules(const char *path,
// create output file
std::string ErrInfo;
- tool_output_file Out(path, ErrInfo, sys::fs::F_Binary);
+ tool_output_file Out(path, ErrInfo, sys::fs::F_None);
if (!ErrInfo.empty()) {
errMsg = "could not open bitcode file for writing: ";
errMsg += path;
diff --git a/lib/MC/MCParser/DarwinAsmParser.cpp b/lib/MC/MCParser/DarwinAsmParser.cpp
index 6d66e308e8c..39399c08656 100644
--- a/lib/MC/MCParser/DarwinAsmParser.cpp
+++ b/lib/MC/MCParser/DarwinAsmParser.cpp
@@ -634,7 +634,8 @@ bool DarwinAsmParser::ParseDirectiveSecureLogUnique(StringRef, SMLoc IDLoc) {
raw_ostream *OS = getContext().getSecureLog();
if (OS == NULL) {
std::string Err;
- OS = new raw_fd_ostream(SecureLogFile, Err, sys::fs::F_Append);
+ OS = new raw_fd_ostream(SecureLogFile, Err,
+ sys::fs::F_Append | sys::fs::F_Text);
if (!Err.empty()) {
delete OS;
return Error(IDLoc, Twine("can't open secure log file: ") +
diff --git a/lib/Support/Path.cpp b/lib/Support/Path.cpp
index 5b8be18db3f..1bd94a76faf 100644
--- a/lib/Support/Path.cpp
+++ b/lib/Support/Path.cpp
@@ -201,9 +201,9 @@ retry_random_path:
// Try to open + create the file.
switch (Type) {
case FS_File: {
- if (error_code EC = sys::fs::openFileForWrite(
- Twine(ResultPath.begin()), ResultFD,
- sys::fs::F_RW | sys::fs::F_Excl | sys::fs::F_Binary, Mode)) {
+ if (error_code EC =
+ sys::fs::openFileForWrite(Twine(ResultPath.begin()), ResultFD,
+ sys::fs::F_RW | sys::fs::F_Excl, Mode)) {
if (EC == errc::file_exists)
goto retry_random_path;
return EC;
diff --git a/lib/Support/Timer.cpp b/lib/Support/Timer.cpp
index 100b21e1221..0456f5d6383 100644
--- a/lib/Support/Timer.cpp
+++ b/lib/Support/Timer.cpp
@@ -66,8 +66,8 @@ raw_ostream *llvm::CreateInfoOutputFile() {
// compensate for this, the test-suite Makefiles have code to delete the
// info output file before running commands which write to it.
std::string Error;
- raw_ostream *Result =
- new raw_fd_ostream(OutputFilename.c_str(), Error, sys::fs::F_Append);
+ raw_ostream *Result = new raw_fd_ostream(
+ OutputFilename.c_str(), Error, sys::fs::F_Append | sys::fs::F_Text);
if (Error.empty())
return Result;
diff --git a/lib/Support/Windows/Path.inc b/lib/Support/Windows/Path.inc
index a72d0bf0b1b..98b2767c011 100644
--- a/lib/Support/Windows/Path.inc
+++ b/lib/Support/Windows/Path.inc
@@ -876,7 +876,7 @@ error_code openFileForWrite(const Twine &Name, int &ResultFD,
if (Flags & F_Append)
OpenFlags |= _O_APPEND;
- if (!(Flags & F_Binary))
+ if (Flags & F_Text)
OpenFlags |= _O_TEXT;
int FD = ::_open_osfhandle(intptr_t(H), OpenFlags);
diff --git a/lib/Support/raw_ostream.cpp b/lib/Support/raw_ostream.cpp
index 2d825e15091..3c45743666d 100644
--- a/lib/Support/raw_ostream.cpp
+++ b/lib/Support/raw_ostream.cpp
@@ -443,7 +443,7 @@ raw_fd_ostream::raw_fd_ostream(const char *Filename, std::string &ErrorInfo,
FD = STDOUT_FILENO;
// If user requested binary then put stdout into binary mode if
// possible.
- if (Flags & sys::fs::F_Binary)
+ if (!(Flags & sys::fs::F_Text))
sys::ChangeStdoutToBinary();
// Close stdout when we're done, to detect any output errors.
ShouldClose = true;
diff --git a/lib/TableGen/Main.cpp b/lib/TableGen/Main.cpp
index cf0d88b513e..6532268263c 100644
--- a/lib/TableGen/Main.cpp
+++ b/lib/TableGen/Main.cpp
@@ -57,7 +57,7 @@ static int createDependencyFile(const TGParser &Parser, const char *argv0) {
return 1;
}
std::string Error;
- tool_output_file DepOut(DependFilename.c_str(), Error, sys::fs::F_None);
+ tool_output_file DepOut(DependFilename.c_str(), Error, sys::fs::F_Text);
if (!Error.empty()) {
errs() << argv0 << ": error opening " << DependFilename
<< ":" << Error << "\n";
@@ -103,7 +103,7 @@ int TableGenMain(char *argv0, TableGenMainFn *MainFn) {
return 1;
std::string Error;
- tool_output_file Out(OutputFilename.c_str(), Error, sys::fs::F_None);
+ tool_output_file Out(OutputFilename.c_str(), Error, sys::fs::F_Text);
if (!Error.empty()) {
errs() << argv0 << ": error opening " << OutputFilename
<< ":" << Error << "\n";
diff --git a/lib/Target/TargetMachineC.cpp b/lib/Target/TargetMachineC.cpp
index f0644ea3cc2..0175ab99170 100644
--- a/lib/Target/TargetMachineC.cpp
+++ b/lib/Target/TargetMachineC.cpp
@@ -238,7 +238,7 @@ static LLVMBool LLVMTargetMachineEmit(LLVMTargetMachineRef T, LLVMModuleRef M,
LLVMBool LLVMTargetMachineEmitToFile(LLVMTargetMachineRef T, LLVMModuleRef M,
char* Filename, LLVMCodeGenFileType codegen, char** ErrorMessage) {
std::string error;
- raw_fd_ostream dest(Filename, error, sys::fs::F_Binary);
+ raw_fd_ostream dest(Filename, error, sys::fs::F_None);
if (!error.empty()) {
*ErrorMessage = strdup(error.c_str());
return true;
diff --git a/lib/Transforms/Instrumentation/DebugIR.cpp b/lib/Transforms/Instrumentation/DebugIR.cpp
index 1100689fb7e..f552bbffc0f 100644
--- a/lib/Transforms/Instrumentation/DebugIR.cpp
+++ b/lib/Transforms/Instrumentation/DebugIR.cpp
@@ -528,7 +528,7 @@ void DebugIR::writeDebugBitcode(const Module *M, int *fd) {
if (!fd) {
std::string Path = getPath();
- Out.reset(new raw_fd_ostream(Path.c_str(), error, sys::fs::F_None));
+ Out.reset(new raw_fd_ostream(Path.c_str(), error, sys::fs::F_Text));
DEBUG(dbgs() << "WRITING debug bitcode from Module " << M << " to file "
<< Path << "\n");
} else {
diff --git a/lib/Transforms/Instrumentation/GCOVProfiling.cpp b/lib/Transforms/Instrumentation/GCOVProfiling.cpp
index 0929142108a..8a3d5ea2db9 100644
--- a/lib/Transforms/Instrumentation/GCOVProfiling.cpp
+++ b/lib/Transforms/Instrumentation/GCOVProfiling.cpp
@@ -466,7 +466,7 @@ void GCOVProfiler::emitProfileNotes() {
DICompileUnit CU(CU_Nodes->getOperand(i));
std::string ErrorInfo;
raw_fd_ostream out(mangleName(CU, "gcno").c_str(), ErrorInfo,
- sys::fs::F_Binary);
+ sys::fs::F_None);
std::string EdgeDestinations;
DIArray SPs = CU.getSubprograms();
diff --git a/tools/bugpoint/OptimizerDriver.cpp b/tools/bugpoint/OptimizerDriver.cpp
index 411b772af52..f91f4937116 100644
--- a/tools/bugpoint/OptimizerDriver.cpp
+++ b/tools/bugpoint/OptimizerDriver.cpp
@@ -71,7 +71,7 @@ bool BugDriver::writeProgramToFile(const std::string &Filename, int FD,
bool BugDriver::writeProgramToFile(const std::string &Filename,
const Module *M) const {
std::string ErrInfo;
- tool_output_file Out(Filename.c_str(), ErrInfo, sys::fs::F_Binary);
+ tool_output_file Out(Filename.c_str(), ErrInfo, sys::fs::F_None);
if (ErrInfo.empty())
return writeProgramToFileAux(Out, M);
return true;
diff --git a/tools/llc/llc.cpp b/tools/llc/llc.cpp
index f8f02831913..3c4336addba 100644
--- a/tools/llc/llc.cpp
+++ b/tools/llc/llc.cpp
@@ -150,8 +150,8 @@ static tool_output_file *GetOutputStream(const char *TargetName,
// Open the file.
std::string error;
sys::fs::OpenFlags OpenFlags = sys::fs::F_None;
- if (Binary)
- OpenFlags |= sys::fs::F_Binary;
+ if (!Binary)
+ OpenFlags |= sys::fs::F_Text;
tool_output_file *FDOut = new tool_output_file(OutputFilename.c_str(), error,
OpenFlags);
if (!error.empty()) {
diff --git a/tools/lli/lli.cpp b/tools/lli/lli.cpp
index 7e928bebffb..448db84d1c9 100644
--- a/tools/lli/lli.cpp
+++ b/tools/lli/lli.cpp
@@ -273,7 +273,7 @@ public:
sys::path::remove_filename(dir);
sys::fs::create_directories(Twine(dir));
}
- raw_fd_ostream outfile(CacheName.c_str(), errStr, sys::fs::F_Binary);
+ raw_fd_ostream outfile(CacheName.c_str(), errStr, sys::fs::F_None);
outfile.write(Obj->getBufferStart(), Obj->getBufferSize());
outfile.close();
}
diff --git a/tools/llvm-ar/llvm-ar.cpp b/tools/llvm-ar/llvm-ar.cpp
index 64d45bcb091..7db4b8308ea 100644
--- a/tools/llvm-ar/llvm-ar.cpp
+++ b/tools/llvm-ar/llvm-ar.cpp
@@ -322,7 +322,7 @@ static void doExtract(StringRef Name, object::Archive::child_iterator I) {
int FD;
failIfError(
- sys::fs::openFileForWrite(Storage.c_str(), FD, sys::fs::F_Binary, Mode),
+ sys::fs::openFileForWrite(Storage.c_str(), FD, sys::fs::F_None, Mode),
Storage.c_str());
{
diff --git a/tools/llvm-as/llvm-as.cpp b/tools/llvm-as/llvm-as.cpp
index d13caf1955e..a9a230536ee 100644
--- a/tools/llvm-as/llvm-as.cpp
+++ b/tools/llvm-as/llvm-as.cpp
@@ -70,7 +70,7 @@ static void WriteOutputFile(const Module *M) {
std::string ErrorInfo;
OwningPtr<tool_output_file> Out(new tool_output_file(
- OutputFilename.c_str(), ErrorInfo, sys::fs::F_Binary));
+ OutputFilename.c_str(), ErrorInfo, sys::fs::F_None));
if (!ErrorInfo.empty()) {
errs() << ErrorInfo << '\n';
exit(1);
diff --git a/tools/llvm-dis/llvm-dis.cpp b/tools/llvm-dis/llvm-dis.cpp
index 9fb056510c0..f25b040a81f 100644
--- a/tools/llvm-dis/llvm-dis.cpp
+++ b/tools/llvm-dis/llvm-dis.cpp
@@ -172,7 +172,7 @@ int main(int argc, char **argv) {
std::string ErrorInfo;
OwningPtr<tool_output_file> Out(new tool_output_file(
- OutputFilename.c_str(), ErrorInfo, sys::fs::F_Binary));
+ OutputFilename.c_str(), ErrorInfo, sys::fs::F_None));
if (!ErrorInfo.empty()) {
errs() << ErrorInfo << '\n';
return 1;
diff --git a/tools/llvm-extract/llvm-extract.cpp b/tools/llvm-extract/llvm-extract.cpp
index 639e8fc2d04..45c920ff3c1 100644
--- a/tools/llvm-extract/llvm-extract.cpp
+++ b/tools/llvm-extract/llvm-extract.cpp
@@ -265,7 +265,7 @@ int main(int argc, char **argv) {
Passes.add(createStripDeadPrototypesPass()); // Remove dead func decls
std::string ErrorInfo;
- tool_output_file Out(OutputFilename.c_str(), ErrorInfo, sys::fs::F_Binary);
+ tool_output_file Out(OutputFilename.c_str(), ErrorInfo, sys::fs::F_None);
if (!ErrorInfo.empty()) {
errs() << ErrorInfo << '\n';
return 1;
diff --git a/tools/llvm-link/llvm-link.cpp b/tools/llvm-link/llvm-link.cpp
index 11870fa7683..f1b32de04b8 100644
--- a/tools/llvm-link/llvm-link.cpp
+++ b/tools/llvm-link/llvm-link.cpp
@@ -110,7 +110,7 @@ int main(int argc, char **argv) {
if (DumpAsm) errs() << "Here's the assembly:\n" << *Composite;
std::string ErrorInfo;
- tool_output_file Out(OutputFilename.c_str(), ErrorInfo, sys::fs::F_Binary);
+ tool_output_file Out(OutputFilename.c_str(), ErrorInfo, sys::fs::F_None);
if (!ErrorInfo.empty()) {
errs() << ErrorInfo << '\n';
return 1;
diff --git a/tools/llvm-lto/llvm-lto.cpp b/tools/llvm-lto/llvm-lto.cpp
index e12852981b5..d984773cddb 100644
--- a/tools/llvm-lto/llvm-lto.cpp
+++ b/tools/llvm-lto/llvm-lto.cpp
@@ -142,7 +142,7 @@ int main(int argc, char **argv) {
}
raw_fd_ostream FileStream(OutputFilename.c_str(), ErrorInfo,
- sys::fs::F_Binary);
+ sys::fs::F_None);
if (!ErrorInfo.empty()) {
errs() << argv[0] << ": error opening the file '" << OutputFilename
<< "': " << ErrorInfo << "\n";
diff --git a/tools/llvm-mc/llvm-mc.cpp b/tools/llvm-mc/llvm-mc.cpp
index 02e78a27072..9c7e76cd330 100644
--- a/tools/llvm-mc/llvm-mc.cpp
+++ b/tools/llvm-mc/llvm-mc.cpp
@@ -211,7 +211,7 @@ static tool_output_file *GetOutputStream() {
std::string Err;
tool_output_file *Out =
- new tool_output_file(OutputFilename.c_str(), Err, sys::fs::F_Binary);
+ new tool_output_file(OutputFilename.c_str(), Err, sys::fs::F_None);
if (!Err.empty()) {
errs() << Err << '\n';
delete Out;
diff --git a/tools/llvm-objdump/llvm-objdump.cpp b/tools/llvm-objdump/llvm-objdump.cpp
index e090f688a4b..8d934cf9485 100644
--- a/tools/llvm-objdump/llvm-objdump.cpp
+++ b/tools/llvm-objdump/llvm-objdump.cpp
@@ -192,7 +192,7 @@ static void emitDOTFile(const char *FileName, const MCFunction &f,
MCInstPrinter *IP) {
// Start a new dot file.
std::string Error;
- raw_fd_ostream Out(FileName, Error, sys::fs::F_None);
+ raw_fd_ostream Out(FileName, Error, sys::fs::F_Text);
if (!Error.empty()) {
errs() << "llvm-objdump: warning: " << Error << '\n';
return;
@@ -373,7 +373,7 @@ static void DisassembleObject(const ObjectFile *Obj, bool InlineRelocs) {
}
if (!YAMLCFG.empty()) {
std::string Error;
- raw_fd_ostream YAMLOut(YAMLCFG.c_str(), Error, sys::fs::F_None);
+ raw_fd_ostream YAMLOut(YAMLCFG.c_str(), Error, sys::fs::F_Text);
if (!Error.empty()) {
errs() << ToolName << ": warning: " << Error << '\n';
return;
diff --git a/tools/llvm-profdata/llvm-profdata.cpp b/tools/llvm-profdata/llvm-profdata.cpp
index b2f52b29dc1..236780b4853 100644
--- a/tools/llvm-profdata/llvm-profdata.cpp
+++ b/tools/llvm-profdata/llvm-profdata.cpp
@@ -112,7 +112,7 @@ int main(int argc, char **argv) {
OutputFilename = "-";
std::string ErrorInfo;
- raw_fd_ostream Output(OutputFilename.data(), ErrorInfo, sys::fs::F_None);
+ raw_fd_ostream Output(OutputFilename.data(), ErrorInfo, sys::fs::F_Text);
if (!ErrorInfo.empty())
exitWithError(ErrorInfo, OutputFilename);
diff --git a/tools/llvm-stress/llvm-stress.cpp b/tools/llvm-stress/llvm-stress.cpp
index 1b6bdd17144..beb0a6042d2 100644
--- a/tools/llvm-stress/llvm-stress.cpp
+++ b/tools/llvm-stress/llvm-stress.cpp
@@ -705,7 +705,7 @@ int main(int argc, char **argv) {
std::string ErrorInfo;
Out.reset(new tool_output_file(OutputFilename.c_str(), ErrorInfo,
- sys::fs::F_Binary));
+ sys::fs::F_None));
if (!ErrorInfo.empty()) {
errs() << ErrorInfo << '\n';
return 1;
diff --git a/tools/opt/opt.cpp b/tools/opt/opt.cpp
index b9d3f9d6d21..9ab43148dab 100644
--- a/tools/opt/opt.cpp
+++ b/tools/opt/opt.cpp
@@ -381,7 +381,7 @@ int main(int argc, char **argv) {
std::string ErrorInfo;
Out.reset(new tool_output_file(OutputFilename.c_str(), ErrorInfo,
- sys::fs::F_Binary));
+ sys::fs::F_None));
if (!ErrorInfo.empty()) {
errs() << ErrorInfo << '\n';
return 1;
@@ -467,7 +467,7 @@ int main(int argc, char **argv) {
std::string ErrorInfo;
Out.reset(new tool_output_file(OutputFilename.c_str(), ErrorInfo,
- sys::fs::F_Binary));
+ sys::fs::F_None));
if (!ErrorInfo.empty()) {
errs() << ErrorInfo << '\n';
return 1;
diff --git a/unittests/Support/Path.cpp b/unittests/Support/Path.cpp
index d834ec04e04..f10faf9908b 100644
--- a/unittests/Support/Path.cpp
+++ b/unittests/Support/Path.cpp
@@ -501,7 +501,7 @@ TEST_F(FileSystemTest, Magic) {
SmallString<128> file_pathname(TestDirectory);
path::append(file_pathname, i->filename);
std::string ErrMsg;
- raw_fd_ostream file(file_pathname.c_str(), ErrMsg, sys::fs::F_Binary);
+ raw_fd_ostream file(file_pathname.c_str(), ErrMsg, sys::fs::F_None);
ASSERT_FALSE(file.has_error());
StringRef magic(i->magic_str, i->magic_str_len);
file << magic;
@@ -521,7 +521,7 @@ TEST_F(FileSystemTest, CarriageReturn) {
path::append(FilePathname, "test");
{
- raw_fd_ostream File(FilePathname.c_str(), ErrMsg, sys::fs::F_None);
+ raw_fd_ostream File(FilePathname.c_str(), ErrMsg, sys::fs::F_Text);
EXPECT_EQ(ErrMsg, "");
File << '\n';
}
@@ -532,7 +532,7 @@ TEST_F(FileSystemTest, CarriageReturn) {
}
{
- raw_fd_ostream File(FilePathname.c_str(), ErrMsg, sys::fs::F_Binary);
+ raw_fd_ostream File(FilePathname.c_str(), ErrMsg, sys::fs::F_None);
EXPECT_EQ(ErrMsg, "");
File << '\n';
}
diff --git a/utils/FileUpdate/FileUpdate.cpp b/utils/FileUpdate/FileUpdate.cpp
index fbcd9277cd5..3064503478a 100644
--- a/utils/FileUpdate/FileUpdate.cpp
+++ b/utils/FileUpdate/FileUpdate.cpp
@@ -71,7 +71,7 @@ int main(int argc, char **argv) {
<< "', contents changed.\n";
std::string ErrorStr;
tool_output_file OutStream(OutputFilename.c_str(), ErrorStr,
- sys::fs::F_Binary);
+ sys::fs::F_None);
if (!ErrorStr.empty()) {
errs() << argv[0] << ": Unable to write output '"
<< OutputFilename << "': " << ErrorStr << '\n';