summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2014-03-04 22:13:07 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2014-03-04 22:13:07 +0000
commit6e5887e7e6f5d7aa8bd85074788090de0378dcb0 (patch)
tree2be28a674c0c7f46f7faa66368a5d1005d365f22 /lib
parent943d1fdffe805f6e026529a30167acdc324fb667 (diff)
downloadllvm-6e5887e7e6f5d7aa8bd85074788090de0378dcb0.tar.gz
llvm-6e5887e7e6f5d7aa8bd85074788090de0378dcb0.tar.bz2
llvm-6e5887e7e6f5d7aa8bd85074788090de0378dcb0.tar.xz
Remove dependence on std::function.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202902 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Support/CrashRecoveryContext.cpp21
1 files changed, 6 insertions, 15 deletions
diff --git a/lib/Support/CrashRecoveryContext.cpp b/lib/Support/CrashRecoveryContext.cpp
index 614980f718..ccc00894fb 100644
--- a/lib/Support/CrashRecoveryContext.cpp
+++ b/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();