mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Currently, ModuleFileSharedCore::fatal() calls abort(), which may be reasonable in a swift-frontend invocation, but has dire consequences when the Swift frontend is embedded into another process, for example, LLDB where the abort() kills the entire debugging session. This patch introduces a few alternatives to the ModuleFile::fatal() familiy of functions that instead push a fatal diagnostic to the ASTContext's DiagnosticsEngine and return an llvm::Error so the error can be roperly communicated and the ASTContext can be wound down without killing the parent process. The transition is not complete, this patch does not yet handle fatalIfUnexpected(), for example. This patch is NFC for the Swift compiler: When DebuggerSupport in off ModuleFile::diagnoseFatal() will still call abort(), but if it is on, the error will be passed up, together with a pretty stack trace. rdar://64511878
45 KiB
45 KiB