blob: 78092e14da4b1680bbbe344320d8d9fb8e4c3e27 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
|
//===- Error.cpp - system_error extensions for lld --------------*- C++ -*-===//
//
// The LLVM Linker
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#include "lld/Core/Error.h"
#include "llvm/Support/ErrorHandling.h"
using namespace lld;
class _native_reader_error_category : public llvm::_do_message {
public:
virtual const char* name() const {
return "lld.native.reader";
}
virtual std::string message(int ev) const {
switch (ev) {
case native_reader_error::success:
return "Success";
case native_reader_error::unknown_file_format:
return "Unknown file format";
case native_reader_error::file_too_short:
return "file truncated";
case native_reader_error::file_malformed:
return "file malformed";
case native_reader_error::memory_error:
return "out of memory";
case native_reader_error::unknown_chunk_type:
return "unknown chunk type";
default:
llvm_unreachable("An enumerator of native_reader_error does not have a "
"message defined.");
}
}
virtual llvm::error_condition default_error_condition(int ev) const {
if (ev == native_reader_error::success)
return llvm::errc::success;
return llvm::errc::invalid_argument;
}
};
const llvm::error_category &lld::native_reader_category() {
static _native_reader_error_category o;
return o;
}
class _yaml_reader_error_category : public llvm::_do_message {
public:
virtual const char* name() const {
return "lld.yaml.reader";
}
virtual std::string message(int ev) const {
switch (ev) {
case yaml_reader_error::success:
return "Success";
case yaml_reader_error::unknown_keyword:
return "Unknown keyword found in yaml file";
case yaml_reader_error::illegal_value:
return "Bad value found in yaml file";
default:
llvm_unreachable("An enumerator of yaml_reader_error does not have a "
"message defined.");
}
}
virtual llvm::error_condition default_error_condition(int ev) const {
if (ev == yaml_reader_error::success)
return llvm::errc::success;
return llvm::errc::invalid_argument;
}
};
const llvm::error_category &lld::yaml_reader_category() {
static _yaml_reader_error_category o;
return o;
}
class _linker_script_reader_error_category : public llvm::_do_message {
public:
virtual const char *name() const { return "lld.linker-script.reader"; }
virtual std::string message(int ev) const {
switch (ev) {
case static_cast<int>(linker_script_reader_error::success):
return "Success";
case static_cast<int>(linker_script_reader_error::parse_error):
return "Error parsing linker script";
default:
llvm_unreachable(
"An enumerator of linker_script_reader_error does not have a "
"message defined.");
}
}
virtual llvm::error_condition default_error_condition(int ev) const {
if (ev == static_cast<int>(linker_script_reader_error::success))
return llvm::errc::success;
return llvm::errc::invalid_argument;
}
};
const llvm::error_category &lld::linker_script_reader_category() {
static _linker_script_reader_error_category o;
return o;
}
|