mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Merge pull request #40168 from bnbarham/rebranch-failures
[rebranch] Fix compilation failures
This commit is contained in:
@@ -1844,15 +1844,15 @@ int swift::performFrontend(ArrayRef<const char *> Args,
|
||||
//
|
||||
// Unfortunately it's not really safe to do anything else, since very
|
||||
// low-level operations in LLVM can trigger fatal errors.
|
||||
auto diagnoseFatalError = [&PDC](const std::string &reason, bool shouldCrash){
|
||||
static const std::string *recursiveFatalError = nullptr;
|
||||
auto diagnoseFatalError = [&PDC](const char *reason, bool shouldCrash) {
|
||||
static const char *recursiveFatalError = nullptr;
|
||||
if (recursiveFatalError) {
|
||||
// Report the /original/ error through LLVM's default handler, not
|
||||
// whatever we encountered.
|
||||
llvm::remove_fatal_error_handler();
|
||||
llvm::report_fatal_error(*recursiveFatalError, shouldCrash);
|
||||
llvm::report_fatal_error(recursiveFatalError, shouldCrash);
|
||||
}
|
||||
recursiveFatalError = &reason;
|
||||
recursiveFatalError = reason;
|
||||
|
||||
SourceManager dummyMgr;
|
||||
|
||||
@@ -1868,12 +1868,13 @@ int swift::performFrontend(ArrayRef<const char *> Args,
|
||||
if (shouldCrash)
|
||||
abort();
|
||||
};
|
||||
llvm::ScopedFatalErrorHandler handler([](void *rawCallback,
|
||||
const std::string &reason,
|
||||
bool shouldCrash) {
|
||||
auto *callback = static_cast<decltype(&diagnoseFatalError)>(rawCallback);
|
||||
(*callback)(reason, shouldCrash);
|
||||
}, &diagnoseFatalError);
|
||||
llvm::ScopedFatalErrorHandler handler(
|
||||
[](void *rawCallback, const char *reason, bool shouldCrash) {
|
||||
auto *callback =
|
||||
static_cast<decltype(&diagnoseFatalError)>(rawCallback);
|
||||
(*callback)(reason, shouldCrash);
|
||||
},
|
||||
&diagnoseFatalError);
|
||||
|
||||
std::unique_ptr<CompilerInstance> Instance =
|
||||
std::make_unique<CompilerInstance>();
|
||||
|
||||
Reference in New Issue
Block a user