[clang] [clang] Allow custom bug report messages (PR #157536)
Alan Zhao via cfe-commits
cfe-commits at lists.llvm.org
Mon Sep 8 12:47:52 PDT 2025
https://github.com/alanzhao1 created https://github.com/llvm/llvm-project/pull/157536
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`.
>From 9422db5ea09c40f74e2af34f6e50fa2fd4567594 Mon Sep 17 00:00:00 2001
From: Alan Zhao <ayzhao at google.com>
Date: Mon, 8 Sep 2025 12:45:02 -0700
Subject: [PATCH] [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())
More information about the cfe-commits
mailing list