Index: clang/include/clang/Driver/Driver.h =================================================================== --- clang/include/clang/Driver/Driver.h +++ clang/include/clang/Driver/Driver.h @@ -157,16 +157,16 @@ std::string HostBits, HostMachine, HostSystem, HostRelease; /// The file to log CC_PRINT_PROC_STAT_FILE output to, if enabled. - const char *CCPrintStatReportFilename; + std::string CCPrintStatReportFilename; /// The file to log CC_PRINT_OPTIONS output to, if enabled. - const char *CCPrintOptionsFilename; + std::string CCPrintOptionsFilename; /// The file to log CC_PRINT_HEADERS output to, if enabled. - const char *CCPrintHeadersFilename; + std::string CCPrintHeadersFilename; /// The file to log CC_LOG_DIAGNOSTICS output to, if enabled. - const char *CCLogDiagnosticsFilename; + std::string CCLogDiagnosticsFilename; /// A list of inputs and their types for the given arguments. typedef SmallVector, 16> Index: clang/lib/Driver/Compilation.cpp =================================================================== --- clang/lib/Driver/Compilation.cpp +++ clang/lib/Driver/Compilation.cpp @@ -170,10 +170,10 @@ // Follow gcc implementation of CC_PRINT_OPTIONS; we could also cache the // output stream. - if (getDriver().CCPrintOptions && getDriver().CCPrintOptionsFilename) { + if (getDriver().CCPrintOptions && !getDriver().CCPrintOptionsFilename.empty()) { std::error_code EC; OwnedStream.reset(new llvm::raw_fd_ostream( - getDriver().CCPrintOptionsFilename, EC, + getDriver().CCPrintOptionsFilename.c_str(), EC, llvm::sys::fs::OF_Append | llvm::sys::fs::OF_Text)); if (EC) { getDriver().Diag(diag::err_drv_cc_print_options_failure) Index: clang/lib/Driver/Driver.cpp =================================================================== --- clang/lib/Driver/Driver.cpp +++ clang/lib/Driver/Driver.cpp @@ -135,9 +135,9 @@ : Diags(Diags), VFS(std::move(VFS)), Mode(GCCMode), SaveTemps(SaveTempsNone), BitcodeEmbed(EmbedNone), LTOMode(LTOK_None), ClangExecutable(ClangExecutable), SysRoot(DEFAULT_SYSROOT), - DriverTitle(Title), CCPrintStatReportFilename(nullptr), - CCPrintOptionsFilename(nullptr), CCPrintHeadersFilename(nullptr), - CCLogDiagnosticsFilename(nullptr), CCCPrintBindings(false), + DriverTitle(Title), CCPrintStatReportFilename(), + CCPrintOptionsFilename(), CCPrintHeadersFilename(), + CCLogDiagnosticsFilename(), CCCPrintBindings(false), CCPrintOptions(false), CCPrintHeaders(false), CCLogDiagnostics(false), CCGenDiagnostics(false), CCPrintProcessStats(false), TargetTriple(TargetTriple), CCCGenericGCCName(""), Saver(Alloc), @@ -4040,7 +4040,7 @@ else LinkingOutput = getDefaultImageName(); - if (!CCPrintStatReportFilename) { + if (CCPrintStatReportFilename.empty()) { using namespace llvm; // Human readable output. outs() << sys::path::filename(Cmd.getExecutable()) << ": " @@ -4063,7 +4063,7 @@ << '\n'; Out.flush(); std::error_code EC; - llvm::raw_fd_ostream OS(CCPrintStatReportFilename, EC, + llvm::raw_fd_ostream OS(CCPrintStatReportFilename.c_str(), EC, llvm::sys::fs::OF_Append); if (EC) return; Index: clang/lib/Driver/ToolChains/Clang.cpp =================================================================== --- clang/lib/Driver/ToolChains/Clang.cpp +++ clang/lib/Driver/ToolChains/Clang.cpp @@ -5107,7 +5107,7 @@ if (D.CCPrintHeaders && !D.CCGenDiagnostics) { CmdArgs.push_back("-header-include-file"); - CmdArgs.push_back(D.CCPrintHeadersFilename ? D.CCPrintHeadersFilename + CmdArgs.push_back(!D.CCPrintHeadersFilename.empty() ? D.CCPrintHeadersFilename.c_str() : "-"); CmdArgs.push_back("-sys-header-deps"); } @@ -5116,7 +5116,7 @@ if (D.CCLogDiagnostics && !D.CCGenDiagnostics) { CmdArgs.push_back("-diagnostic-log-file"); - CmdArgs.push_back(D.CCLogDiagnosticsFilename ? D.CCLogDiagnosticsFilename + CmdArgs.push_back(!D.CCLogDiagnosticsFilename.empty() ? D.CCLogDiagnosticsFilename.c_str() : "-"); }