diff options
author | Alexandre Ganea <alexandre.ganea@ubisoft.com> | 2020-02-11 10:17:15 -0500 |
---|---|---|
committer | Hans Wennborg <hans@chromium.org> | 2020-02-12 10:22:21 +0100 |
commit | fd04cb43e1d83c6f18c932de94c1e341272ed160 (patch) | |
tree | 0eccf00d27a17e3b8ece0a0a4d7eecd328b5d524 /clang/tools | |
parent | aeba7ba9f3dada09e196d174e7f13b82f01300db (diff) | |
download | bcm5719-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 'clang/tools')
-rw-r--r-- | clang/tools/driver/cc1_main.cpp | 3 | ||||
-rw-r--r-- | clang/tools/driver/cc1as_main.cpp | 3 |
2 files changed, 4 insertions, 2 deletions
diff --git a/clang/tools/driver/cc1_main.cpp b/clang/tools/driver/cc1_main.cpp index b551e9f4cf8..6d1a67f2a4f 100644 --- a/clang/tools/driver/cc1_main.cpp +++ b/clang/tools/driver/cc1_main.cpp @@ -36,6 +36,7 @@ #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/ManagedStatic.h" #include "llvm/Support/Path.h" +#include "llvm/Support/Process.h" #include "llvm/Support/Signals.h" #include "llvm/Support/TargetRegistry.h" #include "llvm/Support/TargetSelect.h" @@ -69,7 +70,7 @@ static void LLVMErrorHandler(void *UserData, const std::string &Message, // We cannot recover from llvm errors. When reporting a fatal error, exit // with status 70 to generate crash diagnostics. For BSD systems this is // defined as an internal software error. Otherwise, exit with status 1. - exit(GenCrashDiag ? 70 : 1); + llvm::sys::Process::Exit(GenCrashDiag ? 70 : 1); } #ifdef CLANG_HAVE_RLIMITS diff --git a/clang/tools/driver/cc1as_main.cpp b/clang/tools/driver/cc1as_main.cpp index 53c8a9d642d..e1041f91bfd 100644 --- a/clang/tools/driver/cc1as_main.cpp +++ b/clang/tools/driver/cc1as_main.cpp @@ -46,6 +46,7 @@ #include "llvm/Support/Host.h" #include "llvm/Support/MemoryBuffer.h" #include "llvm/Support/Path.h" +#include "llvm/Support/Process.h" #include "llvm/Support/Signals.h" #include "llvm/Support/SourceMgr.h" #include "llvm/Support/TargetRegistry.h" @@ -547,7 +548,7 @@ static void LLVMErrorHandler(void *UserData, const std::string &Message, Diags.Report(diag::err_fe_error_backend) << Message; // We cannot recover from llvm errors. - exit(1); + sys::Process::Exit(1); } int cc1as_main(ArrayRef<const char *> Argv, const char *Argv0, void *MainAddr) { |