Skip to content

Commit

Permalink
chore: Refactor error handling and reporting
Browse files Browse the repository at this point in the history
  • Loading branch information
vinniefalco committed Jun 4, 2023
1 parent f3a848e commit b81ac4a
Show file tree
Hide file tree
Showing 54 changed files with 1,128 additions and 1,404 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ if (WIN32)
-D_WIN32_WINNT=0x0601
-D_CRT_SECURE_NO_WARNINGS
-D_SILENCE_CXX20_CISO646_REMOVED_WARNING
-DFMT_HEADER_ONLY # because of _ITERATOR_DEBUG_LEVEL
)
get_target_property(LLVM_CONFIGURATION_TYPE LLVMCore IMPORTED_CONFIGURATIONS)
if (LLVM_CONFIGURATION_TYPE STREQUAL RELWITHDEBINFO)
Expand Down
1 change: 1 addition & 0 deletions include/mrdox/ADT/AnyList.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include <cstdint>
#include <iterator>
#include <memory>
#include <type_traits>
#include <typeinfo>
#include <utility>

Expand Down
1 change: 0 additions & 1 deletion include/mrdox/Config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#define MRDOX_API_CONFIG_HPP

#include <mrdox/Platform.hpp>
#include <mrdox/Reporter.hpp>
#include <functional>
#include <memory>
#include <string_view>
Expand Down
10 changes: 2 additions & 8 deletions include/mrdox/Corpus.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,8 @@
#include <mrdox/Platform.hpp>
#include <mrdox/Config.hpp>
#include <mrdox/MetadataFwd.hpp>
#include <mrdox/Reporter.hpp>
#include <mrdox/Metadata/Symbols.hpp>
#include <clang/Tooling/Execution.h>
#include <llvm/Support/Mutex.h>
#include <cassert>
#include <memory>
#include <string>
Expand Down Expand Up @@ -134,18 +132,14 @@ class MRDOX_VISIBLE
/** Build metadata for a set of translation units.
@param config A shared pointer to the configuration.
@param R The diagnostic reporting object to
use for delivering errors and information.
*/
MRDOX_DECL
[[nodiscard]]
static
llvm::Expected<std::unique_ptr<Corpus>>
Expected<std::unique_ptr<Corpus>>
build(
tooling::ToolExecutor& ex,
std::shared_ptr<Config const> config,
Reporter& R);
std::shared_ptr<Config const> config);

// KRYSTIAN NOTE: temporary
MRDOX_DECL
Expand Down
158 changes: 0 additions & 158 deletions include/mrdox/Error.hpp

This file was deleted.

31 changes: 9 additions & 22 deletions include/mrdox/Generator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include <mrdox/Platform.hpp>
#include <mrdox/Config.hpp>
#include <mrdox/Corpus.hpp>
#include <mrdox/Reporter.hpp>
#include <mrdox/Support/Error.hpp>
#include <ostream>
#include <string>
#include <string_view>
Expand Down Expand Up @@ -91,17 +91,13 @@ class MRDOX_VISIBLE
the object before returning.
@param config The configuration to use.
@param R The diagnostic reporting object to
use for delivering errors and information.
*/
MRDOX_DECL
virtual
Err
Error
build(
std::string_view outputPath,
Corpus const& corpus,
Reporter& R) const;
Corpus const& corpus) const;

/** Build reference documentation for the corpus.
Expand All @@ -118,16 +114,13 @@ class MRDOX_VISIBLE
@param os The stream to write to.
@param corpus The metadata to emit.
@param R The diagnostic reporting object to use.
*/
MRDOX_DECL
virtual
Err
Error
buildOne(
std::ostream& os,
Corpus const& corpus,
Reporter& R) const = 0;
Corpus const& corpus) const = 0;

/** Build the reference as a single page to a file.
Expand All @@ -141,15 +134,12 @@ class MRDOX_VISIBLE
file already exists, it will be overwritten.
@param corpus The metadata to emit.
@param R The diagnostic reporting object to use.
*/
MRDOX_DECL
Err
Error
buildOne(
std::string_view fileName,
Corpus const& corpus,
Reporter& R) const;
Corpus const& corpus) const;

/** Build the reference as a single page to a string.
Expand All @@ -160,15 +150,12 @@ class MRDOX_VISIBLE
not be accessed by any other threads.
@param corpus The metadata to emit.
@param R The diagnostic reporting object to use.
*/
MRDOX_DECL
Err
Error
buildOneString(
std::string& dest,
Corpus const& corpus,
Reporter& R) const;
Corpus const& corpus) const;
};

} // mrdox
Expand Down
Loading

0 comments on commit b81ac4a

Please sign in to comment.