[ORC] Allow FailedToMaterialize errors to outlive ExecutionSessions.
Idiomatic llvm::Error usage can result in a FailedToMaterialize error tearing down an ExecutionSession instance. Since the FailedToMaterialize error holds SymbolStringPtrs and JITDylib references this leads to crashes when accessing or logging the error. This patch modifies FailedToMaterialize to retain the SymbolStringPool and JITDylibs involved in the failure so that we can safely report an error message to the client, even if the error tears down the session. The contract for JITDylibs allows the getName method to be used even after the session has been torn down, but no other JITDylib fields should be accessed via the FailedToMaterialize error if the ssesion has been torn down. Logging the error is guaranteed to be safe in all cases.
Loading
Please sign in to comment