Replace the F_Binary flag with a F_Text one.
authorRafael Espindola <rafael.espindola@gmail.com>
Mon, 24 Feb 2014 18:20:12 +0000 (18:20 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Mon, 24 Feb 2014 18:20:12 +0000 (18:20 +0000)
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

35 files changed:
examples/BrainF/BrainFDriver.cpp
include/llvm/Analysis/DOTGraphTraitsPass.h
include/llvm/Support/FileSystem.h
lib/Analysis/CFGPrinter.cpp
lib/Bitcode/Writer/BitWriter.cpp
lib/CodeGen/MachineVerifier.cpp
lib/CodeGen/RegAllocPBQP.cpp
lib/IR/Core.cpp
lib/IR/GCOV.cpp
lib/LTO/LTOCodeGenerator.cpp
lib/MC/MCParser/DarwinAsmParser.cpp
lib/Support/Path.cpp
lib/Support/Timer.cpp
lib/Support/Windows/Path.inc
lib/Support/raw_ostream.cpp
lib/TableGen/Main.cpp
lib/Target/TargetMachineC.cpp
lib/Transforms/Instrumentation/DebugIR.cpp
lib/Transforms/Instrumentation/GCOVProfiling.cpp
tools/bugpoint/OptimizerDriver.cpp
tools/llc/llc.cpp
tools/lli/lli.cpp
tools/llvm-ar/llvm-ar.cpp
tools/llvm-as/llvm-as.cpp
tools/llvm-dis/llvm-dis.cpp
tools/llvm-extract/llvm-extract.cpp
tools/llvm-link/llvm-link.cpp
tools/llvm-lto/llvm-lto.cpp
tools/llvm-mc/llvm-mc.cpp
tools/llvm-objdump/llvm-objdump.cpp
tools/llvm-profdata/llvm-profdata.cpp
tools/llvm-stress/llvm-stress.cpp
tools/opt/opt.cpp
unittests/Support/Path.cpp
utils/FileUpdate/FileUpdate.cpp

index be59c4fc8cbc2b227a6c9318ed3c349ae2dfc030..d726464a5276e0e765540295b2cf1a46c5c6940f 100644 (file)
@@ -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);
     }
   }
 
index 6a6abc20e03bf9869393c0dba0ebad10a1d2e0e0..fc3fc708df66b62fc8cebfc6ef4dbbc30239123f 100644 (file)
@@ -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())
index 6fa4728f3d397a245ef379980d0a3d13024a8f84..d975a914ff11117a6dc56e7717a74acfc11bc224 100644 (file)
@@ -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
index 3c67618450ce7cd810349731ab84ae8318beb6f3..3f768ce7806a113978440dfe637a29f2a7e4f9d4 100644 (file)
@@ -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);
index cd1ada22cfd6cffa4874c1440394b874d10ece63..0275f96fc9ba380db8d8e3a1c8dc3629ed4416bf 100644 (file)
@@ -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;
index d61470c173bcd0713dc99ec9f486851f309739e1..aa89b83e72790311f8873b9a302878a7a7efce96 100644 (file)
@@ -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);
index 56fdb45f4e0b3b865107e97a3764c0e081e15e56..347329591b58e404d8bbbeb95a78ecdbf9896dc8 100644 (file)
@@ -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);
index dbaf02edf6c8ea79d6cb507c5bd540a7e3cdb690..68bc5c5810ebd08a0d727829868dc7b2c27bc7f2 100644 (file)
@@ -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;
index 3311d2ef42eb9da86f6566347aea6d8486bb6b62..a0591fffb9a5344df2510704c0b8cd9e07ff4cf2 100644 (file)
@@ -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";
 
index 2b37802efc4a71b2487820a1936e79f19f9d09c6..fb272ad51348c777bd49bca00181e4ef8191542d 100644 (file)
@@ -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;
index 6d66e308e8c3e183d2d4679049fd6d701c9caf43..39399c0865627d5153c2ab1cc686d36f4fc992f1 100644 (file)
@@ -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: ") +
index 5b8be18db3f7137d7ee015092ea2b0c1a9694c66..1bd94a76faf7934bc1047140c1960c9ba969b06c 100644 (file)
@@ -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;
index 100b21e1221061fc034bf8097d227e79fe060a2e..0456f5d638308a5d444167960104525173ad123a 100644 (file)
@@ -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;
   
index a72d0bf0b1be450855c4d6eb9a9f54a2f3fec506..98b2767c011a61a4954356fb9281be180d4856ef 100644 (file)
@@ -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);
index 2d825e1509143440ec6b3dc4114eaaa8d7fb152d..3c45743666dc6e167e7dffd1d5ba73ec74e66e54 100644 (file)
@@ -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;
index cf0d88b513e49df80354882f3989cb600f82f2dd..6532268263c7582e23b0fc5989528fa7517095a8 100644 (file)
@@ -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";
index f0644ea3cc232f0fd1dbeee3e879567cb1c0f5a8..0175ab9917036c8e80e00fa9310b3dcab6c30743 100644 (file)
@@ -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;
index 1100689fb7e638d8c04d753d7513fe955deae3d6..f552bbffc0fa4c3caa7e067cb86acf6a7b017e49 100644 (file)
@@ -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 {
index 0929142108a7dc21f5a3e565866cbf3fd16e2489..8a3d5ea2db9076de202b5c62641e969ab020d2d0 100644 (file)
@@ -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();
index 411b772af52f00de2947993486b31f1c062b6850..f91f49371166c3a056527eb5d45ebe277bb13e64 100644 (file)
@@ -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;
index f8f02831913d16ca4b9ba19459b6b4d458e9729c..3c4336addbaf6fc5b79c352110275d9e0df8a4c7 100644 (file)
@@ -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()) {
index 7e928bebffbffd90a70125fe55cee209201605df..448db84d1c9a221d700389b3d52ae1ee2f1295b6 100644 (file)
@@ -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();
   }
index 64d45bcb0915cd405e96a5b3757affdc98691254..7db4b8308eabc87e23f8b25988d5fc7e201a23d6 100644 (file)
@@ -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());
 
   {
index d13caf1955e44e05088672143662e1052055503a..a9a230536ee74221ed5823627e53ad68563b95f6 100644 (file)
@@ -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);
index 9fb056510c007a188a707880cf23649cebdd5b0e..f25b040a81f78a56015b01cb487ff3963cf7c650 100644 (file)
@@ -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;
index 639e8fc2d045a4e5316d193c180f83ec504c2994..45c920ff3c1a35881ef78114bb39f0548f72c936 100644 (file)
@@ -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;
index 11870fa7683a2a676c9052c03c8c42031ab6e0e8..f1b32de04b87ef95888a23536e4b6cf32929220f 100644 (file)
@@ -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;
index e12852981b5220c7ee152de64b0bf7c6d6b4fc0d..d984773cddbdb04f4b1bed835a11f061b406a23b 100644 (file)
@@ -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";
index 02e78a270720ebdc10432f1245dd9223af87b8f7..9c7e76cd33066d312a3fa82ebeed4d5961711716 100644 (file)
@@ -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;
index e090f688a4b666f7e62b2ecf71ef26950c252585..8d934cf94854a28e6d2ecc318828a6bfab6d35a7 100644 (file)
@@ -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;
index b2f52b29dc1eeb88281a9fdffa5ea46fc5f5be75..236780b485300776b92813f3ce8e72fc87b754f7 100644 (file)
@@ -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);
 
index 1b6bdd17144331c6dea4d468d3c18b9b1a6c47e7..beb0a6042d277473c90c11e37966201795fdfb70 100644 (file)
@@ -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;
index b9d3f9d6d21b9c774164cff0daf57bbcf40fb196..9ab43148dabb47450db5af3afa1fca7fc9d4702b 100644 (file)
@@ -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;
index d834ec04e048968c29b76d5af52629ac4c110d7a..f10faf9908b4e92dce186904e2aa623315ff5cad 100644 (file)
@@ -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';
   }
index fbcd9277cd51469a86f718d3160d6eeef6c8d9d0..3064503478a45ba0403f20959794a830c5f94ac4 100644 (file)
@@ -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';