https://github.com/alanzhao1 updated 
https://github.com/llvm/llvm-project/pull/157536

>From 9422db5ea09c40f74e2af34f6e50fa2fd4567594 Mon Sep 17 00:00:00 2001
From: Alan Zhao <ayz...@google.com>
Date: Mon, 8 Sep 2025 12:45:02 -0700
Subject: [PATCH 1/2] [clang] Allow custom bug report messages

Clang vendors may need to set a custom message for bug reports if the
default is not sufficient (e.g. if they need the user to provide more
information than what the default message asks for). This can be
configured using the new macro `CLANG_CUSTOM_BUG_REPORT_MSG`.
---
 clang/include/clang/Config/config.h.cmake | 3 +++
 clang/tools/driver/driver.cpp             | 4 ++++
 2 files changed, 7 insertions(+)

diff --git a/clang/include/clang/Config/config.h.cmake 
b/clang/include/clang/Config/config.h.cmake
index 00c352b458c34..4194c00c756c4 100644
--- a/clang/include/clang/Config/config.h.cmake
+++ b/clang/include/clang/Config/config.h.cmake
@@ -85,4 +85,7 @@
 /* Whether CIR is built into Clang */
 #cmakedefine01 CLANG_ENABLE_CIR
 
+/* Define if there is a custom bug report message */
+#cmakedefine CLANG_CUSTOM_BUG_REPORT_MSG "${CLANG_CUSTOM_BUG_REPORT_MSG}"
+
 #endif
diff --git a/clang/tools/driver/driver.cpp b/clang/tools/driver/driver.cpp
index e5c3c4ed5f804..c604d2927c869 100644
--- a/clang/tools/driver/driver.cpp
+++ b/clang/tools/driver/driver.cpp
@@ -235,9 +235,13 @@ static int ExecuteCC1Tool(SmallVectorImpl<const char *> 
&ArgV,
 
 int clang_main(int Argc, char **Argv, const llvm::ToolContext &ToolContext) {
   noteBottomOfStack();
+  #ifdef CLANG_CUSTOM_BUG_REPORT_MSG
+  llvm::setBugReportMsg(CLANG_CUSTOM_BUG_REPORT_MSG);
+  #else
   llvm::setBugReportMsg("PLEASE submit a bug report to " BUG_REPORT_URL
                         " and include the crash backtrace, preprocessed "
                         "source, and associated run script.\n");
+  #endif
   SmallVector<const char *, 256> Args(Argv, Argv + Argc);
 
   if (llvm::sys::Process::FixupStandardFileDescriptors())

>From cebc862986007719d9b15c69315914faf4af5009 Mon Sep 17 00:00:00 2001
From: Alan Zhao <ayz...@google.com>
Date: Mon, 8 Sep 2025 12:53:07 -0700
Subject: [PATCH 2/2] fix formatting

---
 clang/tools/driver/driver.cpp | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/clang/tools/driver/driver.cpp b/clang/tools/driver/driver.cpp
index c604d2927c869..b3fdab6177600 100644
--- a/clang/tools/driver/driver.cpp
+++ b/clang/tools/driver/driver.cpp
@@ -235,13 +235,13 @@ static int ExecuteCC1Tool(SmallVectorImpl<const char *> 
&ArgV,
 
 int clang_main(int Argc, char **Argv, const llvm::ToolContext &ToolContext) {
   noteBottomOfStack();
-  #ifdef CLANG_CUSTOM_BUG_REPORT_MSG
+#ifdef CLANG_CUSTOM_BUG_REPORT_MSG
   llvm::setBugReportMsg(CLANG_CUSTOM_BUG_REPORT_MSG);
-  #else
+#else
   llvm::setBugReportMsg("PLEASE submit a bug report to " BUG_REPORT_URL
                         " and include the crash backtrace, preprocessed "
                         "source, and associated run script.\n");
-  #endif
+#endif
   SmallVector<const char *, 256> Args(Argv, Argv + Argc);
 
   if (llvm::sys::Process::FixupStandardFileDescriptors())

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to