LLVM 22.0.0git
OrcError.h
Go to the documentation of this file.
1//===--------------- OrcError.h - Orc Error Types ---------------*- 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.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_EXECUTIONENGINE_ORC_SHARED_ORCERROR_H
14#define LLVM_EXECUTIONENGINE_ORC_SHARED_ORCERROR_H
15
17#include "llvm/Support/Error.h"
19#include <string>
20#include <system_error>
21
22namespace llvm {
23namespace orc {
24
25enum class OrcErrorCode : int {
26 // RPC Errors
44};
45
46LLVM_ABI std::error_code orcError(OrcErrorCode ErrCode);
47
48class LLVM_ABI DuplicateDefinition : public ErrorInfo<DuplicateDefinition> {
49public:
50 static char ID;
51
52 DuplicateDefinition(std::string SymbolName,
53 std::optional<std::string> Context = {});
54 std::error_code convertToErrorCode() const override;
55 void log(raw_ostream &OS) const override;
56 const std::string &getSymbolName() const;
57 const std::optional<std::string> &getContext() const;
58
59private:
60 std::string SymbolName;
61 std::optional<std::string> Context;
62};
63
64class LLVM_ABI JITSymbolNotFound : public ErrorInfo<JITSymbolNotFound> {
65public:
66 static char ID;
67
68 JITSymbolNotFound(std::string SymbolName);
69 std::error_code convertToErrorCode() const override;
70 void log(raw_ostream &OS) const override;
71 const std::string &getSymbolName() const;
72private:
73 std::string SymbolName;
74};
75
76} // End namespace orc.
77} // End namespace llvm.
78
79#endif // LLVM_EXECUTIONENGINE_ORC_SHARED_ORCERROR_H
static StringRef getSymbolName(SymbolKind SymKind)
#define LLVM_ABI
Definition: Compiler.h:213
raw_pwrite_stream & OS
Base class for user error types.
Definition: Error.h:354
Errors of this type should be returned if a module fails to include definitions that are claimed by t...
Definition: Core.h:519
Errors of this type should be returned if a module contains definitions for symbols that are not clai...
Definition: Core.h:543
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:53
OrcErrorCode
Definition: OrcError.h:25
LLVM_ABI std::error_code orcError(OrcErrorCode ErrCode)
Definition: OrcError.cpp:84
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18