diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ff14fa77b..250a62235 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,7 +40,7 @@ jobs: apple-clang * standards: '20' latest-factors: | - msvc Optimized-Debug + msvc Optimized-Debug Shared gcc Coverage factors: '' runs-on: | @@ -388,6 +388,7 @@ jobs: package-dir: packages package-generators: ${{ matrix.mrdocs-package-generators }} package-artifact: false + shared: ${{ matrix.shared }} - name: Check YAML schema run: | diff --git a/CMakeLists.txt b/CMakeLists.txt index 41b0d2216..27b367dde 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -300,11 +300,11 @@ if (WIN32) target_compile_options( mrdocs-core PUBLIC - /permissive- # strict C++ - /W4 # enable all warnings - /MP # multi-processor compilation - /EHs # C++ Exception handling - $<$:/Oy-> # Disable frame pointer omission + /permissive- # strict C++ + /W4 # enable all warnings + $<$:/MP> # multi-processor compilation + /EHs # C++ Exception handling + $<$:/Oy-> # Disable frame pointer omission ) endif() endif () @@ -334,7 +334,6 @@ list(APPEND TOOL_SOURCES ${CMAKE_CURRENT_BINARY_DIR}/src/tool/PublicToolArgs.cpp) add_executable(mrdocs ${TOOL_SOURCES}) -target_compile_definitions(mrdocs PRIVATE -DMRDOCS_TOOL) target_include_directories(mrdocs PUBLIC @@ -346,7 +345,6 @@ target_include_directories(mrdocs "${PROJECT_BINARY_DIR}/src" ) -target_compile_definitions(mrdocs PRIVATE -DMRDOCS_TOOL) target_link_libraries(mrdocs PUBLIC mrdocs-core) if (MRDOCS_CLANG) target_compile_options( @@ -537,9 +535,14 @@ if (MRDOCS_INSTALL) #------------------------------------------------- install(TARGETS mrdocs-core EXPORT mrdocs-targets + RUNTIME_DEPENDENCIES + PRE_EXCLUDE_REGEXES "^api-ms-.*\\.dll$" "^ext-ms-.*\\.dll$" + POST_EXCLUDE_REGEXES ".*system32/.*\\.dll$" LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} - COMPONENT development + COMPONENT development + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + FRAMEWORK DESTINATION ${CMAKE_INSTALL_LIBDIR} ) install(EXPORT mrdocs-targets diff --git a/include/mrdocs/Config.hpp b/include/mrdocs/Config.hpp index 221c0b45f..de1b56e49 100644 --- a/include/mrdocs/Config.hpp +++ b/include/mrdocs/Config.hpp @@ -60,7 +60,7 @@ class MRDOCS_DECL public: /** Settings values used to generate the Corpus and Docs */ - struct Settings : public PublicSettings + struct MRDOCS_DECL Settings : public PublicSettings { /** * @brief Loads the public configuration settings from the specified YAML file. @@ -157,13 +157,11 @@ class MRDOCS_DECL /** Destructor. */ - MRDOCS_DECL virtual ~Config() noexcept = 0; /** Return a pool of threads for executing work. */ - MRDOCS_DECL virtual ThreadPool& threadPool() const noexcept = 0; diff --git a/include/mrdocs/Dom/Array.hpp b/include/mrdocs/Dom/Array.hpp index 4b3ab1934..01c0ff93c 100644 --- a/include/mrdocs/Dom/Array.hpp +++ b/include/mrdocs/Dom/Array.hpp @@ -269,18 +269,21 @@ class MRDOCS_DECL /** Compare two arrays for equality. */ friend + MRDOCS_DECL bool operator==(Array const&, Array const&) noexcept; /** Compare two arrays for precedence. */ friend + MRDOCS_DECL std::strong_ordering operator<=>(Array const&, Array const&) noexcept; /** Return a diagnostic string. */ friend + MRDOCS_DECL std::string toString(Array const&); @@ -364,6 +367,13 @@ class MRDOCS_DECL DefaultArrayImpl(); explicit DefaultArrayImpl( storage_type elements) noexcept; + + DefaultArrayImpl(const DefaultArrayImpl&); + DefaultArrayImpl(DefaultArrayImpl&&); + DefaultArrayImpl& operator=(const DefaultArrayImpl&); + DefaultArrayImpl& operator=(DefaultArrayImpl&&); + ~DefaultArrayImpl(); + size_type size() const override; value_type get(size_type i) const override; void set(size_type i, Value v) override; diff --git a/include/mrdocs/Dom/Object.hpp b/include/mrdocs/Dom/Object.hpp index 2d8bc818f..25dbb0d3c 100644 --- a/include/mrdocs/Dom/Object.hpp +++ b/include/mrdocs/Dom/Object.hpp @@ -298,6 +298,7 @@ class MRDOCS_DECL /** Compare two objects for equality. */ friend + MRDOCS_DECL bool operator==(Object const& a, Object const& b) noexcept; @@ -318,7 +319,7 @@ class MRDOCS_DECL /** Return a diagnostic string. */ - friend std::string toString(Object const&); + friend MRDOCS_DECL std::string toString(Object const&); }; //------------------------------------------------ @@ -402,6 +403,11 @@ class MRDOCS_DECL { public: DefaultObjectImpl() noexcept; + DefaultObjectImpl(const DefaultObjectImpl&); + DefaultObjectImpl(DefaultObjectImpl&&); + DefaultObjectImpl& operator=(const DefaultObjectImpl&); + DefaultObjectImpl& operator=(DefaultObjectImpl&&); + ~DefaultObjectImpl(); explicit DefaultObjectImpl( storage_type entries) noexcept; diff --git a/include/mrdocs/Dom/Value.hpp b/include/mrdocs/Dom/Value.hpp index e05686c91..c9f0ba51b 100644 --- a/include/mrdocs/Dom/Value.hpp +++ b/include/mrdocs/Dom/Value.hpp @@ -46,9 +46,11 @@ namespace mrdocs { @see https://handlebarsjs.com/api-reference/utilities.html#handlebars-safestring-string */ +MRDOCS_DECL dom::Value safeString(std::string_view str); +MRDOCS_DECL dom::Value safeString(dom::Value const& str); @@ -415,6 +417,7 @@ class MRDOCS_DECL operator, which does not perform type conversions. */ friend + MRDOCS_DECL bool operator==( Value const& lhs, @@ -423,6 +426,7 @@ class MRDOCS_DECL /** Compare two values for inequality. */ friend + MRDOCS_DECL std::strong_ordering operator<=>( Value const& lhs, @@ -453,6 +457,7 @@ class MRDOCS_DECL /** Add or concatenate two values. */ friend + MRDOCS_DECL dom::Value operator+(Value const& lhs, Value const& rhs); @@ -477,6 +482,7 @@ class MRDOCS_DECL This function is equivalent to the JavaScript `||` operator. */ friend + MRDOCS_DECL dom::Value operator||(Value const& lhs, Value const& rhs); @@ -501,6 +507,7 @@ class MRDOCS_DECL This function is equivalent to the JavaScript `&&` operator. */ friend + MRDOCS_DECL dom::Value operator&&(Value const& lhs, Value const& rhs); @@ -523,6 +530,7 @@ class MRDOCS_DECL /** Return value as a string. */ friend + MRDOCS_DECL std::string toString(Value const& value); }; diff --git a/include/mrdocs/Metadata/Info.hpp b/include/mrdocs/Metadata/Info.hpp index 69b09de30..b88390b7f 100644 --- a/include/mrdocs/Metadata/Info.hpp +++ b/include/mrdocs/Metadata/Info.hpp @@ -61,7 +61,7 @@ tag_invoke( /** Base class with common properties of all symbols */ -struct MRDOCS_VISIBLE Info +struct MRDOCS_DECL Info : SourceInfo { /** The unique identifier for this symbol. diff --git a/include/mrdocs/Metadata/Javadoc.hpp b/include/mrdocs/Metadata/Javadoc.hpp index 30def3ca1..158346419 100644 --- a/include/mrdocs/Metadata/Javadoc.hpp +++ b/include/mrdocs/Metadata/Javadoc.hpp @@ -375,6 +375,13 @@ struct MRDOCS_DECL { std::vector> children; + Block(Block&&); + Block(const Block&); + ~Block(); + + Block &operator=(Block&&); + Block &operator=(const Block&); + bool isBlock() const noexcept final { return true; @@ -979,7 +986,6 @@ struct MRDOCS_DECL /** Constructor. */ - MRDOCS_DECL Javadoc() noexcept; /** Constructor @@ -988,6 +994,11 @@ struct MRDOCS_DECL Javadoc( std::vector> blocks); + Javadoc(const Javadoc&); + Javadoc(Javadoc&&); + Javadoc& operator=(const Javadoc&); + Javadoc& operator=(Javadoc&&); + /** Return true if this is empty */ bool diff --git a/include/mrdocs/Platform.hpp b/include/mrdocs/Platform.hpp index ea07c8af9..87515e608 100644 --- a/include/mrdocs/Platform.hpp +++ b/include/mrdocs/Platform.hpp @@ -11,7 +11,6 @@ #ifndef MRDOCS_API_PLATFORM_HPP #define MRDOCS_API_PLATFORM_HPP -#include #include #if __cplusplus < 202002L @@ -79,4 +78,6 @@ namespace mrdocs { } // mrdocs } // clang +#include + #endif diff --git a/include/mrdocs/Support/Assert.hpp b/include/mrdocs/Support/Assert.hpp index 5cd895fe7..4bc433daa 100644 --- a/include/mrdocs/Support/Assert.hpp +++ b/include/mrdocs/Support/Assert.hpp @@ -11,6 +11,7 @@ #ifndef MRDOCS_API_SUPPORT_ASSERT_HPP #define MRDOCS_API_SUPPORT_ASSERT_HPP +#include #include namespace clang { @@ -30,6 +31,7 @@ namespace mrdocs { #define MRDOCS_UNREACHABLE() static_cast(__debugbreak(), __assume(false)) #endif + MRDOCS_DECL void assert_failed( char const* msg, diff --git a/include/mrdocs/Support/Glob.hpp b/include/mrdocs/Support/Glob.hpp index a65d127fd..1de1b086c 100644 --- a/include/mrdocs/Support/Glob.hpp +++ b/include/mrdocs/Support/Glob.hpp @@ -31,7 +31,7 @@ namespace clang::mrdocs { Nested brace expansions "{,"{,...}",...}" are not supported. */ -class GlobPattern { +class MRDOCS_DECL GlobPattern { struct Impl; std::unique_ptr impl_; public: @@ -120,7 +120,7 @@ class GlobPattern { A glob pattern matcher where "*" does not match path separators. The pattern "**" can be used to match any number of path separators. */ -class PathGlobPattern { +class MRDOCS_DECL PathGlobPattern { GlobPattern glob_; public: /** Constructs a PathGlobPattern with the given pattern. @@ -224,7 +224,7 @@ class PathGlobPattern { A glob pattern matcher where "*" does not match "::". The pattern "**" can be used to match any number of "::". */ -class SymbolGlobPattern { +class MRDOCS_DECL SymbolGlobPattern { GlobPattern glob_; public: /** Constructs a SymbolGlobPattern with the given pattern. diff --git a/include/mrdocs/Support/Handlebars.hpp b/include/mrdocs/Support/Handlebars.hpp index de48808a5..ab518a2ac 100644 --- a/include/mrdocs/Support/Handlebars.hpp +++ b/include/mrdocs/Support/Handlebars.hpp @@ -633,7 +633,7 @@ namespace detail { @see https://handlebarsjs.com/ */ -class Handlebars { +class MRDOCS_DECL Handlebars { using helpers_map = std::unordered_map< std::string, dom::Function, detail::string_hash, std::equal_to<>>; diff --git a/include/mrdocs/Support/JavaScript.hpp b/include/mrdocs/Support/JavaScript.hpp index 27d6ae6e6..1bebd6063 100644 --- a/include/mrdocs/Support/JavaScript.hpp +++ b/include/mrdocs/Support/JavaScript.hpp @@ -414,7 +414,7 @@ class MRDOCS_DECL Value via @ref Scope::reset. */ - MRDOCS_DECL ~Value(); + ~Value(); /** Constructor @@ -424,7 +424,7 @@ class MRDOCS_DECL Value The value is undefined. */ - MRDOCS_DECL Value() noexcept; + Value() noexcept; /** Constructor @@ -432,28 +432,28 @@ class MRDOCS_DECL Value value to the stack and associates the new value the top of the stack. */ - MRDOCS_DECL Value(Value const&); + Value(Value const&); /** Constructor The function associates the existing value with this object. */ - MRDOCS_DECL Value(Value&&) noexcept; + Value(Value&&) noexcept; /** Copy assignment. @copydetails Value(Value const&) */ - MRDOCS_DECL Value& operator=(Value const&); + Value& operator=(Value const&); /** Move assignment. @copydetails Value(Value&&) */ - MRDOCS_DECL Value& operator=(Value&&) noexcept; + Value& operator=(Value&&) noexcept; /** Return the type of the value. @@ -476,7 +476,7 @@ class MRDOCS_DECL Value internal ECMAScript class `Function`. */ - MRDOCS_DECL Type type() const noexcept; + Type type() const noexcept; /// Check if the value is undefined. bool @@ -706,7 +706,6 @@ class MRDOCS_DECL Value /** Set or replace the value for a given key. */ - MRDOCS_DECL void set( std::string_view key, @@ -714,7 +713,6 @@ class MRDOCS_DECL Value /** Set or replace the value for a given key. */ - MRDOCS_DECL void set( std::string_view key, @@ -821,6 +819,7 @@ class MRDOCS_DECL Value operator, which does not perform type conversions. */ friend + MRDOCS_DECL bool operator==( Value const& lhs, @@ -870,6 +869,7 @@ class MRDOCS_DECL Value /** Compare two values for inequality. */ friend + MRDOCS_DECL std::strong_ordering operator<=>( Value const& lhs, @@ -880,6 +880,7 @@ class MRDOCS_DECL Value This function is equivalent to the JavaScript `||` operator. */ friend + MRDOCS_DECL Value operator||(Value const& lhs, Value const& rhs); @@ -904,6 +905,7 @@ class MRDOCS_DECL Value This function is equivalent to the JavaScript `&&` operator. */ friend + MRDOCS_DECL Value operator&&(Value const& lhs, Value const& rhs); @@ -928,20 +930,18 @@ class MRDOCS_DECL Value This function coerces any value to a string. */ friend + MRDOCS_DECL std::string toString(Value const& value); private: - MRDOCS_DECL Expected callImpl( std::initializer_list args) const; - MRDOCS_DECL Expected callImpl(std::span args) const; - MRDOCS_DECL Expected callPropImpl( std::string_view prop, diff --git a/include/mrdocs/Support/ThreadPool.hpp b/include/mrdocs/Support/ThreadPool.hpp index 31b5c3f44..8dcff7c19 100644 --- a/include/mrdocs/Support/ThreadPool.hpp +++ b/include/mrdocs/Support/ThreadPool.hpp @@ -149,8 +149,8 @@ class MRDOCS_VISIBLE @return Zero or more errors which were thrown from submitted work. */ - MRDOCS_DECL [[nodiscard]] + MRDOCS_DECL std::vector wait(); diff --git a/src/lib/Dom/Array.cpp b/src/lib/Dom/Array.cpp index c2df24665..8f1503e27 100644 --- a/src/lib/Dom/Array.cpp +++ b/src/lib/Dom/Array.cpp @@ -164,6 +164,23 @@ emplace_back( DefaultArrayImpl:: DefaultArrayImpl() = default; +DefaultArrayImpl:: +DefaultArrayImpl(const DefaultArrayImpl&) = default; + +DefaultArrayImpl:: +DefaultArrayImpl(DefaultArrayImpl&&) = default; + +DefaultArrayImpl& +DefaultArrayImpl:: +operator=(const DefaultArrayImpl&) = default; + +DefaultArrayImpl& +DefaultArrayImpl:: +operator=(DefaultArrayImpl&&) = default; + +DefaultArrayImpl:: +~DefaultArrayImpl() = default; + DefaultArrayImpl:: DefaultArrayImpl( storage_type elements) noexcept diff --git a/src/lib/Dom/Object.cpp b/src/lib/Dom/Object.cpp index a3b046e10..3d51b9a60 100644 --- a/src/lib/Dom/Object.cpp +++ b/src/lib/Dom/Object.cpp @@ -139,6 +139,23 @@ DefaultObjectImpl( { } +DefaultObjectImpl:: +DefaultObjectImpl(const DefaultObjectImpl&) = default; + +DefaultObjectImpl:: +DefaultObjectImpl(DefaultObjectImpl&&) = default; + +DefaultObjectImpl& +DefaultObjectImpl:: +operator=(const DefaultObjectImpl&) = default; + +DefaultObjectImpl& +DefaultObjectImpl:: +operator=(DefaultObjectImpl&&) = default; + +DefaultObjectImpl:: +~DefaultObjectImpl() = default; + std::size_t DefaultObjectImpl:: size() const diff --git a/src/lib/Gen/hbs/HandlebarsGenerator.hpp b/src/lib/Gen/hbs/HandlebarsGenerator.hpp index 175c73bba..b3a7ee5eb 100644 --- a/src/lib/Gen/hbs/HandlebarsGenerator.hpp +++ b/src/lib/Gen/hbs/HandlebarsGenerator.hpp @@ -41,6 +41,7 @@ class HandlebarsGenerator /** Build a tagfile for the corpus. */ + MRDOCS_DECL Expected buildTagfile( std::ostream& os, diff --git a/src/lib/Lib/CMakeExecution.hpp b/src/lib/Lib/CMakeExecution.hpp index c96334ba3..81a8bf4f3 100644 --- a/src/lib/Lib/CMakeExecution.hpp +++ b/src/lib/Lib/CMakeExecution.hpp @@ -31,6 +31,7 @@ namespace mrdocs { * @return An `Expected` object containing the path to the generated `compile_commands.json` file if successful. * Returns `Unexpected` if the project path is not found or if CMake execution fails. */ +MRDOCS_DECL Expected executeCmakeExportCompileCommands(llvm::StringRef projectPath, llvm::StringRef cmakeArgs, llvm::StringRef tempDir); diff --git a/src/lib/Lib/ConfigImpl.hpp b/src/lib/Lib/ConfigImpl.hpp index 9e066b50a..c24c5f1dc 100644 --- a/src/lib/Lib/ConfigImpl.hpp +++ b/src/lib/Lib/ConfigImpl.hpp @@ -96,6 +96,7 @@ class ConfigImpl @param threadPool The thread pool to use. */ + MRDOCS_DECL static Expected> load( diff --git a/src/lib/Lib/CorpusImpl.hpp b/src/lib/Lib/CorpusImpl.hpp index 43e26c6fe..40c7ca7ef 100644 --- a/src/lib/Lib/CorpusImpl.hpp +++ b/src/lib/Lib/CorpusImpl.hpp @@ -38,6 +38,7 @@ namespace clang::mrdocs { */ class CorpusImpl : public Corpus { + MRDOCS_DECL friend void finalize(CorpusImpl& corpus); @@ -85,8 +86,8 @@ class CorpusImpl : public Corpus @param config A shared pointer to the configuration. @param compilations A compilations database for the input files. */ - // MRDOCS_DECL [[nodiscard]] + MRDOCS_DECL static mrdocs::Expected> build( diff --git a/src/lib/Lib/MrDocsCompilationDatabase.hpp b/src/lib/Lib/MrDocsCompilationDatabase.hpp index 490955ad2..c21413bfd 100644 --- a/src/lib/Lib/MrDocsCompilationDatabase.hpp +++ b/src/lib/Lib/MrDocsCompilationDatabase.hpp @@ -33,7 +33,7 @@ namespace mrdocs { - Warnings are disabled */ -class MrDocsCompilationDatabase +class MRDOCS_DECL MrDocsCompilationDatabase : public tooling::CompilationDatabase { std::vector AllCommands_; diff --git a/src/lib/Metadata/Javadoc.cpp b/src/lib/Metadata/Javadoc.cpp index cdd5a294d..452fd52ce 100644 --- a/src/lib/Metadata/Javadoc.cpp +++ b/src/lib/Metadata/Javadoc.cpp @@ -23,6 +23,22 @@ namespace mrdocs { namespace doc { +Block:: +Block(Block&&) = default; + +Block& +Block:: +operator=(Block&&) = default; + +Block::~Block() = default; + +Block:: +Block(const Block&) = default; + +Block& +Block:: +operator=(const Block&) = default; + Text& Block:: emplace_back( @@ -87,6 +103,20 @@ Javadoc( { } +Javadoc:: +Javadoc(Javadoc&&) = default; + +Javadoc:: +Javadoc(const Javadoc&) = default; + +Javadoc& +Javadoc:: +operator=(Javadoc&&) = default; + +Javadoc& +Javadoc:: +operator=(const Javadoc&) = default; + doc::Paragraph const* Javadoc:: getBrief(Corpus const& corpus) const noexcept diff --git a/src/lib/Support/Path.hpp b/src/lib/Support/Path.hpp index 9187c3b0d..729d8f2ff 100644 --- a/src/lib/Support/Path.hpp +++ b/src/lib/Support/Path.hpp @@ -35,6 +35,7 @@ using SmallPathString = llvm::SmallString<340>; On Unix, this function is a no-op because backslashes are valid path chracters. */ +MRDOCS_DECL llvm::StringRef convert_to_slash( llvm::SmallVectorImpl &path, @@ -43,7 +44,7 @@ convert_to_slash( /** A temporary file that is deleted when it goes out of scope. */ -class ScopedTempFile +class MRDOCS_DECL ScopedTempFile { clang::mrdocs::SmallPathString path_; bool ok_ = false; @@ -83,7 +84,7 @@ class ScopedTempFile /** A temporary directory that is deleted when it goes out of scope. */ -class ScopedTempDirectory +class MRDOCS_DECL ScopedTempDirectory { clang::mrdocs::SmallPathString path_; bool ok_ = false;