summaryrefslogtreecommitdiffstats
path: root/llvm/include
diff options
context:
space:
mode:
authorAlexandre Ganea <alexandre.ganea@ubisoft.com>2020-02-11 10:17:15 -0500
committerHans Wennborg <hans@chromium.org>2020-02-12 10:22:21 +0100
commitfd04cb43e1d83c6f18c932de94c1e341272ed160 (patch)
tree0eccf00d27a17e3b8ece0a0a4d7eecd328b5d524 /llvm/include
parentaeba7ba9f3dada09e196d174e7f13b82f01300db (diff)
downloadbcm5719-llvm-fd04cb43e1d83c6f18c932de94c1e341272ed160.tar.gz
bcm5719-llvm-fd04cb43e1d83c6f18c932de94c1e341272ed160.zip
[Clang][Driver] After default -fintegrated-cc1, make llvm::report_fatal_error() generate preprocessed source + reproducer.sh again.
Added a test for #pragma clang __debug llvm_fatal_error to test for the original issue. Added llvm::sys::Process::Exit() and replaced ::exit() in places where it was appropriate. This new function would call the current CrashRecoveryContext if one is running on the same thread; or call ::exit() otherwise. Fixes PR44705. Differential Revision: https://reviews.llvm.org/D73742 (cherry picked from commit faace365088a2a3a4cb1050a9facfc34a7a56577)
Diffstat (limited to 'llvm/include')
-rw-r--r--llvm/include/llvm/Support/CrashRecoveryContext.h5
-rw-r--r--llvm/include/llvm/Support/Process.h6
2 files changed, 11 insertions, 0 deletions
diff --git a/llvm/include/llvm/Support/CrashRecoveryContext.h b/llvm/include/llvm/Support/CrashRecoveryContext.h
index beeb855c7c5..61a1bd405a4 100644
--- a/llvm/include/llvm/Support/CrashRecoveryContext.h
+++ b/llvm/include/llvm/Support/CrashRecoveryContext.h
@@ -97,6 +97,11 @@ public:
return RunSafelyOnThread([&]() { Fn(UserData); }, RequestedStackSize);
}
+ /// Explicitly trigger a crash recovery in the current process, and
+ /// return failure from RunSafely(). This function does not return.
+ LLVM_ATTRIBUTE_NORETURN
+ void HandleExit(int RetCode);
+
/// In case of a crash, this is the crash identifier.
int RetCode = 0;
diff --git a/llvm/include/llvm/Support/Process.h b/llvm/include/llvm/Support/Process.h
index 67e37912519..e934b7413c1 100644
--- a/llvm/include/llvm/Support/Process.h
+++ b/llvm/include/llvm/Support/Process.h
@@ -201,6 +201,12 @@ public:
/// Get the result of a process wide random number generator. The
/// generator will be automatically seeded in non-deterministic fashion.
static unsigned GetRandomNumber();
+
+ /// Equivalent to ::exit(), except when running inside a CrashRecoveryContext.
+ /// In that case, the control flow will resume after RunSafely(), like for a
+ /// crash, rather than exiting the current process.
+ LLVM_ATTRIBUTE_NORETURN
+ static void Exit(int RetCode);
};
}
OpenPOWER on IntegriCloud