diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2014-03-04 21:48:49 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2014-03-04 21:48:49 +0000 |
commit | 943d1fdffe805f6e026529a30167acdc324fb667 (patch) | |
tree | 785c816aa3ab7b6d1a907202afbfd712a6adbf53 /include/llvm/Support | |
parent | f0a0ceb0341db6288d6a3c4c1117cf6f36d5528b (diff) | |
download | llvm-943d1fdffe805f6e026529a30167acdc324fb667.tar.gz llvm-943d1fdffe805f6e026529a30167acdc324fb667.tar.bz2 llvm-943d1fdffe805f6e026529a30167acdc324fb667.tar.xz |
Add support for arbitrary functors to CrashRecoveryContext.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202895 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Support')
-rw-r--r-- | include/llvm/Support/CrashRecoveryContext.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/include/llvm/Support/CrashRecoveryContext.h b/include/llvm/Support/CrashRecoveryContext.h index 4c0a5e26f0..aa5e55eeab 100644 --- a/include/llvm/Support/CrashRecoveryContext.h +++ b/include/llvm/Support/CrashRecoveryContext.h @@ -10,6 +10,7 @@ #ifndef LLVM_SUPPORT_CRASHRECOVERYCONTEXT_H #define LLVM_SUPPORT_CRASHRECOVERYCONTEXT_H +#include <functional> #include <string> namespace llvm { @@ -75,6 +76,7 @@ public: /// make as little assumptions as possible about the program state when /// RunSafely has returned false. Clients can use getBacktrace() to retrieve /// the backtrace of the crash on failures. + bool RunSafely(std::function<void()> Fn); bool RunSafely(void (*Fn)(void*), void *UserData); /// \brief Execute the provide callback function (with the given arguments) in @@ -84,6 +86,8 @@ public: /// See RunSafely() and llvm_execute_on_thread(). bool RunSafelyOnThread(void (*Fn)(void*), void *UserData, unsigned RequestedStackSize = 0); + bool RunSafelyOnThread(std::function<void()> Fn, + unsigned RequestedStackSize = 0); /// \brief Explicitly trigger a crash recovery in the current process, and /// return failure from RunSafely(). This function does not return. |