diff options
| author | Richard Smith <richard-llvm@metafoo.co.uk> | 2014-03-04 22:13:07 +0000 |
|---|---|---|
| committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2014-03-04 22:13:07 +0000 |
| commit | 635631306fc8225c5cd34c0fb6bd960d3ea3f842 (patch) | |
| tree | 4e756c91c3c780feef9e7335488645099db88e94 /llvm/lib | |
| parent | 75991301d2a3c8d851f8a16d03dfbb7daa4d049c (diff) | |
| download | bcm5719-llvm-635631306fc8225c5cd34c0fb6bd960d3ea3f842.tar.gz bcm5719-llvm-635631306fc8225c5cd34c0fb6bd960d3ea3f842.zip | |
Remove dependence on std::function.
llvm-svn: 202902
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Support/CrashRecoveryContext.cpp | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/llvm/lib/Support/CrashRecoveryContext.cpp b/llvm/lib/Support/CrashRecoveryContext.cpp index 614980f718a..ccc00894fb3 100644 --- a/llvm/lib/Support/CrashRecoveryContext.cpp +++ b/llvm/lib/Support/CrashRecoveryContext.cpp @@ -302,10 +302,6 @@ void CrashRecoveryContext::Disable() { #endif bool CrashRecoveryContext::RunSafely(void (*Fn)(void*), void *UserData) { - return RunSafely([&]() { Fn(UserData); }); -} - -bool CrashRecoveryContext::RunSafely(std::function<void()> Fn) { // If crash recovery is disabled, do nothing. if (gCrashRecoveryEnabled) { assert(!Impl && "Crash recovery context already initialized!"); @@ -317,7 +313,7 @@ bool CrashRecoveryContext::RunSafely(std::function<void()> Fn) { } } - Fn(); + Fn(UserData); return true; } @@ -336,14 +332,10 @@ const std::string &CrashRecoveryContext::getBacktrace() const { // -bool CrashRecoveryContext::RunSafelyOnThread(void (*Fn)(void*), void *UserData, - unsigned RequestedStackSize) { - return RunSafelyOnThread([&]() { Fn(UserData); }, RequestedStackSize); -} - namespace { struct RunSafelyOnThreadInfo { - std::function<void()> Fn; + void (*Fn)(void*); + void *Data; CrashRecoveryContext *CRC; bool Result; }; @@ -352,12 +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(std::function<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(); |

