diff --git a/llvm/include/llvm/Support/Signals.h b/llvm/include/llvm/Support/Signals.h index 7e165d7f3a42..2a4d84bd891a 100644 --- a/llvm/include/llvm/Support/Signals.h +++ b/llvm/include/llvm/Support/Signals.h @@ -47,6 +47,9 @@ namespace sys { /// \brief Print the stack trace using the given \c raw_ostream object. void PrintStackTrace(raw_ostream &OS); + // Run all registered signal handlers. + void RunSignalHandlers(); + /// AddSignalHandler - Add a function to be called when an abort/kill signal /// is delivered to the process. The handler can have a cookie passed to it /// to identify what instance of the handler it is. diff --git a/llvm/lib/Support/Signals.cpp b/llvm/lib/Support/Signals.cpp index 598ef50175aa..2c3560c3be90 100644 --- a/llvm/lib/Support/Signals.cpp +++ b/llvm/lib/Support/Signals.cpp @@ -28,7 +28,7 @@ using namespace sys; static ManagedStatic>> CallBacksToRun; -void RunCallBacksToRun() { +void sys::RunSignalHandlers() { if (!CallBacksToRun.isConstructed()) return; for (auto &I : *CallBacksToRun) diff --git a/llvm/lib/Support/Unix/Signals.inc b/llvm/lib/Support/Unix/Signals.inc index caccf7b377c9..2332db58bfc9 100644 --- a/llvm/lib/Support/Unix/Signals.inc +++ b/llvm/lib/Support/Unix/Signals.inc @@ -201,7 +201,7 @@ static RETSIGTYPE SignalHandler(int Sig) { } // Otherwise if it is a fault (like SEGV) run any handler. - RunCallBacksToRun(); + llvm::sys::RunSignalHandlers(); #ifdef __s390__ // On S/390, certain signals are delivered with PSW Address pointing to diff --git a/llvm/lib/Support/Windows/Signals.inc b/llvm/lib/Support/Windows/Signals.inc index c8bc646fd2c2..824edb3c39b2 100644 --- a/llvm/lib/Support/Windows/Signals.inc +++ b/llvm/lib/Support/Windows/Signals.inc @@ -457,7 +457,7 @@ static void Cleanup() { llvm::sys::fs::remove(FilesToRemove->back()); FilesToRemove->pop_back(); } - RunCallBacksToRun(); + llvm::sys::RunSignalHandlers(); LeaveCriticalSection(&CriticalSection); }