Merge pull request #40168 from bnbarham/rebranch-failures

[rebranch] Fix compilation failures
This commit is contained in:
Ben Barham
2021-11-17 08:50:11 +10:00
committed by GitHub
41 changed files with 168 additions and 231 deletions

View File

@@ -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>();