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   JITSymbolNotFound = 1,
     26   RemoteAllocatorDoesNotExist,
     27   RemoteAllocatorIdAlreadyInUse,
     28   RemoteMProtectAddrUnrecognized,
     29   RemoteIndirectStubsOwnerDoesNotExist,
     30   RemoteIndirectStubsOwnerIdAlreadyInUse,
     31   RPCConnectionClosed,
     32   RPCCouldNotNegotiateFunction,
     33   RPCResponseAbandoned,
     34   UnexpectedRPCCall,
     35   UnexpectedRPCResponse,
     36   UnknownErrorCodeFromRemote,
     37   UnknownResourceHandle
     38 };
     39 
     40 std::error_code orcError(OrcErrorCode ErrCode);
     41 
     42 class JITSymbolNotFound : public ErrorInfo<JITSymbolNotFound> {
     43 public:
     44   static char ID;
     45 
     46   JITSymbolNotFound(std::string SymbolName);
     47   std::error_code convertToErrorCode() const override;
     48   void log(raw_ostream &OS) const override;
     49   const std::string &getSymbolName() const;
     50 private:
     51   std::string SymbolName;
     52 };
     53 
     54 } // End namespace orc.
     55 } // End namespace llvm.
     56 
     57 #endif // LLVM_EXECUTIONENGINE_ORC_ORCERROR_H
     58