diff --git a/clang/lib/ARCMigrate/FileRemapper.cpp b/clang/lib/ARCMigrate/FileRemapper.cpp --- a/clang/lib/ARCMigrate/FileRemapper.cpp +++ b/clang/lib/ARCMigrate/FileRemapper.cpp @@ -121,7 +121,7 @@ std::error_code EC; std::string infoFile = std::string(outputPath); - llvm::raw_fd_ostream infoOut(infoFile, EC, llvm::sys::fs::OF_None); + llvm::raw_fd_ostream infoOut(infoFile, EC, llvm::sys::fs::OF_Text); if (EC) return report(EC.message(), Diag); diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp --- a/clang/lib/Driver/Driver.cpp +++ b/clang/lib/Driver/Driver.cpp @@ -1434,7 +1434,9 @@ llvm::SmallString<128> Script(CrashInfo.Filename); llvm::sys::path::replace_extension(Script, "sh"); std::error_code EC; - llvm::raw_fd_ostream ScriptOS(Script, EC, llvm::sys::fs::CD_CreateNew); + llvm::raw_fd_ostream ScriptOS(Script, EC, llvm::sys::fs::CD_CreateNew, + llvm::sys::fs::FA_Write, + llvm::sys::fs::OF_Text); if (EC) { Diag(clang::diag::note_drv_command_failed_diag_msg) << "Error generating run script: " << Script << " " << EC.message(); diff --git a/clang/lib/Frontend/Rewrite/FrontendActions.cpp b/clang/lib/Frontend/Rewrite/FrontendActions.cpp --- a/clang/lib/Frontend/Rewrite/FrontendActions.cpp +++ b/clang/lib/Frontend/Rewrite/FrontendActions.cpp @@ -185,7 +185,7 @@ void RewriteMacrosAction::ExecuteAction() { CompilerInstance &CI = getCompilerInstance(); std::unique_ptr OS = - CI.createDefaultOutputFile(true, getCurrentFileOrBufferName()); + CI.createDefaultOutputFile(false, getCurrentFileOrBufferName()); if (!OS) return; RewriteMacrosInInput(CI.getPreprocessor(), OS.get()); @@ -270,7 +270,7 @@ bool RewriteIncludesAction::BeginSourceFileAction(CompilerInstance &CI) { if (!OutputStream) { OutputStream = - CI.createDefaultOutputFile(true, getCurrentFileOrBufferName()); + CI.createDefaultOutputFile(false, getCurrentFileOrBufferName()); if (!OutputStream) return false; } diff --git a/llvm/tools/dsymutil/DwarfLinkerForBinary.cpp b/llvm/tools/dsymutil/DwarfLinkerForBinary.cpp --- a/llvm/tools/dsymutil/DwarfLinkerForBinary.cpp +++ b/llvm/tools/dsymutil/DwarfLinkerForBinary.cpp @@ -252,7 +252,10 @@ } std::error_code EC; - raw_fd_ostream OS(Options.NoOutput ? "-" : Path.str(), EC, sys::fs::OF_None); + raw_fd_ostream OS(Options.NoOutput ? "-" : Path.str(), EC, + Options.RemarksFormat == remarks::Format::Bitstream + ? sys::fs::OF_None + : sys::fs::OF_Text); if (EC) return errorCodeToError(EC);