As reported by @arichardson , this patch now makes llvm::report_fatal_error() to generate a preprocessed source + reproducer script again. Tested with/without the cmake flag CLANG_SPAWN_CC1. Tested in various configs, Debug/Release, with MSVC 19.24 or clang-cl 9.0.1, on Windows and Linux (with both gcc 9.2.1 and clang 9.0).
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.
This fixes PR44705.
I don't think it matters (yet?) but we should probably also use llvm::sys::Process::Exit() in cc1as_main.cpp?