Skip to content

Commit 7dd38bb

Browse files
authored
Merge pull request #34376 from eeckstein/bug-report-message
update and unify the "please file a bug report" message
2 parents e308865 + 1224cfa commit 7dd38bb

File tree

10 files changed

+27
-10
lines changed

10 files changed

+27
-10
lines changed

include/swift/AST/DiagnosticsFrontend.def

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ ERROR(error_unable_to_load_supplementary_output_file_map, none,
156156

157157
ERROR(error_missing_entry_in_supplementary_output_file_map, none,
158158
"supplementary output file map '%0' is missing an entry for '%1' "
159-
"(this likely indicates a compiler issue; please file a bug report)",
159+
"(this likely indicates a compiler issue; " SWIFT_BUG_REPORT_MESSAGE ")",
160160
(StringRef, StringRef))
161161

162162
ERROR(error_repl_requires_no_input_files,none,
@@ -307,8 +307,8 @@ ERROR(symbol_in_ir_not_in_tbd,none,
307307
(StringRef, StringRef))
308308

309309
ERROR(tbd_validation_failure,none,
310-
"please file a radar or open a bug on bugs.swift.org with this code, and "
311-
"add -Xfrontend -validate-tbd-against-ir=none to squash the errors", ())
310+
SWIFT_BUG_REPORT_MESSAGE ", and add "
311+
"'-Xfrontend -validate-tbd-against-ir=none' to squash the errors", ())
312312

313313
ERROR(redundant_prefix_compilation_flag,none,
314314
"invalid argument '-D%0'; did you provide a redundant '-D' in your "

include/swift/AST/DiagnosticsSema.def

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -766,7 +766,7 @@ ERROR(serialization_target_too_new_repl,none,
766766

767767
ERROR(serialization_fatal,Fatal,
768768
"fatal error encountered while reading from module '%0'; "
769-
"please file a bug report with your project and the crash log",
769+
SWIFT_BUG_REPORT_MESSAGE,
770770
(StringRef))
771771
NOTE(serialization_misc_version,none,
772772
"module '%0' full misc version is '%1'",
@@ -3443,7 +3443,7 @@ ERROR(type_of_expression_is_ambiguous,none,
34433443

34443444
ERROR(failed_to_produce_diagnostic,Fatal,
34453445
"failed to produce diagnostic for expression; "
3446-
"please file a bug report", ())
3446+
SWIFT_BUG_REPORT_MESSAGE, ())
34473447

34483448

34493449
ERROR(missing_protocol,none,

include/swift/Basic/Compiler.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,4 +89,18 @@
8989
#define SWIFT_ATTRIBUTE_NORETURN
9090
#endif
9191

92+
#ifndef SWIFT_BUG_REPORT_URL
93+
#define SWIFT_BUG_REPORT_URL "https://swift.org/contributing/#reporting-bugs"
94+
#endif
95+
96+
#define SWIFT_BUG_REPORT_MESSAGE_BASE \
97+
"submit a bug report (" SWIFT_BUG_REPORT_URL \
98+
") and include the project"
99+
100+
#define SWIFT_BUG_REPORT_MESSAGE \
101+
"please " SWIFT_BUG_REPORT_MESSAGE_BASE
102+
103+
#define SWIFT_CRASH_BUG_REPORT_MESSAGE \
104+
"Please " SWIFT_BUG_REPORT_MESSAGE_BASE " and the crash backtrace."
105+
92106
#endif // SWIFT_BASIC_COMPILER_H

lib/FrontendTool/FrontendTool.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2671,6 +2671,7 @@ int swift::performFrontend(ArrayRef<const char *> Args,
26712671
const char *Argv0, void *MainAddr,
26722672
FrontendObserver *observer) {
26732673
INITIALIZE_LLVM();
2674+
llvm::setBugReportMsg(SWIFT_CRASH_BUG_REPORT_MESSAGE "\n");
26742675
llvm::EnablePrettyStackTraceOnSigInfoForThisThread();
26752676

26762677
PrintingDiagnosticConsumer PDC;
@@ -2694,8 +2695,7 @@ int swift::performFrontend(ArrayRef<const char *> Args,
26942695

26952696
DiagnosticInfo errorInfo(
26962697
DiagID(0), SourceLoc(), DiagnosticKind::Error,
2697-
"fatal error encountered during compilation; please file a bug report "
2698-
"with your project and the crash log",
2698+
"fatal error encountered during compilation; " SWIFT_BUG_REPORT_MESSAGE,
26992699
{}, SourceLoc(), {}, {}, {}, false);
27002700
DiagnosticInfo noteInfo(DiagID(0), SourceLoc(), DiagnosticKind::Note,
27012701
reason, {}, SourceLoc(), {}, {}, {}, false);

test/Frontend/batch_mode_output_file_map_missing_primary.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
// RUN: not %target-swift-frontend -parse -primary-file main.swift -primary-file file-01.swift -supplementary-output-file-map %S/Inputs/supplementary_output_filemap_missing_a_primary.yaml >%t/errs.txt 2>&1
66
// RUN: %FileCheck %s <%t/errs.txt
77

8-
// CHECK: error: supplementary output file map '{{.*}}supplementary_output_filemap_missing_a_primary.yaml' is missing an entry for 'file-01.swift' (this likely indicates a compiler issue; please file a bug report)
8+
// CHECK: error: supplementary output file map '{{.*}}supplementary_output_filemap_missing_a_primary.yaml' is missing an entry for 'file-01.swift' (this likely indicates a compiler issue; please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the project)

test/Sema/rdar38885760.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// RUN: not %target-swift-frontend -typecheck %s -parse-stdlib 2>%t/fallback_diagnostic.txt
44
// RUN: %FileCheck %s --check-prefix FALLBACK-DIAGNOSTIC <%t/fallback_diagnostic.txt
55
//
6-
// FALLBACK-DIAGNOSTIC: error: failed to produce diagnostic for expression; please file a bug report
6+
// FALLBACK-DIAGNOSTIC: error: failed to produce diagnostic for expression; please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the project
77

88
import Swift
99

test/Serialization/Recovery/crash-recovery.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public class Sub: Base {
1212
public override func disappearingMethod() {}
1313
}
1414

15-
// CHECK-CRASH: error: fatal error encountered while reading from module 'Lib'; please file a bug report with your project and the crash log
15+
// CHECK-CRASH: error: fatal error encountered while reading from module 'Lib'; please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the project
1616
// CHECK-CRASH: note: module 'Lib' full misc version is
1717
// CHECK-CRASH-4-NOT: note: compiling as
1818
// CHECK-CRASH-4_2: note: compiling as Swift 4.2, with 'Lib' built as Swift 4.1.50

tools/sil-opt/SILOpt.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,7 @@ void anchorForGetMainExecutable() {}
303303
int main(int argc, char **argv) {
304304
PROGRAM_START(argc, argv);
305305
INITIALIZE_LLVM();
306+
llvm::setBugReportMsg(SWIFT_CRASH_BUG_REPORT_MESSAGE "\n");
306307
llvm::EnablePrettyStackTraceOnSigInfoForThisThread();
307308

308309
llvm::cl::ParseCommandLineOptions(argc, argv, "Swift SIL optimizer\n");

tools/swift-def-to-yaml-converter/swift-def-to-yaml-converter.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
//===----------------------------------------------------------------------===//
1616

1717
#include "swift/Basic/LLVMInitialize.h"
18+
#include "swift/Basic/Compiler.h"
1819
#include "swift/Localization/LocalizationFormat.h"
1920
#include "llvm/ADT/ArrayRef.h"
2021
#include "llvm/ADT/SmallString.h"

unittests/Localization/LocalizationTest.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#define LOCALIZATION_TEST_H
1515

1616
#include "swift/Localization/LocalizationFormat.h"
17+
#include "swift/Basic/Compiler.h"
1718
#include "llvm/ADT/ArrayRef.h"
1819
#include "llvm/ADT/SmallString.h"
1920
#include "llvm/ADT/SmallVector.h"

0 commit comments

Comments
 (0)