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 @@ -1267,10 +1267,6 @@ // Print the version of the compiler. PrintVersion(C, llvm::errs()); - Diag(clang::diag::note_drv_command_failed_diag_msg) - << "PLEASE submit a bug report to " BUG_REPORT_URL " and include the " - "crash backtrace, preprocessed source, and associated run script."; - // Suppress driver output and emit preprocessor output to temp file. Mode = CPPMode; CCGenDiagnostics = true; diff --git a/clang/tools/driver/driver.cpp b/clang/tools/driver/driver.cpp --- a/clang/tools/driver/driver.cpp +++ b/clang/tools/driver/driver.cpp @@ -38,6 +38,7 @@ #include "llvm/Support/Host.h" #include "llvm/Support/InitLLVM.h" #include "llvm/Support/Path.h" +#include "llvm/Support/PrettyStackTrace.h" #include "llvm/Support/Process.h" #include "llvm/Support/Program.h" #include "llvm/Support/Regex.h" @@ -342,6 +343,9 @@ int main(int argc_, const char **argv_) { noteBottomOfStack(); llvm::InitLLVM X(argc_, argv_); + llvm::setBugReportMsg("PLEASE submit a bug report to " BUG_REPORT_URL + " and include the crash backtrace, preprocessed " + "source, and associated run script.\n"); SmallVector argv(argv_, argv_ + argc_); if (llvm::sys::Process::FixupStandardFileDescriptors()) diff --git a/llvm/include/llvm/Support/PrettyStackTrace.h b/llvm/include/llvm/Support/PrettyStackTrace.h --- a/llvm/include/llvm/Support/PrettyStackTrace.h +++ b/llvm/include/llvm/Support/PrettyStackTrace.h @@ -37,6 +37,10 @@ /// \see PrettyStackTraceEntry void EnablePrettyStackTraceOnSigInfoForThisThread(bool ShouldEnable = true); + /// Replaces the generic bug report message that is output upon + /// a crash. + void setBugReportMsg(const char *Msg); + /// PrettyStackTraceEntry - This class is used to represent a frame of the /// "pretty" stack trace that is dumped when a program crashes. You can define /// subclasses of this and declare them on the program stack: when they are diff --git a/llvm/lib/Support/PrettyStackTrace.cpp b/llvm/lib/Support/PrettyStackTrace.cpp --- a/llvm/lib/Support/PrettyStackTrace.cpp +++ b/llvm/lib/Support/PrettyStackTrace.cpp @@ -142,9 +142,17 @@ static CrashHandlerStringStorage crashHandlerStringStorage; #endif +static const char *BugReportMsg = + "PLEASE submit a bug report to " BUG_REPORT_URL + " and include the crash backtrace.\n"; + +void llvm::setBugReportMsg(const char *Msg) { BugReportMsg = Msg; } + /// This callback is run if a fatal signal is delivered to the process, it /// prints the pretty stack trace. static void CrashHandler(void *) { + errs() << BugReportMsg ; + #ifndef __APPLE__ // On non-apple systems, just emit the crash stack trace to stderr. PrintCurStackTrace(errs());