1 //===--------------- RPCError.cpp - RPCERror implementation ---------------===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 // 9 // RPC Error type implmentations. 10 // 11 //===----------------------------------------------------------------------===// 12 13 #include "llvm/ExecutionEngine/Orc/RPC/RPCUtils.h" 14 #include "llvm/Support/Error.h" 15 #include "llvm/Support/raw_ostream.h" 16 17 #include <string> 18 #include <system_error> 19 20 char llvm::orc::rpc::RPCFatalError::ID = 0; 21 char llvm::orc::rpc::ConnectionClosed::ID = 0; 22 char llvm::orc::rpc::ResponseAbandoned::ID = 0; 23 char llvm::orc::rpc::CouldNotNegotiate::ID = 0; 24 25 namespace llvm { 26 namespace orc { 27 namespace rpc { 28 convertToErrorCode() const29std::error_code ConnectionClosed::convertToErrorCode() const { 30 return orcError(OrcErrorCode::RPCConnectionClosed); 31 } 32 log(raw_ostream & OS) const33void ConnectionClosed::log(raw_ostream &OS) const { 34 OS << "RPC connection already closed"; 35 } 36 convertToErrorCode() const37std::error_code ResponseAbandoned::convertToErrorCode() const { 38 return orcError(OrcErrorCode::RPCResponseAbandoned); 39 } 40 log(raw_ostream & OS) const41void ResponseAbandoned::log(raw_ostream &OS) const { 42 OS << "RPC response abandoned"; 43 } 44 CouldNotNegotiate(std::string Signature)45CouldNotNegotiate::CouldNotNegotiate(std::string Signature) 46 : Signature(std::move(Signature)) {} 47 convertToErrorCode() const48std::error_code CouldNotNegotiate::convertToErrorCode() const { 49 return orcError(OrcErrorCode::RPCCouldNotNegotiateFunction); 50 } 51 log(raw_ostream & OS) const52void CouldNotNegotiate::log(raw_ostream &OS) const { 53 OS << "Could not negotiate RPC function " << Signature; 54 } 55 56 } // end namespace rpc 57 } // end namespace orc 58 } // end namespace llvm 59