diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2014-05-06 01:44:26 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2014-05-06 01:44:26 +0000 |
commit | 36ecb2ee9d5cfd001383d7cf7751d830f7c579d1 (patch) | |
tree | a25c18ded5389f992f8323ffb39e2160fee7e1a9 /lib/Support | |
parent | f3a199b2aec6071529f902a3c5d07556c46a8ae1 (diff) | |
download | llvm-36ecb2ee9d5cfd001383d7cf7751d830f7c579d1.tar.gz llvm-36ecb2ee9d5cfd001383d7cf7751d830f7c579d1.tar.bz2 llvm-36ecb2ee9d5cfd001383d7cf7751d830f7c579d1.tar.xz |
Re-commit r208025, reverted in r208030, with a fix for a conformance issue
which GCC detects and Clang does not!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208033 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support')
-rw-r--r-- | lib/Support/CrashRecoveryContext.cpp | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/lib/Support/CrashRecoveryContext.cpp b/lib/Support/CrashRecoveryContext.cpp index 513875d4de..a426377042 100644 --- a/lib/Support/CrashRecoveryContext.cpp +++ b/lib/Support/CrashRecoveryContext.cpp @@ -301,7 +301,7 @@ void CrashRecoveryContext::Disable() { #endif -bool CrashRecoveryContext::RunSafely(void (*Fn)(void*), void *UserData) { +bool CrashRecoveryContext::RunSafely(function_ref<void()> Fn) { // If crash recovery is disabled, do nothing. if (gCrashRecoveryEnabled) { assert(!Impl && "Crash recovery context already initialized!"); @@ -313,7 +313,7 @@ bool CrashRecoveryContext::RunSafely(void (*Fn)(void*), void *UserData) { } } - Fn(UserData); + Fn(); return true; } @@ -334,8 +334,7 @@ const std::string &CrashRecoveryContext::getBacktrace() const { namespace { struct RunSafelyOnThreadInfo { - void (*Fn)(void*); - void *Data; + function_ref<void()> Fn; CrashRecoveryContext *CRC; bool Result; }; @@ -344,11 +343,11 @@ struct RunSafelyOnThreadInfo { static void RunSafelyOnThread_Dispatch(void *UserData) { RunSafelyOnThreadInfo *Info = reinterpret_cast<RunSafelyOnThreadInfo*>(UserData); - Info->Result = Info->CRC->RunSafely(Info->Fn, Info->Data); + Info->Result = Info->CRC->RunSafely(Info->Fn); } -bool CrashRecoveryContext::RunSafelyOnThread(void (*Fn)(void*), void *UserData, +bool CrashRecoveryContext::RunSafelyOnThread(function_ref<void()> Fn, unsigned RequestedStackSize) { - RunSafelyOnThreadInfo Info = { Fn, UserData, this, false }; + RunSafelyOnThreadInfo Info = { Fn, this, false }; llvm_execute_on_thread(RunSafelyOnThread_Dispatch, &Info, RequestedStackSize); if (CrashRecoveryContextImpl *CRC = (CrashRecoveryContextImpl *)Impl) CRC->setSwitchedThread(); |