diff options
author | Lang Hames <lhames@gmail.com> | 2017-01-15 06:34:25 +0000 |
---|---|---|
committer | Lang Hames <lhames@gmail.com> | 2017-01-15 06:34:25 +0000 |
commit | 021cb2b6fc7f04413056d3d70c10bc5c7ece8a4b (patch) | |
tree | 0c796d5589c0f135dd368c5bc52dc4764259be30 /llvm/lib/ExecutionEngine | |
parent | ca68a3ec47416185252b84d2bf60710c88be155f (diff) | |
download | bcm5719-llvm-021cb2b6fc7f04413056d3d70c10bc5c7ece8a4b.tar.gz bcm5719-llvm-021cb2b6fc7f04413056d3d70c10bc5c7ece8a4b.zip |
[Orc][RPC] Add an RPCFunctionNotSupported error type and return it from
negotiateFunction where appropriate.
Replacing the old ECError with a custom type allows us to attach the name of
the function that could not be negotiated, enabling better diagnostics for
negotiation failures.
llvm-svn: 292055
Diffstat (limited to 'llvm/lib/ExecutionEngine')
-rw-r--r-- | llvm/lib/ExecutionEngine/Orc/OrcError.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/llvm/lib/ExecutionEngine/Orc/OrcError.cpp b/llvm/lib/ExecutionEngine/Orc/OrcError.cpp index c531fe36992..eaa75ad06a2 100644 --- a/llvm/lib/ExecutionEngine/Orc/OrcError.cpp +++ b/llvm/lib/ExecutionEngine/Orc/OrcError.cpp @@ -58,10 +58,30 @@ static ManagedStatic<OrcErrorCategory> OrcErrCat; namespace llvm { namespace orc { +char RPCFunctionNotSupported::ID = 0; + Error orcError(OrcErrorCode ErrCode) { typedef std::underlying_type<OrcErrorCode>::type UT; return errorCodeToError( std::error_code(static_cast<UT>(ErrCode), *OrcErrCat)); } + +RPCFunctionNotSupported::RPCFunctionNotSupported(std::string RPCFunctionSignature) + : RPCFunctionSignature(std::move(RPCFunctionSignature)) {} + +std::error_code RPCFunctionNotSupported::convertToErrorCode() const { + typedef std::underlying_type<OrcErrorCode>::type UT; + return std::error_code(static_cast<UT>(OrcErrorCode::UnknownRPCFunction), + *OrcErrCat); +} + +void RPCFunctionNotSupported::log(raw_ostream &OS) const { + OS << "Could not negotiate RPC function '" << RPCFunctionSignature << "'"; +} + +const std::string &RPCFunctionNotSupported::getFunctionSignature() const { + return RPCFunctionSignature; +} + } } |