Bartleby 0.1.0
A symbol renaming toolkit
Loading...
Searching...
No Matches
Error.h
Go to the documentation of this file.
1// Copyright 2023 SandboxAQ
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
20
21#pragma once
22
23#include "Bartleby/Bartleby.h"
24
25#include "llvm/ADT/SmallString.h"
26#include "llvm/ADT/Triple.h"
27#include "llvm/Support/Error.h"
28
29#include <variant>
30
31namespace saq::bartleby {
32
34class Error : public llvm::ErrorInfo<Error> {
35public:
37 static char ID;
38
42 llvm::SmallString<32> Msg;
43 };
44
52
55 };
56
60 llvm::SmallString<32> Msg;
61 };
62
64 using ReasonT =
67
71 template <typename T> Error(T Reason) noexcept : Reason(std::move(Reason)) {}
72
73 ~Error() noexcept override = default;
74
75 void log(llvm::raw_ostream &OS) const noexcept override;
76 std::string message() const noexcept override;
77 std::error_code convertToErrorCode() const noexcept override;
78
79private:
81 ReasonT Reason;
82};
83
84} // end namespace saq::bartleby
Bartleby specification.
Custom error info for Bartleby.
Definition: Error.h:34
std::variant< UnsupportedBinaryReason, ObjectFormatTypeMismatchReason, MachOUniversalBinaryReason > ReasonT
Reason for error.
Definition: Error.h:66
Error(T Reason) noexcept
Constructs an error using a reason.
Definition: Error.h:71
static char ID
Error ID.
Definition: Error.h:37
Fat Mach-O related error.
Definition: Error.h:58
llvm::SmallString< 32 > Msg
Error message.
Definition: Error.h:60
Mismatch between object format type.
Definition: Error.h:49
ObjectFormat Found
The type of the object responsible of this error.
Definition: Error.h:54
ObjectFormat Constraint
Object type from the Bartleby handle.
Definition: Error.h:51
Error from std::error_code.
Definition: Error.h:40
llvm::SmallString< 32 > Msg
Error message.
Definition: Error.h:42
Object format.
Definition: Bartleby.h:40