[llvm] [cmake] Add possibility to use ChooseMSVCCRT.cmake when include LLVM library
[llvm-core.git] / include / llvm / ExecutionEngine / Orc / OrcError.h
blobe5d6a3eca85f2e4cebd7ea447e48f50cc81c13c7
1 //===------ OrcError.h - Reject symbol lookup requests ------*- C++ -*-===//
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 // Define an error category, error codes, and helper utilities for Orc.
11 //===----------------------------------------------------------------------===//
13 #ifndef LLVM_EXECUTIONENGINE_ORC_ORCERROR_H
14 #define LLVM_EXECUTIONENGINE_ORC_ORCERROR_H
16 #include "llvm/Support/Error.h"
17 #include <system_error>
19 namespace llvm {
20 namespace orc {
22 enum class OrcErrorCode : int {
23 // RPC Errors
24 UnknownORCError = 1,
25 DuplicateDefinition,
26 JITSymbolNotFound,
27 RemoteAllocatorDoesNotExist,
28 RemoteAllocatorIdAlreadyInUse,
29 RemoteMProtectAddrUnrecognized,
30 RemoteIndirectStubsOwnerDoesNotExist,
31 RemoteIndirectStubsOwnerIdAlreadyInUse,
32 RPCConnectionClosed,
33 RPCCouldNotNegotiateFunction,
34 RPCResponseAbandoned,
35 UnexpectedRPCCall,
36 UnexpectedRPCResponse,
37 UnknownErrorCodeFromRemote,
38 UnknownResourceHandle
41 std::error_code orcError(OrcErrorCode ErrCode);
43 class DuplicateDefinition : public ErrorInfo<DuplicateDefinition> {
44 public:
45 static char ID;
47 DuplicateDefinition(std::string SymbolName);
48 std::error_code convertToErrorCode() const override;
49 void log(raw_ostream &OS) const override;
50 const std::string &getSymbolName() const;
51 private:
52 std::string SymbolName;
55 class JITSymbolNotFound : public ErrorInfo<JITSymbolNotFound> {
56 public:
57 static char ID;
59 JITSymbolNotFound(std::string SymbolName);
60 std::error_code convertToErrorCode() const override;
61 void log(raw_ostream &OS) const override;
62 const std::string &getSymbolName() const;
63 private:
64 std::string SymbolName;
67 } // End namespace orc.
68 } // End namespace llvm.
70 #endif // LLVM_EXECUTIONENGINE_ORC_ORCERROR_H