Skip to content

Commit b81ac4a

Browse files
committed
chore: Refactor error handling and reporting
1 parent f3a848e commit b81ac4a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+1128
-1404
lines changed

CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ if (WIN32)
143143
-D_WIN32_WINNT=0x0601
144144
-D_CRT_SECURE_NO_WARNINGS
145145
-D_SILENCE_CXX20_CISO646_REMOVED_WARNING
146+
-DFMT_HEADER_ONLY # because of _ITERATOR_DEBUG_LEVEL
146147
)
147148
get_target_property(LLVM_CONFIGURATION_TYPE LLVMCore IMPORTED_CONFIGURATIONS)
148149
if (LLVM_CONFIGURATION_TYPE STREQUAL RELWITHDEBINFO)

include/mrdox/ADT/AnyList.hpp

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include <cstdint>
1919
#include <iterator>
2020
#include <memory>
21+
#include <type_traits>
2122
#include <typeinfo>
2223
#include <utility>
2324

include/mrdox/Config.hpp

-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
#define MRDOX_API_CONFIG_HPP
1414

1515
#include <mrdox/Platform.hpp>
16-
#include <mrdox/Reporter.hpp>
1716
#include <functional>
1817
#include <memory>
1918
#include <string_view>

include/mrdox/Corpus.hpp

+2-8
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,8 @@
1515
#include <mrdox/Platform.hpp>
1616
#include <mrdox/Config.hpp>
1717
#include <mrdox/MetadataFwd.hpp>
18-
#include <mrdox/Reporter.hpp>
1918
#include <mrdox/Metadata/Symbols.hpp>
2019
#include <clang/Tooling/Execution.h>
21-
#include <llvm/Support/Mutex.h>
2220
#include <cassert>
2321
#include <memory>
2422
#include <string>
@@ -134,18 +132,14 @@ class MRDOX_VISIBLE
134132
/** Build metadata for a set of translation units.
135133
136134
@param config A shared pointer to the configuration.
137-
138-
@param R The diagnostic reporting object to
139-
use for delivering errors and information.
140135
*/
141136
MRDOX_DECL
142137
[[nodiscard]]
143138
static
144-
llvm::Expected<std::unique_ptr<Corpus>>
139+
Expected<std::unique_ptr<Corpus>>
145140
build(
146141
tooling::ToolExecutor& ex,
147-
std::shared_ptr<Config const> config,
148-
Reporter& R);
142+
std::shared_ptr<Config const> config);
149143

150144
// KRYSTIAN NOTE: temporary
151145
MRDOX_DECL

include/mrdox/Error.hpp

-158
This file was deleted.

include/mrdox/Generator.hpp

+9-22
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#include <mrdox/Platform.hpp>
1919
#include <mrdox/Config.hpp>
2020
#include <mrdox/Corpus.hpp>
21-
#include <mrdox/Reporter.hpp>
21+
#include <mrdox/Support/Error.hpp>
2222
#include <ostream>
2323
#include <string>
2424
#include <string_view>
@@ -91,17 +91,13 @@ class MRDOX_VISIBLE
9191
the object before returning.
9292
9393
@param config The configuration to use.
94-
95-
@param R The diagnostic reporting object to
96-
use for delivering errors and information.
9794
*/
9895
MRDOX_DECL
9996
virtual
100-
Err
97+
Error
10198
build(
10299
std::string_view outputPath,
103-
Corpus const& corpus,
104-
Reporter& R) const;
100+
Corpus const& corpus) const;
105101

106102
/** Build reference documentation for the corpus.
107103
@@ -118,16 +114,13 @@ class MRDOX_VISIBLE
118114
@param os The stream to write to.
119115
120116
@param corpus The metadata to emit.
121-
122-
@param R The diagnostic reporting object to use.
123117
*/
124118
MRDOX_DECL
125119
virtual
126-
Err
120+
Error
127121
buildOne(
128122
std::ostream& os,
129-
Corpus const& corpus,
130-
Reporter& R) const = 0;
123+
Corpus const& corpus) const = 0;
131124

132125
/** Build the reference as a single page to a file.
133126
@@ -141,15 +134,12 @@ class MRDOX_VISIBLE
141134
file already exists, it will be overwritten.
142135
143136
@param corpus The metadata to emit.
144-
145-
@param R The diagnostic reporting object to use.
146137
*/
147138
MRDOX_DECL
148-
Err
139+
Error
149140
buildOne(
150141
std::string_view fileName,
151-
Corpus const& corpus,
152-
Reporter& R) const;
142+
Corpus const& corpus) const;
153143

154144
/** Build the reference as a single page to a string.
155145
@@ -160,15 +150,12 @@ class MRDOX_VISIBLE
160150
not be accessed by any other threads.
161151
162152
@param corpus The metadata to emit.
163-
164-
@param R The diagnostic reporting object to use.
165153
*/
166154
MRDOX_DECL
167-
Err
155+
Error
168156
buildOneString(
169157
std::string& dest,
170-
Corpus const& corpus,
171-
Reporter& R) const;
158+
Corpus const& corpus) const;
172159
};
173160

174161
} // mrdox

0 commit comments

Comments
 (0)