mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
tools: Set Swift bug report message in some executable targets
If these programs crash, we want them to print the Swift bug report message, not the default LLVM one, which leads to https://github.com/llvm/llvm-project/issues. While here, hoist the setting of the bug report message to the START_PROGRAM macro so that we don't forget to set it in the future.
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
//
|
||||
// This source file is part of the Swift.org open source project
|
||||
//
|
||||
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
|
||||
// Copyright (c) 2014 - 2025 Apple Inc. and the Swift project authors
|
||||
// Licensed under Apache License v2.0 with Runtime Library Exception
|
||||
//
|
||||
// See https://swift.org/LICENSE.txt for license information
|
||||
@@ -19,14 +19,16 @@
|
||||
#ifndef SWIFT_BASIC_LLVMINITIALIZE_H
|
||||
#define SWIFT_BASIC_LLVMINITIALIZE_H
|
||||
|
||||
#include "swift/Basic/Compiler.h"
|
||||
#include "llvm/Support/InitLLVM.h"
|
||||
#include "llvm/Support/ManagedStatic.h"
|
||||
#include "llvm/Support/PrettyStackTrace.h"
|
||||
#include "llvm/Support/Signals.h"
|
||||
#include "llvm/Support/TargetSelect.h"
|
||||
|
||||
#define PROGRAM_START(argc, argv) \
|
||||
llvm::InitLLVM _INITIALIZE_LLVM(argc, argv)
|
||||
#define PROGRAM_START(argc, argv) \
|
||||
llvm::InitLLVM _INITIALIZE_LLVM(argc, argv); \
|
||||
llvm::setBugReportMsg(SWIFT_CRASH_BUG_REPORT_MESSAGE "\n")
|
||||
|
||||
#define INITIALIZE_LLVM() \
|
||||
do { \
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
//
|
||||
// This source file is part of the Swift.org open source project
|
||||
//
|
||||
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
|
||||
// Copyright (c) 2014 - 2025 Apple Inc. and the Swift project authors
|
||||
// Licensed under Apache License v2.0 with Runtime Library Exception
|
||||
//
|
||||
// See https://swift.org/LICENSE.txt for license information
|
||||
@@ -664,7 +664,6 @@ getASTOverrideKind(const SILOptOptions &options) {
|
||||
|
||||
int sil_opt_main(ArrayRef<const char *> argv, void *MainAddr) {
|
||||
INITIALIZE_LLVM();
|
||||
llvm::setBugReportMsg(SWIFT_CRASH_BUG_REPORT_MESSAGE "\n");
|
||||
llvm::EnablePrettyStackTraceOnSigInfoForThisThread();
|
||||
|
||||
SILOptOptions options;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
//
|
||||
// This source file is part of the Swift.org open source project
|
||||
//
|
||||
// Copyright (c) 2014 - 2020 Apple Inc. and the Swift project authors
|
||||
// Copyright (c) 2014 - 2025 Apple Inc. and the Swift project authors
|
||||
// Licensed under Apache License v2.0 with Runtime Library Exception
|
||||
//
|
||||
// See https://swift.org/LICENSE.txt for license information
|
||||
@@ -2259,7 +2259,6 @@ int swift::performFrontend(ArrayRef<const char *> Args,
|
||||
const char *Argv0, void *MainAddr,
|
||||
FrontendObserver *observer) {
|
||||
INITIALIZE_LLVM();
|
||||
llvm::setBugReportMsg(SWIFT_CRASH_BUG_REPORT_MESSAGE "\n");
|
||||
llvm::EnablePrettyStackTraceOnSigInfoForThisThread();
|
||||
|
||||
std::unique_ptr<CompilerInstance> Instance =
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
//
|
||||
// This source file is part of the Swift.org open source project
|
||||
//
|
||||
// Copyright (c) 2014 - 2020 Apple Inc. and the Swift project authors
|
||||
// Copyright (c) 2014 - 2025 Apple Inc. and the Swift project authors
|
||||
// Licensed under Apache License v2.0 with Runtime Library Exception
|
||||
//
|
||||
// See https://swift.org/LICENSE.txt for license information
|
||||
@@ -14,8 +14,8 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "swift/Basic/LLVMInitialize.h"
|
||||
#include "swift/Basic/Compiler.h"
|
||||
#include "swift/Basic/LLVMInitialize.h"
|
||||
#include "swift/Localization/LocalizationFormat.h"
|
||||
#include "llvm/ADT/ArrayRef.h"
|
||||
#include "llvm/ADT/SmallString.h"
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
//
|
||||
// This source file is part of the Swift.org open source project
|
||||
//
|
||||
// Copyright (c) 2014 - 2018 Apple Inc. and the Swift project authors
|
||||
// Copyright (c) 2014 - 2025 Apple Inc. and the Swift project authors
|
||||
// Licensed under Apache License v2.0 with Runtime Library Exception
|
||||
//
|
||||
// See https://swift.org/LICENSE.txt for license information
|
||||
@@ -20,6 +20,7 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "swift/Basic/LLVM.h"
|
||||
#include "swift/Basic/LLVMInitialize.h"
|
||||
#include "swift/Demangling/Demangle.h"
|
||||
#include "swift/Demangling/ManglingMacros.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
@@ -191,6 +192,8 @@ int main(int argc, char **argv) {
|
||||
// if main()'s first function call is passing argv[0].
|
||||
std::rand();
|
||||
#endif
|
||||
PROGRAM_START(argc, argv);
|
||||
|
||||
llvm::cl::ParseCommandLineOptions(argc, argv);
|
||||
|
||||
swift::Demangle::DemangleOptions options;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
//
|
||||
// This source file is part of the Swift.org open source project
|
||||
//
|
||||
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
|
||||
// Copyright (c) 2014 - 2025 Apple Inc. and the Swift project authors
|
||||
// Licensed under Apache License v2.0 with Runtime Library Exception
|
||||
//
|
||||
// See https://swift.org/LICENSE.txt for license information
|
||||
@@ -14,6 +14,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "swift/Basic/LLVMInitialize.h"
|
||||
#include "swift/Demangling/Demangle.h"
|
||||
#include "swift/Demangling/ManglingFlavor.h"
|
||||
#include "swift/Demangling/ManglingMacros.h"
|
||||
@@ -407,6 +408,8 @@ int main(int argc, char **argv) {
|
||||
// if main()'s first function call is passing argv[0].
|
||||
std::rand();
|
||||
#endif
|
||||
PROGRAM_START(argc, argv);
|
||||
|
||||
llvm::cl::ParseCommandLineOptions(argc, argv);
|
||||
|
||||
swift::Demangle::DemangleOptions options;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
//
|
||||
// This source file is part of the Swift.org open source project
|
||||
//
|
||||
// Copyright (c) 2022 Apple Inc. and the Swift project authors
|
||||
// Copyright (c) 2022 - 2025 Apple Inc. and the Swift project authors
|
||||
// Licensed under Apache License v2.0 with Runtime Library Exception
|
||||
//
|
||||
// See https://swift.org/LICENSE.txt for license information
|
||||
@@ -17,6 +17,7 @@
|
||||
#include "swift-c/DependencyScan/DependencyScan.h"
|
||||
#include "swift/Basic/Defer.h"
|
||||
#include "swift/Basic/FileTypes.h"
|
||||
#include "swift/Basic/LLVMInitialize.h"
|
||||
#include "swift/DependencyScan/DependencyScanJSON.h"
|
||||
#include "swift/DependencyScan/StringUtils.h"
|
||||
#include "llvm/ADT/StringExtras.h"
|
||||
@@ -283,6 +284,8 @@ createArgs(ArrayRef<std::string> Cmd, StringSaver &Saver, Actions Action) {
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
PROGRAM_START(argc, argv);
|
||||
|
||||
llvm::cl::HideUnrelatedOptions(Category);
|
||||
llvm::cl::ParseCommandLineOptions(argc, argv,
|
||||
"Test libSwiftScan interfaces\n");
|
||||
|
||||
Reference in New Issue
Block a user