summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/CrashRecoveryContext.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Support/CrashRecoveryContext.cpp')
-rw-r--r--llvm/lib/Support/CrashRecoveryContext.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/llvm/lib/Support/CrashRecoveryContext.cpp b/llvm/lib/Support/CrashRecoveryContext.cpp
index a426377042d..513875d4de4 100644
--- a/llvm/lib/Support/CrashRecoveryContext.cpp
+++ b/llvm/lib/Support/CrashRecoveryContext.cpp
@@ -301,7 +301,7 @@ void CrashRecoveryContext::Disable() {
#endif
-bool CrashRecoveryContext::RunSafely(function_ref<void()> Fn) {
+bool CrashRecoveryContext::RunSafely(void (*Fn)(void*), void *UserData) {
// If crash recovery is disabled, do nothing.
if (gCrashRecoveryEnabled) {
assert(!Impl && "Crash recovery context already initialized!");
@@ -313,7 +313,7 @@ bool CrashRecoveryContext::RunSafely(function_ref<void()> Fn) {
}
}
- Fn();
+ Fn(UserData);
return true;
}
@@ -334,7 +334,8 @@ const std::string &CrashRecoveryContext::getBacktrace() const {
namespace {
struct RunSafelyOnThreadInfo {
- function_ref<void()> Fn;
+ void (*Fn)(void*);
+ void *Data;
CrashRecoveryContext *CRC;
bool Result;
};
@@ -343,11 +344,11 @@ struct RunSafelyOnThreadInfo {
static void RunSafelyOnThread_Dispatch(void *UserData) {
RunSafelyOnThreadInfo *Info =
reinterpret_cast<RunSafelyOnThreadInfo*>(UserData);
- Info->Result = Info->CRC->RunSafely(Info->Fn);
+ Info->Result = Info->CRC->RunSafely(Info->Fn, Info->Data);
}
-bool CrashRecoveryContext::RunSafelyOnThread(function_ref<void()> Fn,
+bool CrashRecoveryContext::RunSafelyOnThread(void (*Fn)(void*), void *UserData,
unsigned RequestedStackSize) {
- RunSafelyOnThreadInfo Info = { Fn, this, false };
+ RunSafelyOnThreadInfo Info = { Fn, UserData, this, false };
llvm_execute_on_thread(RunSafelyOnThread_Dispatch, &Info, RequestedStackSize);
if (CrashRecoveryContextImpl *CRC = (CrashRecoveryContextImpl *)Impl)
CRC->setSwitchedThread();
OpenPOWER on IntegriCloud