aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Support/Process.cpp
diff options
context:
space:
mode:
authorAlexandre Ganea <alexandre.ganea@ubisoft.com>2020-02-11 10:17:15 -0500
committerAlexandre Ganea <alexandre.ganea@ubisoft.com>2020-02-11 10:17:30 -0500
commitfaace365088a2a3a4cb1050a9facfc34a7a56577 (patch)
treebeedb5b9a4ec30d44d2fd6148f65a9f715a51fda /llvm/lib/Support/Process.cpp
parent9a3740c33919287fd9aa4e0c6f761619e84c62a7 (diff)
downloadllvm-faace365088a2a3a4cb1050a9facfc34a7a56577.zip
llvm-faace365088a2a3a4cb1050a9facfc34a7a56577.tar.gz
llvm-faace365088a2a3a4cb1050a9facfc34a7a56577.tar.bz2
[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
Diffstat (limited to 'llvm/lib/Support/Process.cpp')
-rw-r--r--llvm/lib/Support/Process.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/llvm/lib/Support/Process.cpp b/llvm/lib/Support/Process.cpp
index 0b2d41b..9e6e233 100644
--- a/llvm/lib/Support/Process.cpp
+++ b/llvm/lib/Support/Process.cpp
@@ -13,8 +13,9 @@
#include "llvm/Support/Process.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringExtras.h"
-#include "llvm/Config/llvm-config.h"
#include "llvm/Config/config.h"
+#include "llvm/Config/llvm-config.h"
+#include "llvm/Support/CrashRecoveryContext.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/Program.h"
@@ -88,6 +89,13 @@ static bool coreFilesPrevented = !LLVM_ENABLE_CRASH_DUMPS;
bool Process::AreCoreFilesPrevented() { return coreFilesPrevented; }
+LLVM_ATTRIBUTE_NORETURN
+void Process::Exit(int RetCode) {
+ if (CrashRecoveryContext *CRC = CrashRecoveryContext::GetCurrent())
+ CRC->HandleExit(RetCode);
+ ::exit(RetCode);
+}
+
// Include the platform-specific parts of this class.
#ifdef LLVM_ON_UNIX
#include "Unix/Process.inc"