File tree 7 files changed +76
-394
lines changed
7 files changed +76
-394
lines changed Original file line number Diff line number Diff line change @@ -39,3 +39,12 @@ We probably don't want to store any javadocs for namespaces either.
39
39
The AST visitor and metadata all use forward slashes to represent file
40
40
pathnames, even on Windows. This is so the generated reference documentation
41
41
does not vary based on the platform.
42
+
43
+ == Exceptions
44
+
45
+ In functions which cannot return an error, such as work submitted to a thread
46
+ pool or in a constructor, the implementation usually throws `Error`. These
47
+ are caught and reported, and the process exits gracefully. If any exception
48
+ is thrown which is not derived from `Error`, then it should not be caught.
49
+ The uncaught exception handler should print a stack trace and exit the process
50
+ immediately.
Original file line number Diff line number Diff line change @@ -121,6 +121,14 @@ class [[nodiscard]] MRDOX_DECL
121
121
return text_;
122
122
}
123
123
124
+ /* * Return true if this equals other.
125
+ */
126
+ bool
127
+ operator ==(Error const & other) const noexcept
128
+ {
129
+ return text_ == other.text_ ;
130
+ }
131
+
124
132
/* * Return a null-terminated error string.
125
133
*/
126
134
char const *
@@ -147,6 +155,16 @@ success() noexcept
147
155
} // mrdox
148
156
} // clang
149
157
158
+ template <>
159
+ struct std ::hash<::clang::mrdox::Error>
160
+ {
161
+ std::size_t operator ()(
162
+ ::clang::mrdox::Error const & err) const noexcept
163
+ {
164
+ return std::hash<std::string_view>()(err.message ());
165
+ }
166
+ };
167
+
150
168
// ------------------------------------------------
151
169
152
170
template <>
Original file line number Diff line number Diff line change 13
13
14
14
#include < mrdox/Platform.hpp>
15
15
#include < mrdox/Support/any_callable.hpp>
16
+ #include < mrdox/Support/Error.hpp>
16
17
#include < mrdox/Support/ThreadPool.hpp>
17
18
#include < deque>
18
19
#include < memory>
@@ -53,11 +54,17 @@ class MRDOX_DECL
53
54
ExecutorGroupBase (ExecutorGroupBase&&) noexcept ;
54
55
55
56
/* * Block until all work has completed.
57
+
58
+ @return Zero or more errors which were
59
+ thrown from submitted work.
56
60
*/
57
- void
61
+ [[nodiscard]]
62
+ std::vector<Error>
58
63
wait () noexcept ;
59
64
};
60
65
66
+ // ------------------------------------------------
67
+
61
68
/* * A set of execution agents for performing concurrent work.
62
69
*/
63
70
template <class Agent >
Original file line number Diff line number Diff line change @@ -80,6 +80,14 @@ reportError(
80
80
err.message ()));
81
81
}
82
82
83
+ template <class Range >
84
+ void
85
+ reportErrors (Range const & errors)
86
+ {
87
+ for (auto const & err : errors)
88
+ reportError (err.message ());
89
+ }
90
+
83
91
/* * Report a warning to the console.
84
92
85
93
@param text The message contents. A newline
You can’t perform that action at this time.
0 commit comments