Skip to content

Commit ef2776b

Browse files
committed
Don't call signal handler in Windows signal.inc
1 parent bf6fbe2 commit ef2776b

File tree

11 files changed

+19
-22
lines changed

11 files changed

+19
-22
lines changed

clang/tools/clang-repl/ClangRepl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ static void LLVMErrorHandler(void *UserData, const char *Message,
5555

5656
// Run the interrupt handlers to make sure any special cleanups get done, in
5757
// particular that we remove files registered with RemoveFileOnSignal.
58-
llvm::sys::RunInterruptHandlers(/*GenCrashDiag=*/false);
58+
llvm::sys::RunInterruptHandlers(/*ExecuteSignalHandlers=*/true);
5959

6060
// We cannot recover from llvm errors. When reporting a fatal error, exit
6161
// with status 70 to generate crash diagnostics. For BSD systems this is

clang/tools/driver/cc1_main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ static void LLVMErrorHandler(void *UserData, const char *Message,
7272

7373
// Run the interrupt handlers to make sure any special cleanups get done, in
7474
// particular that we remove files registered with RemoveFileOnSignal.
75-
llvm::sys::RunInterruptHandlers(/*GenCrashDiag=*/false);
75+
llvm::sys::RunInterruptHandlers(/*ExecuteSignalHandlers=*/true);
7676

7777
// We cannot recover from llvm errors. When reporting a fatal error, exit
7878
// with status 70 to generate crash diagnostics. For BSD systems this is

llvm/include/llvm/Passes/StandardInstrumentations.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,7 @@ class PrintCrashIRInstrumentation {
589589
// The crash reporter that will report on a crash.
590590
static PrintCrashIRInstrumentation *CrashReporter;
591591
// Crash handler registered when print-on-crash is specified.
592-
static void SignalHandler(void *, bool);
592+
static void SignalHandler(void *);
593593
};
594594

595595
/// This class provides an interface to register all the standard pass

llvm/include/llvm/Support/Signals.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ namespace sys {
2626

2727
/// This function runs all the registered interrupt handlers, including the
2828
/// removal of files registered by RemoveFileOnSignal.
29-
LLVM_ABI void RunInterruptHandlers(bool GenCrashDiag);
29+
LLVM_ABI void RunInterruptHandlers(bool ExecuteSignalHandlers);
3030

3131
/// This function registers signal handlers to ensure that if a signal gets
3232
/// delivered that the named file is removed.
@@ -58,9 +58,9 @@ LLVM_ABI void DisableSystemDialogsOnCrash();
5858
LLVM_ABI void PrintStackTrace(raw_ostream &OS, int Depth = 0);
5959

6060
// Run all registered signal handlers.
61-
LLVM_ABI void RunSignalHandlers(bool GenCrashDiag);
61+
LLVM_ABI void RunSignalHandlers();
6262

63-
using SignalHandlerCallback = void (*)(void *, bool);
63+
using SignalHandlerCallback = void (*)(void *);
6464

6565
/// Add a function to be called when an abort/kill signal is delivered to the
6666
/// process. The handler can have a cookie passed to it to identify what

llvm/lib/Passes/StandardInstrumentations.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2468,7 +2468,7 @@ void PrintCrashIRInstrumentation::reportCrashIR() {
24682468
}
24692469
}
24702470

2471-
void PrintCrashIRInstrumentation::SignalHandler(void *, bool) {
2471+
void PrintCrashIRInstrumentation::SignalHandler(void *) {
24722472
// Called by signal handlers so do not lock here
24732473
// Is the PrintCrashIRInstrumentation still alive?
24742474
if (!CrashReporter)

llvm/lib/Support/Debug.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ void llvm::initDebugOptions() {
148148
}
149149

150150
// Signal handlers - dump debug output on termination.
151-
static void debug_user_sig_handler(void *Cookie, bool /*GenCrashDiag*/) {
151+
static void debug_user_sig_handler(void *Cookie) {
152152
// This is a bit sneaky. Since this is under #ifndef NDEBUG, we
153153
// know that debug mode is enabled and dbgs() really is a
154154
// circular_raw_ostream. If NDEBUG is defined, then dbgs() ==

llvm/lib/Support/PrettyStackTrace.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,10 +150,7 @@ alignas(CrashHandlerString) static CrashHandlerStringStorage
150150

151151
/// This callback is run if a fatal signal is delivered to the process, it
152152
/// prints the pretty stack trace.
153-
static void CrashHandler(void *, bool GenCrashDiag) {
154-
if (!GenCrashDiag)
155-
return;
156-
153+
static void CrashHandler(void *) {
157154
errs() << BugReportMsg ;
158155

159156
#ifndef __APPLE__

llvm/lib/Support/Signals.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,13 +95,13 @@ CallBacksToRun() {
9595
}
9696

9797
// Signal-safe.
98-
void sys::RunSignalHandlers(bool GenCrashDiag) {
98+
void sys::RunSignalHandlers() {
9999
for (CallbackAndCookie &RunMe : CallBacksToRun()) {
100100
auto Expected = CallbackAndCookie::Status::Initialized;
101101
auto Desired = CallbackAndCookie::Status::Executing;
102102
if (!RunMe.Flag.compare_exchange_strong(Expected, Desired))
103103
continue;
104-
(*RunMe.Callback)(RunMe.Cookie, GenCrashDiag);
104+
(*RunMe.Callback)(RunMe.Cookie);
105105
RunMe.Callback = nullptr;
106106
RunMe.Cookie = nullptr;
107107
RunMe.Flag.store(CallbackAndCookie::Status::Empty);

llvm/lib/Support/Windows/Signals.inc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,7 @@ void llvm::sys::AddSignalHandler(sys::SignalHandlerCallback FnPtr,
611611
LeaveCriticalSection(&CriticalSection);
612612
}
613613

614-
static void Cleanup(bool ExecuteSignalHandlers, bool GenCrashDiag) {
614+
static void Cleanup(bool ExecuteSignalHandlers) {
615615
if (CleanupExecuted)
616616
return;
617617

@@ -629,18 +629,18 @@ static void Cleanup(bool ExecuteSignalHandlers, bool GenCrashDiag) {
629629
}
630630

631631
if (ExecuteSignalHandlers)
632-
llvm::sys::RunSignalHandlers(GenCrashDiag);
632+
llvm::sys::RunSignalHandlers();
633633

634634
LeaveCriticalSection(&CriticalSection);
635635
}
636636

637-
void llvm::sys::RunInterruptHandlers(bool GenCrashDiag) {
637+
void llvm::sys::RunInterruptHandlers(bool ExecuteSignalHandlers) {
638638
// The interrupt handler may be called from an interrupt, but it may also be
639639
// called manually (such as the case of report_fatal_error with no registered
640640
// error handler). We must ensure that the critical section is properly
641641
// initialized.
642642
InitializeThreading();
643-
Cleanup(true, GenCrashDiag);
643+
Cleanup(ExecuteSignalHandlers);
644644
}
645645

646646
/// Find the Windows Registry Key for a given location.
@@ -847,7 +847,7 @@ void sys::CleanupOnSignal(uintptr_t Context) {
847847
}
848848

849849
static LONG WINAPI LLVMUnhandledExceptionFilter(LPEXCEPTION_POINTERS ep) {
850-
Cleanup(/*ExecuteSignalHandlers=*/true, /*GenCrashDiag=*/false);
850+
Cleanup(/*ExecuteSignalHandlers=*/true);
851851

852852
// Write out the exception code.
853853
if (ep && ep->ExceptionRecord)
@@ -887,7 +887,7 @@ static BOOL WINAPI LLVMConsoleCtrlHandler(DWORD dwCtrlType) {
887887
// This function is only ever called when a CTRL-C or similar control signal
888888
// is fired. Killing a process in this way is normal, so don't trigger the
889889
// signal handlers.
890-
Cleanup(/*ExecuteSignalHandlers=*/false, /*GenCrashDiag=*/false);
890+
Cleanup(/*ExecuteSignalHandlers=*/false);
891891

892892
// If an interrupt function has been set, go and run one it; otherwise,
893893
// the process dies.

llvm/lib/TableGen/Error.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ static void PrintMessage(ArrayRef<SMLoc> Loc, SourceMgr::DiagKind Kind,
4343
// Run file cleanup handlers and then exit fatally (with non-zero exit code).
4444
[[noreturn]] inline static void fatal_exit() {
4545
// The following call runs the file cleanup handlers.
46-
sys::RunInterruptHandlers(/*GenCrashDiag=*/false);
46+
sys::RunInterruptHandlers(/*ExecuteSignalHandlers=*/false);
4747
std::exit(1);
4848
}
4949

0 commit comments

Comments
 (0)