Home | History | Annotate | Download | only in Orc
      1 //===------ OrcError.h - Reject symbol lookup requests ------*- C++ -*-===//
      2 //
      3 //                     The LLVM Compiler Infrastructure
      4 //
      5 // This file is distributed under the University of Illinois Open Source
      6 // License. See LICENSE.TXT for details.
      7 //
      8 //===----------------------------------------------------------------------===//
      9 //
     10 //   Define an error category, error codes, and helper utilities for Orc.
     11 //
     12 //===----------------------------------------------------------------------===//
     13 
     14 #ifndef LLVM_EXECUTIONENGINE_ORC_ORCERROR_H
     15 #define LLVM_EXECUTIONENGINE_ORC_ORCERROR_H
     16 
     17 #include "llvm/Support/Error.h"
     18 #include <system_error>
     19 
     20 namespace llvm {
     21 namespace orc {
     22 
     23 enum class OrcErrorCode : int {
     24   // RPC Errors
     25   RemoteAllocatorDoesNotExist = 1,
     26   RemoteAllocatorIdAlreadyInUse,
     27   RemoteMProtectAddrUnrecognized,
     28   RemoteIndirectStubsOwnerDoesNotExist,
     29   RemoteIndirectStubsOwnerIdAlreadyInUse,
     30   RPCResponseAbandoned,
     31   UnexpectedRPCCall,
     32   UnexpectedRPCResponse,
     33   UnknownRPCFunction
     34 };
     35 
     36 std::error_code orcError(OrcErrorCode ErrCode);
     37 
     38 class RPCFunctionNotSupported : public ErrorInfo<RPCFunctionNotSupported> {
     39 public:
     40   static char ID;
     41 
     42   RPCFunctionNotSupported(std::string RPCFunctionSignature);
     43   std::error_code convertToErrorCode() const override;
     44   void log(raw_ostream &OS) const override;
     45   const std::string &getFunctionSignature() const;
     46 private:
     47   std::string RPCFunctionSignature;
     48 };
     49 
     50 } // End namespace orc.
     51 } // End namespace llvm.
     52 
     53 #endif // LLVM_EXECUTIONENGINE_ORC_ORCERROR_H
     54