abhina.sreeskantharajan created this revision. Herald added subscribers: dexonsmith, wenlei, okura, kuter, cmtice, martong, steven_wu, gbedwell, hiraditya, qcolombet, MatzeB. Herald added a reviewer: bollu. Herald added a reviewer: JDevlieghere. Herald added a reviewer: andreadb. Herald added a reviewer: jhenderson. abhina.sreeskantharajan requested review of this revision. Herald added subscribers: llvm-commits, lldb-commits, cfe-commits, bbn, MaskRay. Herald added a reviewer: jdoerfert. Herald added a reviewer: sstefan1. Herald added a reviewer: baziotis. Herald added projects: clang, LLDB, LLVM, clang-tools-extra.
On SystemZ we need to open text files in text mode, but on Windows this may not be desirable if we want to suppress CRLF translation. 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. Major change 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; Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D99426 Files: clang-tools-extra/clang-move/tool/ClangMove.cpp clang-tools-extra/modularize/ModuleAssistant.cpp clang-tools-extra/pp-trace/PPTrace.cpp clang/lib/ARCMigrate/PlistReporter.cpp clang/lib/Driver/Compilation.cpp clang/lib/Driver/ToolChains/Clang.cpp clang/lib/Frontend/CompilerInstance.cpp clang/lib/Frontend/DependencyFile.cpp clang/lib/Frontend/DependencyGraph.cpp clang/lib/Frontend/FrontendActions.cpp clang/lib/Frontend/HeaderIncludeGen.cpp clang/lib/Frontend/ModuleDependencyCollector.cpp clang/lib/Serialization/ASTReader.cpp clang/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp clang/lib/StaticAnalyzer/Core/SarifDiagnostics.cpp clang/tools/clang-refactor/ClangRefactor.cpp clang/tools/driver/cc1as_main.cpp flang/lib/Frontend/CompilerInstance.cpp lld/COFF/DriverUtils.cpp lld/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp lldb/include/lldb/Utility/ReproducerProvider.h lldb/source/Utility/GDBRemote.cpp lldb/source/Utility/ReproducerProvider.cpp lldb/tools/lldb-server/LLDBServerUtilities.cpp llvm/include/llvm/Analysis/DOTGraphTraitsPass.h llvm/include/llvm/Support/FileSystem.h llvm/lib/CodeGen/RegAllocPBQP.cpp llvm/lib/IR/Core.cpp llvm/lib/IR/LLVMRemarkStreamer.cpp llvm/lib/LTO/LTOBackend.cpp llvm/lib/MC/MCParser/DarwinAsmParser.cpp llvm/lib/ProfileData/GCOV.cpp llvm/lib/ProfileData/SampleProfWriter.cpp llvm/lib/Support/FileCollector.cpp llvm/lib/Support/MemoryBuffer.cpp llvm/lib/Support/TimeProfiler.cpp llvm/lib/Support/Timer.cpp llvm/lib/Support/Unix/Program.inc llvm/lib/Support/Windows/Path.inc llvm/lib/Support/Windows/Program.inc llvm/lib/Transforms/IPO/Attributor.cpp llvm/lib/Transforms/IPO/LowerTypeTests.cpp llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp llvm/lib/Transforms/Utils/Debugify.cpp llvm/tools/dsymutil/DwarfLinkerForBinary.cpp llvm/tools/dsymutil/dsymutil.cpp llvm/tools/llc/llc.cpp llvm/tools/lli/lli.cpp llvm/tools/llvm-cxxmap/llvm-cxxmap.cpp llvm/tools/llvm-dis/llvm-dis.cpp llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp llvm/tools/llvm-exegesis/lib/BenchmarkResult.cpp llvm/tools/llvm-link/llvm-link.cpp llvm/tools/llvm-mc/llvm-mc.cpp llvm/tools/llvm-mca/llvm-mca.cpp llvm/tools/llvm-opt-report/OptReport.cpp llvm/tools/llvm-profdata/llvm-profdata.cpp llvm/tools/llvm-xray/xray-account.cpp llvm/tools/llvm-xray/xray-converter.cpp llvm/tools/llvm-xray/xray-extract.cpp llvm/tools/llvm-xray/xray-graph-diff.cpp llvm/tools/llvm-xray/xray-graph.cpp llvm/tools/opt/opt.cpp llvm/tools/verify-uselistorder/verify-uselistorder.cpp llvm/unittests/Support/Path.cpp polly/lib/Exchange/JSONExporter.cpp
Index: polly/lib/Exchange/JSONExporter.cpp =================================================================== --- polly/lib/Exchange/JSONExporter.cpp +++ polly/lib/Exchange/JSONExporter.cpp @@ -178,7 +178,7 @@ // Write to file. std::error_code EC; - ToolOutputFile F(FileName, EC, llvm::sys::fs::OF_Text); + ToolOutputFile F(FileName, EC, llvm::sys::fs::OF_TextWithCRLF); std::string FunctionName = S.getFunction().getName().str(); errs() << "Writing JScop '" << S.getNameStr() << "' in function '" Index: llvm/unittests/Support/Path.cpp =================================================================== --- llvm/unittests/Support/Path.cpp +++ llvm/unittests/Support/Path.cpp @@ -1253,7 +1253,7 @@ path::append(FilePathname, "test"); { - raw_fd_ostream File(FilePathname, EC, sys::fs::OF_Text); + raw_fd_ostream File(FilePathname, EC, sys::fs::OF_TextWithCRLF); ASSERT_NO_ERROR(EC); File << '\n'; } Index: llvm/tools/verify-uselistorder/verify-uselistorder.cpp =================================================================== --- llvm/tools/verify-uselistorder/verify-uselistorder.cpp +++ llvm/tools/verify-uselistorder/verify-uselistorder.cpp @@ -136,7 +136,7 @@ bool TempFile::writeAssembly(const Module &M) const { LLVM_DEBUG(dbgs() << " - write assembly\n"); std::error_code EC; - raw_fd_ostream OS(Filename, EC, sys::fs::OF_Text); + raw_fd_ostream OS(Filename, EC, sys::fs::OF_TextWithCRLF); if (EC) { errs() << "verify-uselistorder: error: " << EC.message() << "\n"; return true; Index: llvm/tools/opt/opt.cpp =================================================================== --- llvm/tools/opt/opt.cpp +++ llvm/tools/opt/opt.cpp @@ -700,8 +700,8 @@ OutputFilename = "-"; std::error_code EC; - sys::fs::OpenFlags Flags = OutputAssembly ? sys::fs::OF_Text - : sys::fs::OF_None; + sys::fs::OpenFlags Flags = + OutputAssembly ? sys::fs::OF_TextWithCRLF : sys::fs::OF_None; Out.reset(new ToolOutputFile(OutputFilename, EC, Flags)); if (EC) { errs() << EC.message() << '\n'; Index: llvm/tools/llvm-xray/xray-graph.cpp =================================================================== --- llvm/tools/llvm-xray/xray-graph.cpp +++ llvm/tools/llvm-xray/xray-graph.cpp @@ -523,7 +523,7 @@ auto &GR = *GROrError; std::error_code EC; - raw_fd_ostream OS(GraphOutput, EC, sys::fs::OpenFlags::OF_Text); + raw_fd_ostream OS(GraphOutput, EC, sys::fs::OpenFlags::OF_TextWithCRLF); if (EC) return make_error<StringError>( Twine("Cannot open file '") + GraphOutput + "' for writing.", EC); Index: llvm/tools/llvm-xray/xray-graph-diff.cpp =================================================================== --- llvm/tools/llvm-xray/xray-graph-diff.cpp +++ llvm/tools/llvm-xray/xray-graph-diff.cpp @@ -456,7 +456,7 @@ auto &GDR = *GDROrErr; std::error_code EC; - raw_fd_ostream OS(GraphDiffOutput, EC, sys::fs::OpenFlags::OF_Text); + raw_fd_ostream OS(GraphDiffOutput, EC, sys::fs::OpenFlags::OF_TextWithCRLF); if (EC) return make_error<StringError>( Twine("Cannot open file '") + GraphDiffOutput + "' for writing.", EC); Index: llvm/tools/llvm-xray/xray-extract.cpp =================================================================== --- llvm/tools/llvm-xray/xray-extract.cpp +++ llvm/tools/llvm-xray/xray-extract.cpp @@ -83,7 +83,7 @@ InstrumentationMapOrError.takeError()); std::error_code EC; - raw_fd_ostream OS(ExtractOutput, EC, sys::fs::OpenFlags::OF_Text); + raw_fd_ostream OS(ExtractOutput, EC, sys::fs::OpenFlags::OF_TextWithCRLF); if (EC) return make_error<StringError>( Twine("Cannot open file '") + ExtractOutput + "' for writing.", EC); Index: llvm/tools/llvm-xray/xray-converter.cpp =================================================================== --- llvm/tools/llvm-xray/xray-converter.cpp +++ llvm/tools/llvm-xray/xray-converter.cpp @@ -381,7 +381,7 @@ raw_fd_ostream OS(ConvertOutput, EC, ConvertOutputFormat == ConvertFormats::BINARY ? sys::fs::OpenFlags::OF_None - : sys::fs::OpenFlags::OF_Text); + : sys::fs::OpenFlags::OF_TextWithCRLF); if (EC) return make_error<StringError>( Twine("Cannot open file '") + ConvertOutput + "' for writing.", EC); Index: llvm/tools/llvm-xray/xray-account.cpp =================================================================== --- llvm/tools/llvm-xray/xray-account.cpp +++ llvm/tools/llvm-xray/xray-account.cpp @@ -459,7 +459,7 @@ } std::error_code EC; - raw_fd_ostream OS(AccountOutput, EC, sys::fs::OpenFlags::OF_Text); + raw_fd_ostream OS(AccountOutput, EC, sys::fs::OpenFlags::OF_TextWithCRLF); if (EC) return make_error<StringError>( Twine("Cannot open file '") + AccountOutput + "' for writing.", EC); Index: llvm/tools/llvm-profdata/llvm-profdata.cpp =================================================================== --- llvm/tools/llvm-profdata/llvm-profdata.cpp +++ llvm/tools/llvm-profdata/llvm-profdata.cpp @@ -305,7 +305,7 @@ InstrProfWriter &Writer) { std::error_code EC; raw_fd_ostream Output(OutputFilename.data(), EC, - OutputFormat == PF_Text ? sys::fs::OF_Text + OutputFormat == PF_Text ? sys::fs::OF_TextWithCRLF : sys::fs::OF_None); if (EC) exitWithErrorCode(EC, OutputFilename); @@ -1930,7 +1930,7 @@ cl::ParseCommandLineOptions(argc, argv, "LLVM profile data overlap tool\n"); std::error_code EC; - raw_fd_ostream OS(Output.data(), EC, sys::fs::OF_Text); + raw_fd_ostream OS(Output.data(), EC, sys::fs::OF_TextWithCRLF); if (EC) exitWithErrorCode(EC, Output); @@ -2456,7 +2456,7 @@ } std::error_code EC; - raw_fd_ostream OS(OutputFilename.data(), EC, sys::fs::OF_Text); + raw_fd_ostream OS(OutputFilename.data(), EC, sys::fs::OF_TextWithCRLF); if (EC) exitWithErrorCode(EC, OutputFilename); Index: llvm/tools/llvm-opt-report/OptReport.cpp =================================================================== --- llvm/tools/llvm-opt-report/OptReport.cpp +++ llvm/tools/llvm-opt-report/OptReport.cpp @@ -247,7 +247,7 @@ static bool writeReport(LocationInfoTy &LocationInfo) { std::error_code EC; - llvm::raw_fd_ostream OS(OutputFileName, EC, llvm::sys::fs::OF_Text); + llvm::raw_fd_ostream OS(OutputFileName, EC, llvm::sys::fs::OF_TextWithCRLF); if (EC) { WithColor::error() << "Can't open file " << OutputFileName << ": " << EC.message() << "\n"; Index: llvm/tools/llvm-mca/llvm-mca.cpp =================================================================== --- llvm/tools/llvm-mca/llvm-mca.cpp +++ llvm/tools/llvm-mca/llvm-mca.cpp @@ -244,8 +244,8 @@ if (OutputFilename == "") OutputFilename = "-"; std::error_code EC; - auto Out = - std::make_unique<ToolOutputFile>(OutputFilename, EC, sys::fs::OF_Text); + auto Out = std::make_unique<ToolOutputFile>(OutputFilename, EC, + sys::fs::OF_TextWithCRLF); if (!EC) return std::move(Out); return EC; Index: llvm/tools/llvm-mc/llvm-mc.cpp =================================================================== --- llvm/tools/llvm-mc/llvm-mc.cpp +++ llvm/tools/llvm-mc/llvm-mc.cpp @@ -447,8 +447,9 @@ FeaturesStr = Features.getString(); } - sys::fs::OpenFlags Flags = (FileType == OFT_AssemblyFile) ? sys::fs::OF_Text - : sys::fs::OF_None; + sys::fs::OpenFlags Flags = (FileType == OFT_AssemblyFile) + ? sys::fs::OF_TextWithCRLF + : sys::fs::OF_None; std::unique_ptr<ToolOutputFile> Out = GetOutputStream(OutputFilename, Flags); if (!Out) return 1; Index: llvm/tools/llvm-link/llvm-link.cpp =================================================================== --- llvm/tools/llvm-link/llvm-link.cpp +++ llvm/tools/llvm-link/llvm-link.cpp @@ -465,7 +465,8 @@ std::error_code EC; ToolOutputFile Out(OutputFilename, EC, - OutputAssembly ? sys::fs::OF_Text : sys::fs::OF_None); + OutputAssembly ? sys::fs::OF_TextWithCRLF + : sys::fs::OF_None); if (EC) { WithColor::error() << EC.message() << '\n'; return 1; Index: llvm/tools/llvm-exegesis/lib/BenchmarkResult.cpp =================================================================== --- llvm/tools/llvm-exegesis/lib/BenchmarkResult.cpp +++ llvm/tools/llvm-exegesis/lib/BenchmarkResult.cpp @@ -401,8 +401,9 @@ return Err; } else { int ResultFD = 0; - if (auto E = errorCodeToError(openFileForWrite( - Filename, ResultFD, sys::fs::CD_CreateAlways, sys::fs::OF_Text))) { + if (auto E = errorCodeToError(openFileForWrite(Filename, ResultFD, + sys::fs::CD_CreateAlways, + sys::fs::OF_TextWithCRLF))) { return E; } raw_fd_ostream Ostr(ResultFD, true /*shouldClose*/); Index: llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp =================================================================== --- llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp +++ llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp @@ -628,7 +628,7 @@ } std::error_code EC; - ToolOutputFile OutputFile(OutputFilename, EC, sys::fs::OF_Text); + ToolOutputFile OutputFile(OutputFilename, EC, sys::fs::OF_TextWithCRLF); error("Unable to open output file" + OutputFilename, EC); // Don't remove output file if we exit with an error. OutputFile.keep(); Index: llvm/tools/llvm-dis/llvm-dis.cpp =================================================================== --- llvm/tools/llvm-dis/llvm-dis.cpp +++ llvm/tools/llvm-dis/llvm-dis.cpp @@ -203,7 +203,7 @@ std::error_code EC; std::unique_ptr<ToolOutputFile> Out( - new ToolOutputFile(FinalFilename, EC, sys::fs::OF_Text)); + new ToolOutputFile(FinalFilename, EC, sys::fs::OF_TextWithCRLF)); if (EC) { errs() << EC.message() << '\n'; return 1; Index: llvm/tools/llvm-cxxmap/llvm-cxxmap.cpp =================================================================== --- llvm/tools/llvm-cxxmap/llvm-cxxmap.cpp +++ llvm/tools/llvm-cxxmap/llvm-cxxmap.cpp @@ -145,7 +145,7 @@ exitWithErrorCode(RemappingBufOrError.getError(), RemappingFile); std::error_code EC; - raw_fd_ostream OS(OutputFilename.data(), EC, sys::fs::OF_Text); + raw_fd_ostream OS(OutputFilename.data(), EC, sys::fs::OF_TextWithCRLF); if (EC) exitWithErrorCode(EC, OutputFilename); Index: llvm/tools/lli/lli.cpp =================================================================== --- llvm/tools/lli/lli.cpp +++ llvm/tools/lli/lli.cpp @@ -789,7 +789,8 @@ case DumpKind::DumpModsToDisk: return [](Module &M) { std::error_code EC; - raw_fd_ostream Out(M.getModuleIdentifier() + ".ll", EC, sys::fs::OF_Text); + raw_fd_ostream Out(M.getModuleIdentifier() + ".ll", EC, + sys::fs::OF_TextWithCRLF); if (EC) { errs() << "Couldn't open " << M.getModuleIdentifier() << " for dumping.\nError:" << EC.message() << "\n"; Index: llvm/tools/llc/llc.cpp =================================================================== --- llvm/tools/llc/llc.cpp +++ llvm/tools/llc/llc.cpp @@ -276,7 +276,7 @@ std::error_code EC; sys::fs::OpenFlags OpenFlags = sys::fs::OF_None; if (!Binary) - OpenFlags |= sys::fs::OF_Text; + OpenFlags |= sys::fs::OF_TextWithCRLF; auto FDOut = std::make_unique<ToolOutputFile>(OutputFilename, EC, OpenFlags); if (EC) { reportError(EC.message()); Index: llvm/tools/dsymutil/dsymutil.cpp =================================================================== --- llvm/tools/dsymutil/dsymutil.cpp +++ llvm/tools/dsymutil/dsymutil.cpp @@ -312,7 +312,7 @@ SmallString<128> InfoPlist(BundleRoot); sys::path::append(InfoPlist, "Contents/Info.plist"); std::error_code EC; - raw_fd_ostream PL(InfoPlist, EC, sys::fs::OF_Text); + raw_fd_ostream PL(InfoPlist, EC, sys::fs::OF_TextWithCRLF); if (EC) return make_error<StringError>( "cannot create Plist: " + toString(errorCodeToError(EC)), EC); Index: llvm/tools/dsymutil/DwarfLinkerForBinary.cpp =================================================================== --- llvm/tools/dsymutil/DwarfLinkerForBinary.cpp +++ llvm/tools/dsymutil/DwarfLinkerForBinary.cpp @@ -255,7 +255,7 @@ raw_fd_ostream OS(Options.NoOutput ? "-" : Path.str(), EC, Options.RemarksFormat == remarks::Format::Bitstream ? sys::fs::OF_None - : sys::fs::OF_Text); + : sys::fs::OF_TextWithCRLF); if (EC) return errorCodeToError(EC); Index: llvm/lib/Transforms/Utils/Debugify.cpp =================================================================== --- llvm/lib/Transforms/Utils/Debugify.cpp +++ llvm/lib/Transforms/Utils/Debugify.cpp @@ -440,7 +440,7 @@ llvm::json::Array &Bugs) { std::error_code EC; raw_fd_ostream OS_FILE{OrigDIVerifyBugsReportFilePath, EC, - sys::fs::OF_Append | sys::fs::OF_Text}; + sys::fs::OF_Append | sys::fs::OF_TextWithCRLF}; if (EC) { errs() << "Could not open file: " << EC.message() << ", " << OrigDIVerifyBugsReportFilePath << '\n'; Index: llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp =================================================================== --- llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp +++ llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp @@ -918,7 +918,7 @@ ExitOnErr(errorCodeToError(EC)); WriteIndexToFile(*Summary, OS); } else { - raw_fd_ostream OS(ClWriteSummary, EC, sys::fs::OF_Text); + raw_fd_ostream OS(ClWriteSummary, EC, sys::fs::OF_TextWithCRLF); ExitOnErr(errorCodeToError(EC)); yaml::Output Out(OS); Out << *Summary; Index: llvm/lib/Transforms/IPO/LowerTypeTests.cpp =================================================================== --- llvm/lib/Transforms/IPO/LowerTypeTests.cpp +++ llvm/lib/Transforms/IPO/LowerTypeTests.cpp @@ -1722,7 +1722,7 @@ ExitOnError ExitOnErr("-lowertypetests-write-summary: " + ClWriteSummary + ": "); std::error_code EC; - raw_fd_ostream OS(ClWriteSummary, EC, sys::fs::OF_Text); + raw_fd_ostream OS(ClWriteSummary, EC, sys::fs::OF_TextWithCRLF); ExitOnErr(errorCodeToError(EC)); yaml::Output Out(OS); Index: llvm/lib/Transforms/IPO/Attributor.cpp =================================================================== --- llvm/lib/Transforms/IPO/Attributor.cpp +++ llvm/lib/Transforms/IPO/Attributor.cpp @@ -2413,7 +2413,7 @@ std::error_code EC; - raw_fd_ostream File(Filename, EC, sys::fs::OF_Text); + raw_fd_ostream File(Filename, EC, sys::fs::OF_TextWithCRLF); if (!EC) llvm::WriteGraph(File, this); Index: llvm/lib/Support/Windows/Program.inc =================================================================== --- llvm/lib/Support/Windows/Program.inc +++ llvm/lib/Support/Windows/Program.inc @@ -506,7 +506,7 @@ llvm::sys::writeFileWithEncoding(StringRef FileName, StringRef Contents, WindowsEncodingMethod Encoding) { std::error_code EC; - llvm::raw_fd_ostream OS(FileName, EC, llvm::sys::fs::OF_Text); + llvm::raw_fd_ostream OS(FileName, EC, llvm::sys::fs::OF_TextWithCRLF); if (EC) return EC; Index: llvm/lib/Support/Windows/Path.inc =================================================================== --- llvm/lib/Support/Windows/Path.inc +++ llvm/lib/Support/Windows/Path.inc @@ -1083,7 +1083,7 @@ if (Flags & OF_Append) CrtOpenFlags |= _O_APPEND; - if (Flags & OF_Text) + if (Flags & OF_CRLF) CrtOpenFlags |= _O_TEXT; ResultFD = -1; Index: llvm/lib/Support/Unix/Program.inc =================================================================== --- llvm/lib/Support/Unix/Program.inc +++ llvm/lib/Support/Unix/Program.inc @@ -507,7 +507,7 @@ llvm::sys::writeFileWithEncoding(StringRef FileName, StringRef Contents, WindowsEncodingMethod Encoding /*unused*/) { std::error_code EC; - llvm::raw_fd_ostream OS(FileName, EC, llvm::sys::fs::OpenFlags::OF_Text); + llvm::raw_fd_ostream OS(FileName, EC, llvm::sys::fs::OpenFlags::OF_TextWithCRLF); if (EC) return EC; Index: llvm/lib/Support/Timer.cpp =================================================================== --- llvm/lib/Support/Timer.cpp +++ llvm/lib/Support/Timer.cpp @@ -82,7 +82,7 @@ // info output file before running commands which write to it. std::error_code EC; auto Result = std::make_unique<raw_fd_ostream>( - OutputFilename, EC, sys::fs::OF_Append | sys::fs::OF_Text); + OutputFilename, EC, sys::fs::OF_Append | sys::fs::OF_TextWithCRLF); if (!EC) return Result; Index: llvm/lib/Support/TimeProfiler.cpp =================================================================== --- llvm/lib/Support/TimeProfiler.cpp +++ llvm/lib/Support/TimeProfiler.cpp @@ -304,7 +304,7 @@ } std::error_code EC; - raw_fd_ostream OS(Path, EC, sys::fs::OF_Text); + raw_fd_ostream OS(Path, EC, sys::fs::OF_TextWithCRLF); if (EC) return createStringError(EC, "Could not open " + Path); Index: llvm/lib/Support/MemoryBuffer.cpp =================================================================== --- llvm/lib/Support/MemoryBuffer.cpp +++ llvm/lib/Support/MemoryBuffer.cpp @@ -259,7 +259,7 @@ getFileAux(const Twine &Filename, uint64_t MapSize, uint64_t Offset, bool IsText, bool RequiresNullTerminator, bool IsVolatile) { Expected<sys::fs::file_t> FDOrErr = sys::fs::openNativeFileForRead( - Filename, IsText ? sys::fs::OF_Text : sys::fs::OF_None); + Filename, IsText ? sys::fs::OF_TextWithCRLF : sys::fs::OF_None); if (!FDOrErr) return errorToErrorCode(FDOrErr.takeError()); sys::fs::file_t FD = *FDOrErr; Index: llvm/lib/Support/FileCollector.cpp =================================================================== --- llvm/lib/Support/FileCollector.cpp +++ llvm/lib/Support/FileCollector.cpp @@ -241,7 +241,7 @@ VFSWriter.setUseExternalNames(false); std::error_code EC; - raw_fd_ostream os(MappingFile, EC, sys::fs::OF_Text); + raw_fd_ostream os(MappingFile, EC, sys::fs::OF_TextWithCRLF); if (EC) return EC; Index: llvm/lib/ProfileData/SampleProfWriter.cpp =================================================================== --- llvm/lib/ProfileData/SampleProfWriter.cpp +++ llvm/lib/ProfileData/SampleProfWriter.cpp @@ -728,7 +728,7 @@ Format == SPF_Compact_Binary) OS.reset(new raw_fd_ostream(Filename, EC, sys::fs::OF_None)); else - OS.reset(new raw_fd_ostream(Filename, EC, sys::fs::OF_Text)); + OS.reset(new raw_fd_ostream(Filename, EC, sys::fs::OF_TextWithCRLF)); if (EC) return EC; Index: llvm/lib/ProfileData/GCOV.cpp =================================================================== --- llvm/lib/ProfileData/GCOV.cpp +++ llvm/lib/ProfileData/GCOV.cpp @@ -866,7 +866,7 @@ Optional<raw_fd_ostream> os; if (!options.UseStdout) { std::error_code ec; - os.emplace(gcovName, ec, sys::fs::OF_Text); + os.emplace(gcovName, ec, sys::fs::OF_TextWithCRLF); if (ec) { errs() << ec.message() << '\n'; continue; @@ -881,7 +881,7 @@ // (PR GCC/82702). We create just one file. std::string outputPath(sys::path::filename(filename)); std::error_code ec; - raw_fd_ostream os(outputPath + ".gcov", ec, sys::fs::OF_Text); + raw_fd_ostream os(outputPath + ".gcov", ec, sys::fs::OF_TextWithCRLF); if (ec) { errs() << ec.message() << '\n'; return; Index: llvm/lib/MC/MCParser/DarwinAsmParser.cpp =================================================================== --- llvm/lib/MC/MCParser/DarwinAsmParser.cpp +++ llvm/lib/MC/MCParser/DarwinAsmParser.cpp @@ -776,8 +776,9 @@ raw_fd_ostream *OS = getContext().getSecureLog(); if (!OS) { std::error_code EC; - auto NewOS = std::make_unique<raw_fd_ostream>( - StringRef(SecureLogFile), EC, sys::fs::OF_Append | sys::fs::OF_Text); + auto NewOS = std::make_unique<raw_fd_ostream>(StringRef(SecureLogFile), EC, + sys::fs::OF_Append | + sys::fs::OF_TextWithCRLF); if (EC) return Error(IDLoc, Twine("can't open secure log file: ") + SecureLogFile + " (" + EC.message() + ")"); Index: llvm/lib/LTO/LTOBackend.cpp =================================================================== --- llvm/lib/LTO/LTOBackend.cpp +++ llvm/lib/LTO/LTOBackend.cpp @@ -85,8 +85,9 @@ ShouldDiscardValueNames = false; std::error_code EC; - ResolutionFile = std::make_unique<raw_fd_ostream>( - OutputFileName + "resolution.txt", EC, sys::fs::OpenFlags::OF_Text); + ResolutionFile = + std::make_unique<raw_fd_ostream>(OutputFileName + "resolution.txt", EC, + sys::fs::OpenFlags::OF_TextWithCRLF); if (EC) { ResolutionFile.reset(); return errorCodeToError(EC); Index: llvm/lib/IR/LLVMRemarkStreamer.cpp =================================================================== --- llvm/lib/IR/LLVMRemarkStreamer.cpp +++ llvm/lib/IR/LLVMRemarkStreamer.cpp @@ -106,7 +106,7 @@ return make_error<LLVMRemarkSetupFormatError>(std::move(E)); std::error_code EC; - auto Flags = *Format == remarks::Format::YAML ? sys::fs::OF_Text + auto Flags = *Format == remarks::Format::YAML ? sys::fs::OF_TextWithCRLF : sys::fs::OF_None; auto RemarksFile = std::make_unique<ToolOutputFile>(RemarksFilename, EC, Flags); Index: llvm/lib/IR/Core.cpp =================================================================== --- llvm/lib/IR/Core.cpp +++ llvm/lib/IR/Core.cpp @@ -412,7 +412,7 @@ LLVMBool LLVMPrintModuleToFile(LLVMModuleRef M, const char *Filename, char **ErrorMessage) { std::error_code EC; - raw_fd_ostream dest(Filename, EC, sys::fs::OF_Text); + raw_fd_ostream dest(Filename, EC, sys::fs::OF_TextWithCRLF); if (EC) { *ErrorMessage = strdup(EC.message().c_str()); return true; Index: llvm/lib/CodeGen/RegAllocPBQP.cpp =================================================================== --- llvm/lib/CodeGen/RegAllocPBQP.cpp +++ llvm/lib/CodeGen/RegAllocPBQP.cpp @@ -859,7 +859,7 @@ std::string GraphFileName = FullyQualifiedName + "." + RS.str() + ".pbqpgraph"; std::error_code EC; - raw_fd_ostream OS(GraphFileName, EC, sys::fs::OF_Text); + raw_fd_ostream OS(GraphFileName, EC, sys::fs::OF_TextWithCRLF); LLVM_DEBUG(dbgs() << "Dumping graph for round " << Round << " to \"" << GraphFileName << "\"\n"); G.dump(OS); Index: llvm/include/llvm/Support/FileSystem.h =================================================================== --- llvm/include/llvm/Support/FileSystem.h +++ llvm/include/llvm/Support/FileSystem.h @@ -747,19 +747,25 @@ OF_Text = 1, F_Text = 1, // For compatibility + /// The file should be opened with CRLF translation on platforms that + /// make this distinction. + OF_CRLF = 2, + OF_TextWithCRLF = 3, + /// The file should be opened in append mode. - OF_Append = 2, - F_Append = 2, // For compatibility + OF_Append = 4, + F_Append = 4, // For compatibility /// Delete the file on close. Only makes a difference on windows. - OF_Delete = 4, + OF_Delete = 8, /// When a child process is launched, this file should remain open in the /// child process. - OF_ChildInherit = 8, + OF_ChildInherit = 16, - /// Force files Atime to be updated on access. Only makes a difference on windows. - OF_UpdateAtime = 16, + /// Force files Atime to be updated on access. Only makes a difference on + /// windows. + OF_UpdateAtime = 32, }; /// Create a potentially unique file name but does not create it. Index: llvm/include/llvm/Analysis/DOTGraphTraitsPass.h =================================================================== --- llvm/include/llvm/Analysis/DOTGraphTraitsPass.h +++ llvm/include/llvm/Analysis/DOTGraphTraitsPass.h @@ -97,7 +97,7 @@ errs() << "Writing '" << Filename << "'..."; - raw_fd_ostream File(Filename, EC, sys::fs::OF_Text); + raw_fd_ostream File(Filename, EC, sys::fs::OF_TextWithCRLF); std::string GraphName = DOTGraphTraits<GraphT>::getGraphName(Graph); std::string Title = GraphName + " for '" + F.getName().str() + "' function"; @@ -160,7 +160,7 @@ errs() << "Writing '" << Filename << "'..."; - raw_fd_ostream File(Filename, EC, sys::fs::OF_Text); + raw_fd_ostream File(Filename, EC, sys::fs::OF_TextWithCRLF); std::string Title = DOTGraphTraits<GraphT>::getGraphName(Graph); if (!EC) Index: lldb/tools/lldb-server/LLDBServerUtilities.cpp =================================================================== --- lldb/tools/lldb-server/LLDBServerUtilities.cpp +++ lldb/tools/lldb-server/LLDBServerUtilities.cpp @@ -24,7 +24,7 @@ if (!log_file.empty()) { std::error_code EC; std::shared_ptr<raw_ostream> stream_sp = std::make_shared<raw_fd_ostream>( - log_file, EC, sys::fs::OF_Text | sys::fs::OF_Append); + log_file, EC, sys::fs::OF_TextWithCRLF | sys::fs::OF_Append); if (!EC) return stream_sp; errs() << llvm::formatv( Index: lldb/source/Utility/ReproducerProvider.cpp =================================================================== --- lldb/source/Utility/ReproducerProvider.cpp +++ lldb/source/Utility/ReproducerProvider.cpp @@ -39,7 +39,7 @@ void VersionProvider::Keep() { FileSpec file = GetRoot().CopyByAppendingPathComponent(Info::file); std::error_code ec; - llvm::raw_fd_ostream os(file.GetPath(), ec, llvm::sys::fs::OF_Text); + llvm::raw_fd_ostream os(file.GetPath(), ec, llvm::sys::fs::OF_TextWithCRLF); if (ec) return; os << m_version << "\n"; @@ -108,7 +108,7 @@ FileSpec file = GetRoot().CopyByAppendingPathComponent(Info::file); std::error_code ec; - llvm::raw_fd_ostream os(file.GetPath(), ec, llvm::sys::fs::OF_Text); + llvm::raw_fd_ostream os(file.GetPath(), ec, llvm::sys::fs::OF_TextWithCRLF); if (ec) return; llvm::yaml::Output yout(os); @@ -153,7 +153,7 @@ void SymbolFileProvider::Keep() { FileSpec file = this->GetRoot().CopyByAppendingPathComponent(Info::file); std::error_code ec; - llvm::raw_fd_ostream os(file.GetPath(), ec, llvm::sys::fs::OF_Text); + llvm::raw_fd_ostream os(file.GetPath(), ec, llvm::sys::fs::OF_TextWithCRLF); if (ec) return; Index: lldb/source/Utility/GDBRemote.cpp =================================================================== --- lldb/source/Utility/GDBRemote.cpp +++ lldb/source/Utility/GDBRemote.cpp @@ -104,7 +104,7 @@ FileSpec file = GetRoot().CopyByAppendingPathComponent(Info::file); std::error_code ec; - llvm::raw_fd_ostream os(file.GetPath(), ec, llvm::sys::fs::OF_Text); + llvm::raw_fd_ostream os(file.GetPath(), ec, llvm::sys::fs::OF_TextWithCRLF); if (ec) return; yaml::Output yout(os); @@ -150,8 +150,8 @@ FileSpec history_file = GetRoot().CopyByAppendingPathComponent(Info::file); std::error_code EC; - m_stream_up = std::make_unique<raw_fd_ostream>(history_file.GetPath(), EC, - sys::fs::OpenFlags::OF_Text); + m_stream_up = std::make_unique<raw_fd_ostream>( + history_file.GetPath(), EC, sys::fs::OpenFlags::OF_TextWithCRLF); return m_stream_up.get(); } Index: lldb/include/lldb/Utility/ReproducerProvider.h =================================================================== --- lldb/include/lldb/Utility/ReproducerProvider.h +++ lldb/include/lldb/Utility/ReproducerProvider.h @@ -32,7 +32,8 @@ protected: AbstractRecorder(const FileSpec &filename, std::error_code &ec) : m_filename(filename.GetFilename().GetStringRef()), - m_os(filename.GetPath(), ec, llvm::sys::fs::OF_Text), m_record(true) {} + m_os(filename.GetPath(), ec, llvm::sys::fs::OF_TextWithCRLF), + m_record(true) {} public: const FileSpec &GetFilename() { return m_filename; } @@ -168,7 +169,7 @@ void Keep() override { FileSpec file = this->GetRoot().CopyByAppendingPathComponent(T::Info::file); std::error_code ec; - llvm::raw_fd_ostream os(file.GetPath(), ec, llvm::sys::fs::OF_Text); + llvm::raw_fd_ostream os(file.GetPath(), ec, llvm::sys::fs::OF_TextWithCRLF); if (ec) return; os << m_directory << "\n"; @@ -290,7 +291,7 @@ FileSpec file = this->GetRoot().CopyByAppendingPathComponent(V::Info::file); std::error_code ec; - llvm::raw_fd_ostream os(file.GetPath(), ec, llvm::sys::fs::OF_Text); + llvm::raw_fd_ostream os(file.GetPath(), ec, llvm::sys::fs::OF_TextWithCRLF); if (ec) return; llvm::yaml::Output yout(os); Index: lld/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp =================================================================== --- lld/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp +++ lld/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp @@ -1299,7 +1299,7 @@ llvm::Error writeFile(const lld::File &file, StringRef outPath) override { // Create stream to path. std::error_code ec; - llvm::raw_fd_ostream out(outPath, ec, llvm::sys::fs::OF_Text); + llvm::raw_fd_ostream out(outPath, ec, llvm::sys::fs::OF_TextWithCRLF); if (ec) return llvm::errorCodeToError(ec); Index: lld/COFF/DriverUtils.cpp =================================================================== --- lld/COFF/DriverUtils.cpp +++ lld/COFF/DriverUtils.cpp @@ -414,7 +414,7 @@ // Create the default manifest file as a temporary file. TemporaryFile Default("defaultxml", "manifest"); std::error_code ec; - raw_fd_ostream os(Default.path, ec, sys::fs::OF_Text); + raw_fd_ostream os(Default.path, ec, sys::fs::OF_TextWithCRLF); if (ec) fatal("failed to open " + Default.path + ": " + ec.message()); os << defaultXml; @@ -516,7 +516,7 @@ if (path == "") path = config->outputFile + ".manifest"; std::error_code ec; - raw_fd_ostream out(path, ec, sys::fs::OF_Text); + raw_fd_ostream out(path, ec, sys::fs::OF_TextWithCRLF); if (ec) fatal("failed to create manifest: " + ec.message()); out << createManifestXml(); Index: flang/lib/Frontend/CompilerInstance.cpp =================================================================== --- flang/lib/Frontend/CompilerInstance.cpp +++ flang/lib/Frontend/CompilerInstance.cpp @@ -112,7 +112,7 @@ if (!os) { osFile = outputFilePath; os.reset(new llvm::raw_fd_ostream(osFile, error, - (binary ? llvm::sys::fs::OF_None : llvm::sys::fs::OF_Text))); + (binary ? llvm::sys::fs::OF_None : llvm::sys::fs::OF_TextWithCRLF))); if (error) return nullptr; } Index: clang/tools/driver/cc1as_main.cpp =================================================================== --- clang/tools/driver/cc1as_main.cpp +++ clang/tools/driver/cc1as_main.cpp @@ -324,7 +324,7 @@ std::error_code EC; auto Out = std::make_unique<raw_fd_ostream>( - Path, EC, (Binary ? sys::fs::OF_None : sys::fs::OF_Text)); + Path, EC, (Binary ? sys::fs::OF_None : sys::fs::OF_TextWithCRLF)); if (EC) { Diags.Report(diag::err_fe_unable_to_open_output) << Path << EC.message(); return nullptr; Index: clang/tools/clang-refactor/ClangRefactor.cpp =================================================================== --- clang/tools/clang-refactor/ClangRefactor.cpp +++ clang/tools/clang-refactor/ClangRefactor.cpp @@ -499,7 +499,7 @@ if (opts::Inplace) { std::error_code EC; - llvm::raw_fd_ostream OS(File, EC, llvm::sys::fs::OF_Text); + llvm::raw_fd_ostream OS(File, EC, llvm::sys::fs::OF_TextWithCRLF); if (EC) { llvm::errs() << EC.message() << "\n"; return true; Index: clang/lib/StaticAnalyzer/Core/SarifDiagnostics.cpp =================================================================== --- clang/lib/StaticAnalyzer/Core/SarifDiagnostics.cpp +++ clang/lib/StaticAnalyzer/Core/SarifDiagnostics.cpp @@ -387,7 +387,7 @@ // file can become large very quickly, so decoding into JSON to append a run // may be an expensive operation. std::error_code EC; - llvm::raw_fd_ostream OS(OutputFile, EC, llvm::sys::fs::OF_Text); + llvm::raw_fd_ostream OS(OutputFile, EC, llvm::sys::fs::OF_TextWithCRLF); if (EC) { llvm::errs() << "warning: could not create file: " << EC.message() << '\n'; return; Index: clang/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp =================================================================== --- clang/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp +++ clang/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp @@ -660,7 +660,7 @@ // Open the file. std::error_code EC; - llvm::raw_fd_ostream o(OutputFile, EC, llvm::sys::fs::OF_Text); + llvm::raw_fd_ostream o(OutputFile, EC, llvm::sys::fs::OF_TextWithCRLF); if (EC) { llvm::errs() << "warning: could not create file: " << EC.message() << '\n'; return; Index: clang/lib/Serialization/ASTReader.cpp =================================================================== --- clang/lib/Serialization/ASTReader.cpp +++ clang/lib/Serialization/ASTReader.cpp @@ -4172,7 +4172,8 @@ // Overwrite the timestamp file contents so that file's mtime changes. std::string TimestampFilename = MF.getTimestampFilename(); std::error_code EC; - llvm::raw_fd_ostream OS(TimestampFilename, EC, llvm::sys::fs::OF_Text); + llvm::raw_fd_ostream OS(TimestampFilename, EC, + llvm::sys::fs::OF_TextWithCRLF); if (EC) return; OS << "Timestamp file\n"; Index: clang/lib/Frontend/ModuleDependencyCollector.cpp =================================================================== --- clang/lib/Frontend/ModuleDependencyCollector.cpp +++ clang/lib/Frontend/ModuleDependencyCollector.cpp @@ -148,7 +148,7 @@ std::error_code EC; SmallString<256> YAMLPath = VFSDir; llvm::sys::path::append(YAMLPath, "vfs.yaml"); - llvm::raw_fd_ostream OS(YAMLPath, EC, llvm::sys::fs::OF_Text); + llvm::raw_fd_ostream OS(YAMLPath, EC, llvm::sys::fs::OF_TextWithCRLF); if (EC) { HasErrors = true; return; Index: clang/lib/Frontend/HeaderIncludeGen.cpp =================================================================== --- clang/lib/Frontend/HeaderIncludeGen.cpp +++ clang/lib/Frontend/HeaderIncludeGen.cpp @@ -101,7 +101,7 @@ std::error_code EC; llvm::raw_fd_ostream *OS = new llvm::raw_fd_ostream( OutputPath.str(), EC, - llvm::sys::fs::OF_Append | llvm::sys::fs::OF_Text); + llvm::sys::fs::OF_Append | llvm::sys::fs::OF_TextWithCRLF); if (EC) { PP.getDiagnostics().Report(clang::diag::warn_fe_cc_print_header_failure) << EC.message(); Index: clang/lib/Frontend/FrontendActions.cpp =================================================================== --- clang/lib/Frontend/FrontendActions.cpp +++ clang/lib/Frontend/FrontendActions.cpp @@ -722,7 +722,7 @@ if (!OutputFileName.empty() && OutputFileName != "-") { std::error_code EC; OutFile.reset(new llvm::raw_fd_ostream(OutputFileName.str(), EC, - llvm::sys::fs::OF_Text)); + llvm::sys::fs::OF_TextWithCRLF)); } llvm::raw_ostream &Out = OutFile.get()? *OutFile.get() : llvm::outs(); Index: clang/lib/Frontend/DependencyGraph.cpp =================================================================== --- clang/lib/Frontend/DependencyGraph.cpp +++ clang/lib/Frontend/DependencyGraph.cpp @@ -100,7 +100,7 @@ void DependencyGraphCallback::OutputGraphFile() { std::error_code EC; - llvm::raw_fd_ostream OS(OutputFile, EC, llvm::sys::fs::OF_Text); + llvm::raw_fd_ostream OS(OutputFile, EC, llvm::sys::fs::OF_TextWithCRLF); if (EC) { PP->getDiagnostics().Report(diag::err_fe_error_opening) << OutputFile << EC.message(); Index: clang/lib/Frontend/DependencyFile.cpp =================================================================== --- clang/lib/Frontend/DependencyFile.cpp +++ clang/lib/Frontend/DependencyFile.cpp @@ -307,7 +307,7 @@ } std::error_code EC; - llvm::raw_fd_ostream OS(OutputFile, EC, llvm::sys::fs::OF_Text); + llvm::raw_fd_ostream OS(OutputFile, EC, llvm::sys::fs::OF_TextWithCRLF); if (EC) { Diags.Report(diag::err_fe_error_opening) << OutputFile << EC.message(); return; Index: clang/lib/Frontend/CompilerInstance.cpp =================================================================== --- clang/lib/Frontend/CompilerInstance.cpp +++ clang/lib/Frontend/CompilerInstance.cpp @@ -277,7 +277,7 @@ // Create the output stream. auto FileOS = std::make_unique<llvm::raw_fd_ostream>( DiagOpts->DiagnosticLogFile, EC, - llvm::sys::fs::OF_Append | llvm::sys::fs::OF_Text); + llvm::sys::fs::OF_Append | llvm::sys::fs::OF_TextWithCRLF); if (EC) { Diags.Report(diag::warn_fe_cc_log_diagnostics_failure) << DiagOpts->DiagnosticLogFile << EC.message(); @@ -843,7 +843,7 @@ std::error_code EC; OS.reset(new llvm::raw_fd_ostream( *OSFile, EC, - (Binary ? llvm::sys::fs::OF_None : llvm::sys::fs::OF_Text))); + (Binary ? llvm::sys::fs::OF_None : llvm::sys::fs::OF_TextWithCRLF))); if (EC) return llvm::errorCodeToError(EC); } @@ -1001,7 +1001,7 @@ if (!StatsFile.empty()) { std::error_code EC; auto StatS = std::make_unique<llvm::raw_fd_ostream>( - StatsFile, EC, llvm::sys::fs::OF_Text); + StatsFile, EC, llvm::sys::fs::OF_TextWithCRLF); if (EC) { getDiagnostics().Report(diag::warn_fe_unable_to_open_stats_file) << StatsFile << EC.message(); Index: clang/lib/Driver/ToolChains/Clang.cpp =================================================================== --- clang/lib/Driver/ToolChains/Clang.cpp +++ clang/lib/Driver/ToolChains/Clang.cpp @@ -2261,8 +2261,8 @@ if (!CompilationDatabase) { std::error_code EC; - auto File = std::make_unique<llvm::raw_fd_ostream>(Filename, EC, - llvm::sys::fs::OF_Text); + auto File = std::make_unique<llvm::raw_fd_ostream>( + Filename, EC, llvm::sys::fs::OF_TextWithCRLF); if (EC) { D.Diag(clang::diag::err_drv_compilationdatabase) << Filename << EC.message(); Index: clang/lib/Driver/Compilation.cpp =================================================================== --- clang/lib/Driver/Compilation.cpp +++ clang/lib/Driver/Compilation.cpp @@ -174,7 +174,7 @@ std::error_code EC; OwnedStream.reset(new llvm::raw_fd_ostream( getDriver().CCPrintOptionsFilename, EC, - llvm::sys::fs::OF_Append | llvm::sys::fs::OF_Text)); + llvm::sys::fs::OF_Append | llvm::sys::fs::OF_TextWithCRLF)); if (EC) { getDriver().Diag(diag::err_drv_cc_print_options_failure) << EC.message(); Index: clang/lib/ARCMigrate/PlistReporter.cpp =================================================================== --- clang/lib/ARCMigrate/PlistReporter.cpp +++ clang/lib/ARCMigrate/PlistReporter.cpp @@ -56,7 +56,7 @@ } std::error_code EC; - llvm::raw_fd_ostream o(outPath, EC, llvm::sys::fs::OF_Text); + llvm::raw_fd_ostream o(outPath, EC, llvm::sys::fs::OF_TextWithCRLF); if (EC) { llvm::errs() << "error: could not create file: " << outPath << '\n'; return; Index: clang-tools-extra/pp-trace/PPTrace.cpp =================================================================== --- clang-tools-extra/pp-trace/PPTrace.cpp +++ clang-tools-extra/pp-trace/PPTrace.cpp @@ -152,7 +152,7 @@ OptionsParser->getSourcePathList()); std::error_code EC; - llvm::ToolOutputFile Out(OutputFileName, EC, llvm::sys::fs::OF_Text); + llvm::ToolOutputFile Out(OutputFileName, EC, llvm::sys::fs::OF_TextWithCRLF); if (EC) error(EC.message()); PPTraceFrontendActionFactory Factory(Filters, Out.os()); Index: clang-tools-extra/modularize/ModuleAssistant.cpp =================================================================== --- clang-tools-extra/modularize/ModuleAssistant.cpp +++ clang-tools-extra/modularize/ModuleAssistant.cpp @@ -268,7 +268,7 @@ // Set up module map output file. std::error_code EC; - llvm::ToolOutputFile Out(FilePath, EC, llvm::sys::fs::OF_Text); + llvm::ToolOutputFile Out(FilePath, EC, llvm::sys::fs::OF_TextWithCRLF); if (EC) { llvm::errs() << Argv0 << ": error opening " << FilePath << ":" << EC.message() << "\n"; Index: clang-tools-extra/clang-move/tool/ClangMove.cpp =================================================================== --- clang-tools-extra/clang-move/tool/ClangMove.cpp +++ clang-tools-extra/clang-move/tool/ClangMove.cpp @@ -30,7 +30,8 @@ std::error_code CreateNewFile(const llvm::Twine &path) { int fd = 0; if (std::error_code ec = llvm::sys::fs::openFileForWrite( - path, fd, llvm::sys::fs::CD_CreateAlways, llvm::sys::fs::OF_Text)) + path, fd, llvm::sys::fs::CD_CreateAlways, + llvm::sys::fs::OF_TextWithCRLF)) return ec; return llvm::sys::Process::SafelyCloseFileDescriptor(fd);
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits