From e8dcdc590f8ec65807268b6cf0f7e776044bcb96 Mon Sep 17 00:00:00 2001 From: Alan de Freitas Date: Mon, 22 Sep 2025 22:14:44 -0500 Subject: [PATCH 01/23] feat(lib): optional nullable traits --- include/mrdocs/ADT/Nullable.hpp | 318 +++++++++++++++++ include/mrdocs/ADT/Optional.hpp | 335 ++++++++++++++---- include/mrdocs/Dom/Value.hpp | 16 + include/mrdocs/Metadata/Info.hpp | 2 +- include/mrdocs/Metadata/Source.hpp | 52 ++- src/lib/AST/ASTVisitor.cpp | 11 +- src/lib/Gen/adoc/AdocEscape.cpp | 1 + src/lib/Gen/hbs/TagfileWriter.cpp | 7 +- src/lib/Gen/xml/CXXTags.hpp | 4 +- .../Metadata/Finalizers/Javadoc/Function.hpp | 32 +- .../Metadata/Finalizers/JavadocFinalizer.cpp | 1 + src/lib/Metadata/Info/Function.cpp | 4 +- src/lib/Metadata/Source.cpp | 6 +- src/test/ADT/Nullable.cpp | 239 +++++++++++++ src/test/ADT/Optional.cpp | 233 ++++++++++++ src/test_suite/detail/decomposer.hpp | 2 +- src/test_suite/diff.cpp | 27 +- 17 files changed, 1167 insertions(+), 123 deletions(-) create mode 100644 include/mrdocs/ADT/Nullable.hpp create mode 100644 src/test/ADT/Nullable.cpp create mode 100644 src/test/ADT/Optional.cpp diff --git a/include/mrdocs/ADT/Nullable.hpp b/include/mrdocs/ADT/Nullable.hpp new file mode 100644 index 000000000..bca755b80 --- /dev/null +++ b/include/mrdocs/ADT/Nullable.hpp @@ -0,0 +1,318 @@ +// +// This is a derivative work. originally part of the LLVM Project. +// Licensed under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// Copyright (c) 2025 Alan de Freitas (alandefreitas@gmail.com) +// +// Official repository: https://github.com/cppalliance/mrdocs +// + +#ifndef MRDOCS_API_ADT_NULLABLE_HPP +#define MRDOCS_API_ADT_NULLABLE_HPP + +#include + +#include +#include +#include +#include +#include + +namespace clang::mrdocs { + +/** Defines a customization point for types that have an intrinsic sentinel + value denoting “null”. + + Users may specialize this trait for their own types to declare a + sentinel-based null representation. + + When enabled, nullable semantics can be implemented in terms of the + sentinel without storing a separate engaged/disengaged flag. + + Contract for specializations: + - Provide static constexpr T sentinel() noexcept; which returns the distinguished null value. + - Provide static constexpr bool is_sentinel(const T&) noexcept; which recognizes the null value. + + If a type does not have a well-defined sentinel, leave the primary template in effect. + + Notes + - Built-in pointer types and std::nullptr_t are pre-specialized to use nullptr as the sentinel. +**/ +template +struct sentinel_traits +{ + // No sentinel() or is_sentinel() in the primary template. +}; + +/** sentinel_traits specialization for raw pointers. + + Uses nullptr as the sentinel value. +**/ +template +struct sentinel_traits { + static constexpr T* + sentinel() noexcept + { + return nullptr; + } + + static constexpr bool + is_sentinel(T const* p) noexcept + { + return p == nullptr; + } +}; + +/** sentinel_traits specialization for std::nullptr_t. +**/ +template<> +struct sentinel_traits +{ + static constexpr std::nullptr_t + sentinel() noexcept + { + return nullptr; + } + + static constexpr bool + is_sentinel(std::nullptr_t) noexcept + { + return true; + } +}; + +// ----------------------------------------------------------------------------- +// Sentinel traits for numeric and enum types +// ----------------------------------------------------------------------------- + +/** sentinel_traits specialization for unsigned integral types. + + Uses the maximum representable value (~0u) as the sentinel, + which corresponds to -1 when converted. +**/ +template +struct sentinel_traits +{ + static constexpr T + sentinel() noexcept + { + return static_cast(-1); + } + + static constexpr bool + is_sentinel(T v) noexcept + { + return v == static_cast(-1); + } +}; + +/** sentinel_traits specialization for floating-point types. + + Uses a quiet NaN as the sentinel value. This assumes that T + supports NaN and that it is distinguishable from all ordinary values. +**/ +template +struct sentinel_traits +{ + static constexpr T + sentinel() noexcept + { + return std::numeric_limits::quiet_NaN(); + } + + static constexpr bool + is_sentinel(T v) noexcept + { + return std::isnan(v); + } +}; + +/** sentinel_traits specialization for enums with a well-known "null" enumerator. + + If the enum defines Unknown, UNKNOWN, None, or NONE, this trait uses + that enumerator as the sentinel. This requires that such an enumerator + exists and is accessible from the scope of T. +**/ +template +requires std::is_enum_v && + (requires { T::Unknown; } || + requires { T::UNKNOWN; } || + requires { T::None; } || + requires { T::NONE; }) +struct sentinel_traits +{ + static constexpr T + sentinel() noexcept + { + if constexpr (requires { T::Unknown; }) + return T::Unknown; + else if constexpr (requires { T::UNKNOWN; }) + return T::UNKNOWN; + else if constexpr (requires { T::None; }) + return T::None; + else + return T::NONE; + } + + static constexpr bool + is_sentinel(T v) noexcept + { + return v == sentinel(); + } +}; + +/** Concept that is satisfied when sentinel_traits declares a usable sentinel. +**/ +template +concept HasSentinel = + requires + { + { sentinel_traits::sentinel() } -> std::same_as; + { sentinel_traits::is_sentinel(std::declval()) } -> std::convertible_to; + }; + +/** Internal concept that matches “empty-clear default-constructible” types. + + This captures the common case of containers and data structures that + can be default-constructed to empty, tested with .empty(), and + reset with .clear(). + + Common cases of such containers include std::string, std::vector, + std::optional, std::unique_ptr, std::shared_ptr, and many more. +**/ +template +concept ClearableEmpty = + std::default_initializable && + requires(T& t, const T& ct) + { + { ct.empty() } -> std::convertible_to; + { t.clear() } -> std::same_as; + }; + +/** nullable_traits defines how to treat a T as “nullable” without an + external engaged bit. + + This trait is the canonical place to encode nullability semantics used + by any optional-like type. + + It exposes the minimal operations needed by an optional: + - is_null(const T&): test if a value is null. + - null(): create a null value. + - make_null(T&): turn an existing value into null. + + Users may explicitly specialize nullable_traits for their types to define + the desired semantics. +**/ +template +struct nullable_traits +{ + // No interface in the primary template. + // Provide a specialization to enable. +}; + +/** nullable_traits for types with a sentinel. + + Delegates null handling to sentinel_traits. +**/ +template +requires HasSentinel +struct nullable_traits +{ + static constexpr bool + is_null(T const& v) noexcept + { + return sentinel_traits::is_sentinel(v); + } + + static constexpr T + null() noexcept + { + return sentinel_traits::sentinel(); + } + + static constexpr void + make_null(T& v) noexcept + { + v = sentinel_traits::sentinel(); + } +}; + +/** nullable_traits for clearable empty types. + + Treats the empty state as null, creates null via default construction, + and erases via clear(). +**/ +template +requires (!HasSentinel && ClearableEmpty) +struct nullable_traits +{ + static constexpr bool + is_null(T const& v) noexcept(noexcept(v.empty())) + { + return v.empty(); + } + + static constexpr T + null() noexcept(std::is_nothrow_default_constructible_v) + { + return T(); + } + + static constexpr void + make_null(T& v) noexcept(noexcept(v.clear())) + { + v.clear(); + } +}; + +/** Utility function that returns true if T has a nullable_traits + specialization enabled. +**/ +template +concept has_nullable_traits_v = + requires + { + { nullable_traits::is_null(std::declval()) } -> std::convertible_to; + { nullable_traits::null() } -> std::same_as; + { nullable_traits::make_null(std::declval()) } -> std::same_as; + }; + +/** make_null helper that uses nullable_traits if available. + + @param v The value to make null. +**/ +template +inline void +make_null(T& v) noexcept(noexcept(nullable_traits::make_null(v))) +{ + nullable_traits::make_null(v); +} + +/** is_null helper that uses nullable_traits if available. + + @param v The value to test for null. + @return true if v is null, false otherwise. +**/ +template +inline bool +is_null(T const& v) noexcept(noexcept(nullable_traits::is_null(v))) +{ + return nullable_traits::is_null(v); +} + +/** null_of helper that constructs a null T using nullable_traits. + + @return A null T value. +**/ +template +inline T +null_of() noexcept(noexcept(nullable_traits::null())) +{ + return nullable_traits::null(); +} + +} // clang::mrdocs + +#endif diff --git a/include/mrdocs/ADT/Optional.hpp b/include/mrdocs/ADT/Optional.hpp index ddbc80602..a3e3205fb 100644 --- a/include/mrdocs/ADT/Optional.hpp +++ b/include/mrdocs/ADT/Optional.hpp @@ -5,6 +5,7 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // Copyright (c) 2023 Vinnie Falco (vinnie.falco@gmail.com) +// Copyright (c) 2023 Alan de Freitas (alandefreitas@gmail.com) // // Official repository: https://github.com/cppalliance/mrdocs // @@ -13,151 +14,331 @@ #define MRDOCS_API_ADT_OPTIONAL_HPP #include -#include +#include +#include #include #include -#include namespace clang::mrdocs { -/** The default empty predicate. +/** A compact optional that automatically uses nullable_traits when + available. - This predicate is true when t.empty() returns - `true` where `t` is a `T`. -*/ -struct DefaultEmptyPredicate -{ - template - constexpr - bool - operator()(T const& t) const noexcept + Design + - If nullable_traits exists, the null state is encoded inside T + (via sentinel or clearable-empty semantics). Storage is exactly one T. + - Otherwise, this falls back to std::optional and uses its discriminator. + + This single implementation uses a conditional storage type plus if constexpr + on has_nullable_traits_v to select the appropriate behavior at compile + time. +**/ +template +class Optional { + using storage_t = std::conditional_t< + has_nullable_traits_v, T, std::optional>; + + static constexpr bool uses_nullable_traits = has_nullable_traits_v; + + // --- noexcept helpers (avoid instantiating both branches) --- + static consteval bool default_ctor_noex_() { - return std::ranges::empty(t); + if constexpr (uses_nullable_traits) + return noexcept(nullable_traits::null()); + else + return noexcept(storage_t{}); // std::optional{} is noexcept } - template - constexpr - bool - operator()(T const& t) const noexcept + static consteval bool reset_noex_() { - return !t; + if constexpr (uses_nullable_traits) + return noexcept(nullable_traits::make_null(std::declval())); + else + return noexcept(std::declval&>().reset()); } -}; -/** A compact optional. + static consteval bool has_value_noex_() + { + if constexpr (uses_nullable_traits) + return noexcept(nullable_traits::is_null(std::declval())); + else + return noexcept(std::declval const&>().has_value()); + } - This works like std::optional except the - predicate is invoked to determine whether - the optional is engaged. This is a space - optimization. -*/ -template< - class T, - class EmptyPredicate = DefaultEmptyPredicate> -class Optional -{ - T t_; + storage_t s_; public: using value_type = T; - constexpr Optional() = default; - constexpr Optional(Optional const& other) = default; + /// Default-constructs to the “null” state. + constexpr Optional() noexcept(default_ctor_noex_()) + : s_([&] { + if constexpr (uses_nullable_traits) + { + return storage_t(nullable_traits::null()); + } else + { + return storage_t(std::nullopt); + } + }()) + {} - template - requires std::is_constructible_v - constexpr explicit - Optional(U&& u) - : t_(std::forward(u)) - { - } + /// Copy constructor + constexpr Optional(Optional const&) = default; + + /// Move constructor + constexpr Optional(Optional&&) = default; + + /// Copy assignment + constexpr Optional& + operator=(Optional const&) = default; + + /// Move assignment + constexpr Optional& + operator=(Optional&&) = default; - constexpr Optional& operator=(Optional const& other) = default; - constexpr Optional& operator=(Optional&& other) = default; + /** Construct from a value. + @param u The value to store. It must be convertible to T. + **/ template requires std::is_constructible_v - constexpr - Optional& operator=(U&& u) + constexpr explicit Optional(U&& u) noexcept( + std::is_nothrow_constructible_v) + : s_([&] { + if constexpr (uses_nullable_traits) + { + return storage_t(static_cast(std::forward(u))); + } + else + { + return storage_t(std::forward(u)); + } + }()) + {} + + /** Assign from a value. + + @param u The value to store. It must be convertible to T. + **/ + template + requires std::is_constructible_v && std::is_assignable_v + constexpr Optional& + operator=(U&& u) noexcept(std::is_nothrow_assignable_v) { - t_ = std::forward(u); + s_ = std::forward(u); return *this; } - constexpr - Optional& operator=(std::nullptr_t) + /// Assign null (disengage). + constexpr Optional& + operator=(std::nullptr_t) noexcept(reset_noex_()) { - t_ = T(); - MRDOCS_ASSERT(!this->operator bool()); + reset(); + MRDOCS_ASSERT(!has_value()); return *this; } - constexpr void reset() + /** Reset to the null state. **/ + constexpr void + reset() noexcept(reset_noex_()) { - *this = Optional(); - MRDOCS_ASSERT(!this->operator bool()); + if constexpr (uses_nullable_traits) + { + nullable_traits::make_null(s_); + } + else + { + s_.reset(); + } + MRDOCS_ASSERT(!has_value()); } - template + /** In-place construct a new value, replacing any existing one. + + @param args The arguments to forward to T's constructor. + + @return A reference to the newly constructed value. + **/ + template requires std::is_constructible_v - constexpr value_type& emplace(Args&&... args) + constexpr value_type& + emplace(Args&&... args) noexcept( + std::is_nothrow_constructible_v) { - return t_ = T(std::forward(args)...); + if constexpr (uses_nullable_traits) + { + s_ = T(std::forward(args)...); + return s_; + } + else + { + return s_.emplace(std::forward(args)...); + } } - constexpr value_type& value() & noexcept + /** True if engaged (contains a value). + + @return `true` if the optional contains a value. + **/ + constexpr bool + has_value() const noexcept(has_value_noex_()) { - return t_; + if constexpr (uses_nullable_traits) + { + return !nullable_traits::is_null(s_); + } + else + { + return s_.has_value(); + } } - constexpr value_type const& value() const & noexcept + /** Contextual bool. + **/ + constexpr explicit + operator bool() const noexcept(noexcept(this->has_value())) { - return t_; + return has_value(); } - constexpr value_type&& value() && noexcept + /** Value access. Preconditions: has_value() is true. + + @return A reference to the contained value. + **/ + constexpr value_type& + value() & noexcept { - return std::move(t_); + MRDOCS_ASSERT(has_value()); + if constexpr (uses_nullable_traits) + { + return s_; + } + else + { + return *s_; + } } - constexpr value_type const&& value() const && noexcept + /// @copydoc value() & + constexpr value_type const& + value() const& noexcept { - return std::move(t_); + MRDOCS_ASSERT(has_value()); + if constexpr (uses_nullable_traits) + { + return s_; + } + else + { + return *s_; + } } - constexpr value_type& operator*() noexcept + /// @copydoc value() & + constexpr value_type&& + value() && noexcept { - return t_; + MRDOCS_ASSERT(has_value()); + if constexpr (uses_nullable_traits) + { + return std::move(s_); + } + else + { + return std::move(*s_); + } } - constexpr value_type const& operator*() const noexcept + /// @copydoc value() & + constexpr value_type const&& + value() const&& noexcept { - return t_; + MRDOCS_ASSERT(has_value()); + if constexpr (uses_nullable_traits) + { + return std::move(s_); + } + else + { + return std::move(*s_); + } } - constexpr value_type* operator->() noexcept + /** Pointer-like access. + + @return A pointer to the contained value. + **/ + constexpr value_type* + operator->() noexcept { - return &t_; + MRDOCS_ASSERT(has_value()); + if constexpr (uses_nullable_traits) + { + return std::addressof(s_); + } + else + { + return std::addressof(*s_); + } } - constexpr value_type const* operator->() const noexcept + /// @copydoc operator->() noexcept + constexpr value_type const* + operator->() const noexcept { - return &t_; + MRDOCS_ASSERT(has_value()); + if constexpr (uses_nullable_traits) + { + return std::addressof(s_); + } + else + { + return std::addressof(*s_); + } } - constexpr explicit operator bool() const noexcept + /** Dereference-like access. + + @return A reference to the contained value. + **/ + constexpr value_type& + operator*() noexcept { - return has_value(); + MRDOCS_ASSERT(has_value()); + if constexpr (uses_nullable_traits) + { + return s_; + } + else + { + return *s_; + } } - constexpr bool has_value() const noexcept + /// @copydoc operator*() noexcept + constexpr value_type const& + operator*() const noexcept { - return ! EmptyPredicate()(t_); + MRDOCS_ASSERT(has_value()); + if constexpr (uses_nullable_traits) + { + return s_; + } + else + { + return *s_; + } } - auto operator<=>(Optional const&) const = default; + /** Three-way comparison defaults when supported by the underlying + T/std::optional. + **/ + auto + operator<=>(Optional const&) const + = default; }; -} // clang::mrdocs +} // namespace clang::mrdocs #endif diff --git a/include/mrdocs/Dom/Value.hpp b/include/mrdocs/Dom/Value.hpp index 0511f1bf7..c2c6a24e3 100644 --- a/include/mrdocs/Dom/Value.hpp +++ b/include/mrdocs/Dom/Value.hpp @@ -626,6 +626,22 @@ stringOrNull( return nullptr; } +/** Return a non-empty string, or a null. + + @param s The string to check. +*/ +inline +Value +stringOrNull( + Optional s) +{ + if(s.has_value()) + { + return {*s}; + } + return nullptr; +} + //------------------------------------------------ /** Customization point tag. diff --git a/include/mrdocs/Metadata/Info.hpp b/include/mrdocs/Metadata/Info.hpp index cbb129aea..de2100452 100644 --- a/include/mrdocs/Metadata/Info.hpp +++ b/include/mrdocs/Metadata/Info.hpp @@ -418,7 +418,7 @@ tag_invoke( } inline -OptionalLocation +Optional getPrimaryLocation(Info const& I) { return getPrimaryLocation( diff --git a/include/mrdocs/Metadata/Source.hpp b/include/mrdocs/Metadata/Source.hpp index 4c887b62c..737f2433e 100644 --- a/include/mrdocs/Metadata/Source.hpp +++ b/include/mrdocs/Metadata/Source.hpp @@ -94,18 +94,50 @@ tag_invoke( dom::Value& v, Location const& loc); -struct LocationEmptyPredicate +/** nullable_traits specialization for Location. + + Semantics + - The “null” (sentinel) state is any Location whose ShortPath is empty. + - Creating a null value produces a Location with all fields defaulted + and ShortPath empty. + - Making an existing value null clears ShortPath and resets the other + fields to their defaults. + + Rationale + - This mirrors the old LocationEmptyPredicate, which treated an empty + ShortPath as “empty/null.” +**/ +template<> +struct nullable_traits { - constexpr bool operator()( - Location const& loc) const noexcept + static constexpr bool + is_null(Location const& v) noexcept { - return loc.ShortPath.empty(); + return v.ShortPath.empty(); } -}; -/** Like std::optional -*/ -using OptionalLocation = Optional; + static constexpr Location + null() noexcept + { + return Location{ + /*full_path*/ {}, + /*short_path*/ {}, + /*source_path*/ {}, + /*line*/ 0u, + /*documented*/ false + }; + } + + static constexpr void + make_null(Location& v) noexcept + { + v.FullPath.clear(); + v.ShortPath.clear(); // sentinel condition + v.SourcePath.clear(); + v.LineNumber = 0; + v.Documented = false; + } +}; /** Stores source information for a declaration. */ @@ -119,7 +151,7 @@ struct MRDOCS_DECL actually a definition (e.g. alias-declarations and typedef declarations are never definition). */ - OptionalLocation DefLoc; + Optional DefLoc; /** Locations where the entity was declared. @@ -154,7 +186,7 @@ void merge(SourceInfo& I, SourceInfo&& Other); MRDOCS_DECL -OptionalLocation +Optional getPrimaryLocation(SourceInfo const& I, bool preferDefinition); void diff --git a/src/lib/AST/ASTVisitor.cpp b/src/lib/AST/ASTVisitor.cpp index a33826061..b014400bf 100644 --- a/src/lib/AST/ASTVisitor.cpp +++ b/src/lib/AST/ASTVisitor.cpp @@ -883,11 +883,14 @@ populate( if (!param.Default && default_arg) { param.Default = getSourceCode(default_arg->getSourceRange()); - param.Default = trim(*param.Default); - if (param.Default->starts_with("= ")) + if (param.Default) { - param.Default->erase(0, 2); - param.Default = ltrim(*param.Default); + param.Default = trim(*param.Default); + if (param.Default->starts_with("= ")) + { + param.Default->erase(0, 2); + param.Default = ltrim(*param.Default); + } } } } diff --git a/src/lib/Gen/adoc/AdocEscape.cpp b/src/lib/Gen/adoc/AdocEscape.cpp index ca00fe28d..0044d71eb 100644 --- a/src/lib/Gen/adoc/AdocEscape.cpp +++ b/src/lib/Gen/adoc/AdocEscape.cpp @@ -11,6 +11,7 @@ #include "AdocEscape.hpp" #include +#include namespace clang::mrdocs::adoc { diff --git a/src/lib/Gen/hbs/TagfileWriter.cpp b/src/lib/Gen/hbs/TagfileWriter.cpp index 7496de64c..cedb20d99 100644 --- a/src/lib/Gen/hbs/TagfileWriter.cpp +++ b/src/lib/Gen/hbs/TagfileWriter.cpp @@ -211,8 +211,11 @@ writeFunctionMember(FunctionInfo const& I) for(auto const& J : I.Params) { arglist += toString(*J.Type); - arglist += " "; - arglist += *J.Name; + if (J.Name) + { + arglist += " "; + arglist += *J.Name; + } arglist += ", "; } if (arglist.size() > 2) { diff --git a/src/lib/Gen/xml/CXXTags.hpp b/src/lib/Gen/xml/CXXTags.hpp index a9d74a7d0..c09e42f7a 100644 --- a/src/lib/Gen/xml/CXXTags.hpp +++ b/src/lib/Gen/xml/CXXTags.hpp @@ -260,8 +260,8 @@ inline void writeReturnType(TypeInfo const& I, XMLTags& tags) inline void writeParam(Param const& P, XMLTags& tags) { tags.open(paramTagName, { - { "name", *P.Name, P.Name.has_value() }, - { "default", *P.Default, P.Default.has_value() }, + { "name", P.Name.has_value() ? *P.Name : "", P.Name.has_value() }, + { "default", P.Default.has_value() ? *P.Default : "", P.Default.has_value() }, }); writeType(*P.Type, tags); tags.close(paramTagName); diff --git a/src/lib/Metadata/Finalizers/Javadoc/Function.hpp b/src/lib/Metadata/Finalizers/Javadoc/Function.hpp index a8b0c3f24..353557e28 100644 --- a/src/lib/Metadata/Finalizers/Javadoc/Function.hpp +++ b/src/lib/Metadata/Finalizers/Javadoc/Function.hpp @@ -534,10 +534,13 @@ setCntrOrAssignParamName( I.Class == FunctionClass::Constructor || I.OverloadedOperator == OperatorKind::Equal, false); - auto paramNames = std::views:: - transform(I.Params, [](Param const& p) -> std::string_view { - return *p.Name; - }); + auto paramNames = + std::views::filter(I.Params, [](Param const& p) -> bool { + return p.Name.has_value(); + }) | + std::views::transform([](Param const& p) -> std::string_view { + return *p.Name; + }); auto& innerP = innermostType(param.Type); std::string_view paramName = "value"; if (innerP->namedSymbol() == I.Parent) @@ -557,8 +560,11 @@ setStreamOperatorParamName( { MRDOCS_CHECK_OR(index < 2, false); MRDOCS_CHECK_OR(isStreamInsertion(I), false); - auto paramNames = std::views:: - transform(I.Params, [](Param const& p) -> std::string_view { + auto paramNames = + std::views::filter(I.Params, [](Param const& p) -> bool { + return p.Name.has_value(); + }) | + std::views::transform([](Param const& p) -> std::string_view { return *p.Name; }); std::string_view paramName = @@ -579,8 +585,11 @@ setBinaryOpParamName( std::size_t const sizeFree = I.IsRecordMethod ? I.Params.size() + 1 : I.Params.size(); MRDOCS_CHECK_OR(sizeFree == 2, false); - auto const paramNames = std::views:: - transform(I.Params, [](Param const& p) -> std::string_view { + auto paramNames = + std::views::filter(I.Params, [](Param const& p) -> bool { + return p.Name.has_value(); + }) | + std::views::transform([](Param const& p) -> std::string_view { return *p.Name; }); std::size_t const indexFree = I.IsRecordMethod ? index + 1 : index; @@ -601,8 +610,11 @@ setUnaryOpParamName( MRDOCS_CHECK_OR(isUnaryOperator(I.OverloadedOperator), false); MRDOCS_CHECK_OR(I.Params.size() == 1, false); - auto const paramNames = std::views:: - transform(I.Params, [](Param const& p) -> std::string_view { + auto paramNames = + std::views::filter(I.Params, [](Param const& p) -> bool { + return p.Name.has_value(); + }) | + std::views::transform([](Param const& p) -> std::string_view { return *p.Name; }); std::string_view paramName = "value"; diff --git a/src/lib/Metadata/Finalizers/JavadocFinalizer.cpp b/src/lib/Metadata/Finalizers/JavadocFinalizer.cpp index 7230aaaec..4b7a16446 100644 --- a/src/lib/Metadata/Finalizers/JavadocFinalizer.cpp +++ b/src/lib/Metadata/Finalizers/JavadocFinalizer.cpp @@ -1760,6 +1760,7 @@ warnNoParamDocs(FunctionInfo const& I) auto javadocParamNames = getJavadocParamNames(*I.javadoc); auto paramNames = std::views::transform(I.Params, &Param::Name) | + std::views::filter([](Optional const& name) { return name.has_value(); }) | std::views::transform([](Optional const& name) -> std::string_view { return *name; }) | std::views::filter([](std::string_view const& name) { return !name.empty(); }); for (auto const& paramName: paramNames) diff --git a/src/lib/Metadata/Info/Function.cpp b/src/lib/Metadata/Info/Function.cpp index 702cd5082..12e6912a6 100644 --- a/src/lib/Metadata/Info/Function.cpp +++ b/src/lib/Metadata/Info/Function.cpp @@ -314,9 +314,9 @@ tag_invoke( Param const& p, DomCorpus const*) { - io.map("name", dom::stringOrNull(*p.Name)); + io.map("name", dom::stringOrNull(p.Name)); io.map("type", p.Type); - io.map("default", dom::stringOrNull(*p.Default)); + io.map("default", dom::stringOrNull(p.Default)); } void diff --git a/src/lib/Metadata/Source.cpp b/src/lib/Metadata/Source.cpp index 04f19902f..55e0427da 100644 --- a/src/lib/Metadata/Source.cpp +++ b/src/lib/Metadata/Source.cpp @@ -80,7 +80,7 @@ merge(SourceInfo& I, SourceInfo&& Other) mergeImpl(I, Other); } -OptionalLocation +Optional getPrimaryLocation(SourceInfo const& I, bool const preferDefinition) { if (I.Loc.empty() || @@ -93,9 +93,9 @@ getPrimaryLocation(SourceInfo const& I, bool const preferDefinition) I.Loc, &Location::Documented); if (documentedIt != I.Loc.end()) { - return OptionalLocation(*documentedIt); + return Optional(*documentedIt); } - return OptionalLocation(I.Loc.front()); + return Optional(I.Loc.front()); } template diff --git a/src/test/ADT/Nullable.cpp b/src/test/ADT/Nullable.cpp new file mode 100644 index 000000000..fe4ed346d --- /dev/null +++ b/src/test/ADT/Nullable.cpp @@ -0,0 +1,239 @@ +// +// Licensed under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// Copyright (c) 2025 Alan de Freitas (alandefreitas@gmail.com) +// +// Official repository: https://github.com/cppalliance/mrdocs +// + +#include +#include +#include +#include +#include +#include + +namespace clang::mrdocs { + +struct NullableTest { + // Types for testing + struct NoTraits { + int v{}; + }; + + enum class EUnknown { + A, + B, + Unknown + }; + enum class EUNKNOWN { + A, + B, + UNKNOWN + }; + enum class ENone { + A, + B, + None + }; + enum class ENONE { + A, + B, + NONE + }; + + void + test_concepts_and_detection() + { + // HasSentinel: pointers, nullptr_t, unsigned, floating, enums with + // known nuller + static_assert(HasSentinel); + static_assert(HasSentinel); + static_assert(HasSentinel); + static_assert(HasSentinel); + static_assert(HasSentinel); + static_assert(HasSentinel); + static_assert(HasSentinel); + static_assert(HasSentinel); + + // HasSentinel should NOT hold for std::string or NoTraits + static_assert(!HasSentinel); + static_assert(!HasSentinel); + + // ClearableEmpty: string, vector qualify + static_assert(ClearableEmpty); + static_assert(ClearableEmpty>); + + // ClearableEmpty should NOT hold for primitive or pointer + static_assert(!ClearableEmpty); + static_assert(!ClearableEmpty); + + // has_nullable_traits_v (the concept) should be true when either + // sentinel or clearable-empty applies + static_assert(has_nullable_traits_v); + static_assert(has_nullable_traits_v); + static_assert(has_nullable_traits_v); + static_assert(has_nullable_traits_v); + static_assert(has_nullable_traits_v); + static_assert(has_nullable_traits_v); + static_assert(has_nullable_traits_v>); + static_assert(!has_nullable_traits_v); + } + + void + test_sentinel_traits_pointers() + { + int* p = nullptr; + BOOST_TEST(sentinel_traits::is_sentinel(p)); + BOOST_TEST(sentinel_traits::sentinel() == nullptr); + + int x = 0; + p = &x; + BOOST_TEST(!sentinel_traits::is_sentinel(p)); + + // nullable_traits uses sentinel for pointers + BOOST_TEST(is_null(nullptr)); + int* q = &x; + BOOST_TEST(!is_null(q)); + make_null(q); + BOOST_TEST(is_null(q)); + auto n = null_of(); + BOOST_TEST(n == nullptr); + } + + void + test_sentinel_traits_nullptr_t() + { + std::nullptr_t z = nullptr; + BOOST_TEST(sentinel_traits::is_sentinel(z)); + BOOST_TEST(sentinel_traits::sentinel() == nullptr); + + // nullable_traits via sentinel + BOOST_TEST(is_null(z)); + auto n = null_of(); + (void) n; // always null + std::nullptr_t t = nullptr; + make_null(t); + BOOST_TEST(is_null(t)); + } + + void + test_sentinel_traits_unsigned() + { + using U = unsigned; + U s = sentinel_traits::sentinel(); + BOOST_TEST(s == static_cast(-1)); + BOOST_TEST(sentinel_traits::is_sentinel(s)); + BOOST_TEST(!sentinel_traits::is_sentinel(static_cast(0))); + + // nullable_traits via sentinel + U v = 7u; + BOOST_TEST(!is_null(v)); + make_null(v); + BOOST_TEST(is_null(v)); + BOOST_TEST(sentinel_traits::is_sentinel(v)); + BOOST_TEST(is_null(null_of())); + } + + void + test_sentinel_traits_floating() + { + using F = double; + F s = sentinel_traits::sentinel(); + BOOST_TEST(std::isnan(s)); + BOOST_TEST(sentinel_traits::is_sentinel(s)); + BOOST_TEST(!sentinel_traits::is_sentinel(0.0)); + + // nullable_traits via sentinel (NaN) + F v = 0.5; + BOOST_TEST(!is_null(v)); + make_null(v); + BOOST_TEST(is_null(v)); + BOOST_TEST(std::isnan(null_of())); + } + + void + test_sentinel_traits_enums_all_variants() + { + // EUnknown + BOOST_TEST(sentinel_traits::is_sentinel(EUnknown::Unknown)); + BOOST_TEST(sentinel_traits::sentinel() == EUnknown::Unknown); + EUnknown eu = EUnknown::A; + BOOST_TEST(!is_null(eu)); + make_null(eu); + BOOST_TEST(is_null(eu)); + BOOST_TEST(null_of() == EUnknown::Unknown); + + // EUNKNOWN + BOOST_TEST(sentinel_traits::is_sentinel(EUNKNOWN::UNKNOWN)); + BOOST_TEST(sentinel_traits::sentinel() == EUNKNOWN::UNKNOWN); + + // ENone + BOOST_TEST(sentinel_traits::is_sentinel(ENone::None)); + BOOST_TEST(sentinel_traits::sentinel() == ENone::None); + + // ENONE + BOOST_TEST(sentinel_traits::is_sentinel(ENONE::NONE)); + BOOST_TEST(sentinel_traits::sentinel() == ENONE::NONE); + } + + void + test_nullable_traits_clearable_empty_string() + { + std::string s; + BOOST_TEST(has_nullable_traits_v); + BOOST_TEST(is_null(s)); // empty + s = "abc"; + BOOST_TEST(!is_null(s)); + make_null(s); // clear() + BOOST_TEST(is_null(s)); + + auto z = null_of(); // default empty + BOOST_TEST(is_null(z)); + } + + void + test_nullable_traits_clearable_empty_vector() + { + std::vector v; + BOOST_TEST(has_nullable_traits_v>); + BOOST_TEST(is_null(v)); + v.push_back(1); + BOOST_TEST(!is_null(v)); + make_null(v); + BOOST_TEST(is_null(v)); + auto z = null_of>(); + BOOST_TEST(is_null(z)); + } + + void + test_negative_no_traits() + { + // No traits ⇒ helpers are not available by constraints; we only assert + // detection. + static_assert(!has_nullable_traits_v); + BOOST_TEST(true); + } + + void + run() + { + test_concepts_and_detection(); + test_sentinel_traits_pointers(); + test_sentinel_traits_nullptr_t(); + test_sentinel_traits_unsigned(); + test_sentinel_traits_floating(); + test_sentinel_traits_enums_all_variants(); + test_nullable_traits_clearable_empty_string(); + test_nullable_traits_clearable_empty_vector(); + test_negative_no_traits(); + + BOOST_TEST(true); + } +}; + +TEST_SUITE(NullableTest, "clang.mrdocs.ADT.Nullable"); + +} // namespace clang::mrdocs diff --git a/src/test/ADT/Optional.cpp b/src/test/ADT/Optional.cpp new file mode 100644 index 000000000..80b4ea757 --- /dev/null +++ b/src/test/ADT/Optional.cpp @@ -0,0 +1,233 @@ +// +// Licensed under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// Copyright (c) 2025 Alan de Freitas (alandefreitas@gmail.com) +// +// Official repository: https://github.com/cppalliance/mrdocs +// + +#include +#include +#include + +namespace clang::mrdocs { + +struct OptionalTest { + // A fallback-only payload type (no sentinel, no empty()/clear()). + struct NoTraits { + int x = 0; + int + forty_two() const + { + return 42; + } + auto + operator<=>(NoTraits const&) const + = default; + }; + + // An enum that should pick up sentinel via Unknown + enum class Color { + Red, + Green, + Unknown + }; + + void + test_nullable_string() + { + static_assert( + has_nullable_traits_v, + "string should use nullable_traits"); + Optional o; + BOOST_TEST(!o.has_value()); // default-null via empty() + + o.emplace("hi"); + BOOST_TEST(o.has_value()); + BOOST_TEST(*o == "hi"); + BOOST_TEST(o->size() == 2u); + + // value() overloads + { + std::string& lref = o.value(); + BOOST_TEST(&lref == &*o); + + std::string const& clref = std::as_const(o).value(); + BOOST_TEST(&clref == &*std::as_const(o)); + + std::string moved = std::move(o).value(); // value() && + BOOST_TEST(moved == "hi"); + } + + // assign null + o = nullptr; + BOOST_TEST(!o.has_value()); + + // reset() + o.reset(); + BOOST_TEST(!o.has_value()); + + // construct from value + Optional o2{ "abc" }; + BOOST_TEST(o2.has_value()); + BOOST_TEST(o2.value() == "abc"); + + // comparisons (spaceship defaults) + Optional a{ "abc" }, b{ "abc" }, c{ "abd" }; + BOOST_TEST(a == b); + BOOST_TEST(a < c); + } + + void + test_nullable_unsigned() + { + static_assert( + has_nullable_traits_v, + "unsigned should use sentinel -1"); + Optional id; // sentinel == max + BOOST_TEST(!id.has_value()); + + id = 7u; + BOOST_TEST(id.has_value()); + BOOST_TEST(*id == 7u); + + id = static_cast(-1); // assign sentinel -> null + BOOST_TEST(!id.has_value()); + + id.reset(); + BOOST_TEST(!id.has_value()); + + id.emplace(42u); + BOOST_TEST(id.has_value()); + BOOST_TEST(id.value() == 42u); + } + + void + test_nullable_double() + { + static_assert( + has_nullable_traits_v, + "double should use NaN sentinel"); + Optional dop; // NaN -> null + BOOST_TEST(!dop.has_value()); + + dop = 0.0; + BOOST_TEST(dop.has_value()); + BOOST_TEST(*dop == 0.0); + + dop = nullptr; // back to null + BOOST_TEST(!dop.has_value()); + } + + void + test_nullable_enum() + { + static_assert( + has_nullable_traits_v, + "enum with Unknown should have sentinel"); + Optional c; + BOOST_TEST(!c.has_value()); // default to Unknown sentinel + + c = Color::Red; + BOOST_TEST(c.has_value()); + BOOST_TEST(*c == Color::Red); + + c.reset(); + BOOST_TEST(!c.has_value()); + } + + void + test_nullable_location() + { + // Location is nullable when ShortPath is empty (trait specialization + // provided by user) + static_assert( + has_nullable_traits_v, + "Location should use nullable_traits"); + Optional loc; + BOOST_TEST(!loc.has_value()); // default has empty ShortPath + + Location L{ "full.cpp", "short.cpp", "src.cpp", 10u, true }; + Optional a{ L }; + BOOST_TEST(a.has_value()); + BOOST_TEST(a->ShortPath == "short.cpp"); + BOOST_TEST(a->LineNumber == 10u); + BOOST_TEST((*a).Documented == true); + + a = nullptr; + BOOST_TEST(!a.has_value()); + // Invalid: BOOST_TEST(a.value().ShortPath.empty()); + } + + void + test_fallback_notraits() + { + static_assert( + !has_nullable_traits_v, + "NoTraits must fall back to std::optional"); + Optional o; + BOOST_TEST(!o.has_value()); // default disengaged + + o.emplace(NoTraits{ 7 }); + BOOST_TEST(o.has_value()); + BOOST_TEST((*o).x == 7); + BOOST_TEST(o->forty_two() == 42); + + // copy / move + Optional copy = o; + BOOST_TEST(copy.has_value()); + BOOST_TEST(copy->x == 7); + + Optional moved = std::move(o); + BOOST_TEST(moved.has_value()); + BOOST_TEST(moved->x == 7); + + // assign value + o = NoTraits{ 9 }; + BOOST_TEST(o.has_value()); + BOOST_TEST(o->x == 9); + + // value() overloads + { + NoTraits& lref = o.value(); + BOOST_TEST(&lref == &*o); + + NoTraits const& clref = std::as_const(o).value(); + BOOST_TEST(&clref == &*std::as_const(o)); + + NoTraits moved_val = std::move(o).value(); + BOOST_TEST(moved_val.x == 9); + } + + // reset and null-assign + o.reset(); + BOOST_TEST(!o.has_value()); + o = nullptr; + BOOST_TEST(!o.has_value()); + + // comparisons + Optional a, b; + BOOST_TEST(a == b); // both disengaged + a.emplace(NoTraits{ 1 }); + b.emplace(NoTraits{ 2 }); + BOOST_TEST(a != b); + BOOST_TEST(a < b); + } + + void + run() + { + test_nullable_string(); + test_nullable_unsigned(); + test_nullable_double(); + test_nullable_enum(); + test_nullable_location(); + test_fallback_notraits(); + } +}; + +TEST_SUITE(OptionalTest, "clang.mrdocs.ADT.Optional"); + +} // namespace clang::mrdocs diff --git a/src/test_suite/detail/decomposer.hpp b/src/test_suite/detail/decomposer.hpp index 21d2a7011..1f30f96e2 100644 --- a/src/test_suite/detail/decomposer.hpp +++ b/src/test_suite/detail/decomposer.hpp @@ -117,7 +117,7 @@ namespace test_suite::detail binary_operands operator==(first_operand &&lhs, U &&rhs) { - if constexpr (integral_comparison) + if constexpr (integral_comparison && !std::same_as>) { return {std::cmp_equal( lhs.lhs_, rhs ), lhs.lhs_, "==", rhs}; } diff --git a/src/test_suite/diff.cpp b/src/test_suite/diff.cpp index 341bba588..3d0b8f794 100644 --- a/src/test_suite/diff.cpp +++ b/src/test_suite/diff.cpp @@ -31,7 +31,8 @@ diffStrings(std::string_view str1, std::string_view str2, std::size_t context_si { newPos = text.length(); } - lines.push_back(text.substr(pos, newPos - pos)); + auto line = text.substr(pos, newPos - pos); + lines.push_back(line); pos = newPos + 1; } }; @@ -81,7 +82,9 @@ diffStrings(std::string_view str1, std::string_view str2, std::size_t context_si { for (size_t j = 0; j < lines2.size(); ++j) { - if (trim_spaces(lines1[i]) == trim_spaces(lines2[j])) + auto line1 = trim_spaces(lines1[i]); + auto line2 = trim_spaces(lines2[j]); + if (line1 == line2) { // If the lines are equal, it means they contribute to the common subsequence. // In this case, the value in the current cell lcsTable[i + 1][j + 1] is set @@ -119,12 +122,14 @@ diffStrings(std::string_view str1, std::string_view str2, std::size_t context_si // the adjacent cells to determine the direction of the LCS while (i > 0 && j > 0) { - if (lines1[i - 1] == lines2[j - 1]) + auto line1 = trim_spaces(lines1[i - 1]); + auto line2 = trim_spaces(lines2[j - 1]); + if (line1 == line2) { // If the current lines lines1[i-1] and lines2[j-1] are equal, // it means the line is common to both multiline strings. It // is added to diffLines with a space prefix, indicating no change. - diffLines.push_back({std::string(lines1[i - 1]), false, false}); + diffLines.push_back({std::string(line1), false, false}); --i; --j; result.unmodified++; @@ -136,7 +141,7 @@ diffStrings(std::string_view str1, std::string_view str2, std::size_t context_si // lcsTable[i-1][j], it means the line in lines2[j-1] is // part of the LCS. Thus, it is added to diffLines with // a "+" prefix to indicate an addition. - diffLines.push_back({std::string(lines2[j - 1]), true, false}); + diffLines.push_back({std::string(line2), true, false}); --j; result.added++; } @@ -144,7 +149,7 @@ diffStrings(std::string_view str1, std::string_view str2, std::size_t context_si { // Otherwise, the line in lines1[i-1] is part of the LCS, and it // is added to diffLines with a "-" prefix to indicate a deletion. - diffLines.push_back({std::string(lines1[i - 1]), false, true}); + diffLines.push_back({std::string(line1), false, true}); --i; result.removed++; } @@ -152,14 +157,16 @@ diffStrings(std::string_view str1, std::string_view str2, std::size_t context_si while (i > 0) { - diffLines.push_back({std::string(lines1[i - 1]), false, true}); + auto line1 = lines1[i - 1]; + diffLines.push_back({std::string(line1), false, true}); --i; result.removed++; } while (j > 0) { - diffLines.push_back({std::string(lines2[j - 1]), true, false}); + auto line2 = lines2[j - 1]; + diffLines.push_back({std::string(line2), true, false}); --j; result.added++; } @@ -196,7 +203,7 @@ diffStrings(std::string_view str1, std::string_view str2, std::size_t context_si } } - // Concatenate diff lines into a single string considering number + // Concatenate diff lines into a single string considering the number // of unmodified lines in the context std::size_t out_of_context = 0; for (auto diffLine : diffLines) @@ -265,8 +272,6 @@ BOOST_TEST_DIFF( BOOST_TEST(diff.added == 0); BOOST_TEST(diff.removed == 0); } - BOOST_TEST(rendered_contents.size() == expected_contents.size()); - BOOST_TEST((rendered_contents == expected_contents)); } } From b3305373412fb7a9db7664b2d7e3414fd5200346 Mon Sep 17 00:00:00 2001 From: Alan de Freitas Date: Wed, 24 Sep 2025 01:15:44 -0500 Subject: [PATCH 02/23] refactor(lib): polymorphic is value-type This commit adjusts the Polymorphic class so that it becomes a value-type that matches the standard std::polymorphic. It also implements an implementation detail shared with Optional, allowing the private nullable state to be used for storage optimization. The semantics become less convenient in the case of optional polymorphic objects, but the application becomes much safer because non-nullable objects are never in an invalid state. After adapting all objects, most polymorphic objects are, in fact, not nullable. As future work, we can define a custom type for nullable polymorphic objects that has simpler semantics. --- include/mrdocs/ADT/Optional.hpp | 338 ++++++++++++++++++++++++++++- include/mrdocs/ADT/Polymorphic.hpp | 303 +++++++++++++++----------- 2 files changed, 499 insertions(+), 142 deletions(-) diff --git a/include/mrdocs/ADT/Optional.hpp b/include/mrdocs/ADT/Optional.hpp index a3e3205fb..a898114c9 100644 --- a/include/mrdocs/ADT/Optional.hpp +++ b/include/mrdocs/ADT/Optional.hpp @@ -15,6 +15,7 @@ #include #include +#include #include #include #include @@ -83,6 +84,11 @@ class Optional { }()) {} + /** Construct from std::nullopt + */ + constexpr Optional(std::nullopt_t) noexcept(default_ctor_noex_()) + : Optional() {} + /// Copy constructor constexpr Optional(Optional const&) = default; @@ -102,15 +108,18 @@ class Optional { @param u The value to store. It must be convertible to T. **/ template - requires std::is_constructible_v + requires( + !std::same_as, Optional> + && !std::same_as, std::in_place_t> + && !std::same_as, std::nullopt_t> + && std::is_constructible_v) constexpr explicit Optional(U&& u) noexcept( std::is_nothrow_constructible_v) : s_([&] { if constexpr (uses_nullable_traits) { return storage_t(static_cast(std::forward(u))); - } - else + } else { return storage_t(std::forward(u)); } @@ -122,11 +131,20 @@ class Optional { @param u The value to store. It must be convertible to T. **/ template - requires std::is_constructible_v && std::is_assignable_v - constexpr Optional& + requires( + !std::same_as, Optional> + && std::is_constructible_v && std::is_assignable_v) + constexpr + Optional& operator=(U&& u) noexcept(std::is_nothrow_assignable_v) { - s_ = std::forward(u); + if constexpr (uses_nullable_traits) + { + s_ = std::forward(u); + } else + { + s_ = std::forward(u); + } return *this; } @@ -330,15 +348,311 @@ class Optional { return *s_; } } +}; - /** Three-way comparison defaults when supported by the underlying - T/std::optional. - **/ - auto - operator<=>(Optional const&) const - = default; +namespace detail { +template +inline constexpr bool isOptionalV = false; + +template +inline constexpr bool isOptionalV> = true; + +template +using OptionalRelopT = std::enable_if_t, bool>; + +template +using OptionalEqT = OptionalRelopT< + decltype(std::declval() == std::declval())>; + +template +using OptionalNeT = OptionalRelopT< + decltype(std::declval() != std::declval())>; + +template +using OptionalLtT = OptionalRelopT< + decltype(std::declval() < std::declval())>; + +template +using OptionalGtT = OptionalRelopT< + decltype(std::declval() > std::declval())>; + +template +using OptionalLeT = OptionalRelopT< + decltype(std::declval() <= std::declval())>; + +template +using OptionalGeT = detail::OptionalRelopT< + decltype(std::declval() >= std::declval())>; + +template +concept isDerivedFromOptional = requires(T const& __t) { + [](Optional const&) { + }(__t); }; +} // namespace detail + +/** Compares two Optional values for equality. + + Returns true if both are engaged and their contained values are equal, or both are disengaged. +*/ +template +constexpr detail::OptionalEqT +operator==(Optional const& lhs, Optional const& rhs) +{ + return static_cast(lhs) == static_cast(rhs) + && (!lhs || *lhs == *rhs); +} + +/** Compares two Optional values for inequality. + + Returns true if their engagement states differ or their contained values are not equal. +*/ +template +constexpr detail::OptionalNeT +operator!=(Optional const& lhs, Optional const& rhs) +{ + return static_cast(lhs) != static_cast(rhs) + || (static_cast(lhs) && *lhs != *rhs); +} + +/** Checks if the left Optional is less than the right Optional. + + Returns true if the right is engaged and either the left is disengaged or its value is less. +*/ +template +constexpr detail::OptionalLtT +operator<(Optional const& lhs, Optional const& rhs) +{ + return static_cast(rhs) && (!lhs || *lhs < *rhs); +} + +/** Checks if the left Optional is greater than the right Optional. + + Returns true if the left is engaged and either the right is disengaged or its value is greater. +*/ +template +constexpr detail::OptionalGtT +operator>(Optional const& lhs, Optional const& rhs) +{ + return static_cast(lhs) && (!rhs || *lhs > *rhs); +} + +/** Checks if the left Optional is less than or equal to the right Optional. + + Returns true if the left is disengaged or the right is engaged and the left's value is less or equal. +*/ +template +constexpr detail::OptionalLeT +operator<=(Optional const& lhs, Optional const& rhs) +{ + return !lhs || (static_cast(rhs) && *lhs <= *rhs); +} + +/** Checks if the left Optional is greater than or equal to the right Optional. + + Returns true if the right is disengaged or the left is engaged and its value is greater or equal. +*/ +template +constexpr detail::OptionalGeT +operator>=(Optional const& lhs, Optional const& rhs) +{ + return !rhs || (static_cast(lhs) && *lhs >= *rhs); +} + +/** Performs a three-way comparison between two Optional values. + + If both are engaged, compares their contained values; otherwise, compares engagement state. +*/ +template U> +[[nodiscard]] +constexpr std::compare_three_way_result_t +operator<=>(Optional const& x, Optional const& y) +{ + return x && y ? *x <=> *y : bool(x) <=> bool(y); +} + +/** Checks if the Optional is disengaged (equal to std::nullopt). + + Returns true if the Optional does not contain a value. +*/ +template +[[nodiscard]] +constexpr bool +operator==(Optional const& lhs, std::nullopt_t) noexcept +{ + return !lhs; +} + +/** Performs a three-way comparison between an Optional and std::nullopt. + + Returns std::strong_ordering::greater if engaged, std::strong_ordering::equal if disengaged. +*/ +template +[[nodiscard]] +constexpr std::strong_ordering +operator<=>(Optional const& x, std::nullopt_t) noexcept +{ + return bool(x) <=> false; +} + +/** Compares an engaged Optional to a value for equality. + + Returns true if the Optional is engaged and its value equals rhs. +*/ +template +requires(!detail::isOptionalV) +constexpr detail::OptionalEqT +operator== [[nodiscard]] (Optional const& lhs, U const& rhs) +{ + return lhs && *lhs == rhs; +} + +/** Compares a value to an engaged Optional for equality. + + Returns true if the Optional is engaged and its value equals lhs. +*/ +template +requires(!detail::isOptionalV) +constexpr detail::OptionalEqT +operator== [[nodiscard]] (T const& lhs, Optional const& rhs) +{ + return rhs && lhs == *rhs; +} + +/** Compares an Optional to a value for inequality. + + Returns true if the Optional is disengaged or its value does not equal rhs. +*/ +template +requires(!detail::isOptionalV) +constexpr detail::OptionalNeT +operator!= [[nodiscard]] (Optional const& lhs, U const& rhs) +{ + return !lhs || *lhs != rhs; +} + +/** Compares a value to an Optional for inequality. + + Returns true if the Optional is disengaged or its value does not equal lhs. +*/ +template +requires(!detail::isOptionalV) +constexpr detail::OptionalNeT +operator!= [[nodiscard]] (T const& lhs, Optional const& rhs) +{ + return !rhs || lhs != *rhs; +} + +/** Checks if the Optional is less than a value. + + Returns true if the Optional is disengaged or its value is less than rhs. +*/ +template +requires(!detail::isOptionalV) +constexpr detail::OptionalLtT +operator<[[nodiscard]] (Optional const& lhs, U const& rhs) +{ + return !lhs || *lhs < rhs; +} + +/** Checks if a value is less than an engaged Optional. + + Returns true if the Optional is engaged and lhs is less than its value. +*/ +template +requires(!detail::isOptionalV) +constexpr detail::OptionalLtT +operator<[[nodiscard]] (T const& lhs, Optional const& rhs) +{ + return rhs && lhs < *rhs; +} + +/** Checks if the Optional is greater than a value. + + Returns true if the Optional is engaged and its value is greater than rhs. +*/ +template +requires(!detail::isOptionalV) +constexpr detail::OptionalGtT +operator> [[nodiscard]] (Optional const& lhs, U const& rhs) +{ + return lhs && *lhs > rhs; +} + +/** Checks if a value is greater than an Optional. + + Returns true if the Optional is disengaged or lhs is greater than its value. +*/ +template +requires(!detail::isOptionalV) +constexpr detail::OptionalGtT +operator> [[nodiscard]] (T const& lhs, Optional const& rhs) +{ + return !rhs || lhs > *rhs; +} + +/** Checks if the Optional is less than or equal to a value. + + Returns true if the Optional is disengaged or its value is less than or equal to rhs. +*/ +template +requires(!detail::isOptionalV) +constexpr detail::OptionalLeT +operator<= [[nodiscard]] (Optional const& lhs, U const& rhs) +{ + return !lhs || *lhs <= rhs; +} + +/** Checks if a value is less than or equal to an engaged Optional. + + Returns true if the Optional is engaged and lhs is less than or equal to its value. +*/ +template +requires(!detail::isOptionalV) +constexpr detail::OptionalLeT +operator<= [[nodiscard]] (T const& lhs, Optional const& rhs) +{ + return rhs && lhs <= *rhs; +} + +/** Checks if the Optional is greater than or equal to a value. + + Returns true if the Optional is engaged and its value is greater than or equal to rhs. +*/ +template +requires(!detail::isOptionalV) +constexpr detail::OptionalGeT +operator>= [[nodiscard]] (Optional const& lhs, U const& rhs) +{ + return lhs && *lhs >= rhs; +} + +/** Checks if a value is greater than or equal to an Optional. + + Returns true if the Optional is disengaged or lhs is greater than or equal to its value. +*/ +template +requires(!detail::isOptionalV) +constexpr detail::OptionalGeT +operator>= [[nodiscard]] (T const& lhs, Optional const& rhs) +{ + return !rhs || lhs >= *rhs; +} + +/** Performs a three-way comparison between an Optional and a value. + + If the Optional is engaged, compares its value to v; otherwise, returns less. +*/ +template +requires(!detail::isDerivedFromOptional) + && requires { typename std::compare_three_way_result_t; } + && std::three_way_comparable_with +constexpr std::compare_three_way_result_t +operator<=> [[nodiscard]] (Optional const& x, U const& v) +{ + return bool(x) ? *x <=> v : std::strong_ordering::less; +} } // namespace clang::mrdocs #endif diff --git a/include/mrdocs/ADT/Polymorphic.hpp b/include/mrdocs/ADT/Polymorphic.hpp index f1ccca143..9273c1e1f 100644 --- a/include/mrdocs/ADT/Polymorphic.hpp +++ b/include/mrdocs/ADT/Polymorphic.hpp @@ -14,7 +14,7 @@ #include #include -#include +#include #include namespace clang::mrdocs { @@ -42,133 +42,148 @@ namespace clang::mrdocs { the owned derived-type object in the destructor. */ -template class Polymorphic { - struct WrapperBase { - virtual constexpr ~WrapperBase() = default; - virtual T &getValue() = 0; - virtual constexpr WrapperBase *clone() = 0; - }; +template +class Polymorphic { + struct WrapperBase { + virtual constexpr ~WrapperBase() = default; + virtual T& getValue() = 0; + virtual constexpr WrapperBase* clone() = 0; + }; + + template + class Wrapper final : public WrapperBase { + U Value; + U& getValue() override { return Value; } + public: + template + constexpr Wrapper(Ts&&... ts) : Value(std::forward(ts)...) {} + constexpr ~Wrapper() override = default; + constexpr WrapperBase* clone() override { return new Wrapper(Value); } + }; + + WrapperBase* WB; // nullptr only when constructed/reset by nullable_traits + + // Private null token and constructor: only the friend traits can call this. + struct _null_t { explicit constexpr _null_t(int) {} }; + explicit constexpr Polymorphic(_null_t) noexcept : WB(nullptr) {} + + // Allow the traits specialization to access private members/ctors. + friend struct nullable_traits>; + +// std::polymorphic has a default constructor that +// default-constructs the base type T if it's default-constructible. +// We disable this constructor because this is always an error +// in MrDocs. +// constexpr explicit Polymorphic() +// requires std::is_default_constructible_v +// && std::is_copy_constructible_v +// : WB(new Wrapper()) +// {} - template class Wrapper final : public WrapperBase { - U Value; +public: + using value_type = T; + using pointer = T*; + using const_pointer = T const*; + + /// Default constructs the value type (never null via public API). + /// explicit constexpr Polymorphic() : Polymorphic(std::in_place_type) {} + + /** Forwarding constructor from a derived U. */ + template + constexpr explicit Polymorphic(U&& u) + requires (!std::same_as>) && + std::copy_constructible> && + std::derived_from, T> + : WB(new Wrapper>(std::forward(u))) {} + + /** In-place constructor for a specific derived U. */ + template + explicit constexpr Polymorphic(std::in_place_type_t, Ts&&... ts) + requires std::same_as, U> && + std::constructible_from && + std::copy_constructible && std::derived_from + : WB(new Wrapper(std::forward(ts)...)) {} + + constexpr Polymorphic(Polymorphic const& V) + : WB(V.WB ? V.WB->clone() : nullptr) {} + + constexpr Polymorphic(Polymorphic&& V) noexcept + : WB(std::exchange(V.WB, nullptr)) {} + + constexpr ~Polymorphic() { delete WB; } + + constexpr Polymorphic& operator=(Polymorphic const& V) { + if (this != &V) { + Polymorphic Temp(V); + swap(*this, Temp); + } + return *this; + } + + constexpr Polymorphic& operator=(Polymorphic&& V) noexcept { + if (this != &V) { + delete WB; + WB = std::exchange(V.WB, nullptr); + } + return *this; + } - U &getValue() override { return Value; } + [[nodiscard]] constexpr pointer operator->() noexcept { + MRDOCS_ASSERT(WB != nullptr); + return &WB->getValue(); + } - public: - template - constexpr Wrapper(Ts &&...ts) : Value(std::forward(ts)...) {} - constexpr ~Wrapper() override = default; - constexpr WrapperBase *clone() override { return new Wrapper(getValue()); } - }; + [[nodiscard]] constexpr const_pointer operator->() const noexcept { + MRDOCS_ASSERT(WB != nullptr); + return &WB->getValue(); + } - WrapperBase *WB; + [[nodiscard]] constexpr T& operator*() noexcept { + MRDOCS_ASSERT(WB != nullptr); + return WB->getValue(); + } -public: - using value_type = T; - using pointer = T *; - using const_pointer = T const *; - - /** Empty constructor. - - Ensures: *this is empty. - */ - constexpr Polymorphic(std::nullopt_t) : WB(nullptr) {} - - /// Default constructs the value type. - explicit constexpr Polymorphic() : Polymorphic(std::in_place_type) {} - - /** Forwarding constructor. - * @param u The object to copy. - */ - template - constexpr explicit Polymorphic(U &&u) - requires(not std::same_as>) && - std::copy_constructible> && - std::derived_from, T> - : WB(new Wrapper>(std::forward(u))) {} - - /** In place constructor - * @param ts Arguments to forward to the constructor of U. - */ - template - explicit constexpr Polymorphic(std::in_place_type_t, Ts &&...ts) - requires std::same_as, U> && - std::constructible_from && - std::copy_constructible && std::derived_from - : WB(new Wrapper(std::forward(ts)...)) {} - - constexpr Polymorphic(const Polymorphic &V) - : WB(V ? V.WB->clone() : nullptr) {} - - constexpr Polymorphic(Polymorphic &&V) noexcept - : WB(std::exchange(V.WB, nullptr)) {} - - constexpr ~Polymorphic() { delete WB; } - - constexpr Polymorphic &operator=(const Polymorphic &V) { - if (this != &V) { - Polymorphic Temp(V); - swap(*this, Temp); + [[nodiscard]] constexpr T const& operator*() const noexcept { + MRDOCS_ASSERT(WB != nullptr); + return WB->getValue(); } - return *this; - } - - constexpr Polymorphic &operator=(Polymorphic &&V) noexcept { - if (this != &V) { - swap(*this, V); - Polymorphic Temp = std::nullopt; - swap(V, Temp); + + constexpr bool + valueless_after_move() const noexcept + { + return WB == nullptr; + } + + friend constexpr void + swap(Polymorphic& lhs, Polymorphic& rhs) noexcept + { + std::swap(lhs.WB, rhs.WB); } - return *this; - } - - [[nodiscard]] constexpr pointer operator->() noexcept { - MRDOCS_ASSERT(WB != nullptr); - return &WB->getValue(); - } - - [[nodiscard]] constexpr const_pointer operator->() const noexcept { - MRDOCS_ASSERT(WB != nullptr); - return &WB->getValue(); - } - - [[nodiscard]] constexpr T &operator*() noexcept { - MRDOCS_ASSERT(WB != nullptr); - return WB->getValue(); - } - - [[nodiscard]] constexpr const T &operator*() const noexcept { - MRDOCS_ASSERT(WB != nullptr); - return WB->getValue(); - } - - [[nodiscard]] explicit constexpr operator bool() const noexcept { - return WB != nullptr; - } - - friend constexpr void swap(Polymorphic &lhs, Polymorphic &rhs) noexcept { - std::swap(lhs.WB, rhs.WB); - } }; namespace detail { // A function to compare two polymorphic objects that // store the same derived type -template struct VisitCompareFn { - Base const &rhs; +template +struct VisitCompareFn +{ + Base const& rhs; - template auto operator()(Derived const &lhsDerived) { - auto const &rhsDerived = dynamic_cast(rhs); - return lhsDerived <=> rhsDerived; - } + template + auto + operator()(Derived const& lhsDerived) + { + auto const& rhsDerived = dynamic_cast(rhs); + return lhsDerived <=> rhsDerived; + } }; -/** Determines if a type can be visited with VisitCompareFn - */ template -concept CanVisitCompare = - requires(Base const &b) { visit(b, VisitCompareFn{b}); }; +concept CanVisitCompare = requires(Base const& b) +{ + visit(b, VisitCompareFn{ b }); +}; template inline constexpr bool IsPolymorphic = false; template inline constexpr bool IsPolymorphic> = true; @@ -197,11 +212,9 @@ template inline constexpr bool IsPolymorphic> = true; template requires detail::CanVisitCompare auto -CompareDerived( - Polymorphic const& lhs, - Polymorphic const& rhs) +CompareDerived(Polymorphic const& lhs, Polymorphic const& rhs) { - if (lhs && rhs) + if (!lhs.valueless_after_move() && !rhs.valueless_after_move()) { if (lhs->Kind == rhs->Kind) { @@ -209,26 +222,28 @@ CompareDerived( } return lhs->Kind <=> rhs->Kind; } - return !lhs ? std::strong_ordering::less - : std::strong_ordering::greater; + return lhs.valueless_after_move() ? + std::strong_ordering::less : + std::strong_ordering::greater; } /// @copydoc CompareDerived(Polymorphic const&, Polymorphic const&) template - requires(!detail::IsPolymorphic) && detail::CanVisitCompare -auto CompareDerived(Base const &lhs, Base const &rhs) { - if (lhs.Kind == rhs.Kind) { - return visit(lhs, detail::VisitCompareFn(rhs)); - } - return lhs.Kind <=> rhs.Kind; +requires(!detail::IsPolymorphic) && detail::CanVisitCompare +auto +CompareDerived(Base const& lhs, Base const& rhs) +{ + if (lhs.Kind == rhs.Kind) + { + return visit(lhs, detail::VisitCompareFn(rhs)); + } + return lhs.Kind <=> rhs.Kind; } template requires detail::CanVisitCompare auto -operator<=>( - Polymorphic const& lhs, - Polymorphic const& rhs) +operator<=>(Polymorphic const& lhs, Polymorphic const& rhs) { return CompareDerived(lhs, rhs); } @@ -236,13 +251,41 @@ operator<=>( template requires detail::CanVisitCompare bool -operator==( - Polymorphic const& lhs, - Polymorphic const& rhs) +operator==(Polymorphic const& lhs, Polymorphic const& rhs) { return lhs <=> rhs == std::strong_ordering::equal; } -} // clang::mrdocs +// -------------------- nullable_traits specialization -------------------- + +/** nullable_traits for Polymorphic. + + Only this friend specialization can create/reset the null state. +*/ +template +struct nullable_traits> +{ + static constexpr bool + is_null(Polymorphic const& v) noexcept + { + return v.valueless_after_move(); + } + + static constexpr Polymorphic + null() noexcept + { + // Use the private null constructor + return Polymorphic(typename Polymorphic::_null_t{0}); + } + + static constexpr void + make_null(Polymorphic& v) noexcept + { + delete v.WB; + v.WB = nullptr; + } +}; + +} // namespace clang::mrdocs #endif From 149190f313a19b1d5257bacbb2c13161cf4b9060 Mon Sep 17 00:00:00 2001 From: Alan de Freitas Date: Wed, 24 Sep 2025 02:29:15 -0500 Subject: [PATCH 03/23] docs(contribute): style guide --- .clang-format | 226 ++++++++++++++ .gitignore | 1 - bootstrap.py | 6 + docs/modules/ROOT/pages/contribute.adoc | 20 ++ util/reformat.py | 388 ++++++++++++++++++++++++ 5 files changed, 640 insertions(+), 1 deletion(-) create mode 100644 .clang-format create mode 100644 util/reformat.py diff --git a/.clang-format b/.clang-format new file mode 100644 index 000000000..beac5f6b1 --- /dev/null +++ b/.clang-format @@ -0,0 +1,226 @@ +# +# Copyright (c) 2023 Alan de Freitas (alandefreitas@gmail.com) +# +# Distributed under the Boost Software License, Version 1.0. +# See accompanying file LICENSE or copy at http://www.boost.org/LICENSE_1_0.txt +# + +# --------------------------------------------------------------------------- +# MrDocs Formatting Guidelines (Clang-Format Reference) +# +# This file encodes the formatting style we generally follow in MrDocs, +# based on conventions we have been using in Boost projects. +# +# Important: +# - Do not run clang-format across entire files or the whole project. +# - This configuration is provided as a *reference* to help new contributors +# understand the style rules and configure their editors/IDEs. +# - You may use clang-format to format only the *new code you add or modify* +# in a commit. Never reformat unrelated code. +# +# The goal is to keep the codebase consistent and allow new contributors +# to follow the same style, while minimizing churn and noise, and +# without introducing large, style-only changes in version history. +# +# If in doubt, look at the surrounding code in the file and follow its style. +# This file is here to make that easier, not to replace careful review. +# --------------------------------------------------------------------------- + +Language: Cpp +Standard: Latest +BasedOnStyle: Microsoft + +# Columns and Lines +ColumnLimit: 80 +ReflowComments: Always +TabWidth: 8 +UseCRLF: false +UseTab: Never +DeriveLineEnding: true + +# Breaking around braces +InsertBraces: true +BreakBeforeBraces: Custom +BraceWrapping: + # Control + AfterControlStatement: Always + AfterCaseLabel: true + BeforeCatch: true + BeforeElse: true + BeforeWhile: true + # Definition + AfterNamespace: false + AfterStruct: false + AfterClass: false + SplitEmptyRecord: false + AfterFunction: true + SplitEmptyFunction: false + BeforeLambdaBody: false + AfterEnum: false + SplitEmptyNamespace: true + AfterUnion: false + AfterExternBlock: true + # Extra + IndentBraces: false + +# Breaking around specifiers +# Namespaces +CompactNamespaces: false +# Templates +AlwaysBreakTemplateDeclarations: Yes +BreakBeforeConceptDeclarations: true +# Classes +BreakInheritanceList: BeforeComma +EmptyLineAfterAccessModifier: Never +EmptyLineBeforeAccessModifier: Leave +# Functions +AlwaysBreakAfterDefinitionReturnType: All +AlwaysBreakAfterReturnType: All +MaxEmptyLinesToKeep: 2 +# Strings +AlwaysBreakBeforeMultilineStrings: false +BreakStringLiterals: true +# Expressions +BreakConstructorInitializers: BeforeComma +BreakBeforeBinaryOperators: All +BreakBeforeTernaryOperators: false + +# Breaking single line blocks +# Control +AllowShortBlocksOnASingleLine: Never +AllowShortCaseLabelsOnASingleLine: false +AllowShortIfStatementsOnASingleLine: Never +AllowShortLoopsOnASingleLine: false +# Declarations +AllowShortEnumsOnASingleLine: false +# Function +AllowAllParametersOfDeclarationOnNextLine: false +AllowShortFunctionsOnASingleLine: Empty +AllowShortLambdasOnASingleLine: Inline +# Expressions +AllowAllArgumentsOnNextLine: false + +# Indentation +# Parameters +IndentWidth: 4 +# Definitions +NamespaceIndentation: None +IndentExternBlock: NoIndent +IndentPPDirectives: AfterHash +# Classes +AccessModifierOffset: -4 +IndentAccessModifiers: false +# Templates +IndentRequires: false +# Functions +IndentWrappedFunctionNames: false +LambdaBodyIndentation: OuterScope +# Control +ConstructorInitializerIndentWidth: 4 +IndentCaseBlocks: false +IndentCaseLabels: false +IndentGotoLabels: true +# Expressions +ContinuationIndentWidth: 4 +InsertTrailingCommas: None +KeepEmptyLinesAtTheStartOfBlocks: false + +# Alignment +# Macros +AlignConsecutiveMacros: Consecutive +AttributeMacros: [ 'FUTURES_CONSTEXPR', 'FUTURES_NODISCARD' ] +IfMacros: [ 'FUTURES_IF_CONSTEXPR', 'SECTION', 'TEST_CASE' ] +TypenameMacros: [ 'FUTURES_DETAIL' ] +# Declaration +PointerAlignment: Left +ReferenceAlignment: Pointer +DerivePointerAlignment: true +AlignConsecutiveDeclarations: None +QualifierAlignment: Custom +QualifierOrder: [ 'inline', 'static', 'constexpr', 'type', 'const' ] +# Namespace +ShortNamespaceLines: 0 +# Brackets +AlignAfterOpenBracket: AlwaysBreak +# Expressions +AlignArrayOfStructures: Right +AlignConsecutiveAssignments: None +AlignConsecutiveBitFields: None +AlignEscapedNewlines: Left +AlignOperands: Align +AlignTrailingComments: true + +# Spaces +SpaceAfterCStyleCast: true +SpaceAfterLogicalNot: false +SpaceAfterTemplateKeyword: true +SpaceAroundPointerQualifiers: Default +SpaceBeforeAssignmentOperators: true +SpaceBeforeCaseColon: false +SpaceBeforeCpp11BracedList: false +SpaceBeforeCtorInitializerColon: true +SpaceBeforeInheritanceColon: true +SpaceBeforeParens: ControlStatements +SpaceBeforeRangeBasedForLoopColon: false +SpacesInSquareBrackets: false +SpaceBeforeSquareBrackets: false +SpacesBeforeTrailingComments: 1 +SpaceInEmptyBlock: false +SpaceInEmptyParentheses: false +SpacesInAngles: Never +SpacesInCStyleCastParentheses: false +SpacesInConditionalStatement: false +SpacesInParentheses: false +Cpp11BracedListStyle: false + +# BinPack +BinPackArguments: false +BinPackParameters: false +BitFieldColonSpacing: After +ExperimentalAutoDetectBinPacking: true +PackConstructorInitializers: CurrentLine + +# Penalties +PenaltyBreakAssignment: 512 +PenaltyBreakBeforeFirstCallParameter: 512 +PenaltyBreakComment: 512 +PenaltyBreakFirstLessLess: 512 +PenaltyBreakString: 512 +PenaltyBreakTemplateDeclaration: 512 +PenaltyExcessCharacter: 256 +PenaltyIndentedWhitespace: 8 +PenaltyReturnTypeOnItsOwnLine: 2 + +# Sorting +SortIncludes: CaseInsensitive +SortUsingDeclarations: true +IncludeBlocks: Merge +IncludeCategories: + - Regex: '^$' # always first + Priority: 0 + - Regex: '^".*"' # quoted includes come next + Priority: 1 + - Regex: '^' # internal project headers + Priority: 2 + - Regex: '^' # internal project headers + Priority: 3 + - Regex: '^' # test suite headers + Priority: 4 + - Regex: '^' # clang headers + Priority: 5 + - Regex: '^' # llvm headers + Priority: 6 + - Regex: '^' # fmt headers + Priority: 7 + - Regex: '^' # duktape headers + Priority: 8 + - Regex: '^<(?!mrdocs/|clang/|llvm/|test_suite/|fmt/|duktape/)[^/]+/.*>' # other angle-bracket includes + Priority: 9 + - Regex: '^<[^/]+>' # C++ standard headers like + Priority: 10 + - Regex: '.*' # fallback + Priority: 11 + +# Comments +FixNamespaceComments: true +CommentPragmas: '^ clang-format' diff --git a/.gitignore b/.gitignore index 098519ed9..9b6623007 100644 --- a/.gitignore +++ b/.gitignore @@ -20,6 +20,5 @@ /share/mrdocs/libcxx/ /share/mrdocs/clang/ /docs/modules/reference -/.clang-format /.gdbinit /.lldbinit \ No newline at end of file diff --git a/bootstrap.py b/bootstrap.py index 9a2f79d5d..7a5f8c5bd 100644 --- a/bootstrap.py +++ b/bootstrap.py @@ -2369,6 +2369,12 @@ def generate_run_configs(self): "args": [], "cwd": self.options.mrdocs_src_dir }) + configs.append({ + "name": f"MrDocs Reformat Source Files", + "script": os.path.join(self.options.mrdocs_src_dir, 'util', 'reformat.py'), + "args": [], + "cwd": self.options.mrdocs_src_dir + }) # Documentation generation targets mrdocs_docs_dir = os.path.join(self.options.mrdocs_src_dir, "docs") diff --git a/docs/modules/ROOT/pages/contribute.adoc b/docs/modules/ROOT/pages/contribute.adoc index 5530b8546..364844d64 100644 --- a/docs/modules/ROOT/pages/contribute.adoc +++ b/docs/modules/ROOT/pages/contribute.adoc @@ -233,6 +233,26 @@ The fixtures for golden testing are defined in `test-files/golden-tests`, where * `.bad.xml`: The test output file generated when the test fails. * `.yml`: Extra configuration options for this specific file. +== Style Guide + +This project follows informal formatting conventions established by previous Boost projects. +To help contributors, we provide a `.clang-format` file that encodes these rules. + +* Do *not* apply clang-format across entire files or the whole project. +* Use the config only as a *reference* for your IDE/editor, or to format the code you **personally add or modify** in a commit. +* Always check the surrounding code and keep consistent with it. +* Do not create style-only commits that introduce large diffs without functional changes. + +Why This Approach: + +* Keeps history clean: avoids large, style-only commits. +* Ensures new contributors are not lost when adapting to project style. +* Encourages consistency without rigid automation. + +General Advice: When in doubt, copy the style of the surrounding code. The `.clang-format` file is a tool to help you, not a rule to enforce blindly. + +The utility script `./util/reformat.sh` can also be used to check a few project invariants, such as header guards and include order. + == Contributing If you find a bug or have a feature request, please open an issue on the MrDocs GitHub repository: https://github.com/cppalliance/mrdocs/issues diff --git a/util/reformat.py b/util/reformat.py new file mode 100644 index 000000000..696f858f5 --- /dev/null +++ b/util/reformat.py @@ -0,0 +1,388 @@ +#!/usr/bin/env python3 +import os +import re +import subprocess +import shutil +from typing import List, Optional, Tuple + +# ---------- configuration ---------- +PROCESS_EXTS = {".hpp", ".cpp"} # extend as needed +CLANG_FORMAT_EXE = shutil.which("clang-format") # resolve once + +# ---------- guard name ---------- +def make_guard(abs_path: str, base: str, guard_prefix: str) -> str: + rel = os.path.relpath(abs_path, base).replace(os.sep, "/") + suffix = re.sub(r'[^0-9A-Za-z]+', '_', rel).upper().strip('_') + guard = f"{guard_prefix}{suffix}" if guard_prefix else suffix + if not re.match(r'[A-Z_]', guard[0]): + guard = f"_{guard}" + return guard + +# ---------- comment handling ---------- +def strip_line_comments_and_blocks(line: str, in_block: bool) -> Tuple[str, bool]: + i, n = 0, len(line) + out = [] + while i < n: + if in_block: + end = line.find("*/", i) + if end == -1: + return "".join(out), True + i = end + 2 + in_block = False + else: + if line.startswith("/*", i): + in_block = True + i += 2 + continue + if line.startswith("//", i): + break + out.append(line[i]) + i += 1 + return "".join(out), in_block + +def iter_significant(lines: List[str]) -> List[Tuple[int, str]]: + sig = [] + in_block = False + for idx, raw in enumerate(lines): + text, in_block = strip_line_comments_and_blocks(raw, in_block) + s = text.strip() + if s: + sig.append((idx, s)) + return sig + +# ---------- guard structure detection ---------- +RE_IFNDEF = re.compile(r'^#\s*ifndef\s+([A-Za-z_][A-Za-z0-9_]*)\s*$') +def match_define(s: str, name: str) -> bool: + return re.match(rf'^#\s*define\s+{re.escape(name)}(\s+.*)?$', s) is not None + +def detect_guard_structure(lines: List[str]) -> Optional[Tuple[int, str, int, int]]: + """ + Returns (ifndef_idx, name, define_idx, endif_idx) iff: + - first significant token is '#ifndef NAME' + - next significant token is '#define NAME' + - last significant token is '#endif' + """ + sig = iter_significant(lines) + if not sig: + return None + m = RE_IFNDEF.match(sig[0][1]) + if not m: + return None + name = m.group(1) + if len(sig) < 2 or not match_define(sig[1][1], name): + return None + if not sig[-1][1].startswith("#endif"): + return None + return sig[0][0], name, sig[1][0], sig[-1][0] + +# ---------- misc utils ---------- +def detect_eol(s: str) -> str: + if s.endswith("\r\n"): return "\r\n" + if s.endswith("\n"): return "\n" + if s.endswith("\r"): return "\r" + return "" + +def leading_ws(s: str) -> str: + m = re.match(r'^[ \t]*', s) + return m.group(0) if m else "" + +def _normalize_slashes(p: str) -> str: + return p.replace("\\", "/") + +def _is_path_within(child: str, parent: str) -> bool: + try: + child = os.path.realpath(child) + parent = os.path.realpath(parent) + return os.path.commonpath([child, parent]) == parent + except Exception: + return False + +# ---------- include handling ---------- +INCLUDE_RE = re.compile(r'^(\s*#\s*include\s*)([<"])([^>"]+)([>"])(.*?)(\r?\n|\r)?$') + +def _resolve_from(token: str, root: str) -> Optional[str]: + p = os.path.normpath(os.path.join(root, token)) + return p if os.path.isfile(p) else None + +def _same_dir_exists(token: str, cur_dir: str) -> bool: + p = os.path.normpath(os.path.join(cur_dir, token)) + return os.path.isfile(p) and (os.path.dirname(p) == os.path.normpath(cur_dir)) + +def _detect_include_blocks(lines: List[str]) -> List[Tuple[int, int]]: + blocks: List[Tuple[int, int]] = [] + in_block_comment = False + block_start: Optional[int] = None + last_include: Optional[int] = None + + def is_blank_or_comment(i: int) -> bool: + nonlocal in_block_comment + visible, in_block_comment = strip_line_comments_and_blocks(lines[i], in_block_comment) + s = visible.strip() + return (s == "" or s.startswith("//")) + + for i in range(len(lines)): + raw = lines[i] + visible, in_block_comment = strip_line_comments_and_blocks(raw, in_block_comment) + if in_block_comment: + continue + + is_inc = INCLUDE_RE.match(raw) is not None + if is_inc: + if block_start is None: + block_start = i + last_include = i + continue + + if block_start is not None: + if is_blank_or_comment(i): + continue + blocks.append((block_start + 1, last_include + 1)) + block_start = None + last_include = None + + if block_start is not None and last_include is not None: + blocks.append((block_start + 1, last_include + 1)) + + # merge adjacent + merged: List[Tuple[int, int]] = [] + for s, e in blocks: + if not merged or s > merged[-1][1] + 1: + merged.append((s, e)) + else: + merged[-1] = (merged[-1][0], max(merged[-1][1], e)) + return merged + +def _clang_format_ranges_if_changed(path: str, ranges: List[Tuple[int, int]]) -> str: + """ + Run clang-format once on multiple ranges, but only report 'changed' + if file content actually changed. + Returns: 'changed' | 'unchanged' | 'not-found' | 'error: ...' | 'no-op' + """ + if not ranges: + return "no-op" + if CLANG_FORMAT_EXE is None: + return "not-found" + + with open(path, "rb") as f: + before = f.read() + + cmd = [CLANG_FORMAT_EXE, "-i", "-style", "file", "--sort-includes"] + for s, e in ranges: + cmd.append(f"-lines={s}:{e}") + cmd.append(path) + + try: + subprocess.run(cmd, check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + except subprocess.CalledProcessError as e: + return f"error: clang-format failed: {e}" + + with open(path, "rb") as f: + after = f.read() + + return "changed" if after != before else "unchanged" + +def _rewrite_includes(lines: List[str], path: str, include_root: str, is_header: bool) -> bool: + """ + Normalize #include directives: + + - Headers (.hpp): + * Any quoted include becomes angle brackets. + * If the header resolves under 'include_root' (either from the current + directory or directly under include_root), rewrite token to the path + relative to 'include_root': #include + (POSIX slashes). Example: src/lib header "ConfigImpl.hpp" -> . + * Otherwise, just flip quotes to angles without touching the token. + - .cpp: + * Quoted -> angle brackets ONLY if target is NOT same-dir (exact FS check). + * Same-dir quoted includes are left as-is. + * Never modify the token content for .cpp. + """ + changed = False + in_block = False + cur_dir = os.path.dirname(path) + + for i, raw in enumerate(lines): + visible, in_block = strip_line_comments_and_blocks(raw, in_block) + if in_block: + continue + if visible.strip().startswith("//"): + continue + + m = INCLUDE_RE.match(raw) + if not m: + continue + + prefix, open_ch, token, close_ch, tail, eol = m.groups() + eol = eol or "" + token_stripped = token.strip() + + if is_header: + # Try to resolve under include_root. Prefer resolution from cur_dir if it exists, + # but the final output is always include_root-relative. + target_abs = None + cur_abs = _resolve_from(token_stripped, cur_dir) + if cur_abs and _is_path_within(cur_abs, include_root): + target_abs = cur_abs + else: + root_abs = _resolve_from(token_stripped, include_root) + if root_abs and _is_path_within(root_abs, include_root): + target_abs = root_abs + + if target_abs and _is_path_within(target_abs, include_root): + rel_from_root = _normalize_slashes(os.path.relpath(target_abs, include_root)) + new_line = f"{prefix}<{rel_from_root}>{tail}{eol}" + else: + # Could be system/external. Still convert quotes to angles per rule. + if open_ch == '"' and close_ch == '"': + new_line = f"{prefix}<{token_stripped}>{tail}{eol}" + else: + new_line = raw # already angled; leave token as-is + + if new_line != raw: + lines[i] = new_line + changed = True + continue + + # .cpp policy + if _same_dir_exists(token_stripped, cur_dir): + continue # keep same-dir quoted includes + if open_ch == '"' and close_ch == '"': + new_line = f"{prefix}<{token_stripped}>{tail}{eol}" + if new_line != raw: + lines[i] = new_line + changed = True + + return changed + +# ---------- per-file transform ---------- +def process_file(path: str, guard_base: str, guard_prefix: str, include_root: str) -> str: + """ + 1) For .hpp: If canonical guard exists AND name differs, update; otherwise leave guard as-is. + 2) For .hpp & .cpp: normalize includes per rules (using include_root). + 3) clang-format: run once per file on all include blocks; only report if bytes changed. + """ + ext = os.path.splitext(path)[1].lower() + is_header = (ext == ".hpp") + + with open(path, "r", encoding="utf-8-sig", newline="") as f: + lines = f.readlines() + if not lines: + return "empty" + + changed = False + guard_changed = False + guard_msg = None + + # Optional guard canonicalization (headers only) — only if new name differs + if is_header: + structure = detect_guard_structure(lines) + if structure is not None: + ifndef_idx, old_name, define_idx, endif_idx = structure + new_name = make_guard(path, guard_base, guard_prefix) + if old_name != new_name: + eol = detect_eol(lines[ifndef_idx]); pre = leading_ws(lines[ifndef_idx]) + new_ifndef = f"{pre}#ifndef {new_name}{eol}" + if lines[ifndef_idx] != new_ifndef: + lines[ifndef_idx] = new_ifndef; changed = True; guard_changed = True + + eol = detect_eol(lines[define_idx]); pre = leading_ws(lines[define_idx]) + new_define = f"{pre}#define {new_name}{eol}" + if lines[define_idx] != new_define: + lines[define_idx] = new_define; changed = True; guard_changed = True + + eol = detect_eol(lines[endif_idx]); pre = leading_ws(lines[endif_idx]) + new_endif = f"{pre}#endif // {new_name}{eol}" + if lines[endif_idx] != new_endif: + lines[endif_idx] = new_endif; changed = True; guard_changed = True + + if guard_changed: + guard_msg = f"guard {old_name} -> {new_name}" + + # Include normalization across whole file + inc_changed = _rewrite_includes(lines, path, include_root, is_header) + if inc_changed: + changed = True + + # If buffer changed, write prior to clang-format + if changed: + with open(path, "w", encoding="utf-8", newline="") as f: + f.writelines(lines) + + # clang-format once per file; only report if bytes changed + blocks = _detect_include_blocks(lines) + fmt_status = _clang_format_ranges_if_changed(path, blocks) + fmt_note = "" + fmt_changed = (fmt_status == "changed") + if fmt_status == "not-found": + fmt_note = " (clang-format not found)" + elif fmt_status.startswith("error"): + fmt_note = f" ({fmt_status})" + + # Reload if clang-format changed the file + if fmt_changed: + with open(path, "r", encoding="utf-8-sig", newline="") as f: + lines = f.readlines() + + # Status message + parts = [] + if guard_changed and guard_msg: + parts.append(guard_msg) + if inc_changed: + parts.append("includes normalized") + if fmt_changed: + parts.append("include blocks clang-formatted") + + if parts: + return "updated (" + "; ".join(parts) + ")" + fmt_note + return "ok" + fmt_note + +# ---------- walk requested trees ---------- +def main(): + script_dir = os.path.dirname(os.path.abspath(__file__)) + include_root_public = os.path.normpath(os.path.join(script_dir, "..", "include")) + include_root_src = os.path.normpath(os.path.join(script_dir, "..", "src")) + + targets = [ + # (guard_base, guard_prefix, include_root) + (os.path.join(script_dir, "..", "include", "mrdocs"), "MRDOCS_API_", include_root_public), + (os.path.join(script_dir, "..", "src", "lib"), "MRDOCS_LIB_", include_root_src), + (os.path.join(script_dir, "..", "src", "test"), "MRDOCS_TEST_", include_root_src), + (os.path.join(script_dir, "..", "src", "test_suite"), "MRDOCS_TEST_SUITE_", include_root_src), + (os.path.join(script_dir, "..", "src", "tool"), "MRDOCS_TOOL_", include_root_src), + ] + + grand_total = grand_updated = grand_skipped = 0 + + for base, prefix, inc_root in targets: + if not os.path.isdir(base): + print(f"[skip dir] {base} (not found)") + continue + + total = updated = skipped = 0 + print(f"\n== Processing: {base} (prefix: {prefix}; include_root: {inc_root}) ==") + for root, _, files in os.walk(base): + for fn in files: + ext = os.path.splitext(fn)[1].lower() + if ext not in PROCESS_EXTS: + continue + total += 1 + path = os.path.join(root, fn) + try: + result = process_file(path, base, prefix, inc_root) + except Exception as e: + result = f"skipped (error: {e})" + if result.startswith("updated"): + updated += 1 + elif result.startswith("skipped"): + skipped += 1 + print(f"{os.path.relpath(path, base)}: {result}") + + grand_total += total + grand_updated += updated + grand_skipped += skipped + print(f"-- Dir summary: {total} files, {updated} updated, {skipped} skipped.") + + print(f"\nAll done. {grand_total} files total, {grand_updated} updated, {grand_skipped} skipped.") + +if __name__ == "__main__": + main() From 47464ad847ab871bbf4bd305afa717da5b407940 Mon Sep 17 00:00:00 2001 From: Alan de Freitas Date: Wed, 24 Sep 2025 02:29:38 -0500 Subject: [PATCH 04/23] build: bootstrap enables libcxx hardening mode --- CMakeUserPresets.json.example | 12 +++++++----- bootstrap.py | 16 ++++++++++++++++ 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/CMakeUserPresets.json.example b/CMakeUserPresets.json.example index a555db542..e04454a03 100644 --- a/CMakeUserPresets.json.example +++ b/CMakeUserPresets.json.example @@ -133,7 +133,8 @@ "MRDOCS_BUILD_DOCS": false, "MRDOCS_GENERATE_REFERENCE": false, "MRDOCS_GENERATE_ANTORA_REFERENCE": false, - "CMAKE_MAKE_PROGRAM": "${sourceDir}/build/third-party/ninja/ninja" + "CMAKE_MAKE_PROGRAM": "${sourceDir}/build/third-party/ninja/ninja", + "CMAKE_CXX_FLAGS": "-D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_EXTENSIVE" }, "condition": { "type": "equals", @@ -163,7 +164,8 @@ "MRDOCS_BUILD_DOCS": false, "MRDOCS_GENERATE_REFERENCE": false, "MRDOCS_GENERATE_ANTORA_REFERENCE": false, - "CMAKE_MAKE_PROGRAM": "${sourceDir}/build/third-party/ninja/ninja" + "CMAKE_MAKE_PROGRAM": "${sourceDir}/build/third-party/ninja/ninja", + "CMAKE_CXX_FLAGS": "-D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_EXTENSIVE" }, "warnings": { "unusedCli": false @@ -360,9 +362,9 @@ "Clang_ROOT": "${sourceDir}/build/third-party/llvm-project/install/debug-clang-asan", "duktape_ROOT": "${sourceDir}/build/third-party/duktape/install/debug-clang-asan", "Duktape_ROOT": "${sourceDir}/build/third-party/duktape/install/debug-clang-asan", - "libxml2_ROOT": "", - "LibXml2_ROOT": "", - "MRDOCS_BUILD_TESTS": false, + "libxml2_ROOT": "${sourceDir}/build/third-party/libxml2/install/release-clang", + "LibXml2_ROOT": "${sourceDir}/build/third-party/libxml2/install/release-clang", + "MRDOCS_BUILD_TESTS": true, "MRDOCS_BUILD_DOCS": false, "MRDOCS_GENERATE_REFERENCE": false, "MRDOCS_GENERATE_ANTORA_REFERENCE": false, diff --git a/bootstrap.py b/bootstrap.py index 7a5f8c5bd..face0b58f 100644 --- a/bootstrap.py +++ b/bootstrap.py @@ -1412,6 +1412,22 @@ def create_cmake_presets(self): if cxx_flags: new_preset["cacheVariables"]['CMAKE_CXX_FLAGS'] = cxx_flags.strip() + # if build type is debug and compiler is clang (default macos or explicitly clang), + # add "CMAKE_CXX_FLAGS": "-D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_EXTENSIVE" + # or append it to existing CMAKE_CXX_FLAGS + if self.options.mrdocs_build_type.lower() == "debug": + is_clang = False + if self.options.cxx and "clang" in os.path.basename(self.options.cxx).lower(): + is_clang = True + elif "CMAKE_CXX_COMPILER_ID" in self.compiler_info and self.compiler_info["CMAKE_CXX_COMPILER_ID"].lower() == "clang": + is_clang = True + if is_clang: + hardening_flag = "-D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_EXTENSIVE" + if "CMAKE_CXX_FLAGS" in new_preset["cacheVariables"]: + new_preset["cacheVariables"]["CMAKE_CXX_FLAGS"] += " " + hardening_flag + else: + new_preset["cacheVariables"]["CMAKE_CXX_FLAGS"] = hardening_flag + if self.is_windows(): if self.options.python_path: new_preset["cacheVariables"]["PYTHON_EXECUTABLE"] = self.options.python_path From e926ee90e03af557195904eaf5356055f7d49e19 Mon Sep 17 00:00:00 2001 From: Alan de Freitas Date: Wed, 24 Sep 2025 17:53:51 -0500 Subject: [PATCH 05/23] refactor: split base and derived classes Split base and derived classes into their own headers to remove circular dependencies in the code. --- CMakeLists.txt | 4 +- docs/modules/ROOT/pages/contribute.adoc | 11 + include/mrdocs/ADT/Nullable.hpp | 9 +- include/mrdocs/ADT/Polymorphic.hpp | 39 +- include/mrdocs/ADT/UnorderedStringMap.hpp | 4 +- include/mrdocs/Config.hpp | 4 +- .../mrdocs/Config/ReferenceDirectories.hpp | 6 +- include/mrdocs/Corpus.hpp | 4 +- include/mrdocs/Dom.hpp | 2 +- include/mrdocs/Dom/LazyArray.hpp | 8 +- include/mrdocs/Dom/LazyObject.hpp | 6 +- include/mrdocs/Dom/String.hpp | 2 +- include/mrdocs/Dom/Value.hpp | 8 +- include/mrdocs/Generator.hpp | 2 +- include/mrdocs/Generators.hpp | 4 +- include/mrdocs/Metadata.hpp | 12 +- include/mrdocs/Metadata/DomCorpus.hpp | 6 +- include/mrdocs/Metadata/Info.hpp | 296 +-- include/mrdocs/Metadata/Info/Concept.hpp | 13 +- include/mrdocs/Metadata/Info/Enum.hpp | 13 +- include/mrdocs/Metadata/Info/EnumConstant.hpp | 8 +- .../Metadata/{ => Info}/ExtractionMode.hpp | 6 +- include/mrdocs/Metadata/Info/Friend.hpp | 10 +- include/mrdocs/Metadata/Info/Function.hpp | 151 +- .../mrdocs/Metadata/Info/FunctionClass.hpp | 53 + include/mrdocs/Metadata/Info/Guide.hpp | 14 +- include/mrdocs/Metadata/Info/InfoBase.hpp | 277 +++ include/mrdocs/Metadata/Info/InfoKind.hpp | 60 + include/mrdocs/Metadata/Info/Namespace.hpp | 10 +- .../mrdocs/Metadata/Info/NamespaceAlias.hpp | 10 +- include/mrdocs/Metadata/Info/Overloads.hpp | 8 +- include/mrdocs/Metadata/Info/Param.hpp | 74 + include/mrdocs/Metadata/Info/Record.hpp | 270 +-- include/mrdocs/Metadata/Info/RecordBase.hpp | 52 + .../mrdocs/Metadata/Info/RecordInterface.hpp | 121 ++ .../mrdocs/Metadata/Info/RecordKeyKind.hpp | 49 + .../mrdocs/Metadata/Info/RecordTranche.hpp | 121 ++ include/mrdocs/Metadata/{ => Info}/Source.hpp | 6 +- .../mrdocs/Metadata/{ => Info}/SymbolID.hpp | 12 +- include/mrdocs/Metadata/Info/Typedef.hpp | 12 +- include/mrdocs/Metadata/Info/Using.hpp | 14 +- include/mrdocs/Metadata/Info/Variable.hpp | 16 +- include/mrdocs/Metadata/Javadoc.hpp | 1855 +---------------- include/mrdocs/Metadata/Javadoc/Block.hpp | 136 ++ .../Metadata/Javadoc/Block/Admonish.hpp | 59 + .../Metadata/Javadoc/Block/Admonition.hpp | 89 + .../Metadata/Javadoc/Block/BlockBase.hpp | 146 ++ .../mrdocs/Metadata/Javadoc/Block/Brief.hpp | 98 + .../mrdocs/Metadata/Javadoc/Block/Code.hpp | 80 + .../mrdocs/Metadata/Javadoc/Block/Heading.hpp | 80 + .../Metadata/Javadoc/Block/ListItem.hpp | 88 + .../Metadata/Javadoc/Block/Paragraph.hpp | 85 + .../mrdocs/Metadata/Javadoc/Block/Param.hpp | 116 ++ .../Metadata/Javadoc/Block/ParamDirection.hpp | 55 + .../Metadata/Javadoc/Block/Postcondition.hpp | 85 + .../Metadata/Javadoc/Block/Precondition.hpp | 85 + .../mrdocs/Metadata/Javadoc/Block/Returns.hpp | 100 + include/mrdocs/Metadata/Javadoc/Block/See.hpp | 81 + .../mrdocs/Metadata/Javadoc/Block/TParam.hpp | 81 + .../mrdocs/Metadata/Javadoc/Block/Throws.hpp | 88 + .../Metadata/Javadoc/Block/UnorderedList.hpp | 112 + include/mrdocs/Metadata/Javadoc/Node.hpp | 160 ++ .../mrdocs/Metadata/Javadoc/Node/NodeBase.hpp | 93 + .../mrdocs/Metadata/Javadoc/Node/NodeKind.hpp | 132 ++ include/mrdocs/Metadata/Javadoc/Text.hpp | 122 ++ .../Metadata/Javadoc/Text/CopyDetails.hpp | 80 + include/mrdocs/Metadata/Javadoc/Text/Link.hpp | 82 + .../mrdocs/Metadata/Javadoc/Text/Parts.hpp | 57 + .../Metadata/Javadoc/Text/Reference.hpp | 89 + .../mrdocs/Metadata/Javadoc/Text/Style.hpp | 58 + .../mrdocs/Metadata/Javadoc/Text/Styled.hpp | 82 + .../mrdocs/Metadata/Javadoc/Text/TextBase.hpp | 100 + include/mrdocs/Metadata/Name.hpp | 158 +- .../Metadata/Name/IdentifierNameInfo.hpp | 48 + include/mrdocs/Metadata/Name/NameBase.hpp | 105 + include/mrdocs/Metadata/Name/NameKind.hpp | 43 + .../Metadata/Name/SpecializationNameInfo.hpp | 53 + include/mrdocs/Metadata/Specifiers.hpp | 393 +--- .../mrdocs/Metadata/Specifiers/AccessKind.hpp | 62 + .../Metadata/Specifiers/ConstexprKind.hpp | 54 + .../Metadata/Specifiers/ExplicitInfo.hpp | 75 + .../Metadata/Specifiers/ExplicitKind.hpp | 42 + .../Metadata/Specifiers/NoexceptInfo.hpp | 74 + .../Metadata/Specifiers/NoexceptKind.hpp | 42 + .../Metadata/Specifiers/OperatorKind.hpp | 206 ++ .../Metadata/Specifiers/ReferenceKind.hpp | 49 + .../Metadata/Specifiers/StorageClassKind.hpp | 61 + include/mrdocs/Metadata/TArg.hpp | 77 + include/mrdocs/Metadata/TArg/NonTypeTArg.hpp | 34 + include/mrdocs/Metadata/TArg/TArgBase.hpp | 78 + include/mrdocs/Metadata/TArg/TArgKind.hpp | 51 + include/mrdocs/Metadata/TArg/TemplateTArg.hpp | 38 + include/mrdocs/Metadata/TArg/TypeTArg.hpp | 34 + include/mrdocs/Metadata/TParam.hpp | 85 + .../mrdocs/Metadata/TParam/NonTypeTParam.hpp | 36 + include/mrdocs/Metadata/TParam/TParamBase.hpp | 86 + .../mrdocs/Metadata/TParam/TParamKeyKind.hpp | 48 + include/mrdocs/Metadata/TParam/TParamKind.hpp | 36 + .../mrdocs/Metadata/TParam/TemplateTParam.hpp | 36 + include/mrdocs/Metadata/TParam/TypeTParam.hpp | 40 + include/mrdocs/Metadata/Template.hpp | 359 +--- include/mrdocs/Metadata/Type.hpp | 548 +---- .../mrdocs/Metadata/Type/ArrayTypeInfo.hpp | 33 + include/mrdocs/Metadata/Type/AutoKind.hpp | 47 + include/mrdocs/Metadata/Type/AutoTypeInfo.hpp | 34 + .../mrdocs/Metadata/Type/DecltypeTypeInfo.hpp | 29 + .../mrdocs/Metadata/Type/FunctionTypeInfo.hpp | 37 + .../Metadata/Type/FundamentalTypeKind.hpp | 196 ++ .../Metadata/Type/LValueReferenceTypeInfo.hpp | 32 + .../Metadata/Type/MemberPointerTypeInfo.hpp | 33 + .../mrdocs/Metadata/Type/NamedTypeInfo.hpp | 38 + .../mrdocs/Metadata/Type/PointerTypeInfo.hpp | 31 + .../mrdocs/Metadata/Type/QualifierKind.hpp | 55 + .../Metadata/Type/RValueReferenceTypeInfo.hpp | 31 + include/mrdocs/Metadata/Type/TypeBase.hpp | 125 ++ include/mrdocs/Metadata/Type/TypeKind.hpp | 57 + include/mrdocs/Platform.hpp | 2 +- include/mrdocs/Support/Algorithm.hpp | 2 +- include/mrdocs/Support/Error.hpp | 4 +- include/mrdocs/Support/ExecutorGroup.hpp | 2 +- include/mrdocs/Support/Expected.hpp | 6 +- include/mrdocs/Support/Glob.hpp | 6 +- include/mrdocs/Support/Handlebars.hpp | 10 +- include/mrdocs/Support/JavaScript.hpp | 2 +- include/mrdocs/Support/Lua.hpp | 12 +- include/mrdocs/Support/Report.hpp | 6 +- include/mrdocs/Support/ThreadPool.hpp | 8 +- include/mrdocs/Support/TypeTraits.hpp | 6 +- include/mrdocs/Support/Visitor.hpp | 8 +- include/mrdocs/Support/source_location.hpp | 4 +- src/lib/AST/ASTAction.cpp | 8 +- src/lib/AST/ASTAction.hpp | 11 +- src/lib/AST/ASTVisitor.cpp | 101 +- src/lib/AST/ASTVisitor.hpp | 14 +- src/lib/AST/ASTVisitorConsumer.cpp | 6 +- src/lib/AST/ASTVisitorConsumer.hpp | 8 +- src/lib/AST/ClangHelpers.cpp | 4 +- src/lib/AST/ClangHelpers.hpp | 17 +- src/lib/AST/FrontendActionFactory.cpp | 2 +- src/lib/AST/FrontendActionFactory.hpp | 8 +- src/lib/AST/MissingSymbolSink.hpp | 24 +- src/lib/AST/MrDocsFileSystem.hpp | 20 +- src/lib/AST/NameInfoBuilder.cpp | 30 +- src/lib/AST/NameInfoBuilder.hpp | 13 +- src/lib/AST/ParseJavadoc.cpp | 19 +- src/lib/AST/ParseJavadoc.hpp | 4 +- src/lib/AST/ParseRef.cpp | 102 +- src/lib/AST/ParseRef.hpp | 10 +- src/lib/AST/TypeInfoBuilder.cpp | 74 +- src/lib/AST/TypeInfoBuilder.hpp | 14 +- src/lib/ConfigImpl.cpp | 6 +- src/lib/ConfigImpl.hpp | 4 +- src/lib/Corpus.cpp | 2 +- src/lib/CorpusImpl.cpp | 62 +- src/lib/CorpusImpl.hpp | 18 +- src/lib/Diagnostics.hpp | 10 +- src/lib/Dom/Object.cpp | 4 +- src/lib/Dom/String.cpp | 2 +- src/lib/Dom/Value.cpp | 2 +- src/lib/Gen/adoc/AdocGenerator.hpp | 2 +- src/lib/Gen/hbs/Builder.cpp | 6 +- src/lib/Gen/hbs/Builder.hpp | 6 +- src/lib/Gen/hbs/HandlebarsCorpus.cpp | 4 +- src/lib/Gen/hbs/HandlebarsCorpus.hpp | 6 +- src/lib/Gen/hbs/HandlebarsGenerator.cpp | 12 +- src/lib/Gen/hbs/HandlebarsGenerator.hpp | 2 +- src/lib/Gen/hbs/MultiPageVisitor.cpp | 2 +- src/lib/Gen/hbs/MultiPageVisitor.hpp | 6 +- src/lib/Gen/hbs/SinglePageVisitor.hpp | 2 +- src/lib/Gen/hbs/TagfileWriter.cpp | 28 +- src/lib/Gen/hbs/TagfileWriter.hpp | 11 +- src/lib/Gen/hbs/VisitorHelpers.cpp | 13 +- src/lib/Gen/hbs/VisitorHelpers.hpp | 3 +- src/lib/Gen/html/HTMLGenerator.hpp | 2 +- src/lib/Gen/xml/CXXTags.cpp | 2 +- src/lib/Gen/xml/CXXTags.hpp | 160 +- src/lib/Gen/xml/XMLGenerator.cpp | 6 +- src/lib/Gen/xml/XMLTags.cpp | 2 +- src/lib/Gen/xml/XMLTags.hpp | 12 +- src/lib/Gen/xml/XMLWriter.cpp | 37 +- src/lib/Gen/xml/XMLWriter.hpp | 6 +- src/lib/Metadata/DomCorpus.cpp | 10 +- .../Finalizers/BaseMembersFinalizer.cpp | 4 +- .../Finalizers/BaseMembersFinalizer.hpp | 10 +- .../Metadata/Finalizers/DerivedFinalizer.cpp | 9 +- .../Metadata/Finalizers/DerivedFinalizer.hpp | 10 +- .../Metadata/Finalizers/Javadoc/Function.hpp | 98 +- .../Metadata/Finalizers/Javadoc/Overloads.hpp | 12 +- .../Metadata/Finalizers/JavadocFinalizer.cpp | 96 +- .../Metadata/Finalizers/JavadocFinalizer.hpp | 33 +- .../Finalizers/NamespacesFinalizer.hpp | 10 +- .../Finalizers/OverloadsFinalizer.cpp | 7 +- .../Finalizers/OverloadsFinalizer.hpp | 10 +- .../Finalizers/SortMembersFinalizer.cpp | 16 +- .../Finalizers/SortMembersFinalizer.hpp | 10 +- src/lib/Metadata/Info.cpp | 10 +- src/lib/Metadata/Info/Concept.cpp | 2 +- src/lib/Metadata/Info/Enum.cpp | 2 +- src/lib/Metadata/Info/EnumConstant.cpp | 2 +- src/lib/Metadata/Info/Friend.cpp | 2 +- src/lib/Metadata/Info/Function.cpp | 2 +- src/lib/Metadata/Info/Guide.cpp | 14 +- src/lib/Metadata/Info/Namespace.cpp | 2 +- src/lib/Metadata/Info/NamespaceAlias.cpp | 2 +- src/lib/Metadata/Info/Overloads.cpp | 8 +- src/lib/Metadata/Info/Record.cpp | 7 +- src/lib/Metadata/Info/Typedef.cpp | 4 +- src/lib/Metadata/Info/Using.cpp | 5 +- src/lib/Metadata/Info/Variable.cpp | 2 +- src/lib/Metadata/InfoSet.hpp | 10 +- src/lib/Metadata/Javadoc.cpp | 20 +- src/lib/Metadata/Name.cpp | 45 +- src/lib/Metadata/Source.cpp | 4 +- src/lib/Metadata/Specifiers.cpp | 4 +- src/lib/Metadata/SymbolID.cpp | 6 +- src/lib/Metadata/Template.cpp | 29 +- src/lib/Metadata/Type.cpp | 37 +- src/lib/MrDocsCompilationDatabase.cpp | 12 +- src/lib/MrDocsCompilationDatabase.hpp | 6 +- src/lib/MrDocsSettingsDB.hpp | 2 +- src/lib/Support/Assert.cpp | 4 +- src/lib/Support/CMakeExecution.cpp | 3 +- src/lib/Support/CMakeExecution.hpp | 6 +- src/lib/Support/Debug.cpp | 10 +- src/lib/Support/Debug.hpp | 12 +- src/lib/Support/ExecuteAndWaitWithLogging.cpp | 4 +- src/lib/Support/ExecuteAndWaitWithLogging.hpp | 6 +- src/lib/Support/ExecutionContext.cpp | 4 +- src/lib/Support/ExecutionContext.hpp | 12 +- src/lib/Support/Generator.cpp | 8 +- src/lib/Support/GeneratorsImpl.hpp | 2 +- src/lib/Support/Glob.cpp | 6 +- src/lib/Support/Handlebars.cpp | 4 +- src/lib/Support/JavaScript.cpp | 8 +- src/lib/Support/LegibleNames.cpp | 12 +- src/lib/Support/LegibleNames.hpp | 2 +- src/lib/Support/Lua.cpp | 9 +- src/lib/Support/LuaHandlebars.hpp | 6 +- src/lib/Support/Radix.cpp | 4 +- src/lib/Support/Report.cpp | 18 +- src/lib/Support/Report.hpp | 12 +- src/lib/Support/Yaml.cpp | 4 +- src/lib/lua.cpp | 68 +- src/test/ADT/Optional.cpp | 2 +- src/test/ADT/Polymorphic.cpp | 142 +- src/test/Support/JavaScript.cpp | 4 +- src/test/TestArgs.hpp | 2 +- src/test/TestMain.cpp | 12 +- src/test/TestRunner.cpp | 22 +- src/test/TestRunner.hpp | 4 +- src/test/lib/AST/ParseRef.cpp | 2 +- src/test/lib/Dom/Dom.cpp | 2 +- src/test/lib/Support/Handlebars.cpp | 10 +- src/test/lib/Support/Path.cpp | 2 +- src/test_suite/detail/decomposer.cpp | 2 +- src/test_suite/detail/decomposer.hpp | 6 +- src/test_suite/diff.hpp | 6 +- src/test_suite/test_suite.cpp | 1 - src/test_suite/test_suite.hpp | 8 +- src/tool/CompilerInfo.cpp | 3 +- src/tool/CompilerInfo.hpp | 13 +- src/tool/GenerateAction.cpp | 10 +- src/tool/ToolArgs.cpp | 4 +- src/tool/ToolArgs.hpp | 4 +- src/tool/ToolCompilationDatabase.cpp | 6 +- src/tool/ToolCompilationDatabase.hpp | 10 +- src/tool/ToolMain.cpp | 6 +- .../symbols/concept/requires-clause.cpp | 6 +- .../symbols/concept/requires-clause.xml | 6 +- 269 files changed, 7391 insertions(+), 4919 deletions(-) rename include/mrdocs/Metadata/{ => Info}/ExtractionMode.hpp (95%) create mode 100644 include/mrdocs/Metadata/Info/FunctionClass.hpp create mode 100644 include/mrdocs/Metadata/Info/InfoBase.hpp create mode 100644 include/mrdocs/Metadata/Info/InfoKind.hpp create mode 100644 include/mrdocs/Metadata/Info/Param.hpp create mode 100644 include/mrdocs/Metadata/Info/RecordBase.hpp create mode 100644 include/mrdocs/Metadata/Info/RecordInterface.hpp create mode 100644 include/mrdocs/Metadata/Info/RecordKeyKind.hpp create mode 100644 include/mrdocs/Metadata/Info/RecordTranche.hpp rename include/mrdocs/Metadata/{ => Info}/Source.hpp (97%) rename include/mrdocs/Metadata/{ => Info}/SymbolID.hpp (97%) create mode 100644 include/mrdocs/Metadata/Javadoc/Block.hpp create mode 100644 include/mrdocs/Metadata/Javadoc/Block/Admonish.hpp create mode 100644 include/mrdocs/Metadata/Javadoc/Block/Admonition.hpp create mode 100644 include/mrdocs/Metadata/Javadoc/Block/BlockBase.hpp create mode 100644 include/mrdocs/Metadata/Javadoc/Block/Brief.hpp create mode 100644 include/mrdocs/Metadata/Javadoc/Block/Code.hpp create mode 100644 include/mrdocs/Metadata/Javadoc/Block/Heading.hpp create mode 100644 include/mrdocs/Metadata/Javadoc/Block/ListItem.hpp create mode 100644 include/mrdocs/Metadata/Javadoc/Block/Paragraph.hpp create mode 100644 include/mrdocs/Metadata/Javadoc/Block/Param.hpp create mode 100644 include/mrdocs/Metadata/Javadoc/Block/ParamDirection.hpp create mode 100644 include/mrdocs/Metadata/Javadoc/Block/Postcondition.hpp create mode 100644 include/mrdocs/Metadata/Javadoc/Block/Precondition.hpp create mode 100644 include/mrdocs/Metadata/Javadoc/Block/Returns.hpp create mode 100644 include/mrdocs/Metadata/Javadoc/Block/See.hpp create mode 100644 include/mrdocs/Metadata/Javadoc/Block/TParam.hpp create mode 100644 include/mrdocs/Metadata/Javadoc/Block/Throws.hpp create mode 100644 include/mrdocs/Metadata/Javadoc/Block/UnorderedList.hpp create mode 100644 include/mrdocs/Metadata/Javadoc/Node.hpp create mode 100644 include/mrdocs/Metadata/Javadoc/Node/NodeBase.hpp create mode 100644 include/mrdocs/Metadata/Javadoc/Node/NodeKind.hpp create mode 100644 include/mrdocs/Metadata/Javadoc/Text.hpp create mode 100644 include/mrdocs/Metadata/Javadoc/Text/CopyDetails.hpp create mode 100644 include/mrdocs/Metadata/Javadoc/Text/Link.hpp create mode 100644 include/mrdocs/Metadata/Javadoc/Text/Parts.hpp create mode 100644 include/mrdocs/Metadata/Javadoc/Text/Reference.hpp create mode 100644 include/mrdocs/Metadata/Javadoc/Text/Style.hpp create mode 100644 include/mrdocs/Metadata/Javadoc/Text/Styled.hpp create mode 100644 include/mrdocs/Metadata/Javadoc/Text/TextBase.hpp create mode 100644 include/mrdocs/Metadata/Name/IdentifierNameInfo.hpp create mode 100644 include/mrdocs/Metadata/Name/NameBase.hpp create mode 100644 include/mrdocs/Metadata/Name/NameKind.hpp create mode 100644 include/mrdocs/Metadata/Name/SpecializationNameInfo.hpp create mode 100644 include/mrdocs/Metadata/Specifiers/AccessKind.hpp create mode 100644 include/mrdocs/Metadata/Specifiers/ConstexprKind.hpp create mode 100644 include/mrdocs/Metadata/Specifiers/ExplicitInfo.hpp create mode 100644 include/mrdocs/Metadata/Specifiers/ExplicitKind.hpp create mode 100644 include/mrdocs/Metadata/Specifiers/NoexceptInfo.hpp create mode 100644 include/mrdocs/Metadata/Specifiers/NoexceptKind.hpp create mode 100644 include/mrdocs/Metadata/Specifiers/OperatorKind.hpp create mode 100644 include/mrdocs/Metadata/Specifiers/ReferenceKind.hpp create mode 100644 include/mrdocs/Metadata/Specifiers/StorageClassKind.hpp create mode 100644 include/mrdocs/Metadata/TArg.hpp create mode 100644 include/mrdocs/Metadata/TArg/NonTypeTArg.hpp create mode 100644 include/mrdocs/Metadata/TArg/TArgBase.hpp create mode 100644 include/mrdocs/Metadata/TArg/TArgKind.hpp create mode 100644 include/mrdocs/Metadata/TArg/TemplateTArg.hpp create mode 100644 include/mrdocs/Metadata/TArg/TypeTArg.hpp create mode 100644 include/mrdocs/Metadata/TParam.hpp create mode 100644 include/mrdocs/Metadata/TParam/NonTypeTParam.hpp create mode 100644 include/mrdocs/Metadata/TParam/TParamBase.hpp create mode 100644 include/mrdocs/Metadata/TParam/TParamKeyKind.hpp create mode 100644 include/mrdocs/Metadata/TParam/TParamKind.hpp create mode 100644 include/mrdocs/Metadata/TParam/TemplateTParam.hpp create mode 100644 include/mrdocs/Metadata/TParam/TypeTParam.hpp create mode 100644 include/mrdocs/Metadata/Type/ArrayTypeInfo.hpp create mode 100644 include/mrdocs/Metadata/Type/AutoKind.hpp create mode 100644 include/mrdocs/Metadata/Type/AutoTypeInfo.hpp create mode 100644 include/mrdocs/Metadata/Type/DecltypeTypeInfo.hpp create mode 100644 include/mrdocs/Metadata/Type/FunctionTypeInfo.hpp create mode 100644 include/mrdocs/Metadata/Type/FundamentalTypeKind.hpp create mode 100644 include/mrdocs/Metadata/Type/LValueReferenceTypeInfo.hpp create mode 100644 include/mrdocs/Metadata/Type/MemberPointerTypeInfo.hpp create mode 100644 include/mrdocs/Metadata/Type/NamedTypeInfo.hpp create mode 100644 include/mrdocs/Metadata/Type/PointerTypeInfo.hpp create mode 100644 include/mrdocs/Metadata/Type/QualifierKind.hpp create mode 100644 include/mrdocs/Metadata/Type/RValueReferenceTypeInfo.hpp create mode 100644 include/mrdocs/Metadata/Type/TypeBase.hpp create mode 100644 include/mrdocs/Metadata/Type/TypeKind.hpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 9631325e8..9d2537463 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -321,7 +321,9 @@ target_include_directories(mrdocs-core "$" PRIVATE "${PROJECT_SOURCE_DIR}/src" - "${PROJECT_BINARY_DIR}/src") + "${PROJECT_BINARY_DIR}/src" + "${PROJECT_SOURCE_DIR}/third-party/lua/src" +) target_compile_definitions( mrdocs-core PUBLIC diff --git a/docs/modules/ROOT/pages/contribute.adoc b/docs/modules/ROOT/pages/contribute.adoc index 364844d64..b9eba5be6 100644 --- a/docs/modules/ROOT/pages/contribute.adoc +++ b/docs/modules/ROOT/pages/contribute.adoc @@ -46,6 +46,15 @@ Thus, after the command line and configuration file options are parsed, they are As a last step, `DoGenerateAction` converts the public `Config` settings into a `ConfigImpl` object, which is used by the rest of the program with the parsed options. +[#representing_symbols] +== Representing Symbols + +MrDocs has many categories of objects, where we utilize polymorphism with a fixed set of valid derived types, including Symbols (functions, classes, and enums), Javadoc blocks, template parameters, template arguments, and data types. For each such family, we follow a consistent file layout. Most of these families are defined in the `mrdocs/Metadata` directory. + +Each base class is defined in its own header and, when necessary, implementation file. Each derived class also has its own header and implementation file. Finally, there is a single aggregator header file that includes all the derived headers. This file centralizes logic that requires knowledge of the full set of variants, such as visitors, comparison operators, and other operations that depend on the discriminator. + +This pattern keeps the individual derived types self-contained while making cross-variant operations explicit and localized. When adding a new derived type, contributors should create its header and source file alongside the existing ones and update the corresponding aggregator file to register the new variant. This keeps the codebase predictable, avoids scattering logic, and ensures that operations over polymorphic families remain easy to find and maintain. + [#extract_symbols] === Extracting Symbols @@ -201,6 +210,8 @@ This directory contains build scripts and configuration files for third-party li ** `third-party/duktape/`—CMake scripts for Duktape ** `third-party/lua/`—A bundled Lua interpreter +== Polymorphism + == Coding Standards === Paths diff --git a/include/mrdocs/ADT/Nullable.hpp b/include/mrdocs/ADT/Nullable.hpp index bca755b80..bd5038402 100644 --- a/include/mrdocs/ADT/Nullable.hpp +++ b/include/mrdocs/ADT/Nullable.hpp @@ -13,12 +13,11 @@ #define MRDOCS_API_ADT_NULLABLE_HPP #include - +#include +#include +#include #include #include -#include -#include -#include namespace clang::mrdocs { @@ -315,4 +314,4 @@ null_of() noexcept(noexcept(nullable_traits::null())) } // clang::mrdocs -#endif +#endif // MRDOCS_API_ADT_NULLABLE_HPP diff --git a/include/mrdocs/ADT/Polymorphic.hpp b/include/mrdocs/ADT/Polymorphic.hpp index 9273c1e1f..ee5d33a8c 100644 --- a/include/mrdocs/ADT/Polymorphic.hpp +++ b/include/mrdocs/ADT/Polymorphic.hpp @@ -12,9 +12,9 @@ #ifndef MRDOCS_API_ADT_POLYMORPHIC_HPP #define MRDOCS_API_ADT_POLYMORPHIC_HPP -#include -#include #include +#include +#include #include namespace clang::mrdocs { @@ -26,9 +26,7 @@ namespace clang::mrdocs { It implements a tweaked version of std::polymorphic, based on the reference implementation for P3019R14. Differences are: - * It supports nullability, which was originally supported in P3019 through - std::optional specializations, but was later removed from the paper. - * It implements comparison operators with a very project specific design. + * It implements comparison operators with a very project-specific design. * Fixed allocator, not parametrizable. * No initializer_list constructor. @@ -37,13 +35,14 @@ namespace clang::mrdocs { To copy polymorphic objects, the class uses the copy constructor of the owned derived-type object when copying to another value. - Similarly, to allow correct destruction of + Similarly, to allow the correct destruction of derived objects, it uses the destructor of the owned derived-type object in the destructor. */ template class Polymorphic { + // Base class for type-erasure. struct WrapperBase { virtual constexpr ~WrapperBase() = default; virtual T& getValue() = 0; @@ -61,7 +60,8 @@ class Polymorphic { constexpr WrapperBase* clone() override { return new Wrapper(Value); } }; - WrapperBase* WB; // nullptr only when constructed/reset by nullable_traits + // nullptr only when constructed/reset by nullable_traits + WrapperBase* WB = nullptr; // Private null token and constructor: only the friend traits can call this. struct _null_t { explicit constexpr _null_t(int) {} }; @@ -70,15 +70,15 @@ class Polymorphic { // Allow the traits specialization to access private members/ctors. friend struct nullable_traits>; -// std::polymorphic has a default constructor that -// default-constructs the base type T if it's default-constructible. -// We disable this constructor because this is always an error -// in MrDocs. -// constexpr explicit Polymorphic() -// requires std::is_default_constructible_v -// && std::is_copy_constructible_v -// : WB(new Wrapper()) -// {} + // std::polymorphic has a default constructor that + // default-constructs the base type T if it's default-constructible. + // We disable this constructor because this is always an error + // in MrDocs. + // constexpr explicit Polymorphic() + // requires std::is_default_constructible_v + // && std::is_copy_constructible_v + // : WB(new Wrapper()) + // {} public: using value_type = T; @@ -96,7 +96,10 @@ class Polymorphic { std::derived_from, T> : WB(new Wrapper>(std::forward(u))) {} - /** In-place constructor for a specific derived U. */ + /** In-place constructor for a specific derived U. + + @param ts Arguments to forward to U's constructor. + */ template explicit constexpr Polymorphic(std::in_place_type_t, Ts&&... ts) requires std::same_as, U> && @@ -288,4 +291,4 @@ struct nullable_traits> } // namespace clang::mrdocs -#endif +#endif // MRDOCS_API_ADT_POLYMORPHIC_HPP diff --git a/include/mrdocs/ADT/UnorderedStringMap.hpp b/include/mrdocs/ADT/UnorderedStringMap.hpp index 71c086c59..557af2950 100644 --- a/include/mrdocs/ADT/UnorderedStringMap.hpp +++ b/include/mrdocs/ADT/UnorderedStringMap.hpp @@ -12,8 +12,8 @@ #ifndef MRDOCS_API_ADT_UNORDEREDSTRINGMAP_HPP #define MRDOCS_API_ADT_UNORDEREDSTRINGMAP_HPP -#include #include +#include namespace clang::mrdocs { @@ -34,4 +34,4 @@ using UnorderedStringMultiMap = std::unordered_multimap -#include #include #include +#include #include #include #include @@ -225,4 +225,4 @@ class MRDOCS_DECL } // mrdocs } // clang -#endif +#endif // MRDOCS_API_CONFIG_HPP diff --git a/include/mrdocs/Config/ReferenceDirectories.hpp b/include/mrdocs/Config/ReferenceDirectories.hpp index 2e8e61665..c3bc626e3 100644 --- a/include/mrdocs/Config/ReferenceDirectories.hpp +++ b/include/mrdocs/Config/ReferenceDirectories.hpp @@ -9,8 +9,8 @@ // Official repository: https://github.com/cppalliance/mrdocs // -#ifndef MRDOCS_API_CONFIG_REFERENCE_DIRECTORIES_HPP -#define MRDOCS_API_CONFIG_REFERENCE_DIRECTORIES_HPP +#ifndef MRDOCS_API_CONFIG_REFERENCEDIRECTORIES_HPP +#define MRDOCS_API_CONFIG_REFERENCEDIRECTORIES_HPP #include @@ -34,4 +34,4 @@ struct ReferenceDirectories } // mrdocs } // clang -#endif +#endif // MRDOCS_API_CONFIG_REFERENCEDIRECTORIES_HPP diff --git a/include/mrdocs/Corpus.hpp b/include/mrdocs/Corpus.hpp index d50ee6e35..2244039b2 100644 --- a/include/mrdocs/Corpus.hpp +++ b/include/mrdocs/Corpus.hpp @@ -17,11 +17,11 @@ #include #include #include +#include #include #include #include #include -#include namespace clang::mrdocs { @@ -500,4 +500,4 @@ getParents(Corpus const& C, Info const& I); } // clang::mrdocs -#endif +#endif // MRDOCS_API_CORPUS_HPP diff --git a/include/mrdocs/Dom.hpp b/include/mrdocs/Dom.hpp index 87b0309ad..edf7ac264 100644 --- a/include/mrdocs/Dom.hpp +++ b/include/mrdocs/Dom.hpp @@ -13,4 +13,4 @@ #include -#endif +#endif // MRDOCS_API_DOM_HPP diff --git a/include/mrdocs/Dom/LazyArray.hpp b/include/mrdocs/Dom/LazyArray.hpp index 06a445bbe..a787ed63f 100644 --- a/include/mrdocs/Dom/LazyArray.hpp +++ b/include/mrdocs/Dom/LazyArray.hpp @@ -8,11 +8,11 @@ // Official repository: https://github.com/cppalliance/mrdocs // -#ifndef MRDOCS_LIB_DOM_LAZY_ARRAY_HPP -#define MRDOCS_LIB_DOM_LAZY_ARRAY_HPP +#ifndef MRDOCS_API_DOM_LAZYARRAY_HPP +#define MRDOCS_API_DOM_LAZYARRAY_HPP -#include #include +#include #include #include #include @@ -195,4 +195,4 @@ TransformArray(T const& arr, F const& f) } // mrdocs } // clang -#endif +#endif // MRDOCS_API_DOM_LAZYARRAY_HPP diff --git a/include/mrdocs/Dom/LazyObject.hpp b/include/mrdocs/Dom/LazyObject.hpp index de913e8de..dcef64fa3 100644 --- a/include/mrdocs/Dom/LazyObject.hpp +++ b/include/mrdocs/Dom/LazyObject.hpp @@ -8,8 +8,8 @@ // Official repository: https://github.com/cppalliance/mrdocs // -#ifndef MRDOCS_LIB_DOM_LAZY_OBJECT_HPP -#define MRDOCS_LIB_DOM_LAZY_OBJECT_HPP +#ifndef MRDOCS_API_DOM_LAZYOBJECT_HPP +#define MRDOCS_API_DOM_LAZYOBJECT_HPP #include #include @@ -458,4 +458,4 @@ LazyObject(T const& arr, Context const& context) } // clang::mrdocs::dom -#endif +#endif // MRDOCS_API_DOM_LAZYOBJECT_HPP diff --git a/include/mrdocs/Dom/String.hpp b/include/mrdocs/Dom/String.hpp index da09155d0..c91ce3dc0 100644 --- a/include/mrdocs/Dom/String.hpp +++ b/include/mrdocs/Dom/String.hpp @@ -11,9 +11,9 @@ #ifndef MRDOCS_API_DOM_STRING_HPP #define MRDOCS_API_DOM_STRING_HPP -#include #include #include +#include namespace clang { namespace mrdocs { diff --git a/include/mrdocs/Dom/Value.hpp b/include/mrdocs/Dom/Value.hpp index c2c6a24e3..c9cc97f82 100644 --- a/include/mrdocs/Dom/Value.hpp +++ b/include/mrdocs/Dom/Value.hpp @@ -11,17 +11,17 @@ #ifndef MRDOCS_API_DOM_VALUE_HPP #define MRDOCS_API_DOM_VALUE_HPP -#include -#include -#include +#include #include #include #include #include #include #include -#include #include +#include +#include +#include #include // BAD #include diff --git a/include/mrdocs/Generator.hpp b/include/mrdocs/Generator.hpp index a4c4b7b33..b731c5111 100644 --- a/include/mrdocs/Generator.hpp +++ b/include/mrdocs/Generator.hpp @@ -209,4 +209,4 @@ getSinglePageFullPath( } // mrdocs } // clang -#endif +#endif // MRDOCS_API_GENERATOR_HPP diff --git a/include/mrdocs/Generators.hpp b/include/mrdocs/Generators.hpp index 55441e80f..bedf614fe 100644 --- a/include/mrdocs/Generators.hpp +++ b/include/mrdocs/Generators.hpp @@ -19,7 +19,7 @@ namespace clang { namespace mrdocs { -/** A dynamic list of Generator +/** A dynamic list of @ref Generator elements. */ class MRDOCS_VISIBLE Generators @@ -79,4 +79,4 @@ getGenerators() noexcept; } // mrdocs } // clang -#endif +#endif // MRDOCS_API_GENERATORS_HPP diff --git a/include/mrdocs/Metadata.hpp b/include/mrdocs/Metadata.hpp index c13449d4f..94bd5719e 100644 --- a/include/mrdocs/Metadata.hpp +++ b/include/mrdocs/Metadata.hpp @@ -13,7 +13,7 @@ #define MRDOCS_API_METADATA_HPP #include - +#include #include #include #include @@ -25,16 +25,14 @@ #include #include #include +#include +#include #include -#include #include - -#include +#include #include #include -#include -#include #include #include -#endif +#endif // MRDOCS_API_METADATA_HPP diff --git a/include/mrdocs/Metadata/DomCorpus.hpp b/include/mrdocs/Metadata/DomCorpus.hpp index 0ab8ed7dd..7e145e2de 100644 --- a/include/mrdocs/Metadata/DomCorpus.hpp +++ b/include/mrdocs/Metadata/DomCorpus.hpp @@ -10,8 +10,8 @@ // Official repository: https://github.com/cppalliance/mrdocs // -#ifndef MRDOCS_API_DOM_DOMCORPUS_HPP -#define MRDOCS_API_DOM_DOMCORPUS_HPP +#ifndef MRDOCS_API_METADATA_DOMCORPUS_HPP +#define MRDOCS_API_METADATA_DOMCORPUS_HPP #include #include @@ -114,4 +114,4 @@ getParents(DomCorpus const& C, Info const& I); } // clang::mrdocs -#endif +#endif // MRDOCS_API_METADATA_DOMCORPUS_HPP diff --git a/include/mrdocs/Metadata/Info.hpp b/include/mrdocs/Metadata/Info.hpp index de2100452..e26641d54 100644 --- a/include/mrdocs/Metadata/Info.hpp +++ b/include/mrdocs/Metadata/Info.hpp @@ -13,219 +13,10 @@ #define MRDOCS_API_METADATA_INFO_HPP #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include namespace clang::mrdocs { -/* Forward declarations - */ -#define INFO(Type) struct Type##Info; -#include - -/** Info variant discriminator -*/ -enum class InfoKind -{ - /// Kind is not specified. - None = 0, - #define INFO(Type) Type, - #include -}; - -/** Return the name of the InfoKind as a string. - */ -MRDOCS_DECL -dom::String -toString(InfoKind kind) noexcept; - -/** Return the InfoKind from a @ref dom::Value string. - */ -inline -void -tag_invoke( - dom::ValueFromTag, - dom::Value& v, - InfoKind const kind) -{ - v = toString(kind); -} - -consteval -std::underlying_type_t -countInfoKind() -{ - std::underlying_type_t count = 0; -#define INFO(Type) count++; -#include - return count; -} - -/** Base class with common properties of all symbols -*/ -struct MRDOCS_VISIBLE Info - : SourceInfo -{ - /** The unique identifier for this symbol. - */ - SymbolID id; - - /** The unqualified name. - */ - std::string Name; - - /** Kind of declaration. - */ - InfoKind Kind = InfoKind::None; - - /** Declaration access. - - Class members use: - @li `AccessKind::Public`, - @li `AccessKind::Protected`, and - @li `AccessKind::Private`. - - Namespace members use `AccessKind::None`. - */ - AccessKind Access = AccessKind::None; - - /** Determine why a symbol is extracted. - - This flag distinguishes `Info` from its dependencies and - indicates why it was extracted. - - Non-dependencies can be extracted in normal mode, - see-below mode, or implementation-defined mode. - - A dependency is a symbol which does not meet the configured - conditions for extraction, but had to be extracted due to it - being used transitively by a primary `Info`. - */ - ExtractionMode Extraction = ExtractionMode::Dependency; - - /** The parent symbol, if any. - - This is the parent namespace or record - where the symbol is defined. - */ - SymbolID Parent; - - /** The extracted javadoc for this declaration. - */ - std::optional javadoc; - - //-------------------------------------------- - - ~Info() override = default; - - Info(Info const& Other) = default; - - /** Move constructor. - */ - Info(Info&& Other) = default; - - /** Construct an Info. - - @param kind The kind of symbol - @param ID The unique identifier for this symbol - */ - explicit - Info( - InfoKind const kind, - SymbolID const& ID) noexcept - : id(ID) - , Kind(kind) - { - } - - #define INFO(Type) constexpr bool is##Type() const noexcept { \ - return Kind == InfoKind::Type; \ - } - #include - - constexpr Info const& asInfo() const noexcept - { - return *this; - } - - constexpr Info& asInfo() noexcept - { - return *this; - } - - #define INFO(Type) \ - constexpr Type##Info const& as##Type() const noexcept { \ - if (Kind == InfoKind::Type) \ - return reinterpret_cast(*this); \ - MRDOCS_UNREACHABLE(); \ - } - #include - - #define INFO(Type) \ - constexpr Type##Info & as##Type() noexcept { \ - if (Kind == InfoKind::Type) \ - return reinterpret_cast(*this); \ - MRDOCS_UNREACHABLE(); \ - } - #include - - #define INFO(Type) \ - constexpr Type##Info const* as##Type##Ptr() const noexcept { \ - if (Kind == InfoKind::Type) { return reinterpret_cast(this); } \ - return nullptr; \ - } - #include - - #define INFO(Type) \ - constexpr Type##Info * as##Type##Ptr() noexcept { \ - if (Kind == InfoKind::Type) { return reinterpret_cast(this); } \ - return nullptr; \ - } - #include - - auto operator<=>(Info const&) const = default; -}; - -//------------------------------------------------ - -/** Base class for providing variant discriminator functions. - - This offers functions that return a boolean at - compile-time, indicating if the most-derived - class is a certain type. -*/ -template -struct InfoCommonBase : Info -{ - /** The variant discriminator constant of the most-derived class. - - It only distinguishes from `Info::kind` in that it is a constant. - - */ - static constexpr InfoKind kind_id = K; - - #define INFO(Kind) \ - static constexpr bool is##Kind() noexcept { return K == InfoKind::Kind; } - #include - - auto operator<=>(InfoCommonBase const&) const = default; - -protected: - constexpr explicit InfoCommonBase(SymbolID const& ID) - : Info(K, ID) - { - } -}; - /** Invoke a function object with a type derived from Info This function will invoke the function object `fn` with @@ -256,25 +47,12 @@ visit( #define INFO(Type) \ case InfoKind::Type: \ return visitor.template visit(); - #include +#include default: MRDOCS_UNREACHABLE(); } } -/** Merges two Info objects. - - This function is used to merge two Info objects with the same SymbolID. - The function assumes that the two Info objects are of the same type. - If they are not, the function will fail. - - @param I The Info object to merge into. - @param Other The Info object to merge from. -*/ -MRDOCS_DECL -void -merge(Info& I, Info&& Other); - /** Merges two Info objects according to the behavior of the derived class. @param I The Info object to merge into. @@ -294,15 +72,6 @@ merge(InfoTy& I, InfoTy&& Other) }); } -inline -bool -canMerge(Info const& I, Info const& Other) -{ - return - I.Kind == Other.Kind && - I.id == Other.id; -} - /** A concept for types that have `Info` members. In most cases `T` is another `Info` type that @@ -315,45 +84,6 @@ concept InfoParent = requires(InfoTy const& I) { allMembers(I) } -> range_of; }; -/** Map the Info to a @ref dom::Object. - - @param io The output parameter to receive the dom::Object. - @param I The Info to convert. - @param domCorpus The DomCorpus used to resolve references. - */ -template -void -tag_invoke( - dom::LazyObjectMapTag, - IO& io, - Info const& I, - DomCorpus const* domCorpus) -{ - MRDOCS_ASSERT(domCorpus); - io.map("class", std::string("symbol")); - io.map("kind", I.Kind); - io.map("id", I.id); - if (!I.Name.empty()) - { - io.map("name", I.Name); - } - io.map("access", I.Access); - io.map("extraction", I.Extraction); - io.map("isRegular", I.Extraction == ExtractionMode::Regular); - io.map("isSeeBelow", I.Extraction == ExtractionMode::SeeBelow); - io.map("isImplementationDefined", I.Extraction == ExtractionMode::ImplementationDefined); - io.map("isDependency", I.Extraction == ExtractionMode::Dependency); - if (I.Parent) - { - io.map("parent", I.Parent); - } - if (I.javadoc) - { - io.map("doc", *I.javadoc); - } - io.map("loc", dynamic_cast(I)); -} - /** Map the Polymorphic Info to a @ref dom::Object. @param io The output parameter to receive the dom::Object. @@ -379,19 +109,6 @@ tag_invoke( }); } -/** Return the Info as a @ref dom::Value object. - */ -inline -void -tag_invoke( - dom::ValueFromTag, - dom::Value& v, - Info const& I, - DomCorpus const* domCorpus) -{ - v = dom::LazyObject(I, domCorpus); -} - /** Map the Polymorphic Info as a @ref dom::Value object. @param io The output parameter to receive the dom::Value. @@ -417,15 +134,6 @@ tag_invoke( }); } -inline -Optional -getPrimaryLocation(Info const& I) -{ - return getPrimaryLocation( - dynamic_cast(I), - I.isRecord() || I.isEnum()); -} - } // clang::mrdocs #endif diff --git a/include/mrdocs/Metadata/Info/Concept.hpp b/include/mrdocs/Metadata/Info/Concept.hpp index 6a70fa066..65618e157 100644 --- a/include/mrdocs/Metadata/Info/Concept.hpp +++ b/include/mrdocs/Metadata/Info/Concept.hpp @@ -8,14 +8,15 @@ // Official repository: https://github.com/cppalliance/mrdocs // -#ifndef MRDOCS_API_METADATA_CONCEPT_HPP -#define MRDOCS_API_METADATA_CONCEPT_HPP +#ifndef MRDOCS_API_METADATA_INFO_CONCEPT_HPP +#define MRDOCS_API_METADATA_INFO_CONCEPT_HPP -#include +#include +#include #include -#include +#include +#include #include -#include namespace clang::mrdocs { @@ -85,4 +86,4 @@ tag_invoke( } // clang::mrdocs -#endif +#endif // MRDOCS_API_METADATA_INFO_CONCEPT_HPP diff --git a/include/mrdocs/Metadata/Info/Enum.hpp b/include/mrdocs/Metadata/Info/Enum.hpp index b78825428..fc8550548 100644 --- a/include/mrdocs/Metadata/Info/Enum.hpp +++ b/include/mrdocs/Metadata/Info/Enum.hpp @@ -9,14 +9,15 @@ // Official repository: https://github.com/cppalliance/mrdocs // -#ifndef MRDOCS_API_METADATA_ENUM_HPP -#define MRDOCS_API_METADATA_ENUM_HPP +#ifndef MRDOCS_API_METADATA_INFO_ENUM_HPP +#define MRDOCS_API_METADATA_INFO_ENUM_HPP +#include #include +#include #include -#include +#include #include -#include namespace clang::mrdocs { @@ -29,7 +30,7 @@ struct EnumInfo final // Set too nonempty to the type when this is an explicitly typed enum. For // enum Foo : short { ... }; // this will be "short". - Polymorphic UnderlyingType = std::nullopt; + Optional> UnderlyingType = std::nullopt; /** The members of this scope. @@ -96,4 +97,4 @@ tag_invoke( } // clang::mrdocs -#endif +#endif // MRDOCS_API_METADATA_INFO_ENUM_HPP diff --git a/include/mrdocs/Metadata/Info/EnumConstant.hpp b/include/mrdocs/Metadata/Info/EnumConstant.hpp index c84681b87..32cc6ce22 100644 --- a/include/mrdocs/Metadata/Info/EnumConstant.hpp +++ b/include/mrdocs/Metadata/Info/EnumConstant.hpp @@ -8,12 +8,12 @@ // Official repository: https://github.com/cppalliance/mrdocs // -#ifndef MRDOCS_API_METADATA_ENUMCONSTANT_HPP -#define MRDOCS_API_METADATA_ENUMCONSTANT_HPP +#ifndef MRDOCS_API_METADATA_INFO_ENUMCONSTANT_HPP +#define MRDOCS_API_METADATA_INFO_ENUMCONSTANT_HPP #include #include -#include +#include namespace clang::mrdocs { @@ -75,4 +75,4 @@ tag_invoke( } // clang::mrdocs -#endif +#endif // MRDOCS_API_METADATA_INFO_ENUMCONSTANT_HPP diff --git a/include/mrdocs/Metadata/ExtractionMode.hpp b/include/mrdocs/Metadata/Info/ExtractionMode.hpp similarity index 95% rename from include/mrdocs/Metadata/ExtractionMode.hpp rename to include/mrdocs/Metadata/Info/ExtractionMode.hpp index 9d2b7b832..862a6ae25 100644 --- a/include/mrdocs/Metadata/ExtractionMode.hpp +++ b/include/mrdocs/Metadata/Info/ExtractionMode.hpp @@ -9,8 +9,8 @@ // Official repository: https://github.com/cppalliance/mrdocs // -#ifndef MRDOCS_API_METADATA_EXTRACTIONMODE_HPP -#define MRDOCS_API_METADATA_EXTRACTIONMODE_HPP +#ifndef MRDOCS_API_METADATA_INFO_EXTRACTIONMODE_HPP +#define MRDOCS_API_METADATA_INFO_EXTRACTIONMODE_HPP #include @@ -121,4 +121,4 @@ mostSpecific(ExtractionMode const a, ExtractionMode const b) noexcept } // clang::mrdocs -#endif +#endif // MRDOCS_API_METADATA_INFO_EXTRACTIONMODE_HPP diff --git a/include/mrdocs/Metadata/Info/Friend.hpp b/include/mrdocs/Metadata/Info/Friend.hpp index 36b2948ac..ef76e3ff6 100644 --- a/include/mrdocs/Metadata/Info/Friend.hpp +++ b/include/mrdocs/Metadata/Info/Friend.hpp @@ -8,11 +8,11 @@ // Official repository: https://github.com/cppalliance/mrdocs // -#ifndef MRDOCS_API_METADATA_FRIEND_HPP -#define MRDOCS_API_METADATA_FRIEND_HPP +#ifndef MRDOCS_API_METADATA_INFO_FRIEND_HPP +#define MRDOCS_API_METADATA_INFO_FRIEND_HPP #include -#include +#include #include namespace clang::mrdocs { @@ -31,7 +31,7 @@ struct FriendInfo final /** Befriended type. */ - Polymorphic Type = std::nullopt; + Optional> Type = std::nullopt; }; MRDOCS_DECL @@ -84,4 +84,4 @@ tag_invoke( } // clang::mrdocs -#endif +#endif // MRDOCS_API_METADATA_INFO_FRIEND_HPP diff --git a/include/mrdocs/Metadata/Info/Function.hpp b/include/mrdocs/Metadata/Info/Function.hpp index 7e6df927e..e3e5c3420 100644 --- a/include/mrdocs/Metadata/Info/Function.hpp +++ b/include/mrdocs/Metadata/Info/Function.hpp @@ -11,163 +11,26 @@ // Official repository: https://github.com/cppalliance/mrdocs // -#ifndef MRDOCS_API_METADATA_FUNCTION_HPP -#define MRDOCS_API_METADATA_FUNCTION_HPP +#ifndef MRDOCS_API_METADATA_INFO_FUNCTION_HPP +#define MRDOCS_API_METADATA_INFO_FUNCTION_HPP #include -#include -#include -#include -#include +#include +#include +#include #include -#include -#include #include #include namespace clang::mrdocs { -/** Return the name of an operator as a string. - - @param kind The kind of operator. - @param include_keyword Whether the name - should be prefixed with the `operator` keyword. -*/ -MRDOCS_DECL -std::string_view -getOperatorName( - OperatorKind kind, - bool include_keyword = false) noexcept; - -/** Return the short name of an operator as a string. -*/ -MRDOCS_DECL -std::string_view -getShortOperatorName( - OperatorKind kind) noexcept; - -/** Return the short name of an operator as a string. - - @param name The operator name, e.g. `operator+`, `operator++`, `operator[]`, etc. - @return The OperatorKind, or OperatorKind::None if not recognized. -*/ -MRDOCS_DECL -OperatorKind -getOperatorKind(std::string_view name) noexcept; - -/** Return the short name of an operator as a string. - - @param suffix The operator suffix, e.g. `+`, `++`, `[]`, etc. - @return The OperatorKind, or OperatorKind::None if not recognized. -*/ -MRDOCS_DECL -OperatorKind -getOperatorKindFromSuffix(std::string_view suffix) noexcept; - -/** Return the safe name of an operator as a string. - - @param kind The kind of operator. - @param include_keyword Whether the name - should be prefixed with `operator_`. -*/ -MRDOCS_DECL -std::string_view -getSafeOperatorName( - OperatorKind kind, - bool include_keyword = false) noexcept; - -/** Return the human-readable name of the operator - - @param kind The kind of operator. - @param nParams The number of parameters the operator takes. - @return The readable name, or nullopt if the operator is not recognized. - */ -std::optional -getOperatorReadableName( - OperatorKind kind, - int nParams); - -/** Function classifications */ -enum class FunctionClass -{ - /// The function is a normal function. - Normal = 0, - /// The function is a constructor. - Constructor, - /// The function is a conversion operator. - Conversion, - /// The function is a destructor. - Destructor -}; - -MRDOCS_DECL dom::String toString(FunctionClass kind) noexcept; - -/** Return the FunctionClass from a @ref dom::Value string. - */ -inline -void -tag_invoke( - dom::ValueFromTag, - dom::Value& v, - FunctionClass const kind) -{ - v = toString(kind); -} - - -// KRYSTIAN TODO: attributes (nodiscard, deprecated, and carries_dependency) -// KRYSTIAN TODO: flag to indicate whether this is a function parameter pack -/** Represents a single function parameter */ -struct Param final -{ - /** The type of this parameter - */ - Polymorphic Type = std::nullopt; - - /** The parameter name. - */ - Optional Name; - - /** The default argument for this parameter, if any - */ - Optional Default; - - Param() = default; - - Param( - Polymorphic&& type, - std::string&& name, - std::string&& def_arg) - : Type(std::move(type)) - , Name(std::move(name)) - , Default(std::move(def_arg)) - {} - - auto - operator<=>(Param const&) const = default; -}; - -MRDOCS_DECL -void -merge(Param& I, Param&& Other); - -/** Return the Param as a @ref dom::Value object. - */ -MRDOCS_DECL -void -tag_invoke( - dom::ValueFromTag, - dom::Value& v, - Param const& p, - DomCorpus const* domCorpus); - // TODO: Expand to allow for documenting templating and default args. // Info for functions. struct FunctionInfo final : InfoCommonBase { /// Info about the return type of this function. - Polymorphic ReturnType = std::nullopt; + Optional> ReturnType = std::nullopt; /// List of parameters. std::vector Params; @@ -307,4 +170,4 @@ overrides(FunctionInfo const& base, FunctionInfo const& derived); } // clang::mrdocs -#endif +#endif // MRDOCS_API_METADATA_INFO_FUNCTION_HPP diff --git a/include/mrdocs/Metadata/Info/FunctionClass.hpp b/include/mrdocs/Metadata/Info/FunctionClass.hpp new file mode 100644 index 000000000..929efca43 --- /dev/null +++ b/include/mrdocs/Metadata/Info/FunctionClass.hpp @@ -0,0 +1,53 @@ +// +// This is a derivative work. originally part of the LLVM Project. +// Licensed under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// Copyright (c) 2023 Vinnie Falco (vinnie.falco@gmail.com) +// Copyright (c) 2023 Krystian Stasiowski (sdkrystian@gmail.com) +// Copyright (c) 2024 Alan de Freitas (alandefreitas@gmail.com) +// +// Official repository: https://github.com/cppalliance/mrdocs +// + +#ifndef MRDOCS_API_METADATA_INFO_FUNCTIONCLASS_HPP +#define MRDOCS_API_METADATA_INFO_FUNCTIONCLASS_HPP + +#include +#include + +namespace clang::mrdocs { + +/** Function classifications */ +enum class FunctionClass +{ + /// The function is a normal function. + Normal = 0, + /// The function is a constructor. + Constructor, + /// The function is a conversion operator. + Conversion, + /// The function is a destructor. + Destructor +}; + +MRDOCS_DECL +dom::String +toString(FunctionClass kind) noexcept; + +/** Return the FunctionClass from a @ref dom::Value string. + */ +inline +void +tag_invoke( + dom::ValueFromTag, + dom::Value& v, + FunctionClass const kind) +{ + v = toString(kind); +} + +} // clang::mrdocs + +#endif diff --git a/include/mrdocs/Metadata/Info/Guide.hpp b/include/mrdocs/Metadata/Info/Guide.hpp index 934c8e590..869ef653d 100644 --- a/include/mrdocs/Metadata/Info/Guide.hpp +++ b/include/mrdocs/Metadata/Info/Guide.hpp @@ -8,16 +8,16 @@ // Official repository: https://github.com/cppalliance/mrdocs // -#ifndef MRDOCS_API_METADATA_GUIDE_HPP -#define MRDOCS_API_METADATA_GUIDE_HPP +#ifndef MRDOCS_API_METADATA_INFO_GUIDE_HPP +#define MRDOCS_API_METADATA_INFO_GUIDE_HPP #include +#include #include -#include -#include #include +#include +#include #include -#include #include namespace clang::mrdocs { @@ -31,7 +31,7 @@ struct GuideInfo final This is always a SpecializationTypeInfo. */ - Polymorphic Deduced = std::nullopt; + Optional> Deduced = std::nullopt; /** Template head, if any. */ @@ -96,4 +96,4 @@ tag_invoke( } // clang::mrdocs -#endif +#endif // MRDOCS_API_METADATA_INFO_GUIDE_HPP diff --git a/include/mrdocs/Metadata/Info/InfoBase.hpp b/include/mrdocs/Metadata/Info/InfoBase.hpp new file mode 100644 index 000000000..ac0336e9c --- /dev/null +++ b/include/mrdocs/Metadata/Info/InfoBase.hpp @@ -0,0 +1,277 @@ +// +// This is a derivative work. originally part of the LLVM Project. +// Licensed under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// Copyright (c) 2023 Vinnie Falco (vinnie.falco@gmail.com) +// +// Official repository: https://github.com/cppalliance/mrdocs +// + +#ifndef MRDOCS_API_METADATA_INFO_INFOBASE_HPP +#define MRDOCS_API_METADATA_INFO_INFOBASE_HPP + +#include +#include +#include +#include +#include +#include +#include + +namespace clang::mrdocs { + +/* Forward declarations + */ +#define INFO(Type) struct Type##Info; +#include + +/** Base class with common properties of all symbols +*/ +struct MRDOCS_VISIBLE Info + : SourceInfo +{ + /** The unique identifier for this symbol. + */ + SymbolID id; + + /** The unqualified name. + */ + std::string Name; + + /** Kind of declaration. + */ + InfoKind Kind = InfoKind::None; + + /** Declaration access. + + Class members use: + @li `AccessKind::Public`, + @li `AccessKind::Protected`, and + @li `AccessKind::Private`. + + Namespace members use `AccessKind::None`. + */ + AccessKind Access = AccessKind::None; + + /** Determine why a symbol is extracted. + + This flag distinguishes `Info` from its dependencies and + indicates why it was extracted. + + Non-dependencies can be extracted in normal mode, + see-below mode, or implementation-defined mode. + + A dependency is a symbol that does not meet the configured + conditions for extraction, but had to be extracted due to it + being used transitively by a primary `Info`. + */ + ExtractionMode Extraction = ExtractionMode::Dependency; + + /** The parent symbol, if any. + + This is the parent namespace or record + where the symbol is defined. + */ + SymbolID Parent; + + /** The extracted javadoc for this declaration. + */ + std::optional javadoc; + + //-------------------------------------------- + + ~Info() override = default; + + Info(Info const& Other) = default; + + /** Move constructor. + */ + Info(Info&& Other) = default; + + /** Construct an Info. + + @param kind The kind of symbol + @param ID The unique identifier for this symbol + */ + explicit + Info( + InfoKind const kind, + SymbolID const& ID) noexcept + : id(ID) + , Kind(kind) + { + } + + #define INFO(Type) constexpr bool is##Type() const noexcept { \ + return Kind == InfoKind::Type; \ + } +#include + + constexpr Info const& asInfo() const noexcept + { + return *this; + } + + constexpr Info& asInfo() noexcept + { + return *this; + } + + #define INFO(Type) \ + constexpr Type##Info const& as##Type() const noexcept { \ + if (Kind == InfoKind::Type) \ + return reinterpret_cast(*this); \ + MRDOCS_UNREACHABLE(); \ + } +#include + +#define INFO(Type) \ + constexpr Type##Info & as##Type() noexcept { \ + if (Kind == InfoKind::Type) \ + return reinterpret_cast(*this); \ + MRDOCS_UNREACHABLE(); \ + } +#include + +#define INFO(Type) \ + constexpr Type##Info const* as##Type##Ptr() const noexcept { \ + if (Kind == InfoKind::Type) { return reinterpret_cast(this); } \ + return nullptr; \ + } +#include + +#define INFO(Type) \ + constexpr Type##Info * as##Type##Ptr() noexcept { \ + if (Kind == InfoKind::Type) { return reinterpret_cast(this); } \ + return nullptr; \ + } +#include + + auto operator<=>(Info const&) const = default; + +protected: + Info() = default; + +}; + +//------------------------------------------------ + +/** Base class for providing variant discriminator functions. + + This offers functions that return a boolean at + compile-time, indicating if the most-derived + class is a certain type. +*/ +template +struct InfoCommonBase : Info +{ + /** The variant discriminator constant of the most-derived class. + + It only distinguishes from `Info::kind` in that it is a constant. + + */ + static constexpr InfoKind kind_id = K; + + #define INFO(Kind) \ + static constexpr bool is##Kind() noexcept { return K == InfoKind::Kind; } +#include + + auto operator<=>(InfoCommonBase const&) const = default; + +protected: + InfoCommonBase() = default; + + constexpr explicit InfoCommonBase(SymbolID const& ID) + : Info(K, ID) + { + } +}; + +/** Merges two Info objects. + + This function is used to merge two Info objects with the same SymbolID. + The function assumes that the two Info objects are of the same type. + If they are not, the function will fail. + + @param I The Info object to merge into. + @param Other The Info object to merge from. +*/ +MRDOCS_DECL +void +merge(Info& I, Info&& Other); + +inline +bool +canMerge(Info const& I, Info const& Other) +{ + return + I.Kind == Other.Kind && + I.id == Other.id; +} + +/** Map the Info to a @ref dom::Object. + + @param io The output parameter to receive the dom::Object. + @param I The Info to convert. + @param domCorpus The DomCorpus used to resolve references. + */ +template +void +tag_invoke( + dom::LazyObjectMapTag, + IO& io, + Info const& I, + DomCorpus const* domCorpus) +{ + MRDOCS_ASSERT(domCorpus); + io.map("class", std::string("symbol")); + io.map("kind", I.Kind); + io.map("id", I.id); + if (!I.Name.empty()) + { + io.map("name", I.Name); + } + io.map("access", I.Access); + io.map("extraction", I.Extraction); + io.map("isRegular", I.Extraction == ExtractionMode::Regular); + io.map("isSeeBelow", I.Extraction == ExtractionMode::SeeBelow); + io.map("isImplementationDefined", I.Extraction == ExtractionMode::ImplementationDefined); + io.map("isDependency", I.Extraction == ExtractionMode::Dependency); + if (I.Parent) + { + io.map("parent", I.Parent); + } + if (I.javadoc) + { + io.map("doc", *I.javadoc); + } + io.map("loc", dynamic_cast(I)); +} + +/** Return the Info as a @ref dom::Value object. + */ +inline +void +tag_invoke( + dom::ValueFromTag, + dom::Value& v, + Info const& I, + DomCorpus const* domCorpus) +{ + v = dom::LazyObject(I, domCorpus); +} + +inline +Optional +getPrimaryLocation(Info const& I) +{ + return getPrimaryLocation( + dynamic_cast(I), + I.isRecord() || I.isEnum()); +} + +} // clang::mrdocs + +#endif diff --git a/include/mrdocs/Metadata/Info/InfoKind.hpp b/include/mrdocs/Metadata/Info/InfoKind.hpp new file mode 100644 index 000000000..6fb3a0f80 --- /dev/null +++ b/include/mrdocs/Metadata/Info/InfoKind.hpp @@ -0,0 +1,60 @@ +// +// This is a derivative work. originally part of the LLVM Project. +// Licensed under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// Copyright (c) 2023 Vinnie Falco (vinnie.falco@gmail.com) +// +// Official repository: https://github.com/cppalliance/mrdocs +// + +#ifndef MRDOCS_API_METADATA_INFO_INFOKIND_HPP +#define MRDOCS_API_METADATA_INFO_INFOKIND_HPP + +#include +#include + +namespace clang::mrdocs { + +/** Info variant discriminator +*/ +enum class InfoKind +{ + /// Kind is not specified. + None = 0, + #define INFO(Type) Type, +#include +}; + +/** Return the name of the InfoKind as a string. + */ +MRDOCS_DECL +dom::String +toString(InfoKind kind) noexcept; + +/** Return the InfoKind from a @ref dom::Value string. + */ +inline +void +tag_invoke( + dom::ValueFromTag, + dom::Value& v, + InfoKind const kind) +{ + v = toString(kind); +} + +consteval +std::underlying_type_t +countInfoKind() +{ + std::underlying_type_t count = 0; +#define INFO(Type) count++; +#include + return count; +} + +} // clang::mrdocs + +#endif diff --git a/include/mrdocs/Metadata/Info/Namespace.hpp b/include/mrdocs/Metadata/Info/Namespace.hpp index 01f44d3ba..9e5f66e59 100644 --- a/include/mrdocs/Metadata/Info/Namespace.hpp +++ b/include/mrdocs/Metadata/Info/Namespace.hpp @@ -9,14 +9,14 @@ // Official repository: https://github.com/cppalliance/mrdocs // -#ifndef MRDOCS_API_METADATA_NAMESPACE_HPP -#define MRDOCS_API_METADATA_NAMESPACE_HPP +#ifndef MRDOCS_API_METADATA_INFO_NAMESPACE_HPP +#define MRDOCS_API_METADATA_INFO_NAMESPACE_HPP +#include #include #include -#include -#include #include +#include namespace clang::mrdocs { @@ -177,4 +177,4 @@ tag_invoke( } // clang::mrdocs -#endif +#endif // MRDOCS_API_METADATA_INFO_NAMESPACE_HPP diff --git a/include/mrdocs/Metadata/Info/NamespaceAlias.hpp b/include/mrdocs/Metadata/Info/NamespaceAlias.hpp index df93ea841..ba0d4a00d 100644 --- a/include/mrdocs/Metadata/Info/NamespaceAlias.hpp +++ b/include/mrdocs/Metadata/Info/NamespaceAlias.hpp @@ -8,13 +8,13 @@ // Official repository: https://github.com/cppalliance/mrdocs // -#ifndef MRDOCS_API_METADATA_NAMESPACEALIAS_HPP -#define MRDOCS_API_METADATA_NAMESPACEALIAS_HPP +#ifndef MRDOCS_API_METADATA_INFO_NAMESPACEALIAS_HPP +#define MRDOCS_API_METADATA_INFO_NAMESPACEALIAS_HPP #include +#include #include #include -#include namespace clang::mrdocs { @@ -28,7 +28,7 @@ struct NamespaceAliasInfo final This is another namespace that might or might not be in the same project. */ - Polymorphic AliasedSymbol; + Optional> AliasedSymbol; //-------------------------------------------- @@ -76,4 +76,4 @@ tag_invoke( } // clang::mrdocs -#endif +#endif // MRDOCS_API_METADATA_INFO_NAMESPACEALIAS_HPP diff --git a/include/mrdocs/Metadata/Info/Overloads.hpp b/include/mrdocs/Metadata/Info/Overloads.hpp index d88e3f79b..d76c541f6 100644 --- a/include/mrdocs/Metadata/Info/Overloads.hpp +++ b/include/mrdocs/Metadata/Info/Overloads.hpp @@ -8,8 +8,8 @@ // Official repository: https://github.com/cppalliance/mrdocs // -#ifndef MRDOCS_API_METADATA_OVERLOADS_HPP -#define MRDOCS_API_METADATA_OVERLOADS_HPP +#ifndef MRDOCS_API_METADATA_INFO_OVERLOADS_HPP +#define MRDOCS_API_METADATA_INFO_OVERLOADS_HPP #include #include @@ -32,7 +32,7 @@ struct OverloadsInfo final std::vector Members; /// Info about the return type of this function. - Polymorphic ReturnType = std::nullopt; + Optional> ReturnType = std::nullopt; //-------------------------------------------- @@ -95,4 +95,4 @@ tag_invoke( } // clang::mrdocs -#endif +#endif // MRDOCS_API_METADATA_INFO_OVERLOADS_HPP diff --git a/include/mrdocs/Metadata/Info/Param.hpp b/include/mrdocs/Metadata/Info/Param.hpp new file mode 100644 index 000000000..9463a3496 --- /dev/null +++ b/include/mrdocs/Metadata/Info/Param.hpp @@ -0,0 +1,74 @@ +// +// This is a derivative work. originally part of the LLVM Project. +// Licensed under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// Copyright (c) 2023 Vinnie Falco (vinnie.falco@gmail.com) +// Copyright (c) 2023 Krystian Stasiowski (sdkrystian@gmail.com) +// Copyright (c) 2024 Alan de Freitas (alandefreitas@gmail.com) +// +// Official repository: https://github.com/cppalliance/mrdocs +// + +#ifndef MRDOCS_API_METADATA_INFO_PARAM_HPP +#define MRDOCS_API_METADATA_INFO_PARAM_HPP + +#include +#include +#include +#include +#include + +namespace clang::mrdocs { + +/** Represents a single function parameter */ +struct Param final +{ + /** The type of this parameter + */ + Optional> Type = std::nullopt; + + /** The parameter name. + */ + Optional Name; + + /** The default argument for this parameter, if any + */ + Optional Default; + + // KRYSTIAN TODO: attributes (nodiscard, deprecated, and carries_dependency) + // KRYSTIAN TODO: flag to indicate whether this is a function parameter pack + + Param() = default; + + Param( + Polymorphic&& type, + std::string&& name, + std::string&& def_arg) + : Type(std::move(type)) + , Name(std::move(name)) + , Default(std::move(def_arg)) + {} + + auto + operator<=>(Param const&) const = default; +}; + +MRDOCS_DECL +void +merge(Param& I, Param&& Other); + +/** Return the Param as a @ref dom::Value object. + */ +MRDOCS_DECL +void +tag_invoke( + dom::ValueFromTag, + dom::Value& v, + Param const& p, + DomCorpus const* domCorpus); + +} // clang::mrdocs + +#endif // MRDOCS_API_METADATA_INFO_PARAM_HPP diff --git a/include/mrdocs/Metadata/Info/Record.hpp b/include/mrdocs/Metadata/Info/Record.hpp index db83088d9..1c76e4a05 100644 --- a/include/mrdocs/Metadata/Info/Record.hpp +++ b/include/mrdocs/Metadata/Info/Record.hpp @@ -9,272 +9,18 @@ // Official repository: https://github.com/cppalliance/mrdocs // -#ifndef MRDOCS_API_METADATA_RECORD_HPP -#define MRDOCS_API_METADATA_RECORD_HPP +#ifndef MRDOCS_API_METADATA_INFO_RECORD_HPP +#define MRDOCS_API_METADATA_INFO_RECORD_HPP -#include -#include -#include -#include +#include #include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include namespace clang::mrdocs { -/** A group of members that have the same access specifier. - - This struct represents a collection of symbols that share - the same access specifier within a record. - - It includes one vector for each info type allowed in a - record, and individual vectors for static functions, types, - and function overloads. -*/ -struct RecordTranche -{ - std::vector NamespaceAliases; - std::vector Typedefs; - std::vector Records; - std::vector Enums; - std::vector Functions; - std::vector StaticFunctions; - std::vector Variables; - std::vector StaticVariables; - std::vector Concepts; - std::vector Guides; - std::vector Usings; -}; - -MRDOCS_DECL -void -merge(RecordTranche& I, RecordTranche&& Other); - -inline -auto -allMembers(RecordTranche const& T) -{ - // This is a trick to emulate views::concat in C++20 - return std::views::transform( - std::views::iota(0, 11), - [&T](int const i) -> auto const& - { - switch (i) { - case 0: return T.NamespaceAliases; - case 1: return T.Typedefs; - case 2: return T.Records; - case 3: return T.Enums; - case 4: return T.Functions; - case 5: return T.StaticFunctions; - case 6: return T.Variables; - case 7: return T.StaticVariables; - case 8: return T.Concepts; - case 9: return T.Guides; - case 10: return T.Usings; - default: throw std::out_of_range("Invalid index"); - } - } - ) | std::ranges::views::join; -} - -/** Map a RecordTranche to a dom::Object. - - @param io The output parameter to receive the dom::Object. - @param I The RecordTranche to convert. - @param domCorpus The DomCorpus used to resolve references. - */ -template -void -tag_invoke( - dom::LazyObjectMapTag, - IO& io, - RecordTranche const& I, - DomCorpus const* domCorpus) -{ - io.map("namespaceAliases", dom::LazyArray(I.NamespaceAliases, domCorpus)); - io.map("typedefs", dom::LazyArray(I.Typedefs, domCorpus)); - io.map("records", dom::LazyArray(I.Records, domCorpus)); - io.map("enums", dom::LazyArray(I.Enums, domCorpus)); - io.map("functions", dom::LazyArray(I.Functions, domCorpus)); - io.map("staticFunctions", dom::LazyArray(I.StaticFunctions, domCorpus)); - io.map("variables", dom::LazyArray(I.Variables, domCorpus)); - io.map("staticVariables", dom::LazyArray(I.StaticVariables, domCorpus)); - io.map("concepts", dom::LazyArray(I.Concepts, domCorpus)); - io.map("guides", dom::LazyArray(I.Guides, domCorpus)); - io.map("usings", dom::LazyArray(I.Usings, domCorpus)); -} - -/** Map the RecordTranche to a @ref dom::Value object. - */ -inline -void -tag_invoke( - dom::ValueFromTag, - dom::Value& v, - RecordTranche const& I, - DomCorpus const* domCorpus) -{ - v = dom::LazyObject(I, domCorpus); -} - -/** The aggregated interface for a given struct, class, or union. - - This class represents the public, protected, and private - interfaces of a record. It is used to generate the - "interface" value of the DOM for symbols that represent - records or namespaces. - - The interface is not part of the Corpus. It is a temporary - structure generated to aggregate the symbols of a record. - This structure is provided to the user via the DOM. - - While the members of a Namespace are directly represented - with a Tranche, the members of a Record are represented - with an Interface. - -*/ -class RecordInterface -{ -public: - /** The aggregated public interfaces. - - This tranche contains all public members of a record - or namespace. - - */ - RecordTranche Public; - - /** The aggregated protected interfaces. - - This tranche contains all protected members of a record - or namespace. - - */ - RecordTranche Protected; - - /** The aggregated private interfaces. - - This tranche contains all private members of a record - or namespace. - - */ - RecordTranche Private; -}; - -MRDOCS_DECL -void -merge(RecordInterface& I, RecordInterface&& Other); - -/** Map a RecordInterface to a dom::Object. - - @param io The output parameter to receive the dom::Object. - @param I The RecordInterface to convert. - */ -template -void -tag_invoke( - dom::LazyObjectMapTag, - IO& io, - RecordInterface const& I, - DomCorpus const*) -{ - io.map("public", I.Public); - io.map("protected", I.Protected); - io.map("private", I.Private); -} - -/** Map the RecordInterface to a @ref dom::Value object. - */ -inline -void -tag_invoke( - dom::ValueFromTag, - dom::Value& v, - RecordInterface const& I, - DomCorpus const* domCorpus) -{ - v = dom::LazyObject(I, domCorpus); -} - - -inline -auto -allMembers(RecordInterface const& T) -{ - // This is a trick to emulate views::concat in C++20 - return - std::views::iota(0, 3) | - std::views::transform( - [&T](int i) -> auto { - switch (i) { - case 0: return allMembers(T.Public); - case 1: return allMembers(T.Protected); - case 2: return allMembers(T.Private); - default: throw std::out_of_range("Invalid index"); - } - }) | - std::ranges::views::join; -} - -/** Metadata for a direct base. -*/ -struct BaseInfo -{ - Polymorphic Type; - AccessKind Access = AccessKind::Public; - bool IsVirtual = false; - - BaseInfo() = default; - - BaseInfo( - Polymorphic&& type, - AccessKind const access, - bool const is_virtual) - : Type(std::move(type)) - , Access(access) - , IsVirtual(is_virtual) - { - } -}; - -MRDOCS_DECL -void -tag_invoke( - dom::ValueFromTag, - dom::Value& v, - BaseInfo const& I, - DomCorpus const* domCorpus); - -/** The kind of record: struct, class, or union. -*/ -enum class RecordKeyKind -{ - /// A struct. - Struct, - /// A C++ class. - Class, - /// A C-style Union - Union -}; - -MRDOCS_DECL -dom::String -toString(RecordKeyKind kind) noexcept; - -inline -void -tag_invoke( - dom::ValueFromTag, - dom::Value& v, - RecordKeyKind kind) -{ - v = toString(kind); -} - /** Metadata for struct, class, or union. */ struct RecordInfo final @@ -394,4 +140,4 @@ tag_invoke( } // clang::mrdocs -#endif +#endif // MRDOCS_API_METADATA_INFO_RECORD_HPP diff --git a/include/mrdocs/Metadata/Info/RecordBase.hpp b/include/mrdocs/Metadata/Info/RecordBase.hpp new file mode 100644 index 000000000..6981db72a --- /dev/null +++ b/include/mrdocs/Metadata/Info/RecordBase.hpp @@ -0,0 +1,52 @@ +// +// This is a derivative work. originally part of the LLVM Project. +// Licensed under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// Copyright (c) 2023 Vinnie Falco (vinnie.falco@gmail.com) +// +// Official repository: https://github.com/cppalliance/mrdocs +// + +#ifndef MRDOCS_API_METADATA_INFO_RECORDBASE_HPP +#define MRDOCS_API_METADATA_INFO_RECORDBASE_HPP + +#include +#include +#include + +namespace clang::mrdocs { + +/** Metadata for a direct base. +*/ +struct BaseInfo +{ + Optional> Type; + AccessKind Access = AccessKind::Public; + bool IsVirtual = false; + + BaseInfo() = default; + + BaseInfo( + Polymorphic&& type, + AccessKind const access, + bool const is_virtual) + : Type(std::move(type)) + , Access(access) + , IsVirtual(is_virtual) + { + } +}; + +MRDOCS_DECL +void +tag_invoke( + dom::ValueFromTag, + dom::Value& v, + BaseInfo const& I, + DomCorpus const* domCorpus); + +} // clang::mrdocs + +#endif // MRDOCS_API_METADATA_INFO_RECORDBASE_HPP diff --git a/include/mrdocs/Metadata/Info/RecordInterface.hpp b/include/mrdocs/Metadata/Info/RecordInterface.hpp new file mode 100644 index 000000000..acfdbe32a --- /dev/null +++ b/include/mrdocs/Metadata/Info/RecordInterface.hpp @@ -0,0 +1,121 @@ +// +// This is a derivative work. originally part of the LLVM Project. +// Licensed under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// Copyright (c) 2023 Vinnie Falco (vinnie.falco@gmail.com) +// +// Official repository: https://github.com/cppalliance/mrdocs +// + +#ifndef MRDOCS_API_METADATA_INFO_RECORDINTERFACE_HPP +#define MRDOCS_API_METADATA_INFO_RECORDINTERFACE_HPP + +#include +#include + +namespace clang::mrdocs { + +/** The aggregated interface for a given struct, class, or union. + + This class represents the public, protected, and private + interfaces of a record. It is used to generate the + "interface" value of the DOM for symbols that represent + records or namespaces. + + The interface is not part of the Corpus. It is a temporary + structure generated to aggregate the symbols of a record. + This structure is provided to the user via the DOM. + + While the members of a Namespace are directly represented + with a Tranche, the members of a Record are represented + with an Interface. + +*/ +class RecordInterface +{ +public: + /** The aggregated public interfaces. + + This tranche contains all public members of a record + or namespace. + + */ + RecordTranche Public; + + /** The aggregated protected interfaces. + + This tranche contains all protected members of a record + or namespace. + + */ + RecordTranche Protected; + + /** The aggregated private interfaces. + + This tranche contains all private members of a record + or namespace. + + */ + RecordTranche Private; +}; + +MRDOCS_DECL +void +merge(RecordInterface& I, RecordInterface&& Other); + +/** Map a RecordInterface to a dom::Object. + + @param io The output parameter to receive the dom::Object. + @param I The RecordInterface to convert. + */ +template +void +tag_invoke( + dom::LazyObjectMapTag, + IO& io, + RecordInterface const& I, + DomCorpus const*) +{ + io.map("public", I.Public); + io.map("protected", I.Protected); + io.map("private", I.Private); +} + +/** Map the RecordInterface to a @ref dom::Value object. + */ +inline +void +tag_invoke( + dom::ValueFromTag, + dom::Value& v, + RecordInterface const& I, + DomCorpus const* domCorpus) +{ + v = dom::LazyObject(I, domCorpus); +} + + +inline +auto +allMembers(RecordInterface const& T) +{ + // This is a trick to emulate views::concat in C++20 + return + std::views::iota(0, 3) | + std::views::transform( + [&T](int i) -> auto { + switch (i) { + case 0: return allMembers(T.Public); + case 1: return allMembers(T.Protected); + case 2: return allMembers(T.Private); + default: throw std::out_of_range("Invalid index"); + } + }) | + std::ranges::views::join; +} + +} // clang::mrdocs + +#endif // MRDOCS_API_METADATA_INFO_RECORDINTERFACE_HPP diff --git a/include/mrdocs/Metadata/Info/RecordKeyKind.hpp b/include/mrdocs/Metadata/Info/RecordKeyKind.hpp new file mode 100644 index 000000000..c48726341 --- /dev/null +++ b/include/mrdocs/Metadata/Info/RecordKeyKind.hpp @@ -0,0 +1,49 @@ +// +// Licensed under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// Copyright (c) 2023 Krystian Stasiowski (sdkrystian@gmail.com) +// Copyright (c) 2023 Alan de Freitas (alandefreitas@gmail.com) +// +// Official repository: https://github.com/cppalliance/mrdocs +// + +#ifndef MRDOCS_API_METADATA_INFO_RECORDKEYKIND_HPP +#define MRDOCS_API_METADATA_INFO_RECORDKEYKIND_HPP + +#include +#include +#include + +namespace clang::mrdocs { + +/** The kind of record: struct, class, or union. +*/ +enum class RecordKeyKind +{ + /// A struct. + Struct, + /// A C++ class. + Class, + /// A C-style Union + Union +}; + +MRDOCS_DECL +dom::String +toString(RecordKeyKind kind) noexcept; + +inline +void +tag_invoke( + dom::ValueFromTag, + dom::Value& v, + RecordKeyKind kind) +{ + v = toString(kind); +} + +} // clang::mrdocs + +#endif // MRDOCS_API_METADATA_INFO_RECORDKEYKIND_HPP diff --git a/include/mrdocs/Metadata/Info/RecordTranche.hpp b/include/mrdocs/Metadata/Info/RecordTranche.hpp new file mode 100644 index 000000000..c83b87b1f --- /dev/null +++ b/include/mrdocs/Metadata/Info/RecordTranche.hpp @@ -0,0 +1,121 @@ +// +// This is a derivative work. originally part of the LLVM Project. +// Licensed under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// Copyright (c) 2023 Vinnie Falco (vinnie.falco@gmail.com) +// +// Official repository: https://github.com/cppalliance/mrdocs +// + +#ifndef MRDOCS_API_METADATA_INFO_RECORDTRANCHE_HPP +#define MRDOCS_API_METADATA_INFO_RECORDTRANCHE_HPP + +#include +#include +#include +#include +#include + +namespace clang::mrdocs { + +/** A group of members that have the same access specifier. + + This struct represents a collection of symbols that share + the same access specifier within a record. + + It includes one vector for each info type allowed in a + record, and individual vectors for static functions, types, + and function overloads. +*/ +struct RecordTranche +{ + std::vector NamespaceAliases; + std::vector Typedefs; + std::vector Records; + std::vector Enums; + std::vector Functions; + std::vector StaticFunctions; + std::vector Variables; + std::vector StaticVariables; + std::vector Concepts; + std::vector Guides; + std::vector Usings; +}; + +MRDOCS_DECL +void +merge(RecordTranche& I, RecordTranche&& Other); + +inline +auto +allMembers(RecordTranche const& T) +{ + // This is a trick to emulate views::concat in C++20 + return std::views::transform( + std::views::iota(0, 11), + [&T](int const i) -> auto const& + { + switch (i) { + case 0: return T.NamespaceAliases; + case 1: return T.Typedefs; + case 2: return T.Records; + case 3: return T.Enums; + case 4: return T.Functions; + case 5: return T.StaticFunctions; + case 6: return T.Variables; + case 7: return T.StaticVariables; + case 8: return T.Concepts; + case 9: return T.Guides; + case 10: return T.Usings; + default: throw std::out_of_range("Invalid index"); + } + } + ) | std::ranges::views::join; +} + +/** Map a RecordTranche to a dom::Object. + + @param io The output parameter to receive the dom::Object. + @param I The RecordTranche to convert. + @param domCorpus The DomCorpus used to resolve references. + */ +template +void +tag_invoke( + dom::LazyObjectMapTag, + IO& io, + RecordTranche const& I, + DomCorpus const* domCorpus) +{ + io.map("namespaceAliases", dom::LazyArray(I.NamespaceAliases, domCorpus)); + io.map("typedefs", dom::LazyArray(I.Typedefs, domCorpus)); + io.map("records", dom::LazyArray(I.Records, domCorpus)); + io.map("enums", dom::LazyArray(I.Enums, domCorpus)); + io.map("functions", dom::LazyArray(I.Functions, domCorpus)); + io.map("staticFunctions", dom::LazyArray(I.StaticFunctions, domCorpus)); + io.map("variables", dom::LazyArray(I.Variables, domCorpus)); + io.map("staticVariables", dom::LazyArray(I.StaticVariables, domCorpus)); + io.map("concepts", dom::LazyArray(I.Concepts, domCorpus)); + io.map("guides", dom::LazyArray(I.Guides, domCorpus)); + io.map("usings", dom::LazyArray(I.Usings, domCorpus)); +} + +/** Map the RecordTranche to a @ref dom::Value object. + */ +inline +void +tag_invoke( + dom::ValueFromTag, + dom::Value& v, + RecordTranche const& I, + DomCorpus const* domCorpus) +{ + v = dom::LazyObject(I, domCorpus); +} + + +} // clang::mrdocs + +#endif // MRDOCS_API_METADATA_INFO_RECORDTRANCHE_HPP diff --git a/include/mrdocs/Metadata/Source.hpp b/include/mrdocs/Metadata/Info/Source.hpp similarity index 97% rename from include/mrdocs/Metadata/Source.hpp rename to include/mrdocs/Metadata/Info/Source.hpp index 737f2433e..8e4f75d01 100644 --- a/include/mrdocs/Metadata/Source.hpp +++ b/include/mrdocs/Metadata/Info/Source.hpp @@ -10,8 +10,8 @@ // Official repository: https://github.com/cppalliance/mrdocs // -#ifndef MRDOCS_API_METADATA_SOURCE_HPP -#define MRDOCS_API_METADATA_SOURCE_HPP +#ifndef MRDOCS_API_METADATA_INFO_SOURCE_HPP +#define MRDOCS_API_METADATA_INFO_SOURCE_HPP #include #include @@ -197,4 +197,4 @@ tag_invoke( } // clang::mrdocs -#endif +#endif // MRDOCS_API_METADATA_INFO_SOURCE_HPP diff --git a/include/mrdocs/Metadata/SymbolID.hpp b/include/mrdocs/Metadata/Info/SymbolID.hpp similarity index 97% rename from include/mrdocs/Metadata/SymbolID.hpp rename to include/mrdocs/Metadata/Info/SymbolID.hpp index 9f28a188c..6d5380930 100644 --- a/include/mrdocs/Metadata/SymbolID.hpp +++ b/include/mrdocs/Metadata/Info/SymbolID.hpp @@ -10,17 +10,17 @@ // Official repository: https://github.com/cppalliance/mrdocs // -#ifndef MRDOCS_API_METADATA_SYMBOLID_HPP -#define MRDOCS_API_METADATA_SYMBOLID_HPP +#ifndef MRDOCS_API_METADATA_INFO_SYMBOLID_HPP +#define MRDOCS_API_METADATA_INFO_SYMBOLID_HPP #include #include +#include #include #include -#include -#include -#include #include +#include +#include namespace clang::mrdocs { class DomCorpus; @@ -227,4 +227,4 @@ struct std::hash } }; -#endif +#endif // MRDOCS_API_METADATA_INFO_SYMBOLID_HPP diff --git a/include/mrdocs/Metadata/Info/Typedef.hpp b/include/mrdocs/Metadata/Info/Typedef.hpp index 96431d1cc..8ff148635 100644 --- a/include/mrdocs/Metadata/Info/Typedef.hpp +++ b/include/mrdocs/Metadata/Info/Typedef.hpp @@ -10,14 +10,14 @@ // Official repository: https://github.com/cppalliance/mrdocs // -#ifndef MRDOCS_API_METADATA_TYPEDEF_HPP -#define MRDOCS_API_METADATA_TYPEDEF_HPP +#ifndef MRDOCS_API_METADATA_INFO_TYPEDEF_HPP +#define MRDOCS_API_METADATA_INFO_TYPEDEF_HPP +#include #include +#include #include #include -#include -#include namespace clang::mrdocs { @@ -25,7 +25,7 @@ namespace clang::mrdocs { struct TypedefInfo final : InfoCommonBase { - Polymorphic Type = std::nullopt; + Optional> Type = std::nullopt; /** Indicates if this is a new C++ "using"-style typedef @@ -99,4 +99,4 @@ tag_invoke( } // clang::mrdocs -#endif +#endif // MRDOCS_API_METADATA_INFO_TYPEDEF_HPP diff --git a/include/mrdocs/Metadata/Info/Using.hpp b/include/mrdocs/Metadata/Info/Using.hpp index 5308b000d..d2a2d01b6 100644 --- a/include/mrdocs/Metadata/Info/Using.hpp +++ b/include/mrdocs/Metadata/Info/Using.hpp @@ -8,15 +8,15 @@ // Official repository: https://github.com/cppalliance/mrdocs // -#ifndef MRDOCS_API_METADATA_USING_HPP -#define MRDOCS_API_METADATA_USING_HPP +#ifndef MRDOCS_API_METADATA_INFO_USING_HPP +#define MRDOCS_API_METADATA_INFO_USING_HPP #include +#include #include -#include -#include +#include #include -#include +#include #include namespace clang::mrdocs { @@ -98,7 +98,7 @@ struct UsingInfo final Note that this can be a qualified name, such as `A::f` in the example above. */ - Polymorphic IntroducedName; + Polymorphic IntroducedName = Polymorphic(std::in_place_type); /** The shadow declarations. @@ -176,4 +176,4 @@ tag_invoke( } // clang::mrdocs -#endif +#endif // MRDOCS_API_METADATA_INFO_USING_HPP diff --git a/include/mrdocs/Metadata/Info/Variable.hpp b/include/mrdocs/Metadata/Info/Variable.hpp index 973e0a5a5..5f9b8b5a3 100644 --- a/include/mrdocs/Metadata/Info/Variable.hpp +++ b/include/mrdocs/Metadata/Info/Variable.hpp @@ -9,16 +9,16 @@ // Official repository: https://github.com/cppalliance/mrdocs // -#ifndef MRDOCS_API_METADATA_VARIABLE_HPP -#define MRDOCS_API_METADATA_VARIABLE_HPP +#ifndef MRDOCS_API_METADATA_INFO_VARIABLE_HPP +#define MRDOCS_API_METADATA_INFO_VARIABLE_HPP +#include +#include #include -#include -#include #include +#include +#include #include -#include -#include namespace clang::mrdocs { @@ -31,7 +31,7 @@ struct VariableInfo final : InfoCommonBase { /** The type of the variable */ - Polymorphic Type = std::nullopt; + Optional> Type = std::nullopt; std::optional Template; @@ -148,4 +148,4 @@ tag_invoke( } // clang::mrdocs -#endif +#endif // MRDOCS_API_METADATA_INFO_VARIABLE_HPP diff --git a/include/mrdocs/Metadata/Javadoc.hpp b/include/mrdocs/Metadata/Javadoc.hpp index c927c06d7..63bf2ace7 100644 --- a/include/mrdocs/Metadata/Javadoc.hpp +++ b/include/mrdocs/Metadata/Javadoc.hpp @@ -13,1852 +13,39 @@ #ifndef MRDOCS_API_METADATA_JAVADOC_HPP #define MRDOCS_API_METADATA_JAVADOC_HPP -#include -#include -#include -#include -#include -#include -#include #include -#include -#include -#include -#include -#include -#include +#include +#include namespace clang::mrdocs { -/** Javadoc related types and functions. - - Javadoc is a documentation generator originally - created for the Java language from source code. - - The Javadoc documentation generator tool can interpret - text in the "doc comments" format included - directly in the source code. - - The same "doc comments" format has been replicated - and extended by documentation systems for other - languages, including the cross-language Doxygen - and the JSDoc system for JavaScript. - - Because Clang can already parse and extract - blocks of Javadoc-style comments from source - code, these classes are used to represent the - parsed documentation in a structured form. - - @see https://en.wikipedia.org/wiki/Javadoc - @see https://www.doxygen.nl - - */ -namespace doc { - -struct Node; - -/** The kind of node. - - This includes tags and block types. - - Some of the available tags are: - - @li `@author Author Name` - @li `{@docRoot}` - @li `@version version` - @li `@since since-text ` - @li `@see reference` - @li `@param name description` - @li `@return description` - @li `@exception classname description` - @li `@throws classname description` - @li `@deprecated description` - @li `{@inheritDoc}` - @li `{@link reference}` - @li `{@linkplain reference}` - @li `{@value #STATIC_FIELD}` - @li `{@code literal}` - @li `{@literal literal}` - @li `{@serial literal}` - @li `{@serialData literal}` - @li `{@serialField literal}` - - Doxygen also introduces a number of additional tags on top - of the the doc comment specification. - - @note When a new tag is added, the `visit` function overloads - must be updated to handle the new tag. - - @see https://en.wikipedia.org/wiki/Javadoc[Javadoc - Wikipedia] - @see https://docs.oracle.com/javase/1.5.0/docs/tooldocs/solaris/javadoc.html[Javadoc Documentation] - @see https://docs.oracle.com/en/java/javase/13/docs/specs/javadoc/doc-comment-spec.html[Doc Comment Specification] - @see https://www.oracle.com/java/technologies/javase/javadoc-tool.html[Javadoc Tool] - @see https://www.oracle.com/technical-resources/articles/java/javadoc-tool.html[How to Write Doc Comments] - @see https://docs.oracle.com/javase/8/docs/technotes/tools/unix/javadoc.html[Javadoc Package] - @see https://web.archive.org/web/20170714215721/http://agile.csc.ncsu.edu:80/SEMaterials/tutorials/javadoc[Javadoc Tutorial] - @see https://en.wikipedia.org/wiki/Doxygen[Doxygen - Wikipedia] - @see https://www.doxygen.nl/manual/commands.html[Doxygen Special Tags] - - */ -enum class NodeKind -{ - // VFALCO Don't forget to update - // Node::isText() and Node::isBlock() - // when changing this enum! - - /// A text tag - text = 1, // needed by bitstream - /// An admonition tag - admonition, - /// A brief tag - brief, - /// A code tag - code, - /// A heading tag - heading, - /// A link tag - link, - /// A list_item tag - list_item, - /// An unordered_list tag - unordered_list, - /// A paragraph tag - paragraph, - /// A param tag - param, - /// A returns tag - returns, - /// A styled tag - styled, - /// A tparam tag - tparam, - /// A reference tag - reference, - /// A copy_details tag - copy_details, - /// A throws tag - throws, - /// A details tag - details, - /// A see tag - see, - /// A general tag. - precondition, - /// A postcondition tag. - postcondition -}; - -/** Return the name of the NodeKind as a string. - */ -MRDOCS_DECL -dom::String -toString(NodeKind kind) noexcept; - -/** Return the NodeKind from a @ref dom::Value string. - */ -inline -void -tag_invoke( - dom::ValueFromTag, - dom::Value& v, - NodeKind const kind) -{ - v = toString(kind); -} - -/** The text style. -*/ -enum class Style -{ - /// No style - none = 1, // needed by bitstream - /// Monospaced text - mono, - /// Bold text - bold, - /// Italic text - italic -}; - -/** Return the name of the @ref Style as a string. - - @param kind The style kind. - @return The string representation of the style. - */ -MRDOCS_DECL -dom::String -toString(Style kind) noexcept; - -/** Return the @ref Style from a @ref dom::Value string. - */ -inline -void -tag_invoke( - dom::ValueFromTag, - dom::Value& v, - Style const kind) -{ - v = toString(kind); -} - -/** An admonishment style. -*/ -enum class Admonish -{ - /// No admonishment - none = 1, // needed by bitstream - /// A general note - note, - /// A tip to the reader - tip, - /// Something important - important, - /// A caution admonishment - caution, - /// A warning admonishment - warning -}; - -/** Return the name of the Admonish as a string. - */ -MRDOCS_DECL -dom::String -toString(Admonish kind) noexcept; - -/** Return the Admonish from a @ref dom::Value string. - */ -inline -void -tag_invoke( - dom::ValueFromTag, - dom::Value& v, - Admonish const kind) -{ - v = toString(kind); -} - - -/** Parameter pass direction. -*/ -enum class ParamDirection -{ - /// No direction specified - none, - /// Parameter is passed - in, - /// Parameter is passed back to the caller - out, - /// Parameter is passed and passed back to the caller - inout -}; - -/** Return the name of the ParamDirection as a string. - */ -MRDOCS_DECL -dom::String -toString(ParamDirection kind) noexcept; - -/** Return the ParamDirection from a @ref dom::Value string. - */ -inline -void -tag_invoke( - dom::ValueFromTag, - dom::Value& v, - ParamDirection const kind) -{ - v = toString(kind); -} - -/** Which parts of the documentation to copy. - - @li `all`: copy the brief and the description. - @li `brief`: only copy the brief. - @li `description`: only copy the description. -*/ -enum class Parts -{ - /// Copy the brief and the description - all = 1, // needed by bitstream - /// Copy the brief - brief, - /// Copy the description - description -}; - -/** Return the name of the Parts as a string. - */ -MRDOCS_DECL -dom::String -toString(Parts kind) noexcept; - -/** Return the Parts from a @ref dom::Value string. - */ -inline -void -tag_invoke( - dom::ValueFromTag, - dom::Value& v, - Parts const kind) -{ - v = toString(kind); -} - -//-------------------------------------------- - -/** This is a variant-like list element. - - There are two types of nodes: text and block. - - - The javadoc is a list of blocks. - - A block contains a list of text elements. - - A text element contains a string. -*/ -struct MRDOCS_DECL - Node -{ - NodeKind Kind; - - virtual ~Node() = default; - - explicit Node(NodeKind const kind_) noexcept - : Kind(kind_) - { - } - - virtual bool isBlock() const noexcept = 0; - - bool isText() const noexcept - { - return ! isBlock(); - } - - auto operator<=>(Node const&) const = default; - bool operator==(Node const&)const noexcept = default; - virtual bool equals(Node const& other) const noexcept - { - return Kind == other.Kind; - } -}; - -/** Map the @ref Node to a @ref dom::Object. - - @param io The output parameter to receive the dom::Object. - @param I The input object. - @param domCorpus The DOM corpus, or nullptr if not part of a corpus. - */ -template -void -tag_invoke( - dom::LazyObjectMapTag, - IO& io, - Node const& I, - DomCorpus const* domCorpus) -{ - MRDOCS_ASSERT(domCorpus); - io.map("kind", I.Kind); -} - -/** Return the @ref Node as a @ref dom::Value object. - */ -inline -void -tag_invoke( - dom::ValueFromTag, - dom::Value& v, - Node const& I, - DomCorpus const* domCorpus) -{ - v = dom::LazyObject(I, domCorpus); -} - -/** Map the Polymorphic Node as a @ref dom::Value object. - - @param io The output parameter to receive the dom::Object. - @param I The input object. - @param domCorpus The DOM corpus, or nullptr if not part of a corpus. - */ -template NodeTy> -void -tag_invoke( - dom::ValueFromTag, - IO& io, - NodeTy const& I, - DomCorpus const* domCorpus) -{ - visit(*I, [&](auto const& U) - { - tag_invoke( - dom::ValueFromTag{}, - io, - U, - domCorpus); - }); -} - -//------------------------------------------------ -// -// Text nodes -// -//------------------------------------------------ - -/** A Node containing a string of text. - - There will be no newlines in the text. Otherwise, - this would be represented as multiple text nodes - within a Paragraph node. -*/ -struct Text : Node -{ - std::string string; - - static constexpr auto static_kind = NodeKind::text; - - explicit - Text( - std::string string_ = std::string()) noexcept - : Node(NodeKind::text) - , string(std::move(string_)) - { - } - - bool - isBlock() const noexcept final - { - return false; - } - - auto operator<=>(Text const&) const = default; - bool operator==(Text const&) const noexcept = default; - bool equals(Node const& other) const noexcept override - { - return Kind == other.Kind && - *this == dynamic_cast(other); - } - -protected: - Text( - std::string string_, - NodeKind kind_) - : Node(kind_) - , string(std::move(string_)) - { - } -}; - -/** Map the @ref Text to a @ref dom::Object. - - @param t The tag. - @param io The output object. - @param I The input object. - @param domCorpus The DOM corpus, or nullptr if not part of a corpus. - */ -template -void -tag_invoke( - dom::LazyObjectMapTag t, - IO& io, - Text const& I, - DomCorpus const* domCorpus) -{ - tag_invoke(t, io, dynamic_cast(I), domCorpus); - io.map("string", I.string); -} - -/** Return the @ref Text as a @ref dom::Value object. - */ -inline -void -tag_invoke( - dom::ValueFromTag, - dom::Value& v, - Text const& I, - DomCorpus const* domCorpus) -{ - v = dom::LazyObject(I, domCorpus); -} - -MRDOCS_DECL -std::strong_ordering -operator<=>(Polymorphic const& lhs, Polymorphic const& rhs); - -inline -bool -operator==(Polymorphic const& lhs, Polymorphic const& rhs) { - return std::is_eq(lhs <=> rhs); -} - -/** A piece of styled text. -*/ -struct Styled final : Text -{ - Style style; - - static constexpr auto static_kind = NodeKind::styled; - - Styled( - std::string string_ = std::string(), - Style style_ = Style::none) noexcept - : Text(std::move(string_), NodeKind::styled) - , style(style_) - { - } - - auto operator<=>(Styled const&) const = default; - bool operator==(Styled const&) const noexcept = default; - bool equals(Node const& other) const noexcept override - { - return Kind == other.Kind && - *this == dynamic_cast(other); - } -}; - -/** Map the @ref Styled to a @ref dom::Object. - - @param t The tag. - @param io The output object. - @param I The input object. - @param domCorpus The DOM corpus, or nullptr if not part of a corpus. - */ -template -void -tag_invoke( - dom::LazyObjectMapTag t, - IO& io, - Styled const& I, - DomCorpus const* domCorpus) -{ - tag_invoke(t, io, dynamic_cast(I), domCorpus); - io.map("style", I.style); -} - -/** Return the @ref Styled as a @ref dom::Value object. - */ -inline -void -tag_invoke( - dom::ValueFromTag, - dom::Value& v, - Styled const& I, - DomCorpus const* domCorpus) -{ - v = dom::LazyObject(I, domCorpus); -} +/** A processed documentation comment attached to a declaration. + A complete documentation comment consists of a + sequence of text blocks. -/** A hyperlink. -*/ -struct Link final : Text -{ - std::string href; + Some blocks are used to contain regular text, + such as paragraphs and lists. These are + analogous to markdown blocks. - static constexpr auto static_kind = NodeKind::link; + Other blocks contain metadata about the declaration, + such as parameters and return values. These + blocks are stored separately in the + @ref Javadoc structure. - explicit - Link( - std::string string_ = std::string(), - std::string href_ = std::string()) noexcept - : Text(std::move(string_), NodeKind::link) - , href(std::move(href_)) - { - } + Each block in the document might contain: - auto operator<=>(Link const&) const = default; - bool operator==(Link const&) const noexcept = default; - bool equals(Node const& other) const noexcept override - { - return Kind == other.Kind && - *this == dynamic_cast(other); - } -}; + - No other blocks (leaf blocks) + - Other blocks (container blocks: e.g. lists) -/** Map the @ref Link to a @ref dom::Object. + When they contain no other blocks, they might be: - @param t The tag. - @param io The output object. - @param I The input object. - @param domCorpus The DOM corpus, or nullptr if not part of a corpus. - */ -template -void -tag_invoke( - dom::LazyObjectMapTag t, - IO& io, - Link const& I, - DomCorpus const* domCorpus) -{ - tag_invoke(t, io, dynamic_cast(I), domCorpus); - io.map("href", I.href); -} + - Inlines only (e.g. paragraphs) + - No inlines (e.g. horizontal rule) -/** Return the @ref Link as a @ref dom::Value object. + Inline content elements contain other inlines + but cannot contain blocks. */ -inline -void -tag_invoke( - dom::ValueFromTag, - dom::Value& v, - Link const& I, - DomCorpus const* domCorpus) -{ - v = dom::LazyObject(I, domCorpus); -} - -/** A reference to a symbol. -*/ -struct Reference : Text -{ - SymbolID id = SymbolID::invalid; - - static constexpr auto static_kind = NodeKind::reference; - - explicit - Reference( - std::string string_ = std::string()) noexcept - : Text(std::move(string_), NodeKind::reference) - { - } - - auto operator<=>(Reference const&) const = default; - bool operator==(Reference const&) const noexcept = default; - bool equals(Node const& other) const noexcept override - { - return Kind == other.Kind && - *this == dynamic_cast(other); - } - -protected: - Reference( - std::string string_, - NodeKind const kind_) noexcept - : Text(std::move(string_), kind_) - { - } -}; - -/** Map the @ref Reference to a @ref dom::Object. - - @param t The tag. - @param io The output object. - @param I The input object. - @param domCorpus The DOM corpus, or nullptr if not part of a corpus. - */ -template -void -tag_invoke( - dom::LazyObjectMapTag t, - IO& io, - Reference const& I, - DomCorpus const* domCorpus) -{ - tag_invoke(t, io, dynamic_cast(I), domCorpus); - io.map("symbol", I.id); -} - -/** Return the @ref Reference as a @ref dom::Value object. - */ -inline -void -tag_invoke( - dom::ValueFromTag, - dom::Value& v, - Reference const& I, - DomCorpus const* domCorpus) -{ - v = dom::LazyObject(I, domCorpus); -} - -/** Documentation copied from another symbol. -*/ -struct CopyDetails final : Reference -{ - static constexpr auto static_kind = NodeKind::copy_details; - - CopyDetails(std::string string_ = std::string()) noexcept - : Reference(std::move(string_), NodeKind::copy_details) - { - } - - auto operator<=>(CopyDetails const&) const = default; - bool operator==(CopyDetails const&) const noexcept = default; - bool equals(Node const& other) const noexcept override - { - return Kind == other.Kind && - *this == dynamic_cast(other); - } -}; - -/** Map the @ref CopyDetails to a @ref dom::Object. - - @param t The tag. - @param io The output object. - @param I The input object. - @param domCorpus The DOM corpus, or nullptr if not part of a corpus. - */ -template -void -tag_invoke( - dom::LazyObjectMapTag t, - IO& io, - CopyDetails const& I, - DomCorpus const* domCorpus) -{ - tag_invoke(t, io, dynamic_cast(I), domCorpus); -} - -/** Return the @ref CopyDetails as a @ref dom::Value object. - - @param v The output value. - @param I The input object. - @param domCorpus The DOM corpus, or nullptr if not part of a corpus. - */ -inline -void -tag_invoke( - dom::ValueFromTag, - dom::Value& v, - CopyDetails const& I, - DomCorpus const* domCorpus) -{ - v = dom::LazyObject(I, domCorpus); -} - -//------------------------------------------------ -// -// Block nodes -// -//------------------------------------------------ - -/** A piece of block content - - The top level is a list of blocks. - - There are two types of blocks: headings and paragraphs -*/ -struct MRDOCS_DECL - Block : Node -{ - std::vector> children; - - bool isBlock() const noexcept final - { - return true; - } - - bool empty() const noexcept - { - return children.empty(); - } - - auto operator<=>(Block const& other) const { - if (auto const cmp = children.size() <=> other.children.size(); - !std::is_eq(cmp)) - { - return cmp; - } - for (std::size_t i = 0; i < children.size(); ++i) - { - if (auto const cmp = *children[i] <=> *other.children[i]; - !std::is_eq(cmp)) - { - return cmp; - } - } - return std::strong_ordering::equal; - } - - bool operator==(Block const& other) const noexcept - { - if (Kind != other.Kind) - { - return false; - } - return std::ranges:: - equal(children, other.children, - [](auto const& a, auto const& b) - { - return a->equals(*b); - }); - } - - bool equals(Node const& other) const noexcept override - { - return Kind == other.Kind && - *this == dynamic_cast(other); - } - - template T> - T& emplace_back(T&& text) - { - return static_cast(emplace_back( - std::make_unique(std::forward(text)))); - } - - void append(std::vector>&& blocks); - - void append(std::vector> const& otherChildren); - -protected: - explicit - Block( - NodeKind const kind_, - std::vector> children_ = {}) noexcept - : Node(kind_) - , children(std::move(children_)) - { - } - -private: - Text& emplace_back(Polymorphic text); -}; - -/** Map the @ref Block to a @ref dom::Object. - - @param t The tag. - @param io The output object. - @param I The input object. - @param domCorpus The DOM corpus, or nullptr if not part of a corpus. - */ -template -void -tag_invoke( - dom::LazyObjectMapTag t, - IO& io, - Block const& I, - DomCorpus const* domCorpus) -{ - tag_invoke(t, io, dynamic_cast(I), domCorpus); - io.defer("children", [&I, domCorpus] { - return dom::LazyArray(I.children, domCorpus); - }); -} - -/** Return the @ref Block as a @ref dom::Value object. - */ -inline -void -tag_invoke( - dom::ValueFromTag, - dom::Value& v, - Block const& I, - DomCorpus const* domCorpus) -{ - v = dom::LazyObject(I, domCorpus); -} - -/** A manually specified section heading. -*/ -struct Heading final : Block -{ - static constexpr auto static_kind = NodeKind::heading; - - std::string string; - - Heading( - std::string string_ = std::string()) noexcept - : Block(NodeKind::heading) - , string(std::move(string_)) - { - } - - auto operator<=>(Heading const&) const = default; - bool operator==(Heading const&) const noexcept = default; - bool equals(Node const& other) const noexcept override - { - return Kind == other.Kind && - *this == dynamic_cast(other); - } -}; - -/** Map the @ref Heading to a @ref dom::Object. - - @param t The tag. - @param io The output object. - @param I The input object. - @param domCorpus The DOM corpus, or nullptr if not part of a corpus. - */ -template -void -tag_invoke( - dom::LazyObjectMapTag t, - IO& io, - Heading const& I, - DomCorpus const* domCorpus) -{ - tag_invoke(t, io, dynamic_cast(I), domCorpus); - io.map("string", I.string); -} - -/** Return the @ref Heading as a @ref dom::Value object. - */ -inline -void -tag_invoke( - dom::ValueFromTag, - dom::Value& v, - Heading const& I, - DomCorpus const* domCorpus) -{ - v = dom::LazyObject(I, domCorpus); -} - -/** A sequence of text nodes. -*/ -struct Paragraph : Block -{ - static constexpr auto static_kind = NodeKind::paragraph; - - Paragraph() noexcept : Block(NodeKind::paragraph) {} - - virtual - Paragraph& - operator=(std::string_view str); - - auto operator<=>(Paragraph const&) const = default; - - bool equals(Node const& other) const noexcept override - { - return Kind == other.Kind && - *this == dynamic_cast(other); - } - -protected: - explicit - Paragraph( - NodeKind const kind, - std::vector> children_ = {}) noexcept - : Block(kind, std::move(children_)) - { - } -}; - -/** Map the @ref Paragraph to a @ref dom::Object. - - @param t The tag. - @param io The output object. - @param I The input object. - @param domCorpus The DOM corpus, or nullptr if not part of a corpus. - */ -template -void -tag_invoke( - dom::LazyObjectMapTag t, - IO& io, - Paragraph const& I, - DomCorpus const* domCorpus) -{ - tag_invoke(t, io, dynamic_cast(I), domCorpus); -} - -/** Return the @ref Paragraph as a @ref dom::Value object. - */ -inline -void -tag_invoke( - dom::ValueFromTag, - dom::Value& v, - Paragraph const& I, - DomCorpus const* domCorpus) -{ - v = dom::LazyObject(I, domCorpus); -} - - -/** The brief description -*/ -struct Brief final : Paragraph -{ - static constexpr NodeKind static_kind = NodeKind::brief; - - std::vector copiedFrom; - - Brief() noexcept - : Paragraph(NodeKind::brief) - { - } - - explicit - Brief(std::string_view const text) - : Brief() - { - operator=(text); - } - - Brief(Brief const& other) = default; - - Brief& - operator=(Brief const& other) = default; - - Brief& - operator=(std::string_view const text) override - { - Paragraph::operator=(text); - return *this; - } - - auto operator<=>(Brief const&) const = default; - - bool equals(Node const& other) const noexcept override - { - return Kind == other.Kind && - *this == dynamic_cast(other); - } -}; - -/** Map the @ref Brief to a @ref dom::Object. - - @param t The tag. - @param io The output object. - @param I The input object. - @param domCorpus The DOM corpus, or nullptr if not part of a corpus. - */ -template -void -tag_invoke( - dom::LazyObjectMapTag t, - IO& io, - Brief const& I, - DomCorpus const* domCorpus) -{ - tag_invoke(t, io, dynamic_cast(I), domCorpus); -} - -/** Return the @ref Brief as a @ref dom::Value object. - */ -inline -void -tag_invoke( - dom::ValueFromTag, - dom::Value& v, - Brief const& I, - DomCorpus const* domCorpus) -{ - v = dom::LazyObject(I, domCorpus); -} - -/** An admonition. - - This paragraph represents an admonition, such as - a note, tip, important, caution, or warning. - -*/ -struct Admonition final : Paragraph -{ - Admonish admonish; - - explicit - Admonition( - Admonish const admonish_ = Admonish::none) noexcept - : Paragraph(NodeKind::admonition) - , admonish(admonish_) - { - } - - using Paragraph::operator=; - - auto operator<=>(Admonition const&) const = default; - - bool operator==(Admonition const&) const noexcept = default; - - bool equals(Node const& other) const noexcept override - { - return Kind == other.Kind && - *this == dynamic_cast(other); - } -}; - -/** Map the @ref Admonition to a @ref dom::Object. - - @param t The tag. - @param io The output object. - @param I The input object. - @param domCorpus The DOM corpus, or nullptr if not part of a corpus. - */ -template -void -tag_invoke( - dom::LazyObjectMapTag t, - IO& io, - Admonition const& I, - DomCorpus const* domCorpus) -{ - tag_invoke(t, io, dynamic_cast(I), domCorpus); - io.map("admonish", I.admonish); -} - -/** Return the @ref Admonition as a @ref dom::Value object. - */ -inline -void -tag_invoke( - dom::ValueFromTag, - dom::Value& v, - Admonition const& I, - DomCorpus const* domCorpus) -{ - v = dom::LazyObject(I, domCorpus); -} - -/** Preformatted source code. -*/ -struct Code final : Paragraph -{ - // VFALCO we can add a language (e.g., C++), - // then emit attributes in the generator. - - static constexpr auto static_kind = NodeKind::code; - - Code() noexcept - : Paragraph(NodeKind::code) - { - } - - using Paragraph::operator=; - auto operator<=>(Code const&) const = default; - bool operator==(Code const&) const noexcept = default; - bool equals(Node const& other) const noexcept override - { - return Kind == other.Kind && - *this == dynamic_cast(other); - } -}; - -/** Map the @ref Code to a @ref dom::Object. - - @param t The tag. - @param io The output object. - @param I The input object. - @param domCorpus The DOM corpus, or nullptr if not part of a corpus. - */ -template -void -tag_invoke( - dom::LazyObjectMapTag t, - IO& io, - Code const& I, - DomCorpus const* domCorpus) -{ - tag_invoke(t, io, dynamic_cast(I), domCorpus); -} - -/** Return the @ref Code as a @ref dom::Value object. - */ -inline -void -tag_invoke( - dom::ValueFromTag, - dom::Value& v, - Code const& I, - DomCorpus const* domCorpus) -{ - v = dom::LazyObject(I, domCorpus); -} - -/** An item in a list -*/ -struct ListItem final : Paragraph -{ - static constexpr auto static_kind = NodeKind::list_item; - - ListItem() - : Paragraph(static_kind) - {} - - using Paragraph::operator=; - - auto operator<=>(ListItem const&) const = default; - bool - operator==(ListItem const&) const noexcept = default; - - bool - equals(Node const& other) const noexcept override - { - auto* p = dynamic_cast(&other); - if (!p) - { - return false; - } - if (this == &other) - { - return true; - } - return *this == *p; - } -}; - -/** Map the @ref ListItem to a @ref dom::Object. - - @param t The tag. - @param io The output object. - @param I The input object. - @param domCorpus The DOM corpus, or nullptr if not part of a corpus. - */ -template -void -tag_invoke( - dom::LazyObjectMapTag t, - IO& io, - ListItem const& I, - DomCorpus const* domCorpus) -{ - tag_invoke(t, io, dynamic_cast(I), domCorpus); -} - -/** Return the @ref ListItem as a @ref dom::Value object. - */ -inline -void -tag_invoke( - dom::ValueFromTag, - dom::Value& v, - ListItem const& I, - DomCorpus const* domCorpus) -{ - v = dom::LazyObject(I, domCorpus); -} - -/** A list of list items -*/ -struct UnorderedList final : Paragraph -{ - static constexpr auto static_kind = NodeKind::unordered_list; - - std::vector items; - - UnorderedList() - : Paragraph(static_kind) - { - } - - using Paragraph::operator=; - - auto operator<=>(UnorderedList const& other) const { - if (auto const cmp = items.size() <=> other.items.size(); - !std::is_eq(cmp)) - { - return cmp; - } - for (std::size_t i = 0; i < items.size(); ++i) - { - if (auto const cmp = items[i] <=> other.items[i]; - !std::is_eq(cmp)) - { - return cmp; - } - } - return std::strong_ordering::equal; - } - - bool - operator==(UnorderedList const&) const noexcept = default; - - bool - equals(Node const& other) const noexcept override - { - auto* p = dynamic_cast(&other); - if (!p) - { - return false; - } - if (this == &other) - { - return true; - } - return *this == *p; - } -}; - -/** Map the @ref UnorderedList to a @ref dom::Object. - - @param t The tag. - @param io The output object. - @param I The input object. - @param domCorpus The DOM corpus, or nullptr if not part of a corpus. - */ -template -void -tag_invoke( - dom::LazyObjectMapTag t, - IO& io, - UnorderedList const& I, - DomCorpus const* domCorpus) -{ - tag_invoke(t, io, dynamic_cast(I), domCorpus); - io.defer("items", [&I, domCorpus] { - return dom::LazyArray(I.items, domCorpus); - }); -} - -/** Return the @ref UnorderedList as a @ref dom::Value object. - */ -inline -void -tag_invoke( - dom::ValueFromTag, - dom::Value& v, - UnorderedList const& I, - DomCorpus const* domCorpus) -{ - v = dom::LazyObject(I, domCorpus); -} - -/** A @see paragraph -*/ -struct See final : Paragraph -{ - static constexpr auto static_kind = NodeKind::see; - - See() - : Paragraph(static_kind) - { - } - - using Paragraph::operator=; - - auto operator<=>(See const&) const = default; - - bool operator==(See const&) - const noexcept = default; - - bool equals(Node const& other) const noexcept override - { - return Kind == other.Kind && - *this == dynamic_cast(other); - } -}; - -/** Map the @ref See to a @ref dom::Object. - - @param t The tag. - @param io The output object. - @param I The input object. - @param domCorpus The DOM corpus, or nullptr if not part of a corpus. - */ -template -void -tag_invoke( - dom::LazyObjectMapTag t, - IO& io, - See const& I, - DomCorpus const* domCorpus) -{ - tag_invoke(t, io, dynamic_cast(I), domCorpus); -} - -/** Return the @ref See as a @ref dom::Value object. - */ -inline -void -tag_invoke( - dom::ValueFromTag, - dom::Value& v, - See const& I, - DomCorpus const* domCorpus) -{ - v = dom::LazyObject(I, domCorpus); -} - -/** Documentation for a function parameter -*/ -struct Param final : Paragraph -{ - std::string name; - ParamDirection direction; - - static constexpr auto static_kind = NodeKind::param; - - Param( - std::string name_ = std::string(), - Paragraph details_ = Paragraph(), - ParamDirection const direction_ = ParamDirection::none) - : Paragraph( - NodeKind::param, - std::move(details_.children)) - , name(std::move(name_)) - , direction(direction_) - { - } - - explicit - Param( - std::string_view const name, - std::string_view const text) - : Param() - { - this->name = name; - this->operator=(text); - } - - explicit - Param(Paragraph const& other) - : Param() - { - children = other.children; - } - - Param& - operator=(std::string_view const text) override - { - Paragraph::operator=(text); - return *this; - } - - auto operator<=>(Param const&) const = default; - - bool operator==(Param const&) - const noexcept = default; - - bool equals(Node const& other) const noexcept override - { - return Kind == other.Kind && - *this == dynamic_cast(other); - } -}; - -/** Map the @ref Param to a @ref dom::Object. - - @param t The tag. - @param io The output object. - @param I The input object. - @param domCorpus The DOM corpus, or nullptr if not part of a corpus. - */ -template -void -tag_invoke( - dom::LazyObjectMapTag t, - IO& io, - Param const& I, - DomCorpus const* domCorpus) -{ - tag_invoke(t, io, dynamic_cast(I), domCorpus); - io.map("name", I.name); - io.map("direction", I.direction); -} - -/** Return the @ref Param as a @ref dom::Value object. - */ -inline -void -tag_invoke( - dom::ValueFromTag, - dom::Value& v, - Param const& I, - DomCorpus const* domCorpus) -{ - v = dom::LazyObject(I, domCorpus); -} - -/** Documentation for a function return type -*/ -struct Returns final : Paragraph -{ - static constexpr NodeKind static_kind = NodeKind::returns; - - Returns() - : Paragraph(NodeKind::returns) - { - } - - explicit - Returns(std::string_view const text) - : Returns() - { - operator=(text); - } - - explicit - Returns(Paragraph const& other) - : Returns() - { - children = other.children; - } - - Returns& - operator=(std::string_view const text) override - { - Paragraph::operator=(text); - return *this; - } - - auto operator<=>(Returns const&) const = default; - - bool operator==(Returns const&) - const noexcept = default; - - bool equals(Node const& other) const noexcept override - { - return Kind == other.Kind && - *this == dynamic_cast(other); - } -}; - -/** Map the @ref Returns to a @ref dom::Object. - - @param t The tag. - @param io The output object. - @param I The input object. - @param domCorpus The DOM corpus, or nullptr if not part of a corpus. - */ -template -void -tag_invoke( - dom::LazyObjectMapTag t, - IO& io, - Returns const& I, - DomCorpus const* domCorpus) -{ - tag_invoke(t, io, dynamic_cast(I), domCorpus); -} - -/** Return the @ref Returns as a @ref dom::Value object. - */ -inline -void -tag_invoke( - dom::ValueFromTag, - dom::Value& v, - Returns const& I, - DomCorpus const* domCorpus) -{ - v = dom::LazyObject(I, domCorpus); -} - -/** Documentation for a template parameter -*/ -struct TParam final : Paragraph -{ - std::string name; - - static constexpr NodeKind static_kind = NodeKind::tparam; - - TParam() - : Paragraph(NodeKind::tparam) - { - } - - using Paragraph::operator=; - - auto operator<=>(TParam const&) const = default; - bool operator==(TParam const&) const noexcept = default; - bool equals(Node const& other) const noexcept override - { - return Kind == other.Kind && - *this == dynamic_cast(other); - } -}; - -/** Map the @ref TParam to a @ref dom::Object. - - @param t The tag. - @param io The output object. - @param I The input object. - @param domCorpus The DOM corpus, or nullptr if not part of a corpus. - */ -template -void -tag_invoke( - dom::LazyObjectMapTag t, - IO& io, - TParam const& I, - DomCorpus const* domCorpus) -{ - tag_invoke(t, io, dynamic_cast(I), domCorpus); - io.map("name", I.name); -} - -/** Return the @ref TParam as a @ref dom::Value object. - */ -inline -void -tag_invoke( - dom::ValueFromTag, - dom::Value& v, - TParam const& I, - DomCorpus const* domCorpus) -{ - v = dom::LazyObject(I, domCorpus); -} - -/** Documentation for a function parameter -*/ -struct Throws final : Paragraph -{ - Reference exception; - - static constexpr NodeKind static_kind = NodeKind::throws; - - Throws( - std::string exception_ = std::string(), - Paragraph details_ = Paragraph()) - : Paragraph( - NodeKind::throws, - std::move(details_.children)) - , exception(std::move(exception_)) - { - } - - using Paragraph::operator=; - - auto operator<=>(Throws const&) const = default; - - bool operator==(Throws const&) - const noexcept = default; - - bool equals(Node const& other) const noexcept override - { - return Kind == other.Kind && - *this == dynamic_cast(other); - } -}; - -/** Map the @ref Throws to a @ref dom::Object. - - @param t The tag. - @param io The output object. - @param I The input object. - @param domCorpus The DOM corpus, or nullptr if not part of a corpus. - */ -template -void -tag_invoke( - dom::LazyObjectMapTag t, - IO& io, - Throws const& I, - DomCorpus const* domCorpus) -{ - tag_invoke(t, io, dynamic_cast(I), domCorpus); - io.map("exception", I.exception); -} - -/** Return the @ref Throws as a @ref dom::Value object. - */ -inline -void -tag_invoke( - dom::ValueFromTag, - dom::Value& v, - Throws const& I, - DomCorpus const* domCorpus) -{ - v = dom::LazyObject(I, domCorpus); -} - -struct Precondition final : Paragraph -{ - static constexpr NodeKind static_kind = NodeKind::precondition; - - Precondition( - Paragraph details_ = Paragraph()) - : Paragraph( - NodeKind::precondition, - std::move(details_.children)) - { - } - - using Paragraph::operator=; - - auto operator<=>(Precondition const&) const = default; - - bool operator==(Precondition const&) - const noexcept = default; - - bool equals(Node const& other) const noexcept override - { - return Kind == other.Kind && - *this == dynamic_cast(other); - } -}; - -/** Map the @ref Precondition to a @ref dom::Object. - - @param t The tag. - @param io The output object. - @param I The input object. - @param domCorpus The DOM corpus, or nullptr if not part of a corpus. - */ -template -void -tag_invoke( - dom::LazyObjectMapTag t, - IO& io, - Precondition const& I, - DomCorpus const* domCorpus) -{ - tag_invoke(t, io, dynamic_cast(I), domCorpus); -} - -/** Return the @ref Precondition as a @ref dom::Value object. - - @param v The value to assign to. - @param I The input object. - @param domCorpus The DOM corpus, or nullptr if not part of a corpus. - */ -inline -void -tag_invoke( - dom::ValueFromTag, - dom::Value& v, - Precondition const& I, - DomCorpus const* domCorpus) -{ - v = dom::LazyObject(I, domCorpus); -} - -struct Postcondition : Paragraph -{ - static constexpr auto static_kind = NodeKind::postcondition; - - Postcondition( - Paragraph details_ = Paragraph()) - : Paragraph( - NodeKind::postcondition, - std::move(details_.children)) - { - } - - using Paragraph::operator=; - - auto operator<=>(Postcondition const&) const = default; - - bool operator==(Postcondition const&) - const noexcept = default; - - bool equals(Node const& other) const noexcept override - { - return Kind == other.Kind && - *this == dynamic_cast(other); - } -}; - -/** Map the @ref Postcondition to a @ref dom::Object. - - @param t The tag. - @param io The output object. - @param I The input object. - @param domCorpus The DOM corpus, or nullptr if not part of a corpus. - */ -template -void -tag_invoke( - dom::LazyObjectMapTag t, - IO& io, - Postcondition const& I, - DomCorpus const* domCorpus) -{ - tag_invoke(t, io, dynamic_cast(I), domCorpus); -} - -/** Return the @ref Postcondition as a @ref dom::Value object. - - @param v The value to assign to. - @param I The input object. - @param domCorpus The DOM corpus, or nullptr if not part of a corpus. - */ -inline -void -tag_invoke( - dom::ValueFromTag, - dom::Value& v, - Postcondition const& I, - DomCorpus const* domCorpus) -{ - v = dom::LazyObject(I, domCorpus); -} - -//------------------------------------------------ - -/** Visit a node. - - @param node The node to visit. - @param fn The function to call for each node. - @param args Additional arguments to pass to the function. - @return The result of calling the function. - */ -template< - class NodeTy, - class Fn, - class... Args> - requires std::derived_from -decltype(auto) -visit( - NodeTy& node, - Fn&& fn, - Args&&... args) -{ - auto visitor = makeVisitor( - node, std::forward(fn), - std::forward(args)...); - switch(node.Kind) - { - case NodeKind::admonition: - return visitor.template visit(); - case NodeKind::brief: - return visitor.template visit(); - case NodeKind::code: - return visitor.template visit(); - case NodeKind::heading: - return visitor.template visit(); - case NodeKind::paragraph: - return visitor.template visit(); - case NodeKind::link: - return visitor.template visit(); - case NodeKind::reference: - return visitor.template visit(); - case NodeKind::copy_details: - return visitor.template visit(); - case NodeKind::list_item: - return visitor.template visit(); - case NodeKind::unordered_list: - return visitor.template visit(); - case NodeKind::param: - return visitor.template visit(); - case NodeKind::returns: - return visitor.template visit(); - case NodeKind::styled: - return visitor.template visit(); - case NodeKind::text: - return visitor.template visit(); - case NodeKind::tparam: - return visitor.template visit(); - case NodeKind::throws: - return visitor.template visit(); - case NodeKind::see: - return visitor.template visit(); - case NodeKind::precondition: - return visitor.template visit(); - case NodeKind::postcondition: - return visitor.template visit(); - default: - MRDOCS_UNREACHABLE(); - } -} - -/** Traverse a list of nodes. - - @param list The list of nodes to traverse. - @param f The function to call for each node. - @param args Additional arguments to pass to the function. - */ -template -requires std::derived_from -void traverse( - std::vector> const& list, - F&& f, Args&&... args) -{ - for(auto const& node : list) - visit(*node, - std::forward(f), - std::forward(args)...); -} - -} // doc - -//------------------------------------------------ - -class Corpus; - -/** A processed Doxygen-style comment attached to a declaration. -*/ struct MRDOCS_DECL Javadoc { @@ -2023,7 +210,7 @@ inline void merge(Javadoc& I, Javadoc&& other) { // FIXME: this doesn't merge parameter information; - // parameters with the same name but different direction + // parameters with the same name but different directions // or descriptions end up being duplicated if(other != I) { diff --git a/include/mrdocs/Metadata/Javadoc/Block.hpp b/include/mrdocs/Metadata/Javadoc/Block.hpp new file mode 100644 index 000000000..d874d6b98 --- /dev/null +++ b/include/mrdocs/Metadata/Javadoc/Block.hpp @@ -0,0 +1,136 @@ +// +// This is a derivative work. originally part of the LLVM Project. +// Licensed under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// Copyright (c) 2023 Vinnie Falco (vinnie.falco@gmail.com) +// Copyright (c) 2023 Krystian Stasiowski (sdkrystian@gmail.com) +// +// Official repository: https://github.com/cppalliance/mrdocs +// + +#ifndef MRDOCS_API_METADATA_JAVADOC_BLOCK_HPP +#define MRDOCS_API_METADATA_JAVADOC_BLOCK_HPP + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace clang::mrdocs::doc { +/** Visit a block. + + @param block The block to visit. + @param fn The function to call for each block. + @param args Additional arguments to pass to the function. + @return The result of calling the function. + */ +template< + class BlockTy, + class Fn, + class... Args> + requires std::derived_from +decltype(auto) +visit( + BlockTy& block, + Fn&& fn, + Args&&... args) +{ + auto visitor = makeVisitor( + block, std::forward(fn), + std::forward(args)...); + switch(block.Kind) + { + case NodeKind::admonition: + return visitor.template visit(); + case NodeKind::brief: + return visitor.template visit(); + case NodeKind::code: + return visitor.template visit(); + case NodeKind::heading: + return visitor.template visit(); + case NodeKind::paragraph: + return visitor.template visit(); + case NodeKind::list_item: + return visitor.template visit(); + case NodeKind::unordered_list: + return visitor.template visit(); + case NodeKind::param: + return visitor.template visit(); + case NodeKind::returns: + return visitor.template visit(); + case NodeKind::tparam: + return visitor.template visit(); + case NodeKind::throws: + return visitor.template visit(); + case NodeKind::see: + return visitor.template visit(); + case NodeKind::precondition: + return visitor.template visit(); + case NodeKind::postcondition: + return visitor.template visit(); + default: + MRDOCS_UNREACHABLE(); + } +} + +/** Traverse a list of blocks. + + @param list The list of blocks to traverse. + @param f The function to call for each block. + @param args Additional arguments to pass to the function. + */ +template +requires std::derived_from +void traverse( + std::vector> const& list, + F&& f, Args&&... args) +{ + for(auto const& block : list) + visit(*block, + std::forward(f), + std::forward(args)...); +} + +/** Map the Polymorphic Block as a @ref dom::Value object. + + @param io The output parameter to receive the dom::Object. + @param I The input object. + @param domCorpus The DOM corpus, or nullptr if not part of a corpus. + */ +template BlockTy> +void +tag_invoke( + dom::ValueFromTag, + IO& io, + BlockTy const& I, + DomCorpus const* domCorpus) +{ + visit(*I, [&](auto const& U) + { + tag_invoke( + dom::ValueFromTag{}, + io, + U, + domCorpus); + }); +} +} // clang::mrdocs::doc + +#endif // MRDOCS_API_METADATA_JAVADOC_BLOCK_HPP diff --git a/include/mrdocs/Metadata/Javadoc/Block/Admonish.hpp b/include/mrdocs/Metadata/Javadoc/Block/Admonish.hpp new file mode 100644 index 000000000..2004a0e1b --- /dev/null +++ b/include/mrdocs/Metadata/Javadoc/Block/Admonish.hpp @@ -0,0 +1,59 @@ +// +// This is a derivative work. originally part of the LLVM Project. +// Licensed under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// Copyright (c) 2023 Vinnie Falco (vinnie.falco@gmail.com) +// Copyright (c) 2023 Krystian Stasiowski (sdkrystian@gmail.com) +// +// Official repository: https://github.com/cppalliance/mrdocs +// + +#ifndef MRDOCS_API_METADATA_JAVADOC_BLOCK_ADMONISH_HPP +#define MRDOCS_API_METADATA_JAVADOC_BLOCK_ADMONISH_HPP + +#include +#include + +namespace clang::mrdocs::doc { + +/** An admonishment style. + */ +enum class Admonish +{ + /// No admonishment + none = 1, // needed by bitstream + /// A general note + note, + /// A tip to the reader + tip, + /// Something important + important, + /// A caution admonishment + caution, + /// A warning admonishment + warning +}; + +/** Return the name of the Admonish as a string. + */ +MRDOCS_DECL +dom::String +toString(Admonish kind) noexcept; + +/** Return the Admonish from a @ref dom::Value string. + */ +inline + void + tag_invoke( + dom::ValueFromTag, + dom::Value& v, + Admonish const kind) +{ + v = toString(kind); +} + +} // clang::mrdocs::doc + +#endif // MRDOCS_API_METADATA_JAVADOC_BLOCK_ADMONISH_HPP diff --git a/include/mrdocs/Metadata/Javadoc/Block/Admonition.hpp b/include/mrdocs/Metadata/Javadoc/Block/Admonition.hpp new file mode 100644 index 000000000..62e8142b6 --- /dev/null +++ b/include/mrdocs/Metadata/Javadoc/Block/Admonition.hpp @@ -0,0 +1,89 @@ +// +// This is a derivative work. originally part of the LLVM Project. +// Licensed under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// Copyright (c) 2023 Vinnie Falco (vinnie.falco@gmail.com) +// Copyright (c) 2023 Krystian Stasiowski (sdkrystian@gmail.com) +// +// Official repository: https://github.com/cppalliance/mrdocs +// + +#ifndef MRDOCS_API_METADATA_JAVADOC_BLOCK_ADMONITION_HPP +#define MRDOCS_API_METADATA_JAVADOC_BLOCK_ADMONITION_HPP + +#include +#include +#include +#include +#include + +namespace clang::mrdocs::doc { + +/** An admonition. + + This paragraph represents an admonition, such as + a note, tip, important, caution, or warning. + +*/ +struct Admonition final : Paragraph +{ + Admonish admonish; + + explicit + Admonition( + Admonish const admonish_ = Admonish::none) noexcept + : Paragraph(NodeKind::admonition) + , admonish(admonish_) + { + } + + using Paragraph::operator=; + + auto operator<=>(Admonition const&) const = default; + + bool operator==(Admonition const&) const noexcept = default; + + bool equals(Node const& other) const noexcept override + { + return Kind == other.Kind && + *this == dynamic_cast(other); + } +}; + +/** Map the @ref Admonition to a @ref dom::Object. + + @param t The tag. + @param io The output object. + @param I The input object. + @param domCorpus The DOM corpus, or nullptr if not part of a corpus. + */ +template +void +tag_invoke( + dom::LazyObjectMapTag t, + IO& io, + Admonition const& I, + DomCorpus const* domCorpus) +{ + tag_invoke(t, io, dynamic_cast(I), domCorpus); + io.map("admonish", I.admonish); +} + +/** Return the @ref Admonition as a @ref dom::Value object. + */ +inline +void +tag_invoke( + dom::ValueFromTag, + dom::Value& v, + Admonition const& I, + DomCorpus const* domCorpus) +{ + v = dom::LazyObject(I, domCorpus); +} + +} // clang::mrdocs::doc + +#endif // MRDOCS_API_METADATA_JAVADOC_BLOCK_ADMONITION_HPP diff --git a/include/mrdocs/Metadata/Javadoc/Block/BlockBase.hpp b/include/mrdocs/Metadata/Javadoc/Block/BlockBase.hpp new file mode 100644 index 000000000..4fd0568b0 --- /dev/null +++ b/include/mrdocs/Metadata/Javadoc/Block/BlockBase.hpp @@ -0,0 +1,146 @@ +// +// This is a derivative work. originally part of the LLVM Project. +// Licensed under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// Copyright (c) 2023 Vinnie Falco (vinnie.falco@gmail.com) +// Copyright (c) 2023 Krystian Stasiowski (sdkrystian@gmail.com) +// +// Official repository: https://github.com/cppalliance/mrdocs +// + +#ifndef MRDOCS_API_METADATA_JAVADOC_BLOCK_BLOCKBASE_HPP +#define MRDOCS_API_METADATA_JAVADOC_BLOCK_BLOCKBASE_HPP + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace clang::mrdocs::doc { + +/** A piece of block content + + The top level is a list of blocks. + + There are two types of blocks: headings and paragraphs +*/ +struct MRDOCS_DECL + Block : Node +{ + std::vector> children; + + bool isBlock() const noexcept final + { + return true; + } + + bool empty() const noexcept + { + return children.empty(); + } + + auto operator<=>(Block const& other) const { + if (auto const cmp = children.size() <=> other.children.size(); + !std::is_eq(cmp)) + { + return cmp; + } + for (std::size_t i = 0; i < children.size(); ++i) + { + if (auto const cmp = *children[i] <=> *other.children[i]; + !std::is_eq(cmp)) + { + return cmp; + } + } + return std::strong_ordering::equal; + } + + bool operator==(Block const& other) const noexcept + { + if (Kind != other.Kind) + { + return false; + } + return std::ranges:: + equal(children, other.children, + [](auto const& a, auto const& b) + { + return a->equals(*b); + }); + } + + bool equals(Node const& other) const noexcept override + { + return Kind == other.Kind && + *this == dynamic_cast(other); + } + + template T> + T& emplace_back(T&& text) + { + return static_cast(emplace_back( + std::make_unique(std::forward(text)))); + } + + void append(std::vector>&& blocks); + + void append(std::vector> const& otherChildren); + +protected: + explicit + Block( + NodeKind const kind_, + std::vector> children_ = {}) noexcept + : Node(kind_) + , children(std::move(children_)) + { + } + +private: + Text& emplace_back(Polymorphic text); +}; + +/** Map the @ref Block to a @ref dom::Object. + + @param t The tag. + @param io The output object. + @param I The input object. + @param domCorpus The DOM corpus, or nullptr if not part of a corpus. + */ +template +void +tag_invoke( + dom::LazyObjectMapTag t, + IO& io, + Block const& I, + DomCorpus const* domCorpus) +{ + tag_invoke(t, io, dynamic_cast(I), domCorpus); + io.defer("children", [&I, domCorpus] { + return dom::LazyArray(I.children, domCorpus); + }); +} + +/** Return the @ref Block as a @ref dom::Value object. + */ +inline +void +tag_invoke( + dom::ValueFromTag, + dom::Value& v, + Block const& I, + DomCorpus const* domCorpus) +{ + v = dom::LazyObject(I, domCorpus); +} + +} // clang::mrdocs::doc + +#endif // MRDOCS_API_METADATA_JAVADOC_BLOCK_BLOCKBASE_HPP diff --git a/include/mrdocs/Metadata/Javadoc/Block/Brief.hpp b/include/mrdocs/Metadata/Javadoc/Block/Brief.hpp new file mode 100644 index 000000000..8a1b0b3a5 --- /dev/null +++ b/include/mrdocs/Metadata/Javadoc/Block/Brief.hpp @@ -0,0 +1,98 @@ +// +// This is a derivative work. originally part of the LLVM Project. +// Licensed under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// Copyright (c) 2023 Vinnie Falco (vinnie.falco@gmail.com) +// Copyright (c) 2023 Krystian Stasiowski (sdkrystian@gmail.com) +// +// Official repository: https://github.com/cppalliance/mrdocs +// + +#ifndef MRDOCS_API_METADATA_JAVADOC_BLOCK_BRIEF_HPP +#define MRDOCS_API_METADATA_JAVADOC_BLOCK_BRIEF_HPP + +#include +#include +#include +#include +#include + +namespace clang::mrdocs::doc { + +/** The brief description +*/ +struct Brief final : Paragraph +{ + static constexpr NodeKind static_kind = NodeKind::brief; + + std::vector copiedFrom; + + Brief() noexcept + : Paragraph(NodeKind::brief) + { + } + + explicit + Brief(std::string_view const text) + : Brief() + { + operator=(text); + } + + Brief(Brief const& other) = default; + + Brief& + operator=(Brief const& other) = default; + + Brief& + operator=(std::string_view const text) override + { + Paragraph::operator=(text); + return *this; + } + + auto operator<=>(Brief const&) const = default; + + bool equals(Node const& other) const noexcept override + { + return Kind == other.Kind && + *this == dynamic_cast(other); + } +}; + +/** Map the @ref Brief to a @ref dom::Object. + + @param t The tag. + @param io The output object. + @param I The input object. + @param domCorpus The DOM corpus, or nullptr if not part of a corpus. + */ +template +void +tag_invoke( + dom::LazyObjectMapTag t, + IO& io, + Brief const& I, + DomCorpus const* domCorpus) +{ + tag_invoke(t, io, dynamic_cast(I), domCorpus); +} + +/** Return the @ref Brief as a @ref dom::Value object. + */ +inline +void +tag_invoke( + dom::ValueFromTag, + dom::Value& v, + Brief const& I, + DomCorpus const* domCorpus) +{ + v = dom::LazyObject(I, domCorpus); +} + +} // clang::mrdocs::doc + +#endif // MRDOCS_API_METADATA_JAVADOC_BLOCK_BRIEF_HPP diff --git a/include/mrdocs/Metadata/Javadoc/Block/Code.hpp b/include/mrdocs/Metadata/Javadoc/Block/Code.hpp new file mode 100644 index 000000000..6d3655cb2 --- /dev/null +++ b/include/mrdocs/Metadata/Javadoc/Block/Code.hpp @@ -0,0 +1,80 @@ +// +// This is a derivative work. originally part of the LLVM Project. +// Licensed under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// Copyright (c) 2023 Vinnie Falco (vinnie.falco@gmail.com) +// Copyright (c) 2023 Krystian Stasiowski (sdkrystian@gmail.com) +// +// Official repository: https://github.com/cppalliance/mrdocs +// + +#ifndef MRDOCS_API_METADATA_JAVADOC_BLOCK_CODE_HPP +#define MRDOCS_API_METADATA_JAVADOC_BLOCK_CODE_HPP + +#include +#include +#include +#include + +namespace clang::mrdocs::doc { + +/** Preformatted source code. + */ +struct Code final : Paragraph +{ + // VFALCO we can add a language (e.g., C++), + // then emit attributes in the generator. + + static constexpr auto static_kind = NodeKind::code; + + Code() noexcept + : Paragraph(NodeKind::code) + { + } + + using Paragraph::operator=; + auto operator<=>(Code const&) const = default; + bool operator==(Code const&) const noexcept = default; + bool equals(Node const& other) const noexcept override + { + return Kind == other.Kind && + *this == dynamic_cast(other); + } +}; + +/** Map the @ref Code to a @ref dom::Object. + + @param t The tag. + @param io The output object. + @param I The input object. + @param domCorpus The DOM corpus, or nullptr if not part of a corpus. + */ +template +void +tag_invoke( + dom::LazyObjectMapTag t, + IO& io, + Code const& I, + DomCorpus const* domCorpus) +{ + tag_invoke(t, io, dynamic_cast(I), domCorpus); +} + +/** Return the @ref Code as a @ref dom::Value object. + */ +inline +void +tag_invoke( + dom::ValueFromTag, + dom::Value& v, + Code const& I, + DomCorpus const* domCorpus) +{ + v = dom::LazyObject(I, domCorpus); +} + +} // clang::mrdocs::doc + +#endif // MRDOCS_API_METADATA_JAVADOC_BLOCK_CODE_HPP diff --git a/include/mrdocs/Metadata/Javadoc/Block/Heading.hpp b/include/mrdocs/Metadata/Javadoc/Block/Heading.hpp new file mode 100644 index 000000000..5a761e3ca --- /dev/null +++ b/include/mrdocs/Metadata/Javadoc/Block/Heading.hpp @@ -0,0 +1,80 @@ +// +// This is a derivative work. originally part of the LLVM Project. +// Licensed under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// Copyright (c) 2023 Vinnie Falco (vinnie.falco@gmail.com) +// Copyright (c) 2023 Krystian Stasiowski (sdkrystian@gmail.com) +// +// Official repository: https://github.com/cppalliance/mrdocs +// + +#ifndef MRDOCS_API_METADATA_JAVADOC_BLOCK_HEADING_HPP +#define MRDOCS_API_METADATA_JAVADOC_BLOCK_HEADING_HPP + +#include +#include +#include + +namespace clang::mrdocs::doc { + +/** A manually specified section heading. +*/ +struct Heading final : Block +{ + static constexpr auto static_kind = NodeKind::heading; + + std::string string; + + Heading( + std::string string_ = std::string()) noexcept + : Block(NodeKind::heading) + , string(std::move(string_)) + { + } + + auto operator<=>(Heading const&) const = default; + bool operator==(Heading const&) const noexcept = default; + bool equals(Node const& other) const noexcept override + { + return Kind == other.Kind && + *this == dynamic_cast(other); + } +}; + +/** Map the @ref Heading to a @ref dom::Object. + + @param t The tag. + @param io The output object. + @param I The input object. + @param domCorpus The DOM corpus, or nullptr if not part of a corpus. + */ +template +void +tag_invoke( + dom::LazyObjectMapTag t, + IO& io, + Heading const& I, + DomCorpus const* domCorpus) +{ + tag_invoke(t, io, dynamic_cast(I), domCorpus); + io.map("string", I.string); +} + +/** Return the @ref Heading as a @ref dom::Value object. + */ +inline +void +tag_invoke( + dom::ValueFromTag, + dom::Value& v, + Heading const& I, + DomCorpus const* domCorpus) +{ + v = dom::LazyObject(I, domCorpus); +} + +} // clang::mrdocs::doc + +#endif // MRDOCS_API_METADATA_JAVADOC_BLOCK_HEADING_HPP diff --git a/include/mrdocs/Metadata/Javadoc/Block/ListItem.hpp b/include/mrdocs/Metadata/Javadoc/Block/ListItem.hpp new file mode 100644 index 000000000..ce51557a8 --- /dev/null +++ b/include/mrdocs/Metadata/Javadoc/Block/ListItem.hpp @@ -0,0 +1,88 @@ +// +// This is a derivative work. originally part of the LLVM Project. +// Licensed under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// Copyright (c) 2023 Vinnie Falco (vinnie.falco@gmail.com) +// Copyright (c) 2023 Krystian Stasiowski (sdkrystian@gmail.com) +// +// Official repository: https://github.com/cppalliance/mrdocs +// + +#ifndef MRDOCS_API_METADATA_JAVADOC_BLOCK_LISTITEM_HPP +#define MRDOCS_API_METADATA_JAVADOC_BLOCK_LISTITEM_HPP + +#include +#include +#include +#include + +namespace clang::mrdocs::doc { + +/** An item in a list +*/ +struct ListItem final : Paragraph +{ + static constexpr auto static_kind = NodeKind::list_item; + + ListItem() + : Paragraph(static_kind) + {} + + using Paragraph::operator=; + + auto operator<=>(ListItem const&) const = default; + bool + operator==(ListItem const&) const noexcept = default; + + bool + equals(Node const& other) const noexcept override + { + auto* p = dynamic_cast(&other); + if (!p) + { + return false; + } + if (this == &other) + { + return true; + } + return *this == *p; + } +}; + +/** Map the @ref ListItem to a @ref dom::Object. + + @param t The tag. + @param io The output object. + @param I The input object. + @param domCorpus The DOM corpus, or nullptr if not part of a corpus. + */ +template +void +tag_invoke( + dom::LazyObjectMapTag t, + IO& io, + ListItem const& I, + DomCorpus const* domCorpus) +{ + tag_invoke(t, io, dynamic_cast(I), domCorpus); +} + +/** Return the @ref ListItem as a @ref dom::Value object. + */ +inline +void +tag_invoke( + dom::ValueFromTag, + dom::Value& v, + ListItem const& I, + DomCorpus const* domCorpus) +{ + v = dom::LazyObject(I, domCorpus); +} + +} // clang::mrdocs::doc + +#endif // MRDOCS_API_METADATA_JAVADOC_BLOCK_LISTITEM_HPP diff --git a/include/mrdocs/Metadata/Javadoc/Block/Paragraph.hpp b/include/mrdocs/Metadata/Javadoc/Block/Paragraph.hpp new file mode 100644 index 000000000..aa9c2eef5 --- /dev/null +++ b/include/mrdocs/Metadata/Javadoc/Block/Paragraph.hpp @@ -0,0 +1,85 @@ +// +// This is a derivative work. originally part of the LLVM Project. +// Licensed under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// Copyright (c) 2023 Vinnie Falco (vinnie.falco@gmail.com) +// Copyright (c) 2023 Krystian Stasiowski (sdkrystian@gmail.com) +// +// Official repository: https://github.com/cppalliance/mrdocs +// + +#ifndef MRDOCS_API_METADATA_JAVADOC_BLOCK_PARAGRAPH_HPP +#define MRDOCS_API_METADATA_JAVADOC_BLOCK_PARAGRAPH_HPP + +#include +#include +#include + +namespace clang::mrdocs::doc { + +/** A sequence of text nodes. +*/ +struct Paragraph : Block +{ + static constexpr auto static_kind = NodeKind::paragraph; + + Paragraph() noexcept : Block(NodeKind::paragraph) {} + + virtual + Paragraph& + operator=(std::string_view str); + + auto operator<=>(Paragraph const&) const = default; + + bool equals(Node const& other) const noexcept override + { + return Kind == other.Kind && + *this == dynamic_cast(other); + } + +protected: + explicit + Paragraph( + NodeKind const kind, + std::vector> children_ = {}) noexcept + : Block(kind, std::move(children_)) + { + } +}; + +/** Map the @ref Paragraph to a @ref dom::Object. + + @param t The tag. + @param io The output object. + @param I The input object. + @param domCorpus The DOM corpus, or nullptr if not part of a corpus. + */ +template +void +tag_invoke( + dom::LazyObjectMapTag t, + IO& io, + Paragraph const& I, + DomCorpus const* domCorpus) +{ + tag_invoke(t, io, dynamic_cast(I), domCorpus); +} + +/** Return the @ref Paragraph as a @ref dom::Value object. + */ +inline +void +tag_invoke( + dom::ValueFromTag, + dom::Value& v, + Paragraph const& I, + DomCorpus const* domCorpus) +{ + v = dom::LazyObject(I, domCorpus); +} + +} // clang::mrdocs::doc + +#endif // MRDOCS_API_METADATA_JAVADOC_BLOCK_PARAGRAPH_HPP diff --git a/include/mrdocs/Metadata/Javadoc/Block/Param.hpp b/include/mrdocs/Metadata/Javadoc/Block/Param.hpp new file mode 100644 index 000000000..8844a3b2a --- /dev/null +++ b/include/mrdocs/Metadata/Javadoc/Block/Param.hpp @@ -0,0 +1,116 @@ +// +// This is a derivative work. originally part of the LLVM Project. +// Licensed under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// Copyright (c) 2023 Vinnie Falco (vinnie.falco@gmail.com) +// Copyright (c) 2023 Krystian Stasiowski (sdkrystian@gmail.com) +// +// Official repository: https://github.com/cppalliance/mrdocs +// + +#ifndef MRDOCS_API_METADATA_JAVADOC_BLOCK_PARAM_HPP +#define MRDOCS_API_METADATA_JAVADOC_BLOCK_PARAM_HPP + +#include +#include +#include +#include +#include + +namespace clang::mrdocs::doc { + +/** Documentation for a function parameter +*/ +struct Param final : Paragraph +{ + std::string name; + ParamDirection direction; + + static constexpr auto static_kind = NodeKind::param; + + Param( + std::string name_ = std::string(), + Paragraph details_ = Paragraph(), + ParamDirection const direction_ = ParamDirection::none) + : Paragraph( + NodeKind::param, + std::move(details_.children)) + , name(std::move(name_)) + , direction(direction_) + { + } + + explicit + Param( + std::string_view const name, + std::string_view const text) + : Param() + { + this->name = name; + this->operator=(text); + } + + explicit + Param(Paragraph const& other) + : Param() + { + children = other.children; + } + + Param& + operator=(std::string_view const text) override + { + Paragraph::operator=(text); + return *this; + } + + auto operator<=>(Param const&) const = default; + + bool operator==(Param const&) + const noexcept = default; + + bool equals(Node const& other) const noexcept override + { + return Kind == other.Kind && + *this == dynamic_cast(other); + } +}; + +/** Map the @ref Param to a @ref dom::Object. + + @param t The tag. + @param io The output object. + @param I The input object. + @param domCorpus The DOM corpus, or nullptr if not part of a corpus. + */ +template +void +tag_invoke( + dom::LazyObjectMapTag t, + IO& io, + Param const& I, + DomCorpus const* domCorpus) +{ + tag_invoke(t, io, dynamic_cast(I), domCorpus); + io.map("name", I.name); + io.map("direction", I.direction); +} + +/** Return the @ref Param as a @ref dom::Value object. + */ +inline +void +tag_invoke( + dom::ValueFromTag, + dom::Value& v, + Param const& I, + DomCorpus const* domCorpus) +{ + v = dom::LazyObject(I, domCorpus); +} + +} // clang::mrdocs::doc + +#endif // MRDOCS_API_METADATA_JAVADOC_BLOCK_PARAM_HPP diff --git a/include/mrdocs/Metadata/Javadoc/Block/ParamDirection.hpp b/include/mrdocs/Metadata/Javadoc/Block/ParamDirection.hpp new file mode 100644 index 000000000..16e3b9b97 --- /dev/null +++ b/include/mrdocs/Metadata/Javadoc/Block/ParamDirection.hpp @@ -0,0 +1,55 @@ +// +// This is a derivative work. originally part of the LLVM Project. +// Licensed under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// Copyright (c) 2023 Vinnie Falco (vinnie.falco@gmail.com) +// Copyright (c) 2023 Krystian Stasiowski (sdkrystian@gmail.com) +// +// Official repository: https://github.com/cppalliance/mrdocs +// + +#ifndef MRDOCS_API_METADATA_JAVADOC_BLOCK_PARAMDIRECTION_HPP +#define MRDOCS_API_METADATA_JAVADOC_BLOCK_PARAMDIRECTION_HPP + +#include +#include + +namespace clang::mrdocs::doc { + +/** Parameter pass direction. +*/ +enum class ParamDirection +{ + /// No direction specified + none, + /// Parameter is passed + in, + /// Parameter is passed back to the caller + out, + /// Parameter is passed and passed back to the caller + inout +}; + +/** Return the name of the ParamDirection as a string. + */ +MRDOCS_DECL +dom::String +toString(ParamDirection kind) noexcept; + +/** Return the ParamDirection from a @ref dom::Value string. + */ +inline +void +tag_invoke( + dom::ValueFromTag, + dom::Value& v, + ParamDirection const kind) +{ + v = toString(kind); +} + +} // clang::mrdocs::doc + +#endif // MRDOCS_API_METADATA_JAVADOC_BLOCK_PARAMDIRECTION_HPP diff --git a/include/mrdocs/Metadata/Javadoc/Block/Postcondition.hpp b/include/mrdocs/Metadata/Javadoc/Block/Postcondition.hpp new file mode 100644 index 000000000..251bfa5be --- /dev/null +++ b/include/mrdocs/Metadata/Javadoc/Block/Postcondition.hpp @@ -0,0 +1,85 @@ +// +// This is a derivative work. originally part of the LLVM Project. +// Licensed under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// Copyright (c) 2023 Vinnie Falco (vinnie.falco@gmail.com) +// Copyright (c) 2023 Krystian Stasiowski (sdkrystian@gmail.com) +// +// Official repository: https://github.com/cppalliance/mrdocs +// + +#ifndef MRDOCS_API_METADATA_JAVADOC_BLOCK_POSTCONDITION_HPP +#define MRDOCS_API_METADATA_JAVADOC_BLOCK_POSTCONDITION_HPP + +#include +#include +#include + +namespace clang::mrdocs::doc { + +struct Postcondition : Paragraph +{ + static constexpr auto static_kind = NodeKind::postcondition; + + Postcondition( + Paragraph details_ = Paragraph()) + : Paragraph( + NodeKind::postcondition, + std::move(details_.children)) + { + } + + using Paragraph::operator=; + + auto operator<=>(Postcondition const&) const = default; + + bool operator==(Postcondition const&) + const noexcept = default; + + bool equals(Node const& other) const noexcept override + { + return Kind == other.Kind && + *this == dynamic_cast(other); + } +}; + +/** Map the @ref Postcondition to a @ref dom::Object. + + @param t The tag. + @param io The output object. + @param I The input object. + @param domCorpus The DOM corpus, or nullptr if not part of a corpus. + */ +template +void +tag_invoke( + dom::LazyObjectMapTag t, + IO& io, + Postcondition const& I, + DomCorpus const* domCorpus) +{ + tag_invoke(t, io, dynamic_cast(I), domCorpus); +} + +/** Return the @ref Postcondition as a @ref dom::Value object. + + @param v The value to assign to. + @param I The input object. + @param domCorpus The DOM corpus, or nullptr if not part of a corpus. + */ +inline +void +tag_invoke( + dom::ValueFromTag, + dom::Value& v, + Postcondition const& I, + DomCorpus const* domCorpus) +{ + v = dom::LazyObject(I, domCorpus); +} + +} // clang::mrdocs::doc + +#endif // MRDOCS_API_METADATA_JAVADOC_BLOCK_POSTCONDITION_HPP diff --git a/include/mrdocs/Metadata/Javadoc/Block/Precondition.hpp b/include/mrdocs/Metadata/Javadoc/Block/Precondition.hpp new file mode 100644 index 000000000..39c606155 --- /dev/null +++ b/include/mrdocs/Metadata/Javadoc/Block/Precondition.hpp @@ -0,0 +1,85 @@ +// +// This is a derivative work. originally part of the LLVM Project. +// Licensed under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// Copyright (c) 2023 Vinnie Falco (vinnie.falco@gmail.com) +// Copyright (c) 2023 Krystian Stasiowski (sdkrystian@gmail.com) +// +// Official repository: https://github.com/cppalliance/mrdocs +// + +#ifndef MRDOCS_API_METADATA_JAVADOC_BLOCK_PRECONDITION_HPP +#define MRDOCS_API_METADATA_JAVADOC_BLOCK_PRECONDITION_HPP + +#include +#include +#include + +namespace clang::mrdocs::doc { + +struct Precondition final : Paragraph +{ + static constexpr NodeKind static_kind = NodeKind::precondition; + + Precondition( + Paragraph details_ = Paragraph()) + : Paragraph( + NodeKind::precondition, + std::move(details_.children)) + { + } + + using Paragraph::operator=; + + auto operator<=>(Precondition const&) const = default; + + bool operator==(Precondition const&) + const noexcept = default; + + bool equals(Node const& other) const noexcept override + { + return Kind == other.Kind && + *this == dynamic_cast(other); + } +}; + +/** Map the @ref Precondition to a @ref dom::Object. + + @param t The tag. + @param io The output object. + @param I The input object. + @param domCorpus The DOM corpus, or nullptr if not part of a corpus. + */ +template +void +tag_invoke( + dom::LazyObjectMapTag t, + IO& io, + Precondition const& I, + DomCorpus const* domCorpus) +{ + tag_invoke(t, io, dynamic_cast(I), domCorpus); +} + +/** Return the @ref Precondition as a @ref dom::Value object. + + @param v The value to assign to. + @param I The input object. + @param domCorpus The DOM corpus, or nullptr if not part of a corpus. + */ +inline +void +tag_invoke( + dom::ValueFromTag, + dom::Value& v, + Precondition const& I, + DomCorpus const* domCorpus) +{ + v = dom::LazyObject(I, domCorpus); +} + +} // clang::mrdocs::doc + +#endif // MRDOCS_API_METADATA_JAVADOC_BLOCK_PRECONDITION_HPP diff --git a/include/mrdocs/Metadata/Javadoc/Block/Returns.hpp b/include/mrdocs/Metadata/Javadoc/Block/Returns.hpp new file mode 100644 index 000000000..2108db015 --- /dev/null +++ b/include/mrdocs/Metadata/Javadoc/Block/Returns.hpp @@ -0,0 +1,100 @@ +// +// This is a derivative work. originally part of the LLVM Project. +// Licensed under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// Copyright (c) 2023 Vinnie Falco (vinnie.falco@gmail.com) +// Copyright (c) 2023 Krystian Stasiowski (sdkrystian@gmail.com) +// +// Official repository: https://github.com/cppalliance/mrdocs +// + +#ifndef MRDOCS_API_METADATA_JAVADOC_BLOCK_RETURNS_HPP +#define MRDOCS_API_METADATA_JAVADOC_BLOCK_RETURNS_HPP + +#include +#include +#include +#include + +namespace clang::mrdocs::doc { + +/** Documentation for a function return type +*/ +struct Returns final : Paragraph +{ + static constexpr NodeKind static_kind = NodeKind::returns; + + Returns() + : Paragraph(NodeKind::returns) + { + } + + explicit + Returns(std::string_view const text) + : Returns() + { + operator=(text); + } + + explicit + Returns(Paragraph const& other) + : Returns() + { + children = other.children; + } + + Returns& + operator=(std::string_view const text) override + { + Paragraph::operator=(text); + return *this; + } + + auto operator<=>(Returns const&) const = default; + + bool operator==(Returns const&) + const noexcept = default; + + bool equals(Node const& other) const noexcept override + { + return Kind == other.Kind && + *this == dynamic_cast(other); + } +}; + +/** Map the @ref Returns to a @ref dom::Object. + + @param t The tag. + @param io The output object. + @param I The input object. + @param domCorpus The DOM corpus, or nullptr if not part of a corpus. + */ +template +void +tag_invoke( + dom::LazyObjectMapTag t, + IO& io, + Returns const& I, + DomCorpus const* domCorpus) +{ + tag_invoke(t, io, dynamic_cast(I), domCorpus); +} + +/** Return the @ref Returns as a @ref dom::Value object. + */ +inline +void +tag_invoke( + dom::ValueFromTag, + dom::Value& v, + Returns const& I, + DomCorpus const* domCorpus) +{ + v = dom::LazyObject(I, domCorpus); +} + +} // clang::mrdocs::doc + +#endif // MRDOCS_API_METADATA_JAVADOC_BLOCK_RETURNS_HPP diff --git a/include/mrdocs/Metadata/Javadoc/Block/See.hpp b/include/mrdocs/Metadata/Javadoc/Block/See.hpp new file mode 100644 index 000000000..27ba2b974 --- /dev/null +++ b/include/mrdocs/Metadata/Javadoc/Block/See.hpp @@ -0,0 +1,81 @@ +// +// This is a derivative work. originally part of the LLVM Project. +// Licensed under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// Copyright (c) 2023 Vinnie Falco (vinnie.falco@gmail.com) +// Copyright (c) 2023 Krystian Stasiowski (sdkrystian@gmail.com) +// +// Official repository: https://github.com/cppalliance/mrdocs +// + +#ifndef MRDOCS_API_METADATA_JAVADOC_BLOCK_SEE_HPP +#define MRDOCS_API_METADATA_JAVADOC_BLOCK_SEE_HPP + +#include +#include +#include +#include + +namespace clang::mrdocs::doc { + +/** A @see paragraph +*/ +struct See final : Paragraph +{ + static constexpr auto static_kind = NodeKind::see; + + See() + : Paragraph(static_kind) + { + } + + using Paragraph::operator=; + + auto operator<=>(See const&) const = default; + + bool operator==(See const&) + const noexcept = default; + + bool equals(Node const& other) const noexcept override + { + return Kind == other.Kind && + *this == dynamic_cast(other); + } +}; + +/** Map the @ref See to a @ref dom::Object. + + @param t The tag. + @param io The output object. + @param I The input object. + @param domCorpus The DOM corpus, or nullptr if not part of a corpus. + */ +template +void +tag_invoke( + dom::LazyObjectMapTag t, + IO& io, + See const& I, + DomCorpus const* domCorpus) +{ + tag_invoke(t, io, dynamic_cast(I), domCorpus); +} + +/** Return the @ref See as a @ref dom::Value object. + */ +inline +void +tag_invoke( + dom::ValueFromTag, + dom::Value& v, + See const& I, + DomCorpus const* domCorpus) +{ + v = dom::LazyObject(I, domCorpus); +} + +} // clang::mrdocs::doc + +#endif // MRDOCS_API_METADATA_JAVADOC_BLOCK_SEE_HPP diff --git a/include/mrdocs/Metadata/Javadoc/Block/TParam.hpp b/include/mrdocs/Metadata/Javadoc/Block/TParam.hpp new file mode 100644 index 000000000..6a999fa94 --- /dev/null +++ b/include/mrdocs/Metadata/Javadoc/Block/TParam.hpp @@ -0,0 +1,81 @@ +// +// This is a derivative work. originally part of the LLVM Project. +// Licensed under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// Copyright (c) 2023 Vinnie Falco (vinnie.falco@gmail.com) +// Copyright (c) 2023 Krystian Stasiowski (sdkrystian@gmail.com) +// +// Official repository: https://github.com/cppalliance/mrdocs +// + +#ifndef MRDOCS_API_METADATA_JAVADOC_BLOCK_TPARAM_HPP +#define MRDOCS_API_METADATA_JAVADOC_BLOCK_TPARAM_HPP + +#include +#include +#include +#include + +namespace clang::mrdocs::doc { + +/** Documentation for a template parameter +*/ +struct TParam final : Paragraph +{ + std::string name; + + static constexpr NodeKind static_kind = NodeKind::tparam; + + TParam() + : Paragraph(NodeKind::tparam) + { + } + + using Paragraph::operator=; + + auto operator<=>(TParam const&) const = default; + bool operator==(TParam const&) const noexcept = default; + bool equals(Node const& other) const noexcept override + { + return Kind == other.Kind && + *this == dynamic_cast(other); + } +}; + +/** Map the @ref TParam to a @ref dom::Object. + + @param t The tag. + @param io The output object. + @param I The input object. + @param domCorpus The DOM corpus, or nullptr if not part of a corpus. + */ +template +void +tag_invoke( + dom::LazyObjectMapTag t, + IO& io, + TParam const& I, + DomCorpus const* domCorpus) +{ + tag_invoke(t, io, dynamic_cast(I), domCorpus); + io.map("name", I.name); +} + +/** Return the @ref TParam as a @ref dom::Value object. + */ +inline +void +tag_invoke( + dom::ValueFromTag, + dom::Value& v, + TParam const& I, + DomCorpus const* domCorpus) +{ + v = dom::LazyObject(I, domCorpus); +} + +} // clang::mrdocs::doc + +#endif // MRDOCS_API_METADATA_JAVADOC_BLOCK_TPARAM_HPP diff --git a/include/mrdocs/Metadata/Javadoc/Block/Throws.hpp b/include/mrdocs/Metadata/Javadoc/Block/Throws.hpp new file mode 100644 index 000000000..bc6187bb9 --- /dev/null +++ b/include/mrdocs/Metadata/Javadoc/Block/Throws.hpp @@ -0,0 +1,88 @@ +// +// This is a derivative work. originally part of the LLVM Project. +// Licensed under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// Copyright (c) 2023 Vinnie Falco (vinnie.falco@gmail.com) +// Copyright (c) 2023 Krystian Stasiowski (sdkrystian@gmail.com) +// +// Official repository: https://github.com/cppalliance/mrdocs +// + +#ifndef MRDOCS_API_METADATA_JAVADOC_BLOCK_THROWS_HPP +#define MRDOCS_API_METADATA_JAVADOC_BLOCK_THROWS_HPP + +#include +#include +#include + +namespace clang::mrdocs::doc { + +/** Documentation for a function parameter +*/ +struct Throws final : Paragraph +{ + Reference exception; + + static constexpr NodeKind static_kind = NodeKind::throws; + + Throws( + std::string exception_ = std::string(), + Paragraph details_ = Paragraph()) + : Paragraph( + NodeKind::throws, + std::move(details_.children)) + , exception(std::move(exception_)) + { + } + + using Paragraph::operator=; + + auto operator<=>(Throws const&) const = default; + + bool operator==(Throws const&) + const noexcept = default; + + bool equals(Node const& other) const noexcept override + { + return Kind == other.Kind && + *this == dynamic_cast(other); + } +}; + +/** Map the @ref Throws to a @ref dom::Object. + + @param t The tag. + @param io The output object. + @param I The input object. + @param domCorpus The DOM corpus, or nullptr if not part of a corpus. + */ +template +void +tag_invoke( + dom::LazyObjectMapTag t, + IO& io, + Throws const& I, + DomCorpus const* domCorpus) +{ + tag_invoke(t, io, dynamic_cast(I), domCorpus); + io.map("exception", I.exception); +} + +/** Return the @ref Throws as a @ref dom::Value object. + */ +inline +void +tag_invoke( + dom::ValueFromTag, + dom::Value& v, + Throws const& I, + DomCorpus const* domCorpus) +{ + v = dom::LazyObject(I, domCorpus); +} + +} // clang::mrdocs::doc + +#endif // MRDOCS_API_METADATA_JAVADOC_BLOCK_THROWS_HPP diff --git a/include/mrdocs/Metadata/Javadoc/Block/UnorderedList.hpp b/include/mrdocs/Metadata/Javadoc/Block/UnorderedList.hpp new file mode 100644 index 000000000..1d87c368f --- /dev/null +++ b/include/mrdocs/Metadata/Javadoc/Block/UnorderedList.hpp @@ -0,0 +1,112 @@ +// +// This is a derivative work. originally part of the LLVM Project. +// Licensed under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// Copyright (c) 2023 Vinnie Falco (vinnie.falco@gmail.com) +// Copyright (c) 2023 Krystian Stasiowski (sdkrystian@gmail.com) +// +// Official repository: https://github.com/cppalliance/mrdocs +// + +#ifndef MRDOCS_API_METADATA_JAVADOC_BLOCK_UNORDEREDLIST_HPP +#define MRDOCS_API_METADATA_JAVADOC_BLOCK_UNORDEREDLIST_HPP + +#include +#include +#include +#include +#include +#include + +namespace clang::mrdocs::doc { + +/** A list of list items +*/ +struct UnorderedList final : Paragraph +{ + static constexpr auto static_kind = NodeKind::unordered_list; + + std::vector items; + + UnorderedList() + : Paragraph(static_kind) + { + } + + using Paragraph::operator=; + + auto operator<=>(UnorderedList const& other) const { + if (auto const cmp = items.size() <=> other.items.size(); + !std::is_eq(cmp)) + { + return cmp; + } + for (std::size_t i = 0; i < items.size(); ++i) + { + if (auto const cmp = items[i] <=> other.items[i]; + !std::is_eq(cmp)) + { + return cmp; + } + } + return std::strong_ordering::equal; + } + + bool + operator==(UnorderedList const&) const noexcept = default; + + bool + equals(Node const& other) const noexcept override + { + auto* p = dynamic_cast(&other); + if (!p) + { + return false; + } + if (this == &other) + { + return true; + } + return *this == *p; + } +}; + +/** Map the @ref UnorderedList to a @ref dom::Object. + + @param t The tag. + @param io The output object. + @param I The input object. + @param domCorpus The DOM corpus, or nullptr if not part of a corpus. + */ +template +void +tag_invoke( + dom::LazyObjectMapTag t, + IO& io, + UnorderedList const& I, + DomCorpus const* domCorpus) +{ + tag_invoke(t, io, dynamic_cast(I), domCorpus); + io.defer("items", [&I, domCorpus] { + return dom::LazyArray(I.items, domCorpus); + }); +} + +/** Return the @ref UnorderedList as a @ref dom::Value object. + */ +inline +void +tag_invoke( + dom::ValueFromTag, + dom::Value& v, + UnorderedList const& I, + DomCorpus const* domCorpus) +{ + v = dom::LazyObject(I, domCorpus); +} + +} // clang::mrdocs::doc + +#endif // MRDOCS_API_METADATA_JAVADOC_BLOCK_UNORDEREDLIST_HPP diff --git a/include/mrdocs/Metadata/Javadoc/Node.hpp b/include/mrdocs/Metadata/Javadoc/Node.hpp new file mode 100644 index 000000000..c1d49caa8 --- /dev/null +++ b/include/mrdocs/Metadata/Javadoc/Node.hpp @@ -0,0 +1,160 @@ +// +// This is a derivative work. originally part of the LLVM Project. +// Licensed under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// Copyright (c) 2023 Vinnie Falco (vinnie.falco@gmail.com) +// Copyright (c) 2023 Krystian Stasiowski (sdkrystian@gmail.com) +// +// Official repository: https://github.com/cppalliance/mrdocs +// + +#ifndef MRDOCS_API_METADATA_JAVADOC_NODE_HPP +#define MRDOCS_API_METADATA_JAVADOC_NODE_HPP + +#include +#include +#include +#include +#include +#include + +/** Javadoc related types and functions. + + Javadoc is a documentation generator originally + created for the Java language from source code. + + The Javadoc documentation generator tool can interpret + text in the "doc comments" format included + directly in the source code. + + The same "doc comments" format has been replicated + and extended by documentation systems for other + languages, including the cross-language Doxygen + and the JSDoc system for JavaScript. + + Because Clang can already parse and extract + blocks of Javadoc-style comments from source + code, these classes are used to represent the + parsed documentation in a structured form. + + @see https://en.wikipedia.org/wiki/Javadoc + @see https://www.doxygen.nl + + */ +namespace clang::mrdocs::doc { + +/** Visit a node. + + @param node The node to visit. + @param fn The function to call for each node. + @param args Additional arguments to pass to the function. + @return The result of calling the function. + */ +template< + class NodeTy, + class Fn, + class... Args> +requires + std::same_as, Node> +decltype(auto) +visit( + NodeTy& node, + Fn&& fn, + Args&&... args) +{ + auto visitor = makeVisitor( + node, std::forward(fn), + std::forward(args)...); + switch(node.Kind) + { + case NodeKind::admonition: + return visitor.template visit(); + case NodeKind::brief: + return visitor.template visit(); + case NodeKind::code: + return visitor.template visit(); + case NodeKind::heading: + return visitor.template visit(); + case NodeKind::paragraph: + return visitor.template visit(); + case NodeKind::link: + return visitor.template visit(); + case NodeKind::reference: + return visitor.template visit(); + case NodeKind::copy_details: + return visitor.template visit(); + case NodeKind::list_item: + return visitor.template visit(); + case NodeKind::unordered_list: + return visitor.template visit(); + case NodeKind::param: + return visitor.template visit(); + case NodeKind::returns: + return visitor.template visit(); + case NodeKind::styled: + return visitor.template visit(); + case NodeKind::text: + return visitor.template visit(); + case NodeKind::tparam: + return visitor.template visit(); + case NodeKind::throws: + return visitor.template visit(); + case NodeKind::see: + return visitor.template visit(); + case NodeKind::precondition: + return visitor.template visit(); + case NodeKind::postcondition: + return visitor.template visit(); + default: + MRDOCS_UNREACHABLE(); + } +} + +/** Traverse a list of nodes. + + @param list The list of nodes to traverse. + @param f The function to call for each node. + @param args Additional arguments to pass to the function. + */ +template +requires std::derived_from +void traverse( + std::vector> const& list, + F&& f, Args&&... args) +{ + for(auto const& node : list) + visit(*node, + std::forward(f), + std::forward(args)...); +} + +/** Map the Polymorphic Node as a @ref dom::Value object. + + @param io The output parameter to receive the dom::Object. + @param I The input object. + @param domCorpus The DOM corpus, or nullptr if not part of a corpus. + */ +template +void +tag_invoke( + dom::ValueFromTag, + IO& io, + Polymorphic const& I, + DomCorpus const* domCorpus) +{ + visit(*I, [&](auto const& U) + { + tag_invoke( + dom::ValueFromTag{}, + io, + U, + domCorpus); + }); +} + + +} // clang::mrdocs::doc + +#endif diff --git a/include/mrdocs/Metadata/Javadoc/Node/NodeBase.hpp b/include/mrdocs/Metadata/Javadoc/Node/NodeBase.hpp new file mode 100644 index 000000000..20a4c35cb --- /dev/null +++ b/include/mrdocs/Metadata/Javadoc/Node/NodeBase.hpp @@ -0,0 +1,93 @@ +// +// This is a derivative work. originally part of the LLVM Project. +// Licensed under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// Copyright (c) 2023 Vinnie Falco (vinnie.falco@gmail.com) +// Copyright (c) 2023 Krystian Stasiowski (sdkrystian@gmail.com) +// +// Official repository: https://github.com/cppalliance/mrdocs +// + +#ifndef MRDOCS_API_METADATA_JAVADOC_NODE_NODEBASE_HPP +#define MRDOCS_API_METADATA_JAVADOC_NODE_NODEBASE_HPP + +#include +#include +#include +#include + +namespace clang::mrdocs::doc { + +//-------------------------------------------- + +/** This is a variant-like list element. + + There are two types of nodes: text and block. + + - The javadoc is a list of blocks. + - A block contains a list of text elements. + - A text element contains a string. +*/ +struct MRDOCS_DECL + Node +{ + NodeKind Kind; + + virtual ~Node() = default; + + explicit Node(NodeKind const kind_) noexcept + : Kind(kind_) + { + } + + virtual bool isBlock() const noexcept = 0; + + bool isText() const noexcept + { + return ! isBlock(); + } + + auto operator<=>(Node const&) const = default; + bool operator==(Node const&)const noexcept = default; + virtual bool equals(Node const& other) const noexcept + { + return Kind == other.Kind; + } +}; + +/** Map the @ref Node to a @ref dom::Object. + + @param io The output parameter to receive the dom::Object. + @param I The input object. + @param domCorpus The DOM corpus, or nullptr if not part of a corpus. + */ +template +void +tag_invoke( + dom::LazyObjectMapTag, + IO& io, + Node const& I, + DomCorpus const* domCorpus) +{ + MRDOCS_ASSERT(domCorpus); + io.map("kind", I.Kind); +} + +/** Return the @ref Node as a @ref dom::Value object. + */ +inline +void +tag_invoke( + dom::ValueFromTag, + dom::Value& v, + Node const& I, + DomCorpus const* domCorpus) +{ + v = dom::LazyObject(I, domCorpus); +} + +} // clang::mrdocs::doc + +#endif // MRDOCS_API_METADATA_JAVADOC_NODE_NODEBASE_HPP diff --git a/include/mrdocs/Metadata/Javadoc/Node/NodeKind.hpp b/include/mrdocs/Metadata/Javadoc/Node/NodeKind.hpp new file mode 100644 index 000000000..12f6800c0 --- /dev/null +++ b/include/mrdocs/Metadata/Javadoc/Node/NodeKind.hpp @@ -0,0 +1,132 @@ +// +// This is a derivative work. originally part of the LLVM Project. +// Licensed under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// Copyright (c) 2023 Vinnie Falco (vinnie.falco@gmail.com) +// Copyright (c) 2023 Krystian Stasiowski (sdkrystian@gmail.com) +// +// Official repository: https://github.com/cppalliance/mrdocs +// + +#ifndef MRDOCS_API_METADATA_JAVADOC_NODE_NODEKIND_HPP +#define MRDOCS_API_METADATA_JAVADOC_NODE_NODEKIND_HPP + +#include +#include + +namespace clang::mrdocs::doc { + +/** The kind of node. + + This includes tags and block types. + + Some of the available tags are: + + @li `@author Author Name` + @li `{@docRoot}` + @li `@version version` + @li `@since since-text ` + @li `@see reference` + @li `@param name description` + @li `@return description` + @li `@exception classname description` + @li `@throws classname description` + @li `@deprecated description` + @li `{@inheritDoc}` + @li `{@link reference}` + @li `{@linkplain reference}` + @li `{@value #STATIC_FIELD}` + @li `{@code literal}` + @li `{@literal literal}` + @li `{@serial literal}` + @li `{@serialData literal}` + @li `{@serialField literal}` + + Doxygen also introduces a number of additional tags on top + of the the doc comment specification. + + @note When a new tag is added, the `visit` function overloads + must be updated to handle the new tag. + + @see https://en.wikipedia.org/wiki/Javadoc[Javadoc - Wikipedia] + @see https://docs.oracle.com/javase/1.5.0/docs/tooldocs/solaris/javadoc.html[Javadoc Documentation] + @see https://docs.oracle.com/en/java/javase/13/docs/specs/javadoc/doc-comment-spec.html[Doc Comment Specification] + @see https://www.oracle.com/java/technologies/javase/javadoc-tool.html[Javadoc Tool] + @see https://www.oracle.com/technical-resources/articles/java/javadoc-tool.html[How to Write Doc Comments] + @see https://docs.oracle.com/javase/8/docs/technotes/tools/unix/javadoc.html[Javadoc Package] + @see https://web.archive.org/web/20170714215721/http://agile.csc.ncsu.edu:80/SEMaterials/tutorials/javadoc[Javadoc Tutorial] + @see https://en.wikipedia.org/wiki/Doxygen[Doxygen - Wikipedia] + @see https://www.doxygen.nl/manual/commands.html[Doxygen Special Tags] + + */ +enum class NodeKind +{ + // VFALCO Don't forget to update + // Node::isText() and Node::isBlock() + // when changing this enum! + + /// A text tag + text = 1, // needed by bitstream + /// An admonition tag + admonition, + /// A brief tag + brief, + /// A code tag + code, + /// A heading tag + heading, + /// A link tag + link, + /// A list_item tag + list_item, + /// An unordered_list tag + unordered_list, + /// A paragraph tag + paragraph, + /// A param tag + param, + /// A returns tag + returns, + /// A styled tag + styled, + /// A tparam tag + tparam, + /// A reference tag + reference, + /// A copy_details tag + copy_details, + /// A throws tag + throws, + /// A details tag + details, + /// A see tag + see, + /// A general tag. + precondition, + /// A postcondition tag. + postcondition +}; + +/** Return the name of the NodeKind as a string. + */ +MRDOCS_DECL +dom::String +toString(NodeKind kind) noexcept; + +/** Return the NodeKind from a @ref dom::Value string. + */ +inline +void +tag_invoke( + dom::ValueFromTag, + dom::Value& v, + NodeKind const kind) +{ + v = toString(kind); +} + +} // clang::mrdocs::doc + +#endif // MRDOCS_API_METADATA_JAVADOC_NODE_NODEKIND_HPP diff --git a/include/mrdocs/Metadata/Javadoc/Text.hpp b/include/mrdocs/Metadata/Javadoc/Text.hpp new file mode 100644 index 000000000..5dc97981f --- /dev/null +++ b/include/mrdocs/Metadata/Javadoc/Text.hpp @@ -0,0 +1,122 @@ +// +// This is a derivative work. originally part of the LLVM Project. +// Licensed under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// Copyright (c) 2023 Vinnie Falco (vinnie.falco@gmail.com) +// Copyright (c) 2023 Krystian Stasiowski (sdkrystian@gmail.com) +// +// Official repository: https://github.com/cppalliance/mrdocs +// + +#ifndef MRDOCS_API_METADATA_JAVADOC_TEXT_HPP +#define MRDOCS_API_METADATA_JAVADOC_TEXT_HPP + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace clang::mrdocs::doc { + +/** Visit a text. + + @param text The text to visit. + @param fn The function to call for each text. + @param args Additional arguments to pass to the function. + @return The result of calling the function. + */ +template< + class TextTy, + class Fn, + class... Args> + requires std::derived_from +decltype(auto) +visit( + TextTy& text, + Fn&& fn, + Args&&... args) +{ + auto visitor = makeVisitor( + text, std::forward(fn), + std::forward(args)...); + switch(text.Kind) + { + case NodeKind::link: + return visitor.template visit(); + case NodeKind::reference: + return visitor.template visit(); + case NodeKind::copy_details: + return visitor.template visit(); + case NodeKind::styled: + return visitor.template visit(); + case NodeKind::text: + return visitor.template visit(); + default: + MRDOCS_UNREACHABLE(); + } +} + +/** Traverse a list of texts. + + @param list The list of texts to traverse. + @param f The function to call for each text. + @param args Additional arguments to pass to the function. + */ +template +requires std::derived_from +void traverse( + std::vector> const& list, + F&& f, Args&&... args) +{ + for(auto const& text : list) + visit(*text, + std::forward(f), + std::forward(args)...); +} + +/** Map the Polymorphic Text as a @ref dom::Value object. + + @param io The output parameter to receive the dom::Object. + @param I The input object. + @param domCorpus The DOM corpus, or nullptr if not part of a corpus. + */ +template TextTy> +void +tag_invoke( + dom::ValueFromTag, + IO& io, + TextTy const& I, + DomCorpus const* domCorpus) +{ + visit(*I, [&](auto const& U) + { + tag_invoke( + dom::ValueFromTag{}, + io, + U, + domCorpus); + }); +} + +MRDOCS_DECL +std::strong_ordering +operator<=>(Polymorphic const& lhs, Polymorphic const& rhs); + +inline +bool +operator==(Polymorphic const& lhs, Polymorphic const& rhs) { + return std::is_eq(lhs <=> rhs); +} + +} // clang::mrdocs::doc + +#endif // MRDOCS_API_METADATA_JAVADOC_TEXT_HPP diff --git a/include/mrdocs/Metadata/Javadoc/Text/CopyDetails.hpp b/include/mrdocs/Metadata/Javadoc/Text/CopyDetails.hpp new file mode 100644 index 000000000..9fcaa3e5a --- /dev/null +++ b/include/mrdocs/Metadata/Javadoc/Text/CopyDetails.hpp @@ -0,0 +1,80 @@ +// +// This is a derivative work. originally part of the LLVM Project. +// Licensed under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// Copyright (c) 2023 Vinnie Falco (vinnie.falco@gmail.com) +// Copyright (c) 2023 Krystian Stasiowski (sdkrystian@gmail.com) +// +// Official repository: https://github.com/cppalliance/mrdocs +// + +#ifndef MRDOCS_API_METADATA_JAVADOC_TEXT_COPYDETAILS_HPP +#define MRDOCS_API_METADATA_JAVADOC_TEXT_COPYDETAILS_HPP + +#include +#include +#include +#include + +namespace clang::mrdocs::doc { + +/** Documentation copied from another symbol. +*/ +struct CopyDetails final : Reference +{ + static constexpr auto static_kind = NodeKind::copy_details; + + CopyDetails(std::string string_ = std::string()) noexcept + : Reference(std::move(string_), NodeKind::copy_details) + { + } + + auto operator<=>(CopyDetails const&) const = default; + bool operator==(CopyDetails const&) const noexcept = default; + bool equals(Node const& other) const noexcept override + { + return Kind == other.Kind && + *this == dynamic_cast(other); + } +}; + +/** Map the @ref CopyDetails to a @ref dom::Object. + + @param t The tag. + @param io The output object. + @param I The input object. + @param domCorpus The DOM corpus, or nullptr if not part of a corpus. + */ +template +void +tag_invoke( + dom::LazyObjectMapTag t, + IO& io, + CopyDetails const& I, + DomCorpus const* domCorpus) +{ + tag_invoke(t, io, dynamic_cast(I), domCorpus); +} + +/** Return the @ref CopyDetails as a @ref dom::Value object. + + @param v The output value. + @param I The input object. + @param domCorpus The DOM corpus, or nullptr if not part of a corpus. + */ +inline +void +tag_invoke( + dom::ValueFromTag, + dom::Value& v, + CopyDetails const& I, + DomCorpus const* domCorpus) +{ + v = dom::LazyObject(I, domCorpus); +} + +} // clang::mrdocs::doc + +#endif // MRDOCS_API_METADATA_JAVADOC_TEXT_COPYDETAILS_HPP diff --git a/include/mrdocs/Metadata/Javadoc/Text/Link.hpp b/include/mrdocs/Metadata/Javadoc/Text/Link.hpp new file mode 100644 index 000000000..0020f98d9 --- /dev/null +++ b/include/mrdocs/Metadata/Javadoc/Text/Link.hpp @@ -0,0 +1,82 @@ +// +// This is a derivative work. originally part of the LLVM Project. +// Licensed under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// Copyright (c) 2023 Vinnie Falco (vinnie.falco@gmail.com) +// Copyright (c) 2023 Krystian Stasiowski (sdkrystian@gmail.com) +// +// Official repository: https://github.com/cppalliance/mrdocs +// + +#ifndef MRDOCS_API_METADATA_JAVADOC_TEXT_LINK_HPP +#define MRDOCS_API_METADATA_JAVADOC_TEXT_LINK_HPP + +#include +#include +#include + +namespace clang::mrdocs::doc { + +/** A hyperlink. +*/ +struct Link final : Text +{ + std::string href; + + static constexpr auto static_kind = NodeKind::link; + + explicit + Link( + std::string string_ = std::string(), + std::string href_ = std::string()) noexcept + : Text(std::move(string_), NodeKind::link) + , href(std::move(href_)) + { + } + + auto operator<=>(Link const&) const = default; + bool operator==(Link const&) const noexcept = default; + bool equals(Node const& other) const noexcept override + { + return Kind == other.Kind && + *this == dynamic_cast(other); + } +}; + +/** Map the @ref Link to a @ref dom::Object. + + @param t The tag. + @param io The output object. + @param I The input object. + @param domCorpus The DOM corpus, or nullptr if not part of a corpus. + */ +template +void +tag_invoke( + dom::LazyObjectMapTag t, + IO& io, + Link const& I, + DomCorpus const* domCorpus) +{ + tag_invoke(t, io, dynamic_cast(I), domCorpus); + io.map("href", I.href); +} + +/** Return the @ref Link as a @ref dom::Value object. + */ +inline +void +tag_invoke( + dom::ValueFromTag, + dom::Value& v, + Link const& I, + DomCorpus const* domCorpus) +{ + v = dom::LazyObject(I, domCorpus); +} + +} // clang::mrdocs::doc + +#endif // MRDOCS_API_METADATA_JAVADOC_TEXT_LINK_HPP diff --git a/include/mrdocs/Metadata/Javadoc/Text/Parts.hpp b/include/mrdocs/Metadata/Javadoc/Text/Parts.hpp new file mode 100644 index 000000000..b7f94b39d --- /dev/null +++ b/include/mrdocs/Metadata/Javadoc/Text/Parts.hpp @@ -0,0 +1,57 @@ +// +// This is a derivative work. originally part of the LLVM Project. +// Licensed under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// Copyright (c) 2023 Vinnie Falco (vinnie.falco@gmail.com) +// Copyright (c) 2023 Krystian Stasiowski (sdkrystian@gmail.com) +// +// Official repository: https://github.com/cppalliance/mrdocs +// + +#ifndef MRDOCS_API_METADATA_JAVADOC_TEXT_PARTS_HPP +#define MRDOCS_API_METADATA_JAVADOC_TEXT_PARTS_HPP + +#include +#include + +namespace clang::mrdocs::doc { + +/** Which parts of the documentation to copy. + + @li `all`: copy the brief and the description. + @li `brief`: only copy the brief. + @li `description`: only copy the description. +*/ +enum class Parts +{ + /// Copy the brief and the description + all = 1, // needed by bitstream + /// Copy the brief + brief, + /// Copy the description + description +}; + +/** Return the name of the Parts as a string. + */ +MRDOCS_DECL +dom::String +toString(Parts kind) noexcept; + +/** Return the Parts from a @ref dom::Value string. + */ +inline +void +tag_invoke( + dom::ValueFromTag, + dom::Value& v, + Parts const kind) +{ + v = toString(kind); +} + +} // clang::mrdocs::doc + +#endif // MRDOCS_API_METADATA_JAVADOC_TEXT_PARTS_HPP diff --git a/include/mrdocs/Metadata/Javadoc/Text/Reference.hpp b/include/mrdocs/Metadata/Javadoc/Text/Reference.hpp new file mode 100644 index 000000000..d1131d82e --- /dev/null +++ b/include/mrdocs/Metadata/Javadoc/Text/Reference.hpp @@ -0,0 +1,89 @@ +// +// This is a derivative work. originally part of the LLVM Project. +// Licensed under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// Copyright (c) 2023 Vinnie Falco (vinnie.falco@gmail.com) +// Copyright (c) 2023 Krystian Stasiowski (sdkrystian@gmail.com) +// +// Official repository: https://github.com/cppalliance/mrdocs +// + +#ifndef MRDOCS_API_METADATA_JAVADOC_TEXT_REFERENCE_HPP +#define MRDOCS_API_METADATA_JAVADOC_TEXT_REFERENCE_HPP + +#include +#include +#include +#include + +namespace clang::mrdocs::doc { + +/** A reference to a symbol. +*/ +struct Reference : Text +{ + SymbolID id = SymbolID::invalid; + + static constexpr auto static_kind = NodeKind::reference; + + explicit + Reference( + std::string string_ = std::string()) noexcept + : Text(std::move(string_), NodeKind::reference) + { + } + + auto operator<=>(Reference const&) const = default; + bool operator==(Reference const&) const noexcept = default; + bool equals(Node const& other) const noexcept override + { + return Kind == other.Kind && + *this == dynamic_cast(other); + } + +protected: + Reference( + std::string string_, + NodeKind const kind_) noexcept + : Text(std::move(string_), kind_) + { + } +}; + +/** Map the @ref Reference to a @ref dom::Object. + + @param t The tag. + @param io The output object. + @param I The input object. + @param domCorpus The DOM corpus, or nullptr if not part of a corpus. + */ +template +void +tag_invoke( + dom::LazyObjectMapTag t, + IO& io, + Reference const& I, + DomCorpus const* domCorpus) +{ + tag_invoke(t, io, dynamic_cast(I), domCorpus); + io.map("symbol", I.id); +} + +/** Return the @ref Reference as a @ref dom::Value object. + */ +inline +void +tag_invoke( + dom::ValueFromTag, + dom::Value& v, + Reference const& I, + DomCorpus const* domCorpus) +{ + v = dom::LazyObject(I, domCorpus); +} + +} // clang::mrdocs::doc + +#endif // MRDOCS_API_METADATA_JAVADOC_TEXT_REFERENCE_HPP diff --git a/include/mrdocs/Metadata/Javadoc/Text/Style.hpp b/include/mrdocs/Metadata/Javadoc/Text/Style.hpp new file mode 100644 index 000000000..acdfeb094 --- /dev/null +++ b/include/mrdocs/Metadata/Javadoc/Text/Style.hpp @@ -0,0 +1,58 @@ +// +// This is a derivative work. originally part of the LLVM Project. +// Licensed under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// Copyright (c) 2023 Vinnie Falco (vinnie.falco@gmail.com) +// Copyright (c) 2023 Krystian Stasiowski (sdkrystian@gmail.com) +// +// Official repository: https://github.com/cppalliance/mrdocs +// + +#ifndef MRDOCS_API_METADATA_JAVADOC_TEXT_STYLE_HPP +#define MRDOCS_API_METADATA_JAVADOC_TEXT_STYLE_HPP + +#include +#include + +namespace clang::mrdocs::doc { + +/** The text style. +*/ +enum class Style +{ + /// No style + none = 1, // needed by bitstream + /// Monospaced text + mono, + /// Bold text + bold, + /// Italic text + italic +}; + +/** Return the name of the @ref Style as a string. + + @param kind The style kind. + @return The string representation of the style. + */ +MRDOCS_DECL +dom::String +toString(Style kind) noexcept; + +/** Return the @ref Style from a @ref dom::Value string. + */ +inline +void +tag_invoke( + dom::ValueFromTag, + dom::Value& v, + Style const kind) +{ + v = toString(kind); +} + +} // clang::mrdocs::doc + +#endif // MRDOCS_API_METADATA_JAVADOC_TEXT_STYLE_HPP diff --git a/include/mrdocs/Metadata/Javadoc/Text/Styled.hpp b/include/mrdocs/Metadata/Javadoc/Text/Styled.hpp new file mode 100644 index 000000000..5cc4e2c4b --- /dev/null +++ b/include/mrdocs/Metadata/Javadoc/Text/Styled.hpp @@ -0,0 +1,82 @@ +// +// This is a derivative work. originally part of the LLVM Project. +// Licensed under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// Copyright (c) 2023 Vinnie Falco (vinnie.falco@gmail.com) +// Copyright (c) 2023 Krystian Stasiowski (sdkrystian@gmail.com) +// +// Official repository: https://github.com/cppalliance/mrdocs +// + +#ifndef MRDOCS_API_METADATA_JAVADOC_TEXT_STYLED_HPP +#define MRDOCS_API_METADATA_JAVADOC_TEXT_STYLED_HPP + +#include +#include +#include +#include + +namespace clang::mrdocs::doc { + +/** A piece of styled text. +*/ +struct Styled final : Text +{ + Style style; + + static constexpr auto static_kind = NodeKind::styled; + + Styled( + std::string string_ = std::string(), + Style style_ = Style::none) noexcept + : Text(std::move(string_), NodeKind::styled) + , style(style_) + { + } + + auto operator<=>(Styled const&) const = default; + bool operator==(Styled const&) const noexcept = default; + bool equals(Node const& other) const noexcept override + { + return Kind == other.Kind && + *this == dynamic_cast(other); + } +}; + +/** Map the @ref Styled to a @ref dom::Object. + + @param t The tag. + @param io The output object. + @param I The input object. + @param domCorpus The DOM corpus, or nullptr if not part of a corpus. + */ +template +void +tag_invoke( + dom::LazyObjectMapTag t, + IO& io, + Styled const& I, + DomCorpus const* domCorpus) +{ + tag_invoke(t, io, dynamic_cast(I), domCorpus); + io.map("style", I.style); +} + +/** Return the @ref Styled as a @ref dom::Value object. + */ +inline +void +tag_invoke( + dom::ValueFromTag, + dom::Value& v, + Styled const& I, + DomCorpus const* domCorpus) +{ + v = dom::LazyObject(I, domCorpus); +} + +} // clang::mrdocs::doc + +#endif // MRDOCS_API_METADATA_JAVADOC_TEXT_STYLED_HPP diff --git a/include/mrdocs/Metadata/Javadoc/Text/TextBase.hpp b/include/mrdocs/Metadata/Javadoc/Text/TextBase.hpp new file mode 100644 index 000000000..e2a4e2ddf --- /dev/null +++ b/include/mrdocs/Metadata/Javadoc/Text/TextBase.hpp @@ -0,0 +1,100 @@ +// +// This is a derivative work. originally part of the LLVM Project. +// Licensed under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// Copyright (c) 2023 Vinnie Falco (vinnie.falco@gmail.com) +// Copyright (c) 2023 Krystian Stasiowski (sdkrystian@gmail.com) +// +// Official repository: https://github.com/cppalliance/mrdocs +// + +#ifndef MRDOCS_API_METADATA_JAVADOC_TEXT_TEXTBASE_HPP +#define MRDOCS_API_METADATA_JAVADOC_TEXT_TEXTBASE_HPP + +#include +#include +#include + +namespace clang::mrdocs::doc { + +/** A Node containing a string of text. + + There will be no newlines in the text. Otherwise, + this would be represented as multiple text nodes + within a Paragraph node. +*/ +struct Text : Node +{ + std::string string; + + static constexpr auto static_kind = NodeKind::text; + + explicit + Text( + std::string string_ = std::string()) noexcept + : Node(NodeKind::text) + , string(std::move(string_)) + { + } + + bool + isBlock() const noexcept final + { + return false; + } + + auto operator<=>(Text const&) const = default; + bool operator==(Text const&) const noexcept = default; + bool equals(Node const& other) const noexcept override + { + return Kind == other.Kind && + *this == dynamic_cast(other); + } + +protected: + Text( + std::string string_, + NodeKind kind_) + : Node(kind_) + , string(std::move(string_)) + { + } +}; + +/** Map the @ref Text to a @ref dom::Object. + + @param t The tag. + @param io The output object. + @param I The input object. + @param domCorpus The DOM corpus, or nullptr if not part of a corpus. + */ +template +void +tag_invoke( + dom::LazyObjectMapTag t, + IO& io, + Text const& I, + DomCorpus const* domCorpus) +{ + tag_invoke(t, io, dynamic_cast(I), domCorpus); + io.map("string", I.string); +} + +/** Return the @ref Text as a @ref dom::Value object. + */ +inline +void +tag_invoke( + dom::ValueFromTag, + dom::Value& v, + Text const& I, + DomCorpus const* domCorpus) +{ + v = dom::LazyObject(I, domCorpus); +} + +} // clang::mrdocs::doc + +#endif // MRDOCS_API_METADATA_JAVADOC_TEXT_TEXTBASE_HPP diff --git a/include/mrdocs/Metadata/Name.hpp b/include/mrdocs/Metadata/Name.hpp index 9ea25520d..d4505c251 100644 --- a/include/mrdocs/Metadata/Name.hpp +++ b/include/mrdocs/Metadata/Name.hpp @@ -13,133 +13,13 @@ #define MRDOCS_API_METADATA_NAME_HPP #include -#include -#include +#include +#include +#include #include namespace clang::mrdocs { -enum class NameKind -{ - /// A simple identifier - Identifier = 1, // for bitstream - /// A template instantiation - Specialization -}; - -MRDOCS_DECL -dom::String -toString(NameKind kind) noexcept; - -inline -void -tag_invoke( - dom::ValueFromTag, - dom::Value& v, - NameKind const kind) -{ - v = toString(kind); -} - -/** Represents a name for a named `TypeInfo` - - When the `TypeInfo` is a named type, this class - represents the name of the type. - - It also includes the symbol ID of the named type, - so that it can be referenced in the documentation. - - This allows the `TypeInfo` to store either a - `NameInfo` or a `SpecializationNameInfo`, - which contains the arguments for a template specialization - without requiring the application to extract an - unnecessary symbol. - */ -struct NameInfo -{ - /** The kind of name this is. - */ - NameKind Kind; - - /** The SymbolID of the named symbol, if it exists. - */ - SymbolID id = SymbolID::invalid; - - /** The unqualified name. - */ - std::string Name; - - /** The parent name info, if any. - - This recursively includes information about - the parent, such as the symbol ID and - potentially template arguments, when - the parent is a SpecializationNameInfo. - - This is particularly useful because the - parent of `id` could be a primary template. - In this case, the Prefix will contain - this primary template information - and the template arguments. - - */ - Polymorphic Prefix = std::nullopt; - - constexpr bool isIdentifier() const noexcept { return Kind == NameKind::Identifier; } - constexpr bool isSpecialization() const noexcept { return Kind == NameKind::Specialization; } - - constexpr - NameInfo() noexcept - : NameInfo(NameKind::Identifier) {} - - explicit - constexpr - NameInfo(NameKind const kind) noexcept - : Kind(kind) {} - - constexpr virtual ~NameInfo() = default; - - std::strong_ordering - operator<=>(NameInfo const& other) const; - - bool - operator==(NameInfo const& other) const - { - return std::is_eq(*this <=> other); - } -}; - -/** Represents a (possibly qualified) symbol name with template arguments. -*/ -struct SpecializationNameInfo final - : NameInfo -{ - /** The template arguments. - */ - std::vector> TemplateArgs; - - /** The SymbolID of the named symbol, if it exists. - */ - SymbolID specializationID = SymbolID::invalid; - - constexpr - SpecializationNameInfo() noexcept - : NameInfo(NameKind::Specialization) - {} - - auto - operator<=>(SpecializationNameInfo const& other) const - { - if (auto const r = - dynamic_cast(*this) <=> dynamic_cast(other); - !std::is_eq(r)) - { - return r; - } - return TemplateArgs <=> other.TemplateArgs; - } -}; - template< std::derived_from NameInfoTy, class Fn, @@ -155,7 +35,7 @@ visit( switch(info.Kind) { case NameKind::Identifier: - return visitor.template visit(); + return visitor.template visit(); case NameKind::Specialization: return visitor.template visit(); default: @@ -167,41 +47,45 @@ MRDOCS_DECL std::strong_ordering operator<=>(Polymorphic const& lhs, Polymorphic const& rhs); -inline -bool -operator==(Polymorphic const& lhs, Polymorphic const& rhs) { +inline bool +operator==(Polymorphic const& lhs, Polymorphic const& rhs) +{ return lhs <=> rhs == std::strong_ordering::equal; } -MRDOCS_DECL -std::string -toString(NameInfo const& N); - -MRDOCS_DECL +inline void tag_invoke( dom::ValueFromTag, dom::Value& v, - NameInfo const& I, - DomCorpus const* domCorpus); + Polymorphic const& I, + DomCorpus const* domCorpus) +{ + if(I.valueless_after_move()) + { + v = nullptr; + return; + } + tag_invoke(dom::ValueFromTag{}, v, *I, domCorpus); +} inline void tag_invoke( dom::ValueFromTag, dom::Value& v, - Polymorphic const& I, + Optional> const& I, DomCorpus const* domCorpus) { - if(! I) + if (!I) { v = nullptr; return; } + MRDOCS_ASSERT(!I->valueless_after_move()); tag_invoke(dom::ValueFromTag{}, v, *I, domCorpus); } - } // clang::mrdocs #endif diff --git a/include/mrdocs/Metadata/Name/IdentifierNameInfo.hpp b/include/mrdocs/Metadata/Name/IdentifierNameInfo.hpp new file mode 100644 index 000000000..093bedd4f --- /dev/null +++ b/include/mrdocs/Metadata/Name/IdentifierNameInfo.hpp @@ -0,0 +1,48 @@ +// +// Licensed under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// Copyright (c) 2025 Alan de Freitas (alandefreitas@gmail.com) +// +// Official repository: https://github.com/cppalliance/mrdocs +// + +#ifndef MRDOCS_API_METADATA_NAME_IDENTIFIERNAMEINFO_HPP +#define MRDOCS_API_METADATA_NAME_IDENTIFIERNAMEINFO_HPP + +#include +#include + +namespace clang::mrdocs { + +/** Represents an identifier + + This class is used to represent an identifier + that could be in the corpus or not. + + When the symbol is in the corpus, the `id` + field will be set to the symbol ID of the + symbol. + + When the symbol is not in the corpus, + the `id` field will be set to `SymbolID::invalid`. +*/ +struct IdentifierNameInfo final + : NameInfo +{ + constexpr + IdentifierNameInfo() noexcept + : NameInfo(NameKind::Identifier) + {} + + auto + operator<=>(IdentifierNameInfo const& other) const + { + return dynamic_cast(*this) <=> dynamic_cast(other); + } +}; + +} // clang::mrdocs + +#endif diff --git a/include/mrdocs/Metadata/Name/NameBase.hpp b/include/mrdocs/Metadata/Name/NameBase.hpp new file mode 100644 index 000000000..3a9971705 --- /dev/null +++ b/include/mrdocs/Metadata/Name/NameBase.hpp @@ -0,0 +1,105 @@ +// +// Licensed under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// Copyright (c) 2025 Alan de Freitas (alandefreitas@gmail.com) +// +// Official repository: https://github.com/cppalliance/mrdocs +// + +#ifndef MRDOCS_API_METADATA_NAME_NAMEBASE_HPP +#define MRDOCS_API_METADATA_NAME_NAMEBASE_HPP + +#include +#include +#include +#include + +namespace clang::mrdocs { + +/** Represents a name for a named `TypeInfo` + + When the `TypeInfo` is a named type, this class + represents the name of the type. + + It also includes the symbol ID of the named type, + so that it can be referenced in the documentation. + + This allows the `TypeInfo` to store either a + `NameInfo` or a `SpecializationNameInfo`, + which contains the arguments for a template specialization + without requiring the application to extract an + unnecessary symbol. + */ +struct NameInfo +{ + /** The kind of name this is. + */ + NameKind Kind; + + /** The SymbolID of the named symbol, if it exists. + */ + SymbolID id = SymbolID::invalid; + + /** The unqualified name. + */ + std::string Name; + + /** The parent name info, if any. + + This recursively includes information about + the parent, such as the symbol ID and + potentially template arguments, when + the parent is a SpecializationNameInfo. + + This is particularly useful because the + parent of `id` could be a primary template. + In this case, the Prefix will contain + this primary template information + and the template arguments. + + */ + Optional> Prefix = std::nullopt; + + constexpr bool isIdentifier() const noexcept { return Kind == NameKind::Identifier; } + constexpr bool isSpecialization() const noexcept { return Kind == NameKind::Specialization; } + + + explicit + constexpr + NameInfo(NameKind const kind) noexcept + : Kind(kind) {} + + constexpr virtual ~NameInfo() = default; + + std::strong_ordering + operator<=>(NameInfo const& other) const; + + bool + operator==(NameInfo const& other) const + { + return std::is_eq(*this <=> other); + } + +protected: + constexpr + NameInfo() noexcept + : NameInfo(NameKind::Identifier) {}; +}; + +MRDOCS_DECL +std::string +toString(NameInfo const& N); + +MRDOCS_DECL +void +tag_invoke( + dom::ValueFromTag, + dom::Value& v, + NameInfo const& I, + DomCorpus const* domCorpus); + +} // clang::mrdocs + +#endif diff --git a/include/mrdocs/Metadata/Name/NameKind.hpp b/include/mrdocs/Metadata/Name/NameKind.hpp new file mode 100644 index 000000000..716c73a32 --- /dev/null +++ b/include/mrdocs/Metadata/Name/NameKind.hpp @@ -0,0 +1,43 @@ +// +// Licensed under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// Copyright (c) 2025 Alan de Freitas (alandefreitas@gmail.com) +// +// Official repository: https://github.com/cppalliance/mrdocs +// + +#ifndef MRDOCS_API_METADATA_NAME_NAMEKIND_HPP +#define MRDOCS_API_METADATA_NAME_NAMEKIND_HPP + +#include +#include + +namespace clang::mrdocs { + +enum class NameKind +{ + /// A simple identifier + Identifier = 1, // for bitstream + /// A template instantiation + Specialization +}; + +MRDOCS_DECL +dom::String +toString(NameKind kind) noexcept; + +inline +void +tag_invoke( + dom::ValueFromTag, + dom::Value& v, + NameKind const kind) +{ + v = toString(kind); +} + +} // clang::mrdocs + +#endif diff --git a/include/mrdocs/Metadata/Name/SpecializationNameInfo.hpp b/include/mrdocs/Metadata/Name/SpecializationNameInfo.hpp new file mode 100644 index 000000000..9b1199254 --- /dev/null +++ b/include/mrdocs/Metadata/Name/SpecializationNameInfo.hpp @@ -0,0 +1,53 @@ +// +// Licensed under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// Copyright (c) 2025 Alan de Freitas (alandefreitas@gmail.com) +// +// Official repository: https://github.com/cppalliance/mrdocs +// + +#ifndef MRDOCS_API_METADATA_NAME_SPECIALIZATIONNAMEINFO_HPP +#define MRDOCS_API_METADATA_NAME_SPECIALIZATIONNAMEINFO_HPP + +#include +#include +#include + +namespace clang::mrdocs { + +/** Represents a (possibly qualified) symbol name with template arguments. +*/ +struct SpecializationNameInfo final + : NameInfo +{ + /** The template arguments. + */ + std::vector> TemplateArgs; + + /** The SymbolID of the named symbol, if it exists. + */ + SymbolID specializationID = SymbolID::invalid; + + constexpr + SpecializationNameInfo() noexcept + : NameInfo(NameKind::Specialization) + {} + + auto + operator<=>(SpecializationNameInfo const& other) const + { + if (auto const r = + dynamic_cast(*this) <=> dynamic_cast(other); + !std::is_eq(r)) + { + return r; + } + return TemplateArgs <=> other.TemplateArgs; + } +}; + +} // clang::mrdocs + +#endif diff --git a/include/mrdocs/Metadata/Specifiers.hpp b/include/mrdocs/Metadata/Specifiers.hpp index 9d8429228..1d0fd86b0 100644 --- a/include/mrdocs/Metadata/Specifiers.hpp +++ b/include/mrdocs/Metadata/Specifiers.hpp @@ -4,6 +4,7 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // Copyright (c) 2023 Krystian Stasiowski (sdkrystian@gmail.com) +// Copyright (c) 2023 Alan de Freitas (alandefreitas@gmail.com) // // Official repository: https://github.com/cppalliance/mrdocs // @@ -11,388 +12,14 @@ #ifndef MRDOCS_API_METADATA_SPECIFIERS_HPP #define MRDOCS_API_METADATA_SPECIFIERS_HPP -#include -#include -#include - -namespace clang::mrdocs { - -/** Access specifier. - - None is set to zero since it is the most - frequently occurring access, and it is - elided by the bitstream encoder because it - has an all-zero bit pattern. This improves - compression in the bitstream. - - None is used for namespace members and friend; - such declarations have no access. -*/ -enum class AccessKind -{ - /// Unspecified access - None = 0, - /// Public access - Public, - /// Protected access - Protected, - /// Private access - Private, -}; - -/** `constexpr`/`consteval` specifier kinds - - [dcl.spec.general] p2: At most one of the `constexpr`, `consteval`, - and `constinit` keywords shall appear in a decl-specifier-seq -*/ -enum class ConstexprKind -{ - /// No `constexpr` or `consteval` specifier - None = 0, - /// The `constexpr` specifier - Constexpr, - /// The `consteval` specifier - /// only valid for functions - Consteval, -}; - -/** Explicit specifier kinds -*/ -enum class ExplicitKind -{ - /** No explicit-specifier or explicit-specifier evaluated to false - */ - False = 0, - /** explicit-specifier evaluates to true - */ - True, - /** Dependent explicit-specifier - */ - Dependent -}; - -// KRYSTIAN FIXME: this needs to be improved (a lot) -struct ExplicitInfo -{ - /** Whether an explicit-specifier was user-written. - */ - bool Implicit = true; - - /** The evaluated exception specification. - */ - ExplicitKind Kind = ExplicitKind::False; - - /** The operand of the explicit-specifier, if any. - */ - std::string Operand; - - auto operator<=>(ExplicitInfo const&) const = default; -}; - -/** Exception specification kinds -*/ -enum class NoexceptKind -{ - /** Potentially-throwing exception specification - */ - False = 0, - /** Non-throwing exception specification - */ - True, - /** Dependent exception specification - */ - Dependent -}; - -// KRYSTIAN FIXME: this needs to be improved (a lot) -struct NoexceptInfo -{ - /** Whether a noexcept-specifier was user-written. - */ - bool Implicit = true; - - /** The evaluated exception specification. - */ - NoexceptKind Kind = NoexceptKind::False; - - /** The operand of the noexcept-specifier, if any. - */ - std::string Operand; - - auto operator<=>(NoexceptInfo const&) const = default; -}; - -/** Operator kinds -*/ -enum class OperatorKind -{ - /// No operator - None = 0, - /// The `new` Operator - New, - /// The `delete` Operator - Delete, - /// The `new[]` Operator - ArrayNew, - /// The `delete[]` Operator - ArrayDelete, - /// The + Operator - Plus, - /// The - Operator - Minus, - /// The * Operator - Star, - /// The / Operator - Slash, - /// The % Operator - Percent, - /// The ^ Operator - Caret, - /// The & Operator - Amp, - /// The | Operator - Pipe, - /// The ~ Operator - Tilde, - /// The ! Operator - Equal, - /// The += Operator - PlusEqual, - /// The -= Operator - MinusEqual, - /// The *= Operator - StarEqual, - /// The /= Operator - SlashEqual, - /// The %= Operator - PercentEqual, - /// The ^= Operator - CaretEqual, - /// The &= Operator - AmpEqual, - /// The |= Operator - PipeEqual, - /// The << Operator - LessLess, - /// The >> Operator - GreaterGreater, - /// The <<= Operator - LessLessEqual, - /// The >>= Operator - GreaterGreaterEqual, - - // Relational operators - /// The ! Operator - Exclaim, - /// The == Operator - EqualEqual, - /// The != Operator - ExclaimEqual, - /// The < Operator - Less, - /// The <= Operator - LessEqual, - /// The > Operator - Greater, - /// The >= Operator - GreaterEqual, - /// The <=> Operator - Spaceship, - - /// The && Operator - AmpAmp, - /// The || Operator - PipePipe, - /// The ++ Operator - PlusPlus, - /// The -- Operator - MinusMinus, - /// The , Operator - Comma, - /// The ->* Operator - ArrowStar, - /// The -> Operator - Arrow, - /// The () Operator - Call, - /// The [] Operator - Subscript, - /// The `? :` Operator - Conditional, - /// The `coawait` Operator - Coawait, -}; - -inline -void -tag_invoke( - dom::ValueFromTag, - dom::Value& v, - OperatorKind kind) -{ - v = static_cast>(kind); -} - -/** Determines whether the operator is potentially unary. - */ -MRDOCS_DECL -bool -isUnaryOperator(OperatorKind kind) noexcept; - -/** Determines whether the operator is potentially binary. - */ -MRDOCS_DECL -bool -isBinaryOperator(OperatorKind kind) noexcept; - -/** Reference type kinds -*/ -enum class ReferenceKind -{ - /// Not a reference - None = 0, - /// An L-Value reference - LValue, - /// An R-Value reference - RValue -}; - -/** Storage class kinds - - [dcl.stc] p1: At most one storage-class-specifier shall appear - in a given decl-specifier-seq, except that `thread_local` - may appear with `static` or `extern`. -*/ -enum class StorageClassKind -{ - /// No storage class specifier - None = 0, - /// thread_local storage-class-specifier - Extern, - /// mutable storage-class-specifier - Static, - /// auto storage-class-specifier (removed in C++11) - /// only valid for variables - Auto, - /// register storage-class-specifier (removed in C++17) - /// only valid for variables - Register -}; - -MRDOCS_DECL dom::String toString(AccessKind kind) noexcept; -MRDOCS_DECL dom::String toString(ConstexprKind kind) noexcept; -MRDOCS_DECL dom::String toString(ExplicitKind kind) noexcept; -MRDOCS_DECL dom::String toString(NoexceptKind kind) noexcept; -MRDOCS_DECL dom::String toString(ReferenceKind kind) noexcept; -MRDOCS_DECL dom::String toString(StorageClassKind kind) noexcept; - -/** Convert NoexceptInfo to a string. - - @param info The noexcept-specifier information. - - @param resolved If true, the operand is not shown when - the exception specification is non-dependent. - - @param implicit If true, implicit exception specifications - are shown. - - @return The string representation of the noexcept-specifier. -*/ -MRDOCS_DECL -dom::String -toString( - NoexceptInfo const& info, - bool resolved = false, - bool implicit = false); - -inline -void -tag_invoke( - dom::ValueFromTag, - dom::Value& v, - NoexceptInfo const& info) -{ - v = toString(info, false, false); -} - -/** Convert ExplicitInfo to a string. - - @param info The explicit-specifier information. - @param resolved If true, the operand is not shown when - the explicit-specifier is non-dependent. - @param implicit If true, implicit explicit-specifiers are shown. - @return The string representation of the explicit-specifier. -*/ -MRDOCS_DECL -dom::String -toString( - ExplicitInfo const& info, - bool resolved = false, - bool implicit = false); - -/** Return the ExplicitInfo as a @ref dom::Value string. - - @param v The output parameter to receive the dom::Value. - @param I The ExplicitInfo to convert. - */ -inline -void -tag_invoke( - dom::ValueFromTag, - dom::Value& v, - ExplicitInfo const& I) -{ - v = toString(I); -} - -/** Return the AccessKind as a @ref dom::Value string. - */ -inline -void -tag_invoke( - dom::ValueFromTag, - dom::Value& v, - AccessKind const kind) -{ - v = toString(kind); -} - -/** Return the ConstexprKind as a @ref dom::Value string. - */ -inline -void -tag_invoke( - dom::ValueFromTag, - dom::Value& v, - ConstexprKind const kind) -{ - v = toString(kind); -} - -/** Return the StorageClassKind as a @ref dom::Value string. - */ -inline -void -tag_invoke( - dom::ValueFromTag, - dom::Value& v, - StorageClassKind const kind) -{ - v = toString(kind); -} - -/** Return the ReferenceKind as a @ref dom::Value string. - */ -inline -void -tag_invoke( - dom::ValueFromTag, - dom::Value& v, - ReferenceKind kind) -{ - v = toString(kind); -} - -} // clang::mrdocs +#include +#include +#include +#include +#include +#include +#include +#include +#include #endif diff --git a/include/mrdocs/Metadata/Specifiers/AccessKind.hpp b/include/mrdocs/Metadata/Specifiers/AccessKind.hpp new file mode 100644 index 000000000..d75bb5b38 --- /dev/null +++ b/include/mrdocs/Metadata/Specifiers/AccessKind.hpp @@ -0,0 +1,62 @@ +// +// Licensed under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// Copyright (c) 2023 Krystian Stasiowski (sdkrystian@gmail.com) +// Copyright (c) 2023 Alan de Freitas (alandefreitas@gmail.com) +// +// Official repository: https://github.com/cppalliance/mrdocs +// + +#ifndef MRDOCS_API_METADATA_SPECIFIERS_ACCESSKIND_HPP +#define MRDOCS_API_METADATA_SPECIFIERS_ACCESSKIND_HPP + +#include +#include +#include + +namespace clang::mrdocs { + +/** Access specifier. + + None is set to zero since it is the most + frequently occurring access, and it is + elided by the bitstream encoder because it + has an all-zero bit pattern. This improves + compression in the bitstream. + + None is used for namespace members and friend; + such declarations have no access. +*/ +enum class AccessKind +{ + /// Unspecified access + None = 0, + /// Public access + Public, + /// Protected access + Protected, + /// Private access + Private, +}; + +MRDOCS_DECL +dom::String +toString(AccessKind kind) noexcept; + +/** Return the AccessKind as a @ref dom::Value string. + */ +inline +void +tag_invoke( + dom::ValueFromTag, + dom::Value& v, + AccessKind const kind) +{ + v = toString(kind); +} + +} // clang::mrdocs + +#endif diff --git a/include/mrdocs/Metadata/Specifiers/ConstexprKind.hpp b/include/mrdocs/Metadata/Specifiers/ConstexprKind.hpp new file mode 100644 index 000000000..9e1297229 --- /dev/null +++ b/include/mrdocs/Metadata/Specifiers/ConstexprKind.hpp @@ -0,0 +1,54 @@ +// +// Licensed under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// Copyright (c) 2023 Krystian Stasiowski (sdkrystian@gmail.com) +// Copyright (c) 2023 Alan de Freitas (alandefreitas@gmail.com) +// +// Official repository: https://github.com/cppalliance/mrdocs +// + +#ifndef MRDOCS_API_METADATA_SPECIFIERS_CONSTEXPRKIND_HPP +#define MRDOCS_API_METADATA_SPECIFIERS_CONSTEXPRKIND_HPP + +#include +#include + +namespace clang::mrdocs { + +/** `constexpr`/`consteval` specifier kinds + + [dcl.spec.general] p2: At most one of the `constexpr`, `consteval`, + and `constinit` keywords shall appear in a decl-specifier-seq +*/ +enum class ConstexprKind +{ + /// No `constexpr` or `consteval` specifier + None = 0, + /// The `constexpr` specifier + Constexpr, + /// The `consteval` specifier + /// only valid for functions + Consteval, +}; + +MRDOCS_DECL +dom::String +toString(ConstexprKind kind) noexcept; + +/** Return the ConstexprKind as a @ref dom::Value string. + */ +inline +void +tag_invoke( + dom::ValueFromTag, + dom::Value& v, + ConstexprKind const kind) +{ + v = toString(kind); +} + +} // clang::mrdocs + +#endif diff --git a/include/mrdocs/Metadata/Specifiers/ExplicitInfo.hpp b/include/mrdocs/Metadata/Specifiers/ExplicitInfo.hpp new file mode 100644 index 000000000..68df0c813 --- /dev/null +++ b/include/mrdocs/Metadata/Specifiers/ExplicitInfo.hpp @@ -0,0 +1,75 @@ +// +// Licensed under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// Copyright (c) 2023 Krystian Stasiowski (sdkrystian@gmail.com) +// Copyright (c) 2023 Alan de Freitas (alandefreitas@gmail.com) +// +// Official repository: https://github.com/cppalliance/mrdocs +// + +#ifndef MRDOCS_API_METADATA_SPECIFIERS_EXPLICITINFO_HPP +#define MRDOCS_API_METADATA_SPECIFIERS_EXPLICITINFO_HPP + +#include +#include +#include + +namespace clang::mrdocs { + +/** + Stores only the operand of the explicit-specifier or noexcept-specifier as a string. + The complete expression is not preserved at this time. + This is a temporary design and may be improved in the future. +*/ +struct ExplicitInfo +{ + /** Whether an explicit-specifier was user-written. + */ + bool Implicit = true; + + /** The evaluated exception specification. + */ + ExplicitKind Kind = ExplicitKind::False; + + /** The operand of the explicit-specifier, if any. + */ + std::string Operand; + + auto operator<=>(ExplicitInfo const&) const = default; +}; + +/** Convert ExplicitInfo to a string. + + @param info The explicit-specifier information. + @param resolved If true, the operand is not shown when + the explicit-specifier is non-dependent. + @param implicit If true, implicit explicit-specifiers are shown. + @return The string representation of the explicit-specifier. +*/ +MRDOCS_DECL +dom::String +toString( + ExplicitInfo const& info, + bool resolved = false, + bool implicit = false); + +/** Return the ExplicitInfo as a @ref dom::Value string. + + @param v The output parameter to receive the dom::Value. + @param I The ExplicitInfo to convert. + */ +inline +void +tag_invoke( + dom::ValueFromTag, + dom::Value& v, + ExplicitInfo const& I) +{ + v = toString(I); +} + +} // clang::mrdocs + +#endif diff --git a/include/mrdocs/Metadata/Specifiers/ExplicitKind.hpp b/include/mrdocs/Metadata/Specifiers/ExplicitKind.hpp new file mode 100644 index 000000000..ca3669637 --- /dev/null +++ b/include/mrdocs/Metadata/Specifiers/ExplicitKind.hpp @@ -0,0 +1,42 @@ +// +// Licensed under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// Copyright (c) 2023 Krystian Stasiowski (sdkrystian@gmail.com) +// Copyright (c) 2023 Alan de Freitas (alandefreitas@gmail.com) +// +// Official repository: https://github.com/cppalliance/mrdocs +// + +#ifndef MRDOCS_API_METADATA_SPECIFIERS_EXPLICITKIND_HPP +#define MRDOCS_API_METADATA_SPECIFIERS_EXPLICITKIND_HPP + +#include +#include +#include + +namespace clang::mrdocs { + +/** Explicit specifier kinds +*/ +enum class ExplicitKind +{ + /** No explicit-specifier or explicit-specifier evaluated to false + */ + False = 0, + /** explicit-specifier evaluates to true + */ + True, + /** Dependent explicit-specifier + */ + Dependent +}; + +MRDOCS_DECL +dom::String +toString(ExplicitKind kind) noexcept; + +} // clang::mrdocs + +#endif diff --git a/include/mrdocs/Metadata/Specifiers/NoexceptInfo.hpp b/include/mrdocs/Metadata/Specifiers/NoexceptInfo.hpp new file mode 100644 index 000000000..dd98b4deb --- /dev/null +++ b/include/mrdocs/Metadata/Specifiers/NoexceptInfo.hpp @@ -0,0 +1,74 @@ +// +// Licensed under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// Copyright (c) 2023 Krystian Stasiowski (sdkrystian@gmail.com) +// Copyright (c) 2023 Alan de Freitas (alandefreitas@gmail.com) +// +// Official repository: https://github.com/cppalliance/mrdocs +// + +#ifndef MRDOCS_API_METADATA_SPECIFIERS_NOEXCEPTINFO_HPP +#define MRDOCS_API_METADATA_SPECIFIERS_NOEXCEPTINFO_HPP + +#include +#include +#include +#include +#include +#include +#include + +namespace clang::mrdocs { + +// KRYSTIAN FIXME: this needs to be improved (a lot) +struct NoexceptInfo +{ + /** Whether a noexcept-specifier was user-written. + */ + bool Implicit = true; + + /** The evaluated exception specification. + */ + NoexceptKind Kind = NoexceptKind::False; + + /** The operand of the noexcept-specifier, if any. + */ + std::string Operand; + + auto operator<=>(NoexceptInfo const&) const = default; +}; + +/** Convert NoexceptInfo to a string. + + @param info The noexcept-specifier information. + + @param resolved If true, the operand is not shown when + the exception specification is non-dependent. + + @param implicit If true, implicit exception specifications + are shown. + + @return The string representation of the noexcept-specifier. +*/ +MRDOCS_DECL +dom::String +toString( + NoexceptInfo const& info, + bool resolved = false, + bool implicit = false); + +inline +void +tag_invoke( + dom::ValueFromTag, + dom::Value& v, + NoexceptInfo const& info) +{ + v = toString(info, false, false); +} + +} // clang::mrdocs + +#endif diff --git a/include/mrdocs/Metadata/Specifiers/NoexceptKind.hpp b/include/mrdocs/Metadata/Specifiers/NoexceptKind.hpp new file mode 100644 index 000000000..08544d496 --- /dev/null +++ b/include/mrdocs/Metadata/Specifiers/NoexceptKind.hpp @@ -0,0 +1,42 @@ +// +// Licensed under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// Copyright (c) 2023 Krystian Stasiowski (sdkrystian@gmail.com) +// Copyright (c) 2023 Alan de Freitas (alandefreitas@gmail.com) +// +// Official repository: https://github.com/cppalliance/mrdocs +// + +#ifndef MRDOCS_API_METADATA_SPECIFIERS_NOEXCEPTKIND_HPP +#define MRDOCS_API_METADATA_SPECIFIERS_NOEXCEPTKIND_HPP + +#include +#include +#include + +namespace clang::mrdocs { + +/** Exception specification kinds +*/ +enum class NoexceptKind +{ + /** Potentially-throwing exception specification + */ + False = 0, + /** Non-throwing exception specification + */ + True, + /** Dependent exception specification + */ + Dependent +}; + +MRDOCS_DECL +dom::String +toString(NoexceptKind kind) noexcept; + +} // clang::mrdocs + +#endif diff --git a/include/mrdocs/Metadata/Specifiers/OperatorKind.hpp b/include/mrdocs/Metadata/Specifiers/OperatorKind.hpp new file mode 100644 index 000000000..879a35424 --- /dev/null +++ b/include/mrdocs/Metadata/Specifiers/OperatorKind.hpp @@ -0,0 +1,206 @@ +// +// Licensed under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// Copyright (c) 2023 Krystian Stasiowski (sdkrystian@gmail.com) +// Copyright (c) 2023 Alan de Freitas (alandefreitas@gmail.com) +// +// Official repository: https://github.com/cppalliance/mrdocs +// + +#ifndef MRDOCS_API_METADATA_SPECIFIERS_OPERATORKIND_HPP +#define MRDOCS_API_METADATA_SPECIFIERS_OPERATORKIND_HPP + +#include +#include +#include + +namespace clang::mrdocs { + +/** Operator kinds +*/ +enum class OperatorKind +{ + /// No operator + None = 0, + /// The `new` Operator + New, + /// The `delete` Operator + Delete, + /// The `new[]` Operator + ArrayNew, + /// The `delete[]` Operator + ArrayDelete, + /// The + Operator + Plus, + /// The - Operator + Minus, + /// The * Operator + Star, + /// The / Operator + Slash, + /// The % Operator + Percent, + /// The ^ Operator + Caret, + /// The & Operator + Amp, + /// The | Operator + Pipe, + /// The ~ Operator + Tilde, + /// The ! Operator + Equal, + /// The += Operator + PlusEqual, + /// The -= Operator + MinusEqual, + /// The *= Operator + StarEqual, + /// The /= Operator + SlashEqual, + /// The %= Operator + PercentEqual, + /// The ^= Operator + CaretEqual, + /// The &= Operator + AmpEqual, + /// The |= Operator + PipeEqual, + /// The << Operator + LessLess, + /// The >> Operator + GreaterGreater, + /// The <<= Operator + LessLessEqual, + /// The >>= Operator + GreaterGreaterEqual, + + // Relational operators + /// The ! Operator + Exclaim, + /// The == Operator + EqualEqual, + /// The != Operator + ExclaimEqual, + /// The < Operator + Less, + /// The <= Operator + LessEqual, + /// The > Operator + Greater, + /// The >= Operator + GreaterEqual, + /// The <=> Operator + Spaceship, + + /// The && Operator + AmpAmp, + /// The || Operator + PipePipe, + /// The ++ Operator + PlusPlus, + /// The -- Operator + MinusMinus, + /// The , Operator + Comma, + /// The ->* Operator + ArrowStar, + /// The -> Operator + Arrow, + /// The () Operator + Call, + /// The [] Operator + Subscript, + /// The `? :` Operator + Conditional, + /// The `coawait` Operator + Coawait, +}; + +inline +void +tag_invoke( + dom::ValueFromTag, + dom::Value& v, + OperatorKind kind) +{ + v = static_cast>(kind); +} + +/** Determines whether the operator is potentially unary. + */ +MRDOCS_DECL +bool +isUnaryOperator(OperatorKind kind) noexcept; + +/** Determines whether the operator is potentially binary. + */ +MRDOCS_DECL +bool +isBinaryOperator(OperatorKind kind) noexcept; + +/** Return the name of an operator as a string. + + @param kind The kind of operator. + @param include_keyword Whether the name + should be prefixed with the `operator` keyword. +*/ +MRDOCS_DECL +std::string_view +getOperatorName( + OperatorKind kind, + bool include_keyword = false) noexcept; + +/** Return the short name of an operator as a string. +*/ +MRDOCS_DECL +std::string_view +getShortOperatorName( + OperatorKind kind) noexcept; + +/** Return the short name of an operator as a string. + + @param name The operator name, e.g. `operator+`, `operator++`, `operator[]`, etc. + @return The OperatorKind, or OperatorKind::None if not recognized. +*/ +MRDOCS_DECL +OperatorKind +getOperatorKind(std::string_view name) noexcept; + +/** Return the short name of an operator as a string. + + @param suffix The operator suffix, e.g. `+`, `++`, `[]`, etc. + @return The OperatorKind, or OperatorKind::None if not recognized. +*/ +MRDOCS_DECL +OperatorKind +getOperatorKindFromSuffix(std::string_view suffix) noexcept; + +/** Return the safe name of an operator as a string. + + @param kind The kind of operator. + @param include_keyword Whether the name + should be prefixed with `operator_`. +*/ +MRDOCS_DECL +std::string_view +getSafeOperatorName( + OperatorKind kind, + bool include_keyword = false) noexcept; + +/** Return the human-readable name of the operator + + @param kind The kind of operator. + @param nParams The number of parameters the operator takes. + @return The readable name, or nullopt if the operator is not recognized. + */ +std::optional +getOperatorReadableName( + OperatorKind kind, + int nParams); + +} // clang::mrdocs + +#endif diff --git a/include/mrdocs/Metadata/Specifiers/ReferenceKind.hpp b/include/mrdocs/Metadata/Specifiers/ReferenceKind.hpp new file mode 100644 index 000000000..f5b526e68 --- /dev/null +++ b/include/mrdocs/Metadata/Specifiers/ReferenceKind.hpp @@ -0,0 +1,49 @@ +// +// Licensed under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// Copyright (c) 2023 Krystian Stasiowski (sdkrystian@gmail.com) +// Copyright (c) 2023 Alan de Freitas (alandefreitas@gmail.com) +// +// Official repository: https://github.com/cppalliance/mrdocs +// + +#ifndef MRDOCS_API_METADATA_SPECIFIERS_REFERENCEKIND_HPP +#define MRDOCS_API_METADATA_SPECIFIERS_REFERENCEKIND_HPP + +#include +#include +#include + +namespace clang::mrdocs { + +/** Reference type kinds +*/ +enum class ReferenceKind +{ + /// Not a reference + None = 0, + /// An L-Value reference + LValue, + /// An R-Value reference + RValue +}; + +MRDOCS_DECL dom::String toString(ReferenceKind kind) noexcept; + +/** Return the ReferenceKind as a @ref dom::Value string. + */ +inline +void +tag_invoke( + dom::ValueFromTag, + dom::Value& v, + ReferenceKind kind) +{ + v = toString(kind); +} + +} // clang::mrdocs + +#endif diff --git a/include/mrdocs/Metadata/Specifiers/StorageClassKind.hpp b/include/mrdocs/Metadata/Specifiers/StorageClassKind.hpp new file mode 100644 index 000000000..44a241d7f --- /dev/null +++ b/include/mrdocs/Metadata/Specifiers/StorageClassKind.hpp @@ -0,0 +1,61 @@ +// +// Licensed under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// Copyright (c) 2023 Krystian Stasiowski (sdkrystian@gmail.com) +// Copyright (c) 2023 Alan de Freitas (alandefreitas@gmail.com) +// +// Official repository: https://github.com/cppalliance/mrdocs +// + +#ifndef MRDOCS_API_METADATA_SPECIFIERS_STORAGECLASSKIND_HPP +#define MRDOCS_API_METADATA_SPECIFIERS_STORAGECLASSKIND_HPP + +#include +#include +#include + +namespace clang::mrdocs { + +/** Storage class kinds + + [dcl.stc] p1: At most one storage-class-specifier shall appear + in a given decl-specifier-seq, except that `thread_local` + may appear with `static` or `extern`. +*/ +enum class StorageClassKind +{ + /// No storage class specifier + None = 0, + /// thread_local storage-class-specifier + Extern, + /// mutable storage-class-specifier + Static, + /// auto storage-class-specifier (removed in C++11) + /// only valid for variables + Auto, + /// register storage-class-specifier (removed in C++17) + /// only valid for variables + Register +}; + +MRDOCS_DECL +dom::String +toString(StorageClassKind kind) noexcept; + +/** Return the StorageClassKind as a @ref dom::Value string. + */ +inline +void +tag_invoke( + dom::ValueFromTag, + dom::Value& v, + StorageClassKind const kind) +{ + v = toString(kind); +} + +} // clang::mrdocs + +#endif diff --git a/include/mrdocs/Metadata/TArg.hpp b/include/mrdocs/Metadata/TArg.hpp new file mode 100644 index 000000000..0094ce2ea --- /dev/null +++ b/include/mrdocs/Metadata/TArg.hpp @@ -0,0 +1,77 @@ +// +// This is a derivative work. originally part of the LLVM Project. +// Licensed under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// Copyright (c) 2023 Vinnie Falco (vinnie.falco@gmail.com) +// Copyright (c) 2023 Krystian Stasiowski (sdkrystian@gmail.com) +// Copyright (c) 2024 Alan de Freitas (alandefreitas@gmail.com) +// +// Official repository: https://github.com/cppalliance/mrdocs +// + +#ifndef MRDOCS_API_METADATA_TARG_HPP +#define MRDOCS_API_METADATA_TARG_HPP + +#include +#include +#include +#include +#include + +namespace clang::mrdocs { + +template< + std::derived_from TArgTy, + class F, + class... Args> +constexpr +decltype(auto) +visit( + TArgTy& A, + F&& f, + Args&&... args) +{ + switch(A.Kind) + { + case TArgKind::Type: + return f(static_cast&>(A), + std::forward(args)...); + case TArgKind::NonType: + return f(static_cast&>(A), + std::forward(args)...); + case TArgKind::Template: + return f(static_cast&>(A), + std::forward(args)...); + default: + MRDOCS_UNREACHABLE(); + } +} + +MRDOCS_DECL +std::strong_ordering +operator<=>(Polymorphic const& lhs, Polymorphic const& rhs); + +inline +void +tag_invoke( + dom::ValueFromTag, + dom::Value& v, + Polymorphic const& I, + DomCorpus const* domCorpus) +{ + if (I.valueless_after_move()) + { + v = nullptr; + return; + } + tag_invoke(dom::ValueFromTag{}, v, *I, domCorpus); +} + +} // clang::mrdocs + +#endif diff --git a/include/mrdocs/Metadata/TArg/NonTypeTArg.hpp b/include/mrdocs/Metadata/TArg/NonTypeTArg.hpp new file mode 100644 index 000000000..f3cad9dcd --- /dev/null +++ b/include/mrdocs/Metadata/TArg/NonTypeTArg.hpp @@ -0,0 +1,34 @@ +// +// This is a derivative work. originally part of the LLVM Project. +// Licensed under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// Copyright (c) 2023 Vinnie Falco (vinnie.falco@gmail.com) +// Copyright (c) 2023 Krystian Stasiowski (sdkrystian@gmail.com) +// Copyright (c) 2024 Alan de Freitas (alandefreitas@gmail.com) +// +// Official repository: https://github.com/cppalliance/mrdocs +// + +#ifndef MRDOCS_API_METADATA_TARG_NONTYPETARG_HPP +#define MRDOCS_API_METADATA_TARG_NONTYPETARG_HPP + +#include +#include +#include + +namespace clang::mrdocs { + +struct NonTypeTArg final + : TArgCommonBase +{ + /** Template argument expression. */ + ExprInfo Value; + + auto operator<=>(NonTypeTArg const&) const = default; +}; + +} // clang::mrdocs + +#endif // MRDOCS_API_METADATA_TARG_NONTYPETARG_HPP diff --git a/include/mrdocs/Metadata/TArg/TArgBase.hpp b/include/mrdocs/Metadata/TArg/TArgBase.hpp new file mode 100644 index 000000000..2aadc8d7f --- /dev/null +++ b/include/mrdocs/Metadata/TArg/TArgBase.hpp @@ -0,0 +1,78 @@ +// +// This is a derivative work. originally part of the LLVM Project. +// Licensed under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// Copyright (c) 2023 Vinnie Falco (vinnie.falco@gmail.com) +// Copyright (c) 2023 Krystian Stasiowski (sdkrystian@gmail.com) +// Copyright (c) 2024 Alan de Freitas (alandefreitas@gmail.com) +// +// Official repository: https://github.com/cppalliance/mrdocs +// + +#ifndef MRDOCS_API_METADATA_TARG_TARGBASE_HPP +#define MRDOCS_API_METADATA_TARG_TARGBASE_HPP + +#include +#include + +namespace clang::mrdocs { + +struct TArg +{ + /** The kind of template argument this is. */ + TArgKind Kind; + + /** Whether this template argument is a parameter expansion. */ + bool IsPackExpansion = false; + + constexpr virtual ~TArg() = default; + + constexpr bool isType() const noexcept { return Kind == TArgKind::Type; } + constexpr bool isNonType() const noexcept { return Kind == TArgKind::NonType; } + constexpr bool isTemplate() const noexcept { return Kind == TArgKind::Template; } + + auto operator<=>(TArg const&) const = default; + +protected: + constexpr + TArg( + TArgKind kind) noexcept + : Kind(kind) + { + } +}; + +template +struct TArgCommonBase : TArg +{ + static constexpr TArgKind kind_id = K; + + static constexpr bool isType() noexcept { return K == TArgKind::Type; } + static constexpr bool isNonType() noexcept { return K == TArgKind::NonType; } + static constexpr bool isTemplate() noexcept { return K == TArgKind::Template; } + +protected: + constexpr + TArgCommonBase() noexcept + : TArg(K) + { + } +}; + +MRDOCS_DECL +std::string +toString(TArg const& arg) noexcept; + +MRDOCS_DECL +void +tag_invoke( + dom::ValueFromTag, + dom::Value& v, + TArg const& I, + DomCorpus const* domCorpus); + +} // clang::mrdocs + +#endif // MRDOCS_API_METADATA_TARG_TARGBASE_HPP diff --git a/include/mrdocs/Metadata/TArg/TArgKind.hpp b/include/mrdocs/Metadata/TArg/TArgKind.hpp new file mode 100644 index 000000000..d14174765 --- /dev/null +++ b/include/mrdocs/Metadata/TArg/TArgKind.hpp @@ -0,0 +1,51 @@ +// +// This is a derivative work. originally part of the LLVM Project. +// Licensed under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// Copyright (c) 2023 Vinnie Falco (vinnie.falco@gmail.com) +// Copyright (c) 2023 Krystian Stasiowski (sdkrystian@gmail.com) +// Copyright (c) 2024 Alan de Freitas (alandefreitas@gmail.com) +// +// Official repository: https://github.com/cppalliance/mrdocs +// + +#ifndef MRDOCS_API_METADATA_TARG_TARGKIND_HPP +#define MRDOCS_API_METADATA_TARG_TARGKIND_HPP + +#include +#include +#include + +namespace clang::mrdocs { + +/** The kind of template argument. +*/ +enum class TArgKind : int +{ + /// type arguments + Type = 1, // for bitstream + /// non-type arguments, i.e. expressions + NonType, + /// template template arguments, i.e. template names + Template +}; + +MRDOCS_DECL +std::string_view +toString(TArgKind kind) noexcept; + +inline +void +tag_invoke( + dom::ValueFromTag, + dom::Value& v, + TArgKind kind) +{ + v = toString(kind); +} + +} // clang::mrdocs + +#endif // MRDOCS_API_METADATA_TARG_TARGKIND_HPP diff --git a/include/mrdocs/Metadata/TArg/TemplateTArg.hpp b/include/mrdocs/Metadata/TArg/TemplateTArg.hpp new file mode 100644 index 000000000..29db0c23d --- /dev/null +++ b/include/mrdocs/Metadata/TArg/TemplateTArg.hpp @@ -0,0 +1,38 @@ +// +// This is a derivative work. originally part of the LLVM Project. +// Licensed under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// Copyright (c) 2023 Vinnie Falco (vinnie.falco@gmail.com) +// Copyright (c) 2023 Krystian Stasiowski (sdkrystian@gmail.com) +// Copyright (c) 2024 Alan de Freitas (alandefreitas@gmail.com) +// +// Official repository: https://github.com/cppalliance/mrdocs +// + +#ifndef MRDOCS_API_METADATA_TARG_TEMPLATETARG_HPP +#define MRDOCS_API_METADATA_TARG_TEMPLATETARG_HPP + +#include +#include +#include +#include + +namespace clang::mrdocs { + +struct TemplateTArg final + : TArgCommonBase +{ + /** SymbolID of the referenced template. */ + SymbolID Template; + + /** Name of the referenced template. */ + std::string Name; + + auto operator<=>(TemplateTArg const&) const = default; +}; + +} // clang::mrdocs + +#endif // MRDOCS_API_METADATA_TARG_TEMPLATETARG_HPP diff --git a/include/mrdocs/Metadata/TArg/TypeTArg.hpp b/include/mrdocs/Metadata/TArg/TypeTArg.hpp new file mode 100644 index 000000000..642ec2d4a --- /dev/null +++ b/include/mrdocs/Metadata/TArg/TypeTArg.hpp @@ -0,0 +1,34 @@ +// +// This is a derivative work. originally part of the LLVM Project. +// Licensed under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// Copyright (c) 2023 Vinnie Falco (vinnie.falco@gmail.com) +// Copyright (c) 2023 Krystian Stasiowski (sdkrystian@gmail.com) +// Copyright (c) 2024 Alan de Freitas (alandefreitas@gmail.com) +// +// Official repository: https://github.com/cppalliance/mrdocs +// + +#ifndef MRDOCS_API_METADATA_TARG_TYPETARG_HPP +#define MRDOCS_API_METADATA_TARG_TYPETARG_HPP + +#include +#include +#include + +namespace clang::mrdocs { + +struct TypeTArg final + : TArgCommonBase +{ + /** Template argument type. */ + Optional> Type = std::nullopt; + + auto operator<=>(TypeTArg const&) const = default; +}; + +} // clang::mrdocs + +#endif // MRDOCS_API_METADATA_TARG_TYPETARG_HPP diff --git a/include/mrdocs/Metadata/TParam.hpp b/include/mrdocs/Metadata/TParam.hpp new file mode 100644 index 000000000..9831a87f5 --- /dev/null +++ b/include/mrdocs/Metadata/TParam.hpp @@ -0,0 +1,85 @@ +// +// This is a derivative work. originally part of the LLVM Project. +// Licensed under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// Copyright (c) 2023 Vinnie Falco (vinnie.falco@gmail.com) +// Copyright (c) 2023 Krystian Stasiowski (sdkrystian@gmail.com) +// Copyright (c) 2024 Alan de Freitas (alandefreitas@gmail.com) +// +// Official repository: https://github.com/cppalliance/mrdocs +// + +#ifndef MRDOCS_API_METADATA_TPARAM_HPP +#define MRDOCS_API_METADATA_TPARAM_HPP + +#include +#include +#include +#include +#include + +namespace clang::mrdocs { + +template< + typename TParamTy, + typename F, + typename... Args> + requires std::derived_from +constexpr +decltype(auto) +visit( + TParamTy& P, + F&& f, + Args&&... args) +{ + switch(P.Kind) + { + case TParamKind::Type: + return f(static_cast&>(P), + std::forward(args)...); + case TParamKind::NonType: + return f(static_cast&>(P), + std::forward(args)...); + case TParamKind::Template: + return f(static_cast&>(P), + std::forward(args)...); + default: + MRDOCS_UNREACHABLE(); + } +} + +MRDOCS_DECL +std::strong_ordering +operator<=>(Polymorphic const& lhs, Polymorphic const& rhs); + +inline +bool +operator==(Polymorphic const& lhs, Polymorphic const& rhs) { + return lhs <=> rhs == std::strong_ordering::equal; +} + +inline +void +tag_invoke( + dom::ValueFromTag, + dom::Value& v, + Polymorphic const& I, + DomCorpus const* domCorpus) +{ + if (I.valueless_after_move()) + { + v = nullptr; + return; + } + tag_invoke(dom::ValueFromTag{}, v, *I, domCorpus); +} + + +} // clang::mrdocs + +#endif diff --git a/include/mrdocs/Metadata/TParam/NonTypeTParam.hpp b/include/mrdocs/Metadata/TParam/NonTypeTParam.hpp new file mode 100644 index 000000000..2bd1e70f7 --- /dev/null +++ b/include/mrdocs/Metadata/TParam/NonTypeTParam.hpp @@ -0,0 +1,36 @@ +// +// This is a derivative work. originally part of the LLVM Project. +// Licensed under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// Copyright (c) 2023 Vinnie Falco (vinnie.falco@gmail.com) +// Copyright (c) 2023 Krystian Stasiowski (sdkrystian@gmail.com) +// Copyright (c) 2024 Alan de Freitas (alandefreitas@gmail.com) +// +// Official repository: https://github.com/cppalliance/mrdocs +// + +#ifndef MRDOCS_API_METADATA_TPARAM_NONTYPETPARAM_HPP +#define MRDOCS_API_METADATA_TPARAM_NONTYPETPARAM_HPP + +#include +#include +#include +#include +#include + +namespace clang::mrdocs { + +struct NonTypeTParam final + : TParamCommonBase +{ + /** Type of the non-type template parameter */ + Optional> Type = std::nullopt; + + std::strong_ordering operator<=>(NonTypeTParam const&) const; +}; + +} // clang::mrdocs + +#endif diff --git a/include/mrdocs/Metadata/TParam/TParamBase.hpp b/include/mrdocs/Metadata/TParam/TParamBase.hpp new file mode 100644 index 000000000..a58d91435 --- /dev/null +++ b/include/mrdocs/Metadata/TParam/TParamBase.hpp @@ -0,0 +1,86 @@ +// +// This is a derivative work. originally part of the LLVM Project. +// Licensed under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// Copyright (c) 2023 Vinnie Falco (vinnie.falco@gmail.com) +// Copyright (c) 2023 Krystian Stasiowski (sdkrystian@gmail.com) +// Copyright (c) 2024 Alan de Freitas (alandefreitas@gmail.com) +// +// Official repository: https://github.com/cppalliance/mrdocs +// + +#ifndef MRDOCS_API_METADATA_TPARAM_TPARAMBASE_HPP +#define MRDOCS_API_METADATA_TPARAM_TPARAMBASE_HPP + +#include +#include +#include +#include +#include + +namespace clang::mrdocs { + +class DomCorpus; + +struct TParam +{ + /** The kind of template parameter this is */ + TParamKind Kind; + + /** The template parameters name, if any */ + std::string Name; + + /** Whether this template parameter is a parameter pack */ + bool IsParameterPack = false; + + /** The default template argument, if any */ + Optional> Default = std::nullopt; + + constexpr virtual ~TParam() = default; + + constexpr bool isType() const noexcept { return Kind == TParamKind::Type; } + constexpr bool isNonType() const noexcept { return Kind == TParamKind::NonType; } + constexpr bool isTemplate() const noexcept { return Kind == TParamKind::Template; } + + std::strong_ordering operator<=>(TParam const&) const; + +protected: + constexpr + TParam( + TParamKind kind) noexcept + : Kind(kind) + { + } +}; + +void +tag_invoke( + dom::ValueFromTag, + dom::Value& v, + TParam const& I, + DomCorpus const* domCorpus); + +template +struct TParamCommonBase : TParam +{ + static constexpr TParamKind kind_id = K; + + static constexpr bool isType() noexcept { return K == TParamKind::Type; } + static constexpr bool isNonType() noexcept { return K == TParamKind::NonType; } + static constexpr bool isTemplate() noexcept { return K == TParamKind::Template; } + + auto operator<=>(TParamCommonBase const&) const = default; + +protected: + constexpr + TParamCommonBase() noexcept + : TParam(K) + { + } +}; + +} // clang::mrdocs + +#endif diff --git a/include/mrdocs/Metadata/TParam/TParamKeyKind.hpp b/include/mrdocs/Metadata/TParam/TParamKeyKind.hpp new file mode 100644 index 000000000..53dd13e15 --- /dev/null +++ b/include/mrdocs/Metadata/TParam/TParamKeyKind.hpp @@ -0,0 +1,48 @@ +// +// This is a derivative work. originally part of the LLVM Project. +// Licensed under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// Copyright (c) 2023 Vinnie Falco (vinnie.falco@gmail.com) +// Copyright (c) 2023 Krystian Stasiowski (sdkrystian@gmail.com) +// Copyright (c) 2024 Alan de Freitas (alandefreitas@gmail.com) +// +// Official repository: https://github.com/cppalliance/mrdocs +// + +#ifndef MRDOCS_API_METADATA_TPARAM_TPARAMKEYKIND_HPP +#define MRDOCS_API_METADATA_TPARAM_TPARAMKEYKIND_HPP + +#include +#include +#include + +namespace clang::mrdocs { + +/** The keyword a template parameter was declared with */ +enum class TParamKeyKind : int +{ + /// Class keyword + Class = 0, + /// Typename keyword + Typename +}; + +MRDOCS_DECL +std::string_view +toString(TParamKeyKind kind) noexcept; + +inline +void +tag_invoke( + dom::ValueFromTag, + dom::Value& v, + TParamKeyKind kind) +{ + v = toString(kind); +} + +} // clang::mrdocs + +#endif diff --git a/include/mrdocs/Metadata/TParam/TParamKind.hpp b/include/mrdocs/Metadata/TParam/TParamKind.hpp new file mode 100644 index 000000000..8af7b910b --- /dev/null +++ b/include/mrdocs/Metadata/TParam/TParamKind.hpp @@ -0,0 +1,36 @@ +// +// This is a derivative work. originally part of the LLVM Project. +// Licensed under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// Copyright (c) 2023 Vinnie Falco (vinnie.falco@gmail.com) +// Copyright (c) 2023 Krystian Stasiowski (sdkrystian@gmail.com) +// Copyright (c) 2024 Alan de Freitas (alandefreitas@gmail.com) +// +// Official repository: https://github.com/cppalliance/mrdocs +// + +#ifndef MRDOCS_API_METADATA_TPARAM_TPARAMKIND_HPP +#define MRDOCS_API_METADATA_TPARAM_TPARAMKIND_HPP + +#include +#include + +namespace clang::mrdocs { + +enum class TParamKind : int +{ + /// Template type parameter, e.g. "typename T" or "class T" + Type = 1, // for bitstream + /// Template non-type parameter, e.g. "int N" or "auto N" + NonType, + /// Template-template parameter, e.g. "template typename T" + Template +}; + +MRDOCS_DECL std::string_view toString(TParamKind kind) noexcept; + +} // clang::mrdocs + +#endif diff --git a/include/mrdocs/Metadata/TParam/TemplateTParam.hpp b/include/mrdocs/Metadata/TParam/TemplateTParam.hpp new file mode 100644 index 000000000..77daee36c --- /dev/null +++ b/include/mrdocs/Metadata/TParam/TemplateTParam.hpp @@ -0,0 +1,36 @@ +// +// This is a derivative work. originally part of the LLVM Project. +// Licensed under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// Copyright (c) 2023 Vinnie Falco (vinnie.falco@gmail.com) +// Copyright (c) 2023 Krystian Stasiowski (sdkrystian@gmail.com) +// Copyright (c) 2024 Alan de Freitas (alandefreitas@gmail.com) +// +// Official repository: https://github.com/cppalliance/mrdocs +// + +#ifndef MRDOCS_API_METADATA_TPARAM_TEMPLATETPARAM_HPP +#define MRDOCS_API_METADATA_TPARAM_TEMPLATETPARAM_HPP + +#include +#include +#include +#include + +namespace clang::mrdocs { + +struct TemplateTParam final + : TParamCommonBase +{ + /** Template parameters for the template-template parameter */ + std::vector> Params; + + std::strong_ordering + operator<=>(TemplateTParam const& other) const; +}; + +} // clang::mrdocs + +#endif diff --git a/include/mrdocs/Metadata/TParam/TypeTParam.hpp b/include/mrdocs/Metadata/TParam/TypeTParam.hpp new file mode 100644 index 000000000..796dd682d --- /dev/null +++ b/include/mrdocs/Metadata/TParam/TypeTParam.hpp @@ -0,0 +1,40 @@ +// +// This is a derivative work. originally part of the LLVM Project. +// Licensed under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// Copyright (c) 2023 Vinnie Falco (vinnie.falco@gmail.com) +// Copyright (c) 2023 Krystian Stasiowski (sdkrystian@gmail.com) +// Copyright (c) 2024 Alan de Freitas (alandefreitas@gmail.com) +// +// Official repository: https://github.com/cppalliance/mrdocs +// + +#ifndef MRDOCS_API_METADATA_TPARAM_TYPETPARAM_HPP +#define MRDOCS_API_METADATA_TPARAM_TYPETPARAM_HPP + +#include +#include +#include +#include +#include +#include + +namespace clang::mrdocs { + +struct TypeTParam final + : TParamCommonBase +{ + /** Keyword (class/typename) the parameter uses */ + TParamKeyKind KeyKind = TParamKeyKind::Class; + + /** The type-constraint for the parameter, if any. */ + Optional> Constraint = std::nullopt; + + std::strong_ordering operator<=>(TypeTParam const&) const; +}; + +} // clang::mrdocs + +#endif diff --git a/include/mrdocs/Metadata/Template.hpp b/include/mrdocs/Metadata/Template.hpp index bc2836bec..47ad0180b 100644 --- a/include/mrdocs/Metadata/Template.hpp +++ b/include/mrdocs/Metadata/Template.hpp @@ -16,359 +16,14 @@ #include #include -#include -#include -#include -#include +#include +#include +#include +#include #include namespace clang::mrdocs { -/** The kind of template argument. -*/ -enum class TArgKind : int -{ - /// type arguments - Type = 1, // for bitstream - /// non-type arguments, i.e. expressions - NonType, - /// template template arguments, i.e. template names - Template -}; - -MRDOCS_DECL -std::string_view -toString(TArgKind kind) noexcept; - -inline -void -tag_invoke( - dom::ValueFromTag, - dom::Value& v, - TArgKind kind) -{ - v = toString(kind); -} - -struct TArg -{ - /** The kind of template argument this is. */ - TArgKind Kind; - - /** Whether this template argument is a parameter expansion. */ - bool IsPackExpansion = false; - - constexpr virtual ~TArg() = default; - - constexpr bool isType() const noexcept { return Kind == TArgKind::Type; } - constexpr bool isNonType() const noexcept { return Kind == TArgKind::NonType; } - constexpr bool isTemplate() const noexcept { return Kind == TArgKind::Template; } - - auto operator<=>(TArg const&) const = default; - -protected: - constexpr - TArg( - TArgKind kind) noexcept - : Kind(kind) - { - } -}; - -template -struct IsTArg : TArg -{ - static constexpr TArgKind kind_id = K; - - static constexpr bool isType() noexcept { return K == TArgKind::Type; } - static constexpr bool isNonType() noexcept { return K == TArgKind::NonType; } - static constexpr bool isTemplate() noexcept { return K == TArgKind::Template; } - -protected: - constexpr - IsTArg() noexcept - : TArg(K) - { - } -}; - -struct TypeTArg final - : IsTArg -{ - /** Template argument type. */ - Polymorphic Type = std::nullopt; - - auto operator<=>(TypeTArg const&) const = default; -}; - - -struct NonTypeTArg final - : IsTArg -{ - /** Template argument expression. */ - ExprInfo Value; - - auto operator<=>(NonTypeTArg const&) const = default; -}; - -struct TemplateTArg final - : IsTArg -{ - /** SymbolID of the referenced template. */ - SymbolID Template; - - /** Name of the referenced template. */ - std::string Name; - - auto operator<=>(TemplateTArg const&) const = default; -}; - -template< - std::derived_from TArgTy, - class F, - class... Args> -constexpr -decltype(auto) -visit( - TArgTy& A, - F&& f, - Args&&... args) -{ - switch(A.Kind) - { - case TArgKind::Type: - return f(static_cast&>(A), - std::forward(args)...); - case TArgKind::NonType: - return f(static_cast&>(A), - std::forward(args)...); - case TArgKind::Template: - return f(static_cast&>(A), - std::forward(args)...); - default: - MRDOCS_UNREACHABLE(); - } -} - -MRDOCS_DECL -std::strong_ordering -operator<=>(Polymorphic const& lhs, Polymorphic const& rhs); - -MRDOCS_DECL -std::string -toString(TArg const& arg) noexcept; - -MRDOCS_DECL -void -tag_invoke( - dom::ValueFromTag, - dom::Value& v, - TArg const& I, - DomCorpus const* domCorpus); - -inline -void -tag_invoke( - dom::ValueFromTag, - dom::Value& v, - Polymorphic const& I, - DomCorpus const* domCorpus) -{ - if (!I) - { - v = nullptr; - return; - } - tag_invoke(dom::ValueFromTag{}, v, *I, domCorpus); -} - -// ---------------------------------------------------------------- - -enum class TParamKind : int -{ - /// Template type parameter, e.g. "typename T" or "class T" - Type = 1, // for bitstream - /// Template non-type parameter, e.g. "int N" or "auto N" - NonType, - /// Template-template parameter, e.g. "template typename T" - Template -}; - -MRDOCS_DECL std::string_view toString(TParamKind kind) noexcept; - -struct TParam -{ - /** The kind of template parameter this is */ - TParamKind Kind; - - /** The template parameters name, if any */ - std::string Name; - - /** Whether this template parameter is a parameter pack */ - bool IsParameterPack = false; - - /** The default template argument, if any */ - Polymorphic Default = std::nullopt; - - constexpr virtual ~TParam() = default; - - constexpr bool isType() const noexcept { return Kind == TParamKind::Type; } - constexpr bool isNonType() const noexcept { return Kind == TParamKind::NonType; } - constexpr bool isTemplate() const noexcept { return Kind == TParamKind::Template; } - - std::strong_ordering operator<=>(TParam const&) const; - -protected: - constexpr - TParam( - TParamKind kind) noexcept - : Kind(kind) - { - } -}; - -void -tag_invoke( - dom::ValueFromTag, - dom::Value& v, - TParam const& I, - DomCorpus const* domCorpus); - -inline -void -tag_invoke( - dom::ValueFromTag, - dom::Value& v, - Polymorphic const& I, - DomCorpus const* domCorpus) -{ - if (!I) - { - v = nullptr; - return; - } - tag_invoke(dom::ValueFromTag{}, v, *I, domCorpus); -} - - -template -struct TParamCommonBase : TParam -{ - static constexpr TParamKind kind_id = K; - - static constexpr bool isType() noexcept { return K == TParamKind::Type; } - static constexpr bool isNonType() noexcept { return K == TParamKind::NonType; } - static constexpr bool isTemplate() noexcept { return K == TParamKind::Template; } - - auto operator<=>(TParamCommonBase const&) const = default; - -protected: - constexpr - TParamCommonBase() noexcept - : TParam(K) - { - } -}; - -/** The keyword a template parameter was declared with */ -enum class TParamKeyKind : int -{ - /// Class keyword - Class = 0, - /// Typename keyword - Typename -}; - -MRDOCS_DECL std::string_view toString(TParamKeyKind kind) noexcept; - -inline -void -tag_invoke( - dom::ValueFromTag, - dom::Value& v, - TParamKeyKind kind) -{ - v = toString(kind); -} - -struct TypeTParam final - : TParamCommonBase -{ - /** Keyword (class/typename) the parameter uses */ - TParamKeyKind KeyKind = TParamKeyKind::Class; - - /** The type-constraint for the parameter, if any. */ - Polymorphic Constraint = std::nullopt; - - std::strong_ordering operator<=>(TypeTParam const&) const; -}; - -struct NonTypeTParam final - : TParamCommonBase -{ - /** Type of the non-type template parameter */ - Polymorphic Type = std::nullopt; - - std::strong_ordering operator<=>(NonTypeTParam const&) const; -}; - -struct TemplateTParam final - : TParamCommonBase -{ - /** Template parameters for the template-template parameter */ - std::vector> Params; - - std::strong_ordering - operator<=>(TemplateTParam const& other) const; -}; - -template< - typename TParamTy, - typename F, - typename... Args> - requires std::derived_from -constexpr -decltype(auto) -visit( - TParamTy& P, - F&& f, - Args&&... args) -{ - switch(P.Kind) - { - case TParamKind::Type: - return f(static_cast&>(P), - std::forward(args)...); - case TParamKind::NonType: - return f(static_cast&>(P), - std::forward(args)...); - case TParamKind::Template: - return f(static_cast&>(P), - std::forward(args)...); - default: - MRDOCS_UNREACHABLE(); - } -} - -MRDOCS_DECL -std::strong_ordering -operator<=>(Polymorphic const& lhs, Polymorphic const& rhs); - -inline -bool -operator==(Polymorphic const& lhs, Polymorphic const& rhs) { - return lhs <=> rhs == std::strong_ordering::equal; -} - - -// ---------------------------------------------------------------- - /** The kind of template or specialization. */ enum class TemplateSpecKind @@ -385,9 +40,10 @@ MRDOCS_DECL std::string_view toString(TemplateSpecKind kind); -/** Information pertaining to templates and specializations thereof. + +/** Information about templates and specializations thereof. */ -struct TemplateInfo +struct TemplateInfo final { std::vector> Params; std::vector> Args; @@ -475,6 +131,7 @@ tag_invoke( tag_invoke(dom::ValueFromTag{}, v, *I, domCorpus); } + } // clang::mrdocs #endif diff --git a/include/mrdocs/Metadata/Type.hpp b/include/mrdocs/Metadata/Type.hpp index 4a855513e..674f11889 100644 --- a/include/mrdocs/Metadata/Type.hpp +++ b/include/mrdocs/Metadata/Type.hpp @@ -11,489 +11,23 @@ #ifndef MRDOCS_API_METADATA_TYPE_HPP #define MRDOCS_API_METADATA_TYPE_HPP -#include -#include -#include -#include -#include -#include -#include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include namespace clang::mrdocs { -struct NameInfo; -struct TypeInfo; - -std::strong_ordering -operator<=>(Polymorphic const& lhs, Polymorphic const& rhs); - -std::strong_ordering -operator<=>(Polymorphic const& lhs, Polymorphic const& rhs); - -/** Type qualifiers -*/ -enum QualifierKind -{ - /// No qualifiers - None, - /// The const qualifier - Const, - /// The volatile qualifier - Volatile -}; - -MRDOCS_DECL dom::String toString(QualifierKind kind) noexcept; - -inline -void -tag_invoke( - dom::ValueFromTag, - dom::Value& v, - QualifierKind kind) -{ - v = toString(kind); -} - -enum class TypeKind -{ - /// A Named type - Named = 1, // for bitstream - /// A decltype type - Decltype, - /// An auto type - Auto, - /// An LValueReference type - LValueReference, - /// An RValueReference type - RValueReference, - /// A Pointer type - Pointer, - /// A MemberPointer type - MemberPointer, - /// An Array type - Array, - /// A Function type - Function, -}; - -MRDOCS_DECL dom::String toString(TypeKind kind) noexcept; - -inline -void -tag_invoke( - dom::ValueFromTag, - dom::Value& v, - TypeKind kind) -{ - v = toString(kind); -} - -/** The kind of `auto` keyword used in a declaration. - - This is either `auto` or `decltype(auto)`. -*/ -enum class AutoKind -{ - /// The `auto` keyword - Auto, - /// The `decltype(auto)` keyword - DecltypeAuto -}; - -MRDOCS_DECL dom::String toString(AutoKind kind) noexcept; - -inline -void -tag_invoke( - dom::ValueFromTag, - dom::Value& v, - AutoKind kind) -{ - v = toString(kind); -} - -/** A possibly qualified type. - - This class represents a type that may have - qualifiers (e.g. const, volatile). - - This base class is used to store the kind - of type. Derived classes are used to store - the type information according to the kind. - */ -struct TypeInfo -{ - /** The kind of TypeInfo this is - */ - TypeKind Kind; - - /** Whether this is the pattern of a pack expansion. - */ - bool IsPackExpansion = false; - - /** The const qualifier - */ - bool IsConst = false; - - /** The volatile qualifier - */ - bool IsVolatile = false; - - /** The constraints associated with the type - - This represents the constraints associated with the type, - such as SFINAE constraints. - - For instance, if SFINAE detection is enabled, the - expression `std::enable_if_t, T>` - will have type `T` (NamedType) and constraints - `{std::is_integral_v}`. - */ - std::vector Constraints; - - constexpr virtual ~TypeInfo() = default; - - constexpr bool isNamed() const noexcept { return Kind == TypeKind::Named; } - constexpr bool isDecltype() const noexcept { return Kind == TypeKind::Decltype; } - constexpr bool isAuto() const noexcept { return Kind == TypeKind::Auto; } - constexpr bool isLValueReference() const noexcept { return Kind == TypeKind::LValueReference; } - constexpr bool isRValueReference() const noexcept { return Kind == TypeKind::RValueReference; } - constexpr bool isPointer() const noexcept { return Kind == TypeKind::Pointer; } - constexpr bool isMemberPointer() const noexcept { return Kind == TypeKind::MemberPointer; } - constexpr bool isArray() const noexcept { return Kind == TypeKind::Array; } - constexpr bool isFunction() const noexcept { return Kind == TypeKind::Function; } - - /** Return the symbol named by this type. - */ - SymbolID - namedSymbol() const noexcept; - - auto operator<=>(TypeInfo const&) const = default; - -protected: - constexpr - TypeInfo( - TypeKind kind) noexcept - : Kind(kind) - { - } -}; - -MRDOCS_DECL -void -tag_invoke( - dom::ValueFromTag, - dom::Value& v, - TypeInfo const& I, - DomCorpus const* domCorpus); - -inline -void -tag_invoke( - dom::ValueFromTag, - dom::Value& v, - Polymorphic const& I, - DomCorpus const* domCorpus) -{ - if (!I) - { - v = nullptr; - return; - } - tag_invoke(dom::ValueFromTag{}, v, *I, domCorpus); -} - -template -struct TypeInfoCommonBase : TypeInfo -{ - static constexpr TypeKind kind_id = K; - - static constexpr bool isNamed() noexcept { return K == TypeKind::Named; } - static constexpr bool isDecltype() noexcept { return K == TypeKind::Decltype; } - static constexpr bool isAuto() noexcept { return K == TypeKind::Auto; } - static constexpr bool isLValueReference() noexcept { return K == TypeKind::LValueReference; } - static constexpr bool isRValueReference() noexcept { return K == TypeKind::RValueReference; } - static constexpr bool isPointer() noexcept { return K == TypeKind::Pointer; } - static constexpr bool isMemberPointer() noexcept { return K == TypeKind::MemberPointer; } - static constexpr bool isArray() noexcept { return K == TypeKind::Array; } - static constexpr bool isFunction() noexcept { return K == TypeKind::Function; } - - auto operator<=>(TypeInfoCommonBase const&) const = default; - -protected: - constexpr - TypeInfoCommonBase() noexcept - : TypeInfo(K) - { - } -}; - -/** Categorically describes a fundamental type. - - @see https://en.cppreference.com/w/cpp/language/types -*/ -enum class FundamentalTypeKind -{ - /// void - Void, - /// std::nullptr_t - Nullptr, - /// bool - Bool, - /// char - Char, - /// signed char - SignedChar, - /// unsigned char - UnsignedChar, - /// char8_t - Char8, - /// char16_t - Char16, - /// char32_t - Char32, - /// wchar_t - WChar, - /// short / short int / signed short / signed short int - Short, - /// unsigned short / unsigned short int - UnsignedShort, - /// int / signed / signed int - Int, - /// unsigned / unsigned int - UnsignedInt, - /// long / long int / signed long / signed long int - Long, - /// unsigned long / unsigned long int - UnsignedLong, - /// long long / long long int / signed long long / signed long long int - LongLong, - /// unsigned long long / unsigned long long int - UnsignedLongLong, - /// float - Float, - /// double - Double, - /// long double - LongDouble -}; - -/** Convert a FundamentalTypeKind to a string. - - This function converts a FundamentalTypeKind to - the shortest canonical string representing the type. - - @return The string representation of the kind - */ -MRDOCS_DECL -std::string_view -toString(FundamentalTypeKind kind) noexcept; - -/** Convert a string to a FundamentalTypeKind. - - This function converts a string to a FundamentalTypeKind. - - All variations of the type specifiers are supported. - - However, the "long long" specifier cannot be split - into two separate specifiers. - - @param str The string to convert - @param[out] kind The resulting FundamentalTypeKind - - @return true if the string was successfully converted - */ -MRDOCS_DECL -bool -fromString(std::string_view str, FundamentalTypeKind& kind) noexcept; - -/** Apply the "long" specifier to the type - - If applying "long" the specifier is a valid operation - the function changes the type and returns true. - - For instance, applying "long" to - `FundamentalTypeKind::Int` ("int") results in - `FundamentalTypeKind::Long` ("long int"). - - @param[in/out] kind The type to modify - @return Whether the operation was successful - */ -MRDOCS_DECL -bool -makeLong(FundamentalTypeKind& kind) noexcept; - -/** Apply the "short" specifier to the type - - If applying "short" the specifier is a valid operation - the function changes the type and returns true. - - For instance, applying "short" to - `FundamentalTypeKind::Int` ("int") results in - `FundamentalTypeKind::Short` ("short int"). - - @param[in/out] kind The type to modify - @return Whether the operation was successful - */ -MRDOCS_DECL -bool -makeShort(FundamentalTypeKind& kind) noexcept; - -/** Apply the "signed" specifier to the type - - If applying the "signed" specifier is a valid operation - the function changes the type and returns true. - - For instance, applying "signed" to - `FundamentalTypeKind::Char` ("char") results in - `FundamentalTypeKind::SignedChar` ("signed char"). - - It also returns true if applying the "signed" specifier - is a valid operation but doesn't affect the - type. - - For instance, applying "signed" to - `FundamentalTypeKind::Int` ("int") doesn't change the type - but returns `true`, even though `FundamentalTypeKind::Int` - could be declared as "int" or "signed" and multiple - "signed" specifiers are not allowed. - - @param[in/out] kind The type to modify - @return Whether the operation was successful - */ -MRDOCS_DECL -bool -makeSigned(FundamentalTypeKind& kind) noexcept; - -/** Apply the "unsigned" specifier to the type - - If applying the "unsigned" specifier is a valid operation - the function changes the type and returns true. - - For instance, applying "unsigned" to - `FundamentalTypeKind::Char` ("char") results in - `FundamentalTypeKind::UnsignedChar` ("unsigned char") - and applying "unsigned" to - `FundamentalTypeKind::Int` ("int") results in - `FundamentalTypeKind::UnsignedInt` ("unsigned int"). - - @param[in/out] kind The type to modify - @return Whether the operation was successful - */ -MRDOCS_DECL -bool -makeUnsigned(FundamentalTypeKind& kind) noexcept; - -/** Apply the "char" specifier to the type - - If applying the "char" specifier to a type - that might have been declared only with "signed/unsigned" - or "short/long" specifiers, the function changes the type - and returns true. - - For instance, applying "char" to - `FundamentalTypeKind::Int` ("int", which could be declared - as "signed") results in - `FundamentalTypeKind::SignedChar` ("signed char"). - - @param[in/out] kind The type to modify - @return Whether the operation was successful - */ -MRDOCS_DECL -bool -makeChar(FundamentalTypeKind& kind) noexcept; - -struct NamedTypeInfo final - : TypeInfoCommonBase -{ - Polymorphic Name = std::nullopt; - - std::optional FundamentalType; - - std::strong_ordering - operator<=>(NamedTypeInfo const& other) const; -}; - -struct DecltypeTypeInfo final - : TypeInfoCommonBase -{ - ExprInfo Operand; - - auto operator<=>(DecltypeTypeInfo const&) const = default; -}; - -struct AutoTypeInfo final - : TypeInfoCommonBase -{ - AutoKind Keyword = AutoKind::Auto; - Polymorphic Constraint = std::nullopt; - - std::strong_ordering - operator<=>(AutoTypeInfo const&) const; -}; - -struct LValueReferenceTypeInfo final - : TypeInfoCommonBase -{ - Polymorphic PointeeType = std::nullopt; - - std::strong_ordering - operator<=>(LValueReferenceTypeInfo const&) const; -}; - -struct RValueReferenceTypeInfo final - : TypeInfoCommonBase -{ - Polymorphic PointeeType = std::nullopt; - - std::strong_ordering - operator<=>(RValueReferenceTypeInfo const&) const; -}; - -struct PointerTypeInfo final - : TypeInfoCommonBase -{ - Polymorphic PointeeType = std::nullopt; - - std::strong_ordering - operator<=>(PointerTypeInfo const&) const; -}; - -struct MemberPointerTypeInfo final - : TypeInfoCommonBase -{ - Polymorphic ParentType = std::nullopt; - Polymorphic PointeeType = std::nullopt; - - std::strong_ordering - operator<=>(MemberPointerTypeInfo const&) const; -}; - -struct ArrayTypeInfo final - : TypeInfoCommonBase -{ - Polymorphic ElementType = std::nullopt; - ConstantExprInfo Bounds; - - std::strong_ordering - operator<=>(ArrayTypeInfo const&) const; -}; - -struct FunctionTypeInfo final - : TypeInfoCommonBase -{ - Polymorphic ReturnType = std::nullopt; - std::vector> ParamTypes; - ReferenceKind RefQualifier = ReferenceKind::None; - NoexceptInfo ExceptionSpec; - bool IsVariadic = false; - - std::strong_ordering - operator<=>(FunctionTypeInfo const&) const; -}; - template< std::derived_from TypeTy, class F, @@ -558,6 +92,30 @@ operator==(Polymorphic const& lhs, Polymorphic const& rhs) { return lhs <=> rhs == std::strong_ordering::equal; } +inline std::strong_ordering +operator<=>( + Optional> const& lhs, + Optional> const& rhs) +{ + if (lhs && rhs) + { + return *lhs <=> *rhs; + } + if (!lhs && !rhs) + { + return std::strong_ordering::equal; + } + return bool(lhs) <=> bool(rhs); +} + +inline bool +operator==( + Optional> const& lhs, + Optional> const& rhs) +{ + return lhs <=> rhs == std::strong_ordering::equal; +} + /** Return the inner type. The inner type is the type which is modified @@ -609,6 +167,40 @@ toString( TypeInfo const& T, std::string_view Name = ""); +inline +void +tag_invoke( + dom::ValueFromTag, + dom::Value& v, + Polymorphic const& I, + DomCorpus const* domCorpus) +{ + if (I.valueless_after_move()) + { + v = nullptr; + return; + } + tag_invoke(dom::ValueFromTag{}, v, *I, domCorpus); +} + +inline +void +tag_invoke( + dom::ValueFromTag, + dom::Value& v, + Optional> const& I, + DomCorpus const* domCorpus) +{ + if (!I) + { + v = nullptr; + return; + } + MRDOCS_ASSERT(!I->valueless_after_move()); + tag_invoke(dom::ValueFromTag{}, v, **I, domCorpus); +} + + } // clang::mrdocs #endif diff --git a/include/mrdocs/Metadata/Type/ArrayTypeInfo.hpp b/include/mrdocs/Metadata/Type/ArrayTypeInfo.hpp new file mode 100644 index 000000000..da746e2b2 --- /dev/null +++ b/include/mrdocs/Metadata/Type/ArrayTypeInfo.hpp @@ -0,0 +1,33 @@ +// +// Licensed under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// Copyright (c) 2023 Krystian Stasiowski (sdkrystian@gmail.com) +// +// Official repository: https://github.com/cppalliance/mrdocs +// + +#ifndef MRDOCS_API_METADATA_TYPE_ARRAYTYPEINFO_HPP +#define MRDOCS_API_METADATA_TYPE_ARRAYTYPEINFO_HPP + +#include +#include +#include +#include + +namespace clang::mrdocs { + +struct ArrayTypeInfo final + : TypeInfoCommonBase +{ + Optional> ElementType = std::nullopt; + ConstantExprInfo Bounds; + + std::strong_ordering + operator<=>(ArrayTypeInfo const&) const; +}; + +} // clang::mrdocs + +#endif diff --git a/include/mrdocs/Metadata/Type/AutoKind.hpp b/include/mrdocs/Metadata/Type/AutoKind.hpp new file mode 100644 index 000000000..c59817b98 --- /dev/null +++ b/include/mrdocs/Metadata/Type/AutoKind.hpp @@ -0,0 +1,47 @@ +// +// Licensed under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// Copyright (c) 2023 Krystian Stasiowski (sdkrystian@gmail.com) +// +// Official repository: https://github.com/cppalliance/mrdocs +// + +#ifndef MRDOCS_API_METADATA_TYPE_AUTOKIND_HPP +#define MRDOCS_API_METADATA_TYPE_AUTOKIND_HPP + +#include +#include + +namespace clang::mrdocs { + +/** The kind of `auto` keyword used in a declaration. + + This is either `auto` or `decltype(auto)`. +*/ +enum class AutoKind +{ + /// The `auto` keyword + Auto, + /// The `decltype(auto)` keyword + DecltypeAuto +}; + +MRDOCS_DECL +dom::String +toString(AutoKind kind) noexcept; + +inline +void +tag_invoke( + dom::ValueFromTag, + dom::Value& v, + AutoKind kind) +{ + v = toString(kind); +} + +} // clang::mrdocs + +#endif diff --git a/include/mrdocs/Metadata/Type/AutoTypeInfo.hpp b/include/mrdocs/Metadata/Type/AutoTypeInfo.hpp new file mode 100644 index 000000000..4522e72d8 --- /dev/null +++ b/include/mrdocs/Metadata/Type/AutoTypeInfo.hpp @@ -0,0 +1,34 @@ +// +// Licensed under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// Copyright (c) 2023 Krystian Stasiowski (sdkrystian@gmail.com) +// +// Official repository: https://github.com/cppalliance/mrdocs +// + +#ifndef MRDOCS_API_METADATA_TYPE_AUTOTYPEINFO_HPP +#define MRDOCS_API_METADATA_TYPE_AUTOTYPEINFO_HPP + +#include +#include +#include +#include +#include + +namespace clang::mrdocs { + +struct AutoTypeInfo final + : TypeInfoCommonBase +{ + AutoKind Keyword = AutoKind::Auto; + Optional> Constraint = std::nullopt; + + std::strong_ordering + operator<=>(AutoTypeInfo const&) const; +}; + +} // clang::mrdocs + +#endif diff --git a/include/mrdocs/Metadata/Type/DecltypeTypeInfo.hpp b/include/mrdocs/Metadata/Type/DecltypeTypeInfo.hpp new file mode 100644 index 000000000..648d40e75 --- /dev/null +++ b/include/mrdocs/Metadata/Type/DecltypeTypeInfo.hpp @@ -0,0 +1,29 @@ +// +// Licensed under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// Copyright (c) 2023 Krystian Stasiowski (sdkrystian@gmail.com) +// +// Official repository: https://github.com/cppalliance/mrdocs +// + +#ifndef MRDOCS_API_METADATA_TYPE_DECLTYPETYPEINFO_HPP +#define MRDOCS_API_METADATA_TYPE_DECLTYPETYPEINFO_HPP + +#include +#include + +namespace clang::mrdocs { + +struct DecltypeTypeInfo final + : TypeInfoCommonBase +{ + ExprInfo Operand; + + auto operator<=>(DecltypeTypeInfo const&) const = default; +}; + +} // clang::mrdocs + +#endif diff --git a/include/mrdocs/Metadata/Type/FunctionTypeInfo.hpp b/include/mrdocs/Metadata/Type/FunctionTypeInfo.hpp new file mode 100644 index 000000000..2c1658ba8 --- /dev/null +++ b/include/mrdocs/Metadata/Type/FunctionTypeInfo.hpp @@ -0,0 +1,37 @@ +// +// Licensed under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// Copyright (c) 2023 Krystian Stasiowski (sdkrystian@gmail.com) +// +// Official repository: https://github.com/cppalliance/mrdocs +// + +#ifndef MRDOCS_API_METADATA_TYPE_FUNCTIONTYPEINFO_HPP +#define MRDOCS_API_METADATA_TYPE_FUNCTIONTYPEINFO_HPP + +#include +#include +#include +#include +#include + +namespace clang::mrdocs { + +struct FunctionTypeInfo final + : TypeInfoCommonBase +{ + Optional> ReturnType = std::nullopt; + std::vector> ParamTypes; + ReferenceKind RefQualifier = ReferenceKind::None; + NoexceptInfo ExceptionSpec; + bool IsVariadic = false; + + std::strong_ordering + operator<=>(FunctionTypeInfo const&) const; +}; + +} // clang::mrdocs + +#endif diff --git a/include/mrdocs/Metadata/Type/FundamentalTypeKind.hpp b/include/mrdocs/Metadata/Type/FundamentalTypeKind.hpp new file mode 100644 index 000000000..fa35717e6 --- /dev/null +++ b/include/mrdocs/Metadata/Type/FundamentalTypeKind.hpp @@ -0,0 +1,196 @@ +// +// Licensed under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// Copyright (c) 2023 Krystian Stasiowski (sdkrystian@gmail.com) +// +// Official repository: https://github.com/cppalliance/mrdocs +// + +#ifndef MRDOCS_API_METADATA_TYPE_FUNDAMENTALTYPEKIND_HPP +#define MRDOCS_API_METADATA_TYPE_FUNDAMENTALTYPEKIND_HPP + +#include +#include + +namespace clang::mrdocs { + +/** Categorically describes a fundamental type. + + @see https://en.cppreference.com/w/cpp/language/types +*/ +enum class FundamentalTypeKind +{ + /// void + Void, + /// std::nullptr_t + Nullptr, + /// bool + Bool, + /// char + Char, + /// signed char + SignedChar, + /// unsigned char + UnsignedChar, + /// char8_t + Char8, + /// char16_t + Char16, + /// char32_t + Char32, + /// wchar_t + WChar, + /// short / short int / signed short / signed short int + Short, + /// unsigned short / unsigned short int + UnsignedShort, + /// int / signed / signed int + Int, + /// unsigned / unsigned int + UnsignedInt, + /// long / long int / signed long / signed long int + Long, + /// unsigned long / unsigned long int + UnsignedLong, + /// long long / long long int / signed long long / signed long long int + LongLong, + /// unsigned long long / unsigned long long int + UnsignedLongLong, + /// float + Float, + /// double + Double, + /// long double + LongDouble +}; + +/** Convert a FundamentalTypeKind to a string. + + This function converts a FundamentalTypeKind to + the shortest canonical string representing the type. + + @return The string representation of the kind + */ +MRDOCS_DECL +std::string_view +toString(FundamentalTypeKind kind) noexcept; + +/** Convert a string to a FundamentalTypeKind. + + This function converts a string to a FundamentalTypeKind. + + All variations of the type specifiers are supported. + + However, the "long long" specifier cannot be split + into two separate specifiers. + + @param str The string to convert + @param[out] kind The resulting FundamentalTypeKind + + @return true if the string was successfully converted + */ +MRDOCS_DECL +bool +fromString(std::string_view str, FundamentalTypeKind& kind) noexcept; + +/** Apply the "long" specifier to the type + + If applying "long" the specifier is a valid operation + the function changes the type and returns true. + + For instance, applying "long" to + `FundamentalTypeKind::Int` ("int") results in + `FundamentalTypeKind::Long` ("long int"). + + @param[in/out] kind The type to modify + @return Whether the operation was successful + */ +MRDOCS_DECL +bool +makeLong(FundamentalTypeKind& kind) noexcept; + +/** Apply the "short" specifier to the type + + If applying "short" the specifier is a valid operation + the function changes the type and returns true. + + For instance, applying "short" to + `FundamentalTypeKind::Int` ("int") results in + `FundamentalTypeKind::Short` ("short int"). + + @param[in/out] kind The type to modify + @return Whether the operation was successful + */ +MRDOCS_DECL +bool +makeShort(FundamentalTypeKind& kind) noexcept; + +/** Apply the "signed" specifier to the type + + If applying the "signed" specifier is a valid operation + the function changes the type and returns true. + + For instance, applying "signed" to + `FundamentalTypeKind::Char` ("char") results in + `FundamentalTypeKind::SignedChar` ("signed char"). + + It also returns true if applying the "signed" specifier + is a valid operation but doesn't affect the + type. + + For instance, applying "signed" to + `FundamentalTypeKind::Int` ("int") doesn't change the type + but returns `true`, even though `FundamentalTypeKind::Int` + could be declared as "int" or "signed" and multiple + "signed" specifiers are not allowed. + + @param[in/out] kind The type to modify + @return Whether the operation was successful + */ +MRDOCS_DECL +bool +makeSigned(FundamentalTypeKind& kind) noexcept; + +/** Apply the "unsigned" specifier to the type + + If applying the "unsigned" specifier is a valid operation + the function changes the type and returns true. + + For instance, applying "unsigned" to + `FundamentalTypeKind::Char` ("char") results in + `FundamentalTypeKind::UnsignedChar` ("unsigned char") + and applying "unsigned" to + `FundamentalTypeKind::Int` ("int") results in + `FundamentalTypeKind::UnsignedInt` ("unsigned int"). + + @param[in/out] kind The type to modify + @return Whether the operation was successful + */ +MRDOCS_DECL +bool +makeUnsigned(FundamentalTypeKind& kind) noexcept; + +/** Apply the "char" specifier to the type + + If applying the "char" specifier to a type + that might have been declared only with "signed/unsigned" + or "short/long" specifiers, the function changes the type + and returns true. + + For instance, applying "char" to + `FundamentalTypeKind::Int` ("int", which could be declared + as "signed") results in + `FundamentalTypeKind::SignedChar` ("signed char"). + + @param[in/out] kind The type to modify + @return Whether the operation was successful + */ +MRDOCS_DECL +bool +makeChar(FundamentalTypeKind& kind) noexcept; + +} // clang::mrdocs + +#endif diff --git a/include/mrdocs/Metadata/Type/LValueReferenceTypeInfo.hpp b/include/mrdocs/Metadata/Type/LValueReferenceTypeInfo.hpp new file mode 100644 index 000000000..d1eea06e2 --- /dev/null +++ b/include/mrdocs/Metadata/Type/LValueReferenceTypeInfo.hpp @@ -0,0 +1,32 @@ +// +// Licensed under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// Copyright (c) 2023 Krystian Stasiowski (sdkrystian@gmail.com) +// +// Official repository: https://github.com/cppalliance/mrdocs +// + +#ifndef MRDOCS_API_METADATA_TYPE_LVALUEREFERENCETYPEINFO_HPP +#define MRDOCS_API_METADATA_TYPE_LVALUEREFERENCETYPEINFO_HPP + +#include +#include +#include +#include + +namespace clang::mrdocs { + +struct LValueReferenceTypeInfo final + : TypeInfoCommonBase +{ + Optional> PointeeType = std::nullopt; + + std::strong_ordering + operator<=>(LValueReferenceTypeInfo const&) const; +}; + +} // clang::mrdocs + +#endif diff --git a/include/mrdocs/Metadata/Type/MemberPointerTypeInfo.hpp b/include/mrdocs/Metadata/Type/MemberPointerTypeInfo.hpp new file mode 100644 index 000000000..3fd3ab1fc --- /dev/null +++ b/include/mrdocs/Metadata/Type/MemberPointerTypeInfo.hpp @@ -0,0 +1,33 @@ +// +// Licensed under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// Copyright (c) 2023 Krystian Stasiowski (sdkrystian@gmail.com) +// +// Official repository: https://github.com/cppalliance/mrdocs +// + +#ifndef MRDOCS_API_METADATA_TYPE_MEMBERPOINTERTYPEINFO_HPP +#define MRDOCS_API_METADATA_TYPE_MEMBERPOINTERTYPEINFO_HPP + +#include +#include +#include +#include + +namespace clang::mrdocs { + +struct MemberPointerTypeInfo final + : TypeInfoCommonBase +{ + Optional> ParentType = std::nullopt; + Optional> PointeeType = std::nullopt; + + std::strong_ordering + operator<=>(MemberPointerTypeInfo const&) const; +}; + +} // clang::mrdocs + +#endif diff --git a/include/mrdocs/Metadata/Type/NamedTypeInfo.hpp b/include/mrdocs/Metadata/Type/NamedTypeInfo.hpp new file mode 100644 index 000000000..363890bf1 --- /dev/null +++ b/include/mrdocs/Metadata/Type/NamedTypeInfo.hpp @@ -0,0 +1,38 @@ +// +// Licensed under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// Copyright (c) 2023 Krystian Stasiowski (sdkrystian@gmail.com) +// +// Official repository: https://github.com/cppalliance/mrdocs +// + +#ifndef MRDOCS_API_METADATA_TYPE_NAMEDTYPEINFO_HPP +#define MRDOCS_API_METADATA_TYPE_NAMEDTYPEINFO_HPP + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace clang::mrdocs { + +struct NamedTypeInfo final + : TypeInfoCommonBase +{ + Polymorphic Name = Polymorphic(std::in_place_type); + + std::optional FundamentalType; + + std::strong_ordering + operator<=>(NamedTypeInfo const& other) const; +}; + +} // clang::mrdocs + +#endif diff --git a/include/mrdocs/Metadata/Type/PointerTypeInfo.hpp b/include/mrdocs/Metadata/Type/PointerTypeInfo.hpp new file mode 100644 index 000000000..ffb070f8e --- /dev/null +++ b/include/mrdocs/Metadata/Type/PointerTypeInfo.hpp @@ -0,0 +1,31 @@ +// +// Licensed under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// Copyright (c) 2023 Krystian Stasiowski (sdkrystian@gmail.com) +// +// Official repository: https://github.com/cppalliance/mrdocs +// + +#ifndef MRDOCS_API_METADATA_TYPE_POINTERTYPEINFO_HPP +#define MRDOCS_API_METADATA_TYPE_POINTERTYPEINFO_HPP + +#include +#include +#include +#include + +namespace clang::mrdocs { + +struct PointerTypeInfo final + : TypeInfoCommonBase +{ + Optional> PointeeType = std::nullopt; + std::strong_ordering + operator<=>(PointerTypeInfo const&) const; +}; + +} // clang::mrdocs + +#endif diff --git a/include/mrdocs/Metadata/Type/QualifierKind.hpp b/include/mrdocs/Metadata/Type/QualifierKind.hpp new file mode 100644 index 000000000..03a81766d --- /dev/null +++ b/include/mrdocs/Metadata/Type/QualifierKind.hpp @@ -0,0 +1,55 @@ +// +// Licensed under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// Copyright (c) 2023 Krystian Stasiowski (sdkrystian@gmail.com) +// +// Official repository: https://github.com/cppalliance/mrdocs +// + +#ifndef MRDOCS_API_METADATA_TYPE_QUALIFIERKIND_HPP +#define MRDOCS_API_METADATA_TYPE_QUALIFIERKIND_HPP + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace clang::mrdocs { + +/** Type qualifiers +*/ +enum QualifierKind +{ + /// No qualifiers + None, + /// The const qualifier + Const, + /// The volatile qualifier + Volatile +}; + +MRDOCS_DECL +dom::String +toString(QualifierKind kind) noexcept; + +inline +void +tag_invoke( + dom::ValueFromTag, + dom::Value& v, + QualifierKind kind) +{ + v = toString(kind); +} + +} // clang::mrdocs + +#endif diff --git a/include/mrdocs/Metadata/Type/RValueReferenceTypeInfo.hpp b/include/mrdocs/Metadata/Type/RValueReferenceTypeInfo.hpp new file mode 100644 index 000000000..03d41575a --- /dev/null +++ b/include/mrdocs/Metadata/Type/RValueReferenceTypeInfo.hpp @@ -0,0 +1,31 @@ +// +// Licensed under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// Copyright (c) 2023 Krystian Stasiowski (sdkrystian@gmail.com) +// +// Official repository: https://github.com/cppalliance/mrdocs +// + +#ifndef MRDOCS_API_METADATA_TYPE_RVALUEREFERENCETYPEINFO_HPP +#define MRDOCS_API_METADATA_TYPE_RVALUEREFERENCETYPEINFO_HPP + +#include +#include +#include +#include + +namespace clang::mrdocs { + +struct RValueReferenceTypeInfo final + : TypeInfoCommonBase +{ + Optional> PointeeType = std::nullopt; + std::strong_ordering + operator<=>(RValueReferenceTypeInfo const&) const; +}; + +} // clang::mrdocs + +#endif diff --git a/include/mrdocs/Metadata/Type/TypeBase.hpp b/include/mrdocs/Metadata/Type/TypeBase.hpp new file mode 100644 index 000000000..bf393c131 --- /dev/null +++ b/include/mrdocs/Metadata/Type/TypeBase.hpp @@ -0,0 +1,125 @@ +// +// Licensed under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// Copyright (c) 2023 Krystian Stasiowski (sdkrystian@gmail.com) +// +// Official repository: https://github.com/cppalliance/mrdocs +// + +#ifndef MRDOCS_API_METADATA_TYPE_TYPEBASE_HPP +#define MRDOCS_API_METADATA_TYPE_TYPEBASE_HPP + +#include +#include +#include +#include +#include +#include + +namespace clang::mrdocs { + +/** A possibly qualified type. + + This class represents a type that may have + qualifiers (e.g. const, volatile). + + This base class is used to store the kind + of type. Derived classes are used to store + the type information according to the kind. + */ +struct TypeInfo +{ + /** The kind of TypeInfo this is + */ + TypeKind Kind; + + /** Whether this is the pattern of a pack expansion. + */ + bool IsPackExpansion = false; + + /** The const qualifier + */ + bool IsConst = false; + + /** The volatile qualifier + */ + bool IsVolatile = false; + + /** The constraints associated with the type + + This represents the constraints associated with the type, + such as SFINAE constraints. + + For instance, if SFINAE detection is enabled, the + expression `std::enable_if_t, T>` + will have type `T` (NamedType) and constraints + `{std::is_integral_v}`. + */ + std::vector Constraints; + + constexpr virtual ~TypeInfo() = default; + + constexpr bool isNamed() const noexcept { return Kind == TypeKind::Named; } + constexpr bool isDecltype() const noexcept { return Kind == TypeKind::Decltype; } + constexpr bool isAuto() const noexcept { return Kind == TypeKind::Auto; } + constexpr bool isLValueReference() const noexcept { return Kind == TypeKind::LValueReference; } + constexpr bool isRValueReference() const noexcept { return Kind == TypeKind::RValueReference; } + constexpr bool isPointer() const noexcept { return Kind == TypeKind::Pointer; } + constexpr bool isMemberPointer() const noexcept { return Kind == TypeKind::MemberPointer; } + constexpr bool isArray() const noexcept { return Kind == TypeKind::Array; } + constexpr bool isFunction() const noexcept { return Kind == TypeKind::Function; } + + /** Return the symbol named by this type. + */ + SymbolID + namedSymbol() const noexcept; + + auto operator<=>(TypeInfo const&) const = default; + +protected: + constexpr + TypeInfo( + TypeKind kind) noexcept + : Kind(kind) + { + } +}; + +MRDOCS_DECL +void +tag_invoke( + dom::ValueFromTag, + dom::Value& v, + TypeInfo const& I, + DomCorpus const* domCorpus); + +template +struct TypeInfoCommonBase : TypeInfo +{ + static constexpr TypeKind kind_id = K; + + static constexpr bool isNamed() noexcept { return K == TypeKind::Named; } + static constexpr bool isDecltype() noexcept { return K == TypeKind::Decltype; } + static constexpr bool isAuto() noexcept { return K == TypeKind::Auto; } + static constexpr bool isLValueReference() noexcept { return K == TypeKind::LValueReference; } + static constexpr bool isRValueReference() noexcept { return K == TypeKind::RValueReference; } + static constexpr bool isPointer() noexcept { return K == TypeKind::Pointer; } + static constexpr bool isMemberPointer() noexcept { return K == TypeKind::MemberPointer; } + static constexpr bool isArray() noexcept { return K == TypeKind::Array; } + static constexpr bool isFunction() noexcept { return K == TypeKind::Function; } + + auto operator<=>(TypeInfoCommonBase const&) const = default; + +protected: + constexpr + TypeInfoCommonBase() noexcept + : TypeInfo(K) + { + } +}; + +} // clang::mrdocs + +#endif diff --git a/include/mrdocs/Metadata/Type/TypeKind.hpp b/include/mrdocs/Metadata/Type/TypeKind.hpp new file mode 100644 index 000000000..4ec6bd8fd --- /dev/null +++ b/include/mrdocs/Metadata/Type/TypeKind.hpp @@ -0,0 +1,57 @@ +// +// Licensed under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// Copyright (c) 2023 Krystian Stasiowski (sdkrystian@gmail.com) +// +// Official repository: https://github.com/cppalliance/mrdocs +// + +#ifndef MRDOCS_API_METADATA_TYPE_TYPEKIND_HPP +#define MRDOCS_API_METADATA_TYPE_TYPEKIND_HPP + +#include +#include + +namespace clang::mrdocs { + +enum class TypeKind +{ + /// A Named type + Named = 1, // for bitstream + /// A decltype type + Decltype, + /// An auto type + Auto, + /// An LValueReference type + LValueReference, + /// An RValueReference type + RValueReference, + /// A Pointer type + Pointer, + /// A MemberPointer type + MemberPointer, + /// An Array type + Array, + /// A Function type + Function, +}; + +MRDOCS_DECL +dom::String +toString(TypeKind kind) noexcept; + +inline +void +tag_invoke( + dom::ValueFromTag, + dom::Value& v, + TypeKind kind) +{ + v = toString(kind); +} + +} // clang::mrdocs + +#endif diff --git a/include/mrdocs/Platform.hpp b/include/mrdocs/Platform.hpp index 4c7f77e29..70e8d5c67 100644 --- a/include/mrdocs/Platform.hpp +++ b/include/mrdocs/Platform.hpp @@ -87,4 +87,4 @@ namespace mrdocs { } // mrdocs } // clang -#endif +#endif // MRDOCS_API_PLATFORM_HPP diff --git a/include/mrdocs/Support/Algorithm.hpp b/include/mrdocs/Support/Algorithm.hpp index 9bc8a1218..ccbf88cb9 100644 --- a/include/mrdocs/Support/Algorithm.hpp +++ b/include/mrdocs/Support/Algorithm.hpp @@ -12,8 +12,8 @@ #define MRDOCS_API_SUPPORT_ALGORITHM_HPP #include -#include #include +#include namespace clang::mrdocs { diff --git a/include/mrdocs/Support/Error.hpp b/include/mrdocs/Support/Error.hpp index 1cffb2768..aaae56ef5 100644 --- a/include/mrdocs/Support/Error.hpp +++ b/include/mrdocs/Support/Error.hpp @@ -12,12 +12,12 @@ #ifndef MRDOCS_API_SUPPORT_ERROR_HPP #define MRDOCS_API_SUPPORT_ERROR_HPP +#include +#include #include #include #include #include -#include -#include #include #include #include diff --git a/include/mrdocs/Support/ExecutorGroup.hpp b/include/mrdocs/Support/ExecutorGroup.hpp index 0e3032693..940fe65e7 100644 --- a/include/mrdocs/Support/ExecutorGroup.hpp +++ b/include/mrdocs/Support/ExecutorGroup.hpp @@ -12,9 +12,9 @@ #define MRDOCS_API_SUPPORT_EXECUTORGROUP_HPP #include -#include #include #include +#include #include #include #include diff --git a/include/mrdocs/Support/Expected.hpp b/include/mrdocs/Support/Expected.hpp index f40f74919..28e239977 100644 --- a/include/mrdocs/Support/Expected.hpp +++ b/include/mrdocs/Support/Expected.hpp @@ -12,13 +12,13 @@ #ifndef MRDOCS_API_SUPPORT_EXPECTED_HPP #define MRDOCS_API_SUPPORT_EXPECTED_HPP +#include +#include +#include #include #include #include #include -#include -#include -#include #include #include #include diff --git a/include/mrdocs/Support/Glob.hpp b/include/mrdocs/Support/Glob.hpp index 2b02b71a1..3de603a2e 100644 --- a/include/mrdocs/Support/Glob.hpp +++ b/include/mrdocs/Support/Glob.hpp @@ -8,8 +8,8 @@ // Official repository: https://github.com/cppalliance/mrdocs // -#ifndef MRDOCS_API_SUPPORT_GLOBPATTERN_HPP -#define MRDOCS_API_SUPPORT_GLOBPATTERN_HPP +#ifndef MRDOCS_API_SUPPORT_GLOB_HPP +#define MRDOCS_API_SUPPORT_GLOB_HPP #include #include @@ -331,4 +331,4 @@ class SymbolGlobPattern { } // clang::mrdocs -#endif // MRDOCS_API_SUPPORT_GLOBPATTERN_HPP \ No newline at end of file +#endif // MRDOCS_API_SUPPORT_GLOB_HPP \ No newline at end of file diff --git a/include/mrdocs/Support/Handlebars.hpp b/include/mrdocs/Support/Handlebars.hpp index 250bfce04..d2705bf1c 100644 --- a/include/mrdocs/Support/Handlebars.hpp +++ b/include/mrdocs/Support/Handlebars.hpp @@ -8,13 +8,13 @@ // Official repository: https://github.com/cppalliance/mrdocs // -#ifndef MRDOCS_TOOL_SUPPORT_PATH_HPP -#define MRDOCS_TOOL_SUPPORT_PATH_HPP +#ifndef MRDOCS_API_SUPPORT_HANDLEBARS_HPP +#define MRDOCS_API_SUPPORT_HANDLEBARS_HPP -#include -#include #include #include +#include +#include #include #include #include @@ -1332,4 +1332,4 @@ year_fn(); } // mrdocs } // clang -#endif +#endif // MRDOCS_API_SUPPORT_HANDLEBARS_HPP diff --git a/include/mrdocs/Support/JavaScript.hpp b/include/mrdocs/Support/JavaScript.hpp index b2bc036e4..d230cdc16 100644 --- a/include/mrdocs/Support/JavaScript.hpp +++ b/include/mrdocs/Support/JavaScript.hpp @@ -15,8 +15,8 @@ #include #include #include -#include #include +#include namespace clang { namespace mrdocs { diff --git a/include/mrdocs/Support/Lua.hpp b/include/mrdocs/Support/Lua.hpp index d8587335a..82c9ab4ee 100644 --- a/include/mrdocs/Support/Lua.hpp +++ b/include/mrdocs/Support/Lua.hpp @@ -8,15 +8,15 @@ // Official repository: https://github.com/cppalliance/mrdocs // -#ifndef MRDOCS_SUPPORT_LUA_HPP -#define MRDOCS_SUPPORT_LUA_HPP +#ifndef MRDOCS_API_SUPPORT_LUA_HPP +#define MRDOCS_API_SUPPORT_LUA_HPP -#include -#include -#include #include +#include #include #include +#include +#include #include #include @@ -507,4 +507,4 @@ struct std::formatter : std::formatter { } }; -#endif +#endif // MRDOCS_API_SUPPORT_LUA_HPP diff --git a/include/mrdocs/Support/Report.hpp b/include/mrdocs/Support/Report.hpp index 022686480..c8da3716f 100644 --- a/include/mrdocs/Support/Report.hpp +++ b/include/mrdocs/Support/Report.hpp @@ -12,14 +12,14 @@ #ifndef MRDOCS_API_SUPPORT_REPORT_HPP #define MRDOCS_API_SUPPORT_REPORT_HPP +#include +#include +#include #include #include #include #include #include -#include -#include -#include #include #include #include diff --git a/include/mrdocs/Support/ThreadPool.hpp b/include/mrdocs/Support/ThreadPool.hpp index f679be9e7..041607c46 100644 --- a/include/mrdocs/Support/ThreadPool.hpp +++ b/include/mrdocs/Support/ThreadPool.hpp @@ -9,12 +9,12 @@ // Official repository: https://github.com/cppalliance/mrdocs // -#ifndef MRDOCS_API_SUPPORT_THREAD_HPP -#define MRDOCS_API_SUPPORT_THREAD_HPP +#ifndef MRDOCS_API_SUPPORT_THREADPOOL_HPP +#define MRDOCS_API_SUPPORT_THREADPOOL_HPP #include -#include #include +#include #include #include #include @@ -188,4 +188,4 @@ forEach( } // mrdocs } // clang -#endif +#endif // MRDOCS_API_SUPPORT_THREADPOOL_HPP diff --git a/include/mrdocs/Support/TypeTraits.hpp b/include/mrdocs/Support/TypeTraits.hpp index 937508189..d7a61170d 100644 --- a/include/mrdocs/Support/TypeTraits.hpp +++ b/include/mrdocs/Support/TypeTraits.hpp @@ -9,8 +9,8 @@ // Official repository: https://github.com/cppalliance/mrdocs // -#ifndef MRDOCS_TOOL_SUPPORT_TYPE_TRAITS_HPP -#define MRDOCS_TOOL_SUPPORT_TYPE_TRAITS_HPP +#ifndef MRDOCS_API_SUPPORT_TYPETRAITS_HPP +#define MRDOCS_API_SUPPORT_TYPETRAITS_HPP #include @@ -124,4 +124,4 @@ using add_cvref_from_t = } // mrdocs } // clang -#endif +#endif // MRDOCS_API_SUPPORT_TYPETRAITS_HPP diff --git a/include/mrdocs/Support/Visitor.hpp b/include/mrdocs/Support/Visitor.hpp index 959300298..8a3e36988 100644 --- a/include/mrdocs/Support/Visitor.hpp +++ b/include/mrdocs/Support/Visitor.hpp @@ -8,12 +8,12 @@ // Official repository: https://github.com/cppalliance/mrdocs // -#ifndef MRDOCS_TOOL_SUPPORT_VISITOR_HPP -#define MRDOCS_TOOL_SUPPORT_VISITOR_HPP +#ifndef MRDOCS_API_SUPPORT_VISITOR_HPP +#define MRDOCS_API_SUPPORT_VISITOR_HPP #include -#include #include +#include namespace clang::mrdocs { @@ -126,4 +126,4 @@ makeVisitor( } // clang::mrdocs -#endif +#endif // MRDOCS_API_SUPPORT_VISITOR_HPP diff --git a/include/mrdocs/Support/source_location.hpp b/include/mrdocs/Support/source_location.hpp index 7b98535a8..cca423a59 100644 --- a/include/mrdocs/Support/source_location.hpp +++ b/include/mrdocs/Support/source_location.hpp @@ -15,7 +15,7 @@ #if __cpp_lib_source_location >= 201907L && \ __has_include() - #include +# include namespace clang { namespace mrdocs { @@ -25,7 +25,7 @@ } // mrdocs } // clang #else - #include +# include namespace clang { namespace mrdocs { diff --git a/src/lib/AST/ASTAction.cpp b/src/lib/AST/ASTAction.cpp index c8468014f..44d6b902c 100644 --- a/src/lib/AST/ASTAction.cpp +++ b/src/lib/AST/ASTAction.cpp @@ -11,12 +11,12 @@ // Official repository: https://github.com/cppalliance/mrdocs // -#include "lib/AST/ASTAction.hpp" -#include "lib/AST/MrDocsFileSystem.hpp" -#include "lib/AST/ASTVisitorConsumer.hpp" +#include +#include +#include #include -#include #include +#include namespace clang { namespace mrdocs { diff --git a/src/lib/AST/ASTAction.hpp b/src/lib/AST/ASTAction.hpp index b06154924..bc61e870b 100644 --- a/src/lib/AST/ASTAction.hpp +++ b/src/lib/AST/ASTAction.hpp @@ -14,12 +14,11 @@ #ifndef MRDOCS_LIB_AST_ASTACTION_HPP #define MRDOCS_LIB_AST_ASTACTION_HPP -#include "lib/ConfigImpl.hpp" -#include "lib/Support/ExecutionContext.hpp" -#include #include -#include "MissingSymbolSink.hpp" - +#include +#include +#include +#include namespace clang { namespace mrdocs { @@ -98,4 +97,4 @@ class ASTAction } // mrdocs } // clang -#endif +#endif // MRDOCS_LIB_AST_ASTACTION_HPP diff --git a/src/lib/AST/ASTVisitor.cpp b/src/lib/AST/ASTVisitor.cpp index b014400bf..9b5be1dfd 100644 --- a/src/lib/AST/ASTVisitor.cpp +++ b/src/lib/AST/ASTVisitor.cpp @@ -11,18 +11,18 @@ // Official repository: https://github.com/cppalliance/mrdocs // -#include "lib/AST/ASTVisitor.hpp" -#include "lib/AST/NameInfoBuilder.hpp" -#include "lib/AST/ClangHelpers.hpp" -#include "lib/AST/ParseJavadoc.hpp" -#include "lib/AST/TypeInfoBuilder.hpp" -#include "lib/Support/Path.hpp" -#include "lib/Support/Debug.hpp" -#include "lib/Support/Radix.hpp" -#include "lib/Diagnostics.hpp" +#include +#include +#include +#include +#include +#include +#include +#include +#include #include -#include #include +#include #include #include #include @@ -35,8 +35,8 @@ #include #include #include -#include #include +#include #include #include #include @@ -179,7 +179,7 @@ traverse(UsingDirectiveDecl const* D) MRDOCS_CHECK_OR(NDI, nullptr); auto res = toNameInfo(ND); - MRDOCS_ASSERT(res); + MRDOCS_ASSERT(!res.valueless_after_move()); MRDOCS_ASSERT(res->isIdentifier()); if (NameInfo NI = *res; !contains(PNI.UsingDirectives, NI)) @@ -707,7 +707,8 @@ populate( // CXXBaseSpecifier::getEllipsisLoc indicates whether the // base was a pack expansion; a PackExpansionType is not built // for base-specifiers - if (BaseType && B.getEllipsisLoc().isValid()) + if (!BaseType.valueless_after_move() && + B.getEllipsisLoc().isValid()) { BaseType->IsPackExpansion = true; } @@ -912,9 +913,9 @@ populate( { // Return type SFINAE constraints if (I.ReturnType && - !I.ReturnType->Constraints.empty()) + !(*I.ReturnType)->Constraints.empty()) { - for (ExprInfo const& constraint: I.ReturnType->Constraints) + for (ExprInfo const& constraint: (*I.ReturnType)->Constraints) { if (!I.Requires.Written.empty()) { @@ -928,9 +929,9 @@ populate( for (auto it = I.Params.begin(); it != I.Params.end(); ) { if (it->Type && - !it->Type->Constraints.empty()) + !(*it->Type)->Constraints.empty()) { - for (ExprInfo const& constraint: it->Type->Constraints) + for (ExprInfo const& constraint: (*it->Type)->Constraints) { if (!I.Requires.Written.empty()) { @@ -1181,8 +1182,8 @@ populate( if (TypeSourceInfo const* TSI = D->getFriendType()) { I.Type = toTypeInfo(TSI->getType()); - MRDOCS_CHECK_OR(I.Type->isNamed()); - auto const& NTI = dynamic_cast(*I.Type); + MRDOCS_CHECK_OR((*I.Type)->isNamed()); + auto const& NTI = dynamic_cast(**I.Type); MRDOCS_CHECK_OR(NTI.Name); I.id = NTI.Name->id; } @@ -1331,7 +1332,7 @@ populate( for (auto it = Template.Args.begin(); it != Template.Args.end();) { auto& arg = *it; - if (!arg) + if (arg.valueless_after_move()) { ++it; continue; @@ -1339,9 +1340,9 @@ populate( if (auto* T = dynamic_cast(arg.operator->()); T && T->Type && - !T->Type->Constraints.empty()) + !(*T->Type)->Constraints.empty()) { - for (ExprInfo const& constraint: T->Type->Constraints) + for (ExprInfo const& constraint: (*T->Type)->Constraints) { if (!Template.Requires.Written.empty()) { @@ -1492,7 +1493,7 @@ populate( if constexpr(kind == Decl::TemplateTypeParm) { - if (!I) + if (I.valueless_after_move()) { I = Polymorphic(std::in_place_type); } @@ -1521,7 +1522,7 @@ populate( } else if constexpr(kind == Decl::NonTypeTemplateParm) { - if (!I) + if (I.valueless_after_move()) { I = Polymorphic(std::in_place_type); } @@ -1536,7 +1537,7 @@ populate( } else if constexpr(kind == Decl::TemplateTemplateParm) { - if (!I) + if (I.valueless_after_move()) { I = Polymorphic(std::in_place_type); } @@ -1549,9 +1550,11 @@ populate( for (std::size_t i = 0; i < TPL->size(); ++i) { NamedDecl const* TP = TPL->getParam(i); - auto &Param = i < Result->Params.size() - ? Result->Params[i] - : Result->Params.emplace_back(std::nullopt); + auto& Param + = i < Result->Params.size() ? + Result->Params[i] : + Result->Params.emplace_back( + nullable_traits>::null()); populate(Param, TP); } if (TTPD->hasDefaultArgument() && !Result->Default) @@ -1602,9 +1605,10 @@ populate( while (explicitIt != ExplicitTemplateParameters.end()) { NamedDecl const* P = TPL->getParam(i); - auto &Param = i < TI.Params.size() - ? TI.Params[i] - : TI.Params.emplace_back(std::nullopt); + auto& Param = i < TI.Params.size() ? + TI.Params[i] : + TI.Params.emplace_back( + nullable_traits>::null()); populate(Param, P); ++explicitIt; ++i; @@ -1624,9 +1628,9 @@ populate( if (auto const* T = dynamic_cast(param.operator->()); T && T->Type && - !T->Type->Constraints.empty()) + !(*T->Type)->Constraints.empty()) { - for (ExprInfo const& constraint: T->Type->Constraints) + for (ExprInfo const& constraint: (*T->Type)->Constraints) { if (!TI.Requires.Written.empty()) { @@ -1639,14 +1643,14 @@ populate( } if (param->Default && - param->Default->isType()) + (*param->Default)->isType()) { - if (auto const* T = dynamic_cast(param->Default.operator->()); + if (auto const* T = dynamic_cast((*param->Default).operator->()); T && T->Type && - !T->Type->Constraints.empty()) + !(*T->Type)->Constraints.empty()) { - for (ExprInfo const& constraint: T->Type->Constraints) + for (ExprInfo const& constraint: (*T->Type)->Constraints) { if (!TI.Requires.Written.empty()) { @@ -2039,13 +2043,14 @@ toTypeInfo(QualType const qt, TraversalMode const mode) return Builder.result(); } -Polymorphic ASTVisitor::toNameInfo(NestedNameSpecifier NNS) +Polymorphic +ASTVisitor::toNameInfo(NestedNameSpecifier NNS) { MRDOCS_SYMBOL_TRACE(NNS, context_); ScopeExitRestore scope(mode_, Dependency); switch(NNS.getKind()) { case NestedNameSpecifier::Kind::Null: - return std::nullopt; + return nullable_traits>::null(); case NestedNameSpecifier::Kind::Type: { const Type *T = NNS.getAsType(); NameInfoBuilder Builder(*this); @@ -2053,7 +2058,7 @@ Polymorphic ASTVisitor::toNameInfo(NestedNameSpecifier NNS) return Builder.result(); } case NestedNameSpecifier::Kind::Namespace: { - auto I = Polymorphic(); + auto I = Polymorphic(std::in_place_type); auto [ND, Prefix] = NNS.getAsNamespaceAndPrefix(); I->Name = ND->getIdentifier()->getName(); I->Prefix = toNameInfo(Prefix); @@ -2067,7 +2072,7 @@ Polymorphic ASTVisitor::toNameInfo(NestedNameSpecifier NNS) case NestedNameSpecifier::Kind::Global: case NestedNameSpecifier::Kind::MicrosoftSuper: // FIXME: Unimplemented. - return std::nullopt; + return nullable_traits>::null(); } MRDOCS_UNREACHABLE(); } @@ -2081,9 +2086,9 @@ toNameInfo(DeclarationName const Name, { if (Name.isEmpty()) { - return std::nullopt; + return nullable_traits>::null(); } - Polymorphic I = std::nullopt; + Polymorphic I = nullable_traits>::null(); if(TArgs) { I = Polymorphic(std::in_place_type); @@ -2091,7 +2096,7 @@ toNameInfo(DeclarationName const Name, } else { - I = Polymorphic(); + I = Polymorphic(std::in_place_type); } I->Name = extractName(Name); I->Prefix = toNameInfo(NNS); @@ -2109,13 +2114,13 @@ toNameInfo( auto const* ND = dyn_cast_if_present(D); if (!ND) { - return std::nullopt; + return nullable_traits>::null(); } auto I = toNameInfo( ND->getDeclName(), std::move(TArgs), NNS); - if (!I) + if (I.valueless_after_move()) { - return std::nullopt; + return nullable_traits>::null(); } ScopeExitRestore scope(mode_, Dependency); auto* ID = getInstantiatedFrom(D); @@ -2234,7 +2239,7 @@ toTArg(TemplateArgument const& A) default: MRDOCS_UNREACHABLE(); } - return std::nullopt; + return nullable_traits>::null(); } diff --git a/src/lib/AST/ASTVisitor.hpp b/src/lib/AST/ASTVisitor.hpp index a06e557fb..0de087200 100644 --- a/src/lib/AST/ASTVisitor.hpp +++ b/src/lib/AST/ASTVisitor.hpp @@ -14,15 +14,15 @@ #ifndef MRDOCS_LIB_AST_ASTVISITOR_HPP #define MRDOCS_LIB_AST_ASTVISITOR_HPP -#include "lib/ConfigImpl.hpp" -#include "lib/Support/ExecutionContext.hpp" -#include "lib/AST/ClangHelpers.hpp" -#include -#include +#include +#include +#include +#include +#include #include #include -#include #include +#include #include namespace clang::mrdocs { @@ -1215,4 +1215,4 @@ class ASTVisitor } // clang::mrdocs -#endif +#endif // MRDOCS_LIB_AST_ASTVISITOR_HPP diff --git a/src/lib/AST/ASTVisitorConsumer.cpp b/src/lib/AST/ASTVisitorConsumer.cpp index 91b049e7e..c4e328113 100644 --- a/src/lib/AST/ASTVisitorConsumer.cpp +++ b/src/lib/AST/ASTVisitorConsumer.cpp @@ -11,9 +11,9 @@ // Official repository: https://github.com/cppalliance/mrdocs // -#include "lib/AST/ASTVisitorConsumer.hpp" -#include "lib/AST/ASTVisitor.hpp" -#include "lib/Support/Path.hpp" +#include +#include +#include namespace clang::mrdocs { diff --git a/src/lib/AST/ASTVisitorConsumer.hpp b/src/lib/AST/ASTVisitorConsumer.hpp index 559707ac5..191cd14de 100644 --- a/src/lib/AST/ASTVisitorConsumer.hpp +++ b/src/lib/AST/ASTVisitorConsumer.hpp @@ -14,11 +14,11 @@ #ifndef MRDOCS_LIB_AST_ASTVISITORCONSUMER_HPP #define MRDOCS_LIB_AST_ASTVISITORCONSUMER_HPP -#include "lib/ConfigImpl.hpp" -#include "lib/Support/ExecutionContext.hpp" #include -#include +#include +#include #include +#include namespace clang { namespace mrdocs { @@ -263,4 +263,4 @@ class ASTVisitorConsumer } // mrdocs } // clang -#endif +#endif // MRDOCS_LIB_AST_ASTVISITORCONSUMER_HPP diff --git a/src/lib/AST/ClangHelpers.cpp b/src/lib/AST/ClangHelpers.cpp index 8de956239..fe29dd6cd 100644 --- a/src/lib/AST/ClangHelpers.cpp +++ b/src/lib/AST/ClangHelpers.cpp @@ -10,11 +10,11 @@ // Official repository: https://github.com/cppalliance/mrdocs // -#include "lib/AST/ClangHelpers.hpp" +#include #include #include -#include #include +#include #include namespace clang::mrdocs { diff --git a/src/lib/AST/ClangHelpers.hpp b/src/lib/AST/ClangHelpers.hpp index 2cd2cbf0e..e0770c5b9 100644 --- a/src/lib/AST/ClangHelpers.hpp +++ b/src/lib/AST/ClangHelpers.hpp @@ -14,17 +14,18 @@ #ifndef MRDOCS_LIB_AST_CLANGHELPERS_HPP #define MRDOCS_LIB_AST_CLANGHELPERS_HPP -#include -#include -#include -#include -#include #include +#include #include +#include +#include +#include #include #include #include #include +#include +#include #include namespace clang::mrdocs { @@ -594,7 +595,7 @@ visit( else \ MRDOCS_UNREACHABLE(); - #include +#include default: MRDOCS_UNREACHABLE(); @@ -654,7 +655,7 @@ visit( else \ MRDOCS_UNREACHABLE(); - #include +#include default: MRDOCS_UNREACHABLE(); @@ -712,7 +713,7 @@ visit( else \ MRDOCS_UNREACHABLE(); - #include +#include default: MRDOCS_UNREACHABLE(); diff --git a/src/lib/AST/FrontendActionFactory.cpp b/src/lib/AST/FrontendActionFactory.cpp index 1956321fe..3d7a3f16c 100644 --- a/src/lib/AST/FrontendActionFactory.cpp +++ b/src/lib/AST/FrontendActionFactory.cpp @@ -12,7 +12,7 @@ // #include "FrontendActionFactory.hpp" -#include "lib/AST/ASTAction.hpp" +#include namespace clang { namespace mrdocs { diff --git a/src/lib/AST/FrontendActionFactory.hpp b/src/lib/AST/FrontendActionFactory.hpp index 1111b5db9..3c4ec99a1 100644 --- a/src/lib/AST/FrontendActionFactory.hpp +++ b/src/lib/AST/FrontendActionFactory.hpp @@ -14,9 +14,9 @@ #ifndef MRDOCS_LIB_AST_FRONTENDACTIONFACTORY_HPP #define MRDOCS_LIB_AST_FRONTENDACTIONFACTORY_HPP -#include "lib/ConfigImpl.hpp" -#include "lib/Support/ExecutionContext.hpp" -#include "lib/AST/MissingSymbolSink.hpp" +#include +#include +#include #include namespace clang { @@ -46,4 +46,4 @@ class ASTActionFactory : } // mrdocs } // clang -#endif +#endif // MRDOCS_LIB_AST_FRONTENDACTIONFACTORY_HPP diff --git a/src/lib/AST/MissingSymbolSink.hpp b/src/lib/AST/MissingSymbolSink.hpp index 1fb8319bc..fa634a3e2 100644 --- a/src/lib/AST/MissingSymbolSink.hpp +++ b/src/lib/AST/MissingSymbolSink.hpp @@ -8,18 +8,18 @@ // Official repository: https://github.com/cppalliance/mrdocs // -#ifndef MRDOCS_LIB_AST_MISSING_SYMBOL_SINK_HPP -#define MRDOCS_LIB_AST_MISSING_SYMBOL_SINK_HPP - -#include "clang/Basic/Diagnostic.h" -#include "clang/Basic/DiagnosticSema.h" -#include "clang/Basic/SourceManager.h" -#include "lib/ConfigImpl.hpp" -#include "lib/Support/ExecutionContext.hpp" -#include "lib/Support/Report.hpp" -#include "llvm/ADT/StringExtras.h" -#include "llvm/ADT/StringSet.h" +#ifndef MRDOCS_LIB_AST_MISSINGSYMBOLSINK_HPP +#define MRDOCS_LIB_AST_MISSINGSYMBOLSINK_HPP + #include +#include +#include +#include +#include +#include +#include +#include +#include #include #include #include @@ -438,4 +438,4 @@ class CollectingDiagConsumer : public clang::DiagnosticConsumer { } // namespace mrdocs } // namespace clang -#endif +#endif // MRDOCS_LIB_AST_MISSINGSYMBOLSINK_HPP diff --git a/src/lib/AST/MrDocsFileSystem.hpp b/src/lib/AST/MrDocsFileSystem.hpp index 268114507..558c6957d 100644 --- a/src/lib/AST/MrDocsFileSystem.hpp +++ b/src/lib/AST/MrDocsFileSystem.hpp @@ -8,15 +8,15 @@ // Official repository: https://github.com/cppalliance/mrdocs // -#ifndef MRDOCS_LIB_AST_MRDOCS_FILESYSTEM_HPP -#define MRDOCS_LIB_AST_MRDOCS_FILESYSTEM_HPP - -#include "lib/ConfigImpl.hpp" -#include "llvm/ADT/SmallVector.h" -#include "llvm/ADT/StringRef.h" -#include "llvm/Support/MemoryBuffer.h" -#include "llvm/Support/VirtualFileSystem.h" -#include "clang/Lex/HeaderSearch.h" +#ifndef MRDOCS_LIB_AST_MRDOCSFILESYSTEM_HPP +#define MRDOCS_LIB_AST_MRDOCSFILESYSTEM_HPP + +#include +#include +#include +#include +#include +#include #include #include #include @@ -339,4 +339,4 @@ createMrDocsFileSystem(ConfigImpl const &Cfg) } // namespace clang::mrdocs -#endif +#endif // MRDOCS_LIB_AST_MRDOCSFILESYSTEM_HPP diff --git a/src/lib/AST/NameInfoBuilder.cpp b/src/lib/AST/NameInfoBuilder.cpp index 70bb3f60a..c0817ad63 100644 --- a/src/lib/AST/NameInfoBuilder.cpp +++ b/src/lib/AST/NameInfoBuilder.cpp @@ -11,7 +11,7 @@ // Official repository: https://github.com/cppalliance/mrdocs // -#include "lib/AST/NameInfoBuilder.hpp" +#include namespace clang::mrdocs { @@ -33,8 +33,8 @@ buildTerminal( unsigned, bool) { - Result = Polymorphic(); - Result->Name = getASTVisitor().toString(T); + Result = Polymorphic(std::in_place_type); + (*Result)->Name = getASTVisitor().toString(T); } void @@ -52,22 +52,23 @@ buildTerminal( Polymorphic(std::in_place_type); if (II) { - Result->Name = II->getName(); + (*Result)->Name = II->getName(); } getASTVisitor().populate( - static_cast(*Result).TemplateArgs, *TArgs); + static_cast(**Result).TemplateArgs, + *TArgs); } else { - Result = Polymorphic(); + Result = Polymorphic(std::in_place_type); if (II) { - Result->Name = II->getName(); + (*Result)->Name = II->getName(); } } if (NNS) { - Result->Prefix = getASTVisitor().toNameInfo(NNS); + (*Result)->Prefix = getASTVisitor().toNameInfo(NNS); } } @@ -103,16 +104,17 @@ buildTerminal( if (!TArgs) { - Result = Polymorphic(); - populateNameInfo(*Result, D); + Result = Polymorphic(std::in_place_type); + populateNameInfo(**Result, D); } else { - Result = - Polymorphic(std::in_place_type); - populateNameInfo(*Result, D); + Result = Polymorphic( + std::in_place_type); + populateNameInfo(**Result, D); getASTVisitor().populate( - static_cast(*Result).TemplateArgs, *TArgs); + static_cast(**Result).TemplateArgs, + *TArgs); } } diff --git a/src/lib/AST/NameInfoBuilder.hpp b/src/lib/AST/NameInfoBuilder.hpp index 515a093bd..4de3b1b84 100644 --- a/src/lib/AST/NameInfoBuilder.hpp +++ b/src/lib/AST/NameInfoBuilder.hpp @@ -14,8 +14,8 @@ #ifndef MRDOCS_LIB_AST_NAMEINFOBUILDER_HPP #define MRDOCS_LIB_AST_NAMEINFOBUILDER_HPP -#include #include +#include #include namespace clang::mrdocs { @@ -23,7 +23,7 @@ namespace clang::mrdocs { class NameInfoBuilder : public TerminalTypeVisitor { - Polymorphic Result; + Optional> Result; public: using TerminalTypeVisitor::TerminalTypeVisitor; @@ -31,7 +31,14 @@ class NameInfoBuilder Polymorphic result() { - return std::move(Result); + MRDOCS_ASSERT(Result.has_value()); + return std::move(*Result); + } + + constexpr bool + hasResult() const noexcept + { + return Result.has_value(); } void diff --git a/src/lib/AST/ParseJavadoc.cpp b/src/lib/AST/ParseJavadoc.cpp index 70bde23cb..4e435c9eb 100644 --- a/src/lib/AST/ParseJavadoc.cpp +++ b/src/lib/AST/ParseJavadoc.cpp @@ -13,20 +13,21 @@ // #include "ParseJavadoc.hpp" -#include "lib/AST/ParseRef.hpp" -#include -#include -#include -#include -#include -#include -#include +#include #include +#include #include #include #include #include #include +#include +#include +#include +#include +#include +#include +#include #ifdef _MSC_VER #pragma warning(push) @@ -38,8 +39,8 @@ #pragma warning(pop) #endif #include -#include #include +#include #include #ifdef NDEBUG diff --git a/src/lib/AST/ParseJavadoc.hpp b/src/lib/AST/ParseJavadoc.hpp index 2af42be28..429bcf81d 100644 --- a/src/lib/AST/ParseJavadoc.hpp +++ b/src/lib/AST/ParseJavadoc.hpp @@ -12,8 +12,8 @@ #ifndef MRDOCS_LIB_AST_PARSEJAVADOC_HPP #define MRDOCS_LIB_AST_PARSEJAVADOC_HPP -#include "lib/Diagnostics.hpp" #include +#include #include #include @@ -60,4 +60,4 @@ parseJavadoc( } // mrdocs } // clang -#endif +#endif // MRDOCS_LIB_AST_PARSEJAVADOC_HPP diff --git a/src/lib/AST/ParseRef.cpp b/src/lib/AST/ParseRef.cpp index 1a974ae20..a5ffdc3fa 100644 --- a/src/lib/AST/ParseRef.cpp +++ b/src/lib/AST/ParseRef.cpp @@ -8,14 +8,14 @@ // Official repository: https://github.com/cppalliance/mrdocs // -#include "lib/AST/ParseRef.hpp" +#include #include #include +#include #include #include #include #include - #include namespace clang::mrdocs { @@ -42,13 +42,38 @@ isIdentifierContinuation(char const c) return isIdentifierStart(c) || isDigit(c); } +/* Holds information about a parsed function suffix during reference parsing. + + Used internally by RefParser to accumulate details about function parameters, + variadic status, and exception specifications while parsing C++ symbol + references. + + Example: In 'void foo(int, double, ...)', Params holds 'int' and 'double', + IsVariadic is true, HasVoid is false. +*/ struct ParsedFunctionSuffix { + /* List of parsed function parameter types. + Example: For 'void foo(int, double)', Params contains 'int' and 'double'. + */ llvm::SmallVector, 8> Params; + + /* True if the parameter list contains only 'void'. + Example: For 'void foo(void)', HasVoid is true. + */ bool HasVoid{false}; + + /* True if the function is variadic (contains ...). + Example: For 'void foo(int, ...)', IsVariadic is true. + */ bool IsVariadic{false}; + + /* Exception specification for the function. + Example: For 'void foo() noexcept', ExceptionSpec holds 'noexcept'. + */ NoexceptInfo ExceptionSpec; + /* Virtual destructor for safe polymorphic deletion. */ virtual ~ParsedFunctionSuffix() = default; }; @@ -448,9 +473,9 @@ class RefParser return false; } skipWhitespace(); - Polymorphic conversionType = std::nullopt; + Polymorphic conversionType = nullable_traits>::null(); if (!parseDeclarationSpecifier(conversionType) || - !conversionType) + conversionType.valueless_after_move()) { ptr_ = start; return false; @@ -585,14 +610,17 @@ class RefParser return false; } skipWhitespace(); - TemplateArguments.emplace_back(std::nullopt); + // Add an empty slot for the first template argument + TemplateArguments.emplace_back(nullable_traits>::null()); while (parseTemplateArgument(TemplateArguments.back())) { skipWhitespace(); if (parseLiteral(',')) { skipWhitespace(); - TemplateArguments.emplace_back(std::nullopt); + // Add another empty slot for the next argument after each comma + // This allows parseTemplateArgument to fill the new slot + TemplateArguments.emplace_back(nullable_traits>::null()); } else { @@ -622,16 +650,16 @@ class RefParser } skipWhitespace(); char const* start = ptr_; - Polymorphic type = std::nullopt; + Polymorphic type = nullable_traits>::null(); if (parseTypeId(type)) { dest = Polymorphic(std::in_place_type); - static_cast(*dest).Type = std::move(type); + dynamic_cast(*dest).Type = std::move(type); return true; } // If the argument is not a type-id, it is an expression - // The expression is internally balanced in regards to '<' + // The expression is internally balanced regarding '<' // and '>' and ends with a comma char const* exprStart = ptr_; while (parseBalanced("<", ">", {",", ">"})) @@ -790,7 +818,7 @@ class RefParser // https://en.cppreference.com/w/cpp/language/function#Parameter_list // decl-specifier-seq - auto &curParam = dest.Params.emplace_back(std::nullopt); + auto &curParam = dest.Params.emplace_back(nullable_traits>::null()); if (!parseTypeId(curParam)) { ptr_ = start; @@ -885,7 +913,7 @@ class RefParser // If we have one of the "long", "short", "signed", "unsigned" // specifiers, then we don't have an error because // we can later infer the type from these. - if (!dest && + if (dest.valueless_after_move() && !contains_any(specifiers, typeModifiers)) { setError(specStart, "expected declaration specifier"); @@ -908,7 +936,7 @@ class RefParser break; } } - if (!dest && specifiers.empty()) + if (dest.valueless_after_move() && specifiers.empty()) { // We need at least one type declarator or specifier ptr_ = start; @@ -979,11 +1007,10 @@ class RefParser std::string_view signStr = explicitlySigned ? "signed" : "unsigned"; // Infer basic fundamental type from "signed" or "unsigned", // which is "int" - if (!dest) + if (dest.valueless_after_move()) { dest = Polymorphic(std::in_place_type); - auto &NTI = static_cast(*dest); - NTI.Name = Polymorphic(); + auto &NTI = dynamic_cast(*dest); NTI.Name->Name = "int"; NTI.FundamentalType = FundamentalTypeKind::Int; } @@ -1023,11 +1050,11 @@ class RefParser if (contains(specifiers, "short")) { // Infer basic fundamental type for "short", which is "int" - if (!dest) + if (dest.valueless_after_move()) { dest = Polymorphic(std::in_place_type); - auto &NTI = static_cast(*dest); - NTI.Name = Polymorphic(); + auto &NTI = dynamic_cast(*dest); + NTI.Name = Polymorphic(std::in_place_type); NTI.Name->Name = "int"; NTI.FundamentalType = FundamentalTypeKind::Int; } @@ -1062,11 +1089,11 @@ class RefParser if (contains(specifiers, "long")) { // Infer basic fundamental type for "long", which is "int" - if (!dest) + if (dest.valueless_after_move()) { dest = Polymorphic(std::in_place_type); - auto &NTI = static_cast(*dest); - NTI.Name = Polymorphic(); + auto &NTI = dynamic_cast(*dest); + NTI.Name = Polymorphic(std::in_place_type); NTI.Name->Name = "int"; NTI.FundamentalType = FundamentalTypeKind::Int; } @@ -1106,7 +1133,7 @@ class RefParser } // Final check: if dest is still empty, we have an error - if (!dest) + if (dest.valueless_after_move()) { ptr_ = start; setError("expected parameter type"); @@ -1126,7 +1153,7 @@ class RefParser char const* start = ptr_; // Some rules are only valid if dest was initially empty - auto checkDestWasEmpty = [destWasEmpty=!dest, start, this]() { + auto checkDestWasEmpty = [destWasEmpty=dest.valueless_after_move(), start, this]() { if (!destWasEmpty) { setError(start, "multiple type declaration specifiers"); @@ -1178,8 +1205,8 @@ class RefParser MRDOCS_CHECK_OR(checkDestWasEmpty(), false); dest = Polymorphic(std::in_place_type); - auto &NTI = static_cast(*dest); - NTI.Name = Polymorphic(); + auto &NTI = dynamic_cast(*dest); + MRDOCS_ASSERT(!NTI.Name.valueless_after_move()); NTI.Name->Name = std::string_view(start, ptr_ - start); if (FundamentalTypeKind k; fromString(NTI.Name->Name, k)) @@ -1353,7 +1380,7 @@ class RefParser bool const allowTemplateDisambiguation, bool const allowTemplateArguments) { - if (dest) + if (!dest.valueless_after_move()) { setError("type specifier is already set"); return false; @@ -1372,12 +1399,13 @@ class RefParser // Populate dest auto const idStr = std::string_view(idStart, ptr_ - idStart); - Polymorphic ParentName = - dest ? dynamic_cast(&*dest)->Name - : std::nullopt; + Optional> + ParentName = !dest.valueless_after_move() ? + Optional>(dynamic_cast(&*dest)->Name) : + Optional>(std::nullopt); dest = Polymorphic(std::in_place_type); - auto &NTI = static_cast(*dest); - NTI.Name = Polymorphic(); + auto &NTI = dynamic_cast(*dest); + NTI.Name = Polymorphic(std::in_place_type); NTI.Name->Name = idStr; NTI.Name->Prefix = std::move(ParentName); @@ -1391,7 +1419,7 @@ class RefParser } skipWhitespace(); } - if (!dest) + if (dest.valueless_after_move()) { ptr_ = start; return false; @@ -1481,7 +1509,7 @@ class RefParser ptr_ = start; return false; } - if (!dest) + if (dest.valueless_after_move()) { setError("no type defined by specifiers and declarator"); ptr_ = start; @@ -1522,7 +1550,7 @@ class RefParser // For instance, in "int (*)[3][6]", we have a pointer to an // array of 3 arrays of 6 ints. std::size_t curSuffixLevel = suffixLevel; - while (curSuffixLevel > 0 && inner && inner->get()) + while (curSuffixLevel > 0 && inner && !inner->get().valueless_after_move()) { auto& ref = inner->get(); inner = innerType(*ref); @@ -1551,7 +1579,7 @@ class RefParser // https://en.cppreference.com/w/cpp/language/declarations#Declarators char const* start = ptr_; - if (!dest) + if (dest.valueless_after_move()) { setError("expected parameter type for '...'"); ptr_ = start; @@ -1722,7 +1750,7 @@ class RefParser // Assemble the parent type for the NNS NamedTypeInfo ParentType; auto NNSString = std::string_view(start, NNSEnd - start); - NameInfo NNS; + IdentifierNameInfo NNS; auto const NNSRange = llvm::split(NNSString, "::"); MRDOCS_ASSERT(!NNSRange.empty()); auto NNSIt = NNSRange.begin(); @@ -1736,7 +1764,7 @@ class RefParser { break; } - NameInfo NewNNS; + IdentifierNameInfo NewNNS; NewNNS.Name = std::string(unqualID); NewNNS.Prefix = Polymorphic(std::move(NNS)); NNS = NewNNS; diff --git a/src/lib/AST/ParseRef.hpp b/src/lib/AST/ParseRef.hpp index 03091ba90..34fc7218f 100644 --- a/src/lib/AST/ParseRef.hpp +++ b/src/lib/AST/ParseRef.hpp @@ -8,13 +8,13 @@ // Official repository: https://github.com/cppalliance/mrdocs // -#ifndef MRDOCS_LIB_PARSEREF_HPP -#define MRDOCS_LIB_PARSEREF_HPP +#ifndef MRDOCS_LIB_AST_PARSEREF_HPP +#define MRDOCS_LIB_AST_PARSEREF_HPP +#include #include #include #include -#include #include #include @@ -36,7 +36,7 @@ struct ParsedRefComponent { // If not empty, this is a conversion operator // Only the last component can be a conversion operator - Polymorphic ConversionType = std::nullopt; + Optional> ConversionType = std::nullopt; constexpr bool @@ -82,4 +82,4 @@ parse( } // clang::mrdocs -#endif +#endif // MRDOCS_LIB_AST_PARSEREF_HPP diff --git a/src/lib/AST/TypeInfoBuilder.cpp b/src/lib/AST/TypeInfoBuilder.cpp index 30527d5de..76bc6512d 100644 --- a/src/lib/AST/TypeInfoBuilder.cpp +++ b/src/lib/AST/TypeInfoBuilder.cpp @@ -11,7 +11,7 @@ // Official repository: https://github.com/cppalliance/mrdocs // -#include "lib/AST/TypeInfoBuilder.hpp" +#include namespace clang::mrdocs { @@ -20,7 +20,7 @@ TypeInfoBuilder:: buildPointer(PointerType const*, unsigned quals) { *Inner = Polymorphic(std::in_place_type); - auto &I = static_cast(**Inner); + auto &I = dynamic_cast(***Inner); I.IsConst = quals & Qualifiers::Const; I.IsVolatile = quals & Qualifiers::Volatile; Inner = &I.PointeeType; @@ -31,7 +31,7 @@ TypeInfoBuilder:: buildLValueReference(LValueReferenceType const*) { *Inner = Polymorphic(std::in_place_type); - Inner = &static_cast(**Inner).PointeeType; + Inner = &dynamic_cast(***Inner).PointeeType; } void @@ -39,7 +39,7 @@ TypeInfoBuilder:: buildRValueReference(RValueReferenceType const*) { *Inner = Polymorphic(std::in_place_type); - Inner = &static_cast(**Inner).PointeeType; + Inner = &dynamic_cast(***Inner).PointeeType; } void @@ -49,7 +49,7 @@ buildMemberPointer( unsigned const quals) { *Inner = Polymorphic(std::in_place_type); - auto &I = static_cast(**Inner); + auto &I = dynamic_cast(***Inner); I.IsConst = quals & Qualifiers::Const; I.IsVolatile = quals & Qualifiers::Volatile; // do not set NNS because the parent type is *not* @@ -64,7 +64,7 @@ TypeInfoBuilder:: buildArray(ArrayType const* T) { *Inner = Polymorphic(std::in_place_type); - auto &I = static_cast(**Inner); + auto &I = dynamic_cast(***Inner); if (auto* CAT = dyn_cast(T)) { getASTVisitor().populate(I.Bounds, CAT->getSizeExpr(), CAT->getSize()); @@ -82,7 +82,7 @@ populate(FunctionType const* T) { auto* FPT = cast(T); *Inner = Polymorphic(std::in_place_type); - auto &I = static_cast(**Inner); + auto &I = dynamic_cast(***Inner); for (QualType const PT : FPT->getParamTypes()) { I.ParamTypes.emplace_back(getASTVisitor().toTypeInfo(PT)); @@ -105,16 +105,16 @@ buildDecltype( bool pack) { *Inner = Polymorphic(std::in_place_type); - (*Inner)->Constraints = this->Constraints; - (*Inner)->IsPackExpansion = pack; + (**Inner)->Constraints = this->Constraints; + (**Inner)->IsPackExpansion = pack; - auto &I = static_cast(**Inner); + auto &I = dynamic_cast(***Inner); getASTVisitor().populate(I.Operand, T->getUnderlyingExpr()); I.IsConst = quals & Qualifiers::Const; I.IsVolatile = quals & Qualifiers::Volatile; - Result->Constraints = this->Constraints; - Result->IsPackExpansion = pack; + (*Result)->Constraints = this->Constraints; + (*Result)->IsPackExpansion = pack; } void @@ -125,10 +125,10 @@ buildAuto( bool const pack) { *Inner = Polymorphic(std::in_place_type); - (*Inner)->Constraints = this->Constraints; - (*Inner)->IsPackExpansion = pack; + (**Inner)->Constraints = this->Constraints; + (**Inner)->IsPackExpansion = pack; - auto &I = static_cast(**Inner); + auto &I = dynamic_cast(***Inner); I.IsConst = quals & Qualifiers::Const; I.IsVolatile = quals & Qualifiers::Volatile; I.Keyword = toAutoKind(T->getKeyword()); @@ -145,8 +145,8 @@ buildAuto( // Constraint->Prefix = getASTVisitor().buildNameInfo( // cast(CD->getDeclContext())); } - Result->Constraints = this->Constraints; - Result->IsPackExpansion = pack; + (*Result)->Constraints = this->Constraints; + (*Result)->IsPackExpansion = pack; } void @@ -158,21 +158,21 @@ buildTerminal( { MRDOCS_SYMBOL_TRACE(T, getASTVisitor().context_); *Inner = Polymorphic(std::in_place_type); - (*Inner)->IsPackExpansion = pack; - (*Inner)->Constraints = this->Constraints; + (**Inner)->IsPackExpansion = pack; + (**Inner)->Constraints = this->Constraints; - auto &TI = static_cast(**Inner); + auto &TI = dynamic_cast(***Inner); TI.IsConst = quals & Qualifiers::Const; TI.IsVolatile = quals & Qualifiers::Volatile; - TI.Name = Polymorphic(); + TI.Name = Polymorphic(std::in_place_type); TI.Name->Name = getASTVisitor().toString(T); if (isa(T)) { auto const* FT = cast(T); TI.FundamentalType = toFundamentalTypeKind(FT->getKind()); } - Result->Constraints = this->Constraints; - Result->IsPackExpansion = pack; + (*Result)->Constraints = this->Constraints; + (*Result)->IsPackExpansion = pack; } void @@ -185,17 +185,17 @@ buildTerminal( bool pack) { *Inner = Polymorphic(std::in_place_type); - (*Inner)->IsPackExpansion = pack; - (*Inner)->Constraints = this->Constraints; + (**Inner)->IsPackExpansion = pack; + (**Inner)->Constraints = this->Constraints; - auto &I = static_cast(**Inner); + auto &I = dynamic_cast(***Inner); I.IsConst = quals & Qualifiers::Const; I.IsVolatile = quals & Qualifiers::Volatile; if (TArgs) { I.Name = Polymorphic(std::in_place_type); - auto &Name = static_cast(*I.Name); + auto &Name = dynamic_cast(*I.Name); if (II) { Name.Name = II->getName(); @@ -205,7 +205,7 @@ buildTerminal( } else { - I.Name = Polymorphic(); + I.Name = Polymorphic(std::in_place_type); auto &Name = *I.Name; if (II) { @@ -213,8 +213,8 @@ buildTerminal( } Name.Prefix = getASTVisitor().toNameInfo(NNS); } - Result->Constraints = this->Constraints; - Result->IsPackExpansion = pack; + (*Result)->Constraints = this->Constraints; + (*Result)->IsPackExpansion = pack; } void @@ -236,10 +236,10 @@ buildTerminal( MRDOCS_SYMBOL_TRACE(ID, getASTVisitor().context_); *Inner = Polymorphic(std::in_place_type); - (*Inner)->IsPackExpansion = pack; - (*Inner)->Constraints = this->Constraints; + (**Inner)->IsPackExpansion = pack; + (**Inner)->Constraints = this->Constraints; - auto &TI = static_cast(**Inner); + auto &TI = dynamic_cast(***Inner); TI.IsConst = quals & Qualifiers::Const; TI.IsVolatile = quals & Qualifiers::Volatile; @@ -261,19 +261,19 @@ buildTerminal( if (!TArgs) { - TI.Name = Polymorphic(); + TI.Name = Polymorphic(std::in_place_type); populateNameInfo(*TI.Name, D); } else { TI.Name = Polymorphic(std::in_place_type); - auto &Name = static_cast(*TI.Name); + auto &Name = dynamic_cast(*TI.Name); populateNameInfo(Name, D); getASTVisitor().populate(Name.TemplateArgs, *TArgs); } - Result->Constraints = this->Constraints; - Result->IsPackExpansion = pack; + (*Result)->Constraints = this->Constraints; + (*Result)->IsPackExpansion = pack; } } // clang::mrdocs diff --git a/src/lib/AST/TypeInfoBuilder.hpp b/src/lib/AST/TypeInfoBuilder.hpp index 7d103f253..d1bb7c5e6 100644 --- a/src/lib/AST/TypeInfoBuilder.hpp +++ b/src/lib/AST/TypeInfoBuilder.hpp @@ -40,7 +40,7 @@ class TypeInfoBuilder as a polymorphic `TypeInfo` object. */ - Polymorphic Result = std::nullopt; + Optional> Result = std::nullopt; /* A pointer to the inner type of result currently being populated. @@ -61,7 +61,7 @@ class TypeInfoBuilder `NamedTypeInfo` object, and the visiting process continues populating the `Inner` object. */ - Polymorphic* Inner = &Result; + Optional>* Inner = &Result; public: using TerminalTypeVisitor::TerminalTypeVisitor; @@ -76,7 +76,15 @@ class TypeInfoBuilder Polymorphic result() { - return std::move(Result); + MRDOCS_ASSERT(hasResult()); + return std::move(*Result); + } + + constexpr + bool + hasResult() const noexcept + { + return Result.has_value(); } /** Build type information for a pointer type. diff --git a/src/lib/ConfigImpl.cpp b/src/lib/ConfigImpl.cpp index 795be704c..73bcd9c55 100644 --- a/src/lib/ConfigImpl.cpp +++ b/src/lib/ConfigImpl.cpp @@ -11,10 +11,10 @@ // #include "ConfigImpl.hpp" -#include "lib/Support/Glob.hpp" -#include "lib/Support/Path.hpp" -#include +#include +#include #include +#include #include #include #include diff --git a/src/lib/ConfigImpl.hpp b/src/lib/ConfigImpl.hpp index b3a839286..495653210 100644 --- a/src/lib/ConfigImpl.hpp +++ b/src/lib/ConfigImpl.hpp @@ -13,7 +13,7 @@ #ifndef MRDOCS_LIB_CONFIGIMPL_HPP #define MRDOCS_LIB_CONFIGIMPL_HPP -#include "lib/Support/YamlFwd.hpp" +#include #include #include #include @@ -161,4 +161,4 @@ class ConfigImpl } // mrdocs } // clang -#endif +#endif // MRDOCS_LIB_CONFIGIMPL_HPP diff --git a/src/lib/Corpus.cpp b/src/lib/Corpus.cpp index 159a02938..2d2bd391f 100644 --- a/src/lib/Corpus.cpp +++ b/src/lib/Corpus.cpp @@ -9,7 +9,7 @@ // Official repository: https://github.com/cppalliance/mrdocs // -#include "ConfigImpl.hpp" +#include #include #include #include diff --git a/src/lib/CorpusImpl.cpp b/src/lib/CorpusImpl.cpp index 258c4c8e6..1975164dc 100644 --- a/src/lib/CorpusImpl.cpp +++ b/src/lib/CorpusImpl.cpp @@ -12,17 +12,17 @@ // #include "CorpusImpl.hpp" -#include "lib/AST/FrontendActionFactory.hpp" -#include "lib/AST/MissingSymbolSink.hpp" -#include "lib/AST/MrDocsFileSystem.hpp" -#include "lib/Metadata/Finalizers/BaseMembersFinalizer.hpp" -#include "lib/Metadata/Finalizers/DerivedFinalizer.hpp" -#include "lib/Metadata/Finalizers/JavadocFinalizer.hpp" -#include "lib/Metadata/Finalizers/NamespacesFinalizer.hpp" -#include "lib/Metadata/Finalizers/OverloadsFinalizer.hpp" -#include "lib/Metadata/Finalizers/SortMembersFinalizer.hpp" -#include "lib/Support/Chrono.hpp" -#include "lib/Support/Report.hpp" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include #include @@ -140,7 +140,7 @@ qualifiedNameCompare( Info const& context, CorpusImpl const& corpus) { - MRDOCS_CHECK_OR(lhs0 && rhs0, false); + MRDOCS_CHECK_OR(!lhs0.valueless_after_move() && !rhs0.valueless_after_move(), false); // Compare each component of the qualified name NameInfo const* lhs = &*lhs0; NameInfo const* rhs = &*rhs0; @@ -150,8 +150,8 @@ qualifiedNameCompare( { return false; } - lhs = lhs->Prefix ? &*lhs->Prefix : nullptr; - rhs = rhs->Prefix ? &*rhs->Prefix : nullptr; + lhs = lhs->Prefix ? &**lhs->Prefix : nullptr; + rhs = rhs->Prefix ? &**rhs->Prefix : nullptr; } // We consumed all components of both names if (!lhs && !rhs) @@ -184,13 +184,21 @@ qualifiedNameCompare( continue; } // Names matches, match next component - curName = curName->Prefix ? &*curName->Prefix : nullptr; + curName = curName->Prefix ? &**curName->Prefix : nullptr; curContext = curContext->Parent ? corpus.find(curContext->Parent) : nullptr; } // We should have consumed all components of the name with the context return !curName; } +template +bool +isDecayedEqualImpl( + Optional> const& lhs, + Optional> const& rhs, + Info const& context, + CorpusImpl const& corpus); + template bool isDecayedEqualImpl( @@ -200,8 +208,8 @@ isDecayedEqualImpl( CorpusImpl const& corpus) { // Polymorphic - MRDOCS_CHECK_OR(static_cast(lhs) == static_cast(rhs), false); - MRDOCS_CHECK_OR(static_cast(lhs) && static_cast(rhs), true); + MRDOCS_CHECK_OR(lhs.valueless_after_move() == lhs.valueless_after_move(), false); + MRDOCS_CHECK_OR(!lhs.valueless_after_move() && !rhs.valueless_after_move(), true); // TypeInfo bool const decayToPointer = !isInner && (lhs->isArray() || rhs->isArray()); if (!decayToPointer) @@ -303,6 +311,19 @@ isDecayedEqualImpl( return true; } +template +bool +isDecayedEqualImpl( + Optional> const& lhs, + Optional> const& rhs, + Info const& context, + CorpusImpl const& corpus) +{ + MRDOCS_CHECK_OR(static_cast(lhs) == static_cast(rhs), false); + MRDOCS_CHECK_OR(static_cast(lhs) && static_cast(rhs), true); + return isDecayedEqualImpl(*lhs, *rhs, context, corpus); +} + /* Compare two types for equality for the purposes of overload resolution. */ @@ -470,7 +491,8 @@ lookupImpl( if (auto* TI = contextPtr->asTypedefPtr()) { MRDOCS_CHECK_OR(TI->Type, nullptr); - SymbolID resolvedSymbolID = TI->Type->namedSymbol(); + MRDOCS_ASSERT(!TI->Type->valueless_after_move()); + SymbolID resolvedSymbolID = (*TI->Type)->namedSymbol(); contextPtr = this->find(resolvedSymbolID); MRDOCS_CHECK_OR(contextPtr, nullptr); } @@ -619,7 +641,9 @@ lookupImpl( MRDOCS_CHECK_OR(F.IsExplicitObjectMemberFunction == ref.IsExplicitObjectMemberFunction, matchRes); for (std::size_t i = 0; i < F.Params.size(); ++i) { - auto& lhsType = F.Params[i].Type; + auto& lhsTypeOpt = F.Params[i].Type; + MRDOCS_CHECK_OR(lhsTypeOpt, matchRes); + auto& lhsType = *lhsTypeOpt; auto& rhsType = ref.FunctionParameters[i]; MRDOCS_CHECK_OR(isDecayedEqual(lhsType, rhsType, context, *this), matchRes); } diff --git a/src/lib/CorpusImpl.hpp b/src/lib/CorpusImpl.hpp index c8d70d0cf..0e628264b 100644 --- a/src/lib/CorpusImpl.hpp +++ b/src/lib/CorpusImpl.hpp @@ -12,21 +12,21 @@ #ifndef MRDOCS_LIB_CORPUSIMPL_HPP #define MRDOCS_LIB_CORPUSIMPL_HPP -#include "lib/AST/ParseRef.hpp" -#include "ConfigImpl.hpp" -#include "lib/Metadata/InfoSet.hpp" -#include "lib/Support/Debug.hpp" -#include +#include +#include +#include +#include +#include #include #include #include -#include #include +#include +#include #include #include -#include #include -#include +#include namespace clang::mrdocs { @@ -258,4 +258,4 @@ get( } // clang::mrdocs -#endif +#endif // MRDOCS_LIB_CORPUSIMPL_HPP diff --git a/src/lib/Diagnostics.hpp b/src/lib/Diagnostics.hpp index c3f6c0141..010b35bda 100644 --- a/src/lib/Diagnostics.hpp +++ b/src/lib/Diagnostics.hpp @@ -8,12 +8,12 @@ // Official repository: https://github.com/cppalliance/mrdocs // -#ifndef MRDOCS_LIB_TOOL_DIAGNOSTICS_HPP -#define MRDOCS_LIB_TOOL_DIAGNOSTICS_HPP +#ifndef MRDOCS_LIB_DIAGNOSTICS_HPP +#define MRDOCS_LIB_DIAGNOSTICS_HPP -#include -#include #include +#include +#include #include #include @@ -141,4 +141,4 @@ class Diagnostics } // mrdocs } // clang -#endif +#endif // MRDOCS_LIB_DIAGNOSTICS_HPP diff --git a/src/lib/Dom/Object.cpp b/src/lib/Dom/Object.cpp index fcdab886a..379ad5e99 100644 --- a/src/lib/Dom/Object.cpp +++ b/src/lib/Dom/Object.cpp @@ -8,10 +8,10 @@ // Official repository: https://github.com/cppalliance/mrdocs // -#include -#include #include #include +#include +#include #include namespace clang { diff --git a/src/lib/Dom/String.cpp b/src/lib/Dom/String.cpp index 6e1b5d147..538f457e0 100644 --- a/src/lib/Dom/String.cpp +++ b/src/lib/Dom/String.cpp @@ -8,9 +8,9 @@ // Official repository: https://github.com/cppalliance/mrdocs // +#include #include #include -#include namespace clang { namespace mrdocs { diff --git a/src/lib/Dom/Value.cpp b/src/lib/Dom/Value.cpp index 7927f95b2..83eb6ce1e 100644 --- a/src/lib/Dom/Value.cpp +++ b/src/lib/Dom/Value.cpp @@ -9,8 +9,8 @@ // #include -#include #include +#include namespace clang { namespace mrdocs { diff --git a/src/lib/Gen/adoc/AdocGenerator.hpp b/src/lib/Gen/adoc/AdocGenerator.hpp index a604be9ca..e35f2b28b 100644 --- a/src/lib/Gen/adoc/AdocGenerator.hpp +++ b/src/lib/Gen/adoc/AdocGenerator.hpp @@ -14,8 +14,8 @@ #define MRDOCS_LIB_GEN_ADOC_ADOCGENERATOR_HPP #include -#include #include +#include namespace clang::mrdocs::adoc { diff --git a/src/lib/Gen/hbs/Builder.cpp b/src/lib/Gen/hbs/Builder.cpp index 7468013f0..a41ff4831 100644 --- a/src/lib/Gen/hbs/Builder.cpp +++ b/src/lib/Gen/hbs/Builder.cpp @@ -10,12 +10,12 @@ // #include "Builder.hpp" -#include "lib/ConfigImpl.hpp" -#include -#include +#include #include #include #include +#include +#include namespace clang { namespace mrdocs { diff --git a/src/lib/Gen/hbs/Builder.hpp b/src/lib/Gen/hbs/Builder.hpp index e2cc3894f..8b0ab4bfd 100644 --- a/src/lib/Gen/hbs/Builder.hpp +++ b/src/lib/Gen/hbs/Builder.hpp @@ -12,8 +12,8 @@ #ifndef MRDOCS_LIB_GEN_HBS_BUILDER_HPP #define MRDOCS_LIB_GEN_HBS_BUILDER_HPP -#include "HandlebarsCorpus.hpp" -#include "lib/Support/Radix.hpp" +#include +#include #include #include #include @@ -128,4 +128,4 @@ class Builder } // mrdocs } // clang -#endif +#endif // MRDOCS_LIB_GEN_HBS_BUILDER_HPP diff --git a/src/lib/Gen/hbs/HandlebarsCorpus.cpp b/src/lib/Gen/hbs/HandlebarsCorpus.cpp index 5e4314025..3535dd01b 100644 --- a/src/lib/Gen/hbs/HandlebarsCorpus.cpp +++ b/src/lib/Gen/hbs/HandlebarsCorpus.cpp @@ -12,11 +12,9 @@ #include "HandlebarsCorpus.hpp" #include "VisitorHelpers.hpp" -#include -#include -#include #include #include +#include namespace clang::mrdocs::hbs { diff --git a/src/lib/Gen/hbs/HandlebarsCorpus.hpp b/src/lib/Gen/hbs/HandlebarsCorpus.hpp index 3567d9590..0515901f6 100644 --- a/src/lib/Gen/hbs/HandlebarsCorpus.hpp +++ b/src/lib/Gen/hbs/HandlebarsCorpus.hpp @@ -13,10 +13,10 @@ #define MRDOCS_LIB_GEN_HBS_HANDLEBARSCORPUS_HPP #include -#include "lib/Support/LegibleNames.hpp" +#include +#include #include #include -#include namespace clang::mrdocs::hbs { @@ -72,4 +72,4 @@ class HandlebarsCorpus final : public DomCorpus } // clang::mrdocs::hbs -#endif +#endif // MRDOCS_LIB_GEN_HBS_HANDLEBARSCORPUS_HPP diff --git a/src/lib/Gen/hbs/HandlebarsGenerator.cpp b/src/lib/Gen/hbs/HandlebarsGenerator.cpp index fef070e24..64b018606 100644 --- a/src/lib/Gen/hbs/HandlebarsGenerator.cpp +++ b/src/lib/Gen/hbs/HandlebarsGenerator.cpp @@ -11,21 +11,17 @@ // #include "HandlebarsGenerator.hpp" -#include "HandlebarsCorpus.hpp" #include "Builder.hpp" +#include "HandlebarsCorpus.hpp" #include "MultiPageVisitor.hpp" #include "SinglePageVisitor.hpp" - #include "TagfileWriter.hpp" -#include "lib/Support/RawOstream.hpp" - +#include +#include +#include #include #include #include - -#include -#include - #include #include diff --git a/src/lib/Gen/hbs/HandlebarsGenerator.hpp b/src/lib/Gen/hbs/HandlebarsGenerator.hpp index 3248517c6..5aa4ffc21 100644 --- a/src/lib/Gen/hbs/HandlebarsGenerator.hpp +++ b/src/lib/Gen/hbs/HandlebarsGenerator.hpp @@ -13,9 +13,9 @@ #define MRDOCS_LIB_GEN_HBS_HANDLEBARSGENERATOR_HPP #include +#include #include #include -#include #include namespace clang::mrdocs { diff --git a/src/lib/Gen/hbs/MultiPageVisitor.cpp b/src/lib/Gen/hbs/MultiPageVisitor.cpp index 09bb15a85..b77a578dd 100644 --- a/src/lib/Gen/hbs/MultiPageVisitor.cpp +++ b/src/lib/Gen/hbs/MultiPageVisitor.cpp @@ -11,9 +11,9 @@ #include "MultiPageVisitor.hpp" #include "VisitorHelpers.hpp" -#include #include #include +#include namespace clang::mrdocs::hbs { diff --git a/src/lib/Gen/hbs/MultiPageVisitor.hpp b/src/lib/Gen/hbs/MultiPageVisitor.hpp index d2dfd7df2..13b306edf 100644 --- a/src/lib/Gen/hbs/MultiPageVisitor.hpp +++ b/src/lib/Gen/hbs/MultiPageVisitor.hpp @@ -12,14 +12,14 @@ #ifndef MRDOCS_LIB_GEN_HBS_MULTIPAGEVISITOR_HPP #define MRDOCS_LIB_GEN_HBS_MULTIPAGEVISITOR_HPP -#include "Builder.hpp" -#include +#include #include +#include +#include #include #include #include #include -#include namespace clang::mrdocs::hbs { diff --git a/src/lib/Gen/hbs/SinglePageVisitor.hpp b/src/lib/Gen/hbs/SinglePageVisitor.hpp index 797da308a..9d938819b 100644 --- a/src/lib/Gen/hbs/SinglePageVisitor.hpp +++ b/src/lib/Gen/hbs/SinglePageVisitor.hpp @@ -12,7 +12,7 @@ #ifndef MRDOCS_LIB_GEN_HBS_SINGLEPAGEVISITOR_HPP #define MRDOCS_LIB_GEN_HBS_SINGLEPAGEVISITOR_HPP -#include "Builder.hpp" +#include #include #include #include diff --git a/src/lib/Gen/hbs/TagfileWriter.cpp b/src/lib/Gen/hbs/TagfileWriter.cpp index cedb20d99..01c8519b9 100644 --- a/src/lib/Gen/hbs/TagfileWriter.cpp +++ b/src/lib/Gen/hbs/TagfileWriter.cpp @@ -9,15 +9,13 @@ // Official repository: https://github.com/cppalliance/mrdocs // -#include "lib/Gen/xml/CXXTags.hpp" #include "TagfileWriter.hpp" -#include "lib/Gen/hbs/VisitorHelpers.hpp" -#include "lib/ConfigImpl.hpp" -#include "lib/Support/RawOstream.hpp" - -#include - +#include +#include +#include +#include #include +#include namespace clang::mrdocs { @@ -202,7 +200,11 @@ TagfileWriter:: writeFunctionMember(FunctionInfo const& I) { tags_.open("member", {{"kind", "function"}}); - tags_.write("type", toString(*I.ReturnType)); + if (I.ReturnType) + { + MRDOCS_ASSERT(!I.ReturnType->valueless_after_move()); + tags_.write("type", toString(**I.ReturnType)); + } tags_.write("name", I.Name); auto [anchorFile, anchor] = generateFileAndAnchor(I); tags_.write("anchorfile", anchorFile); @@ -210,10 +212,16 @@ writeFunctionMember(FunctionInfo const& I) std::string arglist = "("; for(auto const& J : I.Params) { - arglist += toString(*J.Type); + if (J.Type) + { + arglist += toString(**J.Type); + if (J.Name) + { + arglist += " "; + } + } if (J.Name) { - arglist += " "; arglist += *J.Name; } arglist += ", "; diff --git a/src/lib/Gen/hbs/TagfileWriter.hpp b/src/lib/Gen/hbs/TagfileWriter.hpp index c571f5a6a..83f424976 100644 --- a/src/lib/Gen/hbs/TagfileWriter.hpp +++ b/src/lib/Gen/hbs/TagfileWriter.hpp @@ -9,14 +9,13 @@ // Official repository: https://github.com/cppalliance/mrdocs // -#ifndef MRDOCS_LIB_TAGFILEWRITER_HPP -#define MRDOCS_LIB_TAGFILEWRITER_HPP +#ifndef MRDOCS_LIB_GEN_HBS_TAGFILEWRITER_HPP +#define MRDOCS_LIB_GEN_HBS_TAGFILEWRITER_HPP -#include "lib/Gen/xml/XMLTags.hpp" -#include "lib/Gen/hbs/HandlebarsCorpus.hpp" +#include +#include #include #include - #include #include @@ -142,4 +141,4 @@ class TagfileWriter } // mrdocs } // clang -#endif \ No newline at end of file +#endif // MRDOCS_LIB_GEN_HBS_TAGFILEWRITER_HPP \ No newline at end of file diff --git a/src/lib/Gen/hbs/VisitorHelpers.cpp b/src/lib/Gen/hbs/VisitorHelpers.cpp index 5464e1f40..48b62d8a1 100644 --- a/src/lib/Gen/hbs/VisitorHelpers.cpp +++ b/src/lib/Gen/hbs/VisitorHelpers.cpp @@ -50,8 +50,10 @@ resolveTypedef(Corpus const& c, Info const& I) if (I.isTypedef()) { auto const& TI = I.asTypedef(); - Polymorphic const& T = TI.Type; - MRDOCS_CHECK_OR(T && T->Kind == TypeKind::Named, &I); + MRDOCS_CHECK_OR(TI.Type, &I); + MRDOCS_ASSERT(!TI.Type->valueless_after_move()); + Polymorphic const& T = *TI.Type; + MRDOCS_CHECK_OR(!T.valueless_after_move() && T->Kind == TypeKind::Named, &I); auto const& NT = dynamic_cast(*T); MRDOCS_CHECK_OR(NT.Name, &I); Info const* resolved = c.find(NT.Name->id); @@ -168,8 +170,11 @@ findResolvedPrimarySiblingWithUrl(Corpus const& c, Info const& I) // The symbol is a typedef to a specialization if constexpr (std::same_as) { - Polymorphic const& T = U.Type; - MRDOCS_CHECK_OR(T && T->Kind == TypeKind::Named, false); + auto const& TOpt = U.Type; + MRDOCS_CHECK_OR(TOpt, false); + Polymorphic const& T = *TOpt; + MRDOCS_CHECK_OR(!T.valueless_after_move(), false); + MRDOCS_CHECK_OR(T->Kind == TypeKind::Named, false); auto const& NT = dynamic_cast(*T); MRDOCS_CHECK_OR(NT.Name, false); MRDOCS_CHECK_OR(NT.Name->Kind == NameKind::Specialization, false); diff --git a/src/lib/Gen/hbs/VisitorHelpers.hpp b/src/lib/Gen/hbs/VisitorHelpers.hpp index 8a1341ae1..67d007ba1 100644 --- a/src/lib/Gen/hbs/VisitorHelpers.hpp +++ b/src/lib/Gen/hbs/VisitorHelpers.hpp @@ -11,8 +11,9 @@ #ifndef MRDOCS_LIB_GEN_HBS_VISITORHELPERS_HPP #define MRDOCS_LIB_GEN_HBS_VISITORHELPERS_HPP -#include #include +#include +#include namespace clang::mrdocs::hbs { diff --git a/src/lib/Gen/html/HTMLGenerator.hpp b/src/lib/Gen/html/HTMLGenerator.hpp index 0b66f532b..921decdd6 100644 --- a/src/lib/Gen/html/HTMLGenerator.hpp +++ b/src/lib/Gen/html/HTMLGenerator.hpp @@ -14,8 +14,8 @@ #define MRDOCS_LIB_GEN_HTML_HTMLGENERATOR_HPP #include -#include #include +#include namespace clang::mrdocs::html { diff --git a/src/lib/Gen/xml/CXXTags.cpp b/src/lib/Gen/xml/CXXTags.cpp index a5ea3bbfd..e80682f30 100644 --- a/src/lib/Gen/xml/CXXTags.cpp +++ b/src/lib/Gen/xml/CXXTags.cpp @@ -10,8 +10,8 @@ // #include "CXXTags.hpp" -#include #include +#include #include namespace clang::mrdocs::xml { diff --git a/src/lib/Gen/xml/CXXTags.hpp b/src/lib/Gen/xml/CXXTags.hpp index c09e42f7a..28eb954e9 100644 --- a/src/lib/Gen/xml/CXXTags.hpp +++ b/src/lib/Gen/xml/CXXTags.hpp @@ -13,9 +13,10 @@ #ifndef MRDOCS_LIB_GEN_XML_CXXTAGS_HPP #define MRDOCS_LIB_GEN_XML_CXXTAGS_HPP -#include "XMLTags.hpp" +#include #include #include +#include #include /* @@ -137,13 +138,16 @@ writeType( // KRYSTIAN FIXME: parent should is a type itself if constexpr(requires { t.ParentType; }) { - if(t.ParentType) - attrs.push({"parent", toString(*t.ParentType)}); + if (t.ParentType) + { + MRDOCS_ASSERT(!t.ParentType->valueless_after_move()); + attrs.push({ "parent", toString(**t.ParentType) }); + } } if constexpr(T::isNamed()) { - if(t.Name) + if(!t.Name.valueless_after_move()) { attrs.push({t.Name->id}); attrs.push({"name", toString(*t.Name)}); @@ -184,9 +188,13 @@ writeType( if constexpr(T::isAuto()) { - attrs.push({"keyword", toString(t.Keyword)}); - if(t.Constraint) - attrs.push({"constraint", toString(*t.Constraint)}); + AutoTypeInfo const& at = t; + attrs.push({"keyword", toString(at.Keyword)}); + if(at.Constraint) + { + MRDOCS_ASSERT(!at.Constraint->valueless_after_move()); + attrs.push({"constraint", toString(**t.Constraint)}); + } } if constexpr(T::isFunction()) @@ -215,19 +223,36 @@ writeType( if constexpr(requires { t.PointeeType; }) { - writeType(*t.PointeeType, tags, "pointee-type"); + Optional> pointee = t.PointeeType; + if (pointee) + { + MRDOCS_ASSERT(!pointee->valueless_after_move()); + writeType(**t.PointeeType, tags, "pointee-type"); + } } if constexpr(T::isArray()) { - writeType(*t.ElementType, tags, "element-type"); + ArrayTypeInfo const& at = t; + if (at.ElementType) + { + MRDOCS_ASSERT(!at.ElementType->valueless_after_move()); + writeType(**t.ElementType, tags, "element-type"); + } } if constexpr(T::isFunction()) { - writeType(*t.ReturnType, tags, "return-type"); - for(auto const& p : t.ParamTypes) - writeType(*p, tags, "param-type"); + FunctionTypeInfo const& ft = t; + if (ft.ReturnType) + { + MRDOCS_ASSERT(!ft.ReturnType->valueless_after_move()); + writeType(**t.ReturnType, tags, "return-type"); + for (auto const& p: t.ParamTypes) + { + writeType(*p, tags, "param-type"); + } + } } tags.close(type_tag); @@ -240,11 +265,26 @@ writeType( Polymorphic const& type, XMLTags& tags) { - if(! type) + if (type.valueless_after_move()) + { return; + } writeType(*type, tags); } +inline +void +writeType( + Optional> const& type, + XMLTags& tags) +{ + if (type) + { + writeType(*type, tags); + } +} + + inline void writeReturnType(TypeInfo const& I, XMLTags& tags) { // KRYSTIAN NOTE: we don't *have* to do this... @@ -269,60 +309,72 @@ inline void writeParam(Param const& P, XMLTags& tags) inline void writeTemplateParam(TParam const& I, XMLTags& tags) { - visit(I, [&](T const& P) + visit(I, [&](T const& P) { + TParam const & tp = P; + Attributes attrs = { + { "name", tp.Name, !tp.Name.empty() }, + { "class", toString(T::kind_id) } + }; + + if constexpr (T::isNonType()) { - Attributes attrs = { - {"name", P.Name, ! P.Name.empty()}, - {"class", toString(T::kind_id)} - }; - - if constexpr(T::isNonType()) - attrs.push({"type", toString(*P.Type)}); - - if(P.Default) - attrs.push({"default", toString(*P.Default)}); - - if constexpr(T::isTemplate()) + NonTypeTParam const& nt = P; + if (nt.Type) { - tags.open(tparamTagName, - std::move(attrs)); - for(auto const& tparam : P.Params) - writeTemplateParam(*tparam, tags); - tags.close(tparamTagName); + MRDOCS_ASSERT(!nt.Type->valueless_after_move()); + attrs.push({ "type", toString(**nt.Type) }); } - else + } + + if (tp.Default) + { + MRDOCS_ASSERT(!tp.Default->valueless_after_move()); + attrs.push({ "default", toString(**P.Default) }); + } + + if constexpr (T::isTemplate()) + { + tags.open(tparamTagName, std::move(attrs)); + for (auto const& tparam: P.Params) { - tags.write(tparamTagName, {}, - std::move(attrs)); + writeTemplateParam(*tparam, tags); } - }); + tags.close(tparamTagName); + } else + { + tags.write(tparamTagName, {}, std::move(attrs)); + } + }); } inline void writeTemplateArg(TArg const& I, XMLTags& tags) { - visit(I, [&](T const& A) - { - Attributes attrs = { - {"class", toString(T::kind_id)} - }; + visit(I, [&](T const& A) { + Attributes attrs = { + { "class", toString(T::kind_id) } + }; - if constexpr(T::isType()) - { - attrs.push({"type", toString(*A.Type)}); - } - if constexpr(T::isNonType()) - { - attrs.push({"value", A.Value.Written}); - } - if constexpr(T::isTemplate()) + if constexpr (T::isType()) + { + TypeTArg const& at = A; + if (at.Type) { - attrs.push({"name", A.Name}); - attrs.push({A.Template}); + MRDOCS_ASSERT(!at.Type->valueless_after_move()); + attrs.push({ "type", toString(**A.Type) }); } + } + if constexpr (T::isNonType()) + { + attrs.push({ "value", A.Value.Written }); + } + if constexpr (T::isTemplate()) + { + attrs.push({ "name", A.Name }); + attrs.push({ A.Template }); + } - tags.write(targTagName, {}, - std::move(attrs)); - }); + tags.write(targTagName, {}, std::move(attrs)); + }); } /** Return the xml tag name for the Info. diff --git a/src/lib/Gen/xml/XMLGenerator.cpp b/src/lib/Gen/xml/XMLGenerator.cpp index d4b5b0a90..42e4ab749 100644 --- a/src/lib/Gen/xml/XMLGenerator.cpp +++ b/src/lib/Gen/xml/XMLGenerator.cpp @@ -11,10 +11,10 @@ #include "XMLGenerator.hpp" #include "XMLWriter.hpp" -#include "lib/Support/Radix.hpp" -#include "lib/Support/RawOstream.hpp" -#include +#include +#include #include +#include namespace clang { namespace mrdocs { diff --git a/src/lib/Gen/xml/XMLTags.cpp b/src/lib/Gen/xml/XMLTags.cpp index 2885bdf12..d93448d1d 100644 --- a/src/lib/Gen/xml/XMLTags.cpp +++ b/src/lib/Gen/xml/XMLTags.cpp @@ -10,8 +10,8 @@ // #include "XMLTags.hpp" -#include "lib/Support/Radix.hpp" #include +#include namespace clang { namespace mrdocs { diff --git a/src/lib/Gen/xml/XMLTags.hpp b/src/lib/Gen/xml/XMLTags.hpp index 6dbc01247..450b726d9 100644 --- a/src/lib/Gen/xml/XMLTags.hpp +++ b/src/lib/Gen/xml/XMLTags.hpp @@ -12,15 +12,15 @@ #ifndef MRDOCS_LIB_GEN_XML_XMLTAGS_HPP #define MRDOCS_LIB_GEN_XML_XMLTAGS_HPP -#include -#include -#include -#include -#include #include +#include #include -#include #include +#include +#include +#include +#include +#include /* Object for assisting with generating diff --git a/src/lib/Gen/xml/XMLWriter.cpp b/src/lib/Gen/xml/XMLWriter.cpp index d39f58345..48ac28a9a 100644 --- a/src/lib/Gen/xml/XMLWriter.cpp +++ b/src/lib/Gen/xml/XMLWriter.cpp @@ -10,13 +10,13 @@ // Official repository: https://github.com/cppalliance/mrdocs // -#include "CXXTags.hpp" #include "XMLWriter.hpp" -#include "lib/ConfigImpl.hpp" -#include "lib/Support/Yaml.hpp" -#include "lib/Support/LegibleNames.hpp" -#include "lib/Support/Radix.hpp" #include +#include "CXXTags.hpp" +#include +#include +#include +#include #include #include @@ -99,7 +99,7 @@ operator()( return; } #define INFO(Type) if constexpr(T::is##Type()) write##Type(I); - #include +#include } //------------------------------------------------ @@ -197,7 +197,7 @@ writeFriend( } else if (I.Type) { - attrs.push({ "type", toString(*I.Type) }); + attrs.push({ "type", toString(**I.Type) }); } tags_.write("befriended", {}, attrs); @@ -251,10 +251,15 @@ writeFunction( writeAttr(I.IsNodiscard, "nodiscard", tags_); writeAttr(I.IsExplicitObjectMemberFunction, "is-explicit-object-member-function", tags_); - writeReturnType(*I.ReturnType, tags_); + if (I.ReturnType) + { + writeReturnType(**I.ReturnType, tags_); + } - for(auto const& J : I.Params) + for (auto const& J: I.Params) + { writeParam(J, tags_); + } writeJavadoc(I.javadoc); @@ -345,10 +350,14 @@ writeNamespaceAlias( writeJavadoc(I.javadoc); - tags_.write("aliased", {}, { - {"name", toString(*I.AliasedSymbol)}, - { I.AliasedSymbol->id } - }); + if (I.AliasedSymbol) + { + tags_.write("aliased", {}, { + {"name", toString(**I.AliasedSymbol)}, + { (*I.AliasedSymbol)->id } + }); + } + tags_.close(namespaceAliasTagName); } @@ -373,7 +382,7 @@ XMLWriter:: } std::string qualifierStr; - if (I.IntroducedName) + if (!I.IntroducedName.valueless_after_move()) { qualifierStr = toString(*I.IntroducedName); } diff --git a/src/lib/Gen/xml/XMLWriter.hpp b/src/lib/Gen/xml/XMLWriter.hpp index 05c5ecda2..75e45752b 100644 --- a/src/lib/Gen/xml/XMLWriter.hpp +++ b/src/lib/Gen/xml/XMLWriter.hpp @@ -12,8 +12,8 @@ #ifndef MRDOCS_LIB_GEN_XML_XMLWRITER_HPP #define MRDOCS_LIB_GEN_XML_XMLWRITER_HPP -#include "XMLTags.hpp" -#include "lib/Support/YamlFwd.hpp" +#include +#include #include #include #include @@ -109,4 +109,4 @@ class XMLWriter } // clang::mrdocs::xml -#endif +#endif // MRDOCS_LIB_GEN_XML_XMLWRITER_HPP diff --git a/src/lib/Metadata/DomCorpus.cpp b/src/lib/Metadata/DomCorpus.cpp index db12ba844..45e523b0e 100644 --- a/src/lib/Metadata/DomCorpus.cpp +++ b/src/lib/Metadata/DomCorpus.cpp @@ -10,16 +10,16 @@ // Official repository: https://github.com/cppalliance/mrdocs // +#include +#include +#include #include #include -#include "lib/Support/LegibleNames.hpp" -#include "lib/Support/Radix.hpp" +#include +#include #include #include #include -#include -#include -#include namespace clang::mrdocs { diff --git a/src/lib/Metadata/Finalizers/BaseMembersFinalizer.cpp b/src/lib/Metadata/Finalizers/BaseMembersFinalizer.cpp index 40b944618..ad214cf13 100644 --- a/src/lib/Metadata/Finalizers/BaseMembersFinalizer.cpp +++ b/src/lib/Metadata/Finalizers/BaseMembersFinalizer.cpp @@ -9,9 +9,9 @@ // #include "BaseMembersFinalizer.hpp" -#include #include #include +#include namespace clang::mrdocs { @@ -228,7 +228,7 @@ operator()(RecordInfo& I) for (BaseInfo const& baseI: I.Bases) { auto const *baseNameType = - dynamic_cast(&*baseI.Type); + dynamic_cast(&**baseI.Type); MRDOCS_CHECK_OR_CONTINUE(baseNameType); auto const *baseName = dynamic_cast(&*baseNameType->Name); diff --git a/src/lib/Metadata/Finalizers/BaseMembersFinalizer.hpp b/src/lib/Metadata/Finalizers/BaseMembersFinalizer.hpp index 1b6659352..a6607fb49 100644 --- a/src/lib/Metadata/Finalizers/BaseMembersFinalizer.hpp +++ b/src/lib/Metadata/Finalizers/BaseMembersFinalizer.hpp @@ -8,11 +8,11 @@ // Official repository: https://github.com/cppalliance/mrdocs // -#ifndef MRDOCS_LIB_METADATA_FINALIZER_BASEMEMBERSFINALIZER_HPP -#define MRDOCS_LIB_METADATA_FINALIZER_BASEMEMBERSFINALIZER_HPP +#ifndef MRDOCS_LIB_METADATA_FINALIZERS_BASEMEMBERSFINALIZER_HPP +#define MRDOCS_LIB_METADATA_FINALIZERS_BASEMEMBERSFINALIZER_HPP -#include "lib/Metadata/InfoSet.hpp" -#include "lib/CorpusImpl.hpp" +#include +#include namespace clang::mrdocs { @@ -83,4 +83,4 @@ class BaseMembersFinalizer } // clang::mrdocs -#endif +#endif // MRDOCS_LIB_METADATA_FINALIZERS_BASEMEMBERSFINALIZER_HPP diff --git a/src/lib/Metadata/Finalizers/DerivedFinalizer.cpp b/src/lib/Metadata/Finalizers/DerivedFinalizer.cpp index 2c106c563..31daac914 100644 --- a/src/lib/Metadata/Finalizers/DerivedFinalizer.cpp +++ b/src/lib/Metadata/Finalizers/DerivedFinalizer.cpp @@ -8,9 +8,9 @@ // Official repository: https://github.com/cppalliance/mrdocs // -#include "DerivedFinalizer.hpp" -#include +#include #include +#include #include namespace clang::mrdocs { @@ -30,8 +30,9 @@ build() { MRDOCS_CHECK_OR_CONTINUE(base.Access == AccessKind::Public); MRDOCS_CHECK_OR_CONTINUE(base.Type); - MRDOCS_CHECK_OR_CONTINUE(base.Type->isNamed()); - auto& namedType = dynamic_cast(*base.Type); + MRDOCS_ASSERT(!base.Type->valueless_after_move()); + MRDOCS_CHECK_OR_CONTINUE((*base.Type)->isNamed()); + auto& namedType = dynamic_cast(**base.Type); MRDOCS_CHECK_OR_CONTINUE(namedType.Name); SymbolID const namedSymbolID = namedType.Name->id; MRDOCS_CHECK_OR_CONTINUE(namedSymbolID != SymbolID::invalid); diff --git a/src/lib/Metadata/Finalizers/DerivedFinalizer.hpp b/src/lib/Metadata/Finalizers/DerivedFinalizer.hpp index 01b07c973..11c802e87 100644 --- a/src/lib/Metadata/Finalizers/DerivedFinalizer.hpp +++ b/src/lib/Metadata/Finalizers/DerivedFinalizer.hpp @@ -9,11 +9,11 @@ // Official repository: https://github.com/cppalliance/mrdocs // -#ifndef MRDOCS_LIB_METADATA_FINALIZER_DERIVEDFINALIZER_HPP -#define MRDOCS_LIB_METADATA_FINALIZER_DERIVEDFINALIZER_HPP +#ifndef MRDOCS_LIB_METADATA_FINALIZERS_DERIVEDFINALIZER_HPP +#define MRDOCS_LIB_METADATA_FINALIZERS_DERIVEDFINALIZER_HPP -#include "lib/CorpusImpl.hpp" -#include "lib/Metadata/InfoSet.hpp" +#include +#include #include namespace clang::mrdocs { @@ -39,4 +39,4 @@ class DerivedFinalizer } // clang::mrdocs -#endif +#endif // MRDOCS_LIB_METADATA_FINALIZERS_DERIVEDFINALIZER_HPP diff --git a/src/lib/Metadata/Finalizers/Javadoc/Function.hpp b/src/lib/Metadata/Finalizers/Javadoc/Function.hpp index 353557e28..cfff7267c 100644 --- a/src/lib/Metadata/Finalizers/Javadoc/Function.hpp +++ b/src/lib/Metadata/Finalizers/Javadoc/Function.hpp @@ -8,13 +8,13 @@ // Official repository: https://github.com/cppalliance/mrdocs // -#ifndef MRDOCS_LIB_METADATA_FINALIZER_JAVADOCFINALIZER_FUNCTION_HPP -#define MRDOCS_LIB_METADATA_FINALIZER_JAVADOCFINALIZER_FUNCTION_HPP +#ifndef MRDOCS_LIB_METADATA_FINALIZERS_JAVADOC_FUNCTION_HPP +#define MRDOCS_LIB_METADATA_FINALIZERS_JAVADOC_FUNCTION_HPP -#include "lib/CorpusImpl.hpp" -#include "lib/Metadata/InfoSet.hpp" -#include +#include +#include #include +#include #include namespace clang::mrdocs { @@ -47,8 +47,10 @@ isCopyOrMoveConstructorOrAssignment(FunctionInfo const& I) } MRDOCS_CHECK_OR(I.Params.size() == 1, false); auto const& param = I.Params[0]; - auto const& paramType = param.Type; - MRDOCS_CHECK_OR(paramType, false); + auto const& paramTypeOpt = param.Type; + MRDOCS_CHECK_OR(paramTypeOpt, false); + auto const& paramType = *paramTypeOpt; + MRDOCS_CHECK_OR(!paramType.valueless_after_move(), false); if constexpr (!move) { MRDOCS_CHECK_OR(paramType->isLValueReference(), false); @@ -59,8 +61,10 @@ isCopyOrMoveConstructorOrAssignment(FunctionInfo const& I) } using RefType = std::conditional_t; auto const& paramRefType = static_cast(*paramType); - auto const& paramRefPointee = paramRefType.PointeeType; - MRDOCS_CHECK_OR(paramRefPointee, false); + auto const& paramRefPointeeOpt = paramRefType.PointeeType; + MRDOCS_CHECK_OR(paramRefPointeeOpt, false); + auto const& paramRefPointee = *paramRefPointeeOpt; + MRDOCS_CHECK_OR(!paramRefPointee.valueless_after_move(), false); auto const *paramRefPointeeNamed = static_cast(&*paramRefPointee); if (!paramRefPointeeNamed) @@ -111,6 +115,13 @@ innermostTypenameString(Polymorphic const& T) return RStr; } +std::optional +innermostTypenameString(Optional> const& T) +{ + MRDOCS_CHECK_OR(T, {}); + return innermostTypenameString(*T); +} + bool populateFunctionBriefFromClass(FunctionInfo& I, CorpusImpl const& corpus) { @@ -196,13 +207,15 @@ isStreamInsertion(FunctionInfo const& function) // Check first param is mutable left reference auto& firstParam = function.Params[0]; MRDOCS_CHECK_OR(firstParam, false); - auto& firstQualType = firstParam.Type; - MRDOCS_CHECK_OR(firstQualType, false); + auto& firstQualTypeOpt = firstParam.Type; + MRDOCS_CHECK_OR(firstQualTypeOpt, false); + auto& firstQualType = *firstQualTypeOpt; MRDOCS_CHECK_OR(firstQualType->isLValueReference(), false); - auto& firstNamedType = + auto& firstNamedTypeOpt = static_cast(*firstQualType) .PointeeType; - MRDOCS_CHECK_OR(firstNamedType, false); + MRDOCS_CHECK_OR(firstNamedTypeOpt, false); + auto& firstNamedType = *firstNamedTypeOpt; MRDOCS_CHECK_OR(firstNamedType->isNamed(), false); // Check return type return firstQualType == function.ReturnType; @@ -343,7 +356,8 @@ populateFunctionReturnsForSpecial( } // Special functions that should return a reference to self - if (I.ReturnType->isLValueReference()) + if (I.ReturnType && + (*I.ReturnType)->isLValueReference()) { Info const* RInfo = getInfo(innerR, corpus); MRDOCS_CHECK_OR(RInfo, false); @@ -353,7 +367,8 @@ populateFunctionReturnsForSpecial( } // Special functions that should return a pointer to self - if (I.ReturnType->isPointer()) + if (I.ReturnType && + (*I.ReturnType)->isPointer()) { Info const* RInfo = getInfo(innerR, corpus); MRDOCS_CHECK_OR(RInfo, false); @@ -373,9 +388,11 @@ populateFunctionReturnsForSpecial( OperatorKind::GreaterEqual, OperatorKind::Exclaim })) { - MRDOCS_CHECK_OR(I.ReturnType->isNamed(), false); + MRDOCS_CHECK_OR(I.ReturnType, false); + MRDOCS_CHECK_OR((*I.ReturnType)->isNamed(), false); + MRDOCS_ASSERT(!I.ReturnType->valueless_after_move()); MRDOCS_CHECK_OR( - static_cast(*I.ReturnType).FundamentalType == + static_cast(**I.ReturnType).FundamentalType == FundamentalTypeKind::Bool, false); doc::Returns r; @@ -428,21 +445,25 @@ populateFunctionReturnsForSpecial( } // Special function that return the same type as the parent - if (I.IsRecordMethod && innerR->isNamed() && - static_cast(*innerR).Name && + if (I.IsRecordMethod && + !innerR.valueless_after_move() && + innerR->isNamed() && + !static_cast(*innerR).Name.valueless_after_move() && static_cast(*innerR).Name->id && static_cast(*innerR).Name->id == I.Parent) { - if (I.ReturnType->isLValueReference()) + MRDOCS_CHECK_OR(I.ReturnType, false); + MRDOCS_ASSERT(!I.ReturnType->valueless_after_move()); + if ((*I.ReturnType)->isLValueReference()) { I.javadoc->returns.emplace_back("Reference to the current object"); } - else if (I.ReturnType->isRValueReference()) + else if ((*I.ReturnType)->isRValueReference()) { I.javadoc->returns.emplace_back( "Rvalue reference to the current object"); } - else if (I.ReturnType->isPointer()) + else if ((*I.ReturnType)->isPointer()) { I.javadoc->returns.emplace_back("Pointer to the current object"); } @@ -481,7 +502,8 @@ populateFunctionReturns(FunctionInfo& I, CorpusImpl const& corpus) // Check if we have a named return type MRDOCS_CHECK_OR(I.ReturnType); - auto& inner = innermostType(I.ReturnType); + MRDOCS_CHECK_OR(!I.ReturnType->valueless_after_move()); + auto& inner = innermostType(*I.ReturnType); MRDOCS_CHECK_OR(inner); if (inner->isNamed()) { @@ -541,7 +563,9 @@ setCntrOrAssignParamName( std::views::transform([](Param const& p) -> std::string_view { return *p.Name; }); - auto& innerP = innermostType(param.Type); + MRDOCS_CHECK_OR(param.Type, false); + MRDOCS_ASSERT(!param.Type->valueless_after_move()); + auto& innerP = innermostType(*param.Type); std::string_view paramName = "value"; if (innerP->namedSymbol() == I.Parent) { @@ -651,7 +675,9 @@ setCntrOrAssignParamDoc( // Set the parameter description if we can MRDOCS_CHECK_OR(param, false); - auto& innerParam = innermostType(param.Type); + MRDOCS_CHECK_OR(param.Type, false); + MRDOCS_ASSERT(!param.Type->valueless_after_move()); + auto& innerParam = innermostType(*param.Type); MRDOCS_CHECK_OR(innerParam, false); MRDOCS_CHECK_OR(innerParam->isNamed(), false); std::string_view const paramNoun @@ -663,13 +689,17 @@ setCntrOrAssignParamDoc( { return !isAssign ? "construct" : "assign"; } - if (param.Type->isLValueReference()) + if (param.Type) { - return !isAssign ? "copy construct" : "copy assign"; - } - if (param.Type->isRValueReference()) - { - return !isAssign ? "move construct" : "move assign"; + MRDOCS_ASSERT(!param.Type->valueless_after_move()); + if ((*param.Type)->isLValueReference()) + { + return !isAssign ? "copy construct" : "copy assign"; + } + if ((*param.Type)->isRValueReference()) + { + return !isAssign ? "move construct" : "move assign"; + } } return !isAssign ? "construct" : "assign"; }(); @@ -759,7 +789,9 @@ setFunctionParamDoc( // param is a named parameter: use the brief of the type // as a description for the parameter - auto const& innerParam = innermostType(param.Type); + MRDOCS_CHECK_OR(param.Type); + MRDOCS_ASSERT(!param.Type->valueless_after_move()); + auto const& innerParam = innermostType(*param.Type); doc::Brief const* paramBrief = getInfoBrief(innerParam, corpus); MRDOCS_CHECK_OR(paramBrief); I.javadoc->params.emplace_back(*param.Name, *paramBrief); @@ -798,4 +830,4 @@ populateFunctionParams(FunctionInfo& I, CorpusImpl const& corpus) } } // clang::mrdocs -#endif +#endif // MRDOCS_LIB_METADATA_FINALIZERS_JAVADOC_FUNCTION_HPP diff --git a/src/lib/Metadata/Finalizers/Javadoc/Overloads.hpp b/src/lib/Metadata/Finalizers/Javadoc/Overloads.hpp index a907edd76..9b8ef1ff1 100644 --- a/src/lib/Metadata/Finalizers/Javadoc/Overloads.hpp +++ b/src/lib/Metadata/Finalizers/Javadoc/Overloads.hpp @@ -8,12 +8,12 @@ // Official repository: https://github.com/cppalliance/mrdocs // -#ifndef MRDOCS_LIB_METADATA_FINALIZER_JAVADOCFINALIZER_OVERLOADS_HPP -#define MRDOCS_LIB_METADATA_FINALIZER_JAVADOCFINALIZER_OVERLOADS_HPP +#ifndef MRDOCS_LIB_METADATA_FINALIZERS_JAVADOC_OVERLOADS_HPP +#define MRDOCS_LIB_METADATA_FINALIZERS_JAVADOC_OVERLOADS_HPP -#include "lib/CorpusImpl.hpp" -#include "lib/Metadata/InfoSet.hpp" -#include "Function.hpp" +#include +#include +#include #include namespace clang::mrdocs { @@ -367,4 +367,4 @@ populateOverloadsPostconditions(OverloadsInfo& I, Range& functions) { } } // clang::mrdocs -#endif +#endif // MRDOCS_LIB_METADATA_FINALIZERS_JAVADOC_OVERLOADS_HPP diff --git a/src/lib/Metadata/Finalizers/JavadocFinalizer.cpp b/src/lib/Metadata/Finalizers/JavadocFinalizer.cpp index 4b7a16446..0b3ae2dd1 100644 --- a/src/lib/Metadata/Finalizers/JavadocFinalizer.cpp +++ b/src/lib/Metadata/Finalizers/JavadocFinalizer.cpp @@ -9,13 +9,13 @@ // Official repository: https://github.com/cppalliance/mrdocs // -#include "JavadocFinalizer.hpp" -#include "Javadoc/Function.hpp" -#include "Javadoc/Overloads.hpp" -#include -#include +#include +#include +#include #include #include +#include +#include namespace clang::mrdocs { @@ -233,7 +233,8 @@ setAutoBrief(Javadoc& javadoc) const MRDOCS_CHECK_OR(!javadoc.blocks.empty()); auto isInvalidBriefText = [](Polymorphic const& text) { - return !text || text->string.empty() + return text.valueless_after_move() + || text->string.empty() || text->Kind == doc::NodeKind::copy_details || isWhitespace(text->string); }; @@ -718,7 +719,10 @@ finalizeInfoData(InfoTy& I) } if constexpr (requires { I.ReturnType; }) { - finalize(I.ReturnType); + if (I.ReturnType) + { + finalize(**I.ReturnType); + } } if constexpr (requires { I.Params; }) { @@ -726,11 +730,17 @@ finalizeInfoData(InfoTy& I) } if constexpr (requires { I.Type; }) { - finalize(I.Type); + if (I.Type) + { + finalize(**I.Type); + } } if constexpr (requires { I.UnderlyingType; }) { - finalize(I.UnderlyingType); + if (I.UnderlyingType) + { + finalize(**I.UnderlyingType); + } } if constexpr (requires { I.FriendSymbol; }) { @@ -742,11 +752,17 @@ finalizeInfoData(InfoTy& I) } if constexpr (requires { I.AliasedSymbol; }) { - finalize(I.AliasedSymbol); + if (I.AliasedSymbol) + { + finalize(**I.AliasedSymbol); + } } if constexpr (requires { I.IntroducedName; }) { - finalize(I.IntroducedName); + if (!I.IntroducedName.valueless_after_move()) + { + finalize(*I.IntroducedName); + } } if constexpr (requires { I.ShadowDeclarations; }) { @@ -754,7 +770,10 @@ finalizeInfoData(InfoTy& I) } if constexpr (requires { I.Deduced; }) { - finalize(I.Deduced); + if (I.Deduced) + { + finalize(**I.Deduced); + } } } @@ -1245,7 +1264,7 @@ setAutoRelates() // 1) Inner type of the first parameter [&] { MRDOCS_CHECK_OR(!I.Params.empty()); - auto* firstParamInfo = toRecordOrEnum(I.Params.front().Type); + auto* firstParamInfo = toRecordOrEnum(*I.Params.front().Type); MRDOCS_CHECK_OR(firstParamInfo); if (firstParamInfo->Extraction == ExtractionMode::Regular) { @@ -1256,15 +1275,15 @@ setAutoRelates() MRDOCS_CHECK_OR(firstParamInfo->isRecord()); auto const* firstParamRecord = dynamic_cast(firstParamInfo); MRDOCS_CHECK_OR( - I.Params.front().Type->isLValueReference() || - I.Params.front().Type->isRValueReference() || - I.Params.front().Type->isPointer()); + (*I.Params.front().Type)->isLValueReference() || + (*I.Params.front().Type)->isRValueReference() || + (*I.Params.front().Type)->isPointer()); // Get all transitively derived classes of firstParamRecord pushAllDerivedClasses(firstParamRecord, relatedRecordsOrEnums, corpus_); }(); // 3) The return type of the function - if (auto* returnTypeInfo = toRecordOrEnum(I.ReturnType)) + if (auto* returnTypeInfo = toRecordOrEnum(*I.ReturnType)) { if (returnTypeInfo->Extraction == ExtractionMode::Regular) { @@ -1275,16 +1294,16 @@ setAutoRelates() // each template parameter is also a related record [&] { MRDOCS_CHECK_OR(I.ReturnType); - MRDOCS_CHECK_OR(I.ReturnType->isNamed()); - auto& NTI = static_cast(*I.ReturnType); + MRDOCS_CHECK_OR((*I.ReturnType)->isNamed()); + auto& NTI = dynamic_cast(**I.ReturnType); MRDOCS_CHECK_OR(NTI.Name); MRDOCS_CHECK_OR(NTI.Name->isSpecialization()); - auto const& NTIS = static_cast(*NTI.Name); + auto const& NTIS = dynamic_cast(*NTI.Name); MRDOCS_CHECK_OR(!NTIS.TemplateArgs.empty()); Polymorphic const& firstArg = NTIS.TemplateArgs.front(); MRDOCS_CHECK_OR(firstArg->isType()); - auto const& typeArg = static_cast(*firstArg); - if (auto* argInfo = toRecordOrEnum(typeArg.Type)) + auto const& typeArg = dynamic_cast(*firstArg); + if (auto* argInfo = toRecordOrEnum(*typeArg.Type)) { if (argInfo->Extraction == ExtractionMode::Regular) { @@ -1532,7 +1551,10 @@ finalize(TArg& arg) { if constexpr (Ty::isType()) { - finalize(A.Type); + if (A.Type) + { + finalize(**A.Type); + } } if constexpr (Ty::isTemplate()) { @@ -1545,18 +1567,26 @@ void JavadocFinalizer:: finalize(TParam& param) { - finalize(param.Default); - + if (param.Default) + { + finalize(**param.Default); + } visit(param, [this](Ty& P) { if constexpr (Ty::isType()) { - finalize(P.Constraint); + if (P.Constraint) + { + finalize(**P.Constraint); + } } if constexpr (Ty::isNonType()) { - finalize(P.Type); + if (P.Type) + { + finalize(**P.Type); + } } if constexpr (Ty::isTemplate()) @@ -1570,14 +1600,20 @@ void JavadocFinalizer:: finalize(Param& param) { - finalize(param.Type); + if (param.Type) + { + finalize(**param.Type); + } } void JavadocFinalizer:: finalize(BaseInfo& info) { - finalize(info.Type); + if (info.Type) + { + finalize(**info.Type); + } } void @@ -1787,7 +1823,7 @@ warnNoParamDocs(FunctionInfo const& I) } return false; }; - if (!isVoid(*I.ReturnType)) + if (!isVoid(**I.ReturnType)) { this->warn( *getPrimaryLocation(I), diff --git a/src/lib/Metadata/Finalizers/JavadocFinalizer.hpp b/src/lib/Metadata/Finalizers/JavadocFinalizer.hpp index 6b3743564..b0814aab8 100644 --- a/src/lib/Metadata/Finalizers/JavadocFinalizer.hpp +++ b/src/lib/Metadata/Finalizers/JavadocFinalizer.hpp @@ -9,14 +9,14 @@ // Official repository: https://github.com/cppalliance/mrdocs // -#ifndef MRDOCS_LIB_METADATA_FINALIZER_JAVADOCFINALIZER_HPP -#define MRDOCS_LIB_METADATA_FINALIZER_JAVADOCFINALIZER_HPP +#ifndef MRDOCS_LIB_METADATA_FINALIZERS_JAVADOCFINALIZER_HPP +#define MRDOCS_LIB_METADATA_FINALIZERS_JAVADOCFINALIZER_HPP -#include "lib/CorpusImpl.hpp" -#include "lib/Metadata/InfoSet.hpp" -#include +#include +#include #include #include +#include #include #include @@ -337,6 +337,27 @@ class JavadocFinalizer void finalize(NameInfo& name); + /// Finalize polymorphic + template + void + finalize(Polymorphic&& val) + { + if (!val.valueless_after_move()) + { + finalize(*val); + } + } + + template + void + finalize(Polymorphic& val) + { + if (!val.valueless_after_move()) + { + finalize(*val); + } + } + /// Finalize optional and pointer-like members template void @@ -431,4 +452,4 @@ class JavadocFinalizer } // clang::mrdocs -#endif +#endif // MRDOCS_LIB_METADATA_FINALIZERS_JAVADOCFINALIZER_HPP diff --git a/src/lib/Metadata/Finalizers/NamespacesFinalizer.hpp b/src/lib/Metadata/Finalizers/NamespacesFinalizer.hpp index 421e3aa46..30e040384 100644 --- a/src/lib/Metadata/Finalizers/NamespacesFinalizer.hpp +++ b/src/lib/Metadata/Finalizers/NamespacesFinalizer.hpp @@ -8,11 +8,11 @@ // Official repository: https://github.com/cppalliance/mrdocs // -#ifndef MRDOCS_LIB_METADATA_FINALIZER_NAMESPACESFINALIZER_HPP -#define MRDOCS_LIB_METADATA_FINALIZER_NAMESPACESFINALIZER_HPP +#ifndef MRDOCS_LIB_METADATA_FINALIZERS_NAMESPACESFINALIZER_HPP +#define MRDOCS_LIB_METADATA_FINALIZERS_NAMESPACESFINALIZER_HPP -#include "lib/Metadata/InfoSet.hpp" -#include "lib/CorpusImpl.hpp" +#include +#include namespace clang::mrdocs { @@ -54,4 +54,4 @@ class NamespacesFinalizer } // clang::mrdocs -#endif +#endif // MRDOCS_LIB_METADATA_FINALIZERS_NAMESPACESFINALIZER_HPP diff --git a/src/lib/Metadata/Finalizers/OverloadsFinalizer.cpp b/src/lib/Metadata/Finalizers/OverloadsFinalizer.cpp index eca1d1096..3d377dd2c 100644 --- a/src/lib/Metadata/Finalizers/OverloadsFinalizer.cpp +++ b/src/lib/Metadata/Finalizers/OverloadsFinalizer.cpp @@ -27,7 +27,8 @@ findBaseClassPermutation( for (auto const& base: info->asRecordPtr()->Bases) { // Find the i-th base class - auto const baseInfo = corpus.find(base.Type->namedSymbol()); + MRDOCS_CHECK_OR(base.Type, SymbolID::invalid); + auto const baseInfo = corpus.find((*base.Type)->namedSymbol()); MRDOCS_CHECK_OR_CONTINUE(baseInfo); auto const baseRecord = baseInfo->asRecordPtr(); MRDOCS_CHECK_OR_CONTINUE(baseRecord); @@ -290,8 +291,8 @@ operator()(RecordInfo& I) { auto& BT = b.Type; MRDOCS_CHECK_OR(BT); - MRDOCS_CHECK_OR(BT->isNamed()); - auto& NT = dynamic_cast(*BT); + MRDOCS_CHECK_OR((*BT)->isNamed()); + auto& NT = dynamic_cast(**BT); MRDOCS_CHECK_OR(NT.Name); auto& NI = dynamic_cast(*NT.Name); MRDOCS_CHECK_OR(NI.id); diff --git a/src/lib/Metadata/Finalizers/OverloadsFinalizer.hpp b/src/lib/Metadata/Finalizers/OverloadsFinalizer.hpp index 189417538..10b3c2e53 100644 --- a/src/lib/Metadata/Finalizers/OverloadsFinalizer.hpp +++ b/src/lib/Metadata/Finalizers/OverloadsFinalizer.hpp @@ -8,11 +8,11 @@ // Official repository: https://github.com/cppalliance/mrdocs // -#ifndef MRDOCS_LIB_METADATA_FINALIZER_OVERLOADSFINALIZER_HPP -#define MRDOCS_LIB_METADATA_FINALIZER_OVERLOADSFINALIZER_HPP +#ifndef MRDOCS_LIB_METADATA_FINALIZERS_OVERLOADSFINALIZER_HPP +#define MRDOCS_LIB_METADATA_FINALIZERS_OVERLOADSFINALIZER_HPP -#include "lib/Metadata/InfoSet.hpp" -#include "lib/CorpusImpl.hpp" +#include +#include namespace clang::mrdocs { @@ -72,4 +72,4 @@ class OverloadsFinalizer } // clang::mrdocs -#endif +#endif // MRDOCS_LIB_METADATA_FINALIZERS_OVERLOADSFINALIZER_HPP diff --git a/src/lib/Metadata/Finalizers/SortMembersFinalizer.cpp b/src/lib/Metadata/Finalizers/SortMembersFinalizer.cpp index 3045ab1bd..f8b36b38e 100644 --- a/src/lib/Metadata/Finalizers/SortMembersFinalizer.cpp +++ b/src/lib/Metadata/Finalizers/SortMembersFinalizer.cpp @@ -9,8 +9,8 @@ // #include "SortMembersFinalizer.hpp" -#include #include +#include namespace clang::mrdocs { @@ -171,18 +171,22 @@ struct SymbolIDCompareFn if (I.Params.size() == 1) { auto const& param = I.Params[0]; - auto const& paramType = param.Type; + auto const& paramTypeOpt = param.Type; + MRDOCS_CHECK_OR(paramTypeOpt, false); + auto const& paramType = *paramTypeOpt; if (!paramType->isLValueReference() && !paramType->isRValueReference()) { return false; } - auto const ¶mRefPointee = + auto const ¶mRefPointeeOpt = paramType->isLValueReference() ? static_cast(*paramType) .PointeeType : static_cast(*paramType) .PointeeType; + MRDOCS_CHECK_OR(paramRefPointeeOpt, false); + auto const& paramRefPointee = *paramRefPointeeOpt; if (!paramRefPointee->isNamed()) { return false; @@ -202,8 +206,10 @@ struct SymbolIDCompareFn // Ensure move comes after copy if (lhsIsCopyOrMove && rhsIsCopyOrMove) { - bool const lhsIsMove = lhsF.Params[0].Type->isRValueReference(); - bool const rhsIsMove = rhsF.Params[0].Type->isRValueReference(); + MRDOCS_CHECK_OR(!lhsF.Params[0].Type, false); + MRDOCS_CHECK_OR(!rhsF.Params[0].Type, true); + bool const lhsIsMove = (*lhsF.Params[0].Type)->isRValueReference(); + bool const rhsIsMove = (*rhsF.Params[0].Type)->isRValueReference(); if (lhsIsMove != rhsIsMove) { return !lhsIsMove; diff --git a/src/lib/Metadata/Finalizers/SortMembersFinalizer.hpp b/src/lib/Metadata/Finalizers/SortMembersFinalizer.hpp index be01754d7..283dc0187 100644 --- a/src/lib/Metadata/Finalizers/SortMembersFinalizer.hpp +++ b/src/lib/Metadata/Finalizers/SortMembersFinalizer.hpp @@ -8,11 +8,11 @@ // Official repository: https://github.com/cppalliance/mrdocs // -#ifndef MRDOCS_LIB_METADATA_FINALIZER_SORTMEMBERSFINALIZER_HPP -#define MRDOCS_LIB_METADATA_FINALIZER_SORTMEMBERSFINALIZER_HPP +#ifndef MRDOCS_LIB_METADATA_FINALIZERS_SORTMEMBERSFINALIZER_HPP +#define MRDOCS_LIB_METADATA_FINALIZERS_SORTMEMBERSFINALIZER_HPP -#include "lib/Metadata/InfoSet.hpp" -#include "lib/CorpusImpl.hpp" +#include +#include namespace clang::mrdocs { @@ -78,4 +78,4 @@ class SortMembersFinalizer } // clang::mrdocs -#endif +#endif // MRDOCS_LIB_METADATA_FINALIZERS_SORTMEMBERSFINALIZER_HPP diff --git a/src/lib/Metadata/Info.cpp b/src/lib/Metadata/Info.cpp index aecbce349..20c52b5c6 100644 --- a/src/lib/Metadata/Info.cpp +++ b/src/lib/Metadata/Info.cpp @@ -10,17 +10,17 @@ // Official repository: https://github.com/cppalliance/mrdocs // +#include #include #include -#include "lib/Support/Radix.hpp" -#include -#include -#include -#include #include #include #include #include +#include +#include +#include +#include namespace clang::mrdocs { diff --git a/src/lib/Metadata/Info/Concept.cpp b/src/lib/Metadata/Info/Concept.cpp index a0cdb3a9c..e3762af31 100644 --- a/src/lib/Metadata/Info/Concept.cpp +++ b/src/lib/Metadata/Info/Concept.cpp @@ -9,8 +9,8 @@ // Official repository: https://github.com/cppalliance/mrdocs // -#include #include +#include #include namespace clang::mrdocs { diff --git a/src/lib/Metadata/Info/Enum.cpp b/src/lib/Metadata/Info/Enum.cpp index 47405e1f5..e94e789dc 100644 --- a/src/lib/Metadata/Info/Enum.cpp +++ b/src/lib/Metadata/Info/Enum.cpp @@ -9,8 +9,8 @@ // Official repository: https://github.com/cppalliance/mrdocs // -#include #include +#include #include namespace clang::mrdocs { diff --git a/src/lib/Metadata/Info/EnumConstant.cpp b/src/lib/Metadata/Info/EnumConstant.cpp index 558ed222b..08979b448 100644 --- a/src/lib/Metadata/Info/EnumConstant.cpp +++ b/src/lib/Metadata/Info/EnumConstant.cpp @@ -9,8 +9,8 @@ // Official repository: https://github.com/cppalliance/mrdocs // -#include #include +#include #include namespace clang::mrdocs { diff --git a/src/lib/Metadata/Info/Friend.cpp b/src/lib/Metadata/Info/Friend.cpp index 167304de6..4dbe59d49 100644 --- a/src/lib/Metadata/Info/Friend.cpp +++ b/src/lib/Metadata/Info/Friend.cpp @@ -9,8 +9,8 @@ // Official repository: https://github.com/cppalliance/mrdocs // -#include #include +#include #include namespace clang::mrdocs { diff --git a/src/lib/Metadata/Info/Function.cpp b/src/lib/Metadata/Info/Function.cpp index 12e6912a6..3a79a95fe 100644 --- a/src/lib/Metadata/Info/Function.cpp +++ b/src/lib/Metadata/Info/Function.cpp @@ -10,10 +10,10 @@ // Official repository: https://github.com/cppalliance/mrdocs // -#include #include #include #include +#include namespace clang::mrdocs { diff --git a/src/lib/Metadata/Info/Guide.cpp b/src/lib/Metadata/Info/Guide.cpp index 391f0bb95..ef3b232e5 100644 --- a/src/lib/Metadata/Info/Guide.cpp +++ b/src/lib/Metadata/Info/Guide.cpp @@ -9,9 +9,11 @@ // Official repository: https://github.com/cppalliance/mrdocs // -#include #include +#include +#include #include +#include namespace clang::mrdocs { @@ -47,11 +49,19 @@ operator<=>(GuideInfo const& other) const return cmp; } } - if (auto const cmp = Params <=> other.Params; + if (auto const cmp = Params.size() <=> other.Params.size(); !std::is_eq(cmp)) { return cmp; } + for (size_t i = 0; i < Params.size(); ++i) + { + if (auto const cmp = Params[i] <=> other.Params[i]; + !std::is_eq(cmp)) + { + return cmp; + } + } if (Template && other.Template) { if (auto const cmp = Template->Args <=> other.Template->Args; diff --git a/src/lib/Metadata/Info/Namespace.cpp b/src/lib/Metadata/Info/Namespace.cpp index 5ae737ac8..3fcebcee2 100644 --- a/src/lib/Metadata/Info/Namespace.cpp +++ b/src/lib/Metadata/Info/Namespace.cpp @@ -9,8 +9,8 @@ // Official repository: https://github.com/cppalliance/mrdocs // -#include #include +#include #include namespace clang::mrdocs { diff --git a/src/lib/Metadata/Info/NamespaceAlias.cpp b/src/lib/Metadata/Info/NamespaceAlias.cpp index a8afd5897..ee20ac9bc 100644 --- a/src/lib/Metadata/Info/NamespaceAlias.cpp +++ b/src/lib/Metadata/Info/NamespaceAlias.cpp @@ -9,8 +9,8 @@ // Official repository: https://github.com/cppalliance/mrdocs // -#include #include +#include #include namespace clang::mrdocs { diff --git a/src/lib/Metadata/Info/Overloads.cpp b/src/lib/Metadata/Info/Overloads.cpp index fb27ba057..a8f567ddd 100644 --- a/src/lib/Metadata/Info/Overloads.cpp +++ b/src/lib/Metadata/Info/Overloads.cpp @@ -8,16 +8,16 @@ // Official repository: https://github.com/cppalliance/mrdocs // -#include "lib/Support/Radix.hpp" -#include -#include -#include +#include #include #include #include #include #include #include +#include +#include +#include namespace clang::mrdocs { diff --git a/src/lib/Metadata/Info/Record.cpp b/src/lib/Metadata/Info/Record.cpp index 2d95ca8ff..89216ea30 100644 --- a/src/lib/Metadata/Info/Record.cpp +++ b/src/lib/Metadata/Info/Record.cpp @@ -170,7 +170,12 @@ tag_invoke( io.map("isPrivate", I.Access == AccessKind::Private); io.map("isVirtual", I.IsVirtual); io.map("type", dom::ValueFrom(I.Type, domCorpus)); - io.map("symbol", I.Type->namedSymbol()); + if (I.Type) + { + MRDOCS_ASSERT(!I.Type->valueless_after_move()); + io.map("symbol", (*I.Type)->namedSymbol()); + } + } void diff --git a/src/lib/Metadata/Info/Typedef.cpp b/src/lib/Metadata/Info/Typedef.cpp index 47f13cd2b..22809f4b9 100644 --- a/src/lib/Metadata/Info/Typedef.cpp +++ b/src/lib/Metadata/Info/Typedef.cpp @@ -9,9 +9,9 @@ // Official repository: https://github.com/cppalliance/mrdocs // -#include -#include #include +#include +#include #include namespace clang::mrdocs { diff --git a/src/lib/Metadata/Info/Using.cpp b/src/lib/Metadata/Info/Using.cpp index 583d7f44d..6b24d8f6e 100644 --- a/src/lib/Metadata/Info/Using.cpp +++ b/src/lib/Metadata/Info/Using.cpp @@ -9,8 +9,8 @@ // Official repository: https://github.com/cppalliance/mrdocs // -#include #include +#include #include namespace clang::mrdocs { @@ -44,7 +44,8 @@ merge(UsingInfo& I, UsingInfo&& Other) { I.Class = Other.Class; } - if (!I.IntroducedName) + if (I.IntroducedName.valueless_after_move() || + I.IntroducedName->Name.empty()) { I.IntroducedName = std::move(Other.IntroducedName); } diff --git a/src/lib/Metadata/Info/Variable.cpp b/src/lib/Metadata/Info/Variable.cpp index 76474bcaf..5a6d6435b 100644 --- a/src/lib/Metadata/Info/Variable.cpp +++ b/src/lib/Metadata/Info/Variable.cpp @@ -9,8 +9,8 @@ // Official repository: https://github.com/cppalliance/mrdocs // -#include #include +#include #include namespace clang::mrdocs { diff --git a/src/lib/Metadata/InfoSet.hpp b/src/lib/Metadata/InfoSet.hpp index 5573304cb..e6919ad30 100644 --- a/src/lib/Metadata/InfoSet.hpp +++ b/src/lib/Metadata/InfoSet.hpp @@ -10,11 +10,11 @@ // Official repository: https://github.com/cppalliance/mrdocs // -#ifndef MRDOCS_LIB_TOOL_INFOSET_HPP -#define MRDOCS_LIB_TOOL_INFOSET_HPP +#ifndef MRDOCS_LIB_METADATA_INFOSET_HPP +#define MRDOCS_LIB_METADATA_INFOSET_HPP -#include "mrdocs/Platform.hpp" -#include "mrdocs/Metadata/Info.hpp" +#include +#include #include #include @@ -181,4 +181,4 @@ using UndocumentedInfoSet = std::unordered_set< } // clang::mrdocs -#endif +#endif // MRDOCS_LIB_METADATA_INFOSET_HPP diff --git a/src/lib/Metadata/Javadoc.cpp b/src/lib/Metadata/Javadoc.cpp index 700884f25..668442b7e 100644 --- a/src/lib/Metadata/Javadoc.cpp +++ b/src/lib/Metadata/Javadoc.cpp @@ -10,13 +10,14 @@ // Official repository: https://github.com/cppalliance/mrdocs // -#include "lib/Support/Debug.hpp" -#include -#include -#include +#include #include #include #include +#include +#include +#include +#include namespace clang { namespace mrdocs { @@ -182,7 +183,7 @@ append(std::vector> const& otherChildren) std::strong_ordering operator<=>(Polymorphic const& lhs, Polymorphic const& rhs) { - if (lhs && rhs) + if (!lhs.valueless_after_move() && !rhs.valueless_after_move()) { if (lhs->Kind == rhs->Kind) { @@ -190,12 +191,13 @@ operator<=>(Polymorphic const& lhs, Polymorphic const& rhs) } return lhs->Kind <=> rhs->Kind; } - if (!lhs && !rhs) + if (lhs.valueless_after_move() && rhs.valueless_after_move()) { return std::strong_ordering::equal; } - return !lhs ? std::strong_ordering::less - : std::strong_ordering::greater; + return lhs.valueless_after_move() ? + std::strong_ordering::less : + std::strong_ordering::greater; } Paragraph& @@ -384,7 +386,7 @@ append(std::vector>&& blocks) } else { - blockAsNode = std::nullopt; + Polymorphic tmp = std::move(blockAsNode); } } } diff --git a/src/lib/Metadata/Name.cpp b/src/lib/Metadata/Name.cpp index e9e0e97ee..6202f5f30 100644 --- a/src/lib/Metadata/Name.cpp +++ b/src/lib/Metadata/Name.cpp @@ -9,11 +9,11 @@ // Official repository: https://github.com/cppalliance/mrdocs // -#include #include #include #include #include +#include namespace clang::mrdocs { @@ -43,15 +43,33 @@ std::strong_ordering NameInfo:: operator<=>(NameInfo const& other) const { - return - std::tie(Kind, Name, Prefix) <=> - std::tie(other.Kind, other.Name, other.Prefix); + if (this == &other) + { + return std::strong_ordering::equal; + } + if (Kind != other.Kind) + { + return Kind <=> other.Kind; + } + if (Name != other.Name) + { + return Name <=> other.Name; + } + if (bool(Prefix) != bool(other.Prefix)) + { + return bool(Prefix) <=> bool(other.Prefix); + } + if (Prefix && other.Prefix) + { + return *Prefix <=> *other.Prefix; + } + return std::strong_ordering::equal; } std::strong_ordering operator<=>(Polymorphic const& lhs, Polymorphic const& rhs) { - if (lhs && rhs) + if (!lhs.valueless_after_move() && !rhs.valueless_after_move()) { if (lhs->Kind == rhs->Kind) { @@ -63,12 +81,14 @@ operator<=>(Polymorphic const& lhs, Polymorphic const& rhs) } return lhs->Kind <=> rhs->Kind; } - if (!lhs && !rhs) + if (lhs.valueless_after_move() && + rhs.valueless_after_move()) { return std::strong_ordering::equal; } - return !lhs ? std::strong_ordering::less - : std::strong_ordering::greater; + return lhs.valueless_after_move() ? + std::strong_ordering::less : + std::strong_ordering::greater; } static @@ -79,7 +99,7 @@ toStringImpl( { if (N.Prefix) { - toStringImpl(result, *N.Prefix); + toStringImpl(result, **N.Prefix); writeTo(result, "::"); } @@ -99,8 +119,11 @@ toStringImpl( { if constexpr(U::isType()) { - if(u.Type) - writeTo(result, toString(*u.Type)); + if (u.Type) + { + MRDOCS_ASSERT(!u.Type->valueless_after_move()); + writeTo(result, toString(**u.Type)); + } } if constexpr(U::isNonType()) { diff --git a/src/lib/Metadata/Source.cpp b/src/lib/Metadata/Source.cpp index 55e0427da..ae8e402f7 100644 --- a/src/lib/Metadata/Source.cpp +++ b/src/lib/Metadata/Source.cpp @@ -11,9 +11,9 @@ #include #include -#include +#include #include -#include +#include namespace clang::mrdocs { diff --git a/src/lib/Metadata/Specifiers.cpp b/src/lib/Metadata/Specifiers.cpp index 38b7b97f6..dce87235e 100644 --- a/src/lib/Metadata/Specifiers.cpp +++ b/src/lib/Metadata/Specifiers.cpp @@ -8,9 +8,9 @@ // Official repository: https://github.com/cppalliance/mrdocs // -#include "mrdocs/Support/Algorithm.hpp" -#include #include +#include +#include namespace clang { namespace mrdocs { diff --git a/src/lib/Metadata/SymbolID.cpp b/src/lib/Metadata/SymbolID.cpp index d9aca9eda..442978797 100644 --- a/src/lib/Metadata/SymbolID.cpp +++ b/src/lib/Metadata/SymbolID.cpp @@ -9,13 +9,13 @@ // Official repository: https://github.com/cppalliance/mrdocs // -#include +#include #include #include -#include +#include +#include #include #include -#include namespace clang { namespace mrdocs { diff --git a/src/lib/Metadata/Template.cpp b/src/lib/Metadata/Template.cpp index 51cd3d15d..5aad05a58 100644 --- a/src/lib/Metadata/Template.cpp +++ b/src/lib/Metadata/Template.cpp @@ -73,7 +73,7 @@ toString( std::strong_ordering operator<=>(Polymorphic const& lhs, Polymorphic const& rhs) { - if (lhs && rhs) + if (!lhs.valueless_after_move() && !rhs.valueless_after_move()) { if (lhs->Kind == rhs->Kind) { @@ -81,8 +81,9 @@ operator<=>(Polymorphic const& lhs, Polymorphic const& rhs) } return lhs->Kind <=> rhs->Kind; } - return !lhs ? std::strong_ordering::less - : std::strong_ordering::greater; + return lhs.valueless_after_move() ? + std::strong_ordering::less : + std::strong_ordering::greater; } std::string_view @@ -105,7 +106,7 @@ toString( std::strong_ordering operator<=>(Polymorphic const& lhs, Polymorphic const& rhs) { - if (lhs && rhs) + if (!lhs.valueless_after_move() && !rhs.valueless_after_move()) { if (lhs->Kind == rhs->Kind) { @@ -113,8 +114,9 @@ operator<=>(Polymorphic const& lhs, Polymorphic const& rhs) } return lhs->Kind <=> rhs->Kind; } - return !lhs ? std::strong_ordering::less - : std::strong_ordering::greater; + return lhs.valueless_after_move() ? + std::strong_ordering::less : + std::strong_ordering::greater; } std::string @@ -127,8 +129,11 @@ toString( std::string result; if constexpr(T::isType()) { - if(t.Type) - result += toString(*t.Type); + if (t.Type) + { + MRDOCS_ASSERT(!t.Type->valueless_after_move()); + result += toString(**t.Type); + } } if constexpr(T::isNonType()) { @@ -225,7 +230,7 @@ tag_invoke( visit(I, [domCorpus, &io](T const& t) { if(t.Default) { - io.map("default", t.Default); + io.map("default", **t.Default); } if constexpr(T::isType()) { @@ -279,7 +284,8 @@ merge(TemplateInfo& I, TemplateInfo&& Other) std::size_t const pn = std::min(I.Params.size(), Other.Params.size()); for (std::size_t i = 0; i < pn; ++i) { - if (!I.Params[i] || I.Params[i]->Kind != Other.Params[i]->Kind) + if (I.Params[i].valueless_after_move() || + I.Params[i]->Kind != Other.Params[i]->Kind) { I.Params[i] = std::move(Other.Params[i]); } @@ -306,7 +312,8 @@ merge(TemplateInfo& I, TemplateInfo&& Other) std::size_t const an = std::min(I.Args.size(), Other.Args.size()); for (std::size_t i = 0; i < an; ++i) { - if (!I.Args[i] || I.Args[i]->Kind != Other.Args[i]->Kind) + if (I.Args[i].valueless_after_move() || + I.Args[i]->Kind != Other.Args[i]->Kind) { I.Args[i] = std::move(Other.Args[i]); } diff --git a/src/lib/Metadata/Type.cpp b/src/lib/Metadata/Type.cpp index 0a9d2c262..ffd067b91 100644 --- a/src/lib/Metadata/Type.cpp +++ b/src/lib/Metadata/Type.cpp @@ -12,6 +12,7 @@ #include #include #include +#include namespace clang::mrdocs { @@ -87,7 +88,7 @@ namedSymbol() const noexcept return SymbolID::invalid; } auto const* NT = dynamic_cast(this); - if (!NT->Name) + if (NT->Name.valueless_after_move()) { return SymbolID::invalid; } @@ -173,7 +174,7 @@ operator()( { if(t.ParentType) { - writeFullType(*t.ParentType, write); + writeFullType(**t.ParentType, write); write("::"); } } @@ -183,8 +184,10 @@ operator()( if constexpr(T::isAuto()) { - if(t.Constraint) - write(toString(*t.Constraint), ' '); + if (t.Constraint) + { + write(toString(**t.Constraint), ' '); + } switch(t.Keyword) { case AutoKind::Auto: @@ -756,7 +759,7 @@ makeChar(FundamentalTypeKind& kind) noexcept std::strong_ordering operator<=>(Polymorphic const& lhs, Polymorphic const& rhs) { - if (lhs && rhs) + if (!lhs.valueless_after_move() && !rhs.valueless_after_move()) { auto& lhsRef = *lhs; auto& rhsRef = *rhs; @@ -766,8 +769,9 @@ operator<=>(Polymorphic const& lhs, Polymorphic const& rhs) } return lhsRef.Kind <=> rhsRef.Kind; } - return !lhs ? std::strong_ordering::less - : std::strong_ordering::greater; + return lhs.valueless_after_move() ? + std::strong_ordering::less : + std::strong_ordering::greater; } namespace { @@ -786,15 +790,24 @@ innerTypeImpl(TypeInfoTy&& TI) noexcept { if constexpr(requires { t.PointeeType; }) { - return &t.PointeeType; + if (t.PointeeType) + { + return &*t.PointeeType; + } } if constexpr(requires { t.ElementType; }) { - return &t.ElementType; + if (t.ElementType) + { + return &*t.ElementType; + } } if constexpr(requires { t.ReturnType; }) { - return &t.ReturnType; + if (t.ReturnType) + { + return &*t.ReturnType; + } } return nullptr; }); @@ -835,7 +848,7 @@ requires std::same_as, Polymorphicget(); - if (!ref || + if (ref.valueless_after_move() || ref->isNamed()) { return ref; diff --git a/src/lib/MrDocsCompilationDatabase.cpp b/src/lib/MrDocsCompilationDatabase.cpp index e565db784..ef5e0f315 100644 --- a/src/lib/MrDocsCompilationDatabase.cpp +++ b/src/lib/MrDocsCompilationDatabase.cpp @@ -10,21 +10,21 @@ // #include "MrDocsCompilationDatabase.hpp" -#include "lib/ConfigImpl.hpp" -#include "lib/Support/Debug.hpp" -#include "lib/Support/ExecuteAndWaitWithLogging.hpp" -#include "lib/Support/Path.hpp" +#include +#include +#include +#include +#include #include #include #include #include -#include #include #include #include #include #include -#include +#include #include namespace clang { diff --git a/src/lib/MrDocsCompilationDatabase.hpp b/src/lib/MrDocsCompilationDatabase.hpp index 490955ad2..097ae5c0a 100644 --- a/src/lib/MrDocsCompilationDatabase.hpp +++ b/src/lib/MrDocsCompilationDatabase.hpp @@ -8,8 +8,8 @@ // Official repository: https://github.com/cppalliance/mrdocs // -#ifndef MRDOCS_LIB_TOOL_MR_DOCS_COMPILATION_DATABASE_HPP -#define MRDOCS_LIB_TOOL_MR_DOCS_COMPILATION_DATABASE_HPP +#ifndef MRDOCS_LIB_MRDOCSCOMPILATIONDATABASE_HPP +#define MRDOCS_LIB_MRDOCSCOMPILATIONDATABASE_HPP #include #include @@ -85,5 +85,5 @@ class MrDocsCompilationDatabase } // mrdocs } // clang -#endif // MRDOCS_LIB_TOOL_MR_DOCS_COMPILATION_DATABASE_HPP +#endif // MRDOCS_LIB_MRDOCSCOMPILATIONDATABASE_HPP diff --git a/src/lib/MrDocsSettingsDB.hpp b/src/lib/MrDocsSettingsDB.hpp index ad3f14fe1..1e8477842 100644 --- a/src/lib/MrDocsSettingsDB.hpp +++ b/src/lib/MrDocsSettingsDB.hpp @@ -11,9 +11,9 @@ #ifndef MRDOCS_LIB_MRDOCSSETTINGSDB_HPP #define MRDOCS_LIB_MRDOCSSETTINGSDB_HPP +#include #include #include -#include "ConfigImpl.hpp" #include #include #include diff --git a/src/lib/Support/Assert.cpp b/src/lib/Support/Assert.cpp index d54ba7bac..8347a34fe 100644 --- a/src/lib/Support/Assert.cpp +++ b/src/lib/Support/Assert.cpp @@ -8,10 +8,10 @@ // Official repository: https://github.com/cppalliance/mrdocs // -#include -#include #include #include +#include +#include namespace SourceFileNames { extern char const* getFileName(char const*) noexcept; diff --git a/src/lib/Support/CMakeExecution.cpp b/src/lib/Support/CMakeExecution.cpp index ec78d0057..db0cc4c79 100644 --- a/src/lib/Support/CMakeExecution.cpp +++ b/src/lib/Support/CMakeExecution.cpp @@ -10,8 +10,7 @@ #include "CMakeExecution.hpp" #include "ExecuteAndWaitWithLogging.hpp" -#include "lib/Support/Path.hpp" - +#include #include #include #include diff --git a/src/lib/Support/CMakeExecution.hpp b/src/lib/Support/CMakeExecution.hpp index b0184f534..c22c554f3 100644 --- a/src/lib/Support/CMakeExecution.hpp +++ b/src/lib/Support/CMakeExecution.hpp @@ -8,8 +8,8 @@ // Official repository: https://github.com/cppalliance/mrdocs // -#ifndef MRDOCS_LIB_TOOL_CMAKE_EXECUTION_HPP -#define MRDOCS_LIB_TOOL_CMAKE_EXECUTION_HPP +#ifndef MRDOCS_LIB_SUPPORT_CMAKEEXECUTION_HPP +#define MRDOCS_LIB_SUPPORT_CMAKEEXECUTION_HPP #include #include @@ -36,5 +36,5 @@ executeCmakeExportCompileCommands(llvm::StringRef projectPath, llvm::StringRef c } // mrdocs } // clang -#endif // MRDOCS_LIB_TOOL_CMAKE_EXECUTION_HPP +#endif // MRDOCS_LIB_SUPPORT_CMAKEEXECUTION_HPP diff --git a/src/lib/Support/Debug.cpp b/src/lib/Support/Debug.cpp index f3218166d..2beec1b05 100644 --- a/src/lib/Support/Debug.cpp +++ b/src/lib/Support/Debug.cpp @@ -9,13 +9,13 @@ // Official repository: https://github.com/cppalliance/mrdocs // -#include "lib/Support/Debug.hpp" -#include "lib/Support/Radix.hpp" -#include -#include +#include +#include #include #include -#include +#include +#include +#include namespace clang { namespace mrdocs { diff --git a/src/lib/Support/Debug.hpp b/src/lib/Support/Debug.hpp index 084e21d47..bc964526b 100644 --- a/src/lib/Support/Debug.hpp +++ b/src/lib/Support/Debug.hpp @@ -14,13 +14,13 @@ #include #if ! defined(NDEBUG) -#include +# include #endif -#include "lib/Support/Radix.hpp" -#include -#include +#include #include -#include +#include +#include +#include #include template <> @@ -77,4 +77,4 @@ MRDOCS_DECL void debugEnableHeapChecking(); } // clang::mrdocs -#endif +#endif // MRDOCS_LIB_SUPPORT_DEBUG_HPP diff --git a/src/lib/Support/ExecuteAndWaitWithLogging.cpp b/src/lib/Support/ExecuteAndWaitWithLogging.cpp index cf1c00a77..392c9aa06 100644 --- a/src/lib/Support/ExecuteAndWaitWithLogging.cpp +++ b/src/lib/Support/ExecuteAndWaitWithLogging.cpp @@ -9,8 +9,8 @@ // #include "ExecuteAndWaitWithLogging.hpp" -#include "lib/Support/Report.hpp" -#include "mrdocs/Support/Assert.hpp" +#include +#include namespace clang::mrdocs { diff --git a/src/lib/Support/ExecuteAndWaitWithLogging.hpp b/src/lib/Support/ExecuteAndWaitWithLogging.hpp index ab9d79b21..4bbfde16b 100644 --- a/src/lib/Support/ExecuteAndWaitWithLogging.hpp +++ b/src/lib/Support/ExecuteAndWaitWithLogging.hpp @@ -8,8 +8,8 @@ // Official repository: https://github.com/cppalliance/mrdocs // -#ifndef MRDOCS_LIB_EXECUTE_AND_WAIT_WITH_LOGGING_HPP -#define MRDOCS_LIB_EXECUTE_AND_WAIT_WITH_LOGGING_HPP +#ifndef MRDOCS_LIB_SUPPORT_EXECUTEANDWAITWITHLOGGING_HPP +#define MRDOCS_LIB_SUPPORT_EXECUTEANDWAITWITHLOGGING_HPP #include @@ -39,4 +39,4 @@ int ExecuteAndWaitWithLogging( } // clang::mrdocs -#endif // MRDOCS_LIB_EXECUTE_AND_WAIT_WITH_LOGGING_HPP +#endif // MRDOCS_LIB_SUPPORT_EXECUTEANDWAITWITHLOGGING_HPP diff --git a/src/lib/Support/ExecutionContext.cpp b/src/lib/Support/ExecutionContext.cpp index 337d5b943..309acd448 100644 --- a/src/lib/Support/ExecutionContext.cpp +++ b/src/lib/Support/ExecutionContext.cpp @@ -12,10 +12,10 @@ // #include "ExecutionContext.hpp" -#include "lib/Metadata/Reduce.hpp" -#include "mrdocs/Support/Assert.hpp" +#include #include #include +#include #include namespace clang { diff --git a/src/lib/Support/ExecutionContext.hpp b/src/lib/Support/ExecutionContext.hpp index bf793efaf..b34f9d48d 100644 --- a/src/lib/Support/ExecutionContext.hpp +++ b/src/lib/Support/ExecutionContext.hpp @@ -10,12 +10,12 @@ // Official repository: https://github.com/cppalliance/mrdocs // -#ifndef MRDOCS_LIB_TOOL_EXECUTIONCONTEXT_HPP -#define MRDOCS_LIB_TOOL_EXECUTIONCONTEXT_HPP +#ifndef MRDOCS_LIB_SUPPORT_EXECUTIONCONTEXT_HPP +#define MRDOCS_LIB_SUPPORT_EXECUTIONCONTEXT_HPP -#include "lib/ConfigImpl.hpp" -#include "lib/Diagnostics.hpp" -#include "lib/Metadata/InfoSet.hpp" +#include +#include +#include #include #include #include @@ -159,4 +159,4 @@ class InfoExecutionContext } // clang::mrdocs -#endif +#endif // MRDOCS_LIB_SUPPORT_EXECUTIONCONTEXT_HPP diff --git a/src/lib/Support/Generator.cpp b/src/lib/Support/Generator.cpp index c496e1843..d2b1e89a4 100644 --- a/src/lib/Support/Generator.cpp +++ b/src/lib/Support/Generator.cpp @@ -9,11 +9,11 @@ // Official repository: https://github.com/cppalliance/mrdocs // -#include "lib/AST/ParseJavadoc.hpp" -#include "lib/Support/Path.hpp" -#include "lib/Support/Chrono.hpp" -#include +#include +#include +#include #include +#include #include #include #include diff --git a/src/lib/Support/GeneratorsImpl.hpp b/src/lib/Support/GeneratorsImpl.hpp index 8fae493a8..73de003f4 100644 --- a/src/lib/Support/GeneratorsImpl.hpp +++ b/src/lib/Support/GeneratorsImpl.hpp @@ -11,9 +11,9 @@ #ifndef MRDOCS_LIB_SUPPORT_GENERATORSIMPL_HPP #define MRDOCS_LIB_SUPPORT_GENERATORSIMPL_HPP -#include #include #include +#include #include #include #include diff --git a/src/lib/Support/Glob.cpp b/src/lib/Support/Glob.cpp index 6b445a2e7..9f840fbe7 100644 --- a/src/lib/Support/Glob.cpp +++ b/src/lib/Support/Glob.cpp @@ -8,13 +8,13 @@ // Official repository: https://github.com/cppalliance/mrdocs // -#include +#include +#include #include #include #include -#include -#include #include +#include namespace clang::mrdocs { diff --git a/src/lib/Support/Handlebars.cpp b/src/lib/Support/Handlebars.cpp index 7aa16e3f4..b5fb3db5b 100644 --- a/src/lib/Support/Handlebars.cpp +++ b/src/lib/Support/Handlebars.cpp @@ -8,14 +8,14 @@ // Official repository: https://github.com/cppalliance/mrdocs // +#include +#include #include #include #include #include #include #include -#include -#include #include #include #include diff --git a/src/lib/Support/JavaScript.cpp b/src/lib/Support/JavaScript.cpp index e7fc49a4f..47ecc1dbf 100644 --- a/src/lib/Support/JavaScript.cpp +++ b/src/lib/Support/JavaScript.cpp @@ -9,13 +9,13 @@ // Official repository: https://github.com/cppalliance/mrdocs // -#include "lib/Support/Report.hpp" -#include -#include -#include +#include #include #include #include +#include +#include +#include #include #include diff --git a/src/lib/Support/LegibleNames.cpp b/src/lib/Support/LegibleNames.cpp index c0cde8593..d3f9052c6 100644 --- a/src/lib/Support/LegibleNames.cpp +++ b/src/lib/Support/LegibleNames.cpp @@ -10,17 +10,17 @@ // Official repository: https://github.com/cppalliance/mrdocs // -#include "lib/Support/LegibleNames.hpp" -#include "lib/Support/Debug.hpp" -#include "lib/Support/Radix.hpp" -#include "lib/Support/Validate.hpp" -#include +#include +#include +#include +#include +#include #include #include #include -#include #include #include +#include #include #include #include diff --git a/src/lib/Support/LegibleNames.hpp b/src/lib/Support/LegibleNames.hpp index a5ca1ee41..1dd9c043c 100644 --- a/src/lib/Support/LegibleNames.hpp +++ b/src/lib/Support/LegibleNames.hpp @@ -12,8 +12,8 @@ #ifndef MRDOCS_LIB_SUPPORT_LEGIBLENAMES_HPP #define MRDOCS_LIB_SUPPORT_LEGIBLENAMES_HPP -#include #include +#include #include #include diff --git a/src/lib/Support/Lua.cpp b/src/lib/Support/Lua.cpp index 9499f070a..57482fc5d 100644 --- a/src/lib/Support/Lua.cpp +++ b/src/lib/Support/Lua.cpp @@ -8,15 +8,14 @@ // Official repository: https://github.com/cppalliance/mrdocs // -#include "../../../third-party/lua/src/lua.hpp" -#include +#include #include #include #include -#include - #include -#include "lib/Support/LuaHandlebars.hpp" +#include +#include +#include namespace clang { namespace mrdocs { diff --git a/src/lib/Support/LuaHandlebars.hpp b/src/lib/Support/LuaHandlebars.hpp index 7e32b0202..958b48d56 100644 --- a/src/lib/Support/LuaHandlebars.hpp +++ b/src/lib/Support/LuaHandlebars.hpp @@ -8,8 +8,8 @@ // Official repository: https://github.com/cppalliance/mrdocs // -#ifndef MRDOCS_API_SUPPORT_LUAHANDLEBARS_HPP -#define MRDOCS_API_SUPPORT_LUAHANDLEBARS_HPP +#ifndef MRDOCS_LIB_SUPPORT_LUAHANDLEBARS_HPP +#define MRDOCS_LIB_SUPPORT_LUAHANDLEBARS_HPP #include #include @@ -27,4 +27,4 @@ tryLoadHandlebars( } // mrdocs } // clang -#endif +#endif // MRDOCS_LIB_SUPPORT_LUAHANDLEBARS_HPP diff --git a/src/lib/Support/Radix.cpp b/src/lib/Support/Radix.cpp index d98b04283..7f656ef0d 100644 --- a/src/lib/Support/Radix.cpp +++ b/src/lib/Support/Radix.cpp @@ -9,9 +9,9 @@ // Official repository: https://github.com/cppalliance/mrdocs // -#include "lib/Support/Radix.hpp" -#include "lib/Support/Debug.hpp" #include +#include +#include #include #include #include diff --git a/src/lib/Support/Report.cpp b/src/lib/Support/Report.cpp index ae0e0b4d8..afeefb023 100644 --- a/src/lib/Support/Report.cpp +++ b/src/lib/Support/Report.cpp @@ -8,22 +8,22 @@ // Official repository: https://github.com/cppalliance/mrdocs // -#include "lib/Support/Report.hpp" -#include -#include +#include +#include +#include #include #include #include -#include -#include +#include +#include #include #ifdef _MSC_VER #define WIN32_LEAN_AND_MEAN -#include -#include -#include -#include +# include +# include +# include +# include #endif namespace SourceFileNames { diff --git a/src/lib/Support/Report.hpp b/src/lib/Support/Report.hpp index d8800a8a2..ab49e4dc0 100644 --- a/src/lib/Support/Report.hpp +++ b/src/lib/Support/Report.hpp @@ -8,15 +8,15 @@ // Official repository: https://github.com/cppalliance/mrdocs // -#ifndef MRDOCS_LIB_SUPPORT_ERROR_HPP -#define MRDOCS_LIB_SUPPORT_ERROR_HPP +#ifndef MRDOCS_LIB_SUPPORT_REPORT_HPP +#define MRDOCS_LIB_SUPPORT_REPORT_HPP -#include -#include +#include #include #include #include -#include +#include +#include #include #include @@ -149,4 +149,4 @@ struct std::formatter> } }; -#endif +#endif // MRDOCS_LIB_SUPPORT_REPORT_HPP diff --git a/src/lib/Support/Yaml.cpp b/src/lib/Support/Yaml.cpp index 3b908fcf3..958a28068 100644 --- a/src/lib/Support/Yaml.cpp +++ b/src/lib/Support/Yaml.cpp @@ -9,8 +9,8 @@ // Official repository: https://github.com/cppalliance/mrdocs // -#include "lib/Support/Report.hpp" -#include "lib/Support/Yaml.hpp" +#include +#include namespace clang { namespace mrdocs { diff --git a/src/lib/lua.cpp b/src/lib/lua.cpp index 5e4982776..b6810dd9b 100644 --- a/src/lib/lua.cpp +++ b/src/lib/lua.cpp @@ -13,40 +13,40 @@ extern "C" { # pragma warning(disable: 4334) // result of 32-bit shift implicitly converted to 64 bits (was 64-bit shift intended?) #endif -#include "../third-party/lua/src/lapi.c" -#include "../third-party/lua/src/lauxlib.c" -#include "../third-party/lua/src/lbaselib.c" -#include "../third-party/lua/src/lcode.c" -#include "../third-party/lua/src/lcorolib.c" -#include "../third-party/lua/src/lctype.c" -#include "../third-party/lua/src/ldblib.c" -#include "../third-party/lua/src/ldebug.c" -#include "../third-party/lua/src/ldo.c" -#include "../third-party/lua/src/ldump.c" -#include "../third-party/lua/src/lfunc.c" -#include "../third-party/lua/src/lgc.c" -#include "../third-party/lua/src/linit.c" -#include "../third-party/lua/src/liolib.c" -#include "../third-party/lua/src/llex.c" -#include "../third-party/lua/src/lmathlib.c" -#include "../third-party/lua/src/lmem.c" -#include "../third-party/lua/src/loadlib.c" -#include "../third-party/lua/src/lobject.c" -#include "../third-party/lua/src/lopcodes.c" -#include "../third-party/lua/src/loslib.c" -#include "../third-party/lua/src/lparser.c" -#include "../third-party/lua/src/lstate.c" -#include "../third-party/lua/src/lstring.c" -#include "../third-party/lua/src/lstrlib.c" -#include "../third-party/lua/src/ltable.c" -#include "../third-party/lua/src/ltablib.c" -#include "../third-party/lua/src/ltm.c" -//#include "../third-party/lua/src/lua.c" -//#include "../third-party/lua/src/luac.c" -#include "../third-party/lua/src/lundump.c" -#include "../third-party/lua/src/lutf8lib.c" -#include "../third-party/lua/src/lvm.c" -#include "../third-party/lua/src/lzio.c" +#include <../third-party/lua/src/lapi.c> +#include <../third-party/lua/src/lauxlib.c> +#include <../third-party/lua/src/lbaselib.c> +#include <../third-party/lua/src/lcode.c> +#include <../third-party/lua/src/lcorolib.c> +#include <../third-party/lua/src/lctype.c> +#include <../third-party/lua/src/ldblib.c> +#include <../third-party/lua/src/ldebug.c> +#include <../third-party/lua/src/ldo.c> +#include <../third-party/lua/src/ldump.c> +#include <../third-party/lua/src/lfunc.c> +#include <../third-party/lua/src/lgc.c> +#include <../third-party/lua/src/linit.c> +#include <../third-party/lua/src/liolib.c> +#include <../third-party/lua/src/llex.c> +#include <../third-party/lua/src/lmathlib.c> +#include <../third-party/lua/src/lmem.c> +#include <../third-party/lua/src/loadlib.c> +#include <../third-party/lua/src/lobject.c> +#include <../third-party/lua/src/lopcodes.c> +#include <../third-party/lua/src/loslib.c> +#include <../third-party/lua/src/lparser.c> +#include <../third-party/lua/src/lstate.c> +#include <../third-party/lua/src/lstring.c> +#include <../third-party/lua/src/lstrlib.c> +#include <../third-party/lua/src/ltable.c> +#include <../third-party/lua/src/ltablib.c> +#include <../third-party/lua/src/ltm.c> +// #include "../third-party/lua/src/lua.c" +// #include "../third-party/lua/src/luac.c" +#include <../third-party/lua/src/lundump.c> +#include <../third-party/lua/src/lutf8lib.c> +#include <../third-party/lua/src/lvm.c> +#include <../third-party/lua/src/lzio.c> #if defined(__clang__) # pragma clang diagnostic pop diff --git a/src/test/ADT/Optional.cpp b/src/test/ADT/Optional.cpp index 80b4ea757..08c32b3fc 100644 --- a/src/test/ADT/Optional.cpp +++ b/src/test/ADT/Optional.cpp @@ -9,7 +9,7 @@ // #include -#include +#include #include namespace clang::mrdocs { diff --git a/src/test/ADT/Polymorphic.cpp b/src/test/ADT/Polymorphic.cpp index 20ebe29d3..21fd36e7d 100644 --- a/src/test/ADT/Polymorphic.cpp +++ b/src/test/ADT/Polymorphic.cpp @@ -33,16 +33,16 @@ struct Polymorphic_test void testConstructors() { - // nullopt constructor - { - Polymorphic constexpr v(std::nullopt); - BOOST_TEST_NOT(v); - } + // nullopt constructor (removed) + // { + // constexpr Polymorphic v(std::nullopt); + // BOOST_TEST_NOT(v); + // } // from derived object { Polymorphic x(Y{}); - BOOST_TEST(x); + BOOST_TEST(!x.valueless_after_move()); BOOST_TEST(x->a == 42); BOOST_TEST(dynamic_cast(&*x)->b == 43); } @@ -50,7 +50,7 @@ struct Polymorphic_test // from derived { auto x = Polymorphic(std::in_place_type); - BOOST_TEST(x); + BOOST_TEST(!x.valueless_after_move()); BOOST_TEST(x->a == 42); BOOST_TEST(dynamic_cast(&*x)->b == 43); } @@ -58,18 +58,18 @@ struct Polymorphic_test // Copy constructor { // from empty - { - Polymorphic x = std::nullopt; - Polymorphic y(x); - BOOST_TEST_NOT(y); - } + // { + // Polymorphic x = std::nullopt; + // Polymorphic y(x); + // BOOST_TEST_NOT(y); + // } // from valid { Polymorphic x(std::in_place_type); x->a = 45; Polymorphic y(x); - BOOST_TEST(y); + BOOST_TEST(!y.valueless_after_move()); BOOST_TEST(y->a == 45); BOOST_TEST(dynamic_cast(&*y)->b == 43); } @@ -80,26 +80,26 @@ struct Polymorphic_test auto x = Polymorphic(std::in_place_type); x->a = 45; Polymorphic y(std::move(x)); - BOOST_TEST_NOT(x); - BOOST_TEST(y); + BOOST_TEST_NOT(!x.valueless_after_move()); + BOOST_TEST(!y.valueless_after_move()); BOOST_TEST(y->a == 45); BOOST_TEST(dynamic_cast(&*y)->b == 43); } // Copy from derived value constructor - { - Polymorphic x; - x->a = 45; - Polymorphic y(std::in_place_type, *x); - BOOST_TEST(y); - BOOST_TEST(y->a == 45); - BOOST_TEST(dynamic_cast(&*y)->b == 43); - } + // { + // Polymorphic x; + // x->a = 45; + // Polymorphic y(std::in_place_type, *x); + // BOOST_TEST(y); + // BOOST_TEST(y->a == 45); + // BOOST_TEST(dynamic_cast(&*y)->b == 43); + // } // In-place constructor { Polymorphic x(std::in_place_type); - BOOST_TEST(x); + BOOST_TEST(!x.valueless_after_move()); BOOST_TEST(x->a == 42); BOOST_TEST(dynamic_cast(&*x)->b == 43); } @@ -123,7 +123,7 @@ struct Polymorphic_test { Polymorphic lhs(std::in_place_type); lhs = lhs; - BOOST_TEST(lhs); + BOOST_TEST(!lhs.valueless_after_move()); BOOST_TEST(lhs->a == 42); } #if defined(__clang__) @@ -133,12 +133,12 @@ struct Polymorphic_test #pragma GCC diagnostic pop #endif // from empty - { - Polymorphic lhs; - Polymorphic rhs = std::nullopt; - lhs = rhs; - BOOST_TEST_NOT(lhs); - } + // { + // Polymorphic lhs; + // Polymorphic rhs = std::nullopt; + // lhs = rhs; + // BOOST_TEST_NOT(lhs); + // } // from valid { @@ -149,10 +149,10 @@ struct Polymorphic_test BOOST_TEST(lhs->a == 45); BOOST_TEST(rhs->a == 46); lhs = rhs; - BOOST_TEST(lhs); + BOOST_TEST(!lhs.valueless_after_move()); BOOST_TEST(lhs->a == 46); BOOST_TEST(rhs->a == 46); - BOOST_TEST(static_cast(*lhs).b == 43); + BOOST_TEST(dynamic_cast(*lhs).b == 43); } } @@ -170,7 +170,7 @@ struct Polymorphic_test { Polymorphic lhs(std::in_place_type); lhs = std::move(lhs); - BOOST_TEST(lhs); + BOOST_TEST(!lhs.valueless_after_move()); BOOST_TEST(lhs->a == 42); } #if defined(__clang__) @@ -181,13 +181,13 @@ struct Polymorphic_test #endif // from empty - { - Polymorphic lhs; - Polymorphic rhs = std::nullopt; - lhs = std::move(rhs); - BOOST_TEST_NOT(lhs); - BOOST_TEST_NOT(rhs); - } + // { + // Polymorphic lhs; + // Polymorphic rhs = std::nullopt; + // lhs = std::move(rhs); + // BOOST_TEST_NOT(lhs); + // BOOST_TEST_NOT(rhs); + // } // from valid { @@ -199,8 +199,8 @@ struct Polymorphic_test BOOST_TEST(rhs->a == 46); lhs = std::move(rhs); BOOST_TEST(lhs->a == 46); - BOOST_TEST_NOT(rhs); - BOOST_TEST(static_cast(*lhs).b == 43); + BOOST_TEST_NOT(!rhs.valueless_after_move()); + BOOST_TEST(dynamic_cast(*lhs).b == 43); } } @@ -213,9 +213,9 @@ struct Polymorphic_test BOOST_TEST(lhs->a == 45); BOOST_TEST(rhs.a == 46); lhs = Polymorphic(std::in_place_type, rhs); - BOOST_TEST(lhs); + BOOST_TEST(!lhs.valueless_after_move()); BOOST_TEST(lhs->a == 46); - BOOST_TEST(static_cast(*lhs).b == 43); + BOOST_TEST(dynamic_cast(*lhs).b == 43); } // copy from derived @@ -227,9 +227,9 @@ struct Polymorphic_test BOOST_TEST(lhs->a == 45); BOOST_TEST(rhs.a == 46); lhs = Polymorphic(std::in_place_type, std::move(rhs)); - BOOST_TEST(lhs); + BOOST_TEST(!lhs.valueless_after_move()); BOOST_TEST(lhs->a == 46); - BOOST_TEST(static_cast(*lhs).b == 43); + BOOST_TEST(dynamic_cast(*lhs).b == 43); } } @@ -257,36 +257,36 @@ struct Polymorphic_test testSwap() { // default constructor - { - Polymorphic lhs = std::nullopt; - Polymorphic rhs(std::in_place_type); - swap(lhs, rhs); - BOOST_TEST(lhs); - BOOST_TEST(lhs->a == 42); - BOOST_TEST(dynamic_cast(&*lhs)->b == 43); - BOOST_TEST_NOT(rhs); - } + // { + // Polymorphic lhs = std::nullopt; + // Polymorphic rhs(std::in_place_type); + // swap(lhs, rhs); + // BOOST_TEST(lhs); + // BOOST_TEST(lhs->a == 42); + // BOOST_TEST(dynamic_cast(&*lhs)->b == 43); + // BOOST_TEST_NOT(rhs); + // } // rhs: default constructor - { - Polymorphic lhs(std::in_place_type); - Polymorphic rhs = std::nullopt; - swap(lhs, rhs); - BOOST_TEST_NOT(lhs); - BOOST_TEST(rhs); - BOOST_TEST(rhs->a == 42); - BOOST_TEST(dynamic_cast(&*rhs)->b == 43); - } + // { + // Polymorphic lhs(std::in_place_type); + // Polymorphic rhs = std::nullopt; + // swap(lhs, rhs); + // BOOST_TEST_NOT(lhs); + // BOOST_TEST(rhs); + // BOOST_TEST(rhs->a == 42); + // BOOST_TEST(dynamic_cast(&*rhs)->b == 43); + // } // lhs: from derived object { Polymorphic lhs(Y{}); Polymorphic rhs(std::in_place_type); swap(lhs, rhs); - BOOST_TEST(rhs); + BOOST_TEST(!rhs.valueless_after_move()); BOOST_TEST(rhs->a == 42); BOOST_TEST(dynamic_cast(&*rhs)->b == 43); - BOOST_TEST(lhs); + BOOST_TEST(!lhs.valueless_after_move()); BOOST_TEST(lhs->a == 42); BOOST_TEST(dynamic_cast(&*lhs)->b == 43); } @@ -296,10 +296,10 @@ struct Polymorphic_test Polymorphic lhs(std::in_place_type); Polymorphic rhs(Y{}); swap(lhs, rhs); - BOOST_TEST(lhs); + BOOST_TEST(!lhs.valueless_after_move()); BOOST_TEST(lhs->a == 42); BOOST_TEST(dynamic_cast(&*lhs)->b == 43); - BOOST_TEST(rhs); + BOOST_TEST(!rhs.valueless_after_move()); BOOST_TEST(rhs->a == 42); BOOST_TEST(dynamic_cast(&*rhs)->b == 43); } @@ -309,10 +309,10 @@ struct Polymorphic_test Polymorphic lhs(std::in_place_type); Polymorphic rhs(std::in_place_type); swap(lhs, rhs); - BOOST_TEST(rhs); + BOOST_TEST(!rhs.valueless_after_move()); BOOST_TEST(rhs->a == 42); BOOST_TEST(dynamic_cast(&*rhs)->b == 43); - BOOST_TEST(lhs); + BOOST_TEST(!lhs.valueless_after_move()); BOOST_TEST(lhs->a == 42); BOOST_TEST(dynamic_cast(&*lhs)->b == 43); } diff --git a/src/test/Support/JavaScript.cpp b/src/test/Support/JavaScript.cpp index e8e7ec9e3..369b0609a 100644 --- a/src/test/Support/JavaScript.cpp +++ b/src/test/Support/JavaScript.cpp @@ -8,10 +8,10 @@ // Official repository: https://github.com/cppalliance/mrdocs // -#include #include -#include +#include #include +#include namespace clang { namespace mrdocs { diff --git a/src/test/TestArgs.hpp b/src/test/TestArgs.hpp index 2ee9f2b17..9deb8cf39 100644 --- a/src/test/TestArgs.hpp +++ b/src/test/TestArgs.hpp @@ -12,8 +12,8 @@ #define MRDOCS_TEST_TESTARGS_HPP #include -#include #include +#include namespace clang { namespace mrdocs { diff --git a/src/test/TestMain.cpp b/src/test/TestMain.cpp index 4b7e52f66..4a144a6db 100644 --- a/src/test/TestMain.cpp +++ b/src/test/TestMain.cpp @@ -8,20 +8,20 @@ // Official repository: https://github.com/cppalliance/mrdocs // +#include #include "TestArgs.hpp" #include "TestRunner.hpp" -#include "lib/Support/Debug.hpp" -#include "lib/Support/Report.hpp" -#include -#include +#include +#include #include #include -#include +#include #include -#include #include #include +#include #include +#include int main(int argc, char const** argv); diff --git a/src/test/TestRunner.cpp b/src/test/TestRunner.cpp index 31ea0e38d..9c2785f97 100644 --- a/src/test/TestRunner.cpp +++ b/src/test/TestRunner.cpp @@ -8,20 +8,19 @@ // Official repository: https://github.com/cppalliance/mrdocs // -#include "TestRunner.hpp" +#include #include "TestArgs.hpp" -#include "lib/Support/Report.hpp" -#include "lib/Support/Path.hpp" -#include "lib/ConfigImpl.hpp" -#include "lib/CorpusImpl.hpp" -#include "lib/Support/ExecuteAndWaitWithLogging.hpp" -#include "lib/MrDocsCompilationDatabase.hpp" -#include "lib/SingleFileDB.hpp" -#include "lib/Gen/hbs/HandlebarsGenerator.hpp" -#include "test_suite/diff.hpp" +#include "TestRunner.hpp" +#include +#include +#include +#include +#include +#include +#include +#include #include #include -#include #include #include #include @@ -29,6 +28,7 @@ #include #include #include +#include namespace clang::mrdocs { diff --git a/src/test/TestRunner.hpp b/src/test/TestRunner.hpp index 2642a2262..1a437cb3e 100644 --- a/src/test/TestRunner.hpp +++ b/src/test/TestRunner.hpp @@ -11,7 +11,7 @@ #ifndef MRDOCS_TEST_TESTRUNNER_HPP #define MRDOCS_TEST_TESTRUNNER_HPP -#include "lib/ConfigImpl.hpp" +#include #include #include #include @@ -86,4 +86,4 @@ class TestRunner } // mrdocs } // clang -#endif +#endif // MRDOCS_TEST_TESTRUNNER_HPP diff --git a/src/test/lib/AST/ParseRef.cpp b/src/test/lib/AST/ParseRef.cpp index a7837e711..25f8140cb 100644 --- a/src/test/lib/AST/ParseRef.cpp +++ b/src/test/lib/AST/ParseRef.cpp @@ -5,10 +5,10 @@ // https://www.boost.org/LICENSE_1_0.txt // +#include #include #include #include -#include "lib/AST/ParseRef.hpp" namespace clang::mrdocs { diff --git a/src/test/lib/Dom/Dom.cpp b/src/test/lib/Dom/Dom.cpp index 4e5f17861..c06e4e990 100644 --- a/src/test/lib/Dom/Dom.cpp +++ b/src/test/lib/Dom/Dom.cpp @@ -8,8 +8,8 @@ // Official repository: https://github.com/cppalliance/mrdocs // -#include #include +#include #include namespace clang { diff --git a/src/test/lib/Support/Handlebars.cpp b/src/test/lib/Support/Handlebars.cpp index 7a0a10c74..1547a96d3 100644 --- a/src/test/lib/Support/Handlebars.cpp +++ b/src/test/lib/Support/Handlebars.cpp @@ -5,18 +5,18 @@ // https://www.boost.org/LICENSE_1_0.txt // -#include -#include -#include -#include #include #include #include #include +#include +#include +#include +#include +#include #include #include #include -#include namespace clang { namespace mrdocs { diff --git a/src/test/lib/Support/Path.cpp b/src/test/lib/Support/Path.cpp index 80649d59a..56da2d001 100644 --- a/src/test/lib/Support/Path.cpp +++ b/src/test/lib/Support/Path.cpp @@ -8,7 +8,7 @@ // Official repository: https://github.com/cppalliance/mrdocs // -#include "lib/Support/Path.hpp" +#include #include namespace clang { diff --git a/src/test_suite/detail/decomposer.cpp b/src/test_suite/detail/decomposer.cpp index 97a11fc86..d3f937b1b 100644 --- a/src/test_suite/detail/decomposer.cpp +++ b/src/test_suite/detail/decomposer.cpp @@ -10,7 +10,7 @@ #include "decomposer.hpp" #if __has_include() -#include +# include #endif namespace test_suite { diff --git a/src/test_suite/detail/decomposer.hpp b/src/test_suite/detail/decomposer.hpp index 1f30f96e2..d678e0d97 100644 --- a/src/test_suite/detail/decomposer.hpp +++ b/src/test_suite/detail/decomposer.hpp @@ -5,8 +5,8 @@ // https://www.boost.org/LICENSE_1_0.txt // -#ifndef MRDOCS_TEST_DECOMPOSER_HPP -#define MRDOCS_TEST_DECOMPOSER_HPP +#ifndef MRDOCS_TEST_SUITE_DETAIL_DECOMPOSER_HPP +#define MRDOCS_TEST_SUITE_DETAIL_DECOMPOSER_HPP #include #include @@ -287,4 +287,4 @@ namespace test_suite::detail # define DETAIL_SUPPRESS_PARENTHESES_WARNINGS #endif -#endif //MRDOCS_TEST_DECOMPOSER_HPP +#endif // MRDOCS_TEST_SUITE_DETAIL_DECOMPOSER_HPP diff --git a/src/test_suite/diff.hpp b/src/test_suite/diff.hpp index 50665b457..4af4e4c60 100644 --- a/src/test_suite/diff.hpp +++ b/src/test_suite/diff.hpp @@ -5,8 +5,8 @@ // https://www.boost.org/LICENSE_1_0.txt // -#ifndef MRDOCS_TEST_DIFF_HPP -#define MRDOCS_TEST_DIFF_HPP +#ifndef MRDOCS_TEST_SUITE_DIFF_HPP +#define MRDOCS_TEST_SUITE_DIFF_HPP #include #include @@ -76,4 +76,4 @@ BOOST_TEST_DIFF( } -#endif //MRDOCS_TEST_DIFF_HPP +#endif // MRDOCS_TEST_SUITE_DIFF_HPP diff --git a/src/test_suite/test_suite.cpp b/src/test_suite/test_suite.cpp index d502b7840..65ed8845a 100644 --- a/src/test_suite/test_suite.cpp +++ b/src/test_suite/test_suite.cpp @@ -8,7 +8,6 @@ // #include "test_suite.hpp" - #include #include #include diff --git a/src/test_suite/test_suite.hpp b/src/test_suite/test_suite.hpp index ec16adbd3..256005fc2 100644 --- a/src/test_suite/test_suite.hpp +++ b/src/test_suite/test_suite.hpp @@ -7,8 +7,8 @@ // Official repository: https://github.com/boostorg/url // -#ifndef MRDOCS_TEST_HPP -#define MRDOCS_TEST_HPP +#ifndef MRDOCS_TEST_SUITE_TEST_SUITE_HPP +#define MRDOCS_TEST_SUITE_TEST_SUITE_HPP #if defined(_MSC_VER) # pragma once @@ -18,7 +18,7 @@ #include #include #include -#include "detail/decomposer.hpp" +#include // This is a derivative work // Copyright 2002-2018 Peter Dimov @@ -385,4 +385,4 @@ extern int unit_test_main(int argc, char const* const* argv); } // test_suite -#endif +#endif // MRDOCS_TEST_SUITE_TEST_SUITE_HPP diff --git a/src/tool/CompilerInfo.cpp b/src/tool/CompilerInfo.cpp index c81e381ac..2cee25fa5 100644 --- a/src/tool/CompilerInfo.cpp +++ b/src/tool/CompilerInfo.cpp @@ -10,9 +10,8 @@ // #include "CompilerInfo.hpp" -#include "lib/Support/ExecuteAndWaitWithLogging.hpp" +#include #include - #include namespace clang { diff --git a/src/tool/CompilerInfo.hpp b/src/tool/CompilerInfo.hpp index f0cdae0b0..fa8138ae7 100644 --- a/src/tool/CompilerInfo.hpp +++ b/src/tool/CompilerInfo.hpp @@ -8,16 +8,15 @@ // Official repository: https://github.com/cppalliance/mrdocs // -#ifndef MRDOCS_TOOL_COMPILER_HPP -#define MRDOCS_TOOL_COMPILER_HPP +#ifndef MRDOCS_TOOL_COMPILERINFO_HPP +#define MRDOCS_TOOL_COMPILERINFO_HPP +#include +#include #include #include -#include #include - -#include -#include +#include namespace clang { namespace mrdocs { @@ -53,4 +52,4 @@ getCompilersDefaultIncludeDir(clang::tooling::CompilationDatabase const& compDb, } // mrdocs } // clang -#endif +#endif // MRDOCS_TOOL_COMPILERINFO_HPP diff --git a/src/tool/GenerateAction.cpp b/src/tool/GenerateAction.cpp index 91a4dc813..670047a94 100644 --- a/src/tool/GenerateAction.cpp +++ b/src/tool/GenerateAction.cpp @@ -12,13 +12,13 @@ #include "ToolArgs.hpp" #include "ToolCompilationDatabase.hpp" -#include "lib/ConfigImpl.hpp" -#include "lib/CorpusImpl.hpp" -#include "lib/MrDocsCompilationDatabase.hpp" -#include "lib/Support/Path.hpp" +#include +#include +#include +#include #include -#include #include +#include #include namespace clang::mrdocs { diff --git a/src/tool/ToolArgs.cpp b/src/tool/ToolArgs.cpp index 561f141e8..f556d87af 100644 --- a/src/tool/ToolArgs.cpp +++ b/src/tool/ToolArgs.cpp @@ -11,9 +11,9 @@ #include "ToolArgs.hpp" #include #include -#include -#include #include +#include +#include namespace clang { namespace mrdocs { diff --git a/src/tool/ToolArgs.hpp b/src/tool/ToolArgs.hpp index aed5016f8..2510703f9 100644 --- a/src/tool/ToolArgs.hpp +++ b/src/tool/ToolArgs.hpp @@ -11,10 +11,10 @@ #ifndef MRDOCS_TOOL_TOOLARGS_HPP #define MRDOCS_TOOL_TOOLARGS_HPP -#include -#include #include +#include #include +#include namespace clang { namespace mrdocs { diff --git a/src/tool/ToolCompilationDatabase.cpp b/src/tool/ToolCompilationDatabase.cpp index 08bb1e225..9e3d25fef 100644 --- a/src/tool/ToolCompilationDatabase.cpp +++ b/src/tool/ToolCompilationDatabase.cpp @@ -10,9 +10,9 @@ #include "ToolCompilationDatabase.hpp" #include "CompilerInfo.hpp" -#include "lib/MrDocsSettingsDB.hpp" -#include "lib/Support/CMakeExecution.hpp" -#include "lib/Support/Path.hpp" +#include +#include +#include #include namespace clang { diff --git a/src/tool/ToolCompilationDatabase.hpp b/src/tool/ToolCompilationDatabase.hpp index 366b5ec35..3abadc91d 100644 --- a/src/tool/ToolCompilationDatabase.hpp +++ b/src/tool/ToolCompilationDatabase.hpp @@ -8,11 +8,11 @@ // Official repository: https://github.com/cppalliance/mrdocs // -#ifndef MRDOCS_TOOL_COMPILATIONDATABASE_HPP -#define MRDOCS_TOOL_COMPILATIONDATABASE_HPP +#ifndef MRDOCS_TOOL_TOOLCOMPILATIONDATABASE_HPP +#define MRDOCS_TOOL_TOOLCOMPILATIONDATABASE_HPP -#include "lib/MrDocsCompilationDatabase.hpp" -#include "lib/ConfigImpl.hpp" +#include +#include namespace clang { namespace mrdocs { @@ -26,4 +26,4 @@ generateCompilationDatabase( } // mrdocs } // clang -#endif +#endif // MRDOCS_TOOL_TOOLCOMPILATIONDATABASE_HPP diff --git a/src/tool/ToolMain.cpp b/src/tool/ToolMain.cpp index 46bbeca11..7be66d202 100644 --- a/src/tool/ToolMain.cpp +++ b/src/tool/ToolMain.cpp @@ -10,14 +10,14 @@ // #include "ToolArgs.hpp" -#include "lib/Support/Debug.hpp" -#include "lib/Support/Report.hpp" +#include +#include #include #include #include -#include #include #include +#include #include #include diff --git a/test-files/golden-tests/symbols/concept/requires-clause.cpp b/test-files/golden-tests/symbols/concept/requires-clause.cpp index e8e84f926..99acf6fcd 100644 --- a/test-files/golden-tests/symbols/concept/requires-clause.cpp +++ b/test-files/golden-tests/symbols/concept/requires-clause.cpp @@ -7,15 +7,15 @@ void f() requires (sizeof(T) == 2); template void f() requires (sizeof(U) == 2); -template requires (sizeof(T) == 4) -void g(); - template requires (sizeof(T) == 2) void g(); template requires (sizeof(U) == 2) void g(); +template requires (sizeof(T) == 4) +void g(); + template requires (sizeof(T) == 2) struct A; diff --git a/test-files/golden-tests/symbols/concept/requires-clause.xml b/test-files/golden-tests/symbols/concept/requires-clause.xml index b699c46b6..f433a13bc 100644 --- a/test-files/golden-tests/symbols/concept/requires-clause.xml +++ b/test-files/golden-tests/symbols/concept/requires-clause.xml @@ -25,19 +25,19 @@ From dd2df35af6882bffca002b058c21659711d72c07 Mon Sep 17 00:00:00 2001 From: Alan de Freitas Date: Wed, 24 Sep 2025 19:17:50 -0500 Subject: [PATCH 06/23] refactor: metadata base classes do not expose constructors --- include/mrdocs/Corpus.hpp | 4 +- include/mrdocs/Metadata/Info/InfoBase.hpp | 41 +++++---- .../Metadata/Javadoc/Block/BlockBase.hpp | 5 +- .../Metadata/Javadoc/{Text.hpp => Inline.hpp} | 54 +++++------ .../Javadoc/{Text => Inline}/CopyDetails.hpp | 10 +-- .../Metadata/Javadoc/Inline/InlineBase.hpp | 89 +++++++++++++++++++ .../Javadoc/{Text => Inline}/Link.hpp | 8 +- .../Javadoc/{Text => Inline}/Parts.hpp | 6 +- .../Javadoc/{Text => Inline}/Reference.hpp | 8 +- .../Javadoc/{Text => Inline}/Style.hpp | 6 +- .../Javadoc/{Text => Inline}/Styled.hpp | 10 +-- .../{Text/TextBase.hpp => Inline/Text.hpp} | 30 +++---- include/mrdocs/Metadata/Javadoc/Node.hpp | 2 +- .../mrdocs/Metadata/Javadoc/Node/NodeBase.hpp | 12 +-- include/mrdocs/Metadata/Name/NameBase.hpp | 11 ++- include/mrdocs/Metadata/TArg/TArgBase.hpp | 2 + include/mrdocs/Metadata/TParam/TParamBase.hpp | 5 +- include/mrdocs/Metadata/Type/TypeBase.hpp | 3 +- src/lib/AST/ParseJavadoc.cpp | 4 +- .../Metadata/Finalizers/JavadocFinalizer.cpp | 2 +- src/lib/Metadata/Javadoc.cpp | 2 +- 21 files changed, 203 insertions(+), 111 deletions(-) rename include/mrdocs/Metadata/Javadoc/{Text.hpp => Inline.hpp} (65%) rename include/mrdocs/Metadata/Javadoc/{Text => Inline}/CopyDetails.hpp (87%) create mode 100644 include/mrdocs/Metadata/Javadoc/Inline/InlineBase.hpp rename include/mrdocs/Metadata/Javadoc/{Text => Inline}/Link.hpp (89%) rename include/mrdocs/Metadata/Javadoc/{Text => Inline}/Parts.hpp (88%) rename include/mrdocs/Metadata/Javadoc/{Text => Inline}/Reference.hpp (90%) rename include/mrdocs/Metadata/Javadoc/{Text => Inline}/Style.hpp (87%) rename include/mrdocs/Metadata/Javadoc/{Text => Inline}/Styled.hpp (87%) rename include/mrdocs/Metadata/Javadoc/{Text/TextBase.hpp => Inline/Text.hpp} (80%) diff --git a/include/mrdocs/Corpus.hpp b/include/mrdocs/Corpus.hpp index 2244039b2..1e9fd5243 100644 --- a/include/mrdocs/Corpus.hpp +++ b/include/mrdocs/Corpus.hpp @@ -272,9 +272,7 @@ class MRDOCS_VISIBLE { return std::is_lt(cmp); } - return std::is_lt( - CompareDerived(Polymorphic(lhsInfo), - Polymorphic(rhsInfo))); + return std::is_lt(CompareDerived(lhsInfo, rhsInfo)); }); if (!opts.skipInherited) { diff --git a/include/mrdocs/Metadata/Info/InfoBase.hpp b/include/mrdocs/Metadata/Info/InfoBase.hpp index ac0336e9c..9b22ef314 100644 --- a/include/mrdocs/Metadata/Info/InfoBase.hpp +++ b/include/mrdocs/Metadata/Info/InfoBase.hpp @@ -84,26 +84,6 @@ struct MRDOCS_VISIBLE Info ~Info() override = default; - Info(Info const& Other) = default; - - /** Move constructor. - */ - Info(Info&& Other) = default; - - /** Construct an Info. - - @param kind The kind of symbol - @param ID The unique identifier for this symbol - */ - explicit - Info( - InfoKind const kind, - SymbolID const& ID) noexcept - : id(ID) - , Kind(kind) - { - } - #define INFO(Type) constexpr bool is##Type() const noexcept { \ return Kind == InfoKind::Type; \ } @@ -152,8 +132,27 @@ struct MRDOCS_VISIBLE Info auto operator<=>(Info const&) const = default; protected: - Info() = default; + constexpr Info() = default; + Info(Info const& Other) = default; + + /** Move constructor. + */ + Info(Info&& Other) = default; + + /** Construct an Info. + + @param kind The kind of symbol + @param ID The unique identifier for this symbol + */ + explicit + Info( + InfoKind const kind, + SymbolID const& ID) noexcept + : id(ID) + , Kind(kind) + { + } }; //------------------------------------------------ diff --git a/include/mrdocs/Metadata/Javadoc/Block/BlockBase.hpp b/include/mrdocs/Metadata/Javadoc/Block/BlockBase.hpp index 4fd0568b0..32cd0abf7 100644 --- a/include/mrdocs/Metadata/Javadoc/Block/BlockBase.hpp +++ b/include/mrdocs/Metadata/Javadoc/Block/BlockBase.hpp @@ -17,8 +17,8 @@ #include #include #include +#include #include -#include #include #include @@ -94,6 +94,9 @@ struct MRDOCS_DECL void append(std::vector> const& otherChildren); protected: + constexpr + Block() = default; + explicit Block( NodeKind const kind_, diff --git a/include/mrdocs/Metadata/Javadoc/Text.hpp b/include/mrdocs/Metadata/Javadoc/Inline.hpp similarity index 65% rename from include/mrdocs/Metadata/Javadoc/Text.hpp rename to include/mrdocs/Metadata/Javadoc/Inline.hpp index 5dc97981f..7efea7b68 100644 --- a/include/mrdocs/Metadata/Javadoc/Text.hpp +++ b/include/mrdocs/Metadata/Javadoc/Inline.hpp @@ -10,45 +10,45 @@ // Official repository: https://github.com/cppalliance/mrdocs // -#ifndef MRDOCS_API_METADATA_JAVADOC_TEXT_HPP -#define MRDOCS_API_METADATA_JAVADOC_TEXT_HPP +#ifndef MRDOCS_API_METADATA_JAVADOC_INLINE_HPP +#define MRDOCS_API_METADATA_JAVADOC_INLINE_HPP #include #include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include #include #include namespace clang::mrdocs::doc { -/** Visit a text. +/** Visit an inline. - @param text The text to visit. - @param fn The function to call for each text. + @param inline The inline to visit. + @param fn The function to call for each inline. @param args Additional arguments to pass to the function. @return The result of calling the function. */ template< - class TextTy, + class InlineTy, class Fn, class... Args> - requires std::derived_from + requires std::derived_from decltype(auto) visit( - TextTy& text, + InlineTy& el, Fn&& fn, Args&&... args) { - auto visitor = makeVisitor( - text, std::forward(fn), + auto visitor = makeVisitor( + el, std::forward(fn), std::forward(args)...); - switch(text.Kind) + switch(el.Kind) { case NodeKind::link: return visitor.template visit(); @@ -65,36 +65,36 @@ visit( } } -/** Traverse a list of texts. +/** Traverse a list of inlines. @param list The list of texts to traverse. @param f The function to call for each text. @param args Additional arguments to pass to the function. */ template -requires std::derived_from +requires std::derived_from void traverse( std::vector> const& list, F&& f, Args&&... args) { - for(auto const& text : list) - visit(*text, + for(auto const& el : list) + visit(*el, std::forward(f), std::forward(args)...); } -/** Map the Polymorphic Text as a @ref dom::Value object. +/** Map the Polymorphic Inline as a @ref dom::Value object. @param io The output parameter to receive the dom::Object. @param I The input object. @param domCorpus The DOM corpus, or nullptr if not part of a corpus. */ -template TextTy> +template InlineTy> void tag_invoke( dom::ValueFromTag, IO& io, - TextTy const& I, + InlineTy const& I, DomCorpus const* domCorpus) { visit(*I, [&](auto const& U) @@ -109,14 +109,14 @@ tag_invoke( MRDOCS_DECL std::strong_ordering -operator<=>(Polymorphic const& lhs, Polymorphic const& rhs); +operator<=>(Polymorphic const& lhs, Polymorphic const& rhs); inline bool -operator==(Polymorphic const& lhs, Polymorphic const& rhs) { +operator==(Polymorphic const& lhs, Polymorphic const& rhs) { return std::is_eq(lhs <=> rhs); } } // clang::mrdocs::doc -#endif // MRDOCS_API_METADATA_JAVADOC_TEXT_HPP +#endif // MRDOCS_API_METADATA_JAVADOC_INLINE_HPP diff --git a/include/mrdocs/Metadata/Javadoc/Text/CopyDetails.hpp b/include/mrdocs/Metadata/Javadoc/Inline/CopyDetails.hpp similarity index 87% rename from include/mrdocs/Metadata/Javadoc/Text/CopyDetails.hpp rename to include/mrdocs/Metadata/Javadoc/Inline/CopyDetails.hpp index 9fcaa3e5a..58bc27a34 100644 --- a/include/mrdocs/Metadata/Javadoc/Text/CopyDetails.hpp +++ b/include/mrdocs/Metadata/Javadoc/Inline/CopyDetails.hpp @@ -10,12 +10,12 @@ // Official repository: https://github.com/cppalliance/mrdocs // -#ifndef MRDOCS_API_METADATA_JAVADOC_TEXT_COPYDETAILS_HPP -#define MRDOCS_API_METADATA_JAVADOC_TEXT_COPYDETAILS_HPP +#ifndef MRDOCS_API_METADATA_JAVADOC_INLINE_COPYDETAILS_HPP +#define MRDOCS_API_METADATA_JAVADOC_INLINE_COPYDETAILS_HPP #include -#include -#include +#include +#include #include namespace clang::mrdocs::doc { @@ -77,4 +77,4 @@ tag_invoke( } // clang::mrdocs::doc -#endif // MRDOCS_API_METADATA_JAVADOC_TEXT_COPYDETAILS_HPP +#endif // MRDOCS_API_METADATA_JAVADOC_INLINE_COPYDETAILS_HPP diff --git a/include/mrdocs/Metadata/Javadoc/Inline/InlineBase.hpp b/include/mrdocs/Metadata/Javadoc/Inline/InlineBase.hpp new file mode 100644 index 000000000..db924c584 --- /dev/null +++ b/include/mrdocs/Metadata/Javadoc/Inline/InlineBase.hpp @@ -0,0 +1,89 @@ +// +// This is a derivative work. originally part of the LLVM Project. +// Licensed under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// Copyright (c) 2023 Vinnie Falco (vinnie.falco@gmail.com) +// Copyright (c) 2023 Krystian Stasiowski (sdkrystian@gmail.com) +// +// Official repository: https://github.com/cppalliance/mrdocs +// + +#ifndef MRDOCS_API_METADATA_JAVADOC_INLINE_INLINEBASE_HPP +#define MRDOCS_API_METADATA_JAVADOC_INLINE_INLINEBASE_HPP + +#include +#include +#include + +namespace clang::mrdocs::doc { + +/** A Node containing a string of text. + + There will be no newlines in the text. Otherwise, + this would be represented as multiple text nodes + within a Paragraph node. +*/ +struct Inline : Node +{ + constexpr ~Inline() override = default; + + bool + isBlock() const noexcept final + { + return false; + } + + auto operator<=>(Inline const&) const = default; + bool operator==(Inline const&) const noexcept = default; + bool equals(Node const& other) const noexcept override + { + return Kind == other.Kind && + *this == dynamic_cast(other); + } + +protected: + constexpr Inline() noexcept = default; + + Inline( + NodeKind kind_) + : Node(kind_) + { + } +}; + +/** Map the @ref Inline to a @ref dom::Object. + + @param t The tag. + @param io The output object. + @param I The input object. + @param domCorpus The DOM corpus, or nullptr if not part of a corpus. + */ +template +void +tag_invoke( + dom::LazyObjectMapTag t, + IO& io, + Inline const& I, + DomCorpus const* domCorpus) +{ + tag_invoke(t, io, dynamic_cast(I), domCorpus); +} + +/** Return the @ref Inline as a @ref dom::Value object. + */ +inline +void +tag_invoke( + dom::ValueFromTag, + dom::Value& v, + Inline const& I, + DomCorpus const* domCorpus) +{ + v = dom::LazyObject(I, domCorpus); +} + +} // clang::mrdocs::doc + +#endif // MRDOCS_API_METADATA_JAVADOC_INLINE_INLINEBASE_HPP diff --git a/include/mrdocs/Metadata/Javadoc/Text/Link.hpp b/include/mrdocs/Metadata/Javadoc/Inline/Link.hpp similarity index 89% rename from include/mrdocs/Metadata/Javadoc/Text/Link.hpp rename to include/mrdocs/Metadata/Javadoc/Inline/Link.hpp index 0020f98d9..e3500016a 100644 --- a/include/mrdocs/Metadata/Javadoc/Text/Link.hpp +++ b/include/mrdocs/Metadata/Javadoc/Inline/Link.hpp @@ -10,11 +10,11 @@ // Official repository: https://github.com/cppalliance/mrdocs // -#ifndef MRDOCS_API_METADATA_JAVADOC_TEXT_LINK_HPP -#define MRDOCS_API_METADATA_JAVADOC_TEXT_LINK_HPP +#ifndef MRDOCS_API_METADATA_JAVADOC_INLINE_LINK_HPP +#define MRDOCS_API_METADATA_JAVADOC_INLINE_LINK_HPP #include -#include +#include #include namespace clang::mrdocs::doc { @@ -79,4 +79,4 @@ tag_invoke( } // clang::mrdocs::doc -#endif // MRDOCS_API_METADATA_JAVADOC_TEXT_LINK_HPP +#endif // MRDOCS_API_METADATA_JAVADOC_INLINE_LINK_HPP diff --git a/include/mrdocs/Metadata/Javadoc/Text/Parts.hpp b/include/mrdocs/Metadata/Javadoc/Inline/Parts.hpp similarity index 88% rename from include/mrdocs/Metadata/Javadoc/Text/Parts.hpp rename to include/mrdocs/Metadata/Javadoc/Inline/Parts.hpp index b7f94b39d..63e37f043 100644 --- a/include/mrdocs/Metadata/Javadoc/Text/Parts.hpp +++ b/include/mrdocs/Metadata/Javadoc/Inline/Parts.hpp @@ -10,8 +10,8 @@ // Official repository: https://github.com/cppalliance/mrdocs // -#ifndef MRDOCS_API_METADATA_JAVADOC_TEXT_PARTS_HPP -#define MRDOCS_API_METADATA_JAVADOC_TEXT_PARTS_HPP +#ifndef MRDOCS_API_METADATA_JAVADOC_INLINE_PARTS_HPP +#define MRDOCS_API_METADATA_JAVADOC_INLINE_PARTS_HPP #include #include @@ -54,4 +54,4 @@ tag_invoke( } // clang::mrdocs::doc -#endif // MRDOCS_API_METADATA_JAVADOC_TEXT_PARTS_HPP +#endif // MRDOCS_API_METADATA_JAVADOC_INLINE_PARTS_HPP diff --git a/include/mrdocs/Metadata/Javadoc/Text/Reference.hpp b/include/mrdocs/Metadata/Javadoc/Inline/Reference.hpp similarity index 90% rename from include/mrdocs/Metadata/Javadoc/Text/Reference.hpp rename to include/mrdocs/Metadata/Javadoc/Inline/Reference.hpp index d1131d82e..8a93125f4 100644 --- a/include/mrdocs/Metadata/Javadoc/Text/Reference.hpp +++ b/include/mrdocs/Metadata/Javadoc/Inline/Reference.hpp @@ -10,12 +10,12 @@ // Official repository: https://github.com/cppalliance/mrdocs // -#ifndef MRDOCS_API_METADATA_JAVADOC_TEXT_REFERENCE_HPP -#define MRDOCS_API_METADATA_JAVADOC_TEXT_REFERENCE_HPP +#ifndef MRDOCS_API_METADATA_JAVADOC_INLINE_REFERENCE_HPP +#define MRDOCS_API_METADATA_JAVADOC_INLINE_REFERENCE_HPP #include #include -#include +#include #include namespace clang::mrdocs::doc { @@ -86,4 +86,4 @@ tag_invoke( } // clang::mrdocs::doc -#endif // MRDOCS_API_METADATA_JAVADOC_TEXT_REFERENCE_HPP +#endif // MRDOCS_API_METADATA_JAVADOC_INLINE_REFERENCE_HPP diff --git a/include/mrdocs/Metadata/Javadoc/Text/Style.hpp b/include/mrdocs/Metadata/Javadoc/Inline/Style.hpp similarity index 87% rename from include/mrdocs/Metadata/Javadoc/Text/Style.hpp rename to include/mrdocs/Metadata/Javadoc/Inline/Style.hpp index acdfeb094..2be1a17c0 100644 --- a/include/mrdocs/Metadata/Javadoc/Text/Style.hpp +++ b/include/mrdocs/Metadata/Javadoc/Inline/Style.hpp @@ -10,8 +10,8 @@ // Official repository: https://github.com/cppalliance/mrdocs // -#ifndef MRDOCS_API_METADATA_JAVADOC_TEXT_STYLE_HPP -#define MRDOCS_API_METADATA_JAVADOC_TEXT_STYLE_HPP +#ifndef MRDOCS_API_METADATA_JAVADOC_INLINE_STYLE_HPP +#define MRDOCS_API_METADATA_JAVADOC_INLINE_STYLE_HPP #include #include @@ -55,4 +55,4 @@ tag_invoke( } // clang::mrdocs::doc -#endif // MRDOCS_API_METADATA_JAVADOC_TEXT_STYLE_HPP +#endif // MRDOCS_API_METADATA_JAVADOC_INLINE_STYLE_HPP diff --git a/include/mrdocs/Metadata/Javadoc/Text/Styled.hpp b/include/mrdocs/Metadata/Javadoc/Inline/Styled.hpp similarity index 87% rename from include/mrdocs/Metadata/Javadoc/Text/Styled.hpp rename to include/mrdocs/Metadata/Javadoc/Inline/Styled.hpp index 5cc4e2c4b..94fcbdf8c 100644 --- a/include/mrdocs/Metadata/Javadoc/Text/Styled.hpp +++ b/include/mrdocs/Metadata/Javadoc/Inline/Styled.hpp @@ -10,12 +10,12 @@ // Official repository: https://github.com/cppalliance/mrdocs // -#ifndef MRDOCS_API_METADATA_JAVADOC_TEXT_STYLED_HPP -#define MRDOCS_API_METADATA_JAVADOC_TEXT_STYLED_HPP +#ifndef MRDOCS_API_METADATA_JAVADOC_INLINE_STYLED_HPP +#define MRDOCS_API_METADATA_JAVADOC_INLINE_STYLED_HPP #include -#include -#include +#include +#include #include namespace clang::mrdocs::doc { @@ -79,4 +79,4 @@ tag_invoke( } // clang::mrdocs::doc -#endif // MRDOCS_API_METADATA_JAVADOC_TEXT_STYLED_HPP +#endif // MRDOCS_API_METADATA_JAVADOC_INLINE_STYLED_HPP diff --git a/include/mrdocs/Metadata/Javadoc/Text/TextBase.hpp b/include/mrdocs/Metadata/Javadoc/Inline/Text.hpp similarity index 80% rename from include/mrdocs/Metadata/Javadoc/Text/TextBase.hpp rename to include/mrdocs/Metadata/Javadoc/Inline/Text.hpp index e2a4e2ddf..0571e31d2 100644 --- a/include/mrdocs/Metadata/Javadoc/Text/TextBase.hpp +++ b/include/mrdocs/Metadata/Javadoc/Inline/Text.hpp @@ -10,11 +10,11 @@ // Official repository: https://github.com/cppalliance/mrdocs // -#ifndef MRDOCS_API_METADATA_JAVADOC_TEXT_TEXTBASE_HPP -#define MRDOCS_API_METADATA_JAVADOC_TEXT_TEXTBASE_HPP +#ifndef MRDOCS_API_METADATA_JAVADOC_INLINE_TEXT_HPP +#define MRDOCS_API_METADATA_JAVADOC_INLINE_TEXT_HPP #include -#include +#include #include namespace clang::mrdocs::doc { @@ -25,25 +25,21 @@ namespace clang::mrdocs::doc { this would be represented as multiple text nodes within a Paragraph node. */ -struct Text : Node +struct Text : Inline { std::string string; static constexpr auto static_kind = NodeKind::text; - explicit - Text( - std::string string_ = std::string()) noexcept - : Node(NodeKind::text) + constexpr ~Text() override = default; + + constexpr Text() noexcept = default; + + explicit Text(std::string string_ = std::string()) noexcept + : Inline(NodeKind::text) , string(std::move(string_)) - { - } + {} - bool - isBlock() const noexcept final - { - return false; - } auto operator<=>(Text const&) const = default; bool operator==(Text const&) const noexcept = default; @@ -57,7 +53,7 @@ struct Text : Node Text( std::string string_, NodeKind kind_) - : Node(kind_) + : Inline(kind_) , string(std::move(string_)) { } @@ -97,4 +93,4 @@ tag_invoke( } // clang::mrdocs::doc -#endif // MRDOCS_API_METADATA_JAVADOC_TEXT_TEXTBASE_HPP +#endif // MRDOCS_API_METADATA_JAVADOC_INLINE_TEXT_HPP diff --git a/include/mrdocs/Metadata/Javadoc/Node.hpp b/include/mrdocs/Metadata/Javadoc/Node.hpp index c1d49caa8..565c73427 100644 --- a/include/mrdocs/Metadata/Javadoc/Node.hpp +++ b/include/mrdocs/Metadata/Javadoc/Node.hpp @@ -15,8 +15,8 @@ #include #include +#include #include -#include #include #include diff --git a/include/mrdocs/Metadata/Javadoc/Node/NodeBase.hpp b/include/mrdocs/Metadata/Javadoc/Node/NodeBase.hpp index 20a4c35cb..22400db60 100644 --- a/include/mrdocs/Metadata/Javadoc/Node/NodeBase.hpp +++ b/include/mrdocs/Metadata/Javadoc/Node/NodeBase.hpp @@ -37,11 +37,6 @@ struct MRDOCS_DECL virtual ~Node() = default; - explicit Node(NodeKind const kind_) noexcept - : Kind(kind_) - { - } - virtual bool isBlock() const noexcept = 0; bool isText() const noexcept @@ -55,6 +50,13 @@ struct MRDOCS_DECL { return Kind == other.Kind; } +protected: + constexpr Node() noexcept = default; + + explicit Node(NodeKind const kind_) noexcept + : Kind(kind_) + { + } }; /** Map the @ref Node to a @ref dom::Object. diff --git a/include/mrdocs/Metadata/Name/NameBase.hpp b/include/mrdocs/Metadata/Name/NameBase.hpp index 3a9971705..b0e43ddf9 100644 --- a/include/mrdocs/Metadata/Name/NameBase.hpp +++ b/include/mrdocs/Metadata/Name/NameBase.hpp @@ -65,12 +65,6 @@ struct NameInfo constexpr bool isIdentifier() const noexcept { return Kind == NameKind::Identifier; } constexpr bool isSpecialization() const noexcept { return Kind == NameKind::Specialization; } - - explicit - constexpr - NameInfo(NameKind const kind) noexcept - : Kind(kind) {} - constexpr virtual ~NameInfo() = default; std::strong_ordering @@ -86,6 +80,11 @@ struct NameInfo constexpr NameInfo() noexcept : NameInfo(NameKind::Identifier) {}; + + explicit + constexpr + NameInfo(NameKind const kind) noexcept + : Kind(kind) {} }; MRDOCS_DECL diff --git a/include/mrdocs/Metadata/TArg/TArgBase.hpp b/include/mrdocs/Metadata/TArg/TArgBase.hpp index 2aadc8d7f..0ce2269cf 100644 --- a/include/mrdocs/Metadata/TArg/TArgBase.hpp +++ b/include/mrdocs/Metadata/TArg/TArgBase.hpp @@ -36,6 +36,8 @@ struct TArg auto operator<=>(TArg const&) const = default; protected: + constexpr TArg() noexcept = default; + constexpr TArg( TArgKind kind) noexcept diff --git a/include/mrdocs/Metadata/TParam/TParamBase.hpp b/include/mrdocs/Metadata/TParam/TParamBase.hpp index a58d91435..5b201035d 100644 --- a/include/mrdocs/Metadata/TParam/TParamBase.hpp +++ b/include/mrdocs/Metadata/TParam/TParamBase.hpp @@ -27,7 +27,7 @@ class DomCorpus; struct TParam { /** The kind of template parameter this is */ - TParamKind Kind; + TParamKind Kind = TParamKind::Type; /** The template parameters name, if any */ std::string Name; @@ -47,6 +47,9 @@ struct TParam std::strong_ordering operator<=>(TParam const&) const; protected: + constexpr + TParam() noexcept = default; + constexpr TParam( TParamKind kind) noexcept diff --git a/include/mrdocs/Metadata/Type/TypeBase.hpp b/include/mrdocs/Metadata/Type/TypeBase.hpp index bf393c131..80fff732f 100644 --- a/include/mrdocs/Metadata/Type/TypeBase.hpp +++ b/include/mrdocs/Metadata/Type/TypeBase.hpp @@ -59,7 +59,6 @@ struct TypeInfo */ std::vector Constraints; - constexpr virtual ~TypeInfo() = default; constexpr bool isNamed() const noexcept { return Kind == TypeKind::Named; } constexpr bool isDecltype() const noexcept { return Kind == TypeKind::Decltype; } @@ -79,6 +78,8 @@ struct TypeInfo auto operator<=>(TypeInfo const&) const = default; protected: + constexpr virtual ~TypeInfo() = default; + constexpr TypeInfo( TypeKind kind) noexcept diff --git a/src/lib/AST/ParseJavadoc.cpp b/src/lib/AST/ParseJavadoc.cpp index 4e435c9eb..b65980e6b 100644 --- a/src/lib/AST/ParseJavadoc.cpp +++ b/src/lib/AST/ParseJavadoc.cpp @@ -15,7 +15,7 @@ #include "ParseJavadoc.hpp" #include #include -#include +#include #include #include #include @@ -742,7 +742,7 @@ visitTextComment( } // Only insert non-empty text nodes - if(! s.empty()) + if (!s.empty()) { emplaceText( C->hasTrailingNewline(), diff --git a/src/lib/Metadata/Finalizers/JavadocFinalizer.cpp b/src/lib/Metadata/Finalizers/JavadocFinalizer.cpp index 0b3ae2dd1..887ef651d 100644 --- a/src/lib/Metadata/Finalizers/JavadocFinalizer.cpp +++ b/src/lib/Metadata/Finalizers/JavadocFinalizer.cpp @@ -898,7 +898,7 @@ processRelates(Javadoc& javadoc) Info const* currentPtr = corpus_.find(current_context_->id); MRDOCS_ASSERT(currentPtr); - Info const current = *currentPtr; + Info const& current = *currentPtr; if (!current.isFunction()) { diff --git a/src/lib/Metadata/Javadoc.cpp b/src/lib/Metadata/Javadoc.cpp index 668442b7e..bf7d94434 100644 --- a/src/lib/Metadata/Javadoc.cpp +++ b/src/lib/Metadata/Javadoc.cpp @@ -14,7 +14,7 @@ #include #include #include -#include +#include #include #include #include From 6aa8b57516a027bdebef9c97cf8a62271854f623 Mon Sep 17 00:00:00 2001 From: Alan de Freitas Date: Wed, 24 Sep 2025 20:33:17 -0500 Subject: [PATCH 07/23] style: version printer mimics clang --- src/tool/ToolMain.cpp | 46 +++++++++++++++++++++---------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/src/tool/ToolMain.cpp b/src/tool/ToolMain.cpp index 7be66d202..3e4717d89 100644 --- a/src/tool/ToolMain.cpp +++ b/src/tool/ToolMain.cpp @@ -16,8 +16,9 @@ #include #include #include -#include #include +#include +#include #include #include @@ -36,16 +37,6 @@ DoGenerateAction( ReferenceDirectories const& dirs, char const** argv); -void -print_version(llvm::raw_ostream& os) -{ - os << project_name - << "\n " << project_description - << "\n version: " << project_version_with_build - << "\n build: " << project_version_build - << "\n built with LLVM " << LLVM_VERSION_STRING - << "\n"; -} Expected getReferenceDirectories(std::string const& execPath) @@ -99,8 +90,28 @@ mrdocs_main(int argc, char const** argv) llvm::sys::PrintStackTraceOnErrorSignal(argv[0]); llvm::setBugReportMsg("PLEASE submit a bug report to https://github.com/cppalliance/mrdocs/issues/ and include the crash backtrace.\n"); + // Set up addons directory +#ifdef __GNUC__ +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wpedantic" + // error: ISO C++ forbids taking address of function ‘::main’ +#endif + void* addressOfMain = reinterpret_cast(&main); +#ifdef __GNUC__ +# pragma GCC diagnostic pop +#endif + std::string execPath = llvm::sys::fs:: + getMainExecutable(argv[0], addressOfMain); + // Parse command line options - llvm::cl::SetVersionPrinter(&print_version); + llvm::cl::SetVersionPrinter([execPath](llvm::raw_ostream& os) { + os << project_name << " version " << project_version_with_build << "\n"; + os << "Built with LLVM " << LLVM_VERSION_STRING << "\n"; + os << "Build SHA: " << project_version_build << "\n"; + os << "Target: " << llvm::sys::getDefaultTargetTriple() << "\n"; + os << "InstalledDir: " << files::getParentDir(execPath) << "\n"; + }); + toolArgs.hideForeignOptions(); if (!llvm::cl::ParseCommandLineOptions( argc, argv, toolArgs.usageText)) @@ -108,17 +119,6 @@ mrdocs_main(int argc, char const** argv) return EXIT_FAILURE; } - // Set up addons directory -#ifdef __GNUC__ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wpedantic" -// error: ISO C++ forbids taking address of function ‘::main’ -#endif - void* addressOfMain = reinterpret_cast(&main); -#ifdef __GNUC__ -#pragma GCC diagnostic pop -#endif - std::string execPath = llvm::sys::fs::getMainExecutable(argv[0], addressOfMain); // Before `DoGenerateAction`, we use an error reporting level. // DoGenerateAction will set the level to whatever is specified in From 569bc116796d3215ac8cac2f42a84bac9bb0b9cb Mon Sep 17 00:00:00 2001 From: Alan de Freitas Date: Wed, 24 Sep 2025 21:46:02 -0500 Subject: [PATCH 08/23] feat: show-enum-constants option Since an EnumConstant is a regular information type according to the Clang AST, it supports all Javadoc features. For consistency, we create an option analogous to 'show-namespaces' for 'enum-constants', so the user has the ability to render their own doc comments instead of discarding them. The logic is also important because it opens the possibility of conditionally rendering enum constants. --- docs/mrdocs.schema.json | 10 + .../generator/adoc/partials/markup/a.adoc.hbs | 4 +- .../generator/adoc/partials/symbol.adoc.hbs | 15 +- .../generator/html/partials/markup/a.html.hbs | 6 +- .../generator/html/partials/symbol.html.hbs | 20 +- src/lib/ConfigOptions.json | 7 + src/lib/Gen/hbs/VisitorHelpers.cpp | 2 +- .../config/auto-brief/auto-brief.html | 64 +- .../config/auto-brief/no-auto-brief.html | 64 +- .../brief-from-function-class.html | 26 +- .../brief-from-operator.html | 20 +- .../param-from-function-class.html | 30 +- .../param-from-operator.html | 16 +- .../returns-from-brief.html | 10 +- .../returns-from-return-brief.html | 6 +- .../returns-from-special.html | 58 +- .../config/auto-relates/auto-relates.html | 16 +- .../config/auto-relates/derived.html | 22 +- .../config/auto-relates/enum.html | 27 +- .../config/auto-relates/no-auto-relates.html | 16 +- .../config/auto-relates/qualified.html | 24 +- .../config/auto-relates/remove-friend.html | 8 +- .../config/auto-relates/return-type.html | 14 +- .../config/extract-all/no-extract-all.html | 6 +- .../no-extract-empty-namespaces.html | 28 +- .../extract-friends/extract-friends.html | 12 +- .../extract-friends/no-extract-friends.html | 12 +- .../base.html | 8 +- .../extract-implicit-specializations.html | 10 +- .../no-extract-implicit-specializations.html | 8 +- .../extract-local-classes.html | 8 +- .../no-extract-local-classes.html | 4 +- .../extract-private-virtual.html | 8 +- .../no-extract-private-virtual.html | 6 +- .../base-overload-set.html | 16 +- .../copy-dependencies.html | 52 +- .../config/inherit-base-members/copy.html | 86 +- .../config/inherit-base-members/never.html | 40 +- .../inherit-base-members/reference.html | 40 +- .../inherit-base-members/skip-special.html | 72 +- .../config/legible-names/constructor.html | 16 +- .../config/missing-include-prefixes/main.html | 6 +- .../config/missing-include-shims/main.html | 4 +- .../config/overloads/const-mutable.html | 10 +- .../config/overloads/visibility.html | 28 +- .../golden-tests/config/sfinae/redeclare.html | 4 +- .../config/sfinae/return-based.html | 4 +- .../show-enum-constants-false.adoc | 46 + .../show-enum-constants-false.cpp | 9 + .../show-enum-constants-false.html | 68 ++ .../show-enum-constants-false.xml | 41 + .../show-enum-constants-false.yml | 1 + .../show-enum-constants-true.adoc | 88 ++ .../show-enum-constants-true.cpp | 9 + .../show-enum-constants-true.html | 125 +++ .../show-enum-constants-true.xml | 41 + .../show-enum-constants-true.yml | 1 + .../show-namespaces/show-namespaces.html | 6 +- .../sort-members-by-location.html | 26 +- .../sort-members-by/sort-members-by-name.html | 26 +- .../sort-namespace-members-by-location.html | 66 +- .../sort-namespace-members-by-name.html | 66 +- .../config/sort/sort-members.html | 66 +- .../golden-tests/config/sort/unordered.html | 66 +- test-files/golden-tests/core/empty.html | 2 +- test-files/golden-tests/core/libcxx.html | 4 +- test-files/golden-tests/core/utf-8.html | 4 +- .../filters/file/exclude-self.html | 2 +- .../filters/file/include-self.html | 6 +- .../filters/file/include-symlink.html | 4 +- .../filters/file/subdirectories.html | 4 +- .../filters/file/subdirectories2.html | 4 +- .../filters/symbol-name/blacklist_0.html | 22 +- .../symbol-name/excluded-base-class.html | 24 +- .../symbol-name/excluded-namespace-alias.html | 8 +- .../filters/symbol-name/extraction-mode.html | 52 +- .../symbol-name/impl-defined-member.html | 10 +- .../filters/symbol-name/whitelist_0.html | 36 +- .../symbol-type/nested-private-template.html | 8 +- .../golden-tests/javadoc/brief/brief-1.html | 6 +- .../golden-tests/javadoc/brief/brief-2.html | 14 +- .../golden-tests/javadoc/brief/brief-3.html | 12 +- .../golden-tests/javadoc/brief/brief-4.html | 10 +- .../golden-tests/javadoc/brief/brief-5.html | 14 +- .../golden-tests/javadoc/brief/brief-6.html | 4 +- .../golden-tests/javadoc/code/code.html | 4 +- .../javadoc/copybrief/copybrief.html | 8 +- .../javadoc/copydetails/copydetails.html | 8 +- .../javadoc/copydoc/conversion.html | 18 +- .../javadoc/copydoc/decay-params.html | 12 +- .../javadoc/copydoc/fundamental.html | 12 +- .../javadoc/copydoc/no-param.html | 12 +- .../javadoc/copydoc/operator-param.html | 10 +- .../javadoc/copydoc/param-types.html | 69 +- .../javadoc/copydoc/qualified.html | 40 +- .../javadoc/copydoc/qualifiers.html | 30 +- .../javadoc/copydoc/template-arguments.html | 30 +- .../golden-tests/javadoc/inline/styled.html | 6 +- .../golden-tests/javadoc/link/link.html | 4 +- test-files/golden-tests/javadoc/lists/li.html | 4 +- .../golden-tests/javadoc/lists/listitem.html | 10 +- .../golden-tests/javadoc/paragraph/par-1.html | 10 +- .../javadoc/paragraph/para-1.html | 10 +- .../javadoc/paragraph/para-2.html | 4 +- .../javadoc/paragraph/para-3.html | 4 +- .../golden-tests/javadoc/param/param-1.html | 12 +- .../javadoc/param/param-direction.html | 22 +- .../javadoc/param/param-duplicate.html | 14 +- .../golden-tests/javadoc/param/param.html | 10 +- .../golden-tests/javadoc/pre/pre-post.html | 4 +- .../golden-tests/javadoc/ref/broken-ref.html | 6 +- .../golden-tests/javadoc/ref/punctuation.html | 8 +- test-files/golden-tests/javadoc/ref/ref.html | 108 +-- .../golden-tests/javadoc/relates/relates.html | 8 +- .../golden-tests/javadoc/returns/returns.html | 12 +- .../golden-tests/javadoc/throw/throw.html | 4 +- .../golden-tests/javadoc/tparam/tparam-1.html | 6 +- .../golden-tests/output/canonical_1.html | 18 +- .../golden-tests/snippets/distance.html | 2 +- .../golden-tests/snippets/is_prime.html | 2 +- test-files/golden-tests/snippets/sqrt.html | 2 +- .../golden-tests/snippets/terminate.html | 2 +- .../golden-tests/symbols/concept/concept.html | 8 +- .../symbols/concept/requires-clause.html | 16 +- .../golden-tests/symbols/enum/enum.adoc | 38 +- .../golden-tests/symbols/enum/enum.html | 76 +- .../symbols/function/attributes-2.html | 4 +- .../symbols/function/attributes_1.html | 4 +- .../golden-tests/symbols/function/auto.html | 4 +- .../function/explicit-conv-operator.html | 18 +- .../symbols/function/explicit-ctor.html | 50 +- .../function/explicit-object-parameter.html | 10 +- .../symbols/function/function-parm-decay.html | 14 +- .../function/function-template-template.html | 4 +- .../symbols/function/function-template.html | 26 +- .../function/function-tparm-decay.html | 14 +- .../golden-tests/symbols/function/mem-fn.html | 78 +- .../symbols/function/merge-params.html | 4 +- .../symbols/function/merge-tparams.html | 4 +- .../symbols/function/noreturn.html | 10 +- .../symbols/function/overloaded-op-1.html | 6 +- .../symbols/function/overloaded-op-2.html | 6 +- .../symbols/function/qualified-params.html | 12 +- .../golden-tests/symbols/function/sfinae.html | 38 +- .../spec-mem-implicit-instantiation.html | 62 +- .../symbols/function/type-resolution.html | 102 +-- .../symbols/function/variadic-function.html | 12 +- .../symbols/guide/explicit-deduct-guide.html | 12 +- .../namespace-alias/namespace-alias-1.html | 8 +- .../namespace-alias/namespace-alias-2.html | 10 +- .../namespace-alias/namespace-alias-3.html | 10 +- .../symbols/namespace/namespace.html | 36 +- .../symbols/overloads/overloads-brief.html | 48 +- .../symbols/overloads/overloads-metadata.html | 10 +- .../symbols/overloads/overloads-ostream.html | 28 +- .../symbols/overloads/overloads.html | 34 +- .../symbols/record/class-private-alias.html | 6 +- .../record/class-template-partial-spec.html | 10 +- .../symbols/record/class-template-spec.html | 38 +- .../class-template-specializations-1.html | 828 +++++++++--------- .../class-template-specializations-2.html | 48 +- .../class-template-specializations-3.html | 130 +-- .../symbols/record/class-template.html | 46 +- .../symbols/record/conditional-explicit.html | 22 +- .../symbols/record/dtor-overloads.html | 10 +- .../symbols/record/final-class.html | 12 +- .../symbols/record/friend-duplicate.html | 8 +- .../symbols/record/friend-excluded.html | 8 +- .../symbols/record/friend-fn-has-docs.html | 6 +- .../symbols/record/friend-fn-member.html | 12 +- .../symbols/record/friend-fn-multi-2nd.html | 8 +- .../symbols/record/friend-fn-multi-free.html | 8 +- .../symbols/record/friend-fn-multi.html | 8 +- .../symbols/record/friend-fn.html | 6 +- .../symbols/record/friend-type.html | 10 +- .../symbols/record/local-class.html | 6 +- .../record/out-of-line-record-def.html | 6 +- .../golden-tests/symbols/record/record-1.html | 20 +- .../symbols/record/record-access.html | 26 +- .../symbols/record/record-data.html | 44 +- .../symbols/record/record-inheritance.html | 34 +- .../template-specialization-inheritance.html | 30 +- .../golden-tests/symbols/record/union.html | 16 +- .../golden-tests/symbols/record/unnamed.html | 4 +- .../symbols/typedef/alias-template.html | 12 +- .../symbols/typedef/decay-to-primary.html | 24 +- .../typedef/dependency-propagation.html | 14 +- .../implicit-instantiation-member-ref.html | 24 +- .../symbols/using-directive/using-1.html | 6 +- .../symbols/using-enum/using-enum-in-ns.adoc | 5 +- .../symbols/using-enum/using-enum-in-ns.html | 19 +- .../using-enum/using-enum-in-record.adoc | 5 +- .../using-enum/using-enum-in-record.html | 21 +- .../symbols/using/using-function-after.html | 12 +- .../using/using-function-and-type.html | 10 +- .../using/using-function-excluded.html | 4 +- .../using/using-function-local-overloads.html | 16 +- .../using/using-function-overloads.html | 14 +- .../symbols/using/using-function.html | 8 +- .../using/using-member-conversion.html | 12 +- .../symbols/using/using-member-function.html | 62 +- .../symbols/using/using-multi.html | 12 +- .../symbols/using/using-struct-template.html | 12 +- .../symbols/using/using-struct.html | 12 +- .../using/using-template-function.html | 8 +- .../symbols/using/using-typename.html | 8 +- .../symbols/variable/no_unique_address.html | 10 +- .../symbols/variable/ns-variables.html | 22 +- .../variable/static-data-def-constexpr.html | 10 +- .../symbols/variable/static-data-def.html | 28 +- .../variable/static-data-template.html | 10 +- .../variable/var-inline-constexpr.html | 22 +- .../symbols/variable/var-template.html | 16 +- .../templates/c_mct_expl_inline.html | 12 +- .../templates/c_mct_expl_outside.html | 12 +- .../templates/c_mft_expl_inline.html | 10 +- .../templates/c_mft_expl_outside.html | 10 +- .../golden-tests/templates/ct_expl.html | 10 +- .../templates/ct_expl_dependency.html | 6 +- test-files/golden-tests/templates/ct_mc.html | 8 +- .../templates/ct_mc_expl_outside.html | 14 +- test-files/golden-tests/templates/ct_mct.html | 8 +- .../templates/ct_mct_expl_inline.html | 12 +- .../templates/ct_mct_expl_outside.html | 16 +- test-files/golden-tests/templates/ct_mf.html | 6 +- .../templates/ct_mf_expl_outside.html | 10 +- test-files/golden-tests/templates/ct_mft.html | 6 +- .../templates/ct_mft_expl_inline.html | 10 +- .../templates/ct_mft_expl_outside.html | 14 +- .../golden-tests/templates/ft_expl.html | 8 +- 230 files changed, 2853 insertions(+), 2502 deletions(-) create mode 100644 test-files/golden-tests/config/show-enum-constants/show-enum-constants-false.adoc create mode 100644 test-files/golden-tests/config/show-enum-constants/show-enum-constants-false.cpp create mode 100644 test-files/golden-tests/config/show-enum-constants/show-enum-constants-false.html create mode 100644 test-files/golden-tests/config/show-enum-constants/show-enum-constants-false.xml create mode 100644 test-files/golden-tests/config/show-enum-constants/show-enum-constants-false.yml create mode 100644 test-files/golden-tests/config/show-enum-constants/show-enum-constants-true.adoc create mode 100644 test-files/golden-tests/config/show-enum-constants/show-enum-constants-true.cpp create mode 100644 test-files/golden-tests/config/show-enum-constants/show-enum-constants-true.html create mode 100644 test-files/golden-tests/config/show-enum-constants/show-enum-constants-true.xml create mode 100644 test-files/golden-tests/config/show-enum-constants/show-enum-constants-true.yml diff --git a/docs/mrdocs.schema.json b/docs/mrdocs.schema.json index 8865cd48f..f904ece17 100644 --- a/docs/mrdocs.schema.json +++ b/docs/mrdocs.schema.json @@ -425,6 +425,16 @@ "title": "Detect and reduce SFINAE expressions", "type": "boolean" }, + "show-enum-constants": { + "default": false, + "description": "When set to true, MrDocs creates a page for each enum constant in the documentation.", + "enum": [ + true, + false + ], + "title": "Show enum constant pages in the documentation", + "type": "boolean" + }, "show-namespaces": { "default": true, "description": "When set to true, MrDocs creates a page for each namespace in the documentation.", diff --git a/share/mrdocs/addons/generator/adoc/partials/markup/a.adoc.hbs b/share/mrdocs/addons/generator/adoc/partials/markup/a.adoc.hbs index 172ba3efc..429b416be 100644 --- a/share/mrdocs/addons/generator/adoc/partials/markup/a.adoc.hbs +++ b/share/mrdocs/addons/generator/adoc/partials/markup/a.adoc.hbs @@ -3,7 +3,9 @@ https://gitlab.com/antora/antora/-/issues/428 }} -{{#if (starts_with href "#")~}} +{{#if (eq href @root.symbol.url)~}} + {{{> @partial-block }}} +{{~else if (starts_with href "#")~}} link:{{{ href }}}[{{> @partial-block }}] {{~else if (starts_with href "/")~}} xref:{{{remove_prefix href "/"}}}[{{> @partial-block }}] diff --git a/share/mrdocs/addons/generator/adoc/partials/symbol.adoc.hbs b/share/mrdocs/addons/generator/adoc/partials/symbol.adoc.hbs index abb772c7a..9dcfabc93 100644 --- a/share/mrdocs/addons/generator/adoc/partials/symbol.adoc.hbs +++ b/share/mrdocs/addons/generator/adoc/partials/symbol.adoc.hbs @@ -69,20 +69,7 @@ {{>symbol/tranche tranche=symbol.members label="" is-namespace=true}} {{! Enum members }} {{else if (eq symbol.kind "enum")}} -{{#if symbol.constants}} -{{#> markup/dynamic-level-h }}Members{{/markup/dynamic-level-h}} - -[cols=2] -|=== -| Name -| Description -{{#each (filter_by symbol.constants "isRegular" "isSeeBelow")}} -|`{{>symbol/name-text .}}` -|{{> javadoc/inline-brief doc.brief }} -{{/each}} -|=== - -{{/if}} +{{>symbol/members-table members=symbol.constants title="Members"}} {{/if}} {{! Friends }} {{#if symbol.friends}} diff --git a/share/mrdocs/addons/generator/html/partials/markup/a.html.hbs b/share/mrdocs/addons/generator/html/partials/markup/a.html.hbs index 03626d5ca..fcfdd3283 100644 --- a/share/mrdocs/addons/generator/html/partials/markup/a.html.hbs +++ b/share/mrdocs/addons/generator/html/partials/markup/a.html.hbs @@ -1 +1,5 @@ -{{> @partial-block }} \ No newline at end of file +{{#if (eq href @root.symbol.url)~}} + {{{> @partial-block }}} +{{~else~}} + {{> @partial-block }} +{{~/if~}} \ No newline at end of file diff --git a/share/mrdocs/addons/generator/html/partials/symbol.html.hbs b/share/mrdocs/addons/generator/html/partials/symbol.html.hbs index da0093e42..4691fc895 100644 --- a/share/mrdocs/addons/generator/html/partials/symbol.html.hbs +++ b/share/mrdocs/addons/generator/html/partials/symbol.html.hbs @@ -93,25 +93,7 @@ {{>symbol/tranche tranche=symbol.members label="" is-namespace=true}} {{! Enum members }} {{else if (eq symbol.kind "enum")}} -
-{{#> markup/dynamic-level-h level=2 }}Members{{/markup/dynamic-level-h}} - - - - - - - - -{{#each (filter_by symbol.constants "isRegular" "isSeeBelow")}} - - - - -{{/each}} - -
NameDescription
{{>symbol/name-text .}}{{> javadoc/inline-brief doc.brief }}
-
+{{>symbol/members-table members=symbol.constants title="Members"}} {{/if}} {{! Friends }} {{#if symbol.friends}} diff --git a/src/lib/ConfigOptions.json b/src/lib/ConfigOptions.json index a75281f17..dc8212890 100644 --- a/src/lib/ConfigOptions.json +++ b/src/lib/ConfigOptions.json @@ -453,6 +453,13 @@ "type": "bool", "default": true }, + { + "name": "show-enum-constants", + "brief": "Show enum constant pages in the documentation", + "details": "When set to true, MrDocs creates a page for each enum constant in the documentation.", + "type": "bool", + "default": false + }, { "name": "global-namespace-index", "brief": "Use the global namespace page as an index for all symbols", diff --git a/src/lib/Gen/hbs/VisitorHelpers.cpp b/src/lib/Gen/hbs/VisitorHelpers.cpp index 48b62d8a1..ce3629233 100644 --- a/src/lib/Gen/hbs/VisitorHelpers.cpp +++ b/src/lib/Gen/hbs/VisitorHelpers.cpp @@ -19,7 +19,7 @@ namespace clang::mrdocs::hbs { bool shouldGenerate(Info const& I, Config const& config) { - if (I.isEnumConstant()) + if (I.isEnumConstant() && !config->showEnumConstants) { return false; } diff --git a/test-files/golden-tests/config/auto-brief/auto-brief.html b/test-files/golden-tests/config/auto-brief/auto-brief.html index 4eeac05f7..85b45bcbe 100644 --- a/test-files/golden-tests/config/auto-brief/auto-brief.html +++ b/test-files/golden-tests/config/auto-brief/auto-brief.html @@ -7,7 +7,7 @@

Reference

-

+

Functions

@@ -56,7 +56,7 @@

Functions

-

copyBriefFromCopyBrief

+

copyBriefFromCopyBrief

This is the explicit brief. @@ -76,7 +76,7 @@

Synopsis

-

copyBriefFromExplicitBrief

+

copyBriefFromExplicitBrief

This is the explicit brief. @@ -96,7 +96,7 @@

Synopsis

-

copyBriefFromFirstSentenceAsBrief

+

copyBriefFromFirstSentenceAsBrief

This is the brief. @@ -116,7 +116,7 @@

Synopsis

-

copyBriefFromFirstValid

+

copyBriefFromFirstValid

This function has documentation but no brief. @@ -136,7 +136,7 @@

Synopsis

-

copyDetailsFromCopyBrief

+

copyDetailsFromCopyBrief

Details will be copied @@ -156,7 +156,7 @@

Synopsis

-

copyDetailsFromDocNoBrief

+

copyDetailsFromDocNoBrief

Custom brief @@ -176,7 +176,7 @@

Synopsis

-

copyDetailsFromExplicitBrief

+

copyDetailsFromExplicitBrief

Synopsis

@@ -196,7 +196,7 @@

Description

-

copyDetailsFromFirstSentenceAsBrief

+

copyDetailsFromFirstSentenceAsBrief

Synopsis

@@ -216,7 +216,7 @@

Description

-

copyDetailsFromNoDoc

+

copyDetailsFromNoDoc

Custom brief @@ -236,7 +236,7 @@

Synopsis

-

copyDocFromCopyBrief

+

copyDocFromCopyBrief

This is the explicit brief. @@ -260,7 +260,7 @@

Description

-

copyDocFromExplicitBrief

+

copyDocFromExplicitBrief

This is the explicit brief. @@ -284,7 +284,7 @@

Description

-

copyDocFromFirstSentenceAsBrief

+

copyDocFromFirstSentenceAsBrief

This is the brief. @@ -308,7 +308,7 @@

Description

-

docNoBriefFunction

+

docNoBriefFunction

This function has documentation but no brief. @@ -328,7 +328,7 @@

Synopsis

-

explicitBriefFunction

+

explicitBriefFunction

This is the explicit brief. @@ -352,7 +352,7 @@

Description

-

explicitBriefFunction2

+

explicitBriefFunction2

This is the explicit brief. @@ -376,7 +376,7 @@

Description

-

failCircularReferenceCopyFunction

+

failCircularReferenceCopyFunction

Synopsis

@@ -392,7 +392,7 @@

Synopsis

-

failCircularSourceFunctionA

+

failCircularSourceFunctionA

Synopsis

@@ -408,7 +408,7 @@

Synopsis

-

failCircularSourceFunctionB

+

failCircularSourceFunctionB

Synopsis

@@ -424,7 +424,7 @@

Synopsis

-

failCopyBriefFromDocNoBrief

+

failCopyBriefFromDocNoBrief

This function has documentation but no brief. @@ -444,7 +444,7 @@

Synopsis

-

failCopyBriefFromInvalidReference

+

failCopyBriefFromInvalidReference

Synopsis

@@ -460,7 +460,7 @@

Synopsis

-

failCopyBriefFromNoDoc

+

failCopyBriefFromNoDoc

Synopsis

@@ -476,7 +476,7 @@

Synopsis

-

failCopyDetailsFromInvalidReference

+

failCopyDetailsFromInvalidReference

Synopsis

@@ -492,7 +492,7 @@

Synopsis

-

failCopyDocFromDocNoBrief

+

failCopyDocFromDocNoBrief

This function has documentation but no brief. @@ -512,7 +512,7 @@

Synopsis

-

failCopyDocFromInvalidReference

+

failCopyDocFromInvalidReference

Synopsis

@@ -528,7 +528,7 @@

Synopsis

-

failCopyDocFromNoDoc

+

failCopyDocFromNoDoc

Synopsis

@@ -544,7 +544,7 @@

Synopsis

-

failInvalidReferenceCopyFunctions

+

failInvalidReferenceCopyFunctions

Synopsis

@@ -560,7 +560,7 @@

Synopsis

-

firstSentenceAsBriefFunction

+

firstSentenceAsBriefFunction

This is the brief. @@ -584,7 +584,7 @@

Description

-

noDocFunction

+

noDocFunction

Synopsis

@@ -600,7 +600,7 @@

Synopsis

-

recursiveReferenceCopyFunction

+

recursiveReferenceCopyFunction

Final recursive brief @@ -620,7 +620,7 @@

Synopsis

-

recursiveSourceFunctionA

+

recursiveSourceFunctionA

Final recursive brief @@ -640,7 +640,7 @@

Synopsis

-

recursiveSourceFunctionB

+

recursiveSourceFunctionB

Final recursive brief diff --git a/test-files/golden-tests/config/auto-brief/no-auto-brief.html b/test-files/golden-tests/config/auto-brief/no-auto-brief.html index bfeb14222..9e0553b81 100644 --- a/test-files/golden-tests/config/auto-brief/no-auto-brief.html +++ b/test-files/golden-tests/config/auto-brief/no-auto-brief.html @@ -7,7 +7,7 @@

Reference

-

+

Functions

@@ -56,7 +56,7 @@

Functions

-

copyBriefFromCopyBrief

+

copyBriefFromCopyBrief

This is the explicit brief. @@ -76,7 +76,7 @@

Synopsis

-

copyBriefFromExplicitBrief

+

copyBriefFromExplicitBrief

This is the explicit brief. @@ -96,7 +96,7 @@

Synopsis

-

copyBriefFromFirstSentenceAsBrief

+

copyBriefFromFirstSentenceAsBrief

Synopsis

@@ -112,7 +112,7 @@

Synopsis

-

copyBriefFromFirstValid

+

copyBriefFromFirstValid

This is the explicit brief. @@ -132,7 +132,7 @@

Synopsis

-

copyDetailsFromCopyBrief

+

copyDetailsFromCopyBrief

Details will be copied @@ -152,7 +152,7 @@

Synopsis

-

copyDetailsFromDocNoBrief

+

copyDetailsFromDocNoBrief

Custom brief @@ -172,7 +172,7 @@

Synopsis

-

copyDetailsFromExplicitBrief

+

copyDetailsFromExplicitBrief

Synopsis

@@ -192,7 +192,7 @@

Description

-

copyDetailsFromFirstSentenceAsBrief

+

copyDetailsFromFirstSentenceAsBrief

Synopsis

@@ -213,7 +213,7 @@

Description

-

copyDetailsFromNoDoc

+

copyDetailsFromNoDoc

Custom brief @@ -233,7 +233,7 @@

Synopsis

-

copyDocFromCopyBrief

+

copyDocFromCopyBrief

This is the explicit brief. @@ -257,7 +257,7 @@

Description

-

copyDocFromExplicitBrief

+

copyDocFromExplicitBrief

This is the explicit brief. @@ -281,7 +281,7 @@

Description

-

copyDocFromFirstSentenceAsBrief

+

copyDocFromFirstSentenceAsBrief

Synopsis

@@ -302,7 +302,7 @@

Description

-

docNoBriefFunction

+

docNoBriefFunction

Synopsis

@@ -322,7 +322,7 @@

Description

-

explicitBriefFunction

+

explicitBriefFunction

This is the explicit brief. @@ -346,7 +346,7 @@

Description

-

explicitBriefFunction2

+

explicitBriefFunction2

This is the explicit brief. @@ -370,7 +370,7 @@

Description

-

failCircularReferenceCopyFunction

+

failCircularReferenceCopyFunction

Synopsis

@@ -386,7 +386,7 @@

Synopsis

-

failCircularSourceFunctionA

+

failCircularSourceFunctionA

Synopsis

@@ -402,7 +402,7 @@

Synopsis

-

failCircularSourceFunctionB

+

failCircularSourceFunctionB

Synopsis

@@ -418,7 +418,7 @@

Synopsis

-

failCopyBriefFromDocNoBrief

+

failCopyBriefFromDocNoBrief

Synopsis

@@ -434,7 +434,7 @@

Synopsis

-

failCopyBriefFromInvalidReference

+

failCopyBriefFromInvalidReference

Synopsis

@@ -450,7 +450,7 @@

Synopsis

-

failCopyBriefFromNoDoc

+

failCopyBriefFromNoDoc

Synopsis

@@ -466,7 +466,7 @@

Synopsis

-

failCopyDetailsFromInvalidReference

+

failCopyDetailsFromInvalidReference

Synopsis

@@ -482,7 +482,7 @@

Synopsis

-

failCopyDocFromDocNoBrief

+

failCopyDocFromDocNoBrief

Synopsis

@@ -502,7 +502,7 @@

Description

-

failCopyDocFromInvalidReference

+

failCopyDocFromInvalidReference

Synopsis

@@ -518,7 +518,7 @@

Synopsis

-

failCopyDocFromNoDoc

+

failCopyDocFromNoDoc

Synopsis

@@ -534,7 +534,7 @@

Synopsis

-

failInvalidReferenceCopyFunctions

+

failInvalidReferenceCopyFunctions

Synopsis

@@ -550,7 +550,7 @@

Synopsis

-

firstSentenceAsBriefFunction

+

firstSentenceAsBriefFunction

Synopsis

@@ -571,7 +571,7 @@

Description

-

noDocFunction

+

noDocFunction

Synopsis

@@ -587,7 +587,7 @@

Synopsis

-

recursiveReferenceCopyFunction

+

recursiveReferenceCopyFunction

Final recursive brief @@ -607,7 +607,7 @@

Synopsis

-

recursiveSourceFunctionA

+

recursiveSourceFunctionA

Final recursive brief @@ -627,7 +627,7 @@

Synopsis

-

recursiveSourceFunctionB

+

recursiveSourceFunctionB

Final recursive brief diff --git a/test-files/golden-tests/config/auto-function-metadata/brief-from-function-class.html b/test-files/golden-tests/config/auto-function-metadata/brief-from-function-class.html index c805d70c3..75326725d 100644 --- a/test-files/golden-tests/config/auto-function-metadata/brief-from-function-class.html +++ b/test-files/golden-tests/config/auto-function-metadata/brief-from-function-class.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -27,7 +27,7 @@

Types

-

A

+

A

A helper tag @@ -48,7 +48,7 @@

Synopsis

-

X

+

X

Test class @@ -86,7 +86,7 @@

Member Functions

-

X::X

+

X::X

Constructors @@ -146,7 +146,7 @@

Synopses

-

X::X

+

X::X

Default constructor @@ -166,7 +166,7 @@

Synopsis

-

X::X

+

X::X

Copy constructor @@ -203,7 +203,7 @@

Parameters

-

X::X

+

X::X

Move constructor @@ -240,7 +240,7 @@

Parameters

-

X::X

+

X::X

Construct from int @@ -276,7 +276,7 @@

Parameters

-

X::X

+

X::X

Construct from A @@ -312,7 +312,7 @@

Parameters

-

X::X

+

X::X

Construct from A @@ -348,7 +348,7 @@

Parameters

-

X::~X

+

X::~X

Destructor @@ -367,7 +367,7 @@

Synopsis

-

X::operator A

+

X::operator A

Conversion to A @@ -390,7 +390,7 @@

Return Value

-

X::operator int

+

X::operator int

Conversion to int diff --git a/test-files/golden-tests/config/auto-function-metadata/brief-from-operator.html b/test-files/golden-tests/config/auto-function-metadata/brief-from-operator.html index e494d0fcd..99f4a1f7d 100644 --- a/test-files/golden-tests/config/auto-function-metadata/brief-from-operator.html +++ b/test-files/golden-tests/config/auto-function-metadata/brief-from-operator.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -42,7 +42,7 @@

Functions

-

A

+

A

A helper tag @@ -63,7 +63,7 @@

Synopsis

-

X

+

X

Test class @@ -99,7 +99,7 @@

Member Functions

-

X::operator=

+

X::operator=

Assignment operators @@ -138,7 +138,7 @@

Synopses

-

X::operator=

+

X::operator=

Copy assignment operator @@ -179,7 +179,7 @@

Parameters

-

X::operator=

+

X::operator=

Move assignment operator @@ -220,7 +220,7 @@

Parameters

-

X::operator=

+

X::operator=

Assignment operator @@ -261,7 +261,7 @@

Parameters

-

X::operator+=

+

X::operator+=

Addition assignment operator @@ -302,7 +302,7 @@

Parameters

-

ostream

+

ostream

A dumb ostream class @@ -323,7 +323,7 @@

Synopsis

-

operator<<

+

operator<<

Stream insertion operator diff --git a/test-files/golden-tests/config/auto-function-metadata/param-from-function-class.html b/test-files/golden-tests/config/auto-function-metadata/param-from-function-class.html index bdcfd1f52..4c17e06fc 100644 --- a/test-files/golden-tests/config/auto-function-metadata/param-from-function-class.html +++ b/test-files/golden-tests/config/auto-function-metadata/param-from-function-class.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -27,7 +27,7 @@

Types

-

A

+

A

A helper tag @@ -48,7 +48,7 @@

Synopsis

-

X

+

X

Test class @@ -84,7 +84,7 @@

Member Functions

-

X::X

+

X::X

Constructors @@ -134,7 +134,7 @@

Synopses

-

X::X

+

X::X

Copy constructor @@ -170,7 +170,7 @@

Parameters

-

X::X

+

X::X

Move constructor @@ -206,7 +206,7 @@

Parameters

-

X::X

+

X::X

Construct from int @@ -242,7 +242,7 @@

Parameters

-

X::X

+

X::X

Construct from A @@ -278,7 +278,7 @@

Parameters

-

X::X

+

X::X

Construct from A @@ -314,7 +314,7 @@

Parameters

-

X::operator=

+

X::operator=

Assignment operators @@ -369,7 +369,7 @@

Synopses

-

X::operator=

+

X::operator=

Copy assignment operator @@ -410,7 +410,7 @@

Parameters

-

X::operator=

+

X::operator=

Move assignment operator @@ -451,7 +451,7 @@

Parameters

-

X::operator=

+

X::operator=

Assignment operator @@ -492,7 +492,7 @@

Parameters

-

X::operator=

+

X::operator=

Assignment operator @@ -533,7 +533,7 @@

Parameters

-

X::operator=

+

X::operator=

Assignment operator diff --git a/test-files/golden-tests/config/auto-function-metadata/param-from-operator.html b/test-files/golden-tests/config/auto-function-metadata/param-from-operator.html index 02d6797e8..bf8d60a2a 100644 --- a/test-files/golden-tests/config/auto-function-metadata/param-from-operator.html +++ b/test-files/golden-tests/config/auto-function-metadata/param-from-operator.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -44,7 +44,7 @@

Functions

-

A

+

A

A helper tag @@ -65,7 +65,7 @@

Synopsis

-

X

+

X

Test class @@ -100,7 +100,7 @@

Member Functions

-

X::operator+

+

X::operator+

Addition operator @@ -141,7 +141,7 @@

Parameters

-

ostream

+

ostream

A dumb ostream class @@ -162,7 +162,7 @@

Synopsis

-

operator-

+

operator-

Subtraction operator @@ -209,7 +209,7 @@

Parameters

-

operator<<

+

operator<<

Stream insertion operator @@ -256,7 +256,7 @@

Parameters

-

operator!

+

operator!

Negation operator diff --git a/test-files/golden-tests/config/auto-function-metadata/returns-from-brief.html b/test-files/golden-tests/config/auto-function-metadata/returns-from-brief.html index a96ba4557..ae649787b 100644 --- a/test-files/golden-tests/config/auto-function-metadata/returns-from-brief.html +++ b/test-files/golden-tests/config/auto-function-metadata/returns-from-brief.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -26,7 +26,7 @@

Types

-

X

+

X

Test class @@ -63,7 +63,7 @@

Member Functions

-

X::empty

+

X::empty

Determines whether the range is empty. @@ -87,7 +87,7 @@

Return Value

-

X::front

+

X::front

Returns the first element of the range. @@ -111,7 +111,7 @@

Return Value

-

X::size

+

X::size

Get the range size. diff --git a/test-files/golden-tests/config/auto-function-metadata/returns-from-return-brief.html b/test-files/golden-tests/config/auto-function-metadata/returns-from-return-brief.html index 9c628cf83..ca2b4f66b 100644 --- a/test-files/golden-tests/config/auto-function-metadata/returns-from-return-brief.html +++ b/test-files/golden-tests/config/auto-function-metadata/returns-from-return-brief.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -40,7 +40,7 @@

Functions

-

R

+

R

The return type of the function @@ -75,7 +75,7 @@

Non-Member Functions

-

getR

+

getR

Test function diff --git a/test-files/golden-tests/config/auto-function-metadata/returns-from-special.html b/test-files/golden-tests/config/auto-function-metadata/returns-from-special.html index 98024861f..0fa92a3a6 100644 --- a/test-files/golden-tests/config/auto-function-metadata/returns-from-special.html +++ b/test-files/golden-tests/config/auto-function-metadata/returns-from-special.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -51,7 +51,7 @@

Functions

-

A

+

A

A helper class @@ -72,7 +72,7 @@

Synopsis

-

Undoc

+

Undoc

Synopsis

@@ -89,7 +89,7 @@

Synopsis

-

X

+

X

Test class @@ -136,7 +136,7 @@

Member Functions

-

X::operator=

+

X::operator=

Assignment operators @@ -167,7 +167,7 @@

Synopses

-

X::operator=

+

X::operator=

Assignment operator @@ -208,7 +208,7 @@

Parameters

-

X::operator=

+

X::operator=

Assignment operator @@ -249,7 +249,7 @@

Parameters

-

X::operator+

+

X::operator+

Addition operator @@ -290,7 +290,7 @@

Parameters

-

X::operator->

+

X::operator->

Member access operator @@ -314,7 +314,7 @@

Return Value

-

X::operator A

+

X::operator A

Conversion to A @@ -337,7 +337,7 @@

Return Value

-

X::operator Undoc

+

X::operator Undoc

Conversion to Undoc @@ -360,7 +360,7 @@

Return Value

-

X::operator!

+

X::operator!

Negation operator @@ -384,7 +384,7 @@

Return Value

-

X::operator==

+

X::operator==

Equality operator @@ -425,7 +425,7 @@

Parameters

-

X::operator!=

+

X::operator!=

Inequality operator @@ -466,7 +466,7 @@

Parameters

-

X::operator<

+

X::operator<

Less-than operator @@ -507,7 +507,7 @@

Parameters

-

X::operator<=

+

X::operator<=

Less-than-or-equal operator @@ -548,7 +548,7 @@

Parameters

-

X::operator>

+

X::operator>

Greater-than operator @@ -589,7 +589,7 @@

Parameters

-

X::operator>=

+

X::operator>=

Greater-than-or-equal operator @@ -630,7 +630,7 @@

Parameters

-

X::operator<=>

+

X::operator<=>

Three-way comparison operator @@ -671,7 +671,7 @@

Parameters

-

ostream

+

ostream

A fake output stream @@ -692,7 +692,7 @@

Synopsis

-

operator<<

+

operator<<

Stream insertion operator @@ -739,7 +739,7 @@

Parameters

-

operator!

+

operator!

Negation operator @@ -780,7 +780,7 @@

Parameters

-

operator==

+

operator==

Equality operator @@ -827,7 +827,7 @@

Parameters

-

operator!=

+

operator!=

Inequality operator @@ -874,7 +874,7 @@

Parameters

-

operator<

+

operator<

Less-than operator @@ -921,7 +921,7 @@

Parameters

-

operator<=

+

operator<=

Less-than-or-equal operator @@ -968,7 +968,7 @@

Parameters

-

operator>

+

operator>

Greater-than operator @@ -1015,7 +1015,7 @@

Parameters

-

operator>=

+

operator>=

Greater-than-or-equal operator @@ -1062,7 +1062,7 @@

Parameters

-

operator<=>

+

operator<=>

Three-way comparison operator diff --git a/test-files/golden-tests/config/auto-relates/auto-relates.html b/test-files/golden-tests/config/auto-relates/auto-relates.html index fc7d27d70..864536adf 100644 --- a/test-files/golden-tests/config/auto-relates/auto-relates.html +++ b/test-files/golden-tests/config/auto-relates/auto-relates.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -45,7 +45,7 @@

Functions

-

A

+

A

A class with non-member functions @@ -85,7 +85,7 @@

Non-Member Functions

-

f1

+

f1

A non-member function of A @@ -105,7 +105,7 @@

Synopsis

-

f2

+

f2

A non-member function of A @@ -125,7 +125,7 @@

Synopsis

-

f3

+

f3

A non-member function of A @@ -145,7 +145,7 @@

Synopsis

-

f4

+

f4

A non-member function of A @@ -165,7 +165,7 @@

Synopsis

-

f5

+

f5

A non-member function of A @@ -185,7 +185,7 @@

Synopsis

-

f6

+

f6

A non-member function of A diff --git a/test-files/golden-tests/config/auto-relates/derived.html b/test-files/golden-tests/config/auto-relates/derived.html index d4789cb95..eec4965d0 100644 --- a/test-files/golden-tests/config/auto-relates/derived.html +++ b/test-files/golden-tests/config/auto-relates/derived.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -48,7 +48,7 @@

Functions

-

A

+

A

A concrete implementation for ABase @@ -102,7 +102,7 @@

Non-Member Functions

-

ABase

+

ABase

A base class for non-member functions @@ -159,7 +159,7 @@

Derived Classes

-

AView

+

AView

A view of A @@ -228,7 +228,7 @@

Derived Classes

-

AView2

+

AView2

Another view of A @@ -286,7 +286,7 @@

Description

-

f1

+

f1

A non-member function of ABase @@ -306,7 +306,7 @@

Synopsis

-

f2

+

f2

A non-member function of ABase @@ -326,7 +326,7 @@

Synopsis

-

f3

+

f3

A non-member function of ABase @@ -346,7 +346,7 @@

Synopsis

-

f4

+

f4

A non-member function of ABase @@ -366,7 +366,7 @@

Synopsis

-

f5

+

f5

A non-member function of ABase @@ -386,7 +386,7 @@

Synopsis

-

n

+

n

A non-member function of ABase only diff --git a/test-files/golden-tests/config/auto-relates/enum.html b/test-files/golden-tests/config/auto-relates/enum.html index 3cab62b65..d7067e504 100644 --- a/test-files/golden-tests/config/auto-relates/enum.html +++ b/test-files/golden-tests/config/auto-relates/enum.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -57,7 +57,7 @@

Functions

-

Result

+

Result

Helper result class @@ -93,7 +93,7 @@

Non-Member Functions

-

SmallVector

+

SmallVector

Helper result class @@ -131,7 +131,7 @@

Non-Member Functions

-

E

+

E

An enum with non-member functions @@ -148,19 +148,6 @@

Synopsis

-

Members

-
- - - - - - - - -
NameDescription
-
-

Non-Member Functions

@@ -179,7 +166,7 @@

Non-Member Functions

-

makeE

+

makeE

Function that returns A @@ -203,7 +190,7 @@

Return Value

-

makeEs

+

makeEs

Function that returns template on A @@ -227,7 +214,7 @@

Return Value

-

tryMakeE

+

tryMakeE

Function that returns template on A diff --git a/test-files/golden-tests/config/auto-relates/no-auto-relates.html b/test-files/golden-tests/config/auto-relates/no-auto-relates.html index 53634c315..cf48c0f84 100644 --- a/test-files/golden-tests/config/auto-relates/no-auto-relates.html +++ b/test-files/golden-tests/config/auto-relates/no-auto-relates.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -45,7 +45,7 @@

Functions

-

A

+

A

A class with non-member functions @@ -66,7 +66,7 @@

Synopsis

-

f1

+

f1

A non-member function of A @@ -86,7 +86,7 @@

Synopsis

-

f2

+

f2

A non-member function of A @@ -106,7 +106,7 @@

Synopsis

-

f3

+

f3

A non-member function of A @@ -126,7 +126,7 @@

Synopsis

-

f4

+

f4

A non-member function of A @@ -146,7 +146,7 @@

Synopsis

-

f5

+

f5

A non-member function of A @@ -166,7 +166,7 @@

Synopsis

-

f6

+

f6

A non-member function of A diff --git a/test-files/golden-tests/config/auto-relates/qualified.html b/test-files/golden-tests/config/auto-relates/qualified.html index 7accb4138..78c5c329d 100644 --- a/test-files/golden-tests/config/auto-relates/qualified.html +++ b/test-files/golden-tests/config/auto-relates/qualified.html @@ -7,7 +7,7 @@

Reference

-

+

Namespaces

@@ -55,7 +55,7 @@

Functions

-

N

+

N

Namespaces

@@ -102,7 +102,7 @@

Functions

-

N::M

+

N::M

Functions

@@ -121,7 +121,7 @@

Functions

-

N::M::f4

+

N::M::f4

A non-member function of ::N::B @@ -141,7 +141,7 @@

Synopsis

-

N::B

+

N::B

A nested class with non-member functions @@ -179,7 +179,7 @@

Non-Member Functions

-

N::f2

+

N::f2

A non-member function of A @@ -199,7 +199,7 @@

Synopsis

-

N::f3

+

N::f3

A non-member function of B @@ -219,7 +219,7 @@

Synopsis

-

O

+

O

Functions

@@ -238,7 +238,7 @@

Functions

-

O::f6

+

O::f6

A non-member function of ::N::B @@ -258,7 +258,7 @@

Synopsis

-

A

+

A

A class with non-member functions @@ -294,7 +294,7 @@

Non-Member Functions

-

f1

+

f1

A non-member function of A @@ -314,7 +314,7 @@

Synopsis

-

f5

+

f5

A non-member function of ::N::B diff --git a/test-files/golden-tests/config/auto-relates/remove-friend.html b/test-files/golden-tests/config/auto-relates/remove-friend.html index 241554ef4..d1420b279 100644 --- a/test-files/golden-tests/config/auto-relates/remove-friend.html +++ b/test-files/golden-tests/config/auto-relates/remove-friend.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -41,7 +41,7 @@

Functions

-

A

+

A

A record with non-member functions @@ -94,7 +94,7 @@

Non-Member Functions

-

to_string

+

to_string

Non-member function of A @@ -135,7 +135,7 @@

Parameters

-

operator==

+

operator==

Friend function not listed as non-member diff --git a/test-files/golden-tests/config/auto-relates/return-type.html b/test-files/golden-tests/config/auto-relates/return-type.html index 5144ec6fb..da9cdc6dc 100644 --- a/test-files/golden-tests/config/auto-relates/return-type.html +++ b/test-files/golden-tests/config/auto-relates/return-type.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -44,7 +44,7 @@

Functions

-

A

+

A

A class with non-member functions @@ -81,7 +81,7 @@

Non-Member Functions

-

Result

+

Result

Helper result class @@ -117,7 +117,7 @@

Non-Member Functions

-

SmallVector

+

SmallVector

Helper result class @@ -155,7 +155,7 @@

Non-Member Functions

-

makeA

+

makeA

Function that returns A @@ -179,7 +179,7 @@

Return Value

-

makeAs

+

makeAs

Function that returns template on A @@ -203,7 +203,7 @@

Return Value

-

tryMakeA

+

tryMakeA

Function that returns template on A diff --git a/test-files/golden-tests/config/extract-all/no-extract-all.html b/test-files/golden-tests/config/extract-all/no-extract-all.html index c3cc86fa6..9e1d32b46 100644 --- a/test-files/golden-tests/config/extract-all/no-extract-all.html +++ b/test-files/golden-tests/config/extract-all/no-extract-all.html @@ -7,7 +7,7 @@

Reference

-

+

Functions

@@ -27,7 +27,7 @@

Functions

-

docFunction

+

docFunction

Documented function @@ -47,7 +47,7 @@

Synopsis

-

sometimesDocFunction

+

sometimesDocFunction

Sometimes documented function diff --git a/test-files/golden-tests/config/extract-empty-namespaces/no-extract-empty-namespaces.html b/test-files/golden-tests/config/extract-empty-namespaces/no-extract-empty-namespaces.html index e5c32d76a..f86f17833 100644 --- a/test-files/golden-tests/config/extract-empty-namespaces/no-extract-empty-namespaces.html +++ b/test-files/golden-tests/config/extract-empty-namespaces/no-extract-empty-namespaces.html @@ -7,7 +7,7 @@

Reference

-

+

Namespaces

@@ -63,7 +63,7 @@

Using Namespace Directives

-

documented_ns

+

documented_ns

Namespace documentation @@ -72,7 +72,7 @@

documented_ns

-

mixed_ns

+

mixed_ns

Should decay to see-below @@ -94,7 +94,7 @@

Types

-

mixed_ns::SeeBelowStructA

+

mixed_ns::SeeBelowStructA

Synopsis

@@ -111,7 +111,7 @@

Synopsis

-

mixed_regular_ns

+

mixed_regular_ns

Should decay to regular @@ -134,7 +134,7 @@

Types

-

mixed_regular_ns::RegularStructA

+

mixed_regular_ns::RegularStructA

Synopsis

@@ -151,7 +151,7 @@

Synopsis

-

mixed_regular_ns::SeeBelowStructB

+

mixed_regular_ns::SeeBelowStructB

Synopsis

@@ -168,7 +168,7 @@

Synopsis

-

regular_ns

+

regular_ns

Regular namespace @@ -190,7 +190,7 @@

Types

-

regular_ns::A

+

regular_ns::A

Synopsis

@@ -207,7 +207,7 @@

Synopsis

-

see_below_ns

+

see_below_ns

Should decay to see-below @@ -230,7 +230,7 @@

Types

-

see_below_ns::SeeBelowStructA

+

see_below_ns::SeeBelowStructA

Synopsis

@@ -247,7 +247,7 @@

Synopsis

-

see_below_ns::SeeBelowStructB

+

see_below_ns::SeeBelowStructB

Synopsis

@@ -264,7 +264,7 @@

Synopsis

-

empty_ns_alias

+

empty_ns_alias

Should still work @@ -283,7 +283,7 @@

Synopsis

-

regular_ns_alias

+

regular_ns_alias

Should work diff --git a/test-files/golden-tests/config/extract-friends/extract-friends.html b/test-files/golden-tests/config/extract-friends/extract-friends.html index 742f55901..a3d3a6dcd 100644 --- a/test-files/golden-tests/config/extract-friends/extract-friends.html +++ b/test-files/golden-tests/config/extract-friends/extract-friends.html @@ -7,7 +7,7 @@

Reference

-

+

Namespaces

@@ -38,7 +38,7 @@

Types

-

std

+

std

Types

@@ -57,7 +57,7 @@

Types

-

std::hash

+

std::hash

Synopsis

@@ -75,7 +75,7 @@

Synopsis

-

std::hash<A>

+

std::hash<A>

Synopsis

@@ -106,7 +106,7 @@

Member Functions

-

std::hash<A>::operator()

+

std::hash<A>::operator()

Synopsis

@@ -122,7 +122,7 @@

Synopsis

-

A

+

A

Synopsis

diff --git a/test-files/golden-tests/config/extract-friends/no-extract-friends.html b/test-files/golden-tests/config/extract-friends/no-extract-friends.html index 3731e0aaf..39b59f654 100644 --- a/test-files/golden-tests/config/extract-friends/no-extract-friends.html +++ b/test-files/golden-tests/config/extract-friends/no-extract-friends.html @@ -7,7 +7,7 @@

Reference

-

+

Namespaces

@@ -38,7 +38,7 @@

Types

-

std

+

std

Types

@@ -57,7 +57,7 @@

Types

-

std::hash

+

std::hash

Synopsis

@@ -75,7 +75,7 @@

Synopsis

-

std::hash<A>

+

std::hash<A>

Synopsis

@@ -106,7 +106,7 @@

Member Functions

-

std::hash<A>::operator()

+

std::hash<A>::operator()

Synopsis

@@ -122,7 +122,7 @@

Synopsis

-

A

+

A

Synopsis

diff --git a/test-files/golden-tests/config/extract-implicit-specializations/base.html b/test-files/golden-tests/config/extract-implicit-specializations/base.html index 5e2905ddd..080cd6166 100644 --- a/test-files/golden-tests/config/extract-implicit-specializations/base.html +++ b/test-files/golden-tests/config/extract-implicit-specializations/base.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -26,7 +26,7 @@

Types

-

A

+

A

Synopsis

@@ -71,7 +71,7 @@

Member Functions

-

B

+

B

Synopsis

@@ -116,7 +116,7 @@

Derived Classes

-

B::value

+

B::value

Synopsis

diff --git a/test-files/golden-tests/config/extract-implicit-specializations/extract-implicit-specializations.html b/test-files/golden-tests/config/extract-implicit-specializations/extract-implicit-specializations.html index ad404c9c2..a0445f7d8 100644 --- a/test-files/golden-tests/config/extract-implicit-specializations/extract-implicit-specializations.html +++ b/test-files/golden-tests/config/extract-implicit-specializations/extract-implicit-specializations.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -26,7 +26,7 @@

Types

-

A

+

A

Synopsis

@@ -71,7 +71,7 @@

Member Functions

-

A::value

+

A::value

Synopsis

@@ -87,7 +87,7 @@

Synopsis

-

B

+

B

Synopsis

@@ -133,7 +133,7 @@

Derived Classes

-

B::value

+

B::value

Synopsis

diff --git a/test-files/golden-tests/config/extract-implicit-specializations/no-extract-implicit-specializations.html b/test-files/golden-tests/config/extract-implicit-specializations/no-extract-implicit-specializations.html index 59225a6f8..a74e7f1bd 100644 --- a/test-files/golden-tests/config/extract-implicit-specializations/no-extract-implicit-specializations.html +++ b/test-files/golden-tests/config/extract-implicit-specializations/no-extract-implicit-specializations.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -26,7 +26,7 @@

Types

-

A

+

A

Synopsis

@@ -71,7 +71,7 @@

Member Functions

-

B

+

B

Synopsis

@@ -117,7 +117,7 @@

Derived Classes

-

B::value

+

B::value

Synopsis

diff --git a/test-files/golden-tests/config/extract-local-classes/extract-local-classes.html b/test-files/golden-tests/config/extract-local-classes/extract-local-classes.html index ce9cb036d..76f34a006 100644 --- a/test-files/golden-tests/config/extract-local-classes/extract-local-classes.html +++ b/test-files/golden-tests/config/extract-local-classes/extract-local-classes.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -39,7 +39,7 @@

Functions

-

local_class

+

local_class

Synopsis

@@ -56,7 +56,7 @@

Synopsis

-

local_struct

+

local_struct

Synopsis

@@ -73,7 +73,7 @@

Synopsis

-

local_function

+

local_function

Synopsis

diff --git a/test-files/golden-tests/config/extract-local-classes/no-extract-local-classes.html b/test-files/golden-tests/config/extract-local-classes/no-extract-local-classes.html index 1d1fbd801..cd05f7b23 100644 --- a/test-files/golden-tests/config/extract-local-classes/no-extract-local-classes.html +++ b/test-files/golden-tests/config/extract-local-classes/no-extract-local-classes.html @@ -7,7 +7,7 @@

Reference

-

+

Functions

@@ -25,7 +25,7 @@

Functions

-

local_function

+

local_function

Synopsis

diff --git a/test-files/golden-tests/config/extract-private-virtual/extract-private-virtual.html b/test-files/golden-tests/config/extract-private-virtual/extract-private-virtual.html index 2395664d6..6e01f1352 100644 --- a/test-files/golden-tests/config/extract-private-virtual/extract-private-virtual.html +++ b/test-files/golden-tests/config/extract-private-virtual/extract-private-virtual.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -25,7 +25,7 @@

Types

-

A

+

A

Synopsis

@@ -68,7 +68,7 @@

Private Member Functions

-

A::f

+

A::f

Synopsis

@@ -85,7 +85,7 @@

Synopsis

-

A::g

+

A::g

Synopsis

diff --git a/test-files/golden-tests/config/extract-private-virtual/no-extract-private-virtual.html b/test-files/golden-tests/config/extract-private-virtual/no-extract-private-virtual.html index cae3b7be9..a793a0559 100644 --- a/test-files/golden-tests/config/extract-private-virtual/no-extract-private-virtual.html +++ b/test-files/golden-tests/config/extract-private-virtual/no-extract-private-virtual.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -25,7 +25,7 @@

Types

-

A

+

A

Synopsis

@@ -55,7 +55,7 @@

Member Functions

-

A::f

+

A::f

Synopsis

diff --git a/test-files/golden-tests/config/inherit-base-members/base-overload-set.html b/test-files/golden-tests/config/inherit-base-members/base-overload-set.html index b03a96e25..52b355ad6 100644 --- a/test-files/golden-tests/config/inherit-base-members/base-overload-set.html +++ b/test-files/golden-tests/config/inherit-base-members/base-overload-set.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -27,7 +27,7 @@

Types

-

Base

+

Base

Synopsis

@@ -88,7 +88,7 @@

Derived Classes

-

Base::foo

+

Base::foo

Synopses

@@ -115,7 +115,7 @@

Synopses

-

Base::foo

+

Base::foo

Synopsis

@@ -131,7 +131,7 @@

Synopsis

-

Base::foo

+

Base::foo

Synopsis

@@ -147,7 +147,7 @@

Synopsis

-

C

+

C

Synopsis

@@ -193,7 +193,7 @@

Member Functions

-

ConstBase

+

ConstBase

Synopsis

@@ -238,7 +238,7 @@

Derived Classes

-

ConstBase::foo

+

ConstBase::foo

Synopsis

diff --git a/test-files/golden-tests/config/inherit-base-members/copy-dependencies.html b/test-files/golden-tests/config/inherit-base-members/copy-dependencies.html index a1576424a..049110be7 100644 --- a/test-files/golden-tests/config/inherit-base-members/copy-dependencies.html +++ b/test-files/golden-tests/config/inherit-base-members/copy-dependencies.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -30,7 +30,7 @@

Types

-

base

+

base

A base class to test inheritance and shadowing @@ -115,7 +115,7 @@

Derived Classes

-

base::base_inherited

+

base::base_inherited

This function should be inherited by derived classes. @@ -139,7 +139,7 @@

Return Value

-

base::base_shadowed

+

base::base_shadowed

This function should shadow the excluded_base function. @@ -163,7 +163,7 @@

Return Value

-

base::derived_shadowed

+

base::derived_shadowed

This function should be shadowed by derived classes. @@ -187,7 +187,7 @@

Return Value

-

base::do_base_inherited

+

base::do_base_inherited

This function should be inherited by derived classes. @@ -211,7 +211,7 @@

Return Value

-

base::do_base_shadowed

+

base::do_base_shadowed

This function should shadow the excluded_base function. @@ -235,7 +235,7 @@

Return Value

-

base::do_derived_shadowed

+

base::do_derived_shadowed

This function should be shadowed by derived classes. @@ -259,7 +259,7 @@

Return Value

-

base_base

+

base_base

A second-order base class to test indirect inheritance @@ -310,7 +310,7 @@

Derived Classes

-

base_base::base_base_inherited

+

base_base::base_base_inherited

This function should be indirectly inherited by derived classes. @@ -334,7 +334,7 @@

Return Value

-

base_base::do_base_base_inherited

+

base_base::do_base_base_inherited

This function should be indirectly inherited by derived classes. @@ -358,7 +358,7 @@

Return Value

-

derived

+

derived

A class that derives from base and excluded_base @@ -434,7 +434,7 @@

Protected Member Functions

-

derived::derived_shadowed

+

derived::derived_shadowed

This function should shadow the base class function. @@ -458,7 +458,7 @@

Return Value

-

derived::do_derived_shadowed

+

derived::do_derived_shadowed

This function should shadow the base class function. @@ -482,7 +482,7 @@

Return Value

-

derived::excluded_inherited

+

derived::excluded_inherited

This function should be inherited by derived classes. @@ -502,7 +502,7 @@

Synopsis

-

derived::do_excluded_inherited

+

derived::do_excluded_inherited

This function should be inherited by derived classes. @@ -522,7 +522,7 @@

Synopsis

-

derived::do_shadowed

+

derived::do_shadowed

This function should be shadowed by derived classes. @@ -542,7 +542,7 @@

Synopsis

-

private_derived

+

private_derived

A class that uses private inheritance only @@ -580,7 +580,7 @@

Member Functions

-

private_derived::derived_shadowed

+

private_derived::derived_shadowed

This function should shadow the base class function. @@ -604,7 +604,7 @@

Return Value

-

private_derived::do_derived_shadowed

+

private_derived::do_derived_shadowed

This function should shadow the base class function. @@ -628,7 +628,7 @@

Return Value

-

protected_derived

+

protected_derived

A class that should inherit functions as protected. @@ -705,7 +705,7 @@

Protected Member Functions

-

protected_derived::derived_shadowed

+

protected_derived::derived_shadowed

This function should shadow the base class function. @@ -729,7 +729,7 @@

Return Value

-

protected_derived::do_derived_shadowed

+

protected_derived::do_derived_shadowed

This function should shadow the base class function. @@ -753,7 +753,7 @@

Return Value

-

protected_derived::do_excluded_inherited

+

protected_derived::do_excluded_inherited

This function should be inherited by derived classes. @@ -773,7 +773,7 @@

Synopsis

-

protected_derived::do_shadowed

+

protected_derived::do_shadowed

This function should be shadowed by derived classes. @@ -793,7 +793,7 @@

Synopsis

-

protected_derived::excluded_inherited

+

protected_derived::excluded_inherited

This function should be inherited by derived classes. diff --git a/test-files/golden-tests/config/inherit-base-members/copy.html b/test-files/golden-tests/config/inherit-base-members/copy.html index 781fd9edf..8e6d67daf 100644 --- a/test-files/golden-tests/config/inherit-base-members/copy.html +++ b/test-files/golden-tests/config/inherit-base-members/copy.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -30,7 +30,7 @@

Types

-

base

+

base

A base class to test inheritance and shadowing @@ -115,7 +115,7 @@

Derived Classes

-

base::base_base_inherited

+

base::base_base_inherited

This function should be indirectly inherited by derived classes. @@ -139,7 +139,7 @@

Return Value

-

base::base_inherited

+

base::base_inherited

This function should be inherited by derived classes. @@ -163,7 +163,7 @@

Return Value

-

base::base_shadowed

+

base::base_shadowed

This function should shadow the excluded_base function. @@ -187,7 +187,7 @@

Return Value

-

base::derived_shadowed

+

base::derived_shadowed

This function should be shadowed by derived classes. @@ -211,7 +211,7 @@

Return Value

-

base::do_base_base_inherited

+

base::do_base_base_inherited

This function should be indirectly inherited by derived classes. @@ -235,7 +235,7 @@

Return Value

-

base::do_base_inherited

+

base::do_base_inherited

This function should be inherited by derived classes. @@ -259,7 +259,7 @@

Return Value

-

base::do_base_shadowed

+

base::do_base_shadowed

This function should shadow the excluded_base function. @@ -283,7 +283,7 @@

Return Value

-

base::do_derived_shadowed

+

base::do_derived_shadowed

This function should be shadowed by derived classes. @@ -307,7 +307,7 @@

Return Value

-

base_base

+

base_base

A second-order base class to test indirect inheritance @@ -358,7 +358,7 @@

Derived Classes

-

base_base::base_base_inherited

+

base_base::base_base_inherited

This function should be indirectly inherited by derived classes. @@ -382,7 +382,7 @@

Return Value

-

base_base::do_base_base_inherited

+

base_base::do_base_base_inherited

This function should be indirectly inherited by derived classes. @@ -406,7 +406,7 @@

Return Value

-

derived

+

derived

A class that derives from base and excluded_base @@ -482,7 +482,7 @@

Protected Member Functions

-

derived::base_base_inherited

+

derived::base_base_inherited

This function should be indirectly inherited by derived classes. @@ -506,7 +506,7 @@

Return Value

-

derived::base_inherited

+

derived::base_inherited

This function should be inherited by derived classes. @@ -530,7 +530,7 @@

Return Value

-

derived::base_shadowed

+

derived::base_shadowed

This function should shadow the excluded_base function. @@ -554,7 +554,7 @@

Return Value

-

derived::derived_shadowed

+

derived::derived_shadowed

This function should shadow the base class function. @@ -578,7 +578,7 @@

Return Value

-

derived::do_base_base_inherited

+

derived::do_base_base_inherited

This function should be indirectly inherited by derived classes. @@ -602,7 +602,7 @@

Return Value

-

derived::do_derived_shadowed

+

derived::do_derived_shadowed

This function should shadow the base class function. @@ -626,7 +626,7 @@

Return Value

-

derived::excluded_inherited

+

derived::excluded_inherited

This function should be inherited by derived classes. @@ -646,7 +646,7 @@

Synopsis

-

derived::do_base_inherited

+

derived::do_base_inherited

This function should be inherited by derived classes. @@ -670,7 +670,7 @@

Return Value

-

derived::do_base_shadowed

+

derived::do_base_shadowed

This function should shadow the excluded_base function. @@ -694,7 +694,7 @@

Return Value

-

derived::do_derived_shadowed

+

derived::do_derived_shadowed

This function should be shadowed by derived classes. @@ -718,7 +718,7 @@

Return Value

-

derived::do_excluded_inherited

+

derived::do_excluded_inherited

This function should be inherited by derived classes. @@ -738,7 +738,7 @@

Synopsis

-

derived::do_shadowed

+

derived::do_shadowed

This function should be shadowed by derived classes. @@ -758,7 +758,7 @@

Synopsis

-

private_derived

+

private_derived

A class that uses private inheritance only @@ -796,7 +796,7 @@

Member Functions

-

private_derived::derived_shadowed

+

private_derived::derived_shadowed

This function should shadow the base class function. @@ -820,7 +820,7 @@

Return Value

-

private_derived::do_derived_shadowed

+

private_derived::do_derived_shadowed

This function should shadow the base class function. @@ -844,7 +844,7 @@

Return Value

-

protected_derived

+

protected_derived

A class that should inherit functions as protected. @@ -921,7 +921,7 @@

Protected Member Functions

-

protected_derived::derived_shadowed

+

protected_derived::derived_shadowed

This function should shadow the base class function. @@ -945,7 +945,7 @@

Return Value

-

protected_derived::do_derived_shadowed

+

protected_derived::do_derived_shadowed

This function should shadow the base class function. @@ -969,7 +969,7 @@

Return Value

-

protected_derived::base_base_inherited

+

protected_derived::base_base_inherited

This function should be indirectly inherited by derived classes. @@ -993,7 +993,7 @@

Return Value

-

protected_derived::base_inherited

+

protected_derived::base_inherited

This function should be inherited by derived classes. @@ -1017,7 +1017,7 @@

Return Value

-

protected_derived::base_shadowed

+

protected_derived::base_shadowed

This function should shadow the excluded_base function. @@ -1041,7 +1041,7 @@

Return Value

-

protected_derived::derived_shadowed

+

protected_derived::derived_shadowed

This function should be shadowed by derived classes. @@ -1065,7 +1065,7 @@

Return Value

-

protected_derived::do_base_base_inherited

+

protected_derived::do_base_base_inherited

This function should be indirectly inherited by derived classes. @@ -1089,7 +1089,7 @@

Return Value

-

protected_derived::do_base_inherited

+

protected_derived::do_base_inherited

This function should be inherited by derived classes. @@ -1113,7 +1113,7 @@

Return Value

-

protected_derived::do_base_shadowed

+

protected_derived::do_base_shadowed

This function should shadow the excluded_base function. @@ -1137,7 +1137,7 @@

Return Value

-

protected_derived::do_derived_shadowed

+

protected_derived::do_derived_shadowed

This function should be shadowed by derived classes. @@ -1161,7 +1161,7 @@

Return Value

-

protected_derived::do_excluded_inherited

+

protected_derived::do_excluded_inherited

This function should be inherited by derived classes. @@ -1181,7 +1181,7 @@

Synopsis

-

protected_derived::do_shadowed

+

protected_derived::do_shadowed

This function should be shadowed by derived classes. @@ -1201,7 +1201,7 @@

Synopsis

-

protected_derived::excluded_inherited

+

protected_derived::excluded_inherited

This function should be inherited by derived classes. diff --git a/test-files/golden-tests/config/inherit-base-members/never.html b/test-files/golden-tests/config/inherit-base-members/never.html index dd80b4f49..24a2a51a2 100644 --- a/test-files/golden-tests/config/inherit-base-members/never.html +++ b/test-files/golden-tests/config/inherit-base-members/never.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -30,7 +30,7 @@

Types

-

base

+

base

A base class to test inheritance and shadowing @@ -113,7 +113,7 @@

Derived Classes

-

base::base_inherited

+

base::base_inherited

This function should be inherited by derived classes. @@ -137,7 +137,7 @@

Return Value

-

base::base_shadowed

+

base::base_shadowed

This function should shadow the excluded_base function. @@ -161,7 +161,7 @@

Return Value

-

base::derived_shadowed

+

base::derived_shadowed

This function should be shadowed by derived classes. @@ -185,7 +185,7 @@

Return Value

-

base::do_base_inherited

+

base::do_base_inherited

This function should be inherited by derived classes. @@ -209,7 +209,7 @@

Return Value

-

base::do_base_shadowed

+

base::do_base_shadowed

This function should shadow the excluded_base function. @@ -233,7 +233,7 @@

Return Value

-

base::do_derived_shadowed

+

base::do_derived_shadowed

This function should be shadowed by derived classes. @@ -257,7 +257,7 @@

Return Value

-

base_base

+

base_base

A second-order base class to test indirect inheritance @@ -308,7 +308,7 @@

Derived Classes

-

base_base::base_base_inherited

+

base_base::base_base_inherited

This function should be indirectly inherited by derived classes. @@ -332,7 +332,7 @@

Return Value

-

base_base::do_base_base_inherited

+

base_base::do_base_base_inherited

This function should be indirectly inherited by derived classes. @@ -356,7 +356,7 @@

Return Value

-

derived

+

derived

A class that derives from base and excluded_base @@ -409,7 +409,7 @@

Member Functions

-

derived::derived_shadowed

+

derived::derived_shadowed

This function should shadow the base class function. @@ -433,7 +433,7 @@

Return Value

-

derived::do_derived_shadowed

+

derived::do_derived_shadowed

This function should shadow the base class function. @@ -457,7 +457,7 @@

Return Value

-

private_derived

+

private_derived

A class that uses private inheritance only @@ -495,7 +495,7 @@

Member Functions

-

private_derived::derived_shadowed

+

private_derived::derived_shadowed

This function should shadow the base class function. @@ -519,7 +519,7 @@

Return Value

-

private_derived::do_derived_shadowed

+

private_derived::do_derived_shadowed

This function should shadow the base class function. @@ -543,7 +543,7 @@

Return Value

-

protected_derived

+

protected_derived

A class that should inherit functions as protected. @@ -596,7 +596,7 @@

Member Functions

-

protected_derived::derived_shadowed

+

protected_derived::derived_shadowed

This function should shadow the base class function. @@ -620,7 +620,7 @@

Return Value

-

protected_derived::do_derived_shadowed

+

protected_derived::do_derived_shadowed

This function should shadow the base class function. diff --git a/test-files/golden-tests/config/inherit-base-members/reference.html b/test-files/golden-tests/config/inherit-base-members/reference.html index 731d0faae..51f3458e8 100644 --- a/test-files/golden-tests/config/inherit-base-members/reference.html +++ b/test-files/golden-tests/config/inherit-base-members/reference.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -30,7 +30,7 @@

Types

-

base

+

base

A base class to test inheritance and shadowing @@ -115,7 +115,7 @@

Derived Classes

-

base::base_inherited

+

base::base_inherited

This function should be inherited by derived classes. @@ -139,7 +139,7 @@

Return Value

-

base::base_shadowed

+

base::base_shadowed

This function should shadow the excluded_base function. @@ -163,7 +163,7 @@

Return Value

-

base::derived_shadowed

+

base::derived_shadowed

This function should be shadowed by derived classes. @@ -187,7 +187,7 @@

Return Value

-

base::do_base_inherited

+

base::do_base_inherited

This function should be inherited by derived classes. @@ -211,7 +211,7 @@

Return Value

-

base::do_base_shadowed

+

base::do_base_shadowed

This function should shadow the excluded_base function. @@ -235,7 +235,7 @@

Return Value

-

base::do_derived_shadowed

+

base::do_derived_shadowed

This function should be shadowed by derived classes. @@ -259,7 +259,7 @@

Return Value

-

base_base

+

base_base

A second-order base class to test indirect inheritance @@ -310,7 +310,7 @@

Derived Classes

-

base_base::base_base_inherited

+

base_base::base_base_inherited

This function should be indirectly inherited by derived classes. @@ -334,7 +334,7 @@

Return Value

-

base_base::do_base_base_inherited

+

base_base::do_base_base_inherited

This function should be indirectly inherited by derived classes. @@ -358,7 +358,7 @@

Return Value

-

derived

+

derived

A class that derives from base and excluded_base @@ -431,7 +431,7 @@

Protected Member Functions

-

derived::derived_shadowed

+

derived::derived_shadowed

This function should shadow the base class function. @@ -455,7 +455,7 @@

Return Value

-

derived::do_derived_shadowed

+

derived::do_derived_shadowed

This function should shadow the base class function. @@ -479,7 +479,7 @@

Return Value

-

private_derived

+

private_derived

A class that uses private inheritance only @@ -517,7 +517,7 @@

Member Functions

-

private_derived::derived_shadowed

+

private_derived::derived_shadowed

This function should shadow the base class function. @@ -541,7 +541,7 @@

Return Value

-

private_derived::do_derived_shadowed

+

private_derived::do_derived_shadowed

This function should shadow the base class function. @@ -565,7 +565,7 @@

Return Value

-

protected_derived

+

protected_derived

A class that should inherit functions as protected. @@ -639,7 +639,7 @@

Protected Member Functions

-

protected_derived::derived_shadowed

+

protected_derived::derived_shadowed

This function should shadow the base class function. @@ -663,7 +663,7 @@

Return Value

-

protected_derived::do_derived_shadowed

+

protected_derived::do_derived_shadowed

This function should shadow the base class function. diff --git a/test-files/golden-tests/config/inherit-base-members/skip-special.html b/test-files/golden-tests/config/inherit-base-members/skip-special.html index a047bd876..5f0a10951 100644 --- a/test-files/golden-tests/config/inherit-base-members/skip-special.html +++ b/test-files/golden-tests/config/inherit-base-members/skip-special.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -30,7 +30,7 @@

Types

-

base

+

base

Synopsis

@@ -113,7 +113,7 @@

Derived Classes

-

base::base

+

base::base

Constructor should not be inherited @@ -132,7 +132,7 @@

Synopsis

-

base::~base

+

base::~base

Destructor should not be inherited @@ -151,7 +151,7 @@

Synopsis

-

base::base_inherited

+

base::base_inherited

This function should be inherited by derived classes. @@ -171,7 +171,7 @@

Synopsis

-

base::base_shadowed

+

base::base_shadowed

This function should shadow the excluded_base function. @@ -191,7 +191,7 @@

Synopsis

-

base::derived_shadowed

+

base::derived_shadowed

This function should be shadowed by derived classes. @@ -211,7 +211,7 @@

Synopsis

-

base::do_base_inherited

+

base::do_base_inherited

This function should be inherited by derived classes. @@ -231,7 +231,7 @@

Synopsis

-

base::do_base_shadowed

+

base::do_base_shadowed

This function should shadow the excluded_base function. @@ -251,7 +251,7 @@

Synopsis

-

base::do_derived_shadowed

+

base::do_derived_shadowed

This function should be shadowed by derived classes. @@ -271,7 +271,7 @@

Synopsis

-

base_base

+

base_base

Synopsis

@@ -320,7 +320,7 @@

Derived Classes

-

base_base::base_base

+

base_base::base_base

Constructor should not be inherited @@ -339,7 +339,7 @@

Synopsis

-

base_base::~base_base

+

base_base::~base_base

Destructor should not be inherited @@ -358,7 +358,7 @@

Synopsis

-

base_base::base_base_inherited

+

base_base::base_base_inherited

This function should be indirectly inherited by derived classes. @@ -378,7 +378,7 @@

Synopsis

-

base_base::do_base_base_inherited

+

base_base::do_base_base_inherited

This function should be indirectly inherited by derived classes. @@ -398,7 +398,7 @@

Synopsis

-

derived

+

derived

Synopsis

@@ -472,7 +472,7 @@

Protected Member Functions

-

derived::derived

+

derived::derived

Constructor should not be inherited @@ -491,7 +491,7 @@

Synopsis

-

derived::~derived

+

derived::~derived

Destructor should not be inherited @@ -510,7 +510,7 @@

Synopsis

-

derived::derived_shadowed

+

derived::derived_shadowed

This function should shadow the base class function. @@ -530,7 +530,7 @@

Synopsis

-

derived::do_derived_shadowed

+

derived::do_derived_shadowed

This function should shadow the base class function. @@ -550,7 +550,7 @@

Synopsis

-

derived::excluded_inherited

+

derived::excluded_inherited

This function should be inherited by derived classes. @@ -570,7 +570,7 @@

Synopsis

-

derived::do_excluded_inherited

+

derived::do_excluded_inherited

This function should be inherited by derived classes. @@ -590,7 +590,7 @@

Synopsis

-

derived::do_shadowed

+

derived::do_shadowed

This function should be shadowed by derived classes. @@ -610,7 +610,7 @@

Synopsis

-

private_derived

+

private_derived

Synopsis

@@ -646,7 +646,7 @@

Member Functions

-

private_derived::private_derived

+

private_derived::private_derived

Constructor should not be inherited @@ -665,7 +665,7 @@

Synopsis

-

private_derived::~private_derived

+

private_derived::~private_derived

Destructor should not be inherited @@ -684,7 +684,7 @@

Synopsis

-

private_derived::derived_shadowed

+

private_derived::derived_shadowed

This function should shadow the base class function. @@ -704,7 +704,7 @@

Synopsis

-

private_derived::do_derived_shadowed

+

private_derived::do_derived_shadowed

This function should shadow the base class function. @@ -724,7 +724,7 @@

Synopsis

-

protected_derived

+

protected_derived

Should inherit functions as protected. @@ -803,7 +803,7 @@

Protected Member Functions

-

protected_derived::protected_derived

+

protected_derived::protected_derived

Constructor should not be inherited @@ -822,7 +822,7 @@

Synopsis

-

protected_derived::~protected_derived

+

protected_derived::~protected_derived

Destructor should not be inherited @@ -841,7 +841,7 @@

Synopsis

-

protected_derived::derived_shadowed

+

protected_derived::derived_shadowed

This function should shadow the base class function. @@ -865,7 +865,7 @@

Return Value

-

protected_derived::do_derived_shadowed

+

protected_derived::do_derived_shadowed

This function should shadow the base class function. @@ -889,7 +889,7 @@

Return Value

-

protected_derived::do_excluded_inherited

+

protected_derived::do_excluded_inherited

This function should be inherited by derived classes. @@ -909,7 +909,7 @@

Synopsis

-

protected_derived::do_shadowed

+

protected_derived::do_shadowed

This function should be shadowed by derived classes. @@ -929,7 +929,7 @@

Synopsis

-

protected_derived::excluded_inherited

+

protected_derived::excluded_inherited

This function should be inherited by derived classes. diff --git a/test-files/golden-tests/config/legible-names/constructor.html b/test-files/golden-tests/config/legible-names/constructor.html index 897c3fdf4..bb40070c9 100644 --- a/test-files/golden-tests/config/legible-names/constructor.html +++ b/test-files/golden-tests/config/legible-names/constructor.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -25,7 +25,7 @@

Types

-

X

+

X

Synopsis

@@ -56,7 +56,7 @@

Member Functions

-

X::X

+

X::X

Constructors @@ -106,7 +106,7 @@

Synopses

-

X::X

+

X::X

Default constructor @@ -125,7 +125,7 @@

Synopsis

-

X::X

+

X::X

Copy constructor @@ -161,7 +161,7 @@

Parameters

-

X::X

+

X::X

Move constructor @@ -197,7 +197,7 @@

Parameters

-

X::X

+

X::X

Construct from int @@ -233,7 +233,7 @@

Parameters

-

X::X

+

X::X

Construct from double diff --git a/test-files/golden-tests/config/missing-include-prefixes/main.html b/test-files/golden-tests/config/missing-include-prefixes/main.html index dc2bb0d2e..08f392245 100644 --- a/test-files/golden-tests/config/missing-include-prefixes/main.html +++ b/test-files/golden-tests/config/missing-include-prefixes/main.html @@ -7,7 +7,7 @@

Reference

-

+

Functions

@@ -26,7 +26,7 @@

Functions

-

f

+

f

Synopsis

@@ -42,7 +42,7 @@

Synopsis

-

g

+

g

Synopsis

diff --git a/test-files/golden-tests/config/missing-include-shims/main.html b/test-files/golden-tests/config/missing-include-shims/main.html index cb7d1d50b..f40715328 100644 --- a/test-files/golden-tests/config/missing-include-shims/main.html +++ b/test-files/golden-tests/config/missing-include-shims/main.html @@ -7,7 +7,7 @@

Reference

-

+

Functions

@@ -26,7 +26,7 @@

Functions

-

f

+

f

Function satisfied by missing-include-shims diff --git a/test-files/golden-tests/config/overloads/const-mutable.html b/test-files/golden-tests/config/overloads/const-mutable.html index a23f7b019..1edc7e2ce 100644 --- a/test-files/golden-tests/config/overloads/const-mutable.html +++ b/test-files/golden-tests/config/overloads/const-mutable.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -25,7 +25,7 @@

Types

-

C

+

C

Synopsis

@@ -56,7 +56,7 @@

Member Functions

-

C::foo

+

C::foo

Synopses

@@ -83,7 +83,7 @@

Synopses

-

C::foo

+

C::foo

Synopsis

@@ -99,7 +99,7 @@

Synopsis

-

C::foo

+

C::foo

Synopsis

diff --git a/test-files/golden-tests/config/overloads/visibility.html b/test-files/golden-tests/config/overloads/visibility.html index db1619027..41883e144 100644 --- a/test-files/golden-tests/config/overloads/visibility.html +++ b/test-files/golden-tests/config/overloads/visibility.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -25,7 +25,7 @@

Types

-

C

+

C

Synopsis

@@ -98,7 +98,7 @@

Protected Static Member Functions

-

C::foo

+

C::foo

Synopses

@@ -125,7 +125,7 @@

Synopses

-

C::foo

+

C::foo

Synopsis

@@ -141,7 +141,7 @@

Synopsis

-

C::foo

+

C::foo

Synopsis

@@ -157,7 +157,7 @@

Synopsis

-

C::foo

+

C::foo

Synopses

@@ -188,7 +188,7 @@

Synopses

-

C::foo

+

C::foo

Synopsis

@@ -205,7 +205,7 @@

Synopsis

-

C::foo

+

C::foo

Synopsis

@@ -224,7 +224,7 @@

Synopsis

-

C::foo

+

C::foo

Synopses

@@ -256,7 +256,7 @@

Synopses

-

C::foo

+

C::foo

Synopsis

@@ -274,7 +274,7 @@

Synopsis

-

C::foo

+

C::foo

Synopsis

@@ -293,7 +293,7 @@

Synopsis

-

C::foo

+

C::foo

Synopses

@@ -329,7 +329,7 @@

Synopses

-

C::foo

+

C::foo

Synopsis

@@ -349,7 +349,7 @@

Synopsis

-

C::foo

+

C::foo

Synopsis

diff --git a/test-files/golden-tests/config/sfinae/redeclare.html b/test-files/golden-tests/config/sfinae/redeclare.html index 8db003587..207f80385 100644 --- a/test-files/golden-tests/config/sfinae/redeclare.html +++ b/test-files/golden-tests/config/sfinae/redeclare.html @@ -7,7 +7,7 @@

Reference

-

+

Functions

@@ -25,7 +25,7 @@

Functions

-

f

+

f

Synopsis

diff --git a/test-files/golden-tests/config/sfinae/return-based.html b/test-files/golden-tests/config/sfinae/return-based.html index 97acc194f..a64428920 100644 --- a/test-files/golden-tests/config/sfinae/return-based.html +++ b/test-files/golden-tests/config/sfinae/return-based.html @@ -7,7 +7,7 @@

Reference

-

+

Functions

@@ -25,7 +25,7 @@

Functions

-

f

+

f

Synopsis

diff --git a/test-files/golden-tests/config/show-enum-constants/show-enum-constants-false.adoc b/test-files/golden-tests/config/show-enum-constants/show-enum-constants-false.adoc new file mode 100644 index 000000000..8b7c9d7db --- /dev/null +++ b/test-files/golden-tests/config/show-enum-constants/show-enum-constants-false.adoc @@ -0,0 +1,46 @@ += Reference +:mrdocs: + +[#index] +== Global namespace + +=== Enums + +[cols=2] +|=== +| Name +| Description +| link:#Color[`Color`] +| A simple enum +|=== + +[#Color] +== Color + +A simple enum + +=== Synopsis + +Declared in `<show‐enum‐constants‐false.cpp>` + +[source,cpp,subs="verbatim,replacements,macros,-callouts"] +---- +enum class Color : int; +---- + +=== Members + +[cols=2] +|=== +| Name +| Description +| `Red` +| The color red +| `Green` +| The color green +| `Blue` +| The color blue +|=== + + +[.small]#Created with https://www.mrdocs.com[MrDocs]# diff --git a/test-files/golden-tests/config/show-enum-constants/show-enum-constants-false.cpp b/test-files/golden-tests/config/show-enum-constants/show-enum-constants-false.cpp new file mode 100644 index 000000000..59e40099a --- /dev/null +++ b/test-files/golden-tests/config/show-enum-constants/show-enum-constants-false.cpp @@ -0,0 +1,9 @@ +/// A simple enum +enum class Color { + /// The color red + Red, + /// The color green + Green, + /// The color blue + Blue +}; \ No newline at end of file diff --git a/test-files/golden-tests/config/show-enum-constants/show-enum-constants-false.html b/test-files/golden-tests/config/show-enum-constants/show-enum-constants-false.html new file mode 100644 index 000000000..8c07c4e70 --- /dev/null +++ b/test-files/golden-tests/config/show-enum-constants/show-enum-constants-false.html @@ -0,0 +1,68 @@ + + +Reference + + +
+

Reference

+
+
+

+
+

Enums

+
+ + + + + + + + + + +
NameDescription
Color A simple enum
+ +
+
+
+

Color

+
+A simple enum + +
+
+
+

Synopsis

+
+Declared in <show-enum-constants-false.cpp>
+
+enum class Color : int;
+
+
+
+
+

Members

+ + + + + + + + + + + + + +
NameDescription
Red The color red
Green The color green
Blue The color blue
+ +
+ + +
+

Created with MrDocs

+
+ + \ No newline at end of file diff --git a/test-files/golden-tests/config/show-enum-constants/show-enum-constants-false.xml b/test-files/golden-tests/config/show-enum-constants/show-enum-constants-false.xml new file mode 100644 index 000000000..0de4ffdcd --- /dev/null +++ b/test-files/golden-tests/config/show-enum-constants/show-enum-constants-false.xml @@ -0,0 +1,41 @@ + + + + + + + + + + + A simple enum + + + + + + + The color red + + + + + + + + The color green + + + + + + + + The color blue + + + + + + diff --git a/test-files/golden-tests/config/show-enum-constants/show-enum-constants-false.yml b/test-files/golden-tests/config/show-enum-constants/show-enum-constants-false.yml new file mode 100644 index 000000000..d3f51abf4 --- /dev/null +++ b/test-files/golden-tests/config/show-enum-constants/show-enum-constants-false.yml @@ -0,0 +1 @@ +show-enum-constants: false \ No newline at end of file diff --git a/test-files/golden-tests/config/show-enum-constants/show-enum-constants-true.adoc b/test-files/golden-tests/config/show-enum-constants/show-enum-constants-true.adoc new file mode 100644 index 000000000..557a038d8 --- /dev/null +++ b/test-files/golden-tests/config/show-enum-constants/show-enum-constants-true.adoc @@ -0,0 +1,88 @@ += Reference +:mrdocs: + +[#index] +== Global namespace + +=== Enums + +[cols=2] +|=== +| Name +| Description +| link:#Color[`Color`] +| A simple enum +|=== + +[#Color] +== Color + +A simple enum + +=== Synopsis + +Declared in `<show‐enum‐constants‐true.cpp>` + +[source,cpp,subs="verbatim,replacements,macros,-callouts"] +---- +enum class Color : int; +---- + +=== Members + +[cols=2] +|=== +| Name +| Description +| link:#Color-Red[`Red`] +| The color red +| link:#Color-Green[`Green`] +| The color green +| link:#Color-Blue[`Blue`] +| The color blue +|=== + +[#Color-Red] +== link:#Color[Color]::Red + +The color red + +=== Synopsis + +Declared in `<show‐enum‐constants‐true.cpp>` + +[source,cpp,subs="verbatim,replacements,macros,-callouts"] +---- +Red +---- + +[#Color-Green] +== link:#Color[Color]::Green + +The color green + +=== Synopsis + +Declared in `<show‐enum‐constants‐true.cpp>` + +[source,cpp,subs="verbatim,replacements,macros,-callouts"] +---- +Green +---- + +[#Color-Blue] +== link:#Color[Color]::Blue + +The color blue + +=== Synopsis + +Declared in `<show‐enum‐constants‐true.cpp>` + +[source,cpp,subs="verbatim,replacements,macros,-callouts"] +---- +Blue +---- + + +[.small]#Created with https://www.mrdocs.com[MrDocs]# diff --git a/test-files/golden-tests/config/show-enum-constants/show-enum-constants-true.cpp b/test-files/golden-tests/config/show-enum-constants/show-enum-constants-true.cpp new file mode 100644 index 000000000..59e40099a --- /dev/null +++ b/test-files/golden-tests/config/show-enum-constants/show-enum-constants-true.cpp @@ -0,0 +1,9 @@ +/// A simple enum +enum class Color { + /// The color red + Red, + /// The color green + Green, + /// The color blue + Blue +}; \ No newline at end of file diff --git a/test-files/golden-tests/config/show-enum-constants/show-enum-constants-true.html b/test-files/golden-tests/config/show-enum-constants/show-enum-constants-true.html new file mode 100644 index 000000000..6dde51084 --- /dev/null +++ b/test-files/golden-tests/config/show-enum-constants/show-enum-constants-true.html @@ -0,0 +1,125 @@ + + +Reference + + +
+

Reference

+
+
+

+
+

Enums

+ + + + + + + + + + + +
NameDescription
Color A simple enum
+ +
+
+
+

Color

+
+A simple enum + +
+
+
+

Synopsis

+
+Declared in <show-enum-constants-true.cpp>
+
+enum class Color : int;
+
+
+
+
+

Members

+ + + + + + + + + + + + + +
NameDescription
Red The color red
Green The color green
Blue The color blue
+ +
+
+
+

Color::Red

+
+The color red + +
+
+
+

Synopsis

+
+Declared in <show-enum-constants-true.cpp>
+
+Red
+
+
+
+
+
+
+
+

Color::Green

+
+The color green + +
+
+
+

Synopsis

+
+Declared in <show-enum-constants-true.cpp>
+
+Green
+
+
+
+
+
+
+
+

Color::Blue

+
+The color blue + +
+
+
+

Synopsis

+
+Declared in <show-enum-constants-true.cpp>
+
+Blue
+
+
+
+
+
+ +
+
+

Created with MrDocs

+
+ + \ No newline at end of file diff --git a/test-files/golden-tests/config/show-enum-constants/show-enum-constants-true.xml b/test-files/golden-tests/config/show-enum-constants/show-enum-constants-true.xml new file mode 100644 index 000000000..2b7260588 --- /dev/null +++ b/test-files/golden-tests/config/show-enum-constants/show-enum-constants-true.xml @@ -0,0 +1,41 @@ + + + + + + + + + + + A simple enum + + + + + + + The color red + + + + + + + + The color green + + + + + + + + The color blue + + + + + + diff --git a/test-files/golden-tests/config/show-enum-constants/show-enum-constants-true.yml b/test-files/golden-tests/config/show-enum-constants/show-enum-constants-true.yml new file mode 100644 index 000000000..6b9718466 --- /dev/null +++ b/test-files/golden-tests/config/show-enum-constants/show-enum-constants-true.yml @@ -0,0 +1 @@ +show-enum-constants: true \ No newline at end of file diff --git a/test-files/golden-tests/config/show-namespaces/show-namespaces.html b/test-files/golden-tests/config/show-namespaces/show-namespaces.html index af2b0caec..1ed532aeb 100644 --- a/test-files/golden-tests/config/show-namespaces/show-namespaces.html +++ b/test-files/golden-tests/config/show-namespaces/show-namespaces.html @@ -7,7 +7,7 @@

Reference

-

A::B::c

+

A::B::c

Synopsis

@@ -23,7 +23,7 @@

Synopsis

-

A::b

+

A::b

Synopsis

@@ -39,7 +39,7 @@

Synopsis

-

a

+

a

Synopsis

diff --git a/test-files/golden-tests/config/sort-members-by/sort-members-by-location.html b/test-files/golden-tests/config/sort-members-by/sort-members-by-location.html index 3acbf2191..e6fd0d68d 100644 --- a/test-files/golden-tests/config/sort-members-by/sort-members-by-location.html +++ b/test-files/golden-tests/config/sort-members-by/sort-members-by-location.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -25,7 +25,7 @@

Types

-

Z

+

Z

Synopsis

@@ -64,7 +64,7 @@

Member Functions

-

Z::Z

+

Z::Z

Constructors @@ -93,7 +93,7 @@

Synopses

-

Z::Z

+

Z::Z

Construct from int @@ -129,7 +129,7 @@

Parameters

-

Z::Z

+

Z::Z

Default constructor @@ -148,7 +148,7 @@

Synopsis

-

Z::~Z

+

Z::~Z

Destructor @@ -167,7 +167,7 @@

Synopsis

-

Z::foo

+

Z::foo

Synopsis

@@ -183,7 +183,7 @@

Synopsis

-

Z::bar

+

Z::bar

Synopsis

@@ -199,7 +199,7 @@

Synopsis

-

Z::operator bool

+

Z::operator bool

Conversion to bool @@ -222,7 +222,7 @@

Return Value

-

Z::operator!

+

Z::operator!

Negation operator @@ -246,7 +246,7 @@

Return Value

-

Z::operator==

+

Z::operator==

Equality operator @@ -287,7 +287,7 @@

Parameters

-

Z::operator!=

+

Z::operator!=

Inequality operator @@ -328,7 +328,7 @@

Parameters

-

Z::operator<=>

+

Z::operator<=>

Three-way comparison operator diff --git a/test-files/golden-tests/config/sort-members-by/sort-members-by-name.html b/test-files/golden-tests/config/sort-members-by/sort-members-by-name.html index 839f92eca..575e608a3 100644 --- a/test-files/golden-tests/config/sort-members-by/sort-members-by-name.html +++ b/test-files/golden-tests/config/sort-members-by/sort-members-by-name.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -25,7 +25,7 @@

Types

-

Z

+

Z

Synopsis

@@ -64,7 +64,7 @@

Member Functions

-

Z::Z

+

Z::Z

Constructors @@ -93,7 +93,7 @@

Synopses

-

Z::Z

+

Z::Z

Default constructor @@ -112,7 +112,7 @@

Synopsis

-

Z::Z

+

Z::Z

Construct from int @@ -148,7 +148,7 @@

Parameters

-

Z::~Z

+

Z::~Z

Destructor @@ -167,7 +167,7 @@

Synopsis

-

Z::bar

+

Z::bar

Synopsis

@@ -183,7 +183,7 @@

Synopsis

-

Z::foo

+

Z::foo

Synopsis

@@ -199,7 +199,7 @@

Synopsis

-

Z::operator bool

+

Z::operator bool

Conversion to bool @@ -222,7 +222,7 @@

Return Value

-

Z::operator!

+

Z::operator!

Negation operator @@ -246,7 +246,7 @@

Return Value

-

Z::operator==

+

Z::operator==

Equality operator @@ -287,7 +287,7 @@

Parameters

-

Z::operator!=

+

Z::operator!=

Inequality operator @@ -328,7 +328,7 @@

Parameters

-

Z::operator<=>

+

Z::operator<=>

Three-way comparison operator diff --git a/test-files/golden-tests/config/sort-namespace-members-by/sort-namespace-members-by-location.html b/test-files/golden-tests/config/sort-namespace-members-by/sort-namespace-members-by-location.html index e90718cb6..2a7014d68 100644 --- a/test-files/golden-tests/config/sort-namespace-members-by/sort-namespace-members-by-location.html +++ b/test-files/golden-tests/config/sort-namespace-members-by/sort-namespace-members-by-location.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -52,7 +52,7 @@

Functions

-

D

+

D

Synopsis

@@ -69,7 +69,7 @@

Synopsis

-

C

+

C

Synopsis

@@ -89,7 +89,7 @@

Synopsis

-

C<int, char>

+

C<int, char>

Synopsis

@@ -107,7 +107,7 @@

Synopsis

-

C<int>

+

C<int>

Synopsis

@@ -125,7 +125,7 @@

Synopsis

-

B

+

B

Synopsis

@@ -145,7 +145,7 @@

Synopsis

-

B<int, char>

+

B<int, char>

Synopsis

@@ -163,7 +163,7 @@

Synopsis

-

B<int, U>

+

B<int, U>

Synopsis

@@ -181,7 +181,7 @@

Synopsis

-

A

+

A

Synopsis

@@ -198,7 +198,7 @@

Synopsis

-

Z

+

Z

Synopsis

@@ -236,7 +236,7 @@

Member Functions

-

Z::Z

+

Z::Z

Constructors @@ -265,7 +265,7 @@

Synopses

-

Z::Z

+

Z::Z

Default constructor @@ -284,7 +284,7 @@

Synopsis

-

Z::Z

+

Z::Z

Construct from int @@ -320,7 +320,7 @@

Parameters

-

Z::~Z

+

Z::~Z

Destructor @@ -339,7 +339,7 @@

Synopsis

-

Z::foo

+

Z::foo

Synopsis

@@ -355,7 +355,7 @@

Synopsis

-

Z::operator bool

+

Z::operator bool

Conversion to bool @@ -378,7 +378,7 @@

Return Value

-

Z::operator!

+

Z::operator!

Negation operator @@ -402,7 +402,7 @@

Return Value

-

Z::operator==

+

Z::operator==

Equality operator @@ -443,7 +443,7 @@

Parameters

-

Z::operator!=

+

Z::operator!=

Inequality operator @@ -484,7 +484,7 @@

Parameters

-

Z::operator<=>

+

Z::operator<=>

Three-way comparison operator @@ -525,7 +525,7 @@

Parameters

-

h

+

h

Synopsis

@@ -541,7 +541,7 @@

Synopsis

-

g

+

g

Synopses

@@ -621,7 +621,7 @@

Synopses

-

g

+

g

Synopsis

@@ -641,7 +641,7 @@

Synopsis

-

g<int>

+

g<int>

Synopsis

@@ -661,7 +661,7 @@

Synopsis

-

g

+

g

Synopsis

@@ -680,7 +680,7 @@

Synopsis

-

g

+

g

Synopsis

@@ -698,7 +698,7 @@

Synopsis

-

g

+

g

Synopsis

@@ -714,7 +714,7 @@

Synopsis

-

g

+

g

Synopsis

@@ -730,7 +730,7 @@

Synopsis

-

g

+

g

Synopsis

@@ -746,7 +746,7 @@

Synopsis

-

f

+

f

Synopsis

@@ -762,7 +762,7 @@

Synopsis

-

operator!

+

operator!

Negation operator @@ -803,7 +803,7 @@

Parameters

-

operator==

+

operator==

Equality operator @@ -850,7 +850,7 @@

Parameters

-

operator!=

+

operator!=

Inequality operator diff --git a/test-files/golden-tests/config/sort-namespace-members-by/sort-namespace-members-by-name.html b/test-files/golden-tests/config/sort-namespace-members-by/sort-namespace-members-by-name.html index 399b5f869..d0c60f782 100644 --- a/test-files/golden-tests/config/sort-namespace-members-by/sort-namespace-members-by-name.html +++ b/test-files/golden-tests/config/sort-namespace-members-by/sort-namespace-members-by-name.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -52,7 +52,7 @@

Functions

-

A

+

A

Synopsis

@@ -69,7 +69,7 @@

Synopsis

-

B

+

B

Synopsis

@@ -89,7 +89,7 @@

Synopsis

-

B<int, char>

+

B<int, char>

Synopsis

@@ -107,7 +107,7 @@

Synopsis

-

B<int, U>

+

B<int, U>

Synopsis

@@ -125,7 +125,7 @@

Synopsis

-

C

+

C

Synopsis

@@ -145,7 +145,7 @@

Synopsis

-

C<int>

+

C<int>

Synopsis

@@ -163,7 +163,7 @@

Synopsis

-

C<int, char>

+

C<int, char>

Synopsis

@@ -181,7 +181,7 @@

Synopsis

-

D

+

D

Synopsis

@@ -198,7 +198,7 @@

Synopsis

-

Z

+

Z

Synopsis

@@ -236,7 +236,7 @@

Member Functions

-

Z::Z

+

Z::Z

Constructors @@ -265,7 +265,7 @@

Synopses

-

Z::Z

+

Z::Z

Default constructor @@ -284,7 +284,7 @@

Synopsis

-

Z::Z

+

Z::Z

Construct from int @@ -320,7 +320,7 @@

Parameters

-

Z::~Z

+

Z::~Z

Destructor @@ -339,7 +339,7 @@

Synopsis

-

Z::foo

+

Z::foo

Synopsis

@@ -355,7 +355,7 @@

Synopsis

-

Z::operator bool

+

Z::operator bool

Conversion to bool @@ -378,7 +378,7 @@

Return Value

-

Z::operator!

+

Z::operator!

Negation operator @@ -402,7 +402,7 @@

Return Value

-

Z::operator==

+

Z::operator==

Equality operator @@ -443,7 +443,7 @@

Parameters

-

Z::operator!=

+

Z::operator!=

Inequality operator @@ -484,7 +484,7 @@

Parameters

-

Z::operator<=>

+

Z::operator<=>

Three-way comparison operator @@ -525,7 +525,7 @@

Parameters

-

f

+

f

Synopsis

@@ -541,7 +541,7 @@

Synopsis

-

g

+

g

Synopses

@@ -621,7 +621,7 @@

Synopses

-

g

+

g

Synopsis

@@ -637,7 +637,7 @@

Synopsis

-

g

+

g

Synopsis

@@ -653,7 +653,7 @@

Synopsis

-

g

+

g

Synopsis

@@ -669,7 +669,7 @@

Synopsis

-

g

+

g

Synopsis

@@ -687,7 +687,7 @@

Synopsis

-

g

+

g

Synopsis

@@ -706,7 +706,7 @@

Synopsis

-

g

+

g

Synopsis

@@ -726,7 +726,7 @@

Synopsis

-

g<int>

+

g<int>

Synopsis

@@ -746,7 +746,7 @@

Synopsis

-

h

+

h

Synopsis

@@ -762,7 +762,7 @@

Synopsis

-

operator!

+

operator!

Negation operator @@ -803,7 +803,7 @@

Parameters

-

operator==

+

operator==

Equality operator @@ -850,7 +850,7 @@

Parameters

-

operator!=

+

operator!=

Inequality operator diff --git a/test-files/golden-tests/config/sort/sort-members.html b/test-files/golden-tests/config/sort/sort-members.html index d2563ae5a..53e1ac6bf 100644 --- a/test-files/golden-tests/config/sort/sort-members.html +++ b/test-files/golden-tests/config/sort/sort-members.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -52,7 +52,7 @@

Functions

-

A

+

A

Synopsis

@@ -69,7 +69,7 @@

Synopsis

-

B

+

B

Synopsis

@@ -89,7 +89,7 @@

Synopsis

-

B<int, char>

+

B<int, char>

Synopsis

@@ -107,7 +107,7 @@

Synopsis

-

B<int, U>

+

B<int, U>

Synopsis

@@ -125,7 +125,7 @@

Synopsis

-

C

+

C

Synopsis

@@ -145,7 +145,7 @@

Synopsis

-

C<int>

+

C<int>

Synopsis

@@ -163,7 +163,7 @@

Synopsis

-

C<int, char>

+

C<int, char>

Synopsis

@@ -181,7 +181,7 @@

Synopsis

-

D

+

D

Synopsis

@@ -198,7 +198,7 @@

Synopsis

-

Z

+

Z

Synopsis

@@ -236,7 +236,7 @@

Member Functions

-

Z::Z

+

Z::Z

Constructors @@ -265,7 +265,7 @@

Synopses

-

Z::Z

+

Z::Z

Default constructor @@ -284,7 +284,7 @@

Synopsis

-

Z::Z

+

Z::Z

Construct from int @@ -320,7 +320,7 @@

Parameters

-

Z::~Z

+

Z::~Z

Destructor @@ -339,7 +339,7 @@

Synopsis

-

Z::foo

+

Z::foo

Synopsis

@@ -355,7 +355,7 @@

Synopsis

-

Z::operator bool

+

Z::operator bool

Conversion to bool @@ -378,7 +378,7 @@

Return Value

-

Z::operator!

+

Z::operator!

Negation operator @@ -402,7 +402,7 @@

Return Value

-

Z::operator==

+

Z::operator==

Equality operator @@ -443,7 +443,7 @@

Parameters

-

Z::operator!=

+

Z::operator!=

Inequality operator @@ -484,7 +484,7 @@

Parameters

-

Z::operator<=>

+

Z::operator<=>

Three-way comparison operator @@ -525,7 +525,7 @@

Parameters

-

f

+

f

Synopsis

@@ -541,7 +541,7 @@

Synopsis

-

g

+

g

Synopses

@@ -621,7 +621,7 @@

Synopses

-

g

+

g

Synopsis

@@ -637,7 +637,7 @@

Synopsis

-

g

+

g

Synopsis

@@ -653,7 +653,7 @@

Synopsis

-

g

+

g

Synopsis

@@ -669,7 +669,7 @@

Synopsis

-

g

+

g

Synopsis

@@ -687,7 +687,7 @@

Synopsis

-

g

+

g

Synopsis

@@ -706,7 +706,7 @@

Synopsis

-

g

+

g

Synopsis

@@ -726,7 +726,7 @@

Synopsis

-

g<int>

+

g<int>

Synopsis

@@ -746,7 +746,7 @@

Synopsis

-

h

+

h

Synopsis

@@ -762,7 +762,7 @@

Synopsis

-

operator!

+

operator!

Negation operator @@ -803,7 +803,7 @@

Parameters

-

operator==

+

operator==

Equality operator @@ -850,7 +850,7 @@

Parameters

-

operator!=

+

operator!=

Inequality operator diff --git a/test-files/golden-tests/config/sort/unordered.html b/test-files/golden-tests/config/sort/unordered.html index 6dc210a0f..99c3fe256 100644 --- a/test-files/golden-tests/config/sort/unordered.html +++ b/test-files/golden-tests/config/sort/unordered.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -52,7 +52,7 @@

Functions

-

D

+

D

Synopsis

@@ -69,7 +69,7 @@

Synopsis

-

C

+

C

Synopsis

@@ -89,7 +89,7 @@

Synopsis

-

C<int, char>

+

C<int, char>

Synopsis

@@ -107,7 +107,7 @@

Synopsis

-

C<int>

+

C<int>

Synopsis

@@ -125,7 +125,7 @@

Synopsis

-

B

+

B

Synopsis

@@ -145,7 +145,7 @@

Synopsis

-

B<int, char>

+

B<int, char>

Synopsis

@@ -163,7 +163,7 @@

Synopsis

-

B<int, U>

+

B<int, U>

Synopsis

@@ -181,7 +181,7 @@

Synopsis

-

A

+

A

Synopsis

@@ -198,7 +198,7 @@

Synopsis

-

Z

+

Z

Synopsis

@@ -236,7 +236,7 @@

Member Functions

-

Z::operator<=>

+

Z::operator<=>

Three-way comparison operator @@ -277,7 +277,7 @@

Parameters

-

Z::operator!=

+

Z::operator!=

Inequality operator @@ -318,7 +318,7 @@

Parameters

-

Z::operator==

+

Z::operator==

Equality operator @@ -359,7 +359,7 @@

Parameters

-

Z::operator!

+

Z::operator!

Negation operator @@ -383,7 +383,7 @@

Return Value

-

Z::operator bool

+

Z::operator bool

Conversion to bool @@ -406,7 +406,7 @@

Return Value

-

Z::foo

+

Z::foo

Synopsis

@@ -422,7 +422,7 @@

Synopsis

-

Z::~Z

+

Z::~Z

Destructor @@ -441,7 +441,7 @@

Synopsis

-

Z::Z

+

Z::Z

Constructors @@ -470,7 +470,7 @@

Synopses

-

Z::Z

+

Z::Z

Default constructor @@ -489,7 +489,7 @@

Synopsis

-

Z::Z

+

Z::Z

Construct from int @@ -525,7 +525,7 @@

Parameters

-

operator!=

+

operator!=

Inequality operator @@ -572,7 +572,7 @@

Parameters

-

operator==

+

operator==

Equality operator @@ -619,7 +619,7 @@

Parameters

-

operator!

+

operator!

Negation operator @@ -660,7 +660,7 @@

Parameters

-

h

+

h

Synopsis

@@ -676,7 +676,7 @@

Synopsis

-

g

+

g

Synopses

@@ -756,7 +756,7 @@

Synopses

-

g

+

g

Synopsis

@@ -776,7 +776,7 @@

Synopsis

-

g<int>

+

g<int>

Synopsis

@@ -796,7 +796,7 @@

Synopsis

-

g

+

g

Synopsis

@@ -815,7 +815,7 @@

Synopsis

-

g

+

g

Synopsis

@@ -833,7 +833,7 @@

Synopsis

-

g

+

g

Synopsis

@@ -849,7 +849,7 @@

Synopsis

-

g

+

g

Synopsis

@@ -865,7 +865,7 @@

Synopsis

-

g

+

g

Synopsis

@@ -881,7 +881,7 @@

Synopsis

-

f

+

f

Synopsis

diff --git a/test-files/golden-tests/core/empty.html b/test-files/golden-tests/core/empty.html index 1ee3b8055..135e79d40 100644 --- a/test-files/golden-tests/core/empty.html +++ b/test-files/golden-tests/core/empty.html @@ -7,7 +7,7 @@

Reference

-

+

diff --git a/test-files/golden-tests/core/libcxx.html b/test-files/golden-tests/core/libcxx.html index a0ff234ed..33d4df60d 100644 --- a/test-files/golden-tests/core/libcxx.html +++ b/test-files/golden-tests/core/libcxx.html @@ -7,7 +7,7 @@

Reference

-

+

Functions

@@ -26,7 +26,7 @@

Functions

-

sqrt

+

sqrt

Computes the square root of an integral value. diff --git a/test-files/golden-tests/core/utf-8.html b/test-files/golden-tests/core/utf-8.html index 0f513fe38..a032af748 100644 --- a/test-files/golden-tests/core/utf-8.html +++ b/test-files/golden-tests/core/utf-8.html @@ -7,7 +7,7 @@

Reference

-

+

Functions

@@ -25,7 +25,7 @@

Functions

-

Христос_воскрес

+

Христос_воскрес

Synopsis

diff --git a/test-files/golden-tests/filters/file/exclude-self.html b/test-files/golden-tests/filters/file/exclude-self.html index 1ee3b8055..135e79d40 100644 --- a/test-files/golden-tests/filters/file/exclude-self.html +++ b/test-files/golden-tests/filters/file/exclude-self.html @@ -7,7 +7,7 @@

Reference

-

+

diff --git a/test-files/golden-tests/filters/file/include-self.html b/test-files/golden-tests/filters/file/include-self.html index 0974c6f3f..274afee73 100644 --- a/test-files/golden-tests/filters/file/include-self.html +++ b/test-files/golden-tests/filters/file/include-self.html @@ -7,7 +7,7 @@

Reference

-

+

Namespaces

@@ -25,7 +25,7 @@

Namespaces

-

TEST

+

TEST

Types

@@ -43,7 +43,7 @@

Types

-

TEST::SUCCESS

+

TEST::SUCCESS

Synopsis

diff --git a/test-files/golden-tests/filters/file/include-symlink.html b/test-files/golden-tests/filters/file/include-symlink.html index ed51751e7..a4f6f953a 100644 --- a/test-files/golden-tests/filters/file/include-symlink.html +++ b/test-files/golden-tests/filters/file/include-symlink.html @@ -7,7 +7,7 @@

Reference

-

+

Functions

@@ -26,7 +26,7 @@

Functions

-

f

+

f

A brief. diff --git a/test-files/golden-tests/filters/file/subdirectories.html b/test-files/golden-tests/filters/file/subdirectories.html index e94b202e7..eed814455 100644 --- a/test-files/golden-tests/filters/file/subdirectories.html +++ b/test-files/golden-tests/filters/file/subdirectories.html @@ -7,7 +7,7 @@

Reference

-

+

Functions

@@ -26,7 +26,7 @@

Functions

-

f

+

f

A brief. diff --git a/test-files/golden-tests/filters/file/subdirectories2.html b/test-files/golden-tests/filters/file/subdirectories2.html index e94b202e7..eed814455 100644 --- a/test-files/golden-tests/filters/file/subdirectories2.html +++ b/test-files/golden-tests/filters/file/subdirectories2.html @@ -7,7 +7,7 @@

Reference

-

+

Functions

@@ -26,7 +26,7 @@

Functions

-

f

+

f

A brief. diff --git a/test-files/golden-tests/filters/symbol-name/blacklist_0.html b/test-files/golden-tests/filters/symbol-name/blacklist_0.html index f4e2e9c1e..9d0cceee2 100644 --- a/test-files/golden-tests/filters/symbol-name/blacklist_0.html +++ b/test-files/golden-tests/filters/symbol-name/blacklist_0.html @@ -7,7 +7,7 @@

Reference

-

+

Namespaces

@@ -27,7 +27,7 @@

Namespaces

-

N0

+

N0

Functions

@@ -45,7 +45,7 @@

Functions

-

N0::f0

+

N0::f0

Synopsis

@@ -61,7 +61,7 @@

Synopsis

-

N4

+

N4

Namespaces

@@ -80,7 +80,7 @@

Namespaces

-

N4::N5

+

N4::N5

Functions

@@ -98,7 +98,7 @@

Functions

-

N4::N5::f1

+

N4::N5::f1

Synopsis

@@ -114,7 +114,7 @@

Synopsis

-

N4::N6

+

N4::N6

Functions

@@ -132,7 +132,7 @@

Functions

-

N4::N6::f1

+

N4::N6::f1

Synopsis

@@ -148,7 +148,7 @@

Synopsis

-

N7

+

N7

Namespaces

@@ -166,7 +166,7 @@

Namespaces

-

N7::N9

+

N7::N9

Functions

@@ -184,7 +184,7 @@

Functions

-

N7::N9::g0

+

N7::N9::g0

Synopsis

diff --git a/test-files/golden-tests/filters/symbol-name/excluded-base-class.html b/test-files/golden-tests/filters/symbol-name/excluded-base-class.html index 0157aa71a..3c3f80243 100644 --- a/test-files/golden-tests/filters/symbol-name/excluded-base-class.html +++ b/test-files/golden-tests/filters/symbol-name/excluded-base-class.html @@ -7,7 +7,7 @@

Reference

-

+

Namespaces

@@ -25,7 +25,7 @@

Namespaces

-

A

+

A

Types

@@ -44,7 +44,7 @@

Types

-

A::D

+

A::D

Synopsis

@@ -92,7 +92,7 @@

Member Functions

-

A::D::f

+

A::D::f

Synopsis

@@ -108,7 +108,7 @@

Synopsis

-

A::D::g

+

A::D::g

Synopsis

@@ -125,7 +125,7 @@

Synopsis

-

A::D::h

+

A::D::h

Synopsis

@@ -142,7 +142,7 @@

Synopsis

-

A::D::i

+

A::D::i

Synopsis

@@ -158,7 +158,7 @@

Synopsis

-

A::E

+

A::E

Synopsis

@@ -206,7 +206,7 @@

Member Functions

-

A::E::f

+

A::E::f

Synopsis

@@ -222,7 +222,7 @@

Synopsis

-

A::E::g

+

A::E::g

Synopsis

@@ -239,7 +239,7 @@

Synopsis

-

A::E::h

+

A::E::h

Synopsis

@@ -256,7 +256,7 @@

Synopsis

-

A::E::i

+

A::E::i

Synopsis

diff --git a/test-files/golden-tests/filters/symbol-name/excluded-namespace-alias.html b/test-files/golden-tests/filters/symbol-name/excluded-namespace-alias.html index 0ab80d792..dff0319e5 100644 --- a/test-files/golden-tests/filters/symbol-name/excluded-namespace-alias.html +++ b/test-files/golden-tests/filters/symbol-name/excluded-namespace-alias.html @@ -7,7 +7,7 @@

Reference

-

+

Namespaces

@@ -25,7 +25,7 @@

Namespaces

-

B

+

B

Namespaces

@@ -43,7 +43,7 @@

Namespaces

-

B::U

+

B::U

Namespace Aliases

@@ -61,7 +61,7 @@

Namespace Aliases

-

B::U::E

+

B::U::E

Synopsis

diff --git a/test-files/golden-tests/filters/symbol-name/extraction-mode.html b/test-files/golden-tests/filters/symbol-name/extraction-mode.html index 56606c8db..9e1d1f0df 100644 --- a/test-files/golden-tests/filters/symbol-name/extraction-mode.html +++ b/test-files/golden-tests/filters/symbol-name/extraction-mode.html @@ -7,7 +7,7 @@

Reference

-

+

Namespaces

@@ -75,7 +75,7 @@

Functions

-

regular_ns

+

regular_ns

A regular namespace with different filters for members @@ -116,7 +116,7 @@

Functions

-

regular_ns::regular

+

regular_ns::regular

A symbol that passes the filters @@ -169,7 +169,7 @@

Description

-

regular_ns::regular::also_regular

+

regular_ns::regular::also_regular

Child of a regular symbol extracted as regular @@ -204,7 +204,7 @@

Types

-

regular_ns::regular::also_regular::regular_as_well

+

regular_ns::regular::also_regular::regular_as_well

Grandchild of a regular symbol extracted as regular @@ -225,7 +225,7 @@

Synopsis

-

regular_ns::see_below

+

regular_ns::see_below

A symbol that passes the see-below filter @@ -250,7 +250,7 @@

Description

-

regular_ns::get_dependency

+

regular_ns::get_dependency

A function to get an excluded symbol @@ -274,7 +274,7 @@

Description

-

regular_ns::get_implementation_defined

+

regular_ns::get_implementation_defined

A function to get an implementation-defined symbol @@ -303,7 +303,7 @@

Return Value

-

regular_ns::get_regular

+

regular_ns::get_regular

A function to get a regular symbol @@ -331,7 +331,7 @@

Return Value

-

regular_ns::get_see_below

+

regular_ns::get_see_below

A function to get a see-below symbol @@ -359,7 +359,7 @@

Return Value

-

see_below_ns

+

see_below_ns

A see-below namespace @@ -403,7 +403,7 @@

Description

-

see_below_ns::regular

+

see_below_ns::regular

Regular symbol in a see-below namespace @@ -428,7 +428,7 @@

Description

-

see_below_ns::see_below

+

see_below_ns::see_below

See-below symbol in a see-below namespace @@ -453,7 +453,7 @@

Description

-

see_below_ns::get_dependency

+

see_below_ns::get_dependency

A function to get a dependency symbol in a see-below namespace @@ -478,7 +478,7 @@

Description

-

see_below_ns::get_implementation_defined

+

see_below_ns::get_implementation_defined

A function to get an implementation-defined symbol in a see-below namespace @@ -507,7 +507,7 @@

Return Value

-

dependency_ns_alias

+

dependency_ns_alias

Namespace alias to form the dependency on dependency_ns @@ -526,7 +526,7 @@

Synopsis

-

implementation_defined_ns_alias

+

implementation_defined_ns_alias

Namespace alias to form a dependency on the implementation-defined namespace @@ -545,7 +545,7 @@

Synopsis

-

see_below_ns_alias

+

see_below_ns_alias

Namespace alias to form a dependency on the see-below namespace @@ -568,7 +568,7 @@

Description

-

regular

+

regular

A regular symbol in the global namespace @@ -621,7 +621,7 @@

Description

-

regular::also_regular

+

regular::also_regular

Child of a regular symbol: should be traversed as usual @@ -656,7 +656,7 @@

Types

-

regular::also_regular::regular_as_well

+

regular::also_regular::regular_as_well

Grandchild of a regular symbol: should be traversed as usual @@ -677,7 +677,7 @@

Synopsis

-

see_below

+

see_below

A see-below symbol in the global namespace @@ -703,7 +703,7 @@

Description

-

get_dependency

+

get_dependency

A function to get a dependency symbol on the global namespace @@ -727,7 +727,7 @@

Description

-

get_implementation_defined

+

get_implementation_defined

A function to get an implementation-defined symbol in the global namespace @@ -756,7 +756,7 @@

Return Value

-

get_regular

+

get_regular

A function to get a regular symbol in the global namespace @@ -784,7 +784,7 @@

Return Value

-

get_see_below

+

get_see_below

A function to get a see-below symbol in the global namespace diff --git a/test-files/golden-tests/filters/symbol-name/impl-defined-member.html b/test-files/golden-tests/filters/symbol-name/impl-defined-member.html index cb8f26140..92b08bc7d 100644 --- a/test-files/golden-tests/filters/symbol-name/impl-defined-member.html +++ b/test-files/golden-tests/filters/symbol-name/impl-defined-member.html @@ -7,7 +7,7 @@

Reference

-

+

Namespaces

@@ -39,7 +39,7 @@

Variables

-

regular

+

regular

Types

@@ -57,7 +57,7 @@

Types

-

regular::absolute_uri_rule_t

+

regular::absolute_uri_rule_t

Synopsis

@@ -74,7 +74,7 @@

Synopsis

-

absolute_uri_rule

+

absolute_uri_rule

Synopsis

@@ -89,7 +89,7 @@

Synopsis

-

regular_absolute_uri_rule

+

regular_absolute_uri_rule

Synopsis

diff --git a/test-files/golden-tests/filters/symbol-name/whitelist_0.html b/test-files/golden-tests/filters/symbol-name/whitelist_0.html index f2b02e598..2f46d7230 100644 --- a/test-files/golden-tests/filters/symbol-name/whitelist_0.html +++ b/test-files/golden-tests/filters/symbol-name/whitelist_0.html @@ -7,7 +7,7 @@

Reference

-

+

Namespaces

@@ -42,7 +42,7 @@

Types

-

N0

+

N0

This namespace should extracted because it's implied by N0::f0_WL @@ -65,7 +65,7 @@

Functions

-

N0::f0_WL

+

N0::f0_WL

This function should be included because it matches N0::f0_WL @@ -85,7 +85,7 @@

Synopsis

-

N1

+

N1

This namespace should extracted because it's implied by N1::N3_WL and N1::N4::f1_WL @@ -109,7 +109,7 @@

Namespaces

-

N1::N3_WL

+

N1::N3_WL

This namespace should extracted because it's explicitly included by N1::N3_WL @@ -132,7 +132,7 @@

Functions

-

N1::N3_WL::f1_WL

+

N1::N3_WL::f1_WL

This function should extracted because the namespace N1::N3_WL is included as a literal. @@ -152,7 +152,7 @@

Synopsis

-

N1::N4

+

N1::N4

This namespace should extracted because it's implied by N1::N4::f1_WL @@ -175,7 +175,7 @@

Functions

-

N1::N4::f1_WL

+

N1::N4::f1_WL

This function should extracted because it matches N1::N4::f1_WL @@ -195,7 +195,7 @@

Synopsis

-

N5

+

N5

This namespace should extracted because it's implied by N5::N6::*7 @@ -218,7 +218,7 @@

Namespaces

-

N5::N6

+

N5::N6

This namespace should extracted because it's implied by N5::N6::*7 @@ -242,7 +242,7 @@

Namespaces

-

N5::N6::M7

+

N5::N6::M7

This namespace should be included because it matches N5::N6::*7 @@ -265,7 +265,7 @@

Functions

-

N5::N6::M7::f2_WL

+

N5::N6::M7::f2_WL

This function should be included because it's a member of M7, which matches N5::N6::*7 @@ -285,7 +285,7 @@

Synopsis

-

N5::N6::N7

+

N5::N6::N7

This namespace should be included because it matches N5::N6::*7 @@ -308,7 +308,7 @@

Functions

-

N5::N6::N7::f2_WL

+

N5::N6::N7::f2_WL

This function should be included because it's a member of N7, which matches N5::N6::*7 @@ -328,7 +328,7 @@

Synopsis

-

C

+

C

This namespace should be included because it strictly matches C @@ -377,7 +377,7 @@

Member Functions

-

C::D

+

C::D

This struct should be included because it's a member of C @@ -412,7 +412,7 @@

Member Functions

-

C::D::f1_WL

+

C::D::f1_WL

This function should be included because it's a member of D @@ -432,7 +432,7 @@

Synopsis

-

C::f0_WL

+

C::f0_WL

This function should be included because it's a member of C diff --git a/test-files/golden-tests/filters/symbol-type/nested-private-template.html b/test-files/golden-tests/filters/symbol-type/nested-private-template.html index 85405ef6c..e5de5fe34 100644 --- a/test-files/golden-tests/filters/symbol-type/nested-private-template.html +++ b/test-files/golden-tests/filters/symbol-type/nested-private-template.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -25,7 +25,7 @@

Types

-

range

+

range

Synopsis

@@ -57,7 +57,7 @@

Private Types

-

range::impl

+

range::impl

Synopsis

@@ -77,7 +77,7 @@

Synopsis

-

range::impl<R, false>

+

range::impl<R, false>

Synopsis

diff --git a/test-files/golden-tests/javadoc/brief/brief-1.html b/test-files/golden-tests/javadoc/brief/brief-1.html index 7305d4783..0b14485e0 100644 --- a/test-files/golden-tests/javadoc/brief/brief-1.html +++ b/test-files/golden-tests/javadoc/brief/brief-1.html @@ -7,7 +7,7 @@

Reference

-

+

Functions

@@ -27,7 +27,7 @@

Functions

-

f5

+

f5

brief bold it continues to the line. @@ -47,7 +47,7 @@

Synopsis

-

f6

+

f6

brief diff --git a/test-files/golden-tests/javadoc/brief/brief-2.html b/test-files/golden-tests/javadoc/brief/brief-2.html index e3771c03d..07c8b1579 100644 --- a/test-files/golden-tests/javadoc/brief/brief-2.html +++ b/test-files/golden-tests/javadoc/brief/brief-2.html @@ -7,7 +7,7 @@

Reference

-

+

Functions

@@ -31,7 +31,7 @@

Functions

-

f1

+

f1

brief @@ -51,7 +51,7 @@

Synopsis

-

f2

+

f2

brief @@ -71,7 +71,7 @@

Synopsis

-

f3

+

f3

brief @@ -91,7 +91,7 @@

Synopsis

-

f4

+

f4

brief x @@ -115,7 +115,7 @@

Description

-

f5

+

f5

brief @@ -135,7 +135,7 @@

Synopsis

-

f6

+

f6

brief diff --git a/test-files/golden-tests/javadoc/brief/brief-3.html b/test-files/golden-tests/javadoc/brief/brief-3.html index e0447c8d7..009ac67db 100644 --- a/test-files/golden-tests/javadoc/brief/brief-3.html +++ b/test-files/golden-tests/javadoc/brief/brief-3.html @@ -7,7 +7,7 @@

Reference

-

+

Functions

@@ -26,7 +26,7 @@

Functions

-

f

+

f

f overloads @@ -73,7 +73,7 @@

Synopses

-

f

+

f

Integer overload. @@ -97,7 +97,7 @@

Description

-

f

+

f

Integer overload. @@ -117,7 +117,7 @@

Synopsis

-

f

+

f

C string overload. @@ -141,7 +141,7 @@

Description

-

f

+

f

C string overload. diff --git a/test-files/golden-tests/javadoc/brief/brief-4.html b/test-files/golden-tests/javadoc/brief/brief-4.html index b348da779..d92240515 100644 --- a/test-files/golden-tests/javadoc/brief/brief-4.html +++ b/test-files/golden-tests/javadoc/brief/brief-4.html @@ -7,7 +7,7 @@

Reference

-

+

Functions

@@ -28,7 +28,7 @@

Functions

-

f0

+

f0

Synopsis

@@ -44,7 +44,7 @@

Synopsis

-

f1

+

f1

Synopsis

@@ -60,7 +60,7 @@

Synopsis

-

f2

+

f2

Synopsis

@@ -76,7 +76,7 @@

Synopsis

-

f3

+

f3

Synopsis

diff --git a/test-files/golden-tests/javadoc/brief/brief-5.html b/test-files/golden-tests/javadoc/brief/brief-5.html index b107cdcc1..2020cff37 100644 --- a/test-files/golden-tests/javadoc/brief/brief-5.html +++ b/test-files/golden-tests/javadoc/brief/brief-5.html @@ -7,7 +7,7 @@

Reference

-

+

Functions

@@ -31,7 +31,7 @@

Functions

-

f0

+

f0

brief @@ -51,7 +51,7 @@

Synopsis

-

f1

+

f1

Synopsis

@@ -67,7 +67,7 @@

Synopsis

-

f2

+

f2

Synopsis

@@ -83,7 +83,7 @@

Synopsis

-

f3

+

f3

brief @@ -103,7 +103,7 @@

Synopsis

-

f4

+

f4

brief @@ -123,7 +123,7 @@

Synopsis

-

f5

+

f5

brief diff --git a/test-files/golden-tests/javadoc/brief/brief-6.html b/test-files/golden-tests/javadoc/brief/brief-6.html index cc163be7f..76f44e7bf 100644 --- a/test-files/golden-tests/javadoc/brief/brief-6.html +++ b/test-files/golden-tests/javadoc/brief/brief-6.html @@ -7,7 +7,7 @@

Reference

-

+

Functions

@@ -26,7 +26,7 @@

Functions

-

f0

+

f0

brief diff --git a/test-files/golden-tests/javadoc/code/code.html b/test-files/golden-tests/javadoc/code/code.html index c01d80ae4..351de615c 100644 --- a/test-files/golden-tests/javadoc/code/code.html +++ b/test-files/golden-tests/javadoc/code/code.html @@ -7,7 +7,7 @@

Reference

-

+

Functions

@@ -26,7 +26,7 @@

Functions

-

f

+

f

brief diff --git a/test-files/golden-tests/javadoc/copybrief/copybrief.html b/test-files/golden-tests/javadoc/copybrief/copybrief.html index a39ed9c94..fedbf564a 100644 --- a/test-files/golden-tests/javadoc/copybrief/copybrief.html +++ b/test-files/golden-tests/javadoc/copybrief/copybrief.html @@ -7,7 +7,7 @@

Reference

-

+

Functions

@@ -28,7 +28,7 @@

Functions

-

f1

+

f1

brief1 @@ -48,7 +48,7 @@

Synopsis

-

f2

+

f2

brief1 @@ -68,7 +68,7 @@

Synopsis

-

f3

+

f3

brief1 diff --git a/test-files/golden-tests/javadoc/copydetails/copydetails.html b/test-files/golden-tests/javadoc/copydetails/copydetails.html index f2d2eb176..6cc9d5da8 100644 --- a/test-files/golden-tests/javadoc/copydetails/copydetails.html +++ b/test-files/golden-tests/javadoc/copydetails/copydetails.html @@ -7,7 +7,7 @@

Reference

-

+

Functions

@@ -28,7 +28,7 @@

Functions

-

dest

+

dest

Destination doc function @@ -121,7 +121,7 @@

See Also

-

destOverride

+

destOverride

Destination doc function @@ -242,7 +242,7 @@

See Also

-

source

+

source

Source doc function diff --git a/test-files/golden-tests/javadoc/copydoc/conversion.html b/test-files/golden-tests/javadoc/copydoc/conversion.html index 5850bb2f0..77aba528e 100644 --- a/test-files/golden-tests/javadoc/copydoc/conversion.html +++ b/test-files/golden-tests/javadoc/copydoc/conversion.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -27,7 +27,7 @@

Types

-

A

+

A

Synopsis

@@ -60,7 +60,7 @@

Member Functions

-

A::operator=

+

A::operator=

Convert a string to A @@ -112,7 +112,7 @@

Parameters

-

A::operator=

+

A::operator=

Convert a string to A @@ -153,7 +153,7 @@

Parameters

-

A::operator=

+

A::operator=

Convert a string to A @@ -194,7 +194,7 @@

Parameters

-

A::operator string_type

+

A::operator string_type

Convert A to a string @@ -217,7 +217,7 @@

Return Value

-

A::operator string_view_type

+

A::operator string_view_type

Convert A to a string @@ -240,7 +240,7 @@

Return Value

-

string_type

+

string_type

Synopsis

@@ -257,7 +257,7 @@

Synopsis

-

string_view_type

+

string_view_type

Synopsis

diff --git a/test-files/golden-tests/javadoc/copydoc/decay-params.html b/test-files/golden-tests/javadoc/copydoc/decay-params.html index 1527d8f91..4cd0cb61c 100644 --- a/test-files/golden-tests/javadoc/copydoc/decay-params.html +++ b/test-files/golden-tests/javadoc/copydoc/decay-params.html @@ -7,7 +7,7 @@

Reference

-

+

Functions

@@ -27,7 +27,7 @@

Functions

-

bar

+

bar

Brief from foo() @@ -73,7 +73,7 @@

Parameters

-

foo

+

foo

foo overloads @@ -134,7 +134,7 @@

Parameters

-

foo

+

foo

We should not copy this doc @@ -158,7 +158,7 @@

Description

-

foo

+

foo

We should not copy this doc @@ -199,7 +199,7 @@

Parameters

-

foo

+

foo

Brief from foo() diff --git a/test-files/golden-tests/javadoc/copydoc/fundamental.html b/test-files/golden-tests/javadoc/copydoc/fundamental.html index 8cd3583fe..73b03a9af 100644 --- a/test-files/golden-tests/javadoc/copydoc/fundamental.html +++ b/test-files/golden-tests/javadoc/copydoc/fundamental.html @@ -7,7 +7,7 @@

Reference

-

+

Functions

@@ -28,7 +28,7 @@

Functions

-

f

+

f

f overloads @@ -76,7 +76,7 @@

Parameters

-

f

+

f

Fail @@ -113,7 +113,7 @@

Parameters

-

f

+

f

Brief @@ -154,7 +154,7 @@

Parameters

-

g

+

g

Brief @@ -195,7 +195,7 @@

Parameters

-

h

+

h

Brief diff --git a/test-files/golden-tests/javadoc/copydoc/no-param.html b/test-files/golden-tests/javadoc/copydoc/no-param.html index cba11cdda..3151a787f 100644 --- a/test-files/golden-tests/javadoc/copydoc/no-param.html +++ b/test-files/golden-tests/javadoc/copydoc/no-param.html @@ -7,7 +7,7 @@

Reference

-

+

Functions

@@ -28,7 +28,7 @@

Functions

-

copyFromNoParam

+

copyFromNoParam

Brief from foo() @@ -58,7 +58,7 @@

Return Value

-

copyfromOverloads

+

copyfromOverloads

Brief from foo() @@ -87,7 +87,7 @@

Return Value

-

foo

+

foo

Brief from foo() @@ -141,7 +141,7 @@

Parameters

-

foo

+

foo

Brief from foo() @@ -170,7 +170,7 @@

Return Value

-

foo

+

foo

Brief from foo() diff --git a/test-files/golden-tests/javadoc/copydoc/operator-param.html b/test-files/golden-tests/javadoc/copydoc/operator-param.html index 69beb6df7..62c5ec86b 100644 --- a/test-files/golden-tests/javadoc/copydoc/operator-param.html +++ b/test-files/golden-tests/javadoc/copydoc/operator-param.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -25,7 +25,7 @@

Types

-

A

+

A

Synopsis

@@ -56,7 +56,7 @@

Member Functions

-

A::operator()

+

A::operator()

Return true if ch is in the character set. @@ -110,7 +110,7 @@

Parameters

-

A::operator()

+

A::operator()

Return true if ch is in the character set. @@ -156,7 +156,7 @@

Parameters

-

A::operator()

+

A::operator()

Return true if ch is in the character set. diff --git a/test-files/golden-tests/javadoc/copydoc/param-types.html b/test-files/golden-tests/javadoc/copydoc/param-types.html index d9c0037c5..66e84ee33 100644 --- a/test-files/golden-tests/javadoc/copydoc/param-types.html +++ b/test-files/golden-tests/javadoc/copydoc/param-types.html @@ -7,7 +7,7 @@

Reference

-

+

Namespaces

@@ -70,7 +70,7 @@

Functions

-

N

+

N

Namespace to test qualified identifier parameters. @@ -93,7 +93,7 @@

Namespaces

-

N::M

+

N::M

Namespace to test qualified identifier parameters. @@ -116,7 +116,7 @@

Types

-

N::M::Q

+

N::M::Q

Struct to test qualified identifier parameters. @@ -151,7 +151,7 @@

Non-Member Functions

-

A

+

A

Struct to test explicit object member functions. @@ -201,7 +201,7 @@

Non-Member Functions

-

A::f

+

A::f

Reference member function. @@ -243,7 +243,7 @@

Parameters

-

A::g

+

A::g

Reference member function. @@ -290,7 +290,7 @@

Parameters

-

paramType

+

paramType

Struct used to vary the parameter type. @@ -334,7 +334,7 @@

Non-Member Functions

-

testEnum

+

testEnum

Synopsis

@@ -347,19 +347,6 @@

Synopsis

-

Members

-
- - - - - - - - -
NameDescription
-
-

Non-Member Functions

@@ -376,7 +363,7 @@

Non-Member Functions

-

f

+

f

f overloads @@ -488,7 +475,7 @@

Parameters

-

f

+

f

Reference function. @@ -512,7 +499,7 @@

Description

-

f

+

f

Reference function. @@ -554,7 +541,7 @@

Parameters

-

f

+

f

Reference function. @@ -596,7 +583,7 @@

Parameters

-

f

+

f

Variadic function @@ -638,7 +625,7 @@

Parameters

-

f

+

f

Non-variadic function @@ -680,7 +667,7 @@

Parameters

-

f

+

f

struct param function @@ -722,7 +709,7 @@

Parameters

-

f

+

f

Decltype function @@ -764,7 +751,7 @@

Parameters

-

f

+

f

struct param function @@ -806,7 +793,7 @@

Parameters

-

f

+

f

Enum param function @@ -848,7 +835,7 @@

Parameters

-

f

+

f

Qualified identifier param function @@ -890,7 +877,7 @@

Parameters

-

g

+

g

g overloads @@ -984,7 +971,7 @@

Parameters

-

g

+

g

struct param function @@ -1025,7 +1012,7 @@

Parameters

-

g

+

g

Qualified identifier param function @@ -1066,7 +1053,7 @@

Parameters

-

g

+

g

Auto function @@ -1107,7 +1094,7 @@

Parameters

-

g

+

g

Enum param function @@ -1148,7 +1135,7 @@

Parameters

-

g

+

g

Variadic function @@ -1189,7 +1176,7 @@

Parameters

-

g

+

g

Non-variadic function @@ -1230,7 +1217,7 @@

Parameters

-

g

+

g

Decltype function diff --git a/test-files/golden-tests/javadoc/copydoc/qualified.html b/test-files/golden-tests/javadoc/copydoc/qualified.html index 9765eeece..32607e767 100644 --- a/test-files/golden-tests/javadoc/copydoc/qualified.html +++ b/test-files/golden-tests/javadoc/copydoc/qualified.html @@ -7,7 +7,7 @@

Reference

-

+

Namespaces

@@ -39,7 +39,7 @@

Types

-

N

+

N

Types

@@ -57,7 +57,7 @@

Types

-

N::A

+

N::A

Synopsis

@@ -103,7 +103,7 @@

Member Functions

-

N::A::B

+

N::A::B

Synopsis

@@ -120,7 +120,7 @@

Synopsis

-

N::A::f

+

N::A::f

Reference function @@ -216,7 +216,7 @@

Parameters

-

N::A::f

+

N::A::f

Reference function @@ -257,7 +257,7 @@

Parameters

-

N::A::f

+

N::A::f

Reference function @@ -298,7 +298,7 @@

Parameters

-

N::A::f

+

N::A::f

Reference function @@ -339,7 +339,7 @@

Parameters

-

N::A::f

+

N::A::f

Reference function @@ -380,7 +380,7 @@

Parameters

-

N::A::f

+

N::A::f

Reference function @@ -421,7 +421,7 @@

Parameters

-

N::A::f

+

N::A::f

Reference function @@ -462,7 +462,7 @@

Parameters

-

N::A::f

+

N::A::f

Reference function @@ -503,7 +503,7 @@

Parameters

-

N::A::f

+

N::A::f

Reference function @@ -544,7 +544,7 @@

Parameters

-

N::A::g

+

N::A::g

g overloads @@ -592,7 +592,7 @@

Parameters

-

N::A::g

+

N::A::g

Reference function @@ -633,7 +633,7 @@

Parameters

-

N::A::g

+

N::A::g

Fail @@ -674,7 +674,7 @@

Parameters

-

N::A::h

+

N::A::h

h overloads @@ -722,7 +722,7 @@

Parameters

-

N::A::h

+

N::A::h

Reference function @@ -763,7 +763,7 @@

Parameters

-

N::A::h

+

N::A::h

Fail @@ -804,7 +804,7 @@

Parameters

-

param_t

+

param_t

Helper class for distinct parameter types diff --git a/test-files/golden-tests/javadoc/copydoc/qualifiers.html b/test-files/golden-tests/javadoc/copydoc/qualifiers.html index 61a628437..0f2a7feb7 100644 --- a/test-files/golden-tests/javadoc/copydoc/qualifiers.html +++ b/test-files/golden-tests/javadoc/copydoc/qualifiers.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -25,7 +25,7 @@

Types

-

A

+

A

Synopsis

@@ -74,7 +74,7 @@

Member Functions

-

A::const_iterator

+

A::const_iterator

Synopsis

@@ -91,7 +91,7 @@

Synopsis

-

A::iterator

+

A::iterator

Synopsis

@@ -108,7 +108,7 @@

Synopsis

-

A::begin

+

A::begin

begin overloads @@ -146,7 +146,7 @@

Return Value

-

A::begin

+

A::begin

Returns an iterator to the beginning @@ -174,7 +174,7 @@

Return Value

-

A::begin

+

A::begin

Return a const iterator to the beginning @@ -202,7 +202,7 @@

Return Value

-

A::cbegin

+

A::cbegin

Return a const iterator to the beginning @@ -230,7 +230,7 @@

Return Value

-

A::crvalue

+

A::crvalue

An const rvalue reference to A @@ -254,7 +254,7 @@

Return Value

-

A::ref

+

A::ref

ref overloads @@ -305,7 +305,7 @@

Return Value

-

A::ref

+

A::ref

An lvalue reference to A @@ -329,7 +329,7 @@

Return Value

-

A::ref

+

A::ref

An rvalue reference to A @@ -353,7 +353,7 @@

Return Value

-

A::ref

+

A::ref

An const lvalue reference to A @@ -377,7 +377,7 @@

Return Value

-

A::ref

+

A::ref

An const rvalue reference to A @@ -401,7 +401,7 @@

Return Value

-

A::rvalue

+

A::rvalue

An rvalue reference to A diff --git a/test-files/golden-tests/javadoc/copydoc/template-arguments.html b/test-files/golden-tests/javadoc/copydoc/template-arguments.html index 8cf977bff..c83844de5 100644 --- a/test-files/golden-tests/javadoc/copydoc/template-arguments.html +++ b/test-files/golden-tests/javadoc/copydoc/template-arguments.html @@ -7,7 +7,7 @@

Reference

-

+

Namespaces

@@ -25,7 +25,7 @@

Namespaces

-

A

+

A

Types

@@ -56,7 +56,7 @@

Types

-

A::BInt

+

A::BInt

Specialization of B for int. @@ -75,7 +75,7 @@

Synopsis

-

A::BInt2

+

A::BInt2

Specialization of B for int with value 2. @@ -94,7 +94,7 @@

Synopsis

-

A::B_t

+

A::B_t

Main class template for B. @@ -133,7 +133,7 @@

Template Parameters

-

A::CDTrue

+

A::CDTrue

Specialization of C for D with true. @@ -152,7 +152,7 @@

Synopsis

-

A::CIntTrue

+

A::CIntTrue

Specialization of C for D with true. @@ -171,7 +171,7 @@

Synopsis

-

A::C_t

+

A::C_t

Main class template for C. @@ -210,7 +210,7 @@

Template Parameters

-

A::B

+

A::B

Main class template for B. @@ -255,7 +255,7 @@

Template Parameters

-

A::B<int>

+

A::B<int>

Specialization of B for int. @@ -277,7 +277,7 @@

Synopsis

-

A::B<int, 2>

+

A::B<int, 2>

Specialization of B for int with value 2. @@ -299,7 +299,7 @@

Synopsis

-

A::C

+

A::C

Main class template for C. @@ -344,7 +344,7 @@

Template Parameters

-

A::C<D, true>

+

A::C<D, true>

Specialization of C for D with true. @@ -366,7 +366,7 @@

Synopsis

-

A::C<int, true>

+

A::C<int, true>

Specialization of C for int with true. @@ -388,7 +388,7 @@

Synopsis

-

A::D

+

A::D

Helper struct D. diff --git a/test-files/golden-tests/javadoc/inline/styled.html b/test-files/golden-tests/javadoc/inline/styled.html index 28502eee5..0a91b8585 100644 --- a/test-files/golden-tests/javadoc/inline/styled.html +++ b/test-files/golden-tests/javadoc/inline/styled.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -26,7 +26,7 @@

Types

-

A

+

A

Brief for A @@ -66,7 +66,7 @@

Description

-

A::compare

+

A::compare

Compare function diff --git a/test-files/golden-tests/javadoc/link/link.html b/test-files/golden-tests/javadoc/link/link.html index 091056aca..d639a73a7 100644 --- a/test-files/golden-tests/javadoc/link/link.html +++ b/test-files/golden-tests/javadoc/link/link.html @@ -7,7 +7,7 @@

Reference

-

+

Functions

@@ -26,7 +26,7 @@

Functions

-

f

+

f

A function with a link diff --git a/test-files/golden-tests/javadoc/lists/li.html b/test-files/golden-tests/javadoc/lists/li.html index db9c61ae9..99eba04f3 100644 --- a/test-files/golden-tests/javadoc/lists/li.html +++ b/test-files/golden-tests/javadoc/lists/li.html @@ -7,7 +7,7 @@

Reference

-

+

Functions

@@ -26,7 +26,7 @@

Functions

-

f

+

f

A function diff --git a/test-files/golden-tests/javadoc/lists/listitem.html b/test-files/golden-tests/javadoc/lists/listitem.html index 8ffb85609..b559e68dd 100644 --- a/test-files/golden-tests/javadoc/lists/listitem.html +++ b/test-files/golden-tests/javadoc/lists/listitem.html @@ -7,7 +7,7 @@

Reference

-

+

Functions

@@ -29,7 +29,7 @@

Functions

-

f0

+

f0

Synopsis

@@ -51,7 +51,7 @@

Description

-

f1

+

f1

Synopsis

@@ -74,7 +74,7 @@

Description

-

f2

+

f2

brief @@ -101,7 +101,7 @@

Description

-

f3

+

f3

brief diff --git a/test-files/golden-tests/javadoc/paragraph/par-1.html b/test-files/golden-tests/javadoc/paragraph/par-1.html index 04f98ed43..fef4b8892 100644 --- a/test-files/golden-tests/javadoc/paragraph/par-1.html +++ b/test-files/golden-tests/javadoc/paragraph/par-1.html @@ -7,7 +7,7 @@

Reference

-

+

Functions

@@ -29,7 +29,7 @@

Functions

-

f1

+

f1

Brief @@ -57,7 +57,7 @@

Custom par

-

f2

+

f2

Brief @@ -85,7 +85,7 @@

Custom par

-

f3

+

f3

Brief @@ -112,7 +112,7 @@

Custom par

-

f4

+

f4

Brief diff --git a/test-files/golden-tests/javadoc/paragraph/para-1.html b/test-files/golden-tests/javadoc/paragraph/para-1.html index 2b892b712..55e6b1514 100644 --- a/test-files/golden-tests/javadoc/paragraph/para-1.html +++ b/test-files/golden-tests/javadoc/paragraph/para-1.html @@ -7,7 +7,7 @@

Reference

-

+

Functions

@@ -29,7 +29,7 @@

Functions

-

f1

+

f1

Synopsis

@@ -45,7 +45,7 @@

Synopsis

-

f2

+

f2

Synopsis

@@ -61,7 +61,7 @@

Synopsis

-

f3

+

f3

Synopsis

@@ -77,7 +77,7 @@

Synopsis

-

f4

+

f4

brief diff --git a/test-files/golden-tests/javadoc/paragraph/para-2.html b/test-files/golden-tests/javadoc/paragraph/para-2.html index 33e5bfdfa..1f8acbc3e 100644 --- a/test-files/golden-tests/javadoc/paragraph/para-2.html +++ b/test-files/golden-tests/javadoc/paragraph/para-2.html @@ -7,7 +7,7 @@

Reference

-

+

Functions

@@ -26,7 +26,7 @@

Functions

-

f1

+

f1

brief diff --git a/test-files/golden-tests/javadoc/paragraph/para-3.html b/test-files/golden-tests/javadoc/paragraph/para-3.html index 25e78bbce..be604e693 100644 --- a/test-files/golden-tests/javadoc/paragraph/para-3.html +++ b/test-files/golden-tests/javadoc/paragraph/para-3.html @@ -7,7 +7,7 @@

Reference

-

+

Functions

@@ -26,7 +26,7 @@

Functions

-

my_function

+

my_function

A function diff --git a/test-files/golden-tests/javadoc/param/param-1.html b/test-files/golden-tests/javadoc/param/param-1.html index 9e31acd50..38e59035d 100644 --- a/test-files/golden-tests/javadoc/param/param-1.html +++ b/test-files/golden-tests/javadoc/param/param-1.html @@ -7,7 +7,7 @@

Reference

-

+

Functions

@@ -30,7 +30,7 @@

Functions

-

f0

+

f0

Synopsis

@@ -63,7 +63,7 @@

Parameters

-

f1

+

f1

Synopsis

@@ -96,7 +96,7 @@

Parameters

-

f2

+

f2

Synopsis

@@ -129,7 +129,7 @@

Parameters

-

f3

+

f3

Synopsis

@@ -162,7 +162,7 @@

Parameters

-

f4

+

f4

Synopsis

diff --git a/test-files/golden-tests/javadoc/param/param-direction.html b/test-files/golden-tests/javadoc/param/param-direction.html index 6aa33ac94..32b08d7ed 100644 --- a/test-files/golden-tests/javadoc/param/param-direction.html +++ b/test-files/golden-tests/javadoc/param/param-direction.html @@ -7,7 +7,7 @@

Reference

-

+

Functions

@@ -35,7 +35,7 @@

Functions

-

f

+

f

Synopsis

@@ -68,7 +68,7 @@

Parameters

-

g

+

g

Synopsis

@@ -107,7 +107,7 @@

Parameters

-

h

+

h

Synopsis

@@ -146,7 +146,7 @@

Parameters

-

i

+

i

Synopsis

@@ -185,7 +185,7 @@

Parameters

-

j

+

j

Synopsis

@@ -224,7 +224,7 @@

Parameters

-

k

+

k

Synopsis

@@ -268,7 +268,7 @@

Parameters

-

l

+

l

Synopsis

@@ -313,7 +313,7 @@

Parameters

-

m

+

m

Synopsis

@@ -352,7 +352,7 @@

Parameters

-

n

+

n

Synopsis

@@ -385,7 +385,7 @@

Parameters

-

o

+

o

Synopsis

diff --git a/test-files/golden-tests/javadoc/param/param-duplicate.html b/test-files/golden-tests/javadoc/param/param-duplicate.html index 2b42b5652..e8079c271 100644 --- a/test-files/golden-tests/javadoc/param/param-duplicate.html +++ b/test-files/golden-tests/javadoc/param/param-duplicate.html @@ -7,7 +7,7 @@

Reference

-

+

Functions

@@ -31,7 +31,7 @@

Functions

-

f0

+

f0

f0 brief @@ -58,7 +58,7 @@

Return Value

-

f1

+

f1

f1 brief @@ -85,7 +85,7 @@

Return Value

-

g0

+

g0

g0 brief @@ -126,7 +126,7 @@

Parameters

-

g1

+

g1

g1 brief @@ -167,7 +167,7 @@

Parameters

-

h0

+

h0

h0 brief @@ -209,7 +209,7 @@

Template Parameters

-

h1

+

h1

h1 brief diff --git a/test-files/golden-tests/javadoc/param/param.html b/test-files/golden-tests/javadoc/param/param.html index 81593d299..018cc9243 100644 --- a/test-files/golden-tests/javadoc/param/param.html +++ b/test-files/golden-tests/javadoc/param/param.html @@ -7,7 +7,7 @@

Reference

-

+

Functions

@@ -29,7 +29,7 @@

Functions

-

f

+

f

Synopsis

@@ -62,7 +62,7 @@

Parameters

-

g

+

g

Synopsis

@@ -101,7 +101,7 @@

Parameters

-

h

+

h

Synopsis

@@ -145,7 +145,7 @@

Parameters

-

i

+

i

Synopsis

diff --git a/test-files/golden-tests/javadoc/pre/pre-post.html b/test-files/golden-tests/javadoc/pre/pre-post.html index cf50c0e88..b54fa0958 100644 --- a/test-files/golden-tests/javadoc/pre/pre-post.html +++ b/test-files/golden-tests/javadoc/pre/pre-post.html @@ -7,7 +7,7 @@

Reference

-

+

Functions

@@ -26,7 +26,7 @@

Functions

-

f

+

f

Synopsis

diff --git a/test-files/golden-tests/javadoc/ref/broken-ref.html b/test-files/golden-tests/javadoc/ref/broken-ref.html index 78a8ea85a..9e98684a5 100644 --- a/test-files/golden-tests/javadoc/ref/broken-ref.html +++ b/test-files/golden-tests/javadoc/ref/broken-ref.html @@ -7,7 +7,7 @@

Reference

-

+

Functions

@@ -27,7 +27,7 @@

Functions

-

f0

+

f0

Synopsis

@@ -43,7 +43,7 @@

Synopsis

-

f1

+

f1

See f0 diff --git a/test-files/golden-tests/javadoc/ref/punctuation.html b/test-files/golden-tests/javadoc/ref/punctuation.html index 962c4314c..ea20b9166 100644 --- a/test-files/golden-tests/javadoc/ref/punctuation.html +++ b/test-files/golden-tests/javadoc/ref/punctuation.html @@ -7,7 +7,7 @@

Reference

-

+

Functions

@@ -28,7 +28,7 @@

Functions

-

f0

+

f0

Synopsis

@@ -44,7 +44,7 @@

Synopsis

-

f1

+

f1

Synopsis

@@ -60,7 +60,7 @@

Synopsis

-

f2

+

f2

See f0, f1. diff --git a/test-files/golden-tests/javadoc/ref/ref.html b/test-files/golden-tests/javadoc/ref/ref.html index 115aefdcf..11b42ac3a 100644 --- a/test-files/golden-tests/javadoc/ref/ref.html +++ b/test-files/golden-tests/javadoc/ref/ref.html @@ -7,7 +7,7 @@

Reference

-

+

Namespaces

@@ -54,7 +54,7 @@

Functions

-

A

+

A

Types

@@ -89,7 +89,7 @@

Functions

-

A::B

+

A::B

See f1 @@ -129,7 +129,7 @@

Description

-

A::B::f2

+

A::B::f2

Synopsis

@@ -145,7 +145,7 @@

Synopsis

-

A::C

+

A::C

Synopsis

@@ -191,7 +191,7 @@

Derived Classes

-

A::C::f3

+

A::C::f3

Synopsis

@@ -207,7 +207,7 @@

Synopsis

-

A::C::f4

+

A::C::f4

Synopsis

@@ -223,7 +223,7 @@

Synopsis

-

A::D

+

A::D

Synopsis

@@ -283,7 +283,7 @@

Member Functions

-

A::D::E

+

A::D::E

See f3 @@ -309,7 +309,7 @@

Description

-

A::D::f4

+

A::D::f4

Synopsis

@@ -325,7 +325,7 @@

Synopsis

-

A::f1

+

A::f1

See f0 @@ -349,7 +349,7 @@

Description

-

F

+

F

Synopsis

@@ -417,7 +417,7 @@

Member Functions

-

F::operator=

+

F::operator=

Synopsis

@@ -433,7 +433,7 @@

Synopsis

-

F::operator%

+

F::operator%

Synopsis

@@ -449,7 +449,7 @@

Synopsis

-

F::operator%=

+

F::operator%=

Synopsis

@@ -465,7 +465,7 @@

Synopsis

-

F::operator&

+

F::operator&

Synopsis

@@ -481,7 +481,7 @@

Synopsis

-

F::operator&&

+

F::operator&&

Synopsis

@@ -497,7 +497,7 @@

Synopsis

-

F::operator&=

+

F::operator&=

Synopsis

@@ -513,7 +513,7 @@

Synopsis

-

F::operator()

+

F::operator()

Synopsis

@@ -529,7 +529,7 @@

Synopsis

-

F::operator*

+

F::operator*

Synopsis

@@ -545,7 +545,7 @@

Synopsis

-

F::operator*=

+

F::operator*=

Synopsis

@@ -561,7 +561,7 @@

Synopsis

-

F::operator+

+

F::operator+

Synopsis

@@ -577,7 +577,7 @@

Synopsis

-

F::operator++

+

F::operator++

Synopsis

@@ -593,7 +593,7 @@

Synopsis

-

F::operator+=

+

F::operator+=

Synopsis

@@ -609,7 +609,7 @@

Synopsis

-

F::operator,

+

F::operator,

Synopsis

@@ -625,7 +625,7 @@

Synopsis

-

F::operator-

+

F::operator-

Synopsis

@@ -641,7 +641,7 @@

Synopsis

-

F::operator--

+

F::operator--

Synopsis

@@ -657,7 +657,7 @@

Synopsis

-

F::operator-=

+

F::operator-=

Synopsis

@@ -673,7 +673,7 @@

Synopsis

-

F::operator->

+

F::operator->

Synopsis

@@ -689,7 +689,7 @@

Synopsis

-

F::operator->*

+

F::operator->*

Synopsis

@@ -705,7 +705,7 @@

Synopsis

-

F::operator/

+

F::operator/

Synopsis

@@ -721,7 +721,7 @@

Synopsis

-

F::operator/=

+

F::operator/=

Synopsis

@@ -737,7 +737,7 @@

Synopsis

-

F::operator<<=

+

F::operator<<=

Synopsis

@@ -753,7 +753,7 @@

Synopsis

-

F::operator>>

+

F::operator>>

Synopsis

@@ -769,7 +769,7 @@

Synopsis

-

F::operator>>=

+

F::operator>>=

Synopsis

@@ -785,7 +785,7 @@

Synopsis

-

F::operator[]

+

F::operator[]

Synopsis

@@ -801,7 +801,7 @@

Synopsis

-

F::operator^

+

F::operator^

Synopsis

@@ -817,7 +817,7 @@

Synopsis

-

F::operator^=

+

F::operator^=

Synopsis

@@ -833,7 +833,7 @@

Synopsis

-

F::operator|

+

F::operator|

Synopsis

@@ -849,7 +849,7 @@

Synopsis

-

F::operator|=

+

F::operator|=

Synopsis

@@ -865,7 +865,7 @@

Synopsis

-

F::operator||

+

F::operator||

Synopsis

@@ -881,7 +881,7 @@

Synopsis

-

F::operator~

+

F::operator~

Synopsis

@@ -897,7 +897,7 @@

Synopsis

-

F::operator<<

+

F::operator<<

Synopsis

@@ -913,7 +913,7 @@

Synopsis

-

F::operator!

+

F::operator!

Synopsis

@@ -929,7 +929,7 @@

Synopsis

-

F::operator==

+

F::operator==

Synopsis

@@ -945,7 +945,7 @@

Synopsis

-

F::operator!=

+

F::operator!=

Synopsis

@@ -961,7 +961,7 @@

Synopsis

-

F::operator<

+

F::operator<

Synopsis

@@ -977,7 +977,7 @@

Synopsis

-

F::operator<=

+

F::operator<=

Synopsis

@@ -993,7 +993,7 @@

Synopsis

-

F::operator>

+

F::operator>

Synopsis

@@ -1009,7 +1009,7 @@

Synopsis

-

F::operator>=

+

F::operator>=

Synopsis

@@ -1025,7 +1025,7 @@

Synopsis

-

F::operator<=>

+

F::operator<=>

Synopsis

@@ -1041,7 +1041,7 @@

Synopsis

-

f0

+

f0

Synopsis

@@ -1057,7 +1057,7 @@

Synopsis

-

f5

+

f5

See A::f1 @@ -1081,7 +1081,7 @@

Description

-

f6

+

f6

See F::operator~ diff --git a/test-files/golden-tests/javadoc/relates/relates.html b/test-files/golden-tests/javadoc/relates/relates.html index fde26b533..5477de080 100644 --- a/test-files/golden-tests/javadoc/relates/relates.html +++ b/test-files/golden-tests/javadoc/relates/relates.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -41,7 +41,7 @@

Functions

-

A

+

A

A brief for A. @@ -76,7 +76,7 @@

Non-Member Functions

-

B

+

B

A brief for B @@ -97,7 +97,7 @@

Synopsis

-

f

+

f

A brief for f. diff --git a/test-files/golden-tests/javadoc/returns/returns.html b/test-files/golden-tests/javadoc/returns/returns.html index a10ab94df..3e04fbaf3 100644 --- a/test-files/golden-tests/javadoc/returns/returns.html +++ b/test-files/golden-tests/javadoc/returns/returns.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -41,7 +41,7 @@

Functions

-

pair

+

pair

Synopsis

@@ -89,7 +89,7 @@

Non-Member Functions

-

pair::first

+

pair::first

Synopsis

@@ -104,7 +104,7 @@

Synopsis

-

pair::second

+

pair::second

Synopsis

@@ -119,7 +119,7 @@

Synopsis

-

f

+

f

A function with a single return value. @@ -143,7 +143,7 @@

Return Value

-

g

+

g

A function with multiple return values. diff --git a/test-files/golden-tests/javadoc/throw/throw.html b/test-files/golden-tests/javadoc/throw/throw.html index acbcdf816..35d763f5e 100644 --- a/test-files/golden-tests/javadoc/throw/throw.html +++ b/test-files/golden-tests/javadoc/throw/throw.html @@ -7,7 +7,7 @@

Reference

-

+

Functions

@@ -26,7 +26,7 @@

Functions

-

f

+

f

brief diff --git a/test-files/golden-tests/javadoc/tparam/tparam-1.html b/test-files/golden-tests/javadoc/tparam/tparam-1.html index 6cdb746ac..a29cc323d 100644 --- a/test-files/golden-tests/javadoc/tparam/tparam-1.html +++ b/test-files/golden-tests/javadoc/tparam/tparam-1.html @@ -7,7 +7,7 @@

Reference

-

+

Functions

@@ -27,7 +27,7 @@

Functions

-

f0

+

f0

Synopsis

@@ -61,7 +61,7 @@

Template Parameters

-

f1

+

f1

brief diff --git a/test-files/golden-tests/output/canonical_1.html b/test-files/golden-tests/output/canonical_1.html index 487dcca0a..c5b115cc8 100644 --- a/test-files/golden-tests/output/canonical_1.html +++ b/test-files/golden-tests/output/canonical_1.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -32,7 +32,7 @@

Types

-

A

+

A

Synopsis

@@ -49,7 +49,7 @@

Synopsis

-

B

+

B

Synopsis

@@ -66,7 +66,7 @@

Synopsis

-

Ba

+

Ba

Synopsis

@@ -83,7 +83,7 @@

Synopsis

-

Bx

+

Bx

Synopsis

@@ -100,7 +100,7 @@

Synopsis

-

a

+

a

Synopsis

@@ -117,7 +117,7 @@

Synopsis

-

b

+

b

Synopsis

@@ -134,7 +134,7 @@

Synopsis

-

bA

+

bA

Synopsis

@@ -151,7 +151,7 @@

Synopsis

-

ba

+

ba

Synopsis

diff --git a/test-files/golden-tests/snippets/distance.html b/test-files/golden-tests/snippets/distance.html index 03711e3e1..01aeab45e 100644 --- a/test-files/golden-tests/snippets/distance.html +++ b/test-files/golden-tests/snippets/distance.html @@ -7,7 +7,7 @@

Reference

-

distance

+

distance

Return the distance between two points diff --git a/test-files/golden-tests/snippets/is_prime.html b/test-files/golden-tests/snippets/is_prime.html index 9953d6a86..ff9dc1172 100644 --- a/test-files/golden-tests/snippets/is_prime.html +++ b/test-files/golden-tests/snippets/is_prime.html @@ -7,7 +7,7 @@

Reference

-

is_prime

+

is_prime

Return true if a number is prime. diff --git a/test-files/golden-tests/snippets/sqrt.html b/test-files/golden-tests/snippets/sqrt.html index ef3f3bbe6..f1b40e706 100644 --- a/test-files/golden-tests/snippets/sqrt.html +++ b/test-files/golden-tests/snippets/sqrt.html @@ -7,7 +7,7 @@

Reference

-

sqrt

+

sqrt

Computes the square root of an integral value. diff --git a/test-files/golden-tests/snippets/terminate.html b/test-files/golden-tests/snippets/terminate.html index b96f942b5..35523ee81 100644 --- a/test-files/golden-tests/snippets/terminate.html +++ b/test-files/golden-tests/snippets/terminate.html @@ -7,7 +7,7 @@

Reference

-

terminate

+

terminate

Exit the program. diff --git a/test-files/golden-tests/symbols/concept/concept.html b/test-files/golden-tests/symbols/concept/concept.html index cc30d6c1e..8809d66f0 100644 --- a/test-files/golden-tests/symbols/concept/concept.html +++ b/test-files/golden-tests/symbols/concept/concept.html @@ -7,7 +7,7 @@

Reference

-

+

Functions

@@ -51,7 +51,7 @@

Concepts

-

f

+

f

Synopsis

@@ -68,7 +68,7 @@

Synopsis

-

x

+

x

Synopsis

@@ -83,7 +83,7 @@

Synopsis

-

C

+

C

Synopsis

diff --git a/test-files/golden-tests/symbols/concept/requires-clause.html b/test-files/golden-tests/symbols/concept/requires-clause.html index 51fb8055c..2e4b2b27b 100644 --- a/test-files/golden-tests/symbols/concept/requires-clause.html +++ b/test-files/golden-tests/symbols/concept/requires-clause.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -41,7 +41,7 @@

Functions

-

A

+

A

Synopsis

@@ -60,7 +60,7 @@

Synopsis

-

A

+

A

Synopsis

@@ -79,7 +79,7 @@

Synopsis

-

f

+

f

Synopsis

@@ -97,7 +97,7 @@

Synopsis

-

g

+

g

Synopses

@@ -138,7 +138,7 @@

Synopses

-

g

+

g

Synopsis

@@ -156,7 +156,7 @@

Synopsis

-

g

+

g

Synopsis

@@ -174,7 +174,7 @@

Synopsis

-

g

+

g

Synopsis

diff --git a/test-files/golden-tests/symbols/enum/enum.adoc b/test-files/golden-tests/symbols/enum/enum.adoc index e3afeb014..96972738b 100644 --- a/test-files/golden-tests/symbols/enum/enum.adoc +++ b/test-files/golden-tests/symbols/enum/enum.adoc @@ -36,15 +36,14 @@ enum E0; === Members - [cols=2] |=== | Name | Description -|`e0` -|e0 brief. -|`e1` -|e1 brief. +| `e0` +| e0 brief. +| `e1` +| e1 brief. |=== === Description @@ -65,15 +64,11 @@ enum E1 : char; === Members - -[cols=2] +[cols=1] |=== | Name -| Description -|`e2` -| -|`e3` -| +| `e2` +| `e3` |=== [#E2] @@ -92,15 +87,14 @@ enum class E2 : int; === Members - [cols=2] |=== | Name | Description -|`e4` -|e4 brief. -|`e5` -|e5 brief. +| `e4` +| e4 brief. +| `e5` +| e5 brief. |=== === Description @@ -121,15 +115,11 @@ enum class E3 : char; === Members - -[cols=2] +[cols=1] |=== | Name -| Description -|`e6` -| -|`e7` -| +| `e6` +| `e7` |=== diff --git a/test-files/golden-tests/symbols/enum/enum.html b/test-files/golden-tests/symbols/enum/enum.html index 014393e77..28da750e4 100644 --- a/test-files/golden-tests/symbols/enum/enum.html +++ b/test-files/golden-tests/symbols/enum/enum.html @@ -7,7 +7,7 @@

Reference

-

+

Enums

@@ -29,7 +29,7 @@

Enums

-

E0

+

E0

E0 brief. @@ -45,9 +45,8 @@

Synopsis

-
-

Members

-
+

Members

+
@@ -56,16 +55,11 @@

Members

- - - - - - - + +
Name
e0e0 brief.
e1e1 brief.
e0 e0 brief.
e1 e1 brief.
-
+

Description

E0 description.

@@ -73,7 +67,7 @@

Description

-

E1

+

E1

Synopsis

@@ -85,31 +79,24 @@

Synopsis

-
-

Members

- +

Members

+
- - - - - - - - + +
NameDescription
e2
e3
e2
e3
-
+
-

E2

+

E2

E2 brief. @@ -125,9 +112,8 @@

Synopsis

-
-

Members

- +

Members

+
@@ -136,16 +122,11 @@

Members

- - - - - - - + +
Name
e4e4 brief.
e5e5 brief.
e4 e4 brief.
e5 e5 brief.
-
+

Description

E2 description.

@@ -153,7 +134,7 @@

Description

-

E3

+

E3

Synopsis

@@ -165,27 +146,20 @@

Synopsis

-
-

Members

- +

Members

+
- - - - - - - - + +
NameDescription
e6
e7
e6
e7
-
+
diff --git a/test-files/golden-tests/symbols/function/attributes-2.html b/test-files/golden-tests/symbols/function/attributes-2.html index be20c3787..c510ae5a0 100644 --- a/test-files/golden-tests/symbols/function/attributes-2.html +++ b/test-files/golden-tests/symbols/function/attributes-2.html @@ -7,7 +7,7 @@

Reference

-

+

Functions

@@ -25,7 +25,7 @@

Functions

-

f

+

f

Synopsis

diff --git a/test-files/golden-tests/symbols/function/attributes_1.html b/test-files/golden-tests/symbols/function/attributes_1.html index 6b37c6d90..cb40440b7 100644 --- a/test-files/golden-tests/symbols/function/attributes_1.html +++ b/test-files/golden-tests/symbols/function/attributes_1.html @@ -7,7 +7,7 @@

Reference

-

+

Functions

@@ -25,7 +25,7 @@

Functions

-

f

+

f

Synopsis

diff --git a/test-files/golden-tests/symbols/function/auto.html b/test-files/golden-tests/symbols/function/auto.html index 85f24da73..2dc16e98f 100644 --- a/test-files/golden-tests/symbols/function/auto.html +++ b/test-files/golden-tests/symbols/function/auto.html @@ -7,7 +7,7 @@

Reference

-

+

Functions

@@ -26,7 +26,7 @@

Functions

-

f

+

f

A function that uses auto diff --git a/test-files/golden-tests/symbols/function/explicit-conv-operator.html b/test-files/golden-tests/symbols/function/explicit-conv-operator.html index 3a8a1b31f..d453de0a0 100644 --- a/test-files/golden-tests/symbols/function/explicit-conv-operator.html +++ b/test-files/golden-tests/symbols/function/explicit-conv-operator.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -28,7 +28,7 @@

Types

-

Explicit

+

Explicit

Synopsis

@@ -59,7 +59,7 @@

Member Functions

-

Explicit::operator bool

+

Explicit::operator bool

Conversion to bool @@ -83,7 +83,7 @@

Return Value

-

ExplicitExpression

+

ExplicitExpression

Synopsis

@@ -115,7 +115,7 @@

Member Functions

-

ExplicitExpression::operator bool

+

ExplicitExpression::operator bool

Conversion to bool @@ -139,7 +139,7 @@

Return Value

-

ExplicitFalse

+

ExplicitFalse

Synopsis

@@ -170,7 +170,7 @@

Member Functions

-

ExplicitFalse::operator bool

+

ExplicitFalse::operator bool

Conversion to bool @@ -194,7 +194,7 @@

Return Value

-

ExplicitTrue

+

ExplicitTrue

Synopsis

@@ -225,7 +225,7 @@

Member Functions

-

ExplicitTrue::operator bool

+

ExplicitTrue::operator bool

Conversion to bool diff --git a/test-files/golden-tests/symbols/function/explicit-ctor.html b/test-files/golden-tests/symbols/function/explicit-ctor.html index 0c1abfe4f..6927f3756 100644 --- a/test-files/golden-tests/symbols/function/explicit-ctor.html +++ b/test-files/golden-tests/symbols/function/explicit-ctor.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -28,7 +28,7 @@

Types

-

Explicit

+

Explicit

Synopsis

@@ -59,7 +59,7 @@

Member Functions

-

Explicit::Explicit

+

Explicit::Explicit

Constructors @@ -108,7 +108,7 @@

Synopses

-

Explicit::Explicit

+

Explicit::Explicit

Default constructor @@ -128,7 +128,7 @@

Synopsis

-

Explicit::Explicit

+

Explicit::Explicit

Copy constructor @@ -165,7 +165,7 @@

Parameters

-

Explicit::Explicit

+

Explicit::Explicit

Move constructor @@ -202,7 +202,7 @@

Parameters

-

Explicit::Explicit

+

Explicit::Explicit

Constructor @@ -224,7 +224,7 @@

Synopsis

-

ExplicitExpression

+

ExplicitExpression

Synopsis

@@ -256,7 +256,7 @@

Member Functions

-

ExplicitExpression::ExplicitExpression

+

ExplicitExpression::ExplicitExpression

Constructors @@ -305,7 +305,7 @@

Synopses

-

ExplicitExpression::ExplicitExpression

+

ExplicitExpression::ExplicitExpression

Default constructor @@ -325,7 +325,7 @@

Synopsis

-

ExplicitExpression::ExplicitExpression

+

ExplicitExpression::ExplicitExpression

Copy constructor @@ -362,7 +362,7 @@

Parameters

-

ExplicitExpression::ExplicitExpression

+

ExplicitExpression::ExplicitExpression

Move constructor @@ -399,7 +399,7 @@

Parameters

-

ExplicitExpression::ExplicitExpression

+

ExplicitExpression::ExplicitExpression

Constructor @@ -421,7 +421,7 @@

Synopsis

-

ExplicitFalse

+

ExplicitFalse

Synopsis

@@ -452,7 +452,7 @@

Member Functions

-

ExplicitFalse::ExplicitFalse

+

ExplicitFalse::ExplicitFalse

Constructors @@ -501,7 +501,7 @@

Synopses

-

ExplicitFalse::ExplicitFalse

+

ExplicitFalse::ExplicitFalse

Default constructor @@ -521,7 +521,7 @@

Synopsis

-

ExplicitFalse::ExplicitFalse

+

ExplicitFalse::ExplicitFalse

Copy constructor @@ -558,7 +558,7 @@

Parameters

-

ExplicitFalse::ExplicitFalse

+

ExplicitFalse::ExplicitFalse

Move constructor @@ -595,7 +595,7 @@

Parameters

-

ExplicitFalse::ExplicitFalse

+

ExplicitFalse::ExplicitFalse

Constructor @@ -617,7 +617,7 @@

Synopsis

-

ExplicitTrue

+

ExplicitTrue

Synopsis

@@ -648,7 +648,7 @@

Member Functions

-

ExplicitTrue::ExplicitTrue

+

ExplicitTrue::ExplicitTrue

Constructors @@ -697,7 +697,7 @@

Synopses

-

ExplicitTrue::ExplicitTrue

+

ExplicitTrue::ExplicitTrue

Default constructor @@ -717,7 +717,7 @@

Synopsis

-

ExplicitTrue::ExplicitTrue

+

ExplicitTrue::ExplicitTrue

Copy constructor @@ -754,7 +754,7 @@

Parameters

-

ExplicitTrue::ExplicitTrue

+

ExplicitTrue::ExplicitTrue

Move constructor @@ -791,7 +791,7 @@

Parameters

-

ExplicitTrue::ExplicitTrue

+

ExplicitTrue::ExplicitTrue

Constructor diff --git a/test-files/golden-tests/symbols/function/explicit-object-parameter.html b/test-files/golden-tests/symbols/function/explicit-object-parameter.html index eed5310c4..10d983100 100644 --- a/test-files/golden-tests/symbols/function/explicit-object-parameter.html +++ b/test-files/golden-tests/symbols/function/explicit-object-parameter.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -25,7 +25,7 @@

Types

-

Optional

+

Optional

Synopsis

@@ -56,7 +56,7 @@

Member Functions

-

Optional::value

+

Optional::value

Synopses

@@ -89,7 +89,7 @@

Synopses

-

Optional::value

+

Optional::value

Synopsis

@@ -107,7 +107,7 @@

Synopsis

-

Optional::value

+

Optional::value

Synopsis

diff --git a/test-files/golden-tests/symbols/function/function-parm-decay.html b/test-files/golden-tests/symbols/function/function-parm-decay.html index c7190bc31..97a0a2a1f 100644 --- a/test-files/golden-tests/symbols/function/function-parm-decay.html +++ b/test-files/golden-tests/symbols/function/function-parm-decay.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -42,7 +42,7 @@

Functions

-

T

+

T

Synopsis

@@ -57,7 +57,7 @@

Synopsis

-

U

+

U

Synopsis

@@ -72,7 +72,7 @@

Synopsis

-

f

+

f

Synopsis

@@ -88,7 +88,7 @@

Synopsis

-

g

+

g

Synopsis

@@ -104,7 +104,7 @@

Synopsis

-

h

+

h

Synopsis

@@ -120,7 +120,7 @@

Synopsis

-

i

+

i

Synopsis

diff --git a/test-files/golden-tests/symbols/function/function-template-template.html b/test-files/golden-tests/symbols/function/function-template-template.html index cc1cc699c..8427930fe 100644 --- a/test-files/golden-tests/symbols/function/function-template-template.html +++ b/test-files/golden-tests/symbols/function/function-template-template.html @@ -7,7 +7,7 @@

Reference

-

+

Functions

@@ -25,7 +25,7 @@

Functions

-

f

+

f

Synopsis

diff --git a/test-files/golden-tests/symbols/function/function-template.html b/test-files/golden-tests/symbols/function/function-template.html index 8d4f09d27..052d67749 100644 --- a/test-files/golden-tests/symbols/function/function-template.html +++ b/test-files/golden-tests/symbols/function/function-template.html @@ -7,7 +7,7 @@

Reference

-

+

Functions

@@ -36,7 +36,7 @@

Functions

-

f0

+

f0

Synopsis

@@ -53,7 +53,7 @@

Synopsis

-

f1

+

f1

Synopsis

@@ -70,7 +70,7 @@

Synopsis

-

f2

+

f2

Synopsis

@@ -87,7 +87,7 @@

Synopsis

-

f3

+

f3

Synopsis

@@ -106,7 +106,7 @@

Synopsis

-

g0

+

g0

Synopsis

@@ -123,7 +123,7 @@

Synopsis

-

g1

+

g1

Synopsis

@@ -140,7 +140,7 @@

Synopsis

-

g2

+

g2

Synopsis

@@ -159,7 +159,7 @@

Synopsis

-

h0

+

h0

Synopsis

@@ -175,7 +175,7 @@

Synopsis

-

h1

+

h1

Synopsis

@@ -193,7 +193,7 @@

Synopsis

-

i

+

i

Synopsis

@@ -212,7 +212,7 @@

Synopsis

-

j0

+

j0

Synopsis

@@ -229,7 +229,7 @@

Synopsis

-

j1

+

j1

Synopsis

diff --git a/test-files/golden-tests/symbols/function/function-tparm-decay.html b/test-files/golden-tests/symbols/function/function-tparm-decay.html index 576f29575..56e41cbb8 100644 --- a/test-files/golden-tests/symbols/function/function-tparm-decay.html +++ b/test-files/golden-tests/symbols/function/function-tparm-decay.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -42,7 +42,7 @@

Functions

-

T

+

T

Synopsis

@@ -57,7 +57,7 @@

Synopsis

-

U

+

U

Synopsis

@@ -72,7 +72,7 @@

Synopsis

-

f

+

f

Synopsis

@@ -89,7 +89,7 @@

Synopsis

-

g

+

g

Synopsis

@@ -106,7 +106,7 @@

Synopsis

-

h

+

h

Synopsis

@@ -123,7 +123,7 @@

Synopsis

-

i

+

i

Synopsis

diff --git a/test-files/golden-tests/symbols/function/mem-fn.html b/test-files/golden-tests/symbols/function/mem-fn.html index 1ccb3b64e..e9a7a6700 100644 --- a/test-files/golden-tests/symbols/function/mem-fn.html +++ b/test-files/golden-tests/symbols/function/mem-fn.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -42,7 +42,7 @@

Types

-

T01

+

T01

Synopsis

@@ -72,7 +72,7 @@

Member Functions

-

T01::f

+

T01::f

Synopsis

@@ -88,7 +88,7 @@

Synopsis

-

T02

+

T02

Synopsis

@@ -118,7 +118,7 @@

Static Member Functions

-

T02::f

+

T02::f

Synopsis

@@ -135,7 +135,7 @@

Synopsis

-

T03

+

T03

Synopsis

@@ -165,7 +165,7 @@

Member Functions

-

T03::f

+

T03::f

Synopsis

@@ -181,7 +181,7 @@

Synopsis

-

T04

+

T04

Synopsis

@@ -211,7 +211,7 @@

Member Functions

-

T04::f

+

T04::f

Synopsis

@@ -227,7 +227,7 @@

Synopsis

-

T05

+

T05

Synopsis

@@ -257,7 +257,7 @@

Member Functions

-

T05::f

+

T05::f

Synopsis

@@ -273,7 +273,7 @@

Synopsis

-

T06

+

T06

Synopsis

@@ -303,7 +303,7 @@

Member Functions

-

T06::f

+

T06::f

Synopsis

@@ -320,7 +320,7 @@

Synopsis

-

T08

+

T08

Synopsis

@@ -350,7 +350,7 @@

Member Functions

-

T08::f

+

T08::f

Synopsis

@@ -366,7 +366,7 @@

Synopsis

-

T09

+

T09

Synopsis

@@ -396,7 +396,7 @@

Member Functions

-

T09::f

+

T09::f

Synopsis

@@ -412,7 +412,7 @@

Synopsis

-

T10

+

T10

Synopsis

@@ -442,7 +442,7 @@

Member Functions

-

T10::f

+

T10::f

Synopsis

@@ -458,7 +458,7 @@

Synopsis

-

T11

+

T11

Synopsis

@@ -488,7 +488,7 @@

Member Functions

-

T11::f

+

T11::f

Synopsis

@@ -504,7 +504,7 @@

Synopsis

-

T12

+

T12

Synopsis

@@ -534,7 +534,7 @@

Member Functions

-

T12::f

+

T12::f

Synopsis

@@ -550,7 +550,7 @@

Synopsis

-

T13

+

T13

Synopsis

@@ -580,7 +580,7 @@

Member Functions

-

T13::f

+

T13::f

Synopsis

@@ -597,7 +597,7 @@

Synopsis

-

T14

+

T14

Synopsis

@@ -642,7 +642,7 @@

Derived Classes

-

T14::f

+

T14::f

Synopsis

@@ -659,7 +659,7 @@

Synopsis

-

T15

+

T15

Synopsis

@@ -689,7 +689,7 @@

Member Functions

-

T15::f

+

T15::f

Synopsis

@@ -705,7 +705,7 @@

Synopsis

-

T16

+

T16

Synopsis

@@ -735,7 +735,7 @@

Static Member Functions

-

T16::f

+

T16::f

Synopsis

@@ -752,7 +752,7 @@

Synopsis

-

T17

+

T17

Synopsis

@@ -797,7 +797,7 @@

Member Functions

-

T17::f

+

T17::f

Synopsis

@@ -814,7 +814,7 @@

Synopsis

-

U

+

U

Synopsis

@@ -873,7 +873,7 @@

Derived Classes

-

U::f1

+

U::f1

Synopsis

@@ -890,7 +890,7 @@

Synopsis

-

U::f3

+

U::f3

Synopsis

@@ -907,7 +907,7 @@

Synopsis

-

U::f2

+

U::f2

Synopsis

@@ -925,7 +925,7 @@

Synopsis

-

V

+

V

Synopsis

@@ -984,7 +984,7 @@

Static Member Functions

-

V::f3

+

V::f3

Synopsis

diff --git a/test-files/golden-tests/symbols/function/merge-params.html b/test-files/golden-tests/symbols/function/merge-params.html index 96edd8516..15087f964 100644 --- a/test-files/golden-tests/symbols/function/merge-params.html +++ b/test-files/golden-tests/symbols/function/merge-params.html @@ -7,7 +7,7 @@

Reference

-

+

Functions

@@ -26,7 +26,7 @@

Functions

-

f

+

f

Function diff --git a/test-files/golden-tests/symbols/function/merge-tparams.html b/test-files/golden-tests/symbols/function/merge-tparams.html index d55d20a3e..7fa1e2b41 100644 --- a/test-files/golden-tests/symbols/function/merge-tparams.html +++ b/test-files/golden-tests/symbols/function/merge-tparams.html @@ -7,7 +7,7 @@

Reference

-

+

Functions

@@ -26,7 +26,7 @@

Functions

-

f

+

f

Function diff --git a/test-files/golden-tests/symbols/function/noreturn.html b/test-files/golden-tests/symbols/function/noreturn.html index 255a96191..162023d8d 100644 --- a/test-files/golden-tests/symbols/function/noreturn.html +++ b/test-files/golden-tests/symbols/function/noreturn.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -38,7 +38,7 @@

Functions

-

T

+

T

Synopsis

@@ -99,7 +99,7 @@

Friends

-

T::f3

+

T::f3

Synopsis

@@ -116,7 +116,7 @@

Synopsis

-

T::f2

+

T::f2

Synopsis

@@ -134,7 +134,7 @@

Synopsis

-

f1

+

f1

Synopsis

diff --git a/test-files/golden-tests/symbols/function/overloaded-op-1.html b/test-files/golden-tests/symbols/function/overloaded-op-1.html index f8dc00942..b5ef87702 100644 --- a/test-files/golden-tests/symbols/function/overloaded-op-1.html +++ b/test-files/golden-tests/symbols/function/overloaded-op-1.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -25,7 +25,7 @@

Types

-

T

+

T

Synopsis

@@ -56,7 +56,7 @@

Member Functions

-

T::operator+

+

T::operator+

Unary plus operator diff --git a/test-files/golden-tests/symbols/function/overloaded-op-2.html b/test-files/golden-tests/symbols/function/overloaded-op-2.html index 8d3673fe8..56a115b00 100644 --- a/test-files/golden-tests/symbols/function/overloaded-op-2.html +++ b/test-files/golden-tests/symbols/function/overloaded-op-2.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -25,7 +25,7 @@

Types

-

T

+

T

Synopsis

@@ -56,7 +56,7 @@

Member Functions

-

T::operator+

+

T::operator+

Addition operator diff --git a/test-files/golden-tests/symbols/function/qualified-params.html b/test-files/golden-tests/symbols/function/qualified-params.html index 6bea203b3..1c38f4064 100644 --- a/test-files/golden-tests/symbols/function/qualified-params.html +++ b/test-files/golden-tests/symbols/function/qualified-params.html @@ -7,7 +7,7 @@

Reference

-

+

Namespaces

@@ -39,7 +39,7 @@

Functions

-

M

+

M

Types

@@ -57,7 +57,7 @@

Types

-

M::D

+

M::D

Synopsis

@@ -74,7 +74,7 @@

Synopsis

-

N

+

N

Types

@@ -92,7 +92,7 @@

Types

-

N::C

+

N::C

Synopsis

@@ -109,7 +109,7 @@

Synopsis

-

foo

+

foo

Synopsis

diff --git a/test-files/golden-tests/symbols/function/sfinae.html b/test-files/golden-tests/symbols/function/sfinae.html index ecfc7a5a8..2bc059188 100644 --- a/test-files/golden-tests/symbols/function/sfinae.html +++ b/test-files/golden-tests/symbols/function/sfinae.html @@ -7,7 +7,7 @@

Reference

-

+

Namespaces

@@ -65,7 +65,7 @@

Functions

-

B

+

B

Types

@@ -84,7 +84,7 @@

Types

-

B::C

+

B::C

Synopsis

@@ -115,7 +115,7 @@

Non-Member Functions

-

A

+

A

The partial specialization of A is enabled via a template parameter @@ -139,7 +139,7 @@

Synopsis

-

A<T>

+

A<T>

Specialization for integral types @@ -162,7 +162,7 @@

Synopsis

-

S

+

S

SFINAE with std::void_t @@ -199,7 +199,7 @@

Member Functions

-

S::store

+

S::store

Synopsis

@@ -215,7 +215,7 @@

Synopsis

-

S<T, std::void_t<T::a::b>>

+

S<T, std::void_t<T::a::b>>

SFINAE with std::void_t @@ -250,7 +250,7 @@

Member Functions

-

S<T, std::void_t<T::a::b>>::store

+

S<T, std::void_t<T::a::b>>::store

Synopsis

@@ -266,7 +266,7 @@

Synopsis

-

f1

+

f1

Enabled via return type @@ -288,7 +288,7 @@

Synopsis

-

f10

+

f10

Enabled via type template parameter @@ -316,7 +316,7 @@

Description

-

f2

+

f2

Enabling a specified return type @@ -338,7 +338,7 @@

Synopsis

-

f3

+

f3

Enabling a specified return type in another namespace @@ -360,7 +360,7 @@

Synopsis

-

f4

+

f4

Enabled via return type with std::enable_if @@ -382,7 +382,7 @@

Synopsis

-

f5

+

f5

Enabled via a non-type template parameter with helper @@ -404,7 +404,7 @@

Synopsis

-

f6

+

f6

Enabled via a non-type template parameter without helper @@ -426,7 +426,7 @@

Synopsis

-

f7

+

f7

Enabled via a non-type template parameter using int instead of bool @@ -448,7 +448,7 @@

Synopsis

-

f8

+

f8

Enabled via parameter without helper @@ -470,7 +470,7 @@

Synopsis

-

f9

+

f9

Enabled via parameter with helper diff --git a/test-files/golden-tests/symbols/function/spec-mem-implicit-instantiation.html b/test-files/golden-tests/symbols/function/spec-mem-implicit-instantiation.html index d15f3a7fd..9df0e4959 100644 --- a/test-files/golden-tests/symbols/function/spec-mem-implicit-instantiation.html +++ b/test-files/golden-tests/symbols/function/spec-mem-implicit-instantiation.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -29,7 +29,7 @@

Types

-

A

+

A

Synopsis

@@ -74,7 +74,7 @@

Member Functions

-

A::B

+

A::B

Synopsis

@@ -105,7 +105,7 @@

Member Functions

-

A::B::g

+

A::B::g

Synopsis

@@ -121,7 +121,7 @@

Synopsis

-

A::C

+

A::C

Synopsis

@@ -152,7 +152,7 @@

Member Functions

-

A::C::h

+

A::C::h

Synopsis

@@ -168,7 +168,7 @@

Synopsis

-

A::f

+

A::f

Synopsis

@@ -184,7 +184,7 @@

Synopsis

-

A<bool>

+

A<bool>

Synopsis

@@ -231,7 +231,7 @@

Member Functions

-

A<bool>::B

+

A<bool>::B

Synopsis

@@ -249,7 +249,7 @@

Synopsis

-

A<bool>::C

+

A<bool>::C

Synopsis

@@ -267,7 +267,7 @@

Synopsis

-

A<bool>::C<double*>

+

A<bool>::C<double*>

Synopsis

@@ -298,7 +298,7 @@

Member Functions

-

A<bool>::C<double*>::j

+

A<bool>::C<double*>::j

Synopsis

@@ -314,7 +314,7 @@

Synopsis

-

A<bool>::C<U*>

+

A<bool>::C<U*>

Synopsis

@@ -345,7 +345,7 @@

Member Functions

-

A<bool>::C<U*>::j

+

A<bool>::C<U*>::j

Synopsis

@@ -361,7 +361,7 @@

Synopsis

-

A<bool>::f

+

A<bool>::f

Synopsis

@@ -377,7 +377,7 @@

Synopsis

-

A<short>

+

A<short>

Synopsis

@@ -422,7 +422,7 @@

Member Functions

-

A<short>::B

+

A<short>::B

Synopsis

@@ -440,7 +440,7 @@

Synopsis

-

A<short>::C

+

A<short>::C

Synopsis

@@ -471,7 +471,7 @@

Member Functions

-

A<short>::C::i

+

A<short>::C::i

Synopsis

@@ -487,7 +487,7 @@

Synopsis

-

A<short>::f

+

A<short>::f

Synopsis

@@ -503,7 +503,7 @@

Synopsis

-

A<int>

+

A<int>

Synopsis

@@ -549,7 +549,7 @@

Member Functions

-

A<int>::B

+

A<int>::B

Synopsis

@@ -567,7 +567,7 @@

Synopsis

-

A<int>::B<long>

+

A<int>::B<long>

Synopsis

@@ -598,7 +598,7 @@

Member Functions

-

A<int>::B<long>::g

+

A<int>::B<long>::g

Synopsis

@@ -614,7 +614,7 @@

Synopsis

-

A<int>::C

+

A<int>::C

Synopsis

@@ -632,7 +632,7 @@

Synopsis

-

A<int>::f

+

A<int>::f

Synopsis

@@ -648,7 +648,7 @@

Synopsis

-

D

+

D

Synopsis

@@ -679,7 +679,7 @@

Types

-

D::E

+

D::E

Synopsis

@@ -710,7 +710,7 @@

Member Functions

-

D::E::k

+

D::E::k

Synopsis

@@ -726,7 +726,7 @@

Synopsis

-

D::E<int>

+

D::E<int>

Synopsis

@@ -757,7 +757,7 @@

Member Functions

-

D::E<int>::k

+

D::E<int>::k

Synopsis

diff --git a/test-files/golden-tests/symbols/function/type-resolution.html b/test-files/golden-tests/symbols/function/type-resolution.html index e48ed4d13..6f5806efa 100644 --- a/test-files/golden-tests/symbols/function/type-resolution.html +++ b/test-files/golden-tests/symbols/function/type-resolution.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -86,7 +86,7 @@

Functions

-

C

+

C

Synopsis

@@ -101,7 +101,7 @@

Synopsis

-

D

+

D

Synopsis

@@ -116,7 +116,7 @@

Synopsis

-

E

+

E

Synopsis

@@ -132,7 +132,7 @@

Synopsis

-

A

+

A

Synopsis

@@ -149,7 +149,7 @@

Synopsis

-

B

+

B

Synopsis

@@ -169,7 +169,7 @@

Synopsis

-

f0

+

f0

Synopsis

@@ -185,7 +185,7 @@

Synopsis

-

f1

+

f1

Synopsis

@@ -201,7 +201,7 @@

Synopsis

-

f2

+

f2

Synopsis

@@ -217,7 +217,7 @@

Synopsis

-

f3

+

f3

Synopsis

@@ -233,7 +233,7 @@

Synopsis

-

f4

+

f4

Synopsis

@@ -249,7 +249,7 @@

Synopsis

-

f5

+

f5

Synopsis

@@ -265,7 +265,7 @@

Synopsis

-

f6

+

f6

Synopsis

@@ -281,7 +281,7 @@

Synopsis

-

f7

+

f7

Synopsis

@@ -297,7 +297,7 @@

Synopsis

-

f8

+

f8

Synopsis

@@ -313,7 +313,7 @@

Synopsis

-

g0

+

g0

Synopsis

@@ -329,7 +329,7 @@

Synopsis

-

g1

+

g1

Synopsis

@@ -345,7 +345,7 @@

Synopsis

-

g2

+

g2

Synopsis

@@ -361,7 +361,7 @@

Synopsis

-

g3

+

g3

Synopsis

@@ -377,7 +377,7 @@

Synopsis

-

g4

+

g4

Synopsis

@@ -393,7 +393,7 @@

Synopsis

-

g5

+

g5

Synopsis

@@ -409,7 +409,7 @@

Synopsis

-

g6

+

g6

Synopsis

@@ -425,7 +425,7 @@

Synopsis

-

g7

+

g7

Synopsis

@@ -441,7 +441,7 @@

Synopsis

-

g8

+

g8

Synopsis

@@ -457,7 +457,7 @@

Synopsis

-

h0

+

h0

Synopsis

@@ -473,7 +473,7 @@

Synopsis

-

h1

+

h1

Synopsis

@@ -489,7 +489,7 @@

Synopsis

-

h2

+

h2

Synopsis

@@ -505,7 +505,7 @@

Synopsis

-

h3

+

h3

Synopsis

@@ -521,7 +521,7 @@

Synopsis

-

h4

+

h4

Synopsis

@@ -537,7 +537,7 @@

Synopsis

-

h5

+

h5

Synopsis

@@ -553,7 +553,7 @@

Synopsis

-

h6

+

h6

Synopsis

@@ -569,7 +569,7 @@

Synopsis

-

h7

+

h7

Synopsis

@@ -585,7 +585,7 @@

Synopsis

-

h8

+

h8

Synopsis

@@ -601,7 +601,7 @@

Synopsis

-

i0

+

i0

Synopsis

@@ -617,7 +617,7 @@

Synopsis

-

i1

+

i1

Synopsis

@@ -633,7 +633,7 @@

Synopsis

-

i2

+

i2

Synopsis

@@ -649,7 +649,7 @@

Synopsis

-

i3

+

i3

Synopsis

@@ -665,7 +665,7 @@

Synopsis

-

i4

+

i4

Synopsis

@@ -681,7 +681,7 @@

Synopsis

-

i5

+

i5

Synopsis

@@ -697,7 +697,7 @@

Synopsis

-

i6

+

i6

Synopsis

@@ -713,7 +713,7 @@

Synopsis

-

i7

+

i7

Synopsis

@@ -729,7 +729,7 @@

Synopsis

-

i8

+

i8

Synopsis

@@ -745,7 +745,7 @@

Synopsis

-

j0

+

j0

Synopsis

@@ -761,7 +761,7 @@

Synopsis

-

j1

+

j1

Synopsis

@@ -777,7 +777,7 @@

Synopsis

-

j2

+

j2

Synopsis

@@ -793,7 +793,7 @@

Synopsis

-

j3

+

j3

Synopsis

@@ -809,7 +809,7 @@

Synopsis

-

j4

+

j4

Synopsis

@@ -825,7 +825,7 @@

Synopsis

-

j5

+

j5

Synopsis

@@ -841,7 +841,7 @@

Synopsis

-

j6

+

j6

Synopsis

@@ -857,7 +857,7 @@

Synopsis

-

j7

+

j7

Synopsis

@@ -873,7 +873,7 @@

Synopsis

-

j8

+

j8

Synopsis

diff --git a/test-files/golden-tests/symbols/function/variadic-function.html b/test-files/golden-tests/symbols/function/variadic-function.html index 600be59b1..b1908b0b1 100644 --- a/test-files/golden-tests/symbols/function/variadic-function.html +++ b/test-files/golden-tests/symbols/function/variadic-function.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -41,7 +41,7 @@

Functions

-

T

+

T

Synopsis

@@ -56,7 +56,7 @@

Synopsis

-

U

+

U

Synopsis

@@ -71,7 +71,7 @@

Synopsis

-

C

+

C

Synopsis

@@ -91,7 +91,7 @@

Synopsis

-

f

+

f

Synopsis

@@ -107,7 +107,7 @@

Synopsis

-

g

+

g

Synopsis

diff --git a/test-files/golden-tests/symbols/guide/explicit-deduct-guide.html b/test-files/golden-tests/symbols/guide/explicit-deduct-guide.html index 0283187c8..f1794a8ff 100644 --- a/test-files/golden-tests/symbols/guide/explicit-deduct-guide.html +++ b/test-files/golden-tests/symbols/guide/explicit-deduct-guide.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -41,7 +41,7 @@

Deduction Guides

-

X

+

X

Synopsis

@@ -59,7 +59,7 @@

Synopsis

-

X<0>

+

X<0>

Synopsis

@@ -74,7 +74,7 @@

Synopsis

-

X<0>

+

X<0>

Synopsis

@@ -89,7 +89,7 @@

Synopsis

-

X<0>

+

X<0>

Synopsis

@@ -104,7 +104,7 @@

Synopsis

-

X<0>

+

X<0>

Synopsis

diff --git a/test-files/golden-tests/symbols/namespace-alias/namespace-alias-1.html b/test-files/golden-tests/symbols/namespace-alias/namespace-alias-1.html index 7ec73f1df..01a94b44a 100644 --- a/test-files/golden-tests/symbols/namespace-alias/namespace-alias-1.html +++ b/test-files/golden-tests/symbols/namespace-alias/namespace-alias-1.html @@ -7,7 +7,7 @@

Reference

-

+

Namespaces

@@ -38,7 +38,7 @@

Namespace Aliases

-

LongName

+

LongName

Types

@@ -56,7 +56,7 @@

Types

-

LongName::A

+

LongName::A

Synopsis

@@ -73,7 +73,7 @@

Synopsis

-

A

+

A

Synopsis

diff --git a/test-files/golden-tests/symbols/namespace-alias/namespace-alias-2.html b/test-files/golden-tests/symbols/namespace-alias/namespace-alias-2.html index fad9267f4..5f9cef62f 100644 --- a/test-files/golden-tests/symbols/namespace-alias/namespace-alias-2.html +++ b/test-files/golden-tests/symbols/namespace-alias/namespace-alias-2.html @@ -7,7 +7,7 @@

Reference

-

+

Namespaces

@@ -39,7 +39,7 @@

Namespace Aliases

-

LongName

+

LongName

Types

@@ -57,7 +57,7 @@

Types

-

LongName::A

+

LongName::A

Synopsis

@@ -74,7 +74,7 @@

Synopsis

-

A

+

A

Synopsis

@@ -89,7 +89,7 @@

Synopsis

-

B

+

B

Synopsis

diff --git a/test-files/golden-tests/symbols/namespace-alias/namespace-alias-3.html b/test-files/golden-tests/symbols/namespace-alias/namespace-alias-3.html index b19115dd0..fb2790f40 100644 --- a/test-files/golden-tests/symbols/namespace-alias/namespace-alias-3.html +++ b/test-files/golden-tests/symbols/namespace-alias/namespace-alias-3.html @@ -7,7 +7,7 @@

Reference

-

+

Namespaces

@@ -39,7 +39,7 @@

Namespace Aliases

-

LongName

+

LongName

Types

@@ -57,7 +57,7 @@

Types

-

LongName::A

+

LongName::A

Synopsis

@@ -74,7 +74,7 @@

Synopsis

-

A

+

A

Synopsis

@@ -89,7 +89,7 @@

Synopsis

-

B

+

B

Synopsis

diff --git a/test-files/golden-tests/symbols/namespace/namespace.html b/test-files/golden-tests/symbols/namespace/namespace.html index 3997fbe77..27c1b20ff 100644 --- a/test-files/golden-tests/symbols/namespace/namespace.html +++ b/test-files/golden-tests/symbols/namespace/namespace.html @@ -7,7 +7,7 @@

Reference

-

+

Namespaces

@@ -45,7 +45,7 @@

Functions

-

A

+

A

Namespaces

@@ -78,7 +78,7 @@

Functions

-

A::B

+

A::B

Functions

@@ -96,7 +96,7 @@

Functions

-

A::B::f1

+

A::B::f1

Synopsis

@@ -112,7 +112,7 @@

Synopsis

-

A::f0

+

A::f0

Synopsis

@@ -128,7 +128,7 @@

Synopsis

-

A::f2

+

A::f2

Synopsis

@@ -144,7 +144,7 @@

Synopsis

-

A::f3

+

A::f3

Synopsis

@@ -160,7 +160,7 @@

Synopsis

-

E

+

E

Functions

@@ -178,7 +178,7 @@

Functions

-

E::f6

+

E::f6

Synopsis

@@ -194,7 +194,7 @@

Synopsis

-

G

+

G

Functions

@@ -212,7 +212,7 @@

Functions

-

G::f11

+

G::f11

Synopsis

@@ -228,7 +228,7 @@

Synopsis

-

I

+

I

Functions

@@ -246,7 +246,7 @@

Functions

-

I::f14

+

I::f14

Synopsis

@@ -262,7 +262,7 @@

Synopsis

-

f10

+

f10

Synopsis

@@ -278,7 +278,7 @@

Synopsis

-

f12

+

f12

Synopsis

@@ -294,7 +294,7 @@

Synopsis

-

f5

+

f5

Synopsis

@@ -310,7 +310,7 @@

Synopsis

-

f7

+

f7

Synopsis

@@ -326,7 +326,7 @@

Synopsis

-

f8

+

f8

Synopsis

diff --git a/test-files/golden-tests/symbols/overloads/overloads-brief.html b/test-files/golden-tests/symbols/overloads/overloads-brief.html index ea857a675..619d4b9f8 100644 --- a/test-files/golden-tests/symbols/overloads/overloads-brief.html +++ b/test-files/golden-tests/symbols/overloads/overloads-brief.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -43,7 +43,7 @@

Functions

-

A

+

A

Overload briefs from function or operator classes @@ -95,7 +95,7 @@

Non-Member Functions

-

A::A

+

A::A

Constructors @@ -141,7 +141,7 @@

Parameters

-

A::A

+

A::A

First constructor @@ -160,7 +160,7 @@

Synopsis

-

A::A

+

A::A

Second constructor @@ -196,7 +196,7 @@

Parameters

-

A::operator=

+

A::operator=

Assignment operators @@ -248,7 +248,7 @@

Parameters

-

A::operator=

+

A::operator=

Assign from A @@ -289,7 +289,7 @@

Parameters

-

A::operator=

+

A::operator=

Assign from int @@ -330,7 +330,7 @@

Parameters

-

A::operator+

+

A::operator+

Addition operators @@ -382,7 +382,7 @@

Parameters

-

A::operator+

+

A::operator+

Addition operator for ints @@ -423,7 +423,7 @@

Parameters

-

A::operator+

+

A::operator+

Addition operator for As @@ -464,7 +464,7 @@

Parameters

-

A::operator-

+

A::operator-

Unary minus operators @@ -499,7 +499,7 @@

Return Value

-

A::operator-

+

A::operator-

Unary operator- for A @@ -527,7 +527,7 @@

Return Value

-

A::operator-

+

A::operator-

Binary operator- for A @@ -572,7 +572,7 @@

Parameters

-

B

+

B

Auxiliary class @@ -607,7 +607,7 @@

Non-Member Functions

-

no_way_to_infer_this_brief

+

no_way_to_infer_this_brief

no_way_to_infer_this_brief overloads @@ -655,7 +655,7 @@

Parameters

-

no_way_to_infer_this_brief

+

no_way_to_infer_this_brief

Function with no params @@ -675,7 +675,7 @@

Synopsis

-

no_way_to_infer_this_brief

+

no_way_to_infer_this_brief

Function with single param @@ -712,7 +712,7 @@

Parameters

-

operator+

+

operator+

Unary plus operators @@ -747,7 +747,7 @@

Return Value

-

operator+

+

operator+

Unary operator for A @@ -788,7 +788,7 @@

Parameters

-

operator+

+

operator+

Unary operator for B @@ -829,7 +829,7 @@

Parameters

-

sameBrief

+

sameBrief

Function with same brief @@ -883,7 +883,7 @@

Parameters

-

sameBrief

+

sameBrief

Function with same brief @@ -920,7 +920,7 @@

Parameters

-

sameBrief

+

sameBrief

Function with same brief diff --git a/test-files/golden-tests/symbols/overloads/overloads-metadata.html b/test-files/golden-tests/symbols/overloads/overloads-metadata.html index 9c7884e06..b481f6ff3 100644 --- a/test-files/golden-tests/symbols/overloads/overloads-metadata.html +++ b/test-files/golden-tests/symbols/overloads/overloads-metadata.html @@ -7,7 +7,7 @@

Reference

-

+

Functions

@@ -26,7 +26,7 @@

Functions

-

f

+

f

Test function @@ -162,7 +162,7 @@

See Also

-

f

+

f

Test function @@ -254,7 +254,7 @@

See Also

-

f

+

f

Test function @@ -301,7 +301,7 @@

See Also

-

f

+

f

Test function diff --git a/test-files/golden-tests/symbols/overloads/overloads-ostream.html b/test-files/golden-tests/symbols/overloads/overloads-ostream.html index 619f50cf5..37019a9fc 100644 --- a/test-files/golden-tests/symbols/overloads/overloads-ostream.html +++ b/test-files/golden-tests/symbols/overloads/overloads-ostream.html @@ -7,7 +7,7 @@

Reference

-

+

Namespaces

@@ -26,7 +26,7 @@

Namespaces

-

left_shift

+

left_shift

Types

@@ -57,7 +57,7 @@

Functions

-

left_shift::A

+

left_shift::A

Synopsis

@@ -88,7 +88,7 @@

Member Functions

-

left_shift::A::operator<<

+

left_shift::A::operator<<

Left shift operators @@ -119,7 +119,7 @@

Synopses

-

left_shift::A::operator<<

+

left_shift::A::operator<<

Left shift operator @@ -160,7 +160,7 @@

Parameters

-

left_shift::A::operator<<

+

left_shift::A::operator<<

Left shift operator @@ -201,7 +201,7 @@

Parameters

-

left_shift::operator<<

+

left_shift::operator<<

Synopsis

@@ -219,7 +219,7 @@

Synopsis

-

ostream

+

ostream

Types

@@ -253,7 +253,7 @@

Functions

-

ostream::B

+

ostream::B

Synopsis

@@ -288,7 +288,7 @@

Friends

-

ostream::C

+

ostream::C

Synopsis

@@ -305,7 +305,7 @@

Synopsis

-

ostream::OStream

+

ostream::OStream

Synopsis

@@ -322,7 +322,7 @@

Synopsis

-

ostream::operator<<

+

ostream::operator<<

Stream insertion operators @@ -357,7 +357,7 @@

Synopses

-

ostream::operator<<

+

ostream::operator<<

Stream insertion operator @@ -404,7 +404,7 @@

Parameters

-

ostream::operator<<

+

ostream::operator<<

Stream insertion operator diff --git a/test-files/golden-tests/symbols/overloads/overloads.html b/test-files/golden-tests/symbols/overloads/overloads.html index c9a4b2de9..4e9e28895 100644 --- a/test-files/golden-tests/symbols/overloads/overloads.html +++ b/test-files/golden-tests/symbols/overloads/overloads.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -41,7 +41,7 @@

Functions

-

A

+

A

Synopsis

@@ -108,7 +108,7 @@

Friends

-

A::f

+

A::f

Synopses

@@ -135,7 +135,7 @@

Synopses

-

A::f

+

A::f

Synopsis

@@ -151,7 +151,7 @@

Synopsis

-

A::f

+

A::f

Synopsis

@@ -167,7 +167,7 @@

Synopsis

-

A::g

+

A::g

Synopses

@@ -196,7 +196,7 @@

Synopses

-

A::g

+

A::g

Synopsis

@@ -213,7 +213,7 @@

Synopsis

-

A::g

+

A::g

Synopsis

@@ -230,7 +230,7 @@

Synopsis

-

B

+

B

Synopsis

@@ -247,7 +247,7 @@

Synopsis

-

f

+

f

Synopses

@@ -274,7 +274,7 @@

Synopses

-

f

+

f

Synopsis

@@ -290,7 +290,7 @@

Synopsis

-

f

+

f

Synopsis

@@ -306,7 +306,7 @@

Synopsis

-

operator==

+

operator==

Equality operators @@ -361,7 +361,7 @@

Synopses

-

operator==

+

operator==

Equality operator @@ -408,7 +408,7 @@

Parameters

-

operator==

+

operator==

Equality operator @@ -455,7 +455,7 @@

Parameters

-

operator==

+

operator==

Equality operator @@ -502,7 +502,7 @@

Parameters

-

operator==

+

operator==

Equality operator diff --git a/test-files/golden-tests/symbols/record/class-private-alias.html b/test-files/golden-tests/symbols/record/class-private-alias.html index 56c9557b8..733e64feb 100644 --- a/test-files/golden-tests/symbols/record/class-private-alias.html +++ b/test-files/golden-tests/symbols/record/class-private-alias.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -25,7 +25,7 @@

Types

-

S

+

S

Synopsis

@@ -55,7 +55,7 @@

Member Functions

-

S::f

+

S::f

Synopsis

diff --git a/test-files/golden-tests/symbols/record/class-template-partial-spec.html b/test-files/golden-tests/symbols/record/class-template-partial-spec.html index 60bb7c732..d17e7f87f 100644 --- a/test-files/golden-tests/symbols/record/class-template-partial-spec.html +++ b/test-files/golden-tests/symbols/record/class-template-partial-spec.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -25,7 +25,7 @@

Types

-

A

+

A

Synopsis

@@ -58,7 +58,7 @@

Types

-

A::B

+

A::B

Synopsis

@@ -78,7 +78,7 @@

Synopsis

-

A::B<T, long>

+

A::B<T, long>

Synopsis

@@ -96,7 +96,7 @@

Synopsis

-

A::B<U*, T>

+

A::B<U*, T>

Synopsis

diff --git a/test-files/golden-tests/symbols/record/class-template-spec.html b/test-files/golden-tests/symbols/record/class-template-spec.html index 8e83fedef..eeb7130c7 100644 --- a/test-files/golden-tests/symbols/record/class-template-spec.html +++ b/test-files/golden-tests/symbols/record/class-template-spec.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -33,7 +33,7 @@

Types

-

A

+

A

Synopsis

@@ -64,7 +64,7 @@

Member Functions

-

A::f

+

A::f

Synopsis

@@ -80,7 +80,7 @@

Synopsis

-

A<int>

+

A<int>

Synopsis

@@ -111,7 +111,7 @@

Member Functions

-

A<int>::g

+

A<int>::g

Synopsis

@@ -127,7 +127,7 @@

Synopsis

-

A<long>

+

A<long>

Synopsis

@@ -158,7 +158,7 @@

Member Functions

-

A<long>::h

+

A<long>::h

Synopsis

@@ -174,7 +174,7 @@

Synopsis

-

B

+

B

Synopsis

@@ -205,7 +205,7 @@

Member Functions

-

B::f

+

B::f

Synopsis

@@ -221,7 +221,7 @@

Synopsis

-

B<T&>

+

B<T&>

Synopsis

@@ -252,7 +252,7 @@

Member Functions

-

B<T&>::h

+

B<T&>::h

Synopsis

@@ -268,7 +268,7 @@

Synopsis

-

B<T*>

+

B<T*>

Synopsis

@@ -299,7 +299,7 @@

Member Functions

-

B<T*>::g

+

B<T*>::g

Synopsis

@@ -315,7 +315,7 @@

Synopsis

-

C

+

C

Synopsis

@@ -348,7 +348,7 @@

Member Functions

-

C::f

+

C::f

Synopsis

@@ -364,7 +364,7 @@

Synopsis

-

C<int, int>

+

C<int, int>

Synopsis

@@ -395,7 +395,7 @@

Member Functions

-

C<int, int>::g

+

C<int, int>::g

Synopsis

@@ -411,7 +411,7 @@

Synopsis

-

C<T*, int>

+

C<T*, int>

Synopsis

@@ -442,7 +442,7 @@

Member Functions

-

C<T*, int>::h

+

C<T*, int>::h

Synopsis

diff --git a/test-files/golden-tests/symbols/record/class-template-specializations-1.html b/test-files/golden-tests/symbols/record/class-template-specializations-1.html index 36044b0f7..74e1e7f06 100644 --- a/test-files/golden-tests/symbols/record/class-template-specializations-1.html +++ b/test-files/golden-tests/symbols/record/class-template-specializations-1.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -115,7 +115,7 @@

Types

-

R0

+

R0

Synopsis

@@ -174,7 +174,7 @@

Member Functions

-

R1

+

R1

Synopsis

@@ -206,7 +206,7 @@

Base Classes

-

R10

+

R10

Synopsis

@@ -238,7 +238,7 @@

Base Classes

-

R11

+

R11

Synopsis

@@ -270,7 +270,7 @@

Base Classes

-

R12

+

R12

Synopsis

@@ -302,7 +302,7 @@

Base Classes

-

R13

+

R13

Synopsis

@@ -334,7 +334,7 @@

Base Classes

-

R14

+

R14

Synopsis

@@ -366,7 +366,7 @@

Base Classes

-

R15

+

R15

Synopsis

@@ -398,7 +398,7 @@

Base Classes

-

R16

+

R16

Synopsis

@@ -430,7 +430,7 @@

Base Classes

-

R17

+

R17

Synopsis

@@ -462,7 +462,7 @@

Base Classes

-

R18

+

R18

Synopsis

@@ -494,7 +494,7 @@

Base Classes

-

R19

+

R19

Synopsis

@@ -526,7 +526,7 @@

Base Classes

-

R2

+

R2

Synopsis

@@ -585,7 +585,7 @@

Member Functions

-

R20

+

R20

Synopsis

@@ -617,7 +617,7 @@

Base Classes

-

R21

+

R21

Synopsis

@@ -649,7 +649,7 @@

Base Classes

-

R22

+

R22

Synopsis

@@ -681,7 +681,7 @@

Base Classes

-

R23

+

R23

Synopsis

@@ -713,7 +713,7 @@

Base Classes

-

R24

+

R24

Synopsis

@@ -745,7 +745,7 @@

Base Classes

-

R25

+

R25

Synopsis

@@ -777,7 +777,7 @@

Base Classes

-

R26

+

R26

Synopsis

@@ -809,7 +809,7 @@

Base Classes

-

R27

+

R27

Synopsis

@@ -841,7 +841,7 @@

Base Classes

-

R28

+

R28

Synopsis

@@ -900,7 +900,7 @@

Member Functions

-

R29

+

R29

Synopsis

@@ -959,7 +959,7 @@

Member Functions

-

R3

+

R3

Synopsis

@@ -991,7 +991,7 @@

Base Classes

-

R30

+

R30

Synopsis

@@ -1049,7 +1049,7 @@

Member Functions

-

R31

+

R31

Synopsis

@@ -1084,7 +1084,7 @@

Base Classes

-

R32

+

R32

Synopsis

@@ -1116,7 +1116,7 @@

Base Classes

-

R33

+

R33

Synopsis

@@ -1148,7 +1148,7 @@

Base Classes

-

R34

+

R34

Synopsis

@@ -1193,7 +1193,7 @@

Member Functions

-

R35

+

R35

Synopsis

@@ -1228,7 +1228,7 @@

Base Classes

-

R36

+

R36

Synopsis

@@ -1260,7 +1260,7 @@

Base Classes

-

R37

+

R37

Synopsis

@@ -1292,7 +1292,7 @@

Base Classes

-

R38

+

R38

Synopsis

@@ -1327,7 +1327,7 @@

Base Classes

-

R39

+

R39

Synopsis

@@ -1359,7 +1359,7 @@

Base Classes

-

R4

+

R4

Synopsis

@@ -1391,7 +1391,7 @@

Base Classes

-

R40

+

R40

Synopsis

@@ -1423,7 +1423,7 @@

Base Classes

-

R41

+

R41

Synopsis

@@ -1481,7 +1481,7 @@

Member Functions

-

R42

+

R42

Synopsis

@@ -1516,7 +1516,7 @@

Base Classes

-

R43

+

R43

Synopsis

@@ -1548,7 +1548,7 @@

Base Classes

-

R44

+

R44

Synopsis

@@ -1580,7 +1580,7 @@

Base Classes

-

R45

+

R45

Synopsis

@@ -1625,7 +1625,7 @@

Member Functions

-

R46

+

R46

Synopsis

@@ -1660,7 +1660,7 @@

Base Classes

-

R47

+

R47

Synopsis

@@ -1692,7 +1692,7 @@

Base Classes

-

R48

+

R48

Synopsis

@@ -1724,7 +1724,7 @@

Base Classes

-

R5

+

R5

Synopsis

@@ -1756,7 +1756,7 @@

Base Classes

-

R6

+

R6

Synopsis

@@ -1788,7 +1788,7 @@

Base Classes

-

R7

+

R7

Synopsis

@@ -1820,7 +1820,7 @@

Base Classes

-

R8

+

R8

Synopsis

@@ -1852,7 +1852,7 @@

Base Classes

-

R9

+

R9

Synopsis

@@ -1884,7 +1884,7 @@

Base Classes

-

S0

+

S0

Synopsis

@@ -1952,7 +1952,7 @@

Derived Classes

-

S0::S1

+

S0::S1

Synopsis

@@ -1995,7 +1995,7 @@

Member Functions

-

S0::S1::S2

+

S0::S1::S2

Synopsis

@@ -2042,7 +2042,7 @@

Member Functions

-

S0::S1::S2::S3

+

S0::S1::S2::S3

Synopsis

@@ -2072,7 +2072,7 @@

Member Functions

-

S0::S1::S2::S3::f3

+

S0::S1::S2::S3::f3

Synopsis

@@ -2088,7 +2088,7 @@

Synopsis

-

S0::S1::S2::S4

+

S0::S1::S2::S4

Synopsis

@@ -2121,7 +2121,7 @@

Member Functions

-

S0::S1::S2::S4::f4

+

S0::S1::S2::S4::f4

Synopsis

@@ -2137,7 +2137,7 @@

Synopsis

-

S0::S1::S2::f2

+

S0::S1::S2::f2

Synopsis

@@ -2153,7 +2153,7 @@

Synopsis

-

S0::S1::f1

+

S0::S1::f1

Synopsis

@@ -2169,7 +2169,7 @@

Synopsis

-

S0::S5

+

S0::S5

Synopsis

@@ -2215,7 +2215,7 @@

Member Functions

-

S0::S5::S6

+

S0::S5::S6

Synopsis

@@ -2258,7 +2258,7 @@

Member Functions

-

S0::S5::S6::S7

+

S0::S5::S6::S7

Synopsis

@@ -2305,7 +2305,7 @@

Member Functions

-

S0::S5::S6::S7::S8

+

S0::S5::S6::S7::S8

Synopsis

@@ -2335,7 +2335,7 @@

Member Functions

-

S0::S5::S6::S7::S8::f8

+

S0::S5::S6::S7::S8::f8

Synopsis

@@ -2351,7 +2351,7 @@

Synopsis

-

S0::S5::S6::S7::S9

+

S0::S5::S6::S7::S9

Synopsis

@@ -2384,7 +2384,7 @@

Member Functions

-

S0::S5::S6::S7::S9::f9

+

S0::S5::S6::S7::S9::f9

Synopsis

@@ -2400,7 +2400,7 @@

Synopsis

-

S0::S5::S6::S7::f7

+

S0::S5::S6::S7::f7

Synopsis

@@ -2416,7 +2416,7 @@

Synopsis

-

S0::S5::S6::f6

+

S0::S5::S6::f6

Synopsis

@@ -2432,7 +2432,7 @@

Synopsis

-

S0::S5::f5

+

S0::S5::f5

Synopsis

@@ -2448,7 +2448,7 @@

Synopsis

-

S0::f0

+

S0::f0

Synopsis

@@ -2464,7 +2464,7 @@

Synopsis

-

S0<0>

+

S0<0>

Synopsis

@@ -2497,7 +2497,7 @@

Derived Classes

-

S0<10>

+

S0<10>

Synopsis

@@ -2542,7 +2542,7 @@

Member Functions

-

S0<10>::S1

+

S0<10>::S1

Synopsis

@@ -2586,7 +2586,7 @@

Member Functions

-

S0<10>::S1::S2

+

S0<10>::S1::S2

Synopsis

@@ -2606,7 +2606,7 @@

Synopsis

-

S0<10>::S1::S2<11>

+

S0<10>::S1::S2<11>

Synopsis

@@ -2651,7 +2651,7 @@

Member Functions

-

S0<10>::S1::S2<11>::S3

+

S0<10>::S1::S2<11>::S3

Synopsis

@@ -2668,7 +2668,7 @@

Synopsis

-

S0<10>::S1::S2<11>::S4

+

S0<10>::S1::S2<11>::S4

Synopsis

@@ -2703,7 +2703,7 @@

Derived Classes

-

S0<10>::S1::S2<11>::f2

+

S0<10>::S1::S2<11>::f2

Synopsis

@@ -2719,7 +2719,7 @@

Synopsis

-

S0<10>::S1::f1

+

S0<10>::S1::f1

Synopsis

@@ -2735,7 +2735,7 @@

Synopsis

-

S0<10>::S5

+

S0<10>::S5

Synopsis

@@ -2755,7 +2755,7 @@

Synopsis

-

S0<10>::f0

+

S0<10>::f0

Synopsis

@@ -2771,7 +2771,7 @@

Synopsis

-

S0<12>

+

S0<12>

Synopsis

@@ -2816,7 +2816,7 @@

Member Functions

-

S0<12>::S1

+

S0<12>::S1

Synopsis

@@ -2860,7 +2860,7 @@

Member Functions

-

S0<12>::S1::S2

+

S0<12>::S1::S2

Synopsis

@@ -2880,7 +2880,7 @@

Synopsis

-

S0<12>::S1::S2<13>

+

S0<12>::S1::S2<13>

Synopsis

@@ -2926,7 +2926,7 @@

Member Functions

-

S0<12>::S1::S2<13>::S3

+

S0<12>::S1::S2<13>::S3

Synopsis

@@ -2943,7 +2943,7 @@

Synopsis

-

S0<12>::S1::S2<13>::S4

+

S0<12>::S1::S2<13>::S4

Synopsis

@@ -2963,7 +2963,7 @@

Synopsis

-

S0<12>::S1::S2<13>::S4<14>

+

S0<12>::S1::S2<13>::S4<14>

Synopsis

@@ -2996,7 +2996,7 @@

Derived Classes

-

S0<12>::S1::S2<13>::f2

+

S0<12>::S1::S2<13>::f2

Synopsis

@@ -3012,7 +3012,7 @@

Synopsis

-

S0<12>::S1::f1

+

S0<12>::S1::f1

Synopsis

@@ -3028,7 +3028,7 @@

Synopsis

-

S0<12>::S5

+

S0<12>::S5

Synopsis

@@ -3048,7 +3048,7 @@

Synopsis

-

S0<12>::f0

+

S0<12>::f0

Synopsis

@@ -3064,7 +3064,7 @@

Synopsis

-

S0<15>

+

S0<15>

Synopsis

@@ -3109,7 +3109,7 @@

Member Functions

-

S0<15>::S1

+

S0<15>::S1

Synopsis

@@ -3153,7 +3153,7 @@

Member Functions

-

S0<15>::S1::S2

+

S0<15>::S1::S2

Synopsis

@@ -3173,7 +3173,7 @@

Synopsis

-

S0<15>::S1::S2<16>

+

S0<15>::S1::S2<16>

Synopsis

@@ -3220,7 +3220,7 @@

Member Functions

-

S0<15>::S1::S2<16>::S3

+

S0<15>::S1::S2<16>::S3

Synopsis

@@ -3237,7 +3237,7 @@

Synopsis

-

S0<15>::S1::S2<16>::S4

+

S0<15>::S1::S2<16>::S4

Synopsis

@@ -3272,7 +3272,7 @@

Derived Classes

-

S0<15>::S1::S2<16>::S4<17, int*>

+

S0<15>::S1::S2<16>::S4<17, int*>

Synopsis

@@ -3305,7 +3305,7 @@

Derived Classes

-

S0<15>::S1::S2<16>::S4<17, T*>

+

S0<15>::S1::S2<16>::S4<17, T*>

Synopsis

@@ -3323,7 +3323,7 @@

Synopsis

-

S0<15>::S1::S2<16>::f2

+

S0<15>::S1::S2<16>::f2

Synopsis

@@ -3339,7 +3339,7 @@

Synopsis

-

S0<15>::S1::f1

+

S0<15>::S1::f1

Synopsis

@@ -3355,7 +3355,7 @@

Synopsis

-

S0<15>::S5

+

S0<15>::S5

Synopsis

@@ -3375,7 +3375,7 @@

Synopsis

-

S0<15>::f0

+

S0<15>::f0

Synopsis

@@ -3391,7 +3391,7 @@

Synopsis

-

S0<18>

+

S0<18>

Synopsis

@@ -3436,7 +3436,7 @@

Member Functions

-

S0<18>::S1

+

S0<18>::S1

Synopsis

@@ -3453,7 +3453,7 @@

Synopsis

-

S0<18>::S5

+

S0<18>::S5

Synopsis

@@ -3488,7 +3488,7 @@

Derived Classes

-

S0<18>::f0

+

S0<18>::f0

Synopsis

@@ -3504,7 +3504,7 @@

Synopsis

-

S0<19>

+

S0<19>

Synopsis

@@ -3550,7 +3550,7 @@

Member Functions

-

S0<19>::S1

+

S0<19>::S1

Synopsis

@@ -3567,7 +3567,7 @@

Synopsis

-

S0<19>::S5

+

S0<19>::S5

Synopsis

@@ -3587,7 +3587,7 @@

Synopsis

-

S0<19>::S5<20>

+

S0<19>::S5<20>

Synopsis

@@ -3620,7 +3620,7 @@

Derived Classes

-

S0<19>::f0

+

S0<19>::f0

Synopsis

@@ -3636,7 +3636,7 @@

Synopsis

-

S0<2>

+

S0<2>

Synopsis

@@ -3681,7 +3681,7 @@

Member Functions

-

S0<2>::S1

+

S0<2>::S1

Synopsis

@@ -3713,7 +3713,7 @@

Derived Classes

-

S0<2>::S5

+

S0<2>::S5

Synopsis

@@ -3733,7 +3733,7 @@

Synopsis

-

S0<2>::f0

+

S0<2>::f0

Synopsis

@@ -3749,7 +3749,7 @@

Synopsis

-

S0<21>

+

S0<21>

Synopsis

@@ -3796,7 +3796,7 @@

Member Functions

-

S0<21>::S1

+

S0<21>::S1

Synopsis

@@ -3813,7 +3813,7 @@

Synopsis

-

S0<21>::S5

+

S0<21>::S5

Synopsis

@@ -3848,7 +3848,7 @@

Derived Classes

-

S0<21>::S5<22, int*>

+

S0<21>::S5<22, int*>

Synopsis

@@ -3881,7 +3881,7 @@

Derived Classes

-

S0<21>::S5<22, T*>

+

S0<21>::S5<22, T*>

Synopsis

@@ -3899,7 +3899,7 @@

Synopsis

-

S0<21>::f0

+

S0<21>::f0

Synopsis

@@ -3915,7 +3915,7 @@

Synopsis

-

S0<23>

+

S0<23>

Synopsis

@@ -3961,7 +3961,7 @@

Member Functions

-

S0<23>::S1

+

S0<23>::S1

Synopsis

@@ -3978,7 +3978,7 @@

Synopsis

-

S0<23>::S5

+

S0<23>::S5

Synopsis

@@ -3998,7 +3998,7 @@

Synopsis

-

S0<23>::S5<24>

+

S0<23>::S5<24>

Synopsis

@@ -4042,7 +4042,7 @@

Member Functions

-

S0<23>::S5<24>::S6

+

S0<23>::S5<24>::S6

Synopsis

@@ -4074,7 +4074,7 @@

Derived Classes

-

S0<23>::S5<24>::f5

+

S0<23>::S5<24>::f5

Synopsis

@@ -4090,7 +4090,7 @@

Synopsis

-

S0<23>::f0

+

S0<23>::f0

Synopsis

@@ -4106,7 +4106,7 @@

Synopsis

-

S0<25>

+

S0<25>

Synopsis

@@ -4152,7 +4152,7 @@

Member Functions

-

S0<25>::S1

+

S0<25>::S1

Synopsis

@@ -4169,7 +4169,7 @@

Synopsis

-

S0<25>::S5

+

S0<25>::S5

Synopsis

@@ -4189,7 +4189,7 @@

Synopsis

-

S0<25>::S5<26>

+

S0<25>::S5<26>

Synopsis

@@ -4233,7 +4233,7 @@

Member Functions

-

S0<25>::S5<26>::S6

+

S0<25>::S5<26>::S6

Synopsis

@@ -4276,7 +4276,7 @@

Member Functions

-

S0<25>::S5<26>::S6::S7

+

S0<25>::S5<26>::S6::S7

Synopsis

@@ -4311,7 +4311,7 @@

Derived Classes

-

S0<25>::S5<26>::S6::f6

+

S0<25>::S5<26>::S6::f6

Synopsis

@@ -4327,7 +4327,7 @@

Synopsis

-

S0<25>::S5<26>::f5

+

S0<25>::S5<26>::f5

Synopsis

@@ -4343,7 +4343,7 @@

Synopsis

-

S0<25>::f0

+

S0<25>::f0

Synopsis

@@ -4359,7 +4359,7 @@

Synopsis

-

S0<27>

+

S0<27>

Synopsis

@@ -4405,7 +4405,7 @@

Member Functions

-

S0<27>::S1

+

S0<27>::S1

Synopsis

@@ -4422,7 +4422,7 @@

Synopsis

-

S0<27>::S5

+

S0<27>::S5

Synopsis

@@ -4442,7 +4442,7 @@

Synopsis

-

S0<27>::S5<28>

+

S0<27>::S5<28>

Synopsis

@@ -4486,7 +4486,7 @@

Member Functions

-

S0<27>::S5<28>::S6

+

S0<27>::S5<28>::S6

Synopsis

@@ -4531,7 +4531,7 @@

Member Functions

-

S0<27>::S5<28>::S6::S7

+

S0<27>::S5<28>::S6::S7

Synopsis

@@ -4566,7 +4566,7 @@

Derived Classes

-

S0<27>::S5<28>::S6::S7<29, int*>

+

S0<27>::S5<28>::S6::S7<29, int*>

Synopsis

@@ -4599,7 +4599,7 @@

Derived Classes

-

S0<27>::S5<28>::S6::S7<29, T*>

+

S0<27>::S5<28>::S6::S7<29, T*>

Synopsis

@@ -4617,7 +4617,7 @@

Synopsis

-

S0<27>::S5<28>::S6::f6

+

S0<27>::S5<28>::S6::f6

Synopsis

@@ -4633,7 +4633,7 @@

Synopsis

-

S0<27>::S5<28>::f5

+

S0<27>::S5<28>::f5

Synopsis

@@ -4649,7 +4649,7 @@

Synopsis

-

S0<27>::f0

+

S0<27>::f0

Synopsis

@@ -4665,7 +4665,7 @@

Synopsis

-

S0<3>

+

S0<3>

Synopsis

@@ -4710,7 +4710,7 @@

Member Functions

-

S0<3>::S1

+

S0<3>::S1

Synopsis

@@ -4753,7 +4753,7 @@

Member Functions

-

S0<3>::S1::S2

+

S0<3>::S1::S2

Synopsis

@@ -4788,7 +4788,7 @@

Derived Classes

-

S0<3>::S1::f1

+

S0<3>::S1::f1

Synopsis

@@ -4804,7 +4804,7 @@

Synopsis

-

S0<3>::S5

+

S0<3>::S5

Synopsis

@@ -4824,7 +4824,7 @@

Synopsis

-

S0<3>::f0

+

S0<3>::f0

Synopsis

@@ -4840,7 +4840,7 @@

Synopsis

-

S0<30>

+

S0<30>

Synopsis

@@ -4886,7 +4886,7 @@

Member Functions

-

S0<30>::S1

+

S0<30>::S1

Synopsis

@@ -4903,7 +4903,7 @@

Synopsis

-

S0<30>::S5

+

S0<30>::S5

Synopsis

@@ -4923,7 +4923,7 @@

Synopsis

-

S0<30>::S5<31>

+

S0<30>::S5<31>

Synopsis

@@ -4967,7 +4967,7 @@

Member Functions

-

S0<30>::S5<31>::S6

+

S0<30>::S5<31>::S6

Synopsis

@@ -5011,7 +5011,7 @@

Member Functions

-

S0<30>::S5<31>::S6::S7

+

S0<30>::S5<31>::S6::S7

Synopsis

@@ -5031,7 +5031,7 @@

Synopsis

-

S0<30>::S5<31>::S6::S7<32>

+

S0<30>::S5<31>::S6::S7<32>

Synopsis

@@ -5064,7 +5064,7 @@

Derived Classes

-

S0<30>::S5<31>::S6::f6

+

S0<30>::S5<31>::S6::f6

Synopsis

@@ -5080,7 +5080,7 @@

Synopsis

-

S0<30>::S5<31>::f5

+

S0<30>::S5<31>::f5

Synopsis

@@ -5096,7 +5096,7 @@

Synopsis

-

S0<30>::f0

+

S0<30>::f0

Synopsis

@@ -5112,7 +5112,7 @@

Synopsis

-

S0<33>

+

S0<33>

Synopsis

@@ -5158,7 +5158,7 @@

Member Functions

-

S0<33>::S1

+

S0<33>::S1

Synopsis

@@ -5175,7 +5175,7 @@

Synopsis

-

S0<33>::S5

+

S0<33>::S5

Synopsis

@@ -5195,7 +5195,7 @@

Synopsis

-

S0<33>::S5<34>

+

S0<33>::S5<34>

Synopsis

@@ -5239,7 +5239,7 @@

Member Functions

-

S0<33>::S5<34>::S6

+

S0<33>::S5<34>::S6

Synopsis

@@ -5283,7 +5283,7 @@

Member Functions

-

S0<33>::S5<34>::S6::S7

+

S0<33>::S5<34>::S6::S7

Synopsis

@@ -5303,7 +5303,7 @@

Synopsis

-

S0<33>::S5<34>::S6::S7<35>

+

S0<33>::S5<34>::S6::S7<35>

Synopsis

@@ -5348,7 +5348,7 @@

Member Functions

-

S0<33>::S5<34>::S6::S7<35>::S8

+

S0<33>::S5<34>::S6::S7<35>::S8

Synopsis

@@ -5380,7 +5380,7 @@

Derived Classes

-

S0<33>::S5<34>::S6::S7<35>::S9

+

S0<33>::S5<34>::S6::S7<35>::S9

Synopsis

@@ -5400,7 +5400,7 @@

Synopsis

-

S0<33>::S5<34>::S6::S7<35>::f7

+

S0<33>::S5<34>::S6::S7<35>::f7

Synopsis

@@ -5416,7 +5416,7 @@

Synopsis

-

S0<33>::S5<34>::S6::f6

+

S0<33>::S5<34>::S6::f6

Synopsis

@@ -5432,7 +5432,7 @@

Synopsis

-

S0<33>::S5<34>::f5

+

S0<33>::S5<34>::f5

Synopsis

@@ -5448,7 +5448,7 @@

Synopsis

-

S0<33>::f0

+

S0<33>::f0

Synopsis

@@ -5464,7 +5464,7 @@

Synopsis

-

S0<36>

+

S0<36>

Synopsis

@@ -5510,7 +5510,7 @@

Member Functions

-

S0<36>::S1

+

S0<36>::S1

Synopsis

@@ -5527,7 +5527,7 @@

Synopsis

-

S0<36>::S5

+

S0<36>::S5

Synopsis

@@ -5547,7 +5547,7 @@

Synopsis

-

S0<36>::S5<37>

+

S0<36>::S5<37>

Synopsis

@@ -5591,7 +5591,7 @@

Member Functions

-

S0<36>::S5<37>::S6

+

S0<36>::S5<37>::S6

Synopsis

@@ -5635,7 +5635,7 @@

Member Functions

-

S0<36>::S5<37>::S6::S7

+

S0<36>::S5<37>::S6::S7

Synopsis

@@ -5655,7 +5655,7 @@

Synopsis

-

S0<36>::S5<37>::S6::S7<38>

+

S0<36>::S5<37>::S6::S7<38>

Synopsis

@@ -5700,7 +5700,7 @@

Member Functions

-

S0<36>::S5<37>::S6::S7<38>::S8

+

S0<36>::S5<37>::S6::S7<38>::S8

Synopsis

@@ -5717,7 +5717,7 @@

Synopsis

-

S0<36>::S5<37>::S6::S7<38>::S9

+

S0<36>::S5<37>::S6::S7<38>::S9

Synopsis

@@ -5752,7 +5752,7 @@

Derived Classes

-

S0<36>::S5<37>::S6::S7<38>::f7

+

S0<36>::S5<37>::S6::S7<38>::f7

Synopsis

@@ -5768,7 +5768,7 @@

Synopsis

-

S0<36>::S5<37>::S6::f6

+

S0<36>::S5<37>::S6::f6

Synopsis

@@ -5784,7 +5784,7 @@

Synopsis

-

S0<36>::S5<37>::f5

+

S0<36>::S5<37>::f5

Synopsis

@@ -5800,7 +5800,7 @@

Synopsis

-

S0<36>::f0

+

S0<36>::f0

Synopsis

@@ -5816,7 +5816,7 @@

Synopsis

-

S0<39>

+

S0<39>

Synopsis

@@ -5862,7 +5862,7 @@

Member Functions

-

S0<39>::S1

+

S0<39>::S1

Synopsis

@@ -5879,7 +5879,7 @@

Synopsis

-

S0<39>::S5

+

S0<39>::S5

Synopsis

@@ -5899,7 +5899,7 @@

Synopsis

-

S0<39>::S5<40>

+

S0<39>::S5<40>

Synopsis

@@ -5943,7 +5943,7 @@

Member Functions

-

S0<39>::S5<40>::S6

+

S0<39>::S5<40>::S6

Synopsis

@@ -5987,7 +5987,7 @@

Member Functions

-

S0<39>::S5<40>::S6::S7

+

S0<39>::S5<40>::S6::S7

Synopsis

@@ -6007,7 +6007,7 @@

Synopsis

-

S0<39>::S5<40>::S6::S7<41>

+

S0<39>::S5<40>::S6::S7<41>

Synopsis

@@ -6054,7 +6054,7 @@

Member Functions

-

S0<39>::S5<40>::S6::S7<41>::S8

+

S0<39>::S5<40>::S6::S7<41>::S8

Synopsis

@@ -6071,7 +6071,7 @@

Synopsis

-

S0<39>::S5<40>::S6::S7<41>::S9

+

S0<39>::S5<40>::S6::S7<41>::S9

Synopsis

@@ -6106,7 +6106,7 @@

Derived Classes

-

S0<39>::S5<40>::S6::S7<41>::S9<42, int*>

+

S0<39>::S5<40>::S6::S7<41>::S9<42, int*>

Synopsis

@@ -6139,7 +6139,7 @@

Derived Classes

-

S0<39>::S5<40>::S6::S7<41>::S9<42, T*>

+

S0<39>::S5<40>::S6::S7<41>::S9<42, T*>

Synopsis

@@ -6157,7 +6157,7 @@

Synopsis

-

S0<39>::S5<40>::S6::S7<41>::f7

+

S0<39>::S5<40>::S6::S7<41>::f7

Synopsis

@@ -6173,7 +6173,7 @@

Synopsis

-

S0<39>::S5<40>::S6::f6

+

S0<39>::S5<40>::S6::f6

Synopsis

@@ -6189,7 +6189,7 @@

Synopsis

-

S0<39>::S5<40>::f5

+

S0<39>::S5<40>::f5

Synopsis

@@ -6205,7 +6205,7 @@

Synopsis

-

S0<39>::f0

+

S0<39>::f0

Synopsis

@@ -6221,7 +6221,7 @@

Synopsis

-

S0<4>

+

S0<4>

Synopsis

@@ -6266,7 +6266,7 @@

Member Functions

-

S0<4>::S1

+

S0<4>::S1

Synopsis

@@ -6310,7 +6310,7 @@

Member Functions

-

S0<4>::S1::S2

+

S0<4>::S1::S2

Synopsis

@@ -6330,7 +6330,7 @@

Synopsis

-

S0<4>::S1::S2<5>

+

S0<4>::S1::S2<5>

Synopsis

@@ -6363,7 +6363,7 @@

Derived Classes

-

S0<4>::S1::f1

+

S0<4>::S1::f1

Synopsis

@@ -6379,7 +6379,7 @@

Synopsis

-

S0<4>::S5

+

S0<4>::S5

Synopsis

@@ -6399,7 +6399,7 @@

Synopsis

-

S0<4>::f0

+

S0<4>::f0

Synopsis

@@ -6415,7 +6415,7 @@

Synopsis

-

S0<43>

+

S0<43>

Synopsis

@@ -6461,7 +6461,7 @@

Member Functions

-

S0<43>::S1

+

S0<43>::S1

Synopsis

@@ -6478,7 +6478,7 @@

Synopsis

-

S0<43>::S5

+

S0<43>::S5

Synopsis

@@ -6498,7 +6498,7 @@

Synopsis

-

S0<43>::S5<44>

+

S0<43>::S5<44>

Synopsis

@@ -6542,7 +6542,7 @@

Member Functions

-

S0<43>::S5<44>::S6

+

S0<43>::S5<44>::S6

Synopsis

@@ -6586,7 +6586,7 @@

Member Functions

-

S0<43>::S5<44>::S6::S7

+

S0<43>::S5<44>::S6::S7

Synopsis

@@ -6606,7 +6606,7 @@

Synopsis

-

S0<43>::S5<44>::S6::S7<45>

+

S0<43>::S5<44>::S6::S7<45>

Synopsis

@@ -6652,7 +6652,7 @@

Member Functions

-

S0<43>::S5<44>::S6::S7<45>::S8

+

S0<43>::S5<44>::S6::S7<45>::S8

Synopsis

@@ -6669,7 +6669,7 @@

Synopsis

-

S0<43>::S5<44>::S6::S7<45>::S9

+

S0<43>::S5<44>::S6::S7<45>::S9

Synopsis

@@ -6689,7 +6689,7 @@

Synopsis

-

S0<43>::S5<44>::S6::S7<45>::S9<46>

+

S0<43>::S5<44>::S6::S7<45>::S9<46>

Synopsis

@@ -6722,7 +6722,7 @@

Derived Classes

-

S0<43>::S5<44>::S6::S7<45>::f7

+

S0<43>::S5<44>::S6::S7<45>::f7

Synopsis

@@ -6738,7 +6738,7 @@

Synopsis

-

S0<43>::S5<44>::S6::f6

+

S0<43>::S5<44>::S6::f6

Synopsis

@@ -6754,7 +6754,7 @@

Synopsis

-

S0<43>::S5<44>::f5

+

S0<43>::S5<44>::f5

Synopsis

@@ -6770,7 +6770,7 @@

Synopsis

-

S0<43>::f0

+

S0<43>::f0

Synopsis

@@ -6786,7 +6786,7 @@

Synopsis

-

S0<6>

+

S0<6>

Synopsis

@@ -6831,7 +6831,7 @@

Member Functions

-

S0<6>::S1

+

S0<6>::S1

Synopsis

@@ -6876,7 +6876,7 @@

Member Functions

-

S0<6>::S1::S2

+

S0<6>::S1::S2

Synopsis

@@ -6911,7 +6911,7 @@

Derived Classes

-

S0<6>::S1::S2<7, int*>

+

S0<6>::S1::S2<7, int*>

Synopsis

@@ -6944,7 +6944,7 @@

Derived Classes

-

S0<6>::S1::S2<7, T*>

+

S0<6>::S1::S2<7, T*>

Synopsis

@@ -6962,7 +6962,7 @@

Synopsis

-

S0<6>::S1::f1

+

S0<6>::S1::f1

Synopsis

@@ -6978,7 +6978,7 @@

Synopsis

-

S0<6>::S5

+

S0<6>::S5

Synopsis

@@ -6998,7 +6998,7 @@

Synopsis

-

S0<6>::f0

+

S0<6>::f0

Synopsis

@@ -7014,7 +7014,7 @@

Synopsis

-

S0<8>

+

S0<8>

Synopsis

@@ -7059,7 +7059,7 @@

Member Functions

-

S0<8>::S1

+

S0<8>::S1

Synopsis

@@ -7103,7 +7103,7 @@

Member Functions

-

S0<8>::S1::S2

+

S0<8>::S1::S2

Synopsis

@@ -7123,7 +7123,7 @@

Synopsis

-

S0<8>::S1::S2<9>

+

S0<8>::S1::S2<9>

Synopsis

@@ -7168,7 +7168,7 @@

Member Functions

-

S0<8>::S1::S2<9>::S3

+

S0<8>::S1::S2<9>::S3

Synopsis

@@ -7200,7 +7200,7 @@

Derived Classes

-

S0<8>::S1::S2<9>::S4

+

S0<8>::S1::S2<9>::S4

Synopsis

@@ -7220,7 +7220,7 @@

Synopsis

-

S0<8>::S1::S2<9>::f2

+

S0<8>::S1::S2<9>::f2

Synopsis

@@ -7236,7 +7236,7 @@

Synopsis

-

S0<8>::S1::f1

+

S0<8>::S1::f1

Synopsis

@@ -7252,7 +7252,7 @@

Synopsis

-

S0<8>::S5

+

S0<8>::S5

Synopsis

@@ -7272,7 +7272,7 @@

Synopsis

-

S0<8>::f0

+

S0<8>::f0

Synopsis

@@ -7288,7 +7288,7 @@

Synopsis

-

S0<1, int*>

+

S0<1, int*>

Synopsis

@@ -7321,7 +7321,7 @@

Derived Classes

-

S0<10, bool>

+

S0<10, bool>

Synopsis

@@ -7366,7 +7366,7 @@

Member Functions

-

S0<10, bool>::S1

+

S0<10, bool>::S1

Synopsis

@@ -7410,7 +7410,7 @@

Member Functions

-

S0<10, bool>::S1::S2

+

S0<10, bool>::S1::S2

Synopsis

@@ -7430,7 +7430,7 @@

Synopsis

-

S0<10, bool>::S1::S2<11, bool>

+

S0<10, bool>::S1::S2<11, bool>

Synopsis

@@ -7475,7 +7475,7 @@

Member Functions

-

S0<10, bool>::S1::S2<11, bool>::S3

+

S0<10, bool>::S1::S2<11, bool>::S3

Synopsis

@@ -7492,7 +7492,7 @@

Synopsis

-

S0<10, bool>::S1::S2<11, bool>::S4

+

S0<10, bool>::S1::S2<11, bool>::S4

Synopsis

@@ -7527,7 +7527,7 @@

Derived Classes

-

S0<10, bool>::S1::S2<11, bool>::f2

+

S0<10, bool>::S1::S2<11, bool>::f2

Synopsis

@@ -7543,7 +7543,7 @@

Synopsis

-

S0<10, bool>::S1::f1

+

S0<10, bool>::S1::f1

Synopsis

@@ -7559,7 +7559,7 @@

Synopsis

-

S0<10, bool>::S5

+

S0<10, bool>::S5

Synopsis

@@ -7579,7 +7579,7 @@

Synopsis

-

S0<10, bool>::f0

+

S0<10, bool>::f0

Synopsis

@@ -7595,7 +7595,7 @@

Synopsis

-

S0<12, bool>

+

S0<12, bool>

Synopsis

@@ -7640,7 +7640,7 @@

Member Functions

-

S0<12, bool>::S1

+

S0<12, bool>::S1

Synopsis

@@ -7684,7 +7684,7 @@

Member Functions

-

S0<12, bool>::S1::S2

+

S0<12, bool>::S1::S2

Synopsis

@@ -7704,7 +7704,7 @@

Synopsis

-

S0<12, bool>::S1::S2<13, bool>

+

S0<12, bool>::S1::S2<13, bool>

Synopsis

@@ -7749,7 +7749,7 @@

Member Functions

-

S0<12, bool>::S1::S2<13, bool>::S3

+

S0<12, bool>::S1::S2<13, bool>::S3

Synopsis

@@ -7766,7 +7766,7 @@

Synopsis

-

S0<12, bool>::S1::S2<13, bool>::S4

+

S0<12, bool>::S1::S2<13, bool>::S4

Synopsis

@@ -7801,7 +7801,7 @@

Derived Classes

-

S0<12, bool>::S1::S2<13, bool>::f2

+

S0<12, bool>::S1::S2<13, bool>::f2

Synopsis

@@ -7817,7 +7817,7 @@

Synopsis

-

S0<12, bool>::S1::f1

+

S0<12, bool>::S1::f1

Synopsis

@@ -7833,7 +7833,7 @@

Synopsis

-

S0<12, bool>::S5

+

S0<12, bool>::S5

Synopsis

@@ -7853,7 +7853,7 @@

Synopsis

-

S0<12, bool>::f0

+

S0<12, bool>::f0

Synopsis

@@ -7869,7 +7869,7 @@

Synopsis

-

S0<15, bool>

+

S0<15, bool>

Synopsis

@@ -7914,7 +7914,7 @@

Member Functions

-

S0<15, bool>::S1

+

S0<15, bool>::S1

Synopsis

@@ -7958,7 +7958,7 @@

Member Functions

-

S0<15, bool>::S1::S2

+

S0<15, bool>::S1::S2

Synopsis

@@ -7978,7 +7978,7 @@

Synopsis

-

S0<15, bool>::S1::S2<16, bool>

+

S0<15, bool>::S1::S2<16, bool>

Synopsis

@@ -8023,7 +8023,7 @@

Member Functions

-

S0<15, bool>::S1::S2<16, bool>::S3

+

S0<15, bool>::S1::S2<16, bool>::S3

Synopsis

@@ -8040,7 +8040,7 @@

Synopsis

-

S0<15, bool>::S1::S2<16, bool>::S4

+

S0<15, bool>::S1::S2<16, bool>::S4

Synopsis

@@ -8075,7 +8075,7 @@

Derived Classes

-

S0<15, bool>::S1::S2<16, bool>::f2

+

S0<15, bool>::S1::S2<16, bool>::f2

Synopsis

@@ -8091,7 +8091,7 @@

Synopsis

-

S0<15, bool>::S1::f1

+

S0<15, bool>::S1::f1

Synopsis

@@ -8107,7 +8107,7 @@

Synopsis

-

S0<15, bool>::S5

+

S0<15, bool>::S5

Synopsis

@@ -8127,7 +8127,7 @@

Synopsis

-

S0<15, bool>::f0

+

S0<15, bool>::f0

Synopsis

@@ -8143,7 +8143,7 @@

Synopsis

-

S0<18, bool>

+

S0<18, bool>

Synopsis

@@ -8188,7 +8188,7 @@

Member Functions

-

S0<18, bool>::S1

+

S0<18, bool>::S1

Synopsis

@@ -8205,7 +8205,7 @@

Synopsis

-

S0<18, bool>::S5

+

S0<18, bool>::S5

Synopsis

@@ -8240,7 +8240,7 @@

Derived Classes

-

S0<18, bool>::f0

+

S0<18, bool>::f0

Synopsis

@@ -8256,7 +8256,7 @@

Synopsis

-

S0<19, bool>

+

S0<19, bool>

Synopsis

@@ -8301,7 +8301,7 @@

Member Functions

-

S0<19, bool>::S1

+

S0<19, bool>::S1

Synopsis

@@ -8318,7 +8318,7 @@

Synopsis

-

S0<19, bool>::S5

+

S0<19, bool>::S5

Synopsis

@@ -8353,7 +8353,7 @@

Derived Classes

-

S0<19, bool>::f0

+

S0<19, bool>::f0

Synopsis

@@ -8369,7 +8369,7 @@

Synopsis

-

S0<2, bool>

+

S0<2, bool>

Synopsis

@@ -8414,7 +8414,7 @@

Member Functions

-

S0<2, bool>::S1

+

S0<2, bool>::S1

Synopsis

@@ -8472,7 +8472,7 @@

Derived Classes

-

S0<2, bool>::S1::S2

+

S0<2, bool>::S1::S2

Synopsis

@@ -8492,7 +8492,7 @@

Synopsis

-

S0<2, bool>::S1::f1

+

S0<2, bool>::S1::f1

Synopsis

@@ -8508,7 +8508,7 @@

Synopsis

-

S0<2, bool>::S5

+

S0<2, bool>::S5

Synopsis

@@ -8528,7 +8528,7 @@

Synopsis

-

S0<2, bool>::f0

+

S0<2, bool>::f0

Synopsis

@@ -8544,7 +8544,7 @@

Synopsis

-

S0<21, bool>

+

S0<21, bool>

Synopsis

@@ -8589,7 +8589,7 @@

Member Functions

-

S0<21, bool>::S1

+

S0<21, bool>::S1

Synopsis

@@ -8606,7 +8606,7 @@

Synopsis

-

S0<21, bool>::S5

+

S0<21, bool>::S5

Synopsis

@@ -8641,7 +8641,7 @@

Derived Classes

-

S0<21, bool>::f0

+

S0<21, bool>::f0

Synopsis

@@ -8657,7 +8657,7 @@

Synopsis

-

S0<23, bool>

+

S0<23, bool>

Synopsis

@@ -8703,7 +8703,7 @@

Member Functions

-

S0<23, bool>::S1

+

S0<23, bool>::S1

Synopsis

@@ -8720,7 +8720,7 @@

Synopsis

-

S0<23, bool>::S5

+

S0<23, bool>::S5

Synopsis

@@ -8740,7 +8740,7 @@

Synopsis

-

S0<23, bool>::S5<24, bool>

+

S0<23, bool>::S5<24, bool>

Synopsis

@@ -8784,7 +8784,7 @@

Member Functions

-

S0<23, bool>::S5<24, bool>::S6

+

S0<23, bool>::S5<24, bool>::S6

Synopsis

@@ -8842,7 +8842,7 @@

Derived Classes

-

S0<23, bool>::S5<24, bool>::S6::S7

+

S0<23, bool>::S5<24, bool>::S6::S7

Synopsis

@@ -8862,7 +8862,7 @@

Synopsis

-

S0<23, bool>::S5<24, bool>::S6::f6

+

S0<23, bool>::S5<24, bool>::S6::f6

Synopsis

@@ -8878,7 +8878,7 @@

Synopsis

-

S0<23, bool>::S5<24, bool>::f5

+

S0<23, bool>::S5<24, bool>::f5

Synopsis

@@ -8894,7 +8894,7 @@

Synopsis

-

S0<23, bool>::f0

+

S0<23, bool>::f0

Synopsis

@@ -8910,7 +8910,7 @@

Synopsis

-

S0<25, bool>

+

S0<25, bool>

Synopsis

@@ -8956,7 +8956,7 @@

Member Functions

-

S0<25, bool>::S1

+

S0<25, bool>::S1

Synopsis

@@ -8973,7 +8973,7 @@

Synopsis

-

S0<25, bool>::S5

+

S0<25, bool>::S5

Synopsis

@@ -8993,7 +8993,7 @@

Synopsis

-

S0<25, bool>::S5<26, bool>

+

S0<25, bool>::S5<26, bool>

Synopsis

@@ -9037,7 +9037,7 @@

Member Functions

-

S0<25, bool>::S5<26, bool>::S6

+

S0<25, bool>::S5<26, bool>::S6

Synopsis

@@ -9080,7 +9080,7 @@

Member Functions

-

S0<25, bool>::S5<26, bool>::S6::S7

+

S0<25, bool>::S5<26, bool>::S6::S7

Synopsis

@@ -9115,7 +9115,7 @@

Derived Classes

-

S0<25, bool>::S5<26, bool>::S6::f6

+

S0<25, bool>::S5<26, bool>::S6::f6

Synopsis

@@ -9131,7 +9131,7 @@

Synopsis

-

S0<25, bool>::S5<26, bool>::f5

+

S0<25, bool>::S5<26, bool>::f5

Synopsis

@@ -9147,7 +9147,7 @@

Synopsis

-

S0<25, bool>::f0

+

S0<25, bool>::f0

Synopsis

@@ -9163,7 +9163,7 @@

Synopsis

-

S0<27, bool>

+

S0<27, bool>

Synopsis

@@ -9209,7 +9209,7 @@

Member Functions

-

S0<27, bool>::S1

+

S0<27, bool>::S1

Synopsis

@@ -9226,7 +9226,7 @@

Synopsis

-

S0<27, bool>::S5

+

S0<27, bool>::S5

Synopsis

@@ -9246,7 +9246,7 @@

Synopsis

-

S0<27, bool>::S5<28, bool>

+

S0<27, bool>::S5<28, bool>

Synopsis

@@ -9290,7 +9290,7 @@

Member Functions

-

S0<27, bool>::S5<28, bool>::S6

+

S0<27, bool>::S5<28, bool>::S6

Synopsis

@@ -9333,7 +9333,7 @@

Member Functions

-

S0<27, bool>::S5<28, bool>::S6::S7

+

S0<27, bool>::S5<28, bool>::S6::S7

Synopsis

@@ -9368,7 +9368,7 @@

Derived Classes

-

S0<27, bool>::S5<28, bool>::S6::f6

+

S0<27, bool>::S5<28, bool>::S6::f6

Synopsis

@@ -9384,7 +9384,7 @@

Synopsis

-

S0<27, bool>::S5<28, bool>::f5

+

S0<27, bool>::S5<28, bool>::f5

Synopsis

@@ -9400,7 +9400,7 @@

Synopsis

-

S0<27, bool>::f0

+

S0<27, bool>::f0

Synopsis

@@ -9416,7 +9416,7 @@

Synopsis

-

S0<3, bool>

+

S0<3, bool>

Synopsis

@@ -9461,7 +9461,7 @@

Member Functions

-

S0<3, bool>::S1

+

S0<3, bool>::S1

Synopsis

@@ -9504,7 +9504,7 @@

Member Functions

-

S0<3, bool>::S1::S2

+

S0<3, bool>::S1::S2

Synopsis

@@ -9539,7 +9539,7 @@

Derived Classes

-

S0<3, bool>::S1::f1

+

S0<3, bool>::S1::f1

Synopsis

@@ -9555,7 +9555,7 @@

Synopsis

-

S0<3, bool>::S5

+

S0<3, bool>::S5

Synopsis

@@ -9575,7 +9575,7 @@

Synopsis

-

S0<3, bool>::f0

+

S0<3, bool>::f0

Synopsis

@@ -9591,7 +9591,7 @@

Synopsis

-

S0<30, bool>

+

S0<30, bool>

Synopsis

@@ -9637,7 +9637,7 @@

Member Functions

-

S0<30, bool>::S1

+

S0<30, bool>::S1

Synopsis

@@ -9654,7 +9654,7 @@

Synopsis

-

S0<30, bool>::S5

+

S0<30, bool>::S5

Synopsis

@@ -9674,7 +9674,7 @@

Synopsis

-

S0<30, bool>::S5<31, bool>

+

S0<30, bool>::S5<31, bool>

Synopsis

@@ -9718,7 +9718,7 @@

Member Functions

-

S0<30, bool>::S5<31, bool>::S6

+

S0<30, bool>::S5<31, bool>::S6

Synopsis

@@ -9761,7 +9761,7 @@

Member Functions

-

S0<30, bool>::S5<31, bool>::S6::S7

+

S0<30, bool>::S5<31, bool>::S6::S7

Synopsis

@@ -9796,7 +9796,7 @@

Derived Classes

-

S0<30, bool>::S5<31, bool>::S6::f6

+

S0<30, bool>::S5<31, bool>::S6::f6

Synopsis

@@ -9812,7 +9812,7 @@

Synopsis

-

S0<30, bool>::S5<31, bool>::f5

+

S0<30, bool>::S5<31, bool>::f5

Synopsis

@@ -9828,7 +9828,7 @@

Synopsis

-

S0<30, bool>::f0

+

S0<30, bool>::f0

Synopsis

@@ -9844,7 +9844,7 @@

Synopsis

-

S0<33, bool>

+

S0<33, bool>

Synopsis

@@ -9890,7 +9890,7 @@

Member Functions

-

S0<33, bool>::S1

+

S0<33, bool>::S1

Synopsis

@@ -9907,7 +9907,7 @@

Synopsis

-

S0<33, bool>::S5

+

S0<33, bool>::S5

Synopsis

@@ -9927,7 +9927,7 @@

Synopsis

-

S0<33, bool>::S5<34, bool>

+

S0<33, bool>::S5<34, bool>

Synopsis

@@ -9971,7 +9971,7 @@

Member Functions

-

S0<33, bool>::S5<34, bool>::S6

+

S0<33, bool>::S5<34, bool>::S6

Synopsis

@@ -10015,7 +10015,7 @@

Member Functions

-

S0<33, bool>::S5<34, bool>::S6::S7

+

S0<33, bool>::S5<34, bool>::S6::S7

Synopsis

@@ -10035,7 +10035,7 @@

Synopsis

-

S0<33, bool>::S5<34, bool>::S6::S7<35, bool>

+

S0<33, bool>::S5<34, bool>::S6::S7<35, bool>

Synopsis

@@ -10080,7 +10080,7 @@

Member Functions

-

S0<33, bool>::S5<34, bool>::S6::S7<35, bool>::S8

+

S0<33, bool>::S5<34, bool>::S6::S7<35, bool>::S8

Synopsis

@@ -10125,7 +10125,7 @@

Derived Classes

-

S0<33, bool>::S5<34, bool>::S6::S7<35, bool>::S8::f8

+

S0<33, bool>::S5<34, bool>::S6::S7<35, bool>::S8::f8

Synopsis

@@ -10141,7 +10141,7 @@

Synopsis

-

S0<33, bool>::S5<34, bool>::S6::S7<35, bool>::S9

+

S0<33, bool>::S5<34, bool>::S6::S7<35, bool>::S9

Synopsis

@@ -10161,7 +10161,7 @@

Synopsis

-

S0<33, bool>::S5<34, bool>::S6::S7<35, bool>::f7

+

S0<33, bool>::S5<34, bool>::S6::S7<35, bool>::f7

Synopsis

@@ -10177,7 +10177,7 @@

Synopsis

-

S0<33, bool>::S5<34, bool>::S6::f6

+

S0<33, bool>::S5<34, bool>::S6::f6

Synopsis

@@ -10193,7 +10193,7 @@

Synopsis

-

S0<33, bool>::S5<34, bool>::f5

+

S0<33, bool>::S5<34, bool>::f5

Synopsis

@@ -10209,7 +10209,7 @@

Synopsis

-

S0<33, bool>::f0

+

S0<33, bool>::f0

Synopsis

@@ -10225,7 +10225,7 @@

Synopsis

-

S0<36, bool>

+

S0<36, bool>

Synopsis

@@ -10271,7 +10271,7 @@

Member Functions

-

S0<36, bool>::S1

+

S0<36, bool>::S1

Synopsis

@@ -10288,7 +10288,7 @@

Synopsis

-

S0<36, bool>::S5

+

S0<36, bool>::S5

Synopsis

@@ -10308,7 +10308,7 @@

Synopsis

-

S0<36, bool>::S5<37, bool>

+

S0<36, bool>::S5<37, bool>

Synopsis

@@ -10352,7 +10352,7 @@

Member Functions

-

S0<36, bool>::S5<37, bool>::S6

+

S0<36, bool>::S5<37, bool>::S6

Synopsis

@@ -10396,7 +10396,7 @@

Member Functions

-

S0<36, bool>::S5<37, bool>::S6::S7

+

S0<36, bool>::S5<37, bool>::S6::S7

Synopsis

@@ -10416,7 +10416,7 @@

Synopsis

-

S0<36, bool>::S5<37, bool>::S6::S7<38, bool>

+

S0<36, bool>::S5<37, bool>::S6::S7<38, bool>

Synopsis

@@ -10461,7 +10461,7 @@

Member Functions

-

S0<36, bool>::S5<37, bool>::S6::S7<38, bool>::S8

+

S0<36, bool>::S5<37, bool>::S6::S7<38, bool>::S8

Synopsis

@@ -10478,7 +10478,7 @@

Synopsis

-

S0<36, bool>::S5<37, bool>::S6::S7<38, bool>::S9

+

S0<36, bool>::S5<37, bool>::S6::S7<38, bool>::S9

Synopsis

@@ -10513,7 +10513,7 @@

Derived Classes

-

S0<36, bool>::S5<37, bool>::S6::S7<38, bool>::f7

+

S0<36, bool>::S5<37, bool>::S6::S7<38, bool>::f7

Synopsis

@@ -10529,7 +10529,7 @@

Synopsis

-

S0<36, bool>::S5<37, bool>::S6::f6

+

S0<36, bool>::S5<37, bool>::S6::f6

Synopsis

@@ -10545,7 +10545,7 @@

Synopsis

-

S0<36, bool>::S5<37, bool>::f5

+

S0<36, bool>::S5<37, bool>::f5

Synopsis

@@ -10561,7 +10561,7 @@

Synopsis

-

S0<36, bool>::f0

+

S0<36, bool>::f0

Synopsis

@@ -10577,7 +10577,7 @@

Synopsis

-

S0<39, bool>

+

S0<39, bool>

Synopsis

@@ -10623,7 +10623,7 @@

Member Functions

-

S0<39, bool>::S1

+

S0<39, bool>::S1

Synopsis

@@ -10640,7 +10640,7 @@

Synopsis

-

S0<39, bool>::S5

+

S0<39, bool>::S5

Synopsis

@@ -10660,7 +10660,7 @@

Synopsis

-

S0<39, bool>::S5<40, bool>

+

S0<39, bool>::S5<40, bool>

Synopsis

@@ -10704,7 +10704,7 @@

Member Functions

-

S0<39, bool>::S5<40, bool>::S6

+

S0<39, bool>::S5<40, bool>::S6

Synopsis

@@ -10748,7 +10748,7 @@

Member Functions

-

S0<39, bool>::S5<40, bool>::S6::S7

+

S0<39, bool>::S5<40, bool>::S6::S7

Synopsis

@@ -10768,7 +10768,7 @@

Synopsis

-

S0<39, bool>::S5<40, bool>::S6::S7<41, bool>

+

S0<39, bool>::S5<40, bool>::S6::S7<41, bool>

Synopsis

@@ -10813,7 +10813,7 @@

Member Functions

-

S0<39, bool>::S5<40, bool>::S6::S7<41, bool>::S8

+

S0<39, bool>::S5<40, bool>::S6::S7<41, bool>::S8

Synopsis

@@ -10830,7 +10830,7 @@

Synopsis

-

S0<39, bool>::S5<40, bool>::S6::S7<41, bool>::S9

+

S0<39, bool>::S5<40, bool>::S6::S7<41, bool>::S9

Synopsis

@@ -10865,7 +10865,7 @@

Derived Classes

-

S0<39, bool>::S5<40, bool>::S6::S7<41, bool>::f7

+

S0<39, bool>::S5<40, bool>::S6::S7<41, bool>::f7

Synopsis

@@ -10881,7 +10881,7 @@

Synopsis

-

S0<39, bool>::S5<40, bool>::S6::f6

+

S0<39, bool>::S5<40, bool>::S6::f6

Synopsis

@@ -10897,7 +10897,7 @@

Synopsis

-

S0<39, bool>::S5<40, bool>::f5

+

S0<39, bool>::S5<40, bool>::f5

Synopsis

@@ -10913,7 +10913,7 @@

Synopsis

-

S0<39, bool>::f0

+

S0<39, bool>::f0

Synopsis

@@ -10929,7 +10929,7 @@

Synopsis

-

S0<4, bool>

+

S0<4, bool>

Synopsis

@@ -10974,7 +10974,7 @@

Member Functions

-

S0<4, bool>::S1

+

S0<4, bool>::S1

Synopsis

@@ -11017,7 +11017,7 @@

Member Functions

-

S0<4, bool>::S1::S2

+

S0<4, bool>::S1::S2

Synopsis

@@ -11052,7 +11052,7 @@

Derived Classes

-

S0<4, bool>::S1::f1

+

S0<4, bool>::S1::f1

Synopsis

@@ -11068,7 +11068,7 @@

Synopsis

-

S0<4, bool>::S5

+

S0<4, bool>::S5

Synopsis

@@ -11088,7 +11088,7 @@

Synopsis

-

S0<4, bool>::f0

+

S0<4, bool>::f0

Synopsis

@@ -11104,7 +11104,7 @@

Synopsis

-

S0<43, bool>

+

S0<43, bool>

Synopsis

@@ -11150,7 +11150,7 @@

Member Functions

-

S0<43, bool>::S1

+

S0<43, bool>::S1

Synopsis

@@ -11167,7 +11167,7 @@

Synopsis

-

S0<43, bool>::S5

+

S0<43, bool>::S5

Synopsis

@@ -11187,7 +11187,7 @@

Synopsis

-

S0<43, bool>::S5<44, bool>

+

S0<43, bool>::S5<44, bool>

Synopsis

@@ -11231,7 +11231,7 @@

Member Functions

-

S0<43, bool>::S5<44, bool>::S6

+

S0<43, bool>::S5<44, bool>::S6

Synopsis

@@ -11275,7 +11275,7 @@

Member Functions

-

S0<43, bool>::S5<44, bool>::S6::S7

+

S0<43, bool>::S5<44, bool>::S6::S7

Synopsis

@@ -11295,7 +11295,7 @@

Synopsis

-

S0<43, bool>::S5<44, bool>::S6::S7<45, bool>

+

S0<43, bool>::S5<44, bool>::S6::S7<45, bool>

Synopsis

@@ -11340,7 +11340,7 @@

Member Functions

-

S0<43, bool>::S5<44, bool>::S6::S7<45, bool>::S8

+

S0<43, bool>::S5<44, bool>::S6::S7<45, bool>::S8

Synopsis

@@ -11357,7 +11357,7 @@

Synopsis

-

S0<43, bool>::S5<44, bool>::S6::S7<45, bool>::S9

+

S0<43, bool>::S5<44, bool>::S6::S7<45, bool>::S9

Synopsis

@@ -11392,7 +11392,7 @@

Derived Classes

-

S0<43, bool>::S5<44, bool>::S6::S7<45, bool>::f7

+

S0<43, bool>::S5<44, bool>::S6::S7<45, bool>::f7

Synopsis

@@ -11408,7 +11408,7 @@

Synopsis

-

S0<43, bool>::S5<44, bool>::S6::f6

+

S0<43, bool>::S5<44, bool>::S6::f6

Synopsis

@@ -11424,7 +11424,7 @@

Synopsis

-

S0<43, bool>::S5<44, bool>::f5

+

S0<43, bool>::S5<44, bool>::f5

Synopsis

@@ -11440,7 +11440,7 @@

Synopsis

-

S0<43, bool>::f0

+

S0<43, bool>::f0

Synopsis

@@ -11456,7 +11456,7 @@

Synopsis

-

S0<6, bool>

+

S0<6, bool>

Synopsis

@@ -11501,7 +11501,7 @@

Member Functions

-

S0<6, bool>::S1

+

S0<6, bool>::S1

Synopsis

@@ -11544,7 +11544,7 @@

Member Functions

-

S0<6, bool>::S1::S2

+

S0<6, bool>::S1::S2

Synopsis

@@ -11579,7 +11579,7 @@

Derived Classes

-

S0<6, bool>::S1::f1

+

S0<6, bool>::S1::f1

Synopsis

@@ -11595,7 +11595,7 @@

Synopsis

-

S0<6, bool>::S5

+

S0<6, bool>::S5

Synopsis

@@ -11615,7 +11615,7 @@

Synopsis

-

S0<6, bool>::f0

+

S0<6, bool>::f0

Synopsis

@@ -11631,7 +11631,7 @@

Synopsis

-

S0<8, bool>

+

S0<8, bool>

Synopsis

@@ -11676,7 +11676,7 @@

Member Functions

-

S0<8, bool>::S1

+

S0<8, bool>::S1

Synopsis

@@ -11720,7 +11720,7 @@

Member Functions

-

S0<8, bool>::S1::S2

+

S0<8, bool>::S1::S2

Synopsis

@@ -11740,7 +11740,7 @@

Synopsis

-

S0<8, bool>::S1::S2<9, bool>

+

S0<8, bool>::S1::S2<9, bool>

Synopsis

@@ -11785,7 +11785,7 @@

Member Functions

-

S0<8, bool>::S1::S2<9, bool>::S3

+

S0<8, bool>::S1::S2<9, bool>::S3

Synopsis

@@ -11830,7 +11830,7 @@

Derived Classes

-

S0<8, bool>::S1::S2<9, bool>::S3::f3

+

S0<8, bool>::S1::S2<9, bool>::S3::f3

Synopsis

@@ -11846,7 +11846,7 @@

Synopsis

-

S0<8, bool>::S1::S2<9, bool>::S4

+

S0<8, bool>::S1::S2<9, bool>::S4

Synopsis

@@ -11866,7 +11866,7 @@

Synopsis

-

S0<8, bool>::S1::S2<9, bool>::f2

+

S0<8, bool>::S1::S2<9, bool>::f2

Synopsis

@@ -11882,7 +11882,7 @@

Synopsis

-

S0<8, bool>::S1::f1

+

S0<8, bool>::S1::f1

Synopsis

@@ -11898,7 +11898,7 @@

Synopsis

-

S0<8, bool>::S5

+

S0<8, bool>::S5

Synopsis

@@ -11918,7 +11918,7 @@

Synopsis

-

S0<8, bool>::f0

+

S0<8, bool>::f0

Synopsis

@@ -11934,7 +11934,7 @@

Synopsis

-

S0<1, T*>

+

S0<1, T*>

Synopsis

diff --git a/test-files/golden-tests/symbols/record/class-template-specializations-2.html b/test-files/golden-tests/symbols/record/class-template-specializations-2.html index c5bc175fd..c68232673 100644 --- a/test-files/golden-tests/symbols/record/class-template-specializations-2.html +++ b/test-files/golden-tests/symbols/record/class-template-specializations-2.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -28,7 +28,7 @@

Types

-

A

+

A

Synopsis

@@ -46,7 +46,7 @@

Synopsis

-

A<double>

+

A<double>

Synopsis

@@ -79,7 +79,7 @@

Types

-

A<double>::D

+

A<double>::D

Synopsis

@@ -111,7 +111,7 @@

Types

-

A<double>::D::E

+

A<double>::D::E

Synopsis

@@ -129,7 +129,7 @@

Synopsis

-

A<double>::D::E<T*>

+

A<double>::D::E<T*>

Synopsis

@@ -160,7 +160,7 @@

Types

-

A<double>::D::E<T*>::F

+

A<double>::D::E<T*>::F

Synopsis

@@ -177,7 +177,7 @@

Synopsis

-

A<double>::D<short>

+

A<double>::D<short>

Synopsis

@@ -209,7 +209,7 @@

Types

-

A<double>::D<short>::E

+

A<double>::D<short>::E

Synopsis

@@ -227,7 +227,7 @@

Synopsis

-

A<double>::D<short>::E<int*>

+

A<double>::D<short>::E<int*>

Synopsis

@@ -258,7 +258,7 @@

Types

-

A<double>::D<short>::E<int*>::F

+

A<double>::D<short>::E<int*>::F

Synopsis

@@ -275,7 +275,7 @@

Synopsis

-

A<double>::D<float>

+

A<double>::D<float>

Synopsis

@@ -307,7 +307,7 @@

Types

-

A<double>::D<float>::G

+

A<double>::D<float>::G

Synopsis

@@ -325,7 +325,7 @@

Synopsis

-

A<double>::D<float>::G<T*>

+

A<double>::D<float>::G<T*>

Synopsis

@@ -343,7 +343,7 @@

Synopsis

-

A<long*>

+

A<long*>

Synopsis

@@ -376,7 +376,7 @@

Types

-

A<long*>::B

+

A<long*>::B

Synopsis

@@ -394,7 +394,7 @@

Synopsis

-

A<long*>::B<int>

+

A<long*>::B<int>

Synopsis

@@ -412,7 +412,7 @@

Synopsis

-

A<long*>::B<int*>

+

A<long*>::B<int*>

Synopsis

@@ -443,7 +443,7 @@

Types

-

A<long*>::B<int*>::C

+

A<long*>::B<int*>::C

Synopsis

@@ -460,7 +460,7 @@

Synopsis

-

A<T*>

+

A<T*>

Synopsis

@@ -493,7 +493,7 @@

Types

-

A<T*>::B

+

A<T*>::B

Synopsis

@@ -511,7 +511,7 @@

Synopsis

-

A<T*>::B<int>

+

A<T*>::B<int>

Synopsis

@@ -529,7 +529,7 @@

Synopsis

-

A<T*>::B<U*>

+

A<T*>::B<U*>

Synopsis

@@ -560,7 +560,7 @@

Types

-

A<T*>::B<U*>::C

+

A<T*>::B<U*>::C

Synopsis

diff --git a/test-files/golden-tests/symbols/record/class-template-specializations-3.html b/test-files/golden-tests/symbols/record/class-template-specializations-3.html index 19476f69b..e16b4f462 100644 --- a/test-files/golden-tests/symbols/record/class-template-specializations-3.html +++ b/test-files/golden-tests/symbols/record/class-template-specializations-3.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -30,7 +30,7 @@

Types

-

A

+

A

Synopsis

@@ -62,7 +62,7 @@

Types

-

A::B

+

A::B

Synopsis

@@ -95,7 +95,7 @@

Types

-

A::B::C

+

A::B::C

Synopsis

@@ -112,7 +112,7 @@

Synopsis

-

A::B::D

+

A::B::D

Synopsis

@@ -130,7 +130,7 @@

Synopsis

-

A::B::D<bool>

+

A::B::D<bool>

Synopsis

@@ -148,7 +148,7 @@

Synopsis

-

A::B<double>

+

A::B<double>

Synopsis

@@ -181,7 +181,7 @@

Types

-

A::B<double>::C

+

A::B<double>::C

Synopsis

@@ -198,7 +198,7 @@

Synopsis

-

A::B<double>::D

+

A::B<double>::D

Synopsis

@@ -216,7 +216,7 @@

Synopsis

-

A::B<double>::D<bool>

+

A::B<double>::D<bool>

Synopsis

@@ -234,7 +234,7 @@

Synopsis

-

A<short>

+

A<short>

Synopsis

@@ -267,7 +267,7 @@

Types

-

A<short>::B

+

A<short>::B

Synopsis

@@ -285,7 +285,7 @@

Synopsis

-

A<short>::B<void>

+

A<short>::B<void>

Synopsis

@@ -318,7 +318,7 @@

Types

-

A<short>::B<void>::C

+

A<short>::B<void>::C

Synopsis

@@ -335,7 +335,7 @@

Synopsis

-

A<short>::B<void>::D

+

A<short>::B<void>::D

Synopsis

@@ -353,7 +353,7 @@

Synopsis

-

A<short>::B<void>::D<bool>

+

A<short>::B<void>::D<bool>

Synopsis

@@ -371,7 +371,7 @@

Synopsis

-

A<short>::B<double>

+

A<short>::B<double>

Synopsis

@@ -404,7 +404,7 @@

Types

-

A<short>::B<double>::C

+

A<short>::B<double>::C

Synopsis

@@ -421,7 +421,7 @@

Synopsis

-

A<short>::B<double>::D

+

A<short>::B<double>::D

Synopsis

@@ -439,7 +439,7 @@

Synopsis

-

A<short>::B<double>::D<bool>

+

A<short>::B<double>::D<bool>

Synopsis

@@ -457,7 +457,7 @@

Synopsis

-

A<unsigned int>

+

A<unsigned int>

Synopsis

@@ -490,7 +490,7 @@

Types

-

A<unsigned int>::B

+

A<unsigned int>::B

Synopsis

@@ -508,7 +508,7 @@

Synopsis

-

A<unsigned int>::B<float>

+

A<unsigned int>::B<float>

Synopsis

@@ -541,7 +541,7 @@

Types

-

A<unsigned int>::B<float>::C

+

A<unsigned int>::B<float>::C

Synopsis

@@ -558,7 +558,7 @@

Synopsis

-

A<unsigned int>::B<float>::D

+

A<unsigned int>::B<float>::D

Synopsis

@@ -576,7 +576,7 @@

Synopsis

-

A<unsigned int>::B<float>::D<bool>

+

A<unsigned int>::B<float>::D<bool>

Synopsis

@@ -594,7 +594,7 @@

Synopsis

-

A<unsigned int>::B<double>

+

A<unsigned int>::B<double>

Synopsis

@@ -627,7 +627,7 @@

Types

-

A<unsigned int>::B<double>::C

+

A<unsigned int>::B<double>::C

Synopsis

@@ -644,7 +644,7 @@

Synopsis

-

A<unsigned int>::B<double>::D

+

A<unsigned int>::B<double>::D

Synopsis

@@ -662,7 +662,7 @@

Synopsis

-

A<unsigned int>::B<double>::D<bool>

+

A<unsigned int>::B<double>::D<bool>

Synopsis

@@ -680,7 +680,7 @@

Synopsis

-

A<long>

+

A<long>

Synopsis

@@ -713,7 +713,7 @@

Types

-

A<long>::B

+

A<long>::B

Synopsis

@@ -746,7 +746,7 @@

Types

-

A<long>::B::C

+

A<long>::B::C

Synopsis

@@ -763,7 +763,7 @@

Synopsis

-

A<long>::B::D

+

A<long>::B::D

Synopsis

@@ -781,7 +781,7 @@

Synopsis

-

A<long>::B::D<bool>

+

A<long>::B::D<bool>

Synopsis

@@ -799,7 +799,7 @@

Synopsis

-

A<long>::B<float>

+

A<long>::B<float>

Synopsis

@@ -832,7 +832,7 @@

Types

-

A<long>::B<float>::C

+

A<long>::B<float>::C

Synopsis

@@ -849,7 +849,7 @@

Synopsis

-

A<long>::B<float>::D

+

A<long>::B<float>::D

Synopsis

@@ -867,7 +867,7 @@

Synopsis

-

A<long>::B<float>::D<bool>

+

A<long>::B<float>::D<bool>

Synopsis

@@ -885,7 +885,7 @@

Synopsis

-

A<long>::B<double>

+

A<long>::B<double>

Synopsis

@@ -918,7 +918,7 @@

Types

-

A<long>::B<double>::C

+

A<long>::B<double>::C

Synopsis

@@ -935,7 +935,7 @@

Synopsis

-

A<long>::B<double>::D

+

A<long>::B<double>::D

Synopsis

@@ -953,7 +953,7 @@

Synopsis

-

A<long>::B<double>::D<bool>

+

A<long>::B<double>::D<bool>

Synopsis

@@ -971,7 +971,7 @@

Synopsis

-

A<float>

+

A<float>

Synopsis

@@ -1003,7 +1003,7 @@

Types

-

A<float>::B

+

A<float>::B

Synopsis

@@ -1021,7 +1021,7 @@

Synopsis

-

A<float>::B<double>

+

A<float>::B<double>

Synopsis

@@ -1054,7 +1054,7 @@

Types

-

A<float>::B<double>::C

+

A<float>::B<double>::C

Synopsis

@@ -1071,7 +1071,7 @@

Synopsis

-

A<float>::B<double>::D

+

A<float>::B<double>::D

Synopsis

@@ -1089,7 +1089,7 @@

Synopsis

-

A<float>::B<double>::D<bool>

+

A<float>::B<double>::D<bool>

Synopsis

@@ -1107,7 +1107,7 @@

Synopsis

-

E

+

E

Synopsis

@@ -1151,7 +1151,7 @@

Data Members

-

E::m0

+

E::m0

Synopsis

@@ -1166,7 +1166,7 @@

Synopsis

-

E::m1

+

E::m1

Synopsis

@@ -1181,7 +1181,7 @@

Synopsis

-

E::m10

+

E::m10

Synopsis

@@ -1196,7 +1196,7 @@

Synopsis

-

E::m11

+

E::m11

Synopsis

@@ -1211,7 +1211,7 @@

Synopsis

-

E::m12

+

E::m12

Synopsis

@@ -1226,7 +1226,7 @@

Synopsis

-

E::m13

+

E::m13

Synopsis

@@ -1241,7 +1241,7 @@

Synopsis

-

E::m14

+

E::m14

Synopsis

@@ -1256,7 +1256,7 @@

Synopsis

-

E::m2

+

E::m2

Synopsis

@@ -1271,7 +1271,7 @@

Synopsis

-

E::m3

+

E::m3

Synopsis

@@ -1286,7 +1286,7 @@

Synopsis

-

E::m4

+

E::m4

Synopsis

@@ -1301,7 +1301,7 @@

Synopsis

-

E::m5

+

E::m5

Synopsis

@@ -1316,7 +1316,7 @@

Synopsis

-

E::m6

+

E::m6

Synopsis

@@ -1331,7 +1331,7 @@

Synopsis

-

E::m7

+

E::m7

Synopsis

@@ -1346,7 +1346,7 @@

Synopsis

-

E::m8

+

E::m8

Synopsis

@@ -1361,7 +1361,7 @@

Synopsis

-

E::m9

+

E::m9

Synopsis

diff --git a/test-files/golden-tests/symbols/record/class-template.html b/test-files/golden-tests/symbols/record/class-template.html index 29e8e2414..4c88bc411 100644 --- a/test-files/golden-tests/symbols/record/class-template.html +++ b/test-files/golden-tests/symbols/record/class-template.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -29,7 +29,7 @@

Types

-

C0

+

C0

Synopsis

@@ -75,7 +75,7 @@

Data Members

-

C0::N0

+

C0::N0

Synopsis

@@ -105,7 +105,7 @@

Data Members

-

C0::N0::z

+

C0::N0::z

Synopsis

@@ -120,7 +120,7 @@

Synopsis

-

C0::w

+

C0::w

Synopsis

@@ -135,7 +135,7 @@

Synopsis

-

C0::x

+

C0::x

Synopsis

@@ -150,7 +150,7 @@

Synopsis

-

C0::y

+

C0::y

Synopsis

@@ -165,7 +165,7 @@

Synopsis

-

C1

+

C1

Synopsis

@@ -208,7 +208,7 @@

Data Members

-

C1::N1

+

C1::N1

Synopsis

@@ -241,7 +241,7 @@

Data Members

-

C1::N1::x

+

C1::N1::x

Synopsis

@@ -256,7 +256,7 @@

Synopsis

-

C1::N1::y

+

C1::N1::y

Synopsis

@@ -271,7 +271,7 @@

Synopsis

-

C1::N1::z

+

C1::N1::z

Synopsis

@@ -286,7 +286,7 @@

Synopsis

-

C1::w

+

C1::w

Synopsis

@@ -301,7 +301,7 @@

Synopsis

-

C2

+

C2

Synopsis

@@ -345,7 +345,7 @@

Data Members

-

C2::N2

+

C2::N2

Synopsis

@@ -379,7 +379,7 @@

Data Members

-

C2::N2::w

+

C2::N2::w

Synopsis

@@ -394,7 +394,7 @@

Synopsis

-

C2::N2::x

+

C2::N2::x

Synopsis

@@ -409,7 +409,7 @@

Synopsis

-

C2::N2::y

+

C2::N2::y

Synopsis

@@ -424,7 +424,7 @@

Synopsis

-

C2::N2::z

+

C2::N2::z

Synopsis

@@ -439,7 +439,7 @@

Synopsis

-

C2::v

+

C2::v

Synopsis

@@ -454,7 +454,7 @@

Synopsis

-

C3

+

C3

Synopsis

@@ -485,7 +485,7 @@

Data Members

-

C3::v

+

C3::v

Synopsis

@@ -500,7 +500,7 @@

Synopsis

-

S

+

S

Synopsis

diff --git a/test-files/golden-tests/symbols/record/conditional-explicit.html b/test-files/golden-tests/symbols/record/conditional-explicit.html index 776f3004e..5e1439c06 100644 --- a/test-files/golden-tests/symbols/record/conditional-explicit.html +++ b/test-files/golden-tests/symbols/record/conditional-explicit.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -25,7 +25,7 @@

Types

-

A

+

A

Synopsis

@@ -61,7 +61,7 @@

Member Functions

-

A::A

+

A::A

Constructors @@ -108,7 +108,7 @@

Synopses

-

A::A

+

A::A

Conditionally explicit conversion from char @@ -145,7 +145,7 @@

Parameters

-

A::A

+

A::A

Explicit conversion from int @@ -182,7 +182,7 @@

Parameters

-

A::A

+

A::A

Implicit conversion from double @@ -218,7 +218,7 @@

Parameters

-

A::A

+

A::A

Conditionally explicit conversion from other types @@ -256,7 +256,7 @@

Parameters

-

A::operator U

+

A::operator U

Conditional explicit conversion to other types @@ -281,7 +281,7 @@

Return Value

-

A::operator bool

+

A::operator bool

Explicit conversion to bool @@ -305,7 +305,7 @@

Return Value

-

A::operator char

+

A::operator char

Conditionally explicit conversion to char @@ -329,7 +329,7 @@

Return Value

-

A::operator double

+

A::operator double

Implicit conversion to double diff --git a/test-files/golden-tests/symbols/record/dtor-overloads.html b/test-files/golden-tests/symbols/record/dtor-overloads.html index e0825614b..8b0378186 100644 --- a/test-files/golden-tests/symbols/record/dtor-overloads.html +++ b/test-files/golden-tests/symbols/record/dtor-overloads.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -25,7 +25,7 @@

Types

-

A

+

A

Synopsis

@@ -57,7 +57,7 @@

Member Functions

-

A::~A

+

A::~A

Destructors @@ -88,7 +88,7 @@

Synopses

-

A::~A

+

A::~A

Destructor @@ -108,7 +108,7 @@

Synopsis

-

A::~A

+

A::~A

Destructor diff --git a/test-files/golden-tests/symbols/record/final-class.html b/test-files/golden-tests/symbols/record/final-class.html index 1b94de154..96efd1b9d 100644 --- a/test-files/golden-tests/symbols/record/final-class.html +++ b/test-files/golden-tests/symbols/record/final-class.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -29,7 +29,7 @@

Types

-

A1

+

A1

Synopsis

@@ -46,7 +46,7 @@

Synopsis

-

A2

+

A2

Synopsis

@@ -64,7 +64,7 @@

Synopsis

-

A3

+

A3

Synopsis

@@ -98,7 +98,7 @@

Base Classes

-

B1

+

B1

Synopsis

@@ -130,7 +130,7 @@

Derived Classes

-

B2

+

B2

Synopsis

diff --git a/test-files/golden-tests/symbols/record/friend-duplicate.html b/test-files/golden-tests/symbols/record/friend-duplicate.html index dab44eff0..6a1417fdd 100644 --- a/test-files/golden-tests/symbols/record/friend-duplicate.html +++ b/test-files/golden-tests/symbols/record/friend-duplicate.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -39,7 +39,7 @@

Functions

-

A

+

A

Synopsis

@@ -78,7 +78,7 @@

Friends

-

B

+

B

Synopsis

@@ -95,7 +95,7 @@

Synopsis

-

f

+

f

Synopsis

diff --git a/test-files/golden-tests/symbols/record/friend-excluded.html b/test-files/golden-tests/symbols/record/friend-excluded.html index fdcedfc9d..31fb1bd93 100644 --- a/test-files/golden-tests/symbols/record/friend-excluded.html +++ b/test-files/golden-tests/symbols/record/friend-excluded.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -39,7 +39,7 @@

Functions

-

A

+

A

Synopsis

@@ -78,7 +78,7 @@

Friends

-

B

+

B

Synopsis

@@ -95,7 +95,7 @@

Synopsis

-

f

+

f

Synopsis

diff --git a/test-files/golden-tests/symbols/record/friend-fn-has-docs.html b/test-files/golden-tests/symbols/record/friend-fn-has-docs.html index 609a84bfe..395192bd8 100644 --- a/test-files/golden-tests/symbols/record/friend-fn-has-docs.html +++ b/test-files/golden-tests/symbols/record/friend-fn-has-docs.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -39,7 +39,7 @@

Functions

-

T

+

T

Synopsis

@@ -74,7 +74,7 @@

Friends

-

f

+

f

f diff --git a/test-files/golden-tests/symbols/record/friend-fn-member.html b/test-files/golden-tests/symbols/record/friend-fn-member.html index ef3d4b2d7..a016b96ac 100644 --- a/test-files/golden-tests/symbols/record/friend-fn-member.html +++ b/test-files/golden-tests/symbols/record/friend-fn-member.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -26,7 +26,7 @@

Types

-

U

+

U

Synopsis

@@ -69,7 +69,7 @@

Friends

-

X

+

X

Synopsis

@@ -102,7 +102,7 @@

Member Functions

-

X::X

+

X::X

Default constructor @@ -121,7 +121,7 @@

Synopsis

-

X::~X

+

X::~X

Destructor @@ -140,7 +140,7 @@

Synopsis

-

X::foo

+

X::foo

Friend member-function diff --git a/test-files/golden-tests/symbols/record/friend-fn-multi-2nd.html b/test-files/golden-tests/symbols/record/friend-fn-multi-2nd.html index 957e1b2fd..a90ac42c5 100644 --- a/test-files/golden-tests/symbols/record/friend-fn-multi-2nd.html +++ b/test-files/golden-tests/symbols/record/friend-fn-multi-2nd.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -40,7 +40,7 @@

Functions

-

T

+

T

Synopsis

@@ -75,7 +75,7 @@

Friends

-

U

+

U

Synopsis

@@ -110,7 +110,7 @@

Friends

-

f

+

f

U::f diff --git a/test-files/golden-tests/symbols/record/friend-fn-multi-free.html b/test-files/golden-tests/symbols/record/friend-fn-multi-free.html index 4c32324e1..57b7f7299 100644 --- a/test-files/golden-tests/symbols/record/friend-fn-multi-free.html +++ b/test-files/golden-tests/symbols/record/friend-fn-multi-free.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -40,7 +40,7 @@

Functions

-

T

+

T

Synopsis

@@ -75,7 +75,7 @@

Friends

-

U

+

U

Synopsis

@@ -110,7 +110,7 @@

Friends

-

f

+

f

f diff --git a/test-files/golden-tests/symbols/record/friend-fn-multi.html b/test-files/golden-tests/symbols/record/friend-fn-multi.html index 542695b74..a3fb41f66 100644 --- a/test-files/golden-tests/symbols/record/friend-fn-multi.html +++ b/test-files/golden-tests/symbols/record/friend-fn-multi.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -40,7 +40,7 @@

Functions

-

T

+

T

Synopsis

@@ -75,7 +75,7 @@

Friends

-

U

+

U

Synopsis

@@ -110,7 +110,7 @@

Friends

-

f

+

f

T::f diff --git a/test-files/golden-tests/symbols/record/friend-fn.html b/test-files/golden-tests/symbols/record/friend-fn.html index ef83619a0..133020c70 100644 --- a/test-files/golden-tests/symbols/record/friend-fn.html +++ b/test-files/golden-tests/symbols/record/friend-fn.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -39,7 +39,7 @@

Functions

-

T

+

T

Synopsis

@@ -74,7 +74,7 @@

Friends

-

f

+

f

f diff --git a/test-files/golden-tests/symbols/record/friend-type.html b/test-files/golden-tests/symbols/record/friend-type.html index f9562429b..69c654552 100644 --- a/test-files/golden-tests/symbols/record/friend-type.html +++ b/test-files/golden-tests/symbols/record/friend-type.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -29,7 +29,7 @@

Types

-

T

+

T

Struct T brief @@ -68,7 +68,7 @@

Friends

-

U

+

U

Struct U brief @@ -107,7 +107,7 @@

Friends

-

V

+

V

Struct V brief @@ -146,7 +146,7 @@

Friends

-

Z

+

Z

Friend class Z brief diff --git a/test-files/golden-tests/symbols/record/local-class.html b/test-files/golden-tests/symbols/record/local-class.html index e6a2a3f0e..b1f5105c1 100644 --- a/test-files/golden-tests/symbols/record/local-class.html +++ b/test-files/golden-tests/symbols/record/local-class.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -38,7 +38,7 @@

Functions

-

B

+

B

Synopsis

@@ -70,7 +70,7 @@

Base Classes

-

f

+

f

Synopsis

diff --git a/test-files/golden-tests/symbols/record/out-of-line-record-def.html b/test-files/golden-tests/symbols/record/out-of-line-record-def.html index 68329ef3f..cac5ff65e 100644 --- a/test-files/golden-tests/symbols/record/out-of-line-record-def.html +++ b/test-files/golden-tests/symbols/record/out-of-line-record-def.html @@ -7,7 +7,7 @@

Reference

-

+

Namespaces

@@ -25,7 +25,7 @@

Namespaces

-

N

+

N

Types

@@ -43,7 +43,7 @@

Types

-

N::S

+

N::S

Synopsis

diff --git a/test-files/golden-tests/symbols/record/record-1.html b/test-files/golden-tests/symbols/record/record-1.html index a38f78c13..217757108 100644 --- a/test-files/golden-tests/symbols/record/record-1.html +++ b/test-files/golden-tests/symbols/record/record-1.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -25,7 +25,7 @@

Types

-

T

+

T

Synopsis

@@ -87,7 +87,7 @@

Protected Member Functions

-

T::U1

+

T::U1

Synopsis

@@ -102,7 +102,7 @@

Synopsis

-

T::U2

+

T::U2

Synopsis

@@ -117,7 +117,7 @@

Synopsis

-

T::f1

+

T::f1

Synopsis

@@ -133,7 +133,7 @@

Synopsis

-

T::f2

+

T::f2

Synopsis

@@ -149,7 +149,7 @@

Synopsis

-

T::f3

+

T::f3

Synopsis

@@ -165,7 +165,7 @@

Synopsis

-

T::g1

+

T::g1

brief-g1 @@ -189,7 +189,7 @@

Description

-

T::g2

+

T::g2

brief-g2 @@ -213,7 +213,7 @@

Return Value

-

T::g3

+

T::g3

brief-g3 diff --git a/test-files/golden-tests/symbols/record/record-access.html b/test-files/golden-tests/symbols/record/record-access.html index 6162cddf8..fe9b3caf8 100644 --- a/test-files/golden-tests/symbols/record/record-access.html +++ b/test-files/golden-tests/symbols/record/record-access.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -27,7 +27,7 @@

Types

-

C0

+

C0

Synopsis

@@ -83,7 +83,7 @@

Private Member Functions

-

C0::f2

+

C0::f2

Synopsis

@@ -99,7 +99,7 @@

Synopsis

-

C0::f1

+

C0::f1

Synopsis

@@ -115,7 +115,7 @@

Synopsis

-

C0::f0

+

C0::f0

Synopsis

@@ -131,7 +131,7 @@

Synopsis

-

S0

+

S0

Synopsis

@@ -187,7 +187,7 @@

Private Member Functions

-

S0::f0

+

S0::f0

Synopsis

@@ -203,7 +203,7 @@

Synopsis

-

S0::f1

+

S0::f1

Synopsis

@@ -219,7 +219,7 @@

Synopsis

-

S0::f2

+

S0::f2

Synopsis

@@ -235,7 +235,7 @@

Synopsis

-

U0

+

U0

Synopsis

@@ -291,7 +291,7 @@

Private Member Functions

-

U0::f0

+

U0::f0

Synopsis

@@ -307,7 +307,7 @@

Synopsis

-

U0::f1

+

U0::f1

Synopsis

@@ -323,7 +323,7 @@

Synopsis

-

U0::f2

+

U0::f2

Synopsis

diff --git a/test-files/golden-tests/symbols/record/record-data.html b/test-files/golden-tests/symbols/record/record-data.html index 0571f3543..ed8d14f0b 100644 --- a/test-files/golden-tests/symbols/record/record-data.html +++ b/test-files/golden-tests/symbols/record/record-data.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -29,7 +29,7 @@

Types

-

T

+

T

Synopsis

@@ -63,7 +63,7 @@

Data Members

-

T::i

+

T::i

Synopsis

@@ -78,7 +78,7 @@

Synopsis

-

T::j

+

T::j

Synopsis

@@ -93,7 +93,7 @@

Synopsis

-

T::k

+

T::k

Synopsis

@@ -109,7 +109,7 @@

Synopsis

-

T::l

+

T::l

Synopsis

@@ -124,7 +124,7 @@

Synopsis

-

T::m

+

T::m

Synopsis

@@ -139,7 +139,7 @@

Synopsis

-

U

+

U

Synopsis

@@ -169,7 +169,7 @@

Data Members

-

U::t

+

U::t

Synopsis

@@ -184,7 +184,7 @@

Synopsis

-

V

+

V

Synopsis

@@ -228,7 +228,7 @@

Private Data Members

-

V::j

+

V::j

Synopsis

@@ -243,7 +243,7 @@

Synopsis

-

V::i

+

V::i

Synopsis

@@ -258,7 +258,7 @@

Synopsis

-

V::k

+

V::k

Synopsis

@@ -273,7 +273,7 @@

Synopsis

-

W

+

W

Synopsis

@@ -303,7 +303,7 @@

Data Members

-

W::buf

+

W::buf

Synopsis

@@ -318,7 +318,7 @@

Synopsis

-

X

+

X

Synopsis

@@ -368,7 +368,7 @@

Data Members

-

X::Q

+

X::Q

Synopsis

@@ -383,7 +383,7 @@

Synopsis

-

X::x0

+

X::x0

Synopsis

@@ -398,7 +398,7 @@

Synopsis

-

X::x1

+

X::x1

Synopsis

@@ -413,7 +413,7 @@

Synopsis

-

X::x2

+

X::x2

Synopsis

@@ -428,7 +428,7 @@

Synopsis

-

X::x3

+

X::x3

Synopsis

@@ -443,7 +443,7 @@

Synopsis

-

X::x4

+

X::x4

Synopsis

diff --git a/test-files/golden-tests/symbols/record/record-inheritance.html b/test-files/golden-tests/symbols/record/record-inheritance.html index 99c061e15..1c5765150 100644 --- a/test-files/golden-tests/symbols/record/record-inheritance.html +++ b/test-files/golden-tests/symbols/record/record-inheritance.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -40,7 +40,7 @@

Types

-

C0

+

C0

Synopsis

@@ -72,7 +72,7 @@

Derived Classes

-

C1

+

C1

Synopsis

@@ -90,7 +90,7 @@

Synopsis

-

C2

+

C2

Synopsis

@@ -122,7 +122,7 @@

Base Classes

-

C3

+

C3

Synopsis

@@ -154,7 +154,7 @@

Protected Base Classes

-

C4

+

C4

Synopsis

@@ -172,7 +172,7 @@

Synopsis

-

C5

+

C5

Synopsis

@@ -205,7 +205,7 @@

Derived Classes

-

C6

+

C6

Synopsis

@@ -238,7 +238,7 @@

Derived Classes

-

C7

+

C7

Synopsis

@@ -272,7 +272,7 @@

Base Classes

-

S0

+

S0

Synopsis

@@ -304,7 +304,7 @@

Derived Classes

-

S1

+

S1

Synopsis

@@ -336,7 +336,7 @@

Derived Classes

-

S2

+

S2

Synopsis

@@ -383,7 +383,7 @@

Derived Classes

-

S3

+

S3

Synopsis

@@ -430,7 +430,7 @@

Derived Classes

-

S4

+

S4

Synopsis

@@ -464,7 +464,7 @@

Base Classes

-

S5

+

S5

Synopsis

@@ -497,7 +497,7 @@

Protected Base Classes

-

S6

+

S6

Synopsis

@@ -530,7 +530,7 @@

Base Classes

-

U0

+

U0

Synopsis

diff --git a/test-files/golden-tests/symbols/record/template-specialization-inheritance.html b/test-files/golden-tests/symbols/record/template-specialization-inheritance.html index 1462b804f..1f831414e 100644 --- a/test-files/golden-tests/symbols/record/template-specialization-inheritance.html +++ b/test-files/golden-tests/symbols/record/template-specialization-inheritance.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -35,7 +35,7 @@

Types

-

U1

+

U1

Synopsis

@@ -50,7 +50,7 @@

Synopsis

-

U2

+

U2

Synopsis

@@ -65,7 +65,7 @@

Synopsis

-

U3

+

U3

Synopsis

@@ -80,7 +80,7 @@

Synopsis

-

R0

+

R0

Synopsis

@@ -125,7 +125,7 @@

Types

-

R1

+

R1

Synopsis

@@ -157,7 +157,7 @@

Base Classes

-

R2

+

R2

Synopsis

@@ -189,7 +189,7 @@

Base Classes

-

S0

+

S0

Synopsis

@@ -237,7 +237,7 @@

Derived Classes

-

S0::S1

+

S0::S1

Synopsis

@@ -254,7 +254,7 @@

Synopsis

-

S0<2>

+

S0<2>

Synopsis

@@ -285,7 +285,7 @@

Types

-

S0<2>::S1

+

S0<2>::S1

Synopsis

@@ -317,7 +317,7 @@

Derived Classes

-

S0<3>

+

S0<3>

Synopsis

@@ -350,7 +350,7 @@

Derived Classes

-

S0<5>

+

S0<5>

Synopsis

@@ -381,7 +381,7 @@

Types

-

S0<5>::S1

+

S0<5>::S1

Synopsis

@@ -398,7 +398,7 @@

Synopsis

-

S0<6>

+

S0<6>

Synopsis

diff --git a/test-files/golden-tests/symbols/record/union.html b/test-files/golden-tests/symbols/record/union.html index 2ce8d95c7..73c865d34 100644 --- a/test-files/golden-tests/symbols/record/union.html +++ b/test-files/golden-tests/symbols/record/union.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -26,7 +26,7 @@

Types

-

A

+

A

Synopsis

@@ -57,7 +57,7 @@

Data Members

-

A::x

+

A::x

Synopsis

@@ -72,7 +72,7 @@

Synopsis

-

A::y

+

A::y

Synopsis

@@ -87,7 +87,7 @@

Synopsis

-

B

+

B

Synopsis

@@ -119,7 +119,7 @@

Data Members

-

B::x

+

B::x

Synopsis

@@ -134,7 +134,7 @@

Synopsis

-

B::y

+

B::y

Synopsis

@@ -149,7 +149,7 @@

Synopsis

-

B::z

+

B::z

Synopsis

diff --git a/test-files/golden-tests/symbols/record/unnamed.html b/test-files/golden-tests/symbols/record/unnamed.html index 161447e57..ed79330bd 100644 --- a/test-files/golden-tests/symbols/record/unnamed.html +++ b/test-files/golden-tests/symbols/record/unnamed.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -143,7 +143,7 @@

Synopsis

-

F

+

F

Synopsis

diff --git a/test-files/golden-tests/symbols/typedef/alias-template.html b/test-files/golden-tests/symbols/typedef/alias-template.html index 5cda8e886..64889d567 100644 --- a/test-files/golden-tests/symbols/typedef/alias-template.html +++ b/test-files/golden-tests/symbols/typedef/alias-template.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -28,7 +28,7 @@

Types

-

C

+

C

Synopsis

@@ -44,7 +44,7 @@

Synopsis

-

A

+

A

Synopsis

@@ -62,7 +62,7 @@

Synopsis

-

B

+

B

Synopsis

@@ -82,7 +82,7 @@

Synopsis

-

D

+

D

Synopsis

@@ -113,7 +113,7 @@

Types

-

D::E

+

D::E

Synopsis

diff --git a/test-files/golden-tests/symbols/typedef/decay-to-primary.html b/test-files/golden-tests/symbols/typedef/decay-to-primary.html index d9fe6219e..f747caa70 100644 --- a/test-files/golden-tests/symbols/typedef/decay-to-primary.html +++ b/test-files/golden-tests/symbols/typedef/decay-to-primary.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -29,7 +29,7 @@

Types

-

A0

+

A0

Synopsis

@@ -44,7 +44,7 @@

Synopsis

-

A1

+

A1

Synopsis

@@ -59,7 +59,7 @@

Synopsis

-

S0

+

S0

Synopsis

@@ -91,7 +91,7 @@

Types

-

S0::M0

+

S0::M0

Synopsis

@@ -106,7 +106,7 @@

Synopsis

-

S0::M1

+

S0::M1

Synopsis

@@ -122,7 +122,7 @@

Synopsis

-

S0<void>

+

S0<void>

Synopsis

@@ -154,7 +154,7 @@

Types

-

S0<void>::M0

+

S0<void>::M0

Synopsis

@@ -169,7 +169,7 @@

Synopsis

-

S0<void>::M1

+

S0<void>::M1

Synopsis

@@ -185,7 +185,7 @@

Synopsis

-

S0<short>

+

S0<short>

Synopsis

@@ -217,7 +217,7 @@

Types

-

S0<short>::M0

+

S0<short>::M0

Synopsis

@@ -232,7 +232,7 @@

Synopsis

-

S0<short>::M1

+

S0<short>::M1

Synopsis

diff --git a/test-files/golden-tests/symbols/typedef/dependency-propagation.html b/test-files/golden-tests/symbols/typedef/dependency-propagation.html index 6c0a23da1..ee3ddf82a 100644 --- a/test-files/golden-tests/symbols/typedef/dependency-propagation.html +++ b/test-files/golden-tests/symbols/typedef/dependency-propagation.html @@ -7,7 +7,7 @@

Reference

-

+

Namespaces

@@ -38,7 +38,7 @@

Types

-

N

+

N

Types

@@ -59,7 +59,7 @@

Types

-

N::B

+

N::B

Synopsis

@@ -75,7 +75,7 @@

Synopsis

-

N::C

+

N::C

Synopsis

@@ -91,7 +91,7 @@

Synopsis

-

N::A

+

N::A

Synopsis

@@ -109,7 +109,7 @@

Synopsis

-

N::D

+

N::D

Synopsis

@@ -126,7 +126,7 @@

Synopsis

-

E

+

E

Synopsis

diff --git a/test-files/golden-tests/symbols/typedef/implicit-instantiation-member-ref.html b/test-files/golden-tests/symbols/typedef/implicit-instantiation-member-ref.html index a35a02dc4..9abefa38e 100644 --- a/test-files/golden-tests/symbols/typedef/implicit-instantiation-member-ref.html +++ b/test-files/golden-tests/symbols/typedef/implicit-instantiation-member-ref.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -28,7 +28,7 @@

Types

-

A5

+

A5

Synopsis

@@ -43,7 +43,7 @@

Synopsis

-

A9

+

A9

Synopsis

@@ -58,7 +58,7 @@

Synopsis

-

S0

+

S0

Synopsis

@@ -89,7 +89,7 @@

Types

-

S0::S2

+

S0::S2

Synopsis

@@ -121,7 +121,7 @@

Types

-

S0::S2::M2

+

S0::S2::M2

Synopsis

@@ -136,7 +136,7 @@

Synopsis

-

S0::S2::M3

+

S0::S2::M3

Synopsis

@@ -152,7 +152,7 @@

Synopsis

-

S0<void>

+

S0<void>

Synopsis

@@ -184,7 +184,7 @@

Types

-

S0<void>::S2

+

S0<void>::S2

Synopsis

@@ -202,7 +202,7 @@

Synopsis

-

S0<void>::S2<char>

+

S0<void>::S2<char>

Synopsis

@@ -234,7 +234,7 @@

Types

-

S0<void>::S2<char>::M2

+

S0<void>::S2<char>::M2

Synopsis

@@ -249,7 +249,7 @@

Synopsis

-

S0<void>::S2<char>::M3

+

S0<void>::S2<char>::M3

Synopsis

diff --git a/test-files/golden-tests/symbols/using-directive/using-1.html b/test-files/golden-tests/symbols/using-directive/using-1.html index 11b11ebd6..a4295e1a3 100644 --- a/test-files/golden-tests/symbols/using-directive/using-1.html +++ b/test-files/golden-tests/symbols/using-directive/using-1.html @@ -7,7 +7,7 @@

Reference

-

+

Namespaces

@@ -42,7 +42,7 @@

Using Namespace Directives

-

LongName

+

LongName

Types

@@ -60,7 +60,7 @@

Types

-

LongName::A

+

LongName::A

Synopsis

diff --git a/test-files/golden-tests/symbols/using-enum/using-enum-in-ns.adoc b/test-files/golden-tests/symbols/using-enum/using-enum-in-ns.adoc index b2ab0202b..3f177aa46 100644 --- a/test-files/golden-tests/symbols/using-enum/using-enum-in-ns.adoc +++ b/test-files/golden-tests/symbols/using-enum/using-enum-in-ns.adoc @@ -45,13 +45,12 @@ enum class E : int; === Members - [cols=2] |=== | Name | Description -|`e1` -|The constant to be introduced +| `e1` +| The constant to be introduced |=== [#f] diff --git a/test-files/golden-tests/symbols/using-enum/using-enum-in-ns.html b/test-files/golden-tests/symbols/using-enum/using-enum-in-ns.html index 32901a0c7..0b58c6fbd 100644 --- a/test-files/golden-tests/symbols/using-enum/using-enum-in-ns.html +++ b/test-files/golden-tests/symbols/using-enum/using-enum-in-ns.html @@ -7,7 +7,7 @@

Reference

-

+

Namespaces

@@ -38,7 +38,7 @@

Functions

-

A

+

A

Enums

@@ -56,7 +56,7 @@

Enums

-

A::E

+

A::E

Synopsis

@@ -68,9 +68,8 @@

Synopsis

-
-

Members

-
+

Members

+
@@ -79,16 +78,14 @@

Members

- - - +
Name
e1The constant to be introduced
e1 The constant to be introduced
-
+
-

f

+

f

Synopsis

diff --git a/test-files/golden-tests/symbols/using-enum/using-enum-in-record.adoc b/test-files/golden-tests/symbols/using-enum/using-enum-in-record.adoc index db39c38f8..c6bfbdf94 100644 --- a/test-files/golden-tests/symbols/using-enum/using-enum-in-record.adoc +++ b/test-files/golden-tests/symbols/using-enum/using-enum-in-record.adoc @@ -53,13 +53,12 @@ enum class E : int; === Members - [cols=2] |=== | Name | Description -|`e1` -|The constant to be introduced +| `e1` +| The constant to be introduced |=== [#B] diff --git a/test-files/golden-tests/symbols/using-enum/using-enum-in-record.html b/test-files/golden-tests/symbols/using-enum/using-enum-in-record.html index 384d72904..c10b0f369 100644 --- a/test-files/golden-tests/symbols/using-enum/using-enum-in-record.html +++ b/test-files/golden-tests/symbols/using-enum/using-enum-in-record.html @@ -7,7 +7,7 @@

Reference

-

+

Namespaces

@@ -51,7 +51,7 @@

Functions

-

A

+

A

Enums

@@ -69,7 +69,7 @@

Enums

-

A::E

+

A::E

Synopsis

@@ -81,9 +81,8 @@

Synopsis

-
-

Members

-
+

Members

+
@@ -92,16 +91,14 @@

Members

- - - +
Name
e1The constant to be introduced
e1 The constant to be introduced
-
+
-

B

+

B

Synopsis

@@ -118,7 +115,7 @@

Synopsis

-

g

+

g

Synopsis

diff --git a/test-files/golden-tests/symbols/using/using-function-after.html b/test-files/golden-tests/symbols/using/using-function-after.html index fce951903..ae264b91b 100644 --- a/test-files/golden-tests/symbols/using/using-function-after.html +++ b/test-files/golden-tests/symbols/using/using-function-after.html @@ -7,7 +7,7 @@

Reference

-

+

Namespaces

@@ -39,7 +39,7 @@

Using Declarations

-

A

+

A

Functions

@@ -58,7 +58,7 @@

Functions

-

A::f

+

A::f

f overloads @@ -89,7 +89,7 @@

Synopses

-

A::f

+

A::f

A non-shadowing declaration @@ -114,7 +114,7 @@

Description

-

A::f

+

A::f

A shadow declaration @@ -134,7 +134,7 @@

Synopsis

-

f

+

f

f overloads are also available in the global namespace diff --git a/test-files/golden-tests/symbols/using/using-function-and-type.html b/test-files/golden-tests/symbols/using/using-function-and-type.html index 157a4c800..4dc3a5ddd 100644 --- a/test-files/golden-tests/symbols/using/using-function-and-type.html +++ b/test-files/golden-tests/symbols/using/using-function-and-type.html @@ -7,7 +7,7 @@

Reference

-

+

Namespaces

@@ -39,7 +39,7 @@

Using Declarations

-

A

+

A

Types

@@ -72,7 +72,7 @@

Functions

-

A::f

+

A::f

A record @@ -93,7 +93,7 @@

Synopsis

-

A::f

+

A::f

A function @@ -113,7 +113,7 @@

Synopsis

-

f

+

f

A using declaration that shadows a function and the record. diff --git a/test-files/golden-tests/symbols/using/using-function-excluded.html b/test-files/golden-tests/symbols/using/using-function-excluded.html index 16e044bcd..3eb65e4b5 100644 --- a/test-files/golden-tests/symbols/using/using-function-excluded.html +++ b/test-files/golden-tests/symbols/using/using-function-excluded.html @@ -7,7 +7,7 @@

Reference

-

+

Using Declarations

@@ -26,7 +26,7 @@

Using Declarations

-

f

+

f

Using excluded function f diff --git a/test-files/golden-tests/symbols/using/using-function-local-overloads.html b/test-files/golden-tests/symbols/using/using-function-local-overloads.html index 934cadb18..01f590816 100644 --- a/test-files/golden-tests/symbols/using/using-function-local-overloads.html +++ b/test-files/golden-tests/symbols/using/using-function-local-overloads.html @@ -7,7 +7,7 @@

Reference

-

+

Namespaces

@@ -52,7 +52,7 @@

Using Declarations

-

A

+

A

Functions

@@ -71,7 +71,7 @@

Functions

-

A::f

+

A::f

f overloads @@ -112,7 +112,7 @@

Synopses

-

A::f

+

A::f

Second overload @@ -132,7 +132,7 @@

Synopsis

-

A::f

+

A::f

First overload @@ -152,7 +152,7 @@

Synopsis

-

A::f

+

A::f

Third overload @@ -174,7 +174,7 @@

Synopsis

-

f

+

f

Local overload @@ -194,7 +194,7 @@

Synopsis

-

f

+

f

Synopsis

diff --git a/test-files/golden-tests/symbols/using/using-function-overloads.html b/test-files/golden-tests/symbols/using/using-function-overloads.html index 6fc39e276..d8843388c 100644 --- a/test-files/golden-tests/symbols/using/using-function-overloads.html +++ b/test-files/golden-tests/symbols/using/using-function-overloads.html @@ -7,7 +7,7 @@

Reference

-

+

Namespaces

@@ -39,7 +39,7 @@

Using Declarations

-

A

+

A

Functions

@@ -58,7 +58,7 @@

Functions

-

A::f

+

A::f

f overloads @@ -99,7 +99,7 @@

Synopses

-

A::f

+

A::f

Second overload @@ -119,7 +119,7 @@

Synopsis

-

A::f

+

A::f

First overload @@ -139,7 +139,7 @@

Synopsis

-

A::f

+

A::f

Third overload @@ -161,7 +161,7 @@

Synopsis

-

f

+

f

Using the overloads from namespace A diff --git a/test-files/golden-tests/symbols/using/using-function.html b/test-files/golden-tests/symbols/using/using-function.html index 86bfdedeb..0db8ae859 100644 --- a/test-files/golden-tests/symbols/using/using-function.html +++ b/test-files/golden-tests/symbols/using/using-function.html @@ -7,7 +7,7 @@

Reference

-

+

Namespaces

@@ -39,7 +39,7 @@

Using Declarations

-

A

+

A

Functions

@@ -58,7 +58,7 @@

Functions

-

A::f

+

A::f

Function being used @@ -78,7 +78,7 @@

Synopsis

-

f

+

f

f is also available in the global namespace diff --git a/test-files/golden-tests/symbols/using/using-member-conversion.html b/test-files/golden-tests/symbols/using/using-member-conversion.html index b82eeab5b..401abf5a7 100644 --- a/test-files/golden-tests/symbols/using/using-member-conversion.html +++ b/test-files/golden-tests/symbols/using/using-member-conversion.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -28,7 +28,7 @@

Types

-

fun_ptr

+

fun_ptr

A pointer to function typedef @@ -47,7 +47,7 @@

Synopsis

-

X

+

X

This struct will be inherited as public @@ -97,7 +97,7 @@

Derived Classes

-

X::operator fun_ptr

+

X::operator fun_ptr

Conversion operator to function pointer. @@ -120,7 +120,7 @@

Return Value

-

Y

+

Y

This struct inherits from X @@ -184,7 +184,7 @@

Using Declarations

-

Y::operator void(*)()

+

Y::operator void(*)()

Bring X::operator fun_ptr into Y. diff --git a/test-files/golden-tests/symbols/using/using-member-function.html b/test-files/golden-tests/symbols/using/using-member-function.html index ffcb4752e..08320e940 100644 --- a/test-files/golden-tests/symbols/using/using-member-function.html +++ b/test-files/golden-tests/symbols/using/using-member-function.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -33,7 +33,7 @@

Types

-

A

+

A

This struct will be inherited as public @@ -83,7 +83,7 @@

Derived Classes

-

A::f

+

A::f

Public member function f taking a Tag<0>. @@ -107,7 +107,7 @@

Description

-

B

+

B

This struct will be inherited as public @@ -157,7 +157,7 @@

Derived Classes

-

B::f

+

B::f

Protected member function f taking a Tag<1>. @@ -177,7 +177,7 @@

Synopsis

-

C

+

C

This struct will be inherited as protected @@ -212,7 +212,7 @@

Member Functions

-

C::f

+

C::f

Public member function f taking a Tag<2>. @@ -232,7 +232,7 @@

Synopsis

-

D

+

D

This struct will be inherited as protected @@ -267,7 +267,7 @@

Protected Member Functions

-

D::f

+

D::f

Protected member function f taking a Tag<3>. @@ -287,7 +287,7 @@

Synopsis

-

E

+

E

This struct will be inherited as private @@ -322,7 +322,7 @@

Member Functions

-

E::f

+

E::f

Public member function f taking a Tag<4>. @@ -342,7 +342,7 @@

Synopsis

-

F

+

F

This struct will be inherited as private @@ -377,7 +377,7 @@

Protected Member Functions

-

F::f

+

F::f

Protected member function f taking a Tag<5>. @@ -397,7 +397,7 @@

Synopsis

-

Tag

+

Tag

A tag template to create distinct f functions. @@ -419,7 +419,7 @@

Synopsis

-

U

+

U

This struct inherits from A, B, C, D, E, and F in various ways, @@ -531,7 +531,7 @@

Description

-

U::U

+

U::U

Bring all the A::A constructors into U. @@ -550,7 +550,7 @@

Synopsis

-

U::U

+

U::U

Bring all the B::B constructors into U. @@ -569,7 +569,7 @@

Synopsis

-

U::U

+

U::U

Bring all the C::C constructors into U. @@ -588,7 +588,7 @@

Synopsis

-

U::U

+

U::U

Bring all the D::D constructors into U. @@ -607,7 +607,7 @@

Synopsis

-

U::U

+

U::U

Bring all the E::E constructors into U. @@ -626,7 +626,7 @@

Synopsis

-

U::U

+

U::U

Bring all the F::F constructors into U. @@ -645,7 +645,7 @@

Synopsis

-

U::f

+

U::f

Bring all the A::f functions into U. @@ -682,7 +682,7 @@

Introduced Symbols

-

U::f

+

U::f

Bring all the B::f functions into U. @@ -719,7 +719,7 @@

Introduced Symbols

-

U::f

+

U::f

Bring all the C::f functions into U. @@ -756,7 +756,7 @@

Introduced Symbols

-

U::f

+

U::f

Bring all the D::f functions into U. @@ -793,7 +793,7 @@

Introduced Symbols

-

U::f

+

U::f

Bring all the E::f functions into U. @@ -830,7 +830,7 @@

Introduced Symbols

-

U::f

+

U::f

Bring all the F::f functions into U. @@ -867,7 +867,7 @@

Introduced Symbols

-

U::f

+

U::f

f overloads @@ -906,7 +906,7 @@

Synopses

-

B::f

+

B::f

Protected member function f taking a Tag<1>. @@ -926,7 +926,7 @@

Synopsis

-

C::f

+

C::f

Public member function f taking a Tag<2>. @@ -946,7 +946,7 @@

Synopsis

-

D::f

+

D::f

Protected member function f taking a Tag<3>. diff --git a/test-files/golden-tests/symbols/using/using-multi.html b/test-files/golden-tests/symbols/using/using-multi.html index 0121adc1d..9c491c5bc 100644 --- a/test-files/golden-tests/symbols/using/using-multi.html +++ b/test-files/golden-tests/symbols/using/using-multi.html @@ -7,7 +7,7 @@

Reference

-

+

Namespaces

@@ -39,7 +39,7 @@

Using Declarations

-

A

+

A

Functions

@@ -58,7 +58,7 @@

Functions

-

A::f

+

A::f

Synopsis

@@ -74,7 +74,7 @@

Synopsis

-

A::g

+

A::g

Synopsis

@@ -90,7 +90,7 @@

Synopsis

-

f

+

f

Synopsis

@@ -121,7 +121,7 @@

Introduced Symbols

-

g

+

g

Synopsis

diff --git a/test-files/golden-tests/symbols/using/using-struct-template.html b/test-files/golden-tests/symbols/using/using-struct-template.html index f4a3bb66a..595ab3f20 100644 --- a/test-files/golden-tests/symbols/using/using-struct-template.html +++ b/test-files/golden-tests/symbols/using/using-struct-template.html @@ -7,7 +7,7 @@

Reference

-

+

Namespaces

@@ -39,7 +39,7 @@

Using Declarations

-

LongName

+

LongName

Types

@@ -58,7 +58,7 @@

Types

-

LongName::S1

+

LongName::S1

Synopsis

@@ -75,7 +75,7 @@

Synopsis

-

LongName::S2

+

LongName::S2

Synopsis

@@ -92,7 +92,7 @@

Synopsis

-

S1

+

S1

Synopsis

@@ -123,7 +123,7 @@

Introduced Symbols

-

S2

+

S2

Synopsis

diff --git a/test-files/golden-tests/symbols/using/using-struct.html b/test-files/golden-tests/symbols/using/using-struct.html index 69469395c..ab8036949 100644 --- a/test-files/golden-tests/symbols/using/using-struct.html +++ b/test-files/golden-tests/symbols/using/using-struct.html @@ -7,7 +7,7 @@

Reference

-

+

Namespaces

@@ -39,7 +39,7 @@

Using Declarations

-

LongName

+

LongName

Types

@@ -58,7 +58,7 @@

Types

-

LongName::S1

+

LongName::S1

Synopsis

@@ -75,7 +75,7 @@

Synopsis

-

LongName::S2

+

LongName::S2

Synopsis

@@ -92,7 +92,7 @@

Synopsis

-

S1

+

S1

Synopsis

@@ -123,7 +123,7 @@

Introduced Symbols

-

S2

+

S2

Synopsis

diff --git a/test-files/golden-tests/symbols/using/using-template-function.html b/test-files/golden-tests/symbols/using/using-template-function.html index 13e14bf13..9b429bb33 100644 --- a/test-files/golden-tests/symbols/using/using-template-function.html +++ b/test-files/golden-tests/symbols/using/using-template-function.html @@ -7,7 +7,7 @@

Reference

-

+

Namespaces

@@ -38,7 +38,7 @@

Using Declarations

-

A

+

A

Functions

@@ -56,7 +56,7 @@

Functions

-

A::f

+

A::f

Synopsis

@@ -72,7 +72,7 @@

Synopsis

-

f

+

f

Synopsis

diff --git a/test-files/golden-tests/symbols/using/using-typename.html b/test-files/golden-tests/symbols/using/using-typename.html index 5b9d4db99..78afc6b1e 100644 --- a/test-files/golden-tests/symbols/using/using-typename.html +++ b/test-files/golden-tests/symbols/using/using-typename.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -26,7 +26,7 @@

Types

-

Base

+

Base

Synopsis

@@ -57,7 +57,7 @@

Types

-

Base::V

+

Base::V

Synopsis

@@ -72,7 +72,7 @@

Synopsis

-

Derived

+

Derived

Synopsis

diff --git a/test-files/golden-tests/symbols/variable/no_unique_address.html b/test-files/golden-tests/symbols/variable/no_unique_address.html index 5cd49f86e..cfd38a0b4 100644 --- a/test-files/golden-tests/symbols/variable/no_unique_address.html +++ b/test-files/golden-tests/symbols/variable/no_unique_address.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -26,7 +26,7 @@

Types

-

Empty

+

Empty

Synopsis

@@ -43,7 +43,7 @@

Synopsis

-

T

+

T

Synopsis

@@ -74,7 +74,7 @@

Data Members

-

T::e

+

T::e

Synopsis

@@ -90,7 +90,7 @@

Synopsis

-

T::i

+

T::i

Synopsis

diff --git a/test-files/golden-tests/symbols/variable/ns-variables.html b/test-files/golden-tests/symbols/variable/ns-variables.html index e788cec13..60f0156a8 100644 --- a/test-files/golden-tests/symbols/variable/ns-variables.html +++ b/test-files/golden-tests/symbols/variable/ns-variables.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -46,7 +46,7 @@

Variables

-

T

+

T

Synopsis

@@ -63,7 +63,7 @@

Synopsis

-

i

+

i

Synopsis

@@ -78,7 +78,7 @@

Synopsis

-

j

+

j

Synopsis

@@ -93,7 +93,7 @@

Synopsis

-

k

+

k

Synopsis

@@ -109,7 +109,7 @@

Synopsis

-

l

+

l

Synopsis

@@ -125,7 +125,7 @@

Synopsis

-

pi

+

pi

Synopsis

@@ -140,7 +140,7 @@

Synopsis

-

t

+

t

Synopsis

@@ -156,7 +156,7 @@

Synopsis

-

x0

+

x0

Synopsis

@@ -172,7 +172,7 @@

Synopsis

-

x1

+

x1

Synopsis

@@ -189,7 +189,7 @@

Synopsis

-

x2

+

x2

Synopsis

diff --git a/test-files/golden-tests/symbols/variable/static-data-def-constexpr.html b/test-files/golden-tests/symbols/variable/static-data-def-constexpr.html index 63e73c399..c72e144fd 100644 --- a/test-files/golden-tests/symbols/variable/static-data-def-constexpr.html +++ b/test-files/golden-tests/symbols/variable/static-data-def-constexpr.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -26,7 +26,7 @@

Types

-

S

+

S

Synopsis

@@ -56,7 +56,7 @@

Static Data Members

-

S::s

+

S::s

Synopsis

@@ -72,7 +72,7 @@

Synopsis

-

T

+

T

Synopsis

@@ -102,7 +102,7 @@

Static Data Members

-

T::t

+

T::t

Synopsis

diff --git a/test-files/golden-tests/symbols/variable/static-data-def.html b/test-files/golden-tests/symbols/variable/static-data-def.html index 9e0be09e8..18df33ed5 100644 --- a/test-files/golden-tests/symbols/variable/static-data-def.html +++ b/test-files/golden-tests/symbols/variable/static-data-def.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -39,7 +39,7 @@

Functions

-

A

+

A

Synopsis

@@ -77,7 +77,7 @@

Static Data Members

-

A::v0

+

A::v0

Synopsis

@@ -93,7 +93,7 @@

Synopsis

-

A::v1

+

A::v1

Synopsis

@@ -109,7 +109,7 @@

Synopsis

-

A::v2

+

A::v2

Synopsis

@@ -125,7 +125,7 @@

Synopsis

-

A::v3

+

A::v3

Synopsis

@@ -141,7 +141,7 @@

Synopsis

-

A::v4

+

A::v4

Synopsis

@@ -157,7 +157,7 @@

Synopsis

-

A::v5

+

A::v5

Synopsis

@@ -173,7 +173,7 @@

Synopsis

-

A::v6

+

A::v6

Synopsis

@@ -189,7 +189,7 @@

Synopsis

-

A::v7

+

A::v7

Synopsis

@@ -205,7 +205,7 @@

Synopsis

-

B

+

B

Synopsis

@@ -236,7 +236,7 @@

Static Data Members

-

B::x0

+

B::x0

Synopsis

@@ -253,7 +253,7 @@

Synopsis

-

B::x1

+

B::x1

Synopsis

@@ -270,7 +270,7 @@

Synopsis

-

f

+

f

Synopsis

diff --git a/test-files/golden-tests/symbols/variable/static-data-template.html b/test-files/golden-tests/symbols/variable/static-data-template.html index be9d5afc7..8b201ee43 100644 --- a/test-files/golden-tests/symbols/variable/static-data-template.html +++ b/test-files/golden-tests/symbols/variable/static-data-template.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -25,7 +25,7 @@

Types

-

A

+

A

Synopsis

@@ -58,7 +58,7 @@

Static Data Members

-

A::x

+

A::x

Synopsis

@@ -77,7 +77,7 @@

Synopsis

-

A::x<T, long>

+

A::x<T, long>

Synopsis

@@ -94,7 +94,7 @@

Synopsis

-

A::x<U*, T>

+

A::x<U*, T>

Synopsis

diff --git a/test-files/golden-tests/symbols/variable/var-inline-constexpr.html b/test-files/golden-tests/symbols/variable/var-inline-constexpr.html index 3dcdf74b1..a2dbe268b 100644 --- a/test-files/golden-tests/symbols/variable/var-inline-constexpr.html +++ b/test-files/golden-tests/symbols/variable/var-inline-constexpr.html @@ -7,7 +7,7 @@

Reference

-

+

Variables

@@ -34,7 +34,7 @@

Variables

-

var

+

var

Synopsis

@@ -49,7 +49,7 @@

Synopsis

-

var_const

+

var_const

Synopsis

@@ -64,7 +64,7 @@

Synopsis

-

var_const_t

+

var_const_t

Synopsis

@@ -80,7 +80,7 @@

Synopsis

-

var_constexpr

+

var_constexpr

Synopsis

@@ -95,7 +95,7 @@

Synopsis

-

var_constexpr_t

+

var_constexpr_t

Synopsis

@@ -111,7 +111,7 @@

Synopsis

-

var_inline_const

+

var_inline_const

Synopsis

@@ -126,7 +126,7 @@

Synopsis

-

var_inline_const_t

+

var_inline_const_t

Synopsis

@@ -142,7 +142,7 @@

Synopsis

-

var_inline_constexpr

+

var_inline_constexpr

Synopsis

@@ -157,7 +157,7 @@

Synopsis

-

var_inline_constexpr_t

+

var_inline_constexpr_t

Synopsis

@@ -173,7 +173,7 @@

Synopsis

-

var_t

+

var_t

Synopsis

diff --git a/test-files/golden-tests/symbols/variable/var-template.html b/test-files/golden-tests/symbols/variable/var-template.html index e25cd2f9a..ea25d99e2 100644 --- a/test-files/golden-tests/symbols/variable/var-template.html +++ b/test-files/golden-tests/symbols/variable/var-template.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -40,7 +40,7 @@

Variables

-

B

+

B

Synopsis

@@ -72,7 +72,7 @@

Static Data Members

-

B::C

+

B::C

Synopsis

@@ -89,7 +89,7 @@

Synopsis

-

B::C<int>

+

B::C<int>

Synopsis

@@ -106,7 +106,7 @@

Synopsis

-

B::C<T*>

+

B::C<T*>

Synopsis

@@ -123,7 +123,7 @@

Synopsis

-

A

+

A

Synopsis

@@ -139,7 +139,7 @@

Synopsis

-

A<void>

+

A<void>

Synopsis

@@ -155,7 +155,7 @@

Synopsis

-

A<T&>

+

A<T&>

Synopsis

diff --git a/test-files/golden-tests/templates/c_mct_expl_inline.html b/test-files/golden-tests/templates/c_mct_expl_inline.html index dddaab5b2..e1890e8d6 100644 --- a/test-files/golden-tests/templates/c_mct_expl_inline.html +++ b/test-files/golden-tests/templates/c_mct_expl_inline.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -25,7 +25,7 @@

Types

-

A

+

A

Synopsis

@@ -56,7 +56,7 @@

Types

-

A::B

+

A::B

Synopsis

@@ -87,7 +87,7 @@

Member Functions

-

A::B::f

+

A::B::f

Synopsis

@@ -103,7 +103,7 @@

Synopsis

-

A::B<int>

+

A::B<int>

Synopsis

@@ -134,7 +134,7 @@

Member Functions

-

A::B<int>::g

+

A::B<int>::g

Synopsis

diff --git a/test-files/golden-tests/templates/c_mct_expl_outside.html b/test-files/golden-tests/templates/c_mct_expl_outside.html index 5bbddc336..6b8fcd3de 100644 --- a/test-files/golden-tests/templates/c_mct_expl_outside.html +++ b/test-files/golden-tests/templates/c_mct_expl_outside.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -25,7 +25,7 @@

Types

-

A

+

A

Synopsis

@@ -56,7 +56,7 @@

Types

-

A::B

+

A::B

Synopsis

@@ -87,7 +87,7 @@

Member Functions

-

A::B::f

+

A::B::f

Synopsis

@@ -103,7 +103,7 @@

Synopsis

-

A::B<int>

+

A::B<int>

Synopsis

@@ -134,7 +134,7 @@

Member Functions

-

A::B<int>::g

+

A::B<int>::g

Synopsis

diff --git a/test-files/golden-tests/templates/c_mft_expl_inline.html b/test-files/golden-tests/templates/c_mft_expl_inline.html index 264af1109..f310f8428 100644 --- a/test-files/golden-tests/templates/c_mft_expl_inline.html +++ b/test-files/golden-tests/templates/c_mft_expl_inline.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -25,7 +25,7 @@

Types

-

A

+

A

Synopsis

@@ -56,7 +56,7 @@

Member Functions

-

A::f

+

A::f

Synopses

@@ -85,7 +85,7 @@

Synopses

-

A::f

+

A::f

Synopsis

@@ -102,7 +102,7 @@

Synopsis

-

A::f<int>

+

A::f<int>

Synopsis

diff --git a/test-files/golden-tests/templates/c_mft_expl_outside.html b/test-files/golden-tests/templates/c_mft_expl_outside.html index a80adc249..2e5d76e68 100644 --- a/test-files/golden-tests/templates/c_mft_expl_outside.html +++ b/test-files/golden-tests/templates/c_mft_expl_outside.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -25,7 +25,7 @@

Types

-

A

+

A

Synopsis

@@ -56,7 +56,7 @@

Member Functions

-

A::f

+

A::f

Synopses

@@ -85,7 +85,7 @@

Synopses

-

A::f

+

A::f

Synopsis

@@ -102,7 +102,7 @@

Synopsis

-

A::f<int>

+

A::f<int>

Synopsis

diff --git a/test-files/golden-tests/templates/ct_expl.html b/test-files/golden-tests/templates/ct_expl.html index 6f02c6102..b5b3c3979 100644 --- a/test-files/golden-tests/templates/ct_expl.html +++ b/test-files/golden-tests/templates/ct_expl.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -26,7 +26,7 @@

Types

-

A

+

A

Synopsis

@@ -57,7 +57,7 @@

Member Functions

-

A::f

+

A::f

Synopsis

@@ -73,7 +73,7 @@

Synopsis

-

A<int>

+

A<int>

Synopsis

@@ -104,7 +104,7 @@

Member Functions

-

A<int>::g

+

A<int>::g

Synopsis

diff --git a/test-files/golden-tests/templates/ct_expl_dependency.html b/test-files/golden-tests/templates/ct_expl_dependency.html index 91b681dc6..c54867004 100644 --- a/test-files/golden-tests/templates/ct_expl_dependency.html +++ b/test-files/golden-tests/templates/ct_expl_dependency.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -25,7 +25,7 @@

Types

-

A<int>

+

A<int>

Synopsis

@@ -56,7 +56,7 @@

Member Functions

-

A<int>::g

+

A<int>::g

Synopsis

diff --git a/test-files/golden-tests/templates/ct_mc.html b/test-files/golden-tests/templates/ct_mc.html index 29d7003bc..b9bb24124 100644 --- a/test-files/golden-tests/templates/ct_mc.html +++ b/test-files/golden-tests/templates/ct_mc.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -25,7 +25,7 @@

Types

-

A

+

A

Synopsis

@@ -56,7 +56,7 @@

Types

-

A::B

+

A::B

Synopsis

@@ -86,7 +86,7 @@

Member Functions

-

A::B::f

+

A::B::f

Synopsis

diff --git a/test-files/golden-tests/templates/ct_mc_expl_outside.html b/test-files/golden-tests/templates/ct_mc_expl_outside.html index 5c9db023e..9af63d53c 100644 --- a/test-files/golden-tests/templates/ct_mc_expl_outside.html +++ b/test-files/golden-tests/templates/ct_mc_expl_outside.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -26,7 +26,7 @@

Types

-

A

+

A

Synopsis

@@ -57,7 +57,7 @@

Types

-

A::B

+

A::B

Synopsis

@@ -87,7 +87,7 @@

Member Functions

-

A::B::f

+

A::B::f

Synopsis

@@ -103,7 +103,7 @@

Synopsis

-

A<int>

+

A<int>

Synopsis

@@ -134,7 +134,7 @@

Types

-

A<int>::B

+

A<int>::B

Synopsis

@@ -164,7 +164,7 @@

Member Functions

-

A<int>::B::g

+

A<int>::B::g

Synopsis

diff --git a/test-files/golden-tests/templates/ct_mct.html b/test-files/golden-tests/templates/ct_mct.html index 6e0259eb8..2bc7614d4 100644 --- a/test-files/golden-tests/templates/ct_mct.html +++ b/test-files/golden-tests/templates/ct_mct.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -25,7 +25,7 @@

Types

-

A

+

A

Synopsis

@@ -56,7 +56,7 @@

Types

-

A::B

+

A::B

Synopsis

@@ -87,7 +87,7 @@

Member Functions

-

A::B::f

+

A::B::f

Synopsis

diff --git a/test-files/golden-tests/templates/ct_mct_expl_inline.html b/test-files/golden-tests/templates/ct_mct_expl_inline.html index 3b303dbac..ec0559aa8 100644 --- a/test-files/golden-tests/templates/ct_mct_expl_inline.html +++ b/test-files/golden-tests/templates/ct_mct_expl_inline.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -25,7 +25,7 @@

Types

-

A

+

A

Synopsis

@@ -57,7 +57,7 @@

Types

-

A::B

+

A::B

Synopsis

@@ -88,7 +88,7 @@

Member Functions

-

A::B::f

+

A::B::f

Synopsis

@@ -104,7 +104,7 @@

Synopsis

-

A::B<int>

+

A::B<int>

Synopsis

@@ -135,7 +135,7 @@

Member Functions

-

A::B<int>::g

+

A::B<int>::g

Synopsis

diff --git a/test-files/golden-tests/templates/ct_mct_expl_outside.html b/test-files/golden-tests/templates/ct_mct_expl_outside.html index eac5dd41a..2b3aa4109 100644 --- a/test-files/golden-tests/templates/ct_mct_expl_outside.html +++ b/test-files/golden-tests/templates/ct_mct_expl_outside.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -26,7 +26,7 @@

Types

-

A

+

A

Synopsis

@@ -57,7 +57,7 @@

Types

-

A::B

+

A::B

Synopsis

@@ -88,7 +88,7 @@

Member Functions

-

A::B::f

+

A::B::f

Synopsis

@@ -104,7 +104,7 @@

Synopsis

-

A<int>

+

A<int>

Synopsis

@@ -136,7 +136,7 @@

Types

-

A<int>::B

+

A<int>::B

Synopsis

@@ -154,7 +154,7 @@

Synopsis

-

A<int>::B<int>

+

A<int>::B<int>

Synopsis

@@ -185,7 +185,7 @@

Member Functions

-

A<int>::B<int>::g

+

A<int>::B<int>::g

Synopsis

diff --git a/test-files/golden-tests/templates/ct_mf.html b/test-files/golden-tests/templates/ct_mf.html index 7f8d1cf49..89e884c26 100644 --- a/test-files/golden-tests/templates/ct_mf.html +++ b/test-files/golden-tests/templates/ct_mf.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -25,7 +25,7 @@

Types

-

A

+

A

Synopsis

@@ -56,7 +56,7 @@

Member Functions

-

A::f

+

A::f

Synopsis

diff --git a/test-files/golden-tests/templates/ct_mf_expl_outside.html b/test-files/golden-tests/templates/ct_mf_expl_outside.html index 6e908420e..a6646dcae 100644 --- a/test-files/golden-tests/templates/ct_mf_expl_outside.html +++ b/test-files/golden-tests/templates/ct_mf_expl_outside.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -26,7 +26,7 @@

Types

-

A

+

A

Synopsis

@@ -57,7 +57,7 @@

Member Functions

-

A::f

+

A::f

Synopsis

@@ -73,7 +73,7 @@

Synopsis

-

A<int>

+

A<int>

Synopsis

@@ -104,7 +104,7 @@

Member Functions

-

A<int>::f

+

A<int>::f

Synopsis

diff --git a/test-files/golden-tests/templates/ct_mft.html b/test-files/golden-tests/templates/ct_mft.html index 7a4d4157f..22a329503 100644 --- a/test-files/golden-tests/templates/ct_mft.html +++ b/test-files/golden-tests/templates/ct_mft.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -25,7 +25,7 @@

Types

-

A

+

A

Synopsis

@@ -56,7 +56,7 @@

Member Functions

-

A::f

+

A::f

Synopsis

diff --git a/test-files/golden-tests/templates/ct_mft_expl_inline.html b/test-files/golden-tests/templates/ct_mft_expl_inline.html index 3ecdab504..cac28653c 100644 --- a/test-files/golden-tests/templates/ct_mft_expl_inline.html +++ b/test-files/golden-tests/templates/ct_mft_expl_inline.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -25,7 +25,7 @@

Types

-

A

+

A

Synopsis

@@ -57,7 +57,7 @@

Member Functions

-

A::f

+

A::f

Synopses

@@ -86,7 +86,7 @@

Synopses

-

A::f

+

A::f

Synopsis

@@ -103,7 +103,7 @@

Synopsis

-

A::f<int>

+

A::f<int>

Synopsis

diff --git a/test-files/golden-tests/templates/ct_mft_expl_outside.html b/test-files/golden-tests/templates/ct_mft_expl_outside.html index 5ba55f9b4..f8b19fbd5 100644 --- a/test-files/golden-tests/templates/ct_mft_expl_outside.html +++ b/test-files/golden-tests/templates/ct_mft_expl_outside.html @@ -7,7 +7,7 @@

Reference

-

+

Types

@@ -26,7 +26,7 @@

Types

-

A

+

A

Synopsis

@@ -57,7 +57,7 @@

Member Functions

-

A::f

+

A::f

Synopsis

@@ -74,7 +74,7 @@

Synopsis

-

A<int>

+

A<int>

Synopsis

@@ -106,7 +106,7 @@

Member Functions

-

A<int>::f

+

A<int>::f

Synopses

@@ -135,7 +135,7 @@

Synopses

-

A<int>::f

+

A<int>::f

Synopsis

@@ -152,7 +152,7 @@

Synopsis

-

A<int>::f<int>

+

A<int>::f<int>

Synopsis

diff --git a/test-files/golden-tests/templates/ft_expl.html b/test-files/golden-tests/templates/ft_expl.html index 4ab21409b..9b51b74cc 100644 --- a/test-files/golden-tests/templates/ft_expl.html +++ b/test-files/golden-tests/templates/ft_expl.html @@ -7,7 +7,7 @@

Reference

-

+

Functions

@@ -26,7 +26,7 @@

Functions

-

f

+

f

Synopses

@@ -55,7 +55,7 @@

Synopses

-

f

+

f

Synopsis

@@ -72,7 +72,7 @@

Synopsis

-

f<int>

+

f<int>

Synopsis

From 2e531aa4fc2196641b6899f5d8b36e9908df65de Mon Sep 17 00:00:00 2001 From: Alan de Freitas Date: Thu, 25 Sep 2025 01:14:25 -0500 Subject: [PATCH 09/23] refactor(lib): use mrdocs::Optional in public API Use mrdocs::Optional throughout the public API for consistency and extensibility, including the optional reference return types. --- include/mrdocs/ADT/Nullable.hpp | 1 + include/mrdocs/ADT/Optional.hpp | 392 ++++++++++++++---- include/mrdocs/Dom/Value.hpp | 16 + include/mrdocs/Metadata/Expression.hpp | 3 +- include/mrdocs/Metadata/Info/Concept.hpp | 3 +- include/mrdocs/Metadata/Info/Function.hpp | 3 +- include/mrdocs/Metadata/Info/Guide.hpp | 3 +- include/mrdocs/Metadata/Info/InfoBase.hpp | 2 +- include/mrdocs/Metadata/Info/Record.hpp | 3 +- include/mrdocs/Metadata/Info/Typedef.hpp | 3 +- include/mrdocs/Metadata/Info/Variable.hpp | 3 +- include/mrdocs/Metadata/Javadoc.hpp | 2 +- include/mrdocs/Metadata/Javadoc/Inline.hpp | 2 +- .../Metadata/Specifiers/OperatorKind.hpp | 3 +- include/mrdocs/Metadata/Template.hpp | 6 +- include/mrdocs/Metadata/Type.hpp | 4 +- .../mrdocs/Metadata/Type/NamedTypeInfo.hpp | 2 +- include/mrdocs/Support/Glob.hpp | 7 +- src/lib/AST/ASTVisitor.cpp | 24 +- src/lib/AST/ASTVisitor.hpp | 24 +- src/lib/AST/ClangHelpers.cpp | 4 +- src/lib/AST/ClangHelpers.hpp | 4 +- src/lib/AST/MrDocsFileSystem.hpp | 2 +- src/lib/AST/NameInfoBuilder.cpp | 4 +- src/lib/AST/NameInfoBuilder.hpp | 4 +- src/lib/AST/ParseJavadoc.cpp | 4 +- src/lib/AST/ParseJavadoc.hpp | 2 +- src/lib/AST/ParseRef.cpp | 6 +- src/lib/AST/TerminalTypeVisitor.hpp | 6 +- src/lib/AST/TypeInfoBuilder.cpp | 6 +- src/lib/AST/TypeInfoBuilder.hpp | 4 +- src/lib/CorpusImpl.cpp | 2 +- src/lib/Gen/adoc/AdocEscape.cpp | 2 +- src/lib/Gen/hbs/SinglePageVisitor.hpp | 2 +- src/lib/Gen/hbs/VisitorHelpers.cpp | 4 +- src/lib/Gen/xml/XMLWriter.cpp | 6 +- src/lib/Gen/xml/XMLWriter.hpp | 6 +- .../Metadata/Finalizers/Javadoc/Function.hpp | 4 +- .../Metadata/Finalizers/JavadocFinalizer.cpp | 2 +- .../Finalizers/SortMembersFinalizer.cpp | 16 +- src/lib/Metadata/Info/Function.cpp | 2 +- src/lib/Metadata/Type.cpp | 6 +- src/lib/Support/Glob.cpp | 6 +- src/lib/Support/Handlebars.cpp | 2 +- src/lib/Support/Report.cpp | 11 +- src/test/ADT/Optional.cpp | 2 +- src/test/lib/Dom/Dom.cpp | 6 +- src/test/lib/Support/Handlebars.cpp | 8 +- src/tool/CompilerInfo.cpp | 2 +- src/tool/CompilerInfo.hpp | 5 +- 50 files changed, 457 insertions(+), 189 deletions(-) diff --git a/include/mrdocs/ADT/Nullable.hpp b/include/mrdocs/ADT/Nullable.hpp index bd5038402..c27fdf95f 100644 --- a/include/mrdocs/ADT/Nullable.hpp +++ b/include/mrdocs/ADT/Nullable.hpp @@ -92,6 +92,7 @@ struct sentinel_traits which corresponds to -1 when converted. **/ template +requires (!std::same_as) struct sentinel_traits { static constexpr T diff --git a/include/mrdocs/ADT/Optional.hpp b/include/mrdocs/ADT/Optional.hpp index a898114c9..a743fb9c4 100644 --- a/include/mrdocs/ADT/Optional.hpp +++ b/include/mrdocs/ADT/Optional.hpp @@ -22,6 +22,38 @@ namespace clang::mrdocs { +template +class Optional; + +namespace detail { +template +using ConvertsFromAnyCvRef = std::disjunction< + std::is_constructible, + std::is_convertible, + std::is_constructible, + std::is_convertible, + std::is_constructible, + std::is_convertible, + std::is_constructible, + std::is_convertible>; + +template +using ConvertsFromOptional = ConvertsFromAnyCvRef>; + +template +using AssignsFromOptional = std::disjunction< + std::is_assignable const&>, + std::is_assignable&>, + std::is_assignable const&&>, + std::is_assignable&&>>; + +template +inline constexpr bool isOptionalV = false; + +template +inline constexpr bool isOptionalV> = true; +} + /** A compact optional that automatically uses nullable_traits when available. @@ -66,6 +98,23 @@ class Optional { return noexcept(std::declval const&>().has_value()); } + template> + static constexpr bool NotConstructingBoolFromOptional + = true; + + template + static constexpr bool NotConstructingBoolFromOptional + = !detail::isOptionalV>; + + template> + static constexpr bool ConstructFromContainedValue + = !detail::ConvertsFromOptional::value; + + template + static constexpr bool ConstructFromContainedValue + = true; + + storage_t s_; public: @@ -95,26 +144,17 @@ class Optional { /// Move constructor constexpr Optional(Optional&&) = default; - /// Copy assignment - constexpr Optional& - operator=(Optional const&) = default; - - /// Move assignment - constexpr Optional& - operator=(Optional&&) = default; - /** Construct from a value. @param u The value to store. It must be convertible to T. **/ - template - requires( - !std::same_as, Optional> - && !std::same_as, std::in_place_t> - && !std::same_as, std::nullopt_t> - && std::is_constructible_v) - constexpr explicit Optional(U&& u) noexcept( - std::is_nothrow_constructible_v) + template > + requires(!std::is_same_v>) + && (!std::is_same_v>) + && std::is_constructible_v + && NotConstructingBoolFromOptional + constexpr explicit(!std::is_convertible_v) + Optional(U&& u) noexcept(std::is_nothrow_constructible_v) : s_([&] { if constexpr (uses_nullable_traits) { @@ -126,34 +166,223 @@ class Optional { }()) {} + template + requires(!std::is_same_v) && std::is_constructible_v + && ConstructFromContainedValue + constexpr explicit(!std::is_convertible_v) + Optional(Optional const& t) noexcept(std::is_nothrow_constructible_v) + : s_([&] { + if constexpr (uses_nullable_traits) + { + if (t) + return storage_t(static_cast(*t)); + else + return storage_t(nullable_traits::null()); + } else + { + if (t) + return storage_t(*t); + else + return storage_t(std::nullopt); + } + }()) + {} + + template + requires(!std::is_same_v) + && std::is_constructible_v && ConstructFromContainedValue + constexpr explicit(!std::is_convertible_v) + Optional(Optional&& t) noexcept(std::is_nothrow_constructible_v) + : s_([&] { + if constexpr (uses_nullable_traits) + { + if (t) + return storage_t(static_cast(std::move(*t))); + else + return storage_t(nullable_traits::null()); + } else + { + if (t) + return storage_t(std::move(*t)); + else + return storage_t(std::nullopt); + } + }()) + {} + + template + requires + std::is_constructible_v && + ConstructFromContainedValue + constexpr explicit(!std::is_convertible_v) + Optional(std::optional const& t) noexcept(std::is_nothrow_constructible_v) + : s_([&] { + if constexpr (uses_nullable_traits) + { + if (t) + return storage_t(static_cast(*t)); + else + return storage_t(nullable_traits::null()); + } else + { + if (t) + return storage_t(*t); + else + return storage_t(std::nullopt); + } + }()) + {} + + template + requires + std::is_constructible_v && + ConstructFromContainedValue + constexpr explicit(!std::is_convertible_v) + Optional(std::optional&& t) noexcept(std::is_nothrow_constructible_v) + : s_([&] { + if constexpr (uses_nullable_traits) + { + if (t) + return storage_t(static_cast(std::move(*t))); + else + return storage_t(nullable_traits::null()); + } else + { + if (t) + return storage_t(std::move(*t)); + else + return storage_t(std::nullopt); + } + }()) + {} + + template + requires std::is_constructible_v + explicit constexpr + Optional(std::in_place_t, Args&&... args) + noexcept(std::is_nothrow_constructible_v) + : s_([&] { + if constexpr (uses_nullable_traits) + { + return storage_t(T(std::forward(args)...)); + } else + { + return storage_t(std::in_place, std::forward(args)...); + } + }()) + {} + + template + requires std::is_constructible_v&, Args...> + explicit constexpr Optional( + std::in_place_t, std::initializer_list il, Args&&... args) + noexcept(std::is_nothrow_constructible_v&, Args...>) + : s_([&] { + if constexpr (uses_nullable_traits) + { + return storage_t(T(il, std::forward(args)...)); + } else + { + return storage_t(std::in_place, il, std::forward(args)...); + } + }()) + {} + + /// Copy assignment + constexpr Optional& + operator=(Optional const&) = default; + + /// Move assignment + constexpr Optional& + operator=(Optional&&) = default; + + constexpr Optional& + operator=(std::nullptr_t) noexcept(reset_noex_()) + { + reset(); + MRDOCS_ASSERT(!has_value()); + return *this; + } + /** Assign from a value. @param u The value to store. It must be convertible to T. **/ - template - requires( - !std::same_as, Optional> - && std::is_constructible_v && std::is_assignable_v) - constexpr - Optional& - operator=(U&& u) noexcept(std::is_nothrow_assignable_v) + template > + requires(!std::is_same_v>) + && std::is_constructible_v && std::is_assignable_v + constexpr Optional& + operator=(U&& u) noexcept( + std::is_nothrow_constructible_v && + std::is_nothrow_assignable_v ) { if constexpr (uses_nullable_traits) { s_ = std::forward(u); - } else + } + else { s_ = std::forward(u); } return *this; } - /// Assign null (disengage). + template + requires (!std::is_same_v) + && std::is_constructible_v + && std::is_assignable_v + && (!detail::ConvertsFromOptional::value) + && (!detail::AssignsFromOptional::value) constexpr Optional& - operator=(std::nullptr_t) noexcept(reset_noex_()) + operator=(const Optional& u) noexcept( + std::is_nothrow_constructible_v + && std::is_nothrow_assignable_v) { - reset(); - MRDOCS_ASSERT(!has_value()); + if (u) + { + if constexpr (uses_nullable_traits) + { + s_ = *u; + } + else + { + s_ = *u; + } + } + else + { + reset(); + } + return *this; + } + + + template + requires (!std::is_same_v) + && std::is_constructible_v + && std::is_assignable_v + && (!detail::ConvertsFromOptional::value) + && (!detail::AssignsFromOptional::value) + constexpr Optional& + operator=(Optional&& u) noexcept( + std::is_nothrow_constructible_v + && std::is_nothrow_assignable_v) + { + if (u) + { + if constexpr (uses_nullable_traits) + { + s_ = std::move(*u); + } + else + { + s_ = std::move(*u); + } + } + else + { + reset(); + } return *this; } @@ -195,6 +424,23 @@ class Optional { } } + /** Determine if the value is inlined via nullable traits. + + This is a compile-time property of T. If nullable_traits is not + specialized, this function returns false to indicate that the + optional uses std::optional as storage with an extra discriminator. + If nullable_traits is specialized, this function returns true + to suggest that the null state is encoded inside T and no extra + storage is used. + + @return `true` if the optional uses nullable_traits for storage. + */ + static constexpr bool + is_inlined() noexcept + { + return uses_nullable_traits; + } + /** True if engaged (contains a value). @return `true` if the optional contains a value. @@ -351,50 +597,44 @@ class Optional { }; namespace detail { -template -inline constexpr bool isOptionalV = false; - -template -inline constexpr bool isOptionalV> = true; - template -using OptionalRelopT = std::enable_if_t, bool>; +using OptionalRelOpT = std::enable_if_t, bool>; template -using OptionalEqT = OptionalRelopT< +using OptionalEqT = OptionalRelOpT< decltype(std::declval() == std::declval())>; template -using OptionalNeT = OptionalRelopT< +using OptionalNeT = OptionalRelOpT< decltype(std::declval() != std::declval())>; template -using OptionalLtT = OptionalRelopT< +using OptionalLtT = OptionalRelOpT< decltype(std::declval() < std::declval())>; template -using OptionalGtT = OptionalRelopT< +using OptionalGtT = OptionalRelOpT< decltype(std::declval() > std::declval())>; template -using OptionalLeT = OptionalRelopT< +using OptionalLeT = OptionalRelOpT< decltype(std::declval() <= std::declval())>; template -using OptionalGeT = detail::OptionalRelopT< +using OptionalGeT = detail::OptionalRelOpT< decltype(std::declval() >= std::declval())>; template -concept isDerivedFromOptional = requires(T const& __t) { +concept isDerivedFromOptional = requires(T const& t) { [](Optional const&) { - }(__t); + }(t); }; } // namespace detail /** Compares two Optional values for equality. - Returns true if both are engaged and their contained values are equal, or both are disengaged. + @return `true` if both optionals are engaged and equal, or both are disengaged; otherwise, `false`. */ template constexpr detail::OptionalEqT @@ -405,8 +645,8 @@ operator==(Optional const& lhs, Optional const& rhs) } /** Compares two Optional values for inequality. - Returns true if their engagement states differ or their contained values are not equal. + @return `true` if the optionals differ in engagement or value; otherwise, `false`. */ template constexpr detail::OptionalNeT @@ -417,8 +657,8 @@ operator!=(Optional const& lhs, Optional const& rhs) } /** Checks if the left Optional is less than the right Optional. - Returns true if the right is engaged and either the left is disengaged or its value is less. + @return `true` if `lhs` is less than `rhs` according to the described rules; otherwise, `false`. */ template constexpr detail::OptionalLtT @@ -428,8 +668,8 @@ operator<(Optional const& lhs, Optional const& rhs) } /** Checks if the left Optional is greater than the right Optional. - Returns true if the left is engaged and either the right is disengaged or its value is greater. + @return `true` if `lhs` is greater than `rhs` according to the described rules; otherwise, `false`. */ template constexpr detail::OptionalGtT @@ -439,8 +679,8 @@ operator>(Optional const& lhs, Optional const& rhs) } /** Checks if the left Optional is less than or equal to the right Optional. - Returns true if the left is disengaged or the right is engaged and the left's value is less or equal. + @return `true` if `lhs` is less than or equal to `rhs` according to the described rules; otherwise, `false`. */ template constexpr detail::OptionalLeT @@ -450,8 +690,8 @@ operator<=(Optional const& lhs, Optional const& rhs) } /** Checks if the left Optional is greater than or equal to the right Optional. - Returns true if the right is disengaged or the left is engaged and its value is greater or equal. + @return `true` if `lhs` is greater than or equal to `rhs` according to the described rules; otherwise, `false`. */ template constexpr detail::OptionalGeT @@ -461,8 +701,8 @@ operator>=(Optional const& lhs, Optional const& rhs) } /** Performs a three-way comparison between two Optional values. - If both are engaged, compares their contained values; otherwise, compares engagement state. + @return The result of the three-way comparison between the optionals or their values. */ template U> [[nodiscard]] @@ -473,8 +713,8 @@ operator<=>(Optional const& x, Optional const& y) } /** Checks if the Optional is disengaged (equal to std::nullopt). - Returns true if the Optional does not contain a value. + @return `true` if the optional is disengaged; otherwise, `false`. */ template [[nodiscard]] @@ -485,8 +725,8 @@ operator==(Optional const& lhs, std::nullopt_t) noexcept } /** Performs a three-way comparison between an Optional and std::nullopt. - Returns std::strong_ordering::greater if engaged, std::strong_ordering::equal if disengaged. + @return The result of the three-way comparison with `std::nullopt`. */ template [[nodiscard]] @@ -497,56 +737,56 @@ operator<=>(Optional const& x, std::nullopt_t) noexcept } /** Compares an engaged Optional to a value for equality. - Returns true if the Optional is engaged and its value equals rhs. + @return `true` if the optional is engaged and equal to `rhs`; otherwise, `false`. */ template requires(!detail::isOptionalV) constexpr detail::OptionalEqT -operator== [[nodiscard]] (Optional const& lhs, U const& rhs) +operator==(Optional const& lhs, U const& rhs) { return lhs && *lhs == rhs; } /** Compares a value to an engaged Optional for equality. - Returns true if the Optional is engaged and its value equals lhs. + @return `true` if the optional is engaged and equal to `lhs`; otherwise, `false`. */ template requires(!detail::isOptionalV) constexpr detail::OptionalEqT -operator== [[nodiscard]] (T const& lhs, Optional const& rhs) +operator==(T const& lhs, Optional const& rhs) { return rhs && lhs == *rhs; } /** Compares an Optional to a value for inequality. - Returns true if the Optional is disengaged or its value does not equal rhs. + @return `true` if the optional is disengaged or not equal to `rhs`; otherwise, `false`. */ template requires(!detail::isOptionalV) constexpr detail::OptionalNeT -operator!= [[nodiscard]] (Optional const& lhs, U const& rhs) +operator!=(Optional const& lhs, U const& rhs) { return !lhs || *lhs != rhs; } /** Compares a value to an Optional for inequality. - Returns true if the Optional is disengaged or its value does not equal lhs. + @return `true` if the optional is disengaged or not equal to `lhs`; otherwise, `false`. */ template requires(!detail::isOptionalV) constexpr detail::OptionalNeT -operator!= [[nodiscard]] (T const& lhs, Optional const& rhs) +operator!=(T const& lhs, Optional const& rhs) { return !rhs || lhs != *rhs; } /** Checks if the Optional is less than a value. - Returns true if the Optional is disengaged or its value is less than rhs. + @return `true` if the optional is disengaged or less than `rhs`; otherwise, `false`. */ template requires(!detail::isOptionalV) @@ -557,8 +797,8 @@ operator<[[nodiscard]] (Optional const& lhs, U const& rhs) } /** Checks if a value is less than an engaged Optional. - Returns true if the Optional is engaged and lhs is less than its value. + @return `true` if the optional is engaged and `lhs` is less than its value; otherwise, `false`. */ template requires(!detail::isOptionalV) @@ -569,87 +809,87 @@ operator<[[nodiscard]] (T const& lhs, Optional const& rhs) } /** Checks if the Optional is greater than a value. - Returns true if the Optional is engaged and its value is greater than rhs. + @return `true` if the optional is engaged and greater than `rhs`; otherwise, `false`. */ template requires(!detail::isOptionalV) constexpr detail::OptionalGtT -operator> [[nodiscard]] (Optional const& lhs, U const& rhs) +operator>(Optional const& lhs, U const& rhs) { return lhs && *lhs > rhs; } /** Checks if a value is greater than an Optional. - Returns true if the Optional is disengaged or lhs is greater than its value. + @return `true` if the optional is disengaged or `lhs` is greater than its value; otherwise, `false`. */ template requires(!detail::isOptionalV) constexpr detail::OptionalGtT -operator> [[nodiscard]] (T const& lhs, Optional const& rhs) +operator>(T const& lhs, Optional const& rhs) { return !rhs || lhs > *rhs; } /** Checks if the Optional is less than or equal to a value. - Returns true if the Optional is disengaged or its value is less than or equal to rhs. + @return `true` if the optional is disengaged or less than or equal to `rhs`; otherwise, `false`. */ template requires(!detail::isOptionalV) constexpr detail::OptionalLeT -operator<= [[nodiscard]] (Optional const& lhs, U const& rhs) +operator<=(Optional const& lhs, U const& rhs) { return !lhs || *lhs <= rhs; } /** Checks if a value is less than or equal to an engaged Optional. - Returns true if the Optional is engaged and lhs is less than or equal to its value. + @return `true` if the optional is engaged and `lhs` is less than or equal to its value; otherwise, `false`. */ template requires(!detail::isOptionalV) constexpr detail::OptionalLeT -operator<= [[nodiscard]] (T const& lhs, Optional const& rhs) +operator<=(T const& lhs, Optional const& rhs) { return rhs && lhs <= *rhs; } /** Checks if the Optional is greater than or equal to a value. - Returns true if the Optional is engaged and its value is greater than or equal to rhs. + @return `true` if the optional is engaged and greater than or equal to `rhs`; otherwise, `false`. */ template requires(!detail::isOptionalV) constexpr detail::OptionalGeT -operator>= [[nodiscard]] (Optional const& lhs, U const& rhs) +operator>=(Optional const& lhs, U const& rhs) { return lhs && *lhs >= rhs; } /** Checks if a value is greater than or equal to an Optional. - Returns true if the Optional is disengaged or lhs is greater than or equal to its value. + @return `true` if the optional is disengaged or `lhs` is greater than or equal to its value; otherwise, `false`. */ template requires(!detail::isOptionalV) constexpr detail::OptionalGeT -operator>= [[nodiscard]] (T const& lhs, Optional const& rhs) +operator>=(T const& lhs, Optional const& rhs) { return !rhs || lhs >= *rhs; } /** Performs a three-way comparison between an Optional and a value. - If the Optional is engaged, compares its value to v; otherwise, returns less. + @return The result of the three-way comparison with the value. */ template requires(!detail::isDerivedFromOptional) && requires { typename std::compare_three_way_result_t; } && std::three_way_comparable_with constexpr std::compare_three_way_result_t -operator<=> [[nodiscard]] (Optional const& x, U const& v) +operator<=>(Optional const& x, U const& v) { return bool(x) ? *x <=> v : std::strong_ordering::less; } diff --git a/include/mrdocs/Dom/Value.hpp b/include/mrdocs/Dom/Value.hpp index c9cc97f82..468bc4f39 100644 --- a/include/mrdocs/Dom/Value.hpp +++ b/include/mrdocs/Dom/Value.hpp @@ -642,6 +642,22 @@ stringOrNull( return nullptr; } +/** Return a non-empty string, or a null. + + @param s The string to check. +*/ +inline +Value +stringOrNull( + std::string const& s) +{ + if(!s.empty()) + { + return {s}; + } + return nullptr; +} + //------------------------------------------------ /** Customization point tag. diff --git a/include/mrdocs/Metadata/Expression.hpp b/include/mrdocs/Metadata/Expression.hpp index fb4996eec..76f4cf16a 100644 --- a/include/mrdocs/Metadata/Expression.hpp +++ b/include/mrdocs/Metadata/Expression.hpp @@ -12,6 +12,7 @@ #define MRDOCS_API_METADATA_EXPRESSION_HPP #include +#include #include #include #include @@ -44,7 +45,7 @@ struct ConstantExprInfo The value of an expression will be unknown if it is e.g. dependent on a template parameter */ - std::optional Value; + Optional Value; auto operator<=>(ConstantExprInfo const&) const = default; diff --git a/include/mrdocs/Metadata/Info/Concept.hpp b/include/mrdocs/Metadata/Info/Concept.hpp index 65618e157..ba6a15d15 100644 --- a/include/mrdocs/Metadata/Info/Concept.hpp +++ b/include/mrdocs/Metadata/Info/Concept.hpp @@ -13,6 +13,7 @@ #include #include +#include #include #include #include @@ -27,7 +28,7 @@ struct ConceptInfo final { /** The concepts template parameters */ - std::optional Template; + Optional Template; /** The concepts constraint-expression */ diff --git a/include/mrdocs/Metadata/Info/Function.hpp b/include/mrdocs/Metadata/Info/Function.hpp index e3e5c3420..de1b9f09d 100644 --- a/include/mrdocs/Metadata/Info/Function.hpp +++ b/include/mrdocs/Metadata/Info/Function.hpp @@ -15,6 +15,7 @@ #define MRDOCS_API_METADATA_INFO_FUNCTION_HPP #include +#include #include #include #include @@ -36,7 +37,7 @@ struct FunctionInfo final std::vector Params; /// When present, this function is a template or specialization. - std::optional Template; + Optional Template; /// The class of function this is FunctionClass Class = FunctionClass::Normal; diff --git a/include/mrdocs/Metadata/Info/Guide.hpp b/include/mrdocs/Metadata/Info/Guide.hpp index 869ef653d..67de5f07f 100644 --- a/include/mrdocs/Metadata/Info/Guide.hpp +++ b/include/mrdocs/Metadata/Info/Guide.hpp @@ -13,6 +13,7 @@ #include #include +#include #include #include #include @@ -35,7 +36,7 @@ struct GuideInfo final /** Template head, if any. */ - std::optional Template; + Optional Template; /** The parameters of the deduction guide. */ diff --git a/include/mrdocs/Metadata/Info/InfoBase.hpp b/include/mrdocs/Metadata/Info/InfoBase.hpp index 9b22ef314..7048821b1 100644 --- a/include/mrdocs/Metadata/Info/InfoBase.hpp +++ b/include/mrdocs/Metadata/Info/InfoBase.hpp @@ -78,7 +78,7 @@ struct MRDOCS_VISIBLE Info /** The extracted javadoc for this declaration. */ - std::optional javadoc; + Optional javadoc; //-------------------------------------------- diff --git a/include/mrdocs/Metadata/Info/Record.hpp b/include/mrdocs/Metadata/Info/Record.hpp index 1c76e4a05..ab3be600a 100644 --- a/include/mrdocs/Metadata/Info/Record.hpp +++ b/include/mrdocs/Metadata/Info/Record.hpp @@ -13,6 +13,7 @@ #define MRDOCS_API_METADATA_INFO_RECORD_HPP #include +#include #include #include #include @@ -31,7 +32,7 @@ struct RecordInfo final RecordKeyKind KeyKind = RecordKeyKind::Struct; /// When present, this record is a template or specialization. - std::optional Template; + Optional Template; // Indicates if the record was declared using a typedef. // Things like anonymous structs in a typedef: diff --git a/include/mrdocs/Metadata/Info/Typedef.hpp b/include/mrdocs/Metadata/Info/Typedef.hpp index 8ff148635..a8c66aa6e 100644 --- a/include/mrdocs/Metadata/Info/Typedef.hpp +++ b/include/mrdocs/Metadata/Info/Typedef.hpp @@ -14,6 +14,7 @@ #define MRDOCS_API_METADATA_INFO_TYPEDEF_HPP #include +#include #include #include #include @@ -41,7 +42,7 @@ struct TypedefInfo final */ bool IsUsing = false; - std::optional Template; + Optional Template; //-------------------------------------------- diff --git a/include/mrdocs/Metadata/Info/Variable.hpp b/include/mrdocs/Metadata/Info/Variable.hpp index 5f9b8b5a3..5512318b7 100644 --- a/include/mrdocs/Metadata/Info/Variable.hpp +++ b/include/mrdocs/Metadata/Info/Variable.hpp @@ -12,6 +12,7 @@ #ifndef MRDOCS_API_METADATA_INFO_VARIABLE_HPP #define MRDOCS_API_METADATA_INFO_VARIABLE_HPP +#include #include #include #include @@ -33,7 +34,7 @@ struct VariableInfo final /** The type of the variable */ Optional> Type = std::nullopt; - std::optional Template; + Optional Template; /** The default member initializer, if any. */ diff --git a/include/mrdocs/Metadata/Javadoc.hpp b/include/mrdocs/Metadata/Javadoc.hpp index 63bf2ace7..ac2e4136a 100644 --- a/include/mrdocs/Metadata/Javadoc.hpp +++ b/include/mrdocs/Metadata/Javadoc.hpp @@ -56,7 +56,7 @@ struct MRDOCS_DECL // Symbol Metadata /// A brief description of the symbol. - std::optional brief; + Optional brief; /** The list of return type descriptions. diff --git a/include/mrdocs/Metadata/Javadoc/Inline.hpp b/include/mrdocs/Metadata/Javadoc/Inline.hpp index 7efea7b68..ee1a8a0b7 100644 --- a/include/mrdocs/Metadata/Javadoc/Inline.hpp +++ b/include/mrdocs/Metadata/Javadoc/Inline.hpp @@ -29,7 +29,7 @@ namespace clang::mrdocs::doc { /** Visit an inline. - @param inline The inline to visit. + @param el The inline element to visit. @param fn The function to call for each inline. @param args Additional arguments to pass to the function. @return The result of calling the function. diff --git a/include/mrdocs/Metadata/Specifiers/OperatorKind.hpp b/include/mrdocs/Metadata/Specifiers/OperatorKind.hpp index 879a35424..bd2a70c2d 100644 --- a/include/mrdocs/Metadata/Specifiers/OperatorKind.hpp +++ b/include/mrdocs/Metadata/Specifiers/OperatorKind.hpp @@ -13,6 +13,7 @@ #define MRDOCS_API_METADATA_SPECIFIERS_OPERATORKIND_HPP #include +#include #include #include @@ -196,7 +197,7 @@ getSafeOperatorName( @param nParams The number of parameters the operator takes. @return The readable name, or nullopt if the operator is not recognized. */ -std::optional +Optional getOperatorReadableName( OperatorKind kind, int nParams); diff --git a/include/mrdocs/Metadata/Template.hpp b/include/mrdocs/Metadata/Template.hpp index 47ad0180b..c66712a06 100644 --- a/include/mrdocs/Metadata/Template.hpp +++ b/include/mrdocs/Metadata/Template.hpp @@ -83,7 +83,7 @@ merge(TemplateInfo& I, TemplateInfo&& Other); inline auto -operator<=>(std::optional const& lhs, std::optional const& rhs) +operator<=>(Optional const& lhs, Optional const& rhs) { if (!lhs) { @@ -102,7 +102,7 @@ operator<=>(std::optional const& lhs, std::optional inline bool -operator==(std::optional const& lhs, std::optional const& rhs) +operator==(Optional const& lhs, Optional const& rhs) { return lhs <=> rhs == std::strong_ordering::equal; } @@ -120,7 +120,7 @@ void tag_invoke( dom::ValueFromTag, dom::Value& v, - std::optional const& I, + Optional const& I, DomCorpus const* domCorpus) { if (!I) diff --git a/include/mrdocs/Metadata/Type.hpp b/include/mrdocs/Metadata/Type.hpp index 674f11889..57a94cfe1 100644 --- a/include/mrdocs/Metadata/Type.hpp +++ b/include/mrdocs/Metadata/Type.hpp @@ -122,12 +122,12 @@ operator==( by a specifier (e.g. "int" in "pointer to int". */ MRDOCS_DECL -std::optional const>> +Optional const>> innerType(TypeInfo const& TI) noexcept; /// @copydoc innerType(TypeInfo const&) MRDOCS_DECL -std::optional>> +Optional>> innerType(TypeInfo& TI) noexcept; /// @copydoc innerType(TypeInfo const&) diff --git a/include/mrdocs/Metadata/Type/NamedTypeInfo.hpp b/include/mrdocs/Metadata/Type/NamedTypeInfo.hpp index 363890bf1..a9fd234f6 100644 --- a/include/mrdocs/Metadata/Type/NamedTypeInfo.hpp +++ b/include/mrdocs/Metadata/Type/NamedTypeInfo.hpp @@ -27,7 +27,7 @@ struct NamedTypeInfo final { Polymorphic Name = Polymorphic(std::in_place_type); - std::optional FundamentalType; + Optional FundamentalType; std::strong_ordering operator<=>(NamedTypeInfo const& other) const; diff --git a/include/mrdocs/Support/Glob.hpp b/include/mrdocs/Support/Glob.hpp index 3de603a2e..4ae383b69 100644 --- a/include/mrdocs/Support/Glob.hpp +++ b/include/mrdocs/Support/Glob.hpp @@ -11,6 +11,7 @@ #ifndef MRDOCS_API_SUPPORT_GLOB_HPP #define MRDOCS_API_SUPPORT_GLOB_HPP +#include #include #include #include @@ -45,7 +46,7 @@ class GlobPattern { */ static Expected - create(std::string_view pattern, std::optional maxSubGlobs); + create(std::string_view pattern, Optional maxSubGlobs); static Expected @@ -138,7 +139,7 @@ class PathGlobPattern { Expected create( std::string_view const pattern, - std::optional maxSubGlobs) + Optional maxSubGlobs) { MRDOCS_TRY(auto glob, GlobPattern::create(pattern, maxSubGlobs)); return PathGlobPattern{std::move(glob)}; @@ -242,7 +243,7 @@ class SymbolGlobPattern { Expected create( std::string_view const pattern, - std::optional maxSubGlobs) + Optional maxSubGlobs) { MRDOCS_TRY(auto glob, GlobPattern::create(pattern, maxSubGlobs)); return SymbolGlobPattern{std::move(glob)}; diff --git a/src/lib/AST/ASTVisitor.cpp b/src/lib/AST/ASTVisitor.cpp index 9b5be1dfd..550b0720e 100644 --- a/src/lib/AST/ASTVisitor.cpp +++ b/src/lib/AST/ASTVisitor.cpp @@ -560,7 +560,7 @@ populate(SourceInfo& I, DeclTy const* D) bool ASTVisitor:: populate( - std::optional& javadoc, + Optional& javadoc, Decl const* D) { RawComment const* RC = getDocumentation(D); @@ -1511,7 +1511,7 @@ populate( { NestedNameSpecifier NNS = TC->getNestedNameSpecifierLoc().getNestedNameSpecifier(); - std::optional TArgs; + Optional TArgs; if (TC->hasExplicitTemplateArgs()) { TArgs.emplace(TC->getTemplateArgsAsWritten()); @@ -2081,7 +2081,7 @@ template Polymorphic ASTVisitor:: toNameInfo(DeclarationName const Name, - std::optional TArgs, + Optional TArgs, NestedNameSpecifier NNS) { if (Name.isEmpty()) @@ -2108,7 +2108,7 @@ Polymorphic ASTVisitor:: toNameInfo( Decl const* D, - std::optional TArgs, + Optional TArgs, NestedNameSpecifier NNS) { auto const* ND = dyn_cast_if_present(D); @@ -2136,7 +2136,7 @@ Polymorphic ASTVisitor:: toNameInfo>( Decl const* D, - std::optional> TArgs, + Optional> TArgs, NestedNameSpecifier NNS); Polymorphic @@ -2307,7 +2307,7 @@ getSourceCode(SourceRange const& R) const context_.getLangOpts()).str(); } -std::optional +Optional ASTVisitor:: extractSFINAEInfo(QualType const T) { @@ -2352,7 +2352,7 @@ extractSFINAEInfo(QualType const T) return Result; } -std::optional +Optional ASTVisitor:: getSFINAEControlParams( TemplateDecl* TD, @@ -2666,7 +2666,7 @@ getSFINAEControlParams( return SFINAEControlParams(CTD->getTemplateParameters(), std::move(ControllingParams), ParamIdx); } -std::optional +Optional ASTVisitor::getSFINAETemplateInfo(QualType T, bool const AllowDependentNames) const { MRDOCS_SYMBOL_TRACE(T, context_); @@ -2704,7 +2704,7 @@ ASTVisitor::getSFINAETemplateInfo(QualType T, bool const AllowDependentNames) co return std::nullopt; } -std::optional +Optional ASTVisitor:: tryGetTemplateArgument( TemplateParameterList* Parameters, @@ -3309,7 +3309,7 @@ buildFileInfo(std::string_view path) // Attempts to get a relative path for the prefix auto tryGetRelativePosixPath = [&file_info](std::string_view const prefix) - -> std::optional + -> Optional { if (files::startsWith(file_info.full_path, prefix)) { @@ -3325,7 +3325,7 @@ buildFileInfo(std::string_view path) }; auto tryGetRelativePath = [&tryGetRelativePosixPath](std::string_view const prefix) - -> std::optional + -> Optional { if (!files::isAbsolute(prefix)) { @@ -3376,7 +3376,7 @@ buildFileInfo(std::string_view path) } // Fallback to system search paths in PATH - std::optional const optEnvPathsStr = llvm::sys::Process::GetEnv("PATH"); + Optional const optEnvPathsStr = llvm::sys::Process::GetEnv("PATH"); MRDOCS_CHECK_OR(optEnvPathsStr, file_info); std::string const& envPathsStr = *optEnvPathsStr; for (auto const envPaths = llvm::split(envPathsStr, llvm::sys::EnvPathSeparator); diff --git a/src/lib/AST/ASTVisitor.hpp b/src/lib/AST/ASTVisitor.hpp index 0de087200..db292a40c 100644 --- a/src/lib/AST/ASTVisitor.hpp +++ b/src/lib/AST/ASTVisitor.hpp @@ -121,7 +121,7 @@ class ASTVisitor std::string source_path; // Whether this file passes the file filters - std::optional passesFilters; + Optional passesFilters; }; /* A map of Clang FileEntry objects to Visitor FileInfo objects @@ -503,7 +503,7 @@ class ASTVisitor */ bool populate( - std::optional& javadoc, + Optional& javadoc, Decl const* D); void @@ -625,7 +625,7 @@ class ASTVisitor std::derived_from DeclTy, std::derived_from TemplateDeclTy> void - populate(std::optional& Template, DeclTy const* D, TemplateDeclTy const* VTD) + populate(Optional& Template, DeclTy const* D, TemplateDeclTy const* VTD) { MRDOCS_CHECK_OR(VTD); MRDOCS_CHECK_OR(!VTD->isImplicit()); @@ -666,7 +666,7 @@ class ASTVisitor populate(Polymorphic& I, NamedDecl const* N); void - populate(std::optional& TI, TemplateParameterList const* TPL) + populate(Optional& TI, TemplateParameterList const* TPL) { if (!TI) { @@ -777,14 +777,14 @@ class ASTVisitor Polymorphic toNameInfo( DeclarationName Name, - std::optional TArgs = std::nullopt, + Optional TArgs = std::nullopt, NestedNameSpecifier NNS = std::nullopt); template > Polymorphic toNameInfo( Decl const* D, - std::optional TArgs = std::nullopt, + Optional TArgs = std::nullopt, NestedNameSpecifier NNS = std::nullopt); Polymorphic @@ -844,11 +844,11 @@ class ASTVisitor and the underlying type with the template arguments otherwise. */ - std::optional + Optional extractSFINAEInfo(QualType T); // @copydoc extractSFINAEInfo(QualType) - std::optional + Optional extractSFINAEInfo(Type const* T) { return extractSFINAEInfo(QualType(T, 0)); @@ -894,7 +894,7 @@ class ASTVisitor respective to `std::enable_if`: `Template` would be `std::enable_if`, and `Arguments` would be `{B,T}`. */ - std::optional + Optional getSFINAETemplateInfo(QualType T, bool AllowDependentNames) const; /* The controlling parameters of a SFINAE template @@ -935,10 +935,10 @@ class ASTVisitor template information of the underlying type (such as `typename enable_if::type`) will be extract instead. */ - std::optional + Optional getSFINAEControlParams(TemplateDecl* TD, IdentifierInfo const* Member); - std::optional + Optional getSFINAEControlParams(SFINAETemplateInfo const& SFINAE) { return getSFINAEControlParams(SFINAE.Template, SFINAE.Member); } @@ -953,7 +953,7 @@ class ASTVisitor arguments, the function will attempt to get the argument from the default template arguments. */ - std::optional + Optional tryGetTemplateArgument( TemplateParameterList* Parameters, ArrayRef Arguments, diff --git a/src/lib/AST/ClangHelpers.cpp b/src/lib/AST/ClangHelpers.cpp index fe29dd6cd..150e05afe 100644 --- a/src/lib/AST/ClangHelpers.cpp +++ b/src/lib/AST/ClangHelpers.cpp @@ -60,7 +60,7 @@ SubstituteConstraintExpressionWithoutSatisfaction( } } - std::optional ThisScope; + Optional ThisScope; // See TreeTransform::RebuildTemplateSpecializationType. A context scope is // essential for having an injected class as the canonical type for a template @@ -69,7 +69,7 @@ SubstituteConstraintExpressionWithoutSatisfaction( // template specializations can be profiled to the same value, which makes it // possible that e.g. constraints involving C> and C are // perceived identical. - std::optional ContextScope; + Optional ContextScope; if (auto *RD = dyn_cast(DeclInfo.getDeclContext())) { ThisScope.emplace(S, const_cast(RD), Qualifiers()); diff --git a/src/lib/AST/ClangHelpers.hpp b/src/lib/AST/ClangHelpers.hpp index e0770c5b9..0e8cc31e5 100644 --- a/src/lib/AST/ClangHelpers.hpp +++ b/src/lib/AST/ClangHelpers.hpp @@ -512,7 +512,7 @@ toAutoKind(AutoTypeKeyword const kind) /** Convert a Clang AutoTypeKeyword into a MrDocs AutoKind */ inline -std::optional +Optional toFundamentalTypeKind(BuiltinType::Kind const kind) { switch(kind) @@ -1060,7 +1060,7 @@ namespace detail { template void - printTraceName(std::optional const& D, ASTContext const& C, std::string& symbol_name) + printTraceName(Optional const& D, ASTContext const& C, std::string& symbol_name) { if (D) { diff --git a/src/lib/AST/MrDocsFileSystem.hpp b/src/lib/AST/MrDocsFileSystem.hpp index 558c6957d..a622a2a0a 100644 --- a/src/lib/AST/MrDocsFileSystem.hpp +++ b/src/lib/AST/MrDocsFileSystem.hpp @@ -73,7 +73,7 @@ class MrDocsFileSystem : public llvm::vfs::FileSystem { return matchesPrefixSetImpl(Path, shimParents); } - std::optional> + Optional> matchShim(llvm::StringRef Path) const { for (auto const &[K, P]: config_->missingIncludeShims) diff --git a/src/lib/AST/NameInfoBuilder.cpp b/src/lib/AST/NameInfoBuilder.cpp index c0817ad63..2d6347692 100644 --- a/src/lib/AST/NameInfoBuilder.cpp +++ b/src/lib/AST/NameInfoBuilder.cpp @@ -42,7 +42,7 @@ NameInfoBuilder:: buildTerminal( NestedNameSpecifier NNS, IdentifierInfo const* II, - std::optional> TArgs, + Optional> TArgs, unsigned, bool) { @@ -77,7 +77,7 @@ NameInfoBuilder:: buildTerminal( NestedNameSpecifier NNS, NamedDecl const* D, - std::optional> const& TArgs, + Optional> const& TArgs, unsigned, bool) { diff --git a/src/lib/AST/NameInfoBuilder.hpp b/src/lib/AST/NameInfoBuilder.hpp index 4de3b1b84..c57ab455d 100644 --- a/src/lib/AST/NameInfoBuilder.hpp +++ b/src/lib/AST/NameInfoBuilder.hpp @@ -57,7 +57,7 @@ class NameInfoBuilder buildTerminal( NestedNameSpecifier NNS, IdentifierInfo const* II, - std::optional> TArgs, + Optional> TArgs, unsigned quals, bool pack); @@ -65,7 +65,7 @@ class NameInfoBuilder buildTerminal( NestedNameSpecifier NNS, NamedDecl const* D, - std::optional> const& TArgs, + Optional> const& TArgs, unsigned quals, bool pack); }; diff --git a/src/lib/AST/ParseJavadoc.cpp b/src/lib/AST/ParseJavadoc.cpp index b65980e6b..9990dee6e 100644 --- a/src/lib/AST/ParseJavadoc.cpp +++ b/src/lib/AST/ParseJavadoc.cpp @@ -1106,7 +1106,7 @@ std::string JavadocVisitor:: fixReference(std::string& ref) { - auto peekNextIt = [&]() -> std::optional + auto peekNextIt = [&]() -> Optional { ++it_; if (it_ == end_ || @@ -1794,7 +1794,7 @@ initCustomCommentCommands(ASTContext& context) void parseJavadoc( - std::optional& jd, + Optional& jd, FullComment const* FC, Decl const* D, Config const& config, diff --git a/src/lib/AST/ParseJavadoc.hpp b/src/lib/AST/ParseJavadoc.hpp index 429bcf81d..ff18d72b3 100644 --- a/src/lib/AST/ParseJavadoc.hpp +++ b/src/lib/AST/ParseJavadoc.hpp @@ -51,7 +51,7 @@ initCustomCommentCommands( */ void parseJavadoc( - std::optional& jd, + Optional& jd, comments::FullComment const* FC, Decl const* D, Config const& config, diff --git a/src/lib/AST/ParseRef.cpp b/src/lib/AST/ParseRef.cpp index a5ffdc3fa..42bfb6cd6 100644 --- a/src/lib/AST/ParseRef.cpp +++ b/src/lib/AST/ParseRef.cpp @@ -1931,12 +1931,12 @@ class RefParser // Bounds.Value is an optional integer with the value // Bounds.Written is the original string representation // of the bounds - std::optional boundsValue = 0; + Optional boundsValue = 0; if (ConstantExprInfo Bounds; parseInteger(boundsValue) && peek(']', ' ')) { - Bounds.Value = boundsValue; + Bounds.Value = *boundsValue; Bounds.Written = std::string_view(exprStart, ptr_ - exprStart); ATI.Bounds = Bounds; if (!parseLiteral("]")) @@ -2021,7 +2021,7 @@ class RefParser } bool - parseInteger(std::optional& dest) + parseInteger(Optional& dest) { if (!hasMore()) { diff --git a/src/lib/AST/TerminalTypeVisitor.hpp b/src/lib/AST/TerminalTypeVisitor.hpp index ee2821f90..838f0c3d7 100644 --- a/src/lib/AST/TerminalTypeVisitor.hpp +++ b/src/lib/AST/TerminalTypeVisitor.hpp @@ -255,7 +255,7 @@ class TerminalTypeVisitor buildTerminal( NestedNameSpecifier, IdentifierInfo const*, - std::optional>, + Optional>, unsigned, bool) { @@ -270,7 +270,7 @@ class TerminalTypeVisitor buildTerminal( NestedNameSpecifier, NamedDecl*, - std::optional>, + Optional>, unsigned, bool) { @@ -616,7 +616,7 @@ class TerminalTypeVisitor RecordDecl* RD = T->getOriginalDecl()->getDefinitionOrSelf(); // if this is an instantiation of a class template, // create a SpecializationTypeInfo & extract the template arguments - std::optional> TArgs = std::nullopt; + Optional> TArgs = std::nullopt; if (auto const* CTSD = dyn_cast(RD)) { TArgs = CTSD->getTemplateArgs().asArray(); diff --git a/src/lib/AST/TypeInfoBuilder.cpp b/src/lib/AST/TypeInfoBuilder.cpp index 76bc6512d..39c173518 100644 --- a/src/lib/AST/TypeInfoBuilder.cpp +++ b/src/lib/AST/TypeInfoBuilder.cpp @@ -134,7 +134,7 @@ buildAuto( I.Keyword = toAutoKind(T->getKeyword()); if(T->isConstrained()) { - std::optional> TArgs; + Optional> TArgs; if(auto Args = T->getTypeConstraintArguments(); ! Args.empty()) { @@ -180,7 +180,7 @@ TypeInfoBuilder:: buildTerminal( NestedNameSpecifier NNS, IdentifierInfo const* II, - std::optional> TArgs, + Optional> TArgs, unsigned quals, bool pack) { @@ -222,7 +222,7 @@ TypeInfoBuilder:: buildTerminal( NestedNameSpecifier NNS, NamedDecl* D, - std::optional> TArgs, + Optional> TArgs, unsigned quals, bool pack) { diff --git a/src/lib/AST/TypeInfoBuilder.hpp b/src/lib/AST/TypeInfoBuilder.hpp index d1bb7c5e6..361ce04e9 100644 --- a/src/lib/AST/TypeInfoBuilder.hpp +++ b/src/lib/AST/TypeInfoBuilder.hpp @@ -219,7 +219,7 @@ class TypeInfoBuilder void buildTerminal( NestedNameSpecifier NNS, IdentifierInfo const* II, - std::optional> TArgs, + Optional> TArgs, unsigned quals, bool pack); @@ -241,7 +241,7 @@ class TypeInfoBuilder void buildTerminal( NestedNameSpecifier NNS, NamedDecl* D, - std::optional> TArgs, + Optional> TArgs, unsigned quals, bool pack); }; diff --git a/src/lib/CorpusImpl.cpp b/src/lib/CorpusImpl.cpp index 1975164dc..a1c5316e2 100644 --- a/src/lib/CorpusImpl.cpp +++ b/src/lib/CorpusImpl.cpp @@ -590,7 +590,7 @@ lookupImpl( TemplateInfo const* templateInfo = [&]() -> TemplateInfo const* { if constexpr (requires { M.Template; }) { - std::optional const& OTI = M.Template; + Optional const& OTI = M.Template; MRDOCS_CHECK_OR(OTI, nullptr); TemplateInfo const& TI = *OTI; return &TI; diff --git a/src/lib/Gen/adoc/AdocEscape.cpp b/src/lib/Gen/adoc/AdocEscape.cpp index 0044d71eb..c9461f6ca 100644 --- a/src/lib/Gen/adoc/AdocEscape.cpp +++ b/src/lib/Gen/adoc/AdocEscape.cpp @@ -18,7 +18,7 @@ namespace clang::mrdocs::adoc { namespace { constexpr -std::optional +Optional HTMLNamedEntity(char const c) { // If c has a named entity, we use it diff --git a/src/lib/Gen/hbs/SinglePageVisitor.hpp b/src/lib/Gen/hbs/SinglePageVisitor.hpp index 9d938819b..cb69d8883 100644 --- a/src/lib/Gen/hbs/SinglePageVisitor.hpp +++ b/src/lib/Gen/hbs/SinglePageVisitor.hpp @@ -31,7 +31,7 @@ class SinglePageVisitor std::size_t numSymbols_ = 0; std::mutex mutex_; std::size_t topSymbol_ = 0; - std::vector> symbols_; + std::vector> symbols_; void writePage(std::string pageText, std::size_t symbolIdx); public: diff --git a/src/lib/Gen/hbs/VisitorHelpers.cpp b/src/lib/Gen/hbs/VisitorHelpers.cpp index ce3629233..af18610cf 100644 --- a/src/lib/Gen/hbs/VisitorHelpers.cpp +++ b/src/lib/Gen/hbs/VisitorHelpers.cpp @@ -101,7 +101,7 @@ findPrimarySiblingWithUrl(Corpus const& c, Info const& I, Info const& parent) { if constexpr (requires { V.Template; }) { - std::optional const& Template = V.Template; + Optional const& Template = V.Template; MRDOCS_CHECK_OR(Template, false); return !Template->Params.empty() && Template->Args.empty(); } @@ -160,7 +160,7 @@ findResolvedPrimarySiblingWithUrl(Corpus const& c, Info const& I) // The symbol is a specialization if constexpr (requires { U.Template; }) { - std::optional const& Template = U.Template; + Optional const& Template = U.Template; if (Template && !Template->Args.empty()) { diff --git a/src/lib/Gen/xml/XMLWriter.cpp b/src/lib/Gen/xml/XMLWriter.cpp index 48ac28a9a..e0acb15dc 100644 --- a/src/lib/Gen/xml/XMLWriter.cpp +++ b/src/lib/Gen/xml/XMLWriter.cpp @@ -569,7 +569,7 @@ writeLocation( void XMLWriter:: openTemplate( - const std::optional& I) + Optional const& I) { if(! I) return; @@ -591,7 +591,7 @@ openTemplate( void XMLWriter:: closeTemplate( - const std::optional& I) + const Optional& I) { if(! I) return; @@ -603,7 +603,7 @@ closeTemplate( void XMLWriter:: writeJavadoc( - std::optional const& javadoc) + Optional const& javadoc) { if (!javadoc) { diff --git a/src/lib/Gen/xml/XMLWriter.hpp b/src/lib/Gen/xml/XMLWriter.hpp index 75e45752b..b165c7ac3 100644 --- a/src/lib/Gen/xml/XMLWriter.hpp +++ b/src/lib/Gen/xml/XMLWriter.hpp @@ -57,10 +57,10 @@ class XMLWriter void writeSourceInfo(SourceInfo const& I); void writeLocation(Location const& loc, bool def = false); - void writeJavadoc(std::optional const& javadoc); + void writeJavadoc(Optional const& javadoc); void writeFriend(FriendInfo const& I); - void openTemplate(const std::optional& I); - void closeTemplate(const std::optional& I); + void openTemplate(Optional const& I); + void closeTemplate(Optional const& I); // --------------- // Javadoc types diff --git a/src/lib/Metadata/Finalizers/Javadoc/Function.hpp b/src/lib/Metadata/Finalizers/Javadoc/Function.hpp index cfff7267c..bd301d7c6 100644 --- a/src/lib/Metadata/Finalizers/Javadoc/Function.hpp +++ b/src/lib/Metadata/Finalizers/Javadoc/Function.hpp @@ -103,7 +103,7 @@ isMoveAssignment(FunctionInfo const& I) return isCopyOrMoveConstructorOrAssignment(I); } -std::optional +Optional innermostTypenameString(Polymorphic const& T) { auto& R = innermostType(T); @@ -115,7 +115,7 @@ innermostTypenameString(Polymorphic const& T) return RStr; } -std::optional +Optional innermostTypenameString(Optional> const& T) { MRDOCS_CHECK_OR(T, {}); diff --git a/src/lib/Metadata/Finalizers/JavadocFinalizer.cpp b/src/lib/Metadata/Finalizers/JavadocFinalizer.cpp index 887ef651d..733424cb4 100644 --- a/src/lib/Metadata/Finalizers/JavadocFinalizer.cpp +++ b/src/lib/Metadata/Finalizers/JavadocFinalizer.cpp @@ -1381,7 +1381,7 @@ copyDetails(Javadoc& javadoc) } // Find copydetails command - std::optional copied; + Optional copied; for (auto textIt = para.children.begin(); textIt != para.children.end();) { // Find copydoc command diff --git a/src/lib/Metadata/Finalizers/SortMembersFinalizer.cpp b/src/lib/Metadata/Finalizers/SortMembersFinalizer.cpp index f8b36b38e..eaa345770 100644 --- a/src/lib/Metadata/Finalizers/SortMembersFinalizer.cpp +++ b/src/lib/Metadata/Finalizers/SortMembersFinalizer.cpp @@ -22,13 +22,13 @@ struct SymbolIDCompareFn template static - std::optional + Optional findFunctionClass(InfoTy const& I) { if constexpr (std::same_as) { return visit(I, [](U const& u) - -> std::optional + -> Optional { return findFunctionClass(u); }); @@ -44,13 +44,13 @@ struct SymbolIDCompareFn template static - std::optional + Optional findOperatorKind(InfoTy const& I) { if constexpr (std::same_as) { return visit(I, [](U const& u) - -> std::optional + -> Optional { return findOperatorKind(u); }); @@ -76,8 +76,8 @@ struct SymbolIDCompareFn Info const& rhs = *rhsPtr; // Constructors come first - std::optional const lhsClass = findFunctionClass(lhs); - std::optional const rhsClass = findFunctionClass(rhs); + Optional const lhsClass = findFunctionClass(lhs); + Optional const rhsClass = findFunctionClass(rhs); if (corpus_.config->sortMembersCtors1St) { bool const lhsIsCtor = lhsClass && *lhsClass == FunctionClass::Constructor; @@ -100,8 +100,8 @@ struct SymbolIDCompareFn } // Assignment operators come next - std::optional const lhsOp = findOperatorKind(lhs); - std::optional const rhsOp = findOperatorKind(rhs); + Optional const lhsOp = findOperatorKind(lhs); + Optional const rhsOp = findOperatorKind(rhs); if (corpus_.config->sortMembersAssignment1St) { bool const lhsIsAssign = lhsOp && *lhsOp == OperatorKind::Equal; diff --git a/src/lib/Metadata/Info/Function.cpp b/src/lib/Metadata/Info/Function.cpp index 3a79a95fe..73fec236f 100644 --- a/src/lib/Metadata/Info/Function.cpp +++ b/src/lib/Metadata/Info/Function.cpp @@ -168,7 +168,7 @@ getSafeOperatorName( return full.substr(9); } -std::optional +Optional getOperatorReadableName( OperatorKind const kind, int const nParams) diff --git a/src/lib/Metadata/Type.cpp b/src/lib/Metadata/Type.cpp index ffd067b91..b94fce3c5 100644 --- a/src/lib/Metadata/Type.cpp +++ b/src/lib/Metadata/Type.cpp @@ -782,7 +782,7 @@ template < class Ptr = std::conditional_t*, Polymorphic const*>, class Ref = std::conditional_t>, std::reference_wrapper const>>> requires std::same_as, TypeInfo> -std::optional +Optional innerTypeImpl(TypeInfoTy&& TI) noexcept { // Get a pointer to the inner type @@ -872,13 +872,13 @@ innermostTypeImpl(PolymorphicTypeInfoTy&& TI) noexcept } -std::optional const>> +Optional const>> innerType(TypeInfo const& TI) noexcept { return innerTypeImpl(TI); } -std::optional>> +Optional>> innerType(TypeInfo& TI) noexcept { return innerTypeImpl(TI); diff --git a/src/lib/Support/Glob.cpp b/src/lib/Support/Glob.cpp index 9f840fbe7..fd0028037 100644 --- a/src/lib/Support/Glob.cpp +++ b/src/lib/Support/Glob.cpp @@ -86,7 +86,7 @@ parseCharRange( Expected> parseBraceExpansions( std::string_view str, - std::optional const max) + Optional const max) { // If there are no brace expansions, return the original string // as the only subpattern. @@ -365,7 +365,7 @@ match(std::string_view str, char const delimiter) const std::string_view starStr = str; // The pattern suffix after the "*" run. - std::optional patternStarSuffix; + Optional patternStarSuffix; // The saved brackets index for backtracking. std::size_t bracketsStarMatchIdx = 0; @@ -564,7 +564,7 @@ Expected GlobPattern:: create( std::string_view const pattern, - std::optional maxSubGlobs) + Optional maxSubGlobs) { if (pattern.empty()) { diff --git a/src/lib/Support/Handlebars.cpp b/src/lib/Support/Handlebars.cpp index b5fb3db5b..f9ee2d2b1 100644 --- a/src/lib/Support/Handlebars.cpp +++ b/src/lib/Support/Handlebars.cpp @@ -3354,7 +3354,7 @@ renderBlock( return {}; }; - std::optional hbs_error; + Optional hbs_error; if (!tag.rawBlock) { cb.set("write", dom::makeInvocable([&out, &write_nested_block, &hbs_error]( dom::Value const& newContext, diff --git a/src/lib/Support/Report.cpp b/src/lib/Support/Report.cpp index afeefb023..efe1e7f72 100644 --- a/src/lib/Support/Report.cpp +++ b/src/lib/Support/Report.cpp @@ -8,22 +8,23 @@ // Official repository: https://github.com/cppalliance/mrdocs // +#include #include #include #include #include -#include #include +#include #include #include #include #ifdef _MSC_VER #define WIN32_LEAN_AND_MEAN -# include -# include -# include -# include +#include +#include +#include +#include #endif namespace SourceFileNames { diff --git a/src/test/ADT/Optional.cpp b/src/test/ADT/Optional.cpp index 08c32b3fc..b7478b3c0 100644 --- a/src/test/ADT/Optional.cpp +++ b/src/test/ADT/Optional.cpp @@ -166,7 +166,7 @@ struct OptionalTest { { static_assert( !has_nullable_traits_v, - "NoTraits must fall back to std::optional"); + "NoTraits must fall back to Optional"); Optional o; BOOST_TEST(!o.has_value()); // default disengaged diff --git a/src/test/lib/Dom/Dom.cpp b/src/test/lib/Dom/Dom.cpp index c06e4e990..765b5f52d 100644 --- a/src/test/lib/Dom/Dom.cpp +++ b/src/test/lib/Dom/Dom.cpp @@ -1132,16 +1132,16 @@ struct Dom_test BOOST_TEST(v == "hello"); } - // Value(std::optional const& opt) + // Value(Optional const& opt) { { - std::optional opt; + Optional opt; Value v(opt); BOOST_TEST(v.isUndefined()); } { - std::optional opt(123); + Optional opt(123); Value v(opt); BOOST_TEST(v.isInteger()); BOOST_TEST(v == 123); diff --git a/src/test/lib/Support/Handlebars.cpp b/src/test/lib/Support/Handlebars.cpp index 1547a96d3..e0cef2c68 100644 --- a/src/test/lib/Support/Handlebars.cpp +++ b/src/test/lib/Support/Handlebars.cpp @@ -5270,19 +5270,19 @@ to_dom(llvm::json::Value& val) } // val is string - std::optional str_opt = val.getAsString(); + Optional str_opt = val.getAsString(); if (str_opt) { return str_opt.value().str(); } // val is integer - std::optional int_opt = val.getAsInteger(); + Optional int_opt = val.getAsInteger(); if (int_opt) { return int_opt.value(); } // val is double (convert to string) - std::optional num_opt = val.getAsNumber(); + Optional num_opt = val.getAsNumber(); if (num_opt) { std::string double_str = std::to_string(num_opt.value()); double_str.erase(double_str.find_last_not_of('0') + 1, std::string::npos); @@ -5290,7 +5290,7 @@ to_dom(llvm::json::Value& val) } // val is bool - std::optional bool_opt = val.getAsBoolean(); + Optional bool_opt = val.getAsBoolean(); if (bool_opt) { return bool_opt.value(); } diff --git a/src/tool/CompilerInfo.cpp b/src/tool/CompilerInfo.cpp index 2cee25fa5..f53d1a8b0 100644 --- a/src/tool/CompilerInfo.cpp +++ b/src/tool/CompilerInfo.cpp @@ -17,7 +17,7 @@ namespace clang { namespace mrdocs { -std::optional +Optional getCompilerVerboseOutput(llvm::StringRef compilerPath) { if ( ! llvm::sys::fs::exists(compilerPath)) diff --git a/src/tool/CompilerInfo.hpp b/src/tool/CompilerInfo.hpp index fa8138ae7..10cd30c58 100644 --- a/src/tool/CompilerInfo.hpp +++ b/src/tool/CompilerInfo.hpp @@ -11,6 +11,7 @@ #ifndef MRDOCS_TOOL_COMPILERINFO_HPP #define MRDOCS_TOOL_COMPILERINFO_HPP +#include #include #include #include @@ -25,9 +26,9 @@ namespace mrdocs { * @brief Get the compiler verbose output. * * @param compilerPath The compiler path. - * @return std::optional The compiler verbose output. + * @return The compiler verbose output. */ -std::optional +Optional getCompilerVerboseOutput(llvm::StringRef compilerPath); /** From 6102c4aeb6c79aab01501b23c3b3175413dc2194 Mon Sep 17 00:00:00 2001 From: Alan de Freitas Date: Thu, 25 Sep 2025 18:38:40 -0500 Subject: [PATCH 10/23] refactor(lib): Info contains SourceInfo as composition Info objects contain Source information rather than _being_ source information. --- include/mrdocs/Metadata/Info/FileKind.hpp | 49 +++++++ include/mrdocs/Metadata/Info/InfoBase.hpp | 11 +- include/mrdocs/Metadata/Info/Location.hpp | 120 ++++++++++++++++ include/mrdocs/Metadata/Info/Source.hpp | 135 +----------------- src/lib/AST/ASTVisitor.cpp | 6 +- src/lib/Gen/xml/XMLWriter.cpp | 20 +-- .../Metadata/Finalizers/JavadocFinalizer.cpp | 2 +- src/lib/Metadata/Info.cpp | 2 +- src/lib/Metadata/Info/Overloads.cpp | 2 +- src/lib/Metadata/InfoSet.hpp | 6 +- src/lib/Metadata/Source.cpp | 2 + src/lib/Support/Report.cpp | 2 + src/test_suite/test_suite.cpp | 2 + 13 files changed, 204 insertions(+), 155 deletions(-) create mode 100644 include/mrdocs/Metadata/Info/FileKind.hpp create mode 100644 include/mrdocs/Metadata/Info/Location.hpp diff --git a/include/mrdocs/Metadata/Info/FileKind.hpp b/include/mrdocs/Metadata/Info/FileKind.hpp new file mode 100644 index 000000000..03e4a4fca --- /dev/null +++ b/include/mrdocs/Metadata/Info/FileKind.hpp @@ -0,0 +1,49 @@ +// +// This is a derivative work. originally part of the LLVM Project. +// Licensed under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// Copyright (c) 2023 Vinnie Falco (vinnie.falco@gmail.com) +// Copyright (c) 2023 Krystian Stasiowski (sdkrystian@gmail.com) +// +// Official repository: https://github.com/cppalliance/mrdocs +// + +#ifndef MRDOCS_API_METADATA_INFO_FILEKIND_HPP +#define MRDOCS_API_METADATA_INFO_FILEKIND_HPP + +#include +#include +#include +#include + +namespace clang::mrdocs { + +enum class FileKind +{ + /// File in the source directory + Source, + /// File in a system include directory + System, + /// File outside the source directory + Other +}; + +MRDOCS_DECL +std::string_view +toString(FileKind kind); + +inline +void +tag_invoke( + dom::ValueFromTag, + dom::Value& v, + FileKind kind) +{ + v = toString(kind); +} + +} // clang::mrdocs + +#endif // MRDOCS_API_METADATA_INFO_FILEKIND_HPP diff --git a/include/mrdocs/Metadata/Info/InfoBase.hpp b/include/mrdocs/Metadata/Info/InfoBase.hpp index 7048821b1..6de915403 100644 --- a/include/mrdocs/Metadata/Info/InfoBase.hpp +++ b/include/mrdocs/Metadata/Info/InfoBase.hpp @@ -30,8 +30,11 @@ namespace clang::mrdocs { /** Base class with common properties of all symbols */ struct MRDOCS_VISIBLE Info - : SourceInfo { + /** The source location information. + */ + SourceInfo Loc; + /** The unique identifier for this symbol. */ SymbolID id; @@ -82,7 +85,7 @@ struct MRDOCS_VISIBLE Info //-------------------------------------------- - ~Info() override = default; + virtual ~Info() = default; #define INFO(Type) constexpr bool is##Type() const noexcept { \ return Kind == InfoKind::Type; \ @@ -246,7 +249,7 @@ tag_invoke( { io.map("doc", *I.javadoc); } - io.map("loc", dynamic_cast(I)); + io.map("loc", I.Loc); } /** Return the Info as a @ref dom::Value object. @@ -267,7 +270,7 @@ Optional getPrimaryLocation(Info const& I) { return getPrimaryLocation( - dynamic_cast(I), + I.Loc, I.isRecord() || I.isEnum()); } diff --git a/include/mrdocs/Metadata/Info/Location.hpp b/include/mrdocs/Metadata/Info/Location.hpp new file mode 100644 index 000000000..f102947a9 --- /dev/null +++ b/include/mrdocs/Metadata/Info/Location.hpp @@ -0,0 +1,120 @@ +// +// This is a derivative work. originally part of the LLVM Project. +// Licensed under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// Copyright (c) 2023 Vinnie Falco (vinnie.falco@gmail.com) +// Copyright (c) 2023 Krystian Stasiowski (sdkrystian@gmail.com) +// +// Official repository: https://github.com/cppalliance/mrdocs +// + +#ifndef MRDOCS_API_METADATA_INFO_LOCATION_HPP +#define MRDOCS_API_METADATA_INFO_LOCATION_HPP + +#include +#include +#include +#include + +namespace clang::mrdocs { + +struct MRDOCS_DECL + Location +{ + /** The full file path + */ + std::string FullPath; + + /** The file path relative to one of the search directories + */ + std::string ShortPath; + + /** The file path relative to the source-root directory + */ + std::string SourcePath; + + /** Line number within the file + */ + unsigned LineNumber = 0; + + /** Whether this location has documentation. + */ + bool Documented = false; + + //-------------------------------------------- + + constexpr + Location( + std::string_view const full_path = {}, + std::string_view const short_path = {}, + std::string_view const source_path = {}, + unsigned const line = 0, + bool const documented = false) + : FullPath(full_path) + , ShortPath(short_path) + , SourcePath(source_path) + , LineNumber(line) + , Documented(documented) + { + } + + auto operator<=>(Location const&) const = default; +}; + +MRDOCS_DECL +void +tag_invoke( + dom::ValueFromTag, + dom::Value& v, + Location const& loc); + +/** nullable_traits specialization for Location. + + Semantics + - The “null” (sentinel) state is any Location whose ShortPath is empty. + - Creating a null value produces a Location with all fields defaulted + and ShortPath empty. + - Making an existing value null clears ShortPath and resets the other + fields to their defaults. + + Rationale + - This mirrors the old LocationEmptyPredicate, which treated an empty + ShortPath as “empty/null.” +**/ +template<> +struct nullable_traits +{ + static constexpr bool + is_null(Location const& v) noexcept + { + return v.ShortPath.empty(); + } + + static constexpr Location + null() noexcept + { + return Location{ + /*full_path*/ {}, + /*short_path*/ {}, + /*source_path*/ {}, + /*line*/ 0u, + /*documented*/ false + }; + } + + static constexpr void + make_null(Location& v) noexcept + { + v.FullPath.clear(); + v.ShortPath.clear(); // sentinel condition + v.SourcePath.clear(); + v.LineNumber = 0; + v.Documented = false; + } +}; + +} // clang::mrdocs + +#endif // MRDOCS_API_METADATA_INFO_LOCATION_HPP diff --git a/include/mrdocs/Metadata/Info/Source.hpp b/include/mrdocs/Metadata/Info/Source.hpp index 8e4f75d01..bbf39accc 100644 --- a/include/mrdocs/Metadata/Info/Source.hpp +++ b/include/mrdocs/Metadata/Info/Source.hpp @@ -14,136 +14,20 @@ #define MRDOCS_API_METADATA_INFO_SOURCE_HPP #include +#include #include #include #include namespace clang::mrdocs { -enum class FileKind -{ - /// File in the source directory - Source, - /// File in a system include directory - System, - /// File outside the source directory - Other -}; - -MRDOCS_DECL -std::string_view -toString(FileKind kind); - -inline -void -tag_invoke( - dom::ValueFromTag, - dom::Value& v, - FileKind kind) -{ - v = toString(kind); -} - -struct MRDOCS_DECL - Location -{ - /** The full file path - */ - std::string FullPath; - - /** The file path relative to one of the search directories - */ - std::string ShortPath; - - /** The file path relative to the source-root directory - */ - std::string SourcePath; - - /** Line number within the file - */ - unsigned LineNumber = 0; - - /** Whether this location has documentation. - */ - bool Documented = false; - - //-------------------------------------------- - - constexpr - Location( - std::string_view const full_path = {}, - std::string_view const short_path = {}, - std::string_view const source_path = {}, - unsigned const line = 0, - bool const documented = false) - : FullPath(full_path) - , ShortPath(short_path) - , SourcePath(source_path) - , LineNumber(line) - , Documented(documented) - { - } - - auto operator<=>(Location const&) const = default; -}; - -MRDOCS_DECL -void -tag_invoke( - dom::ValueFromTag, - dom::Value& v, - Location const& loc); - -/** nullable_traits specialization for Location. - - Semantics - - The “null” (sentinel) state is any Location whose ShortPath is empty. - - Creating a null value produces a Location with all fields defaulted - and ShortPath empty. - - Making an existing value null clears ShortPath and resets the other - fields to their defaults. - - Rationale - - This mirrors the old LocationEmptyPredicate, which treated an empty - ShortPath as “empty/null.” -**/ -template<> -struct nullable_traits -{ - static constexpr bool - is_null(Location const& v) noexcept - { - return v.ShortPath.empty(); - } - - static constexpr Location - null() noexcept - { - return Location{ - /*full_path*/ {}, - /*short_path*/ {}, - /*source_path*/ {}, - /*line*/ 0u, - /*documented*/ false - }; - } - - static constexpr void - make_null(Location& v) noexcept - { - v.FullPath.clear(); - v.ShortPath.clear(); // sentinel condition - v.SourcePath.clear(); - v.LineNumber = 0; - v.Documented = false; - } -}; - /** Stores source information for a declaration. */ struct MRDOCS_DECL SourceInfo { + constexpr SourceInfo() = default; + /** Location where the entity was defined KRYSTIAN NOTE: this is used for entities which cannot be @@ -159,22 +43,9 @@ struct MRDOCS_DECL */ std::vector Loc; - constexpr SourceInfo const& asSourceInfo() const noexcept - { - return *this; - } - - constexpr SourceInfo& asSourceInfo() noexcept - { - return *this; - } - constexpr virtual ~SourceInfo() = default; auto operator<=>(SourceInfo const&) const = default; - -protected: - constexpr SourceInfo() = default; }; MRDOCS_DECL diff --git a/src/lib/AST/ASTVisitor.cpp b/src/lib/AST/ASTVisitor.cpp index 550b0720e..53eee91c8 100644 --- a/src/lib/AST/ASTVisitor.cpp +++ b/src/lib/AST/ASTVisitor.cpp @@ -525,7 +525,7 @@ ASTVisitor:: populate(Info& I, bool const isNew, DeclTy const* D) { populate(I.javadoc, D); - populate(I.asSourceInfo(), D); + populate(I.Loc, D); // All other information is redundant if the symbol is not new MRDOCS_CHECK_OR(isNew); @@ -550,7 +550,7 @@ populate(SourceInfo& I, DeclTy const* D) if (Loc.isValid()) { populate( - I.asSourceInfo(), + I, Loc, isDefinition(D), isDocumented(D)); @@ -3532,7 +3532,7 @@ checkUndocumented( // Populate the location auto handle = undocumented_.extract(undocIt); UndocumentedInfo& UI = handle.value(); - populate(UI.asSourceInfo(), D); + populate(UI.Loc, D); undocumented_.insert(std::move(handle)); } return Unexpected(Error("Undocumented")); diff --git a/src/lib/Gen/xml/XMLWriter.cpp b/src/lib/Gen/xml/XMLWriter.cpp index e0acb15dc..06a92ba35 100644 --- a/src/lib/Gen/xml/XMLWriter.cpp +++ b/src/lib/Gen/xml/XMLWriter.cpp @@ -147,7 +147,7 @@ writeEnum( tags_.close(baseTagName); } - writeSourceInfo(I); + writeSourceInfo(I.Loc); writeJavadoc(I.javadoc); @@ -173,7 +173,7 @@ writeEnumConstant( { I.id } }); - writeSourceInfo(I); + writeSourceInfo(I.Loc); writeJavadoc(I.javadoc); @@ -230,7 +230,7 @@ writeFunction( { I.id } }); - writeSourceInfo(I); + writeSourceInfo(I.Loc); writeAttr(I.IsVariadic, "is-variadic", tags_); writeAttr(I.IsVirtualAsWritten, "is-virtual-as-written", tags_); @@ -294,7 +294,7 @@ writeGuide( { I.id } }); - writeSourceInfo(I); + writeSourceInfo(I.Loc); tags_.open(deducedTagName); writeType(I.Deduced, tags_); @@ -325,7 +325,7 @@ writeConcept( { "constraint", I.Constraint.Written }, }); - writeSourceInfo(I); + writeSourceInfo(I.Loc); writeJavadoc(I.javadoc); @@ -346,7 +346,7 @@ writeNamespaceAlias( { I.id } }); - writeSourceInfo(I); + writeSourceInfo(I.Loc); writeJavadoc(I.javadoc); @@ -395,7 +395,7 @@ XMLWriter:: { "qualifier", qualifierStr, !qualifierStr.empty() } }); - writeSourceInfo(I); + writeSourceInfo(I.Loc); writeJavadoc(I.javadoc); @@ -420,7 +420,7 @@ writeRecord( { I.id } }); - writeSourceInfo(I); + writeSourceInfo(I.Loc); writeAttr(I.IsFinal, "is-final", tags_); writeAttr(I.IsFinalDestructor, "is-final-dtor", tags_); @@ -472,7 +472,7 @@ writeTypedef( { I.id } }); - writeSourceInfo(I); + writeSourceInfo(I.Loc); writeType(I.Type, tags_); @@ -506,7 +506,7 @@ writeVariable( { "default", I.Initializer.Written, ! I.Initializer.Written.empty() } }); - writeSourceInfo(I); + writeSourceInfo(I.Loc); if(I.IsMutable) tags_.write(attributeTagName, {}, { diff --git a/src/lib/Metadata/Finalizers/JavadocFinalizer.cpp b/src/lib/Metadata/Finalizers/JavadocFinalizer.cpp index 733424cb4..87e04a857 100644 --- a/src/lib/Metadata/Finalizers/JavadocFinalizer.cpp +++ b/src/lib/Metadata/Finalizers/JavadocFinalizer.cpp @@ -1712,7 +1712,7 @@ warnUndocumented() bool const prefer_definition = undocI.kind == InfoKind::Record || undocI.kind == InfoKind::Enum; this->warn( - *getPrimaryLocation(undocI, prefer_definition), + *getPrimaryLocation(undocI.Loc, prefer_definition), "{}: Symbol is undocumented", undocI.name); } corpus_.undocumented_.clear(); diff --git a/src/lib/Metadata/Info.cpp b/src/lib/Metadata/Info.cpp index 20c52b5c6..eb2ab26e2 100644 --- a/src/lib/Metadata/Info.cpp +++ b/src/lib/Metadata/Info.cpp @@ -41,7 +41,7 @@ void merge(Info& I, Info&& Other) { MRDOCS_ASSERT(I.id); - merge(I.asSourceInfo(), std::move(Other.asSourceInfo())); + merge(I.Loc, std::move(Other.Loc)); if (I.Name == "") { I.Name = Other.Name; diff --git a/src/lib/Metadata/Info/Overloads.cpp b/src/lib/Metadata/Info/Overloads.cpp index a8f567ddd..4982bd1c6 100644 --- a/src/lib/Metadata/Info/Overloads.cpp +++ b/src/lib/Metadata/Info/Overloads.cpp @@ -60,7 +60,7 @@ addMember(OverloadsInfo& I, FunctionInfo const& Member) I.ReturnType = std::nullopt; } } - merge(I.asSourceInfo(), Member.asSourceInfo()); + merge(I.Loc, Member.Loc); I.Members.push_back(Member.id); } diff --git a/src/lib/Metadata/InfoSet.hpp b/src/lib/Metadata/InfoSet.hpp index e6919ad30..9094a06fc 100644 --- a/src/lib/Metadata/InfoSet.hpp +++ b/src/lib/Metadata/InfoSet.hpp @@ -116,18 +116,18 @@ struct InfoPtrEqual using InfoSet = std::unordered_set< std::unique_ptr, InfoPtrHasher, InfoPtrEqual>; -struct UndocumentedInfo final : SourceInfo { +struct UndocumentedInfo final { SymbolID id; std::string name; InfoKind kind; + SourceInfo Loc; constexpr UndocumentedInfo( SymbolID id_, std::string name_, InfoKind kind_) noexcept - : SourceInfo() - , id(id_) + : id(id_) , name(std::move(name_)) , kind(kind_) { diff --git a/src/lib/Metadata/Source.cpp b/src/lib/Metadata/Source.cpp index ae8e402f7..85c5e5737 100644 --- a/src/lib/Metadata/Source.cpp +++ b/src/lib/Metadata/Source.cpp @@ -12,6 +12,8 @@ #include #include #include +#include +#include #include #include diff --git a/src/lib/Support/Report.cpp b/src/lib/Support/Report.cpp index efe1e7f72..54180cbfb 100644 --- a/src/lib/Support/Report.cpp +++ b/src/lib/Support/Report.cpp @@ -21,10 +21,12 @@ #ifdef _MSC_VER #define WIN32_LEAN_AND_MEAN +// clang-format off #include #include #include #include +// clang-format on #endif namespace SourceFileNames { diff --git a/src/test_suite/test_suite.cpp b/src/test_suite/test_suite.cpp index 65ed8845a..0621a41eb 100644 --- a/src/test_suite/test_suite.cpp +++ b/src/test_suite/test_suite.cpp @@ -19,10 +19,12 @@ #ifdef _MSC_VER #define WIN32_LEAN_AND_MEAN +// clang-format off #include #include #include #include +// clang-format on #endif namespace test_suite { From ac3a830f953c6ae40c76e7917db9e7701788031f Mon Sep 17 00:00:00 2001 From: Alan de Freitas Date: Thu, 25 Sep 2025 22:40:27 -0500 Subject: [PATCH 11/23] feat(lib): optional references Support Optional for references and replace usages of Optional with reference wrappers in the codebase. --- include/mrdocs/ADT/Optional.hpp | 296 ++++++++++++++++++++++ include/mrdocs/Metadata/Info/InfoBase.hpp | 20 +- include/mrdocs/Metadata/Type.hpp | 8 +- src/lib/AST/ParseRef.cpp | 6 +- src/lib/CorpusImpl.cpp | 15 +- src/lib/Metadata/Type.cpp | 50 ++-- src/test/ADT/Optional.cpp | 107 ++++++++ 7 files changed, 463 insertions(+), 39 deletions(-) diff --git a/include/mrdocs/ADT/Optional.hpp b/include/mrdocs/ADT/Optional.hpp index a743fb9c4..1917a23cd 100644 --- a/include/mrdocs/ADT/Optional.hpp +++ b/include/mrdocs/ADT/Optional.hpp @@ -52,6 +52,9 @@ inline constexpr bool isOptionalV = false; template inline constexpr bool isOptionalV> = true; + +template +inline constexpr bool isOptionalV> = true; } /** A compact optional that automatically uses nullable_traits when @@ -632,6 +635,298 @@ concept isDerivedFromOptional = requires(T const& t) { } // namespace detail + +namespace detail { +#if defined(__cpp_lib_reference_from_temporary) +using std::reference_constructs_from_temporary_v; +using std::reference_converts_from_temporary_v; +#else +template +concept reference_converts_from_temporary_v = + std::is_reference_v && + ( + (!std::is_reference_v && + std::is_convertible_v*, + std::remove_cvref_t*>) + || + (std::is_lvalue_reference_v && + std::is_const_v> && + std::is_convertible_v&&> && + !std::is_convertible_v&>) + ); + +template +inline constexpr bool reference_constructs_from_temporary_v + = reference_converts_from_temporary_v; +#endif +} // detail + +template +class Optional { + T* p_ = nullptr; + + template + static constexpr bool ok_bind_v + = std::is_constructible_v + && !detail::reference_constructs_from_temporary_v; + +public: + using value_type = T; + + constexpr + Optional() noexcept = default; + + constexpr + Optional(Optional const&) noexcept = default; + + constexpr + Optional(Optional&&) noexcept = default; + + constexpr + Optional(std::nullopt_t) noexcept + : Optional() {} + + template + requires( + !std::is_same_v, Optional> && + !std::is_same_v, std::in_place_t> && + ok_bind_v) + constexpr + explicit(!std::is_convertible_v) + Optional(U&& u) + noexcept(std::is_nothrow_constructible_v) + { + T& r(static_cast(u)); + p_ = std::addressof(r); + } + + template + requires ok_bind_v + constexpr + explicit(!std::is_convertible_v) + Optional(Optional& rhs) + noexcept(std::is_nothrow_constructible_v) + { + if (rhs) + { + p_ = std::addressof(*rhs); + } + } + + template + requires ok_bind_v + constexpr + explicit(!std::is_convertible_v) + Optional(Optional const& rhs) + noexcept(std::is_nothrow_constructible_v) + { + if (rhs) + { + p_ = std::addressof(*rhs); + } + } + + template + requires ok_bind_v + constexpr + Optional(std::optional& o) + noexcept(std::is_nothrow_constructible_v) + { + if (o) + { + p_ = std::addressof(*o); + } + } + + template + requires ok_bind_v + constexpr + Optional(std::optional const& o) + noexcept(std::is_nothrow_constructible_v) + { + if (o) + { + p_ = std::addressof(*o); + } + } + + constexpr Optional& + operator=(Optional const&) noexcept = default; + + constexpr Optional& + operator=(Optional&&) noexcept = default; + + constexpr Optional& + operator=(std::nullopt_t) noexcept + { + p_ = nullptr; + return *this; + } + + template + requires ok_bind_v + constexpr Optional& + operator=(U&& u) + noexcept(std::is_nothrow_constructible_v) + { + T& r(static_cast(u)); + p_ = std::addressof(r); + return *this; + } + + template + requires ok_bind_v + constexpr + Optional& + operator=(Optional& rhs) + noexcept(std::is_nothrow_constructible_v) + { + p_ = rhs ? std::addressof(*rhs) : nullptr; + return *this; + } + + template + requires ok_bind_v + constexpr + Optional& + operator=(Optional const& rhs) + noexcept(std::is_nothrow_constructible_v) + { + p_ = rhs ? std::addressof(*rhs) : nullptr; + return *this; + } + + template + requires ok_bind_v + constexpr + Optional& + operator=(Optional&& rhs) + noexcept(std::is_nothrow_constructible_v) + { + p_ = rhs ? std::addressof(*rhs) : nullptr; + return *this; + } + + template + requires ok_bind_v + constexpr + value_type& + emplace(U&& u) + noexcept(std::is_nothrow_constructible_v) + { + T& r(static_cast(u)); + p_ = std::addressof(r); + return *p_; + } + + static + constexpr + bool + is_inlined() noexcept + { + return true; + } + + constexpr + bool + has_value() const noexcept + { + return p_ != nullptr; + } + + constexpr + explicit + operator bool() const noexcept + { + return has_value(); + } + + constexpr + void + reset() noexcept + { + p_ = nullptr; + } + + constexpr + value_type* + operator->() noexcept + { + MRDOCS_ASSERT(has_value()); + return p_; + } + + constexpr + value_type const* + operator->() const noexcept + { + MRDOCS_ASSERT(has_value()); + return p_; + } + + constexpr + value_type& + operator*() noexcept + { + MRDOCS_ASSERT(has_value()); + return *p_; + } + + constexpr + value_type const& + operator*() const noexcept + { + MRDOCS_ASSERT(has_value()); + return *p_; + } + + constexpr + value_type& + value() & noexcept + { + MRDOCS_ASSERT(has_value()); + return *p_; + } + + constexpr + value_type const& + value() const& noexcept + { + MRDOCS_ASSERT(has_value()); + return *p_; + } + + constexpr + value_type& + value() && noexcept + { + MRDOCS_ASSERT(has_value()); + return *p_; + } + + constexpr + value_type const& + value() const&& noexcept + { + MRDOCS_ASSERT(has_value()); + return *p_; + } + + constexpr void + swap(Optional& other) noexcept + { + using std::swap; + swap(p_, other.p_); + } +}; + +template +constexpr void +swap(Optional& a, Optional& b) noexcept +{ + a.swap(b); +} + /** Compares two Optional values for equality. Returns true if both are engaged and their contained values are equal, or both are disengaged. @return `true` if both optionals are engaged and equal, or both are disengaged; otherwise, `false`. @@ -893,6 +1188,7 @@ operator<=>(Optional const& x, U const& v) { return bool(x) ? *x <=> v : std::strong_ordering::less; } + } // namespace clang::mrdocs #endif diff --git a/include/mrdocs/Metadata/Info/InfoBase.hpp b/include/mrdocs/Metadata/Info/InfoBase.hpp index 6de915403..59c1f9456 100644 --- a/include/mrdocs/Metadata/Info/InfoBase.hpp +++ b/include/mrdocs/Metadata/Info/InfoBase.hpp @@ -31,22 +31,22 @@ namespace clang::mrdocs { */ struct MRDOCS_VISIBLE Info { + /** The unqualified name. + */ + std::string Name; + /** The source location information. */ SourceInfo Loc; - /** The unique identifier for this symbol. - */ - SymbolID id; - - /** The unqualified name. - */ - std::string Name; - /** Kind of declaration. */ InfoKind Kind = InfoKind::None; + /** The unique identifier for this symbol. + */ + SymbolID id; + /** Declaration access. Class members use: @@ -152,8 +152,8 @@ struct MRDOCS_VISIBLE Info Info( InfoKind const kind, SymbolID const& ID) noexcept - : id(ID) - , Kind(kind) + : Kind(kind) + , id(ID) { } }; diff --git a/include/mrdocs/Metadata/Type.hpp b/include/mrdocs/Metadata/Type.hpp index 57a94cfe1..3393f4e31 100644 --- a/include/mrdocs/Metadata/Type.hpp +++ b/include/mrdocs/Metadata/Type.hpp @@ -118,16 +118,16 @@ operator==( /** Return the inner type. - The inner type is the type which is modified - by a specifier (e.g. "int" in "pointer to int". + The inner type is the type that is modified + by a specifier (e.g. "int" in "pointer to int"). */ MRDOCS_DECL -Optional const>> +Optional const&> innerType(TypeInfo const& TI) noexcept; /// @copydoc innerType(TypeInfo const&) MRDOCS_DECL -Optional>> +Optional&> innerType(TypeInfo& TI) noexcept; /// @copydoc innerType(TypeInfo const&) diff --git a/src/lib/AST/ParseRef.cpp b/src/lib/AST/ParseRef.cpp index 42bfb6cd6..8469da98a 100644 --- a/src/lib/AST/ParseRef.cpp +++ b/src/lib/AST/ParseRef.cpp @@ -1550,15 +1550,15 @@ class RefParser // For instance, in "int (*)[3][6]", we have a pointer to an // array of 3 arrays of 6 ints. std::size_t curSuffixLevel = suffixLevel; - while (curSuffixLevel > 0 && inner && !inner->get().valueless_after_move()) + while (curSuffixLevel > 0 && inner && !inner->valueless_after_move()) { - auto& ref = inner->get(); + auto& ref = *inner; inner = innerType(*ref); --curSuffixLevel; } char const* parenStart = ptr_; if (!parseArrayOrFunctionDeclaratorSuffix( - inner ? inner->get() : dest)) + inner ? *inner : dest)) { setError(parenStart, "expected declarator"); ptr_ = start; diff --git a/src/lib/CorpusImpl.cpp b/src/lib/CorpusImpl.cpp index a1c5316e2..1dad574bd 100644 --- a/src/lib/CorpusImpl.cpp +++ b/src/lib/CorpusImpl.cpp @@ -199,6 +199,14 @@ isDecayedEqualImpl( Info const& context, CorpusImpl const& corpus); +// Check if two types are equal after decay +// +// The isInner template parameter indicates if +// we are comparing inner types (e.g., pointee types) +// or root types (e.g., function parameter types) because +// the rules are slightly different depending +// on the level of the type specifiers. +// template bool isDecayedEqualImpl( @@ -225,7 +233,7 @@ isDecayedEqualImpl( MRDOCS_CHECK_OR(lhs->IsPackExpansion == rhs->IsPackExpansion, false); if constexpr (isInner) { - // const and volative are ignored from root types + // const and volatile are ignored from root types // in function parameters MRDOCS_CHECK_OR(lhs->IsConst == rhs->IsConst, false); MRDOCS_CHECK_OR(lhs->IsVolatile == rhs->IsVolatile, false); @@ -301,9 +309,12 @@ isDecayedEqualImpl( { auto const I1 = innerType(*lhs); auto const I2 = innerType(*rhs); + // Both inner types must be present or absent, otherwise not equal MRDOCS_CHECK_OR(static_cast(I1) == static_cast(I2), false); + // Both inner types are absent: they are equal MRDOCS_CHECK_OR(static_cast(I1) && static_cast(I2), true); - return isDecayedEqualImpl(I1->get(), I2->get(), context, corpus); + // Both inner types are present: compare them internally + return isDecayedEqualImpl(*I1, *I2, context, corpus); } default: MRDOCS_UNREACHABLE(); diff --git a/src/lib/Metadata/Type.cpp b/src/lib/Metadata/Type.cpp index b94fce3c5..16fed0b8f 100644 --- a/src/lib/Metadata/Type.cpp +++ b/src/lib/Metadata/Type.cpp @@ -780,7 +780,7 @@ template < class TypeInfoTy, bool isMutable = !std::is_const_v>, class Ptr = std::conditional_t*, Polymorphic const*>, - class Ref = std::conditional_t>, std::reference_wrapper const>>> + class Ref = std::conditional_t&, Polymorphic const&>> requires std::same_as, TypeInfo> Optional innerTypeImpl(TypeInfoTy&& TI) noexcept @@ -827,39 +827,48 @@ innerTypeImpl(TypeInfoTy&& TI) noexcept } // Get a pointer to the inner type -template -auto +template < + class TypeInfoTy, + bool isMutable = !std::is_const_v>, + class Ptr = std::conditional_t*, Polymorphic const*>, + class Ref = std::conditional_t&, Polymorphic const&>, + class InnerPtr = std::conditional_t> +requires std::same_as, TypeInfo> +InnerPtr innerTypePtrImpl(TypeInfoTy&& TI) noexcept { - auto res = innerTypeImpl(TI); + Optional res = innerTypeImpl(TI); if (res) { - auto& ref = res->get(); - return &*ref; + MRDOCS_ASSERT(!res->valueless_after_move()); + return &**res; } - return decltype(&*res->get())(nullptr); + return nullptr; } // Get the innermost type // If there's an internal type, return it // If there's no internal type, return the current type -template +template < + class PolymorphicTypeInfoTy, + bool isMutable = !std::is_const_v>, + class Ref = std::conditional_t&, Polymorphic const&>> requires std::same_as, Polymorphic> -auto& +Ref innermostTypeImpl(PolymorphicTypeInfoTy&& TI) noexcept { if (TI.valueless_after_move()) { return TI; } - /* optional */ auto inner = innerTypeImpl(*TI); + Optional inner = innerTypeImpl(*TI); if (!inner) { return TI; } while (inner) { - /* polymorphic */ auto& ref = inner->get(); + Ref ref = *inner; if (ref.valueless_after_move() || ref->isNamed()) { @@ -867,45 +876,46 @@ innermostTypeImpl(PolymorphicTypeInfoTy&& TI) noexcept } inner = innerTypeImpl(*ref); } - return inner->get(); + Ref ref = *inner; + return ref; } } -Optional const>> +Optional const&> innerType(TypeInfo const& TI) noexcept { - return innerTypeImpl(TI); + return innerTypeImpl(TI); } -Optional>> +Optional&> innerType(TypeInfo& TI) noexcept { - return innerTypeImpl(TI); + return innerTypeImpl(TI); } TypeInfo const* innerTypePtr(TypeInfo const& TI) noexcept { - return innerTypePtrImpl(TI); + return innerTypePtrImpl(TI); } TypeInfo* innerTypePtr(TypeInfo& TI) noexcept { - return innerTypePtrImpl(TI); + return innerTypePtrImpl(TI); } Polymorphic const& innermostType(Polymorphic const& TI) noexcept { - return innermostTypeImpl(TI); + return innermostTypeImpl const&>(TI); } Polymorphic& innermostType(Polymorphic& TI) noexcept { - return innermostTypeImpl(TI); + return innermostTypeImpl&>(TI); } } // clang::mrdocs diff --git a/src/test/ADT/Optional.cpp b/src/test/ADT/Optional.cpp index b7478b3c0..539233a48 100644 --- a/src/test/ADT/Optional.cpp +++ b/src/test/ADT/Optional.cpp @@ -11,6 +11,8 @@ #include #include #include +#include +#include namespace clang::mrdocs { @@ -216,6 +218,110 @@ struct OptionalTest { BOOST_TEST(a < b); } + void + test_reference_optional() + { + static_assert(detail::isOptionalV>); + + int a = 1; + int b = 2; + int c = 3; + + Optional r = a; + BOOST_TEST(r.has_value()); + BOOST_TEST(&*r == &a); + BOOST_TEST(r.value() == 1); + + struct S { + int v{ 0 }; + + int + inc() + { + return ++v; + } + }; + S s{ 7 }; + Optional rs = s; + BOOST_TEST(rs->inc() == 8); + BOOST_TEST((*rs).v == 8); + + r = b; + BOOST_TEST(&*r == &b); + BOOST_TEST(*r == 2); + + // assign from Optional + Optional rr = a; + rr = r; + BOOST_TEST(&*rr == &b); + + // construct from Optional + Optional rr2{ r }; + BOOST_TEST(&*rr2 == &b); + + // Rebinding from Optional + Optional vo = 42; + rr = vo; // rebind to the referent inside vo + BOOST_TEST(&*rr == &*vo); + BOOST_TEST(*rr == *vo); + + // rebind to different lvalue + rr2 = c; + BOOST_TEST(&*rr2 == &c); + BOOST_TEST(*rr2 == 3); + + rr2.reset(); + BOOST_TEST(!rr2.has_value()); + rr2 = a; + BOOST_TEST(&*rr2 == &a); + + Optional copy = rr2; + BOOST_TEST(&*copy == &a); + Optional moved = std::move(rr2); + BOOST_TEST(&*moved == &a); + + Optional rx = b; + Optional ry = c; + rx.swap(ry); + BOOST_TEST(&*rx == &c); + BOOST_TEST(&*ry == &b); + + Optional r1 = a; + Optional r2 = b; + BOOST_TEST(r1 != r2); + BOOST_TEST((r1 < r2) == (a < b)); + + Optional rn; + BOOST_TEST(rn == std::nullopt); + BOOST_TEST((r1 <=> std::nullopt) == std::strong_ordering::greater); + BOOST_TEST((rn <=> std::nullopt) == std::strong_ordering::equal); + + int z = 9; + Optional rz = z; + int& zref = std::move(rz).value(); + BOOST_TEST(&zref == &z); + + static_assert(!std::is_constructible_v, int&&>); + static_assert(!std::is_constructible_v, int const&&>); + static_assert(!std::is_constructible_v, Optional&&>); + static_assert(!std::is_constructible_v, Optional const&&>); + static_assert(!std::is_assignable_v, int&&>); + static_assert(!std::is_assignable_v, int const&&>); + + static_assert(std::is_constructible_v, int&>); + static_assert(std::is_assignable_v, int&>); + static_assert(std::is_constructible_v, Optional&>); + static_assert(std::is_constructible_v, Optional const&>); + static_assert(std::is_assignable_v, Optional&>); + static_assert(std::is_assignable_v, Optional const&>); + + Optional on = 1; + Optional orf = a; + BOOST_TEST(orf == on); + a = 5; + BOOST_TEST(orf != on); + } + void run() { @@ -225,6 +331,7 @@ struct OptionalTest { test_nullable_enum(); test_nullable_location(); test_fallback_notraits(); + test_reference_optional(); } }; From d91f99e176805b2749d928f6b655dffa51f7f29a Mon Sep 17 00:00:00 2001 From: Alan de Freitas Date: Thu, 25 Sep 2025 23:27:43 -0500 Subject: [PATCH 12/23] feat(lib): expected references Support Expected for references and replace usages of Expected with reference wrappers in the codebase. As with Optional references, expected references provide a safer interface that always rebinds values. Syntax is also more convenient both to declare variables without std::reference_wrapper and to access values without requiring the get function. --- include/mrdocs/ADT/Optional.hpp | 29 +- include/mrdocs/Corpus.hpp | 4 +- include/mrdocs/Support/Concepts.hpp | 21 + include/mrdocs/Support/Expected.hpp | 1037 ++++++++++++++++- src/lib/CorpusImpl.cpp | 10 +- src/lib/CorpusImpl.hpp | 6 +- .../Metadata/Finalizers/JavadocFinalizer.cpp | 4 +- src/test/Support/Expected.cpp | 477 ++++++++ 8 files changed, 1500 insertions(+), 88 deletions(-) create mode 100644 src/test/Support/Expected.cpp diff --git a/include/mrdocs/ADT/Optional.hpp b/include/mrdocs/ADT/Optional.hpp index 1917a23cd..cae1ffb1e 100644 --- a/include/mrdocs/ADT/Optional.hpp +++ b/include/mrdocs/ADT/Optional.hpp @@ -15,6 +15,7 @@ #include #include +#include #include #include #include @@ -635,32 +636,6 @@ concept isDerivedFromOptional = requires(T const& t) { } // namespace detail - -namespace detail { -#if defined(__cpp_lib_reference_from_temporary) -using std::reference_constructs_from_temporary_v; -using std::reference_converts_from_temporary_v; -#else -template -concept reference_converts_from_temporary_v = - std::is_reference_v && - ( - (!std::is_reference_v && - std::is_convertible_v*, - std::remove_cvref_t*>) - || - (std::is_lvalue_reference_v && - std::is_const_v> && - std::is_convertible_v&&> && - !std::is_convertible_v&>) - ); - -template -inline constexpr bool reference_constructs_from_temporary_v - = reference_converts_from_temporary_v; -#endif -} // detail - template class Optional { T* p_ = nullptr; @@ -668,7 +643,7 @@ class Optional { template static constexpr bool ok_bind_v = std::is_constructible_v - && !detail::reference_constructs_from_temporary_v; + && !reference_constructs_from_temporary_v; public: using value_type = T; diff --git a/include/mrdocs/Corpus.hpp b/include/mrdocs/Corpus.hpp index 1e9fd5243..e2a41ee52 100644 --- a/include/mrdocs/Corpus.hpp +++ b/include/mrdocs/Corpus.hpp @@ -99,7 +99,7 @@ class MRDOCS_VISIBLE Use @ref traverse to find all matching symbols. */ virtual - Expected> + Expected lookup(SymbolID const& context, std::string_view name) const = 0; /** Return the Info for the matching string in the global context. @@ -108,7 +108,7 @@ class MRDOCS_VISIBLE @return The Info for the symbol with the specified name in the global context, or an error if not found. */ - Expected> + Expected lookup(std::string_view name) const { return lookup(SymbolID::global, name); diff --git a/include/mrdocs/Support/Concepts.hpp b/include/mrdocs/Support/Concepts.hpp index 71c377bc0..f9c56536f 100644 --- a/include/mrdocs/Support/Concepts.hpp +++ b/include/mrdocs/Support/Concepts.hpp @@ -135,6 +135,27 @@ template concept range_of_tuple_like = std::ranges::range && tuple_like>; +#ifdef __cpp_lib_reference_from_temporary + using std::reference_constructs_from_temporary_v; + using std::reference_converts_from_temporary_v; +#else + template + concept reference_converts_from_temporary_v + = std::is_reference_v + && ((!std::is_reference_v + && std::is_convertible_v< + std::remove_cvref_t*, + std::remove_cvref_t*>) + || (std::is_lvalue_reference_v + && std::is_const_v> + && std::is_convertible_v&&> + && !std::is_convertible_v&>) ); + + template + concept reference_constructs_from_temporary_v + = reference_converts_from_temporary_v; +#endif + } // namespace clang::mrdocs diff --git a/include/mrdocs/Support/Expected.hpp b/include/mrdocs/Support/Expected.hpp index 28e239977..3bdcfaf2b 100644 --- a/include/mrdocs/Support/Expected.hpp +++ b/include/mrdocs/Support/Expected.hpp @@ -14,6 +14,7 @@ #include #include +#include #include #include #include @@ -125,13 +126,13 @@ namespace detail constexpr bool isUnexpected> = true; template - using then_result = std::remove_cvref_t>; + using ThenResult = std::remove_cvref_t>; template - using result_transform = std::remove_cv_t>; + using ResultTransform = std::remove_cv_t>; template using result0 = std::remove_cvref_t>; template - using result0_xform = std::remove_cv_t>; + using result0Transform = std::remove_cv_t>; template concept can_beUnexpected = @@ -144,6 +145,11 @@ namespace detail // Tag types for in-place construction from an invocation result. struct in_place_inv { }; struct unexpect_inv { }; + + template + inline constexpr bool ok_bind_ref_v + = std::is_constructible_v + && !reference_constructs_from_temporary_v; } template @@ -477,7 +483,7 @@ class Expected template static constexpr bool same_err - = std::is_same_v; + = std::is_same_v; template friend class Expected; @@ -1091,9 +1097,9 @@ class Expected auto and_then(Fn&& f) & { - using U = detail::then_result; + using U = detail::ThenResult; static_assert(detail::isExpected); - static_assert(std::is_same_v); + static_assert(std::is_same_v); if (has_value()) { @@ -1111,9 +1117,9 @@ class Expected auto and_then(Fn&& f) const & { - using U = detail::then_result; + using U = detail::ThenResult; static_assert(detail::isExpected); - static_assert(std::is_same_v); + static_assert(std::is_same_v); if (has_value()) { @@ -1131,9 +1137,9 @@ class Expected auto and_then(Fn&& f) && { - using U = detail::then_result; + using U = detail::ThenResult; static_assert(detail::isExpected); - static_assert(std::is_same_v); + static_assert(std::is_same_v); if (has_value()) { @@ -1152,9 +1158,9 @@ class Expected auto and_then(Fn&& f) const && { - using U = detail::then_result; + using U = detail::ThenResult; static_assert(detail::isExpected); - static_assert(std::is_same_v); + static_assert(std::is_same_v); if (has_value()) { @@ -1172,9 +1178,9 @@ class Expected auto or_else(Fn&& f) & { - using G = detail::then_result; + using G = detail::ThenResult; static_assert(detail::isExpected); - static_assert(std::is_same_v); + static_assert(std::is_same_v); if (has_value()) { @@ -1192,9 +1198,9 @@ class Expected auto or_else(Fn&& f) const & { - using G = detail::then_result; + using G = detail::ThenResult; static_assert(detail::isExpected); - static_assert(std::is_same_v); + static_assert(std::is_same_v); if (has_value()) { @@ -1212,9 +1218,9 @@ class Expected auto or_else(Fn&& f) && { - using G = detail::then_result; + using G = detail::ThenResult; static_assert(detail::isExpected); - static_assert(std::is_same_v); + static_assert(std::is_same_v); if (has_value()) { @@ -1232,9 +1238,9 @@ class Expected auto or_else(Fn&& f) const && { - using G = detail::then_result; + using G = detail::ThenResult; static_assert(detail::isExpected); - static_assert(std::is_same_v); + static_assert(std::is_same_v); if (has_value()) { @@ -1252,7 +1258,7 @@ class Expected auto transform(Fn&& f) & { - using U = detail::result_transform; + using U = detail::ResultTransform; using Res = Expected; if (has_value()) @@ -1274,7 +1280,7 @@ class Expected auto transform(Fn&& f) const & { - using U = detail::result_transform; + using U = detail::ResultTransform; using Res = Expected; if (has_value()) @@ -1296,7 +1302,7 @@ class Expected auto transform(Fn&& f) && { - using U = detail::result_transform; + using U = detail::ResultTransform; using Res = Expected; if (has_value()) @@ -1318,7 +1324,7 @@ class Expected auto transform(Fn&& f) const && { - using U = detail::result_transform; + using U = detail::ResultTransform; using Res = Expected; if (has_value()) @@ -1340,7 +1346,7 @@ class Expected auto transform_error(Fn&& f) & { - using G = detail::result_transform; + using G = detail::ResultTransform; using Res = Expected; if (has_value()) @@ -1362,7 +1368,7 @@ class Expected auto transform_error(Fn&& f) const & { - using G = detail::result_transform; + using G = detail::ResultTransform; using Res = Expected; if (has_value()) @@ -1384,7 +1390,7 @@ class Expected auto transform_error(Fn&& f) && { - using G = detail::result_transform; + using G = detail::ResultTransform; using Res = Expected; if (has_value()) @@ -1406,7 +1412,7 @@ class Expected auto transform_error(Fn&& f) const && { - using G = detail::result_transform; + using G = detail::ResultTransform; using Res = Expected; if (has_value()) @@ -1576,7 +1582,7 @@ class Expected template static constexpr bool same_err - = std::is_same_v; + = std::is_same_v; template friend class Expected; @@ -1951,7 +1957,7 @@ class Expected { using U = detail::result0; static_assert(detail::isExpected); - static_assert(std::is_same_v); + static_assert(std::is_same_v); if (has_value()) { @@ -1971,7 +1977,7 @@ class Expected { using U = detail::result0; static_assert(detail::isExpected); - static_assert(std::is_same_v); + static_assert(std::is_same_v); if (has_value()) { @@ -1991,7 +1997,7 @@ class Expected { using U = detail::result0; static_assert(detail::isExpected); - static_assert(std::is_same_v); + static_assert(std::is_same_v); if (has_value()) { @@ -2011,7 +2017,7 @@ class Expected { using U = detail::result0; static_assert(detail::isExpected); - static_assert(std::is_same_v); + static_assert(std::is_same_v); if (has_value()) { @@ -2028,9 +2034,9 @@ class Expected auto or_else(Fn&& f) & { - using G = detail::then_result; + using G = detail::ThenResult; static_assert(detail::isExpected); - static_assert(std::is_same_v); + static_assert(std::is_same_v); if (has_value()) { @@ -2047,9 +2053,9 @@ class Expected auto or_else(Fn&& f) const & { - using G = detail::then_result; + using G = detail::ThenResult; static_assert(detail::isExpected); - static_assert(std::is_same_v); + static_assert(std::is_same_v); if (has_value()) { @@ -2066,9 +2072,9 @@ class Expected auto or_else(Fn&& f) && { - using G = detail::then_result; + using G = detail::ThenResult; static_assert(detail::isExpected); - static_assert(std::is_same_v); + static_assert(std::is_same_v); if (has_value()) { @@ -2085,9 +2091,9 @@ class Expected auto or_else(Fn&& f) const&& { - using G = detail::then_result; + using G = detail::ThenResult; static_assert(detail::isExpected); - static_assert(std::is_same_v); + static_assert(std::is_same_v); if (has_value()) { @@ -2105,7 +2111,7 @@ class Expected auto transform(Fn&& f) & { - using U = detail::result0_xform; + using U = detail::result0Transform; using Res = Expected; if (has_value()) @@ -2124,7 +2130,7 @@ class Expected auto transform(Fn&& f) const & { - using U = detail::result0_xform; + using U = detail::result0Transform; using Res = Expected; if (has_value()) @@ -2143,7 +2149,7 @@ class Expected auto transform(Fn&& f) && { - using U = detail::result0_xform; + using U = detail::result0Transform; using Res = Expected; if (has_value()) @@ -2162,7 +2168,7 @@ class Expected auto transform(Fn&& f) const && { - using U = detail::result0_xform; + using U = detail::result0Transform; using Res = Expected; if (has_value()) @@ -2180,7 +2186,7 @@ class Expected auto transform_error(Fn&& f) & { - using G = detail::result_transform; + using G = detail::ResultTransform; using Res = Expected; if (has_value()) @@ -2201,7 +2207,7 @@ class Expected auto transform_error(Fn&& f) const & { - using G = detail::result_transform; + using G = detail::ResultTransform; using Res = Expected; if (has_value()) @@ -2222,7 +2228,7 @@ class Expected auto transform_error(Fn&& f) && { - using G = detail::result_transform; + using G = detail::ResultTransform; using Res = Expected; if (has_value()) @@ -2243,7 +2249,7 @@ class Expected auto transform_error(Fn&& f) const && { - using G = detail::result_transform; + using G = detail::ResultTransform; using Res = Expected; if (has_value()) @@ -2336,6 +2342,939 @@ class Expected { } }; +template +class Expected { + static_assert(detail::can_beUnexpected); + + // Storage: either a bound pointer to T, or an error E. + union { + T* p_; + E unex_; + }; + bool has_value_ = false; + + // Short aliases + using R = T&; + template + static constexpr bool ok_bind_v = detail::ok_bind_ref_v; + +public: + using value_type = T&; + using error_type = E; + using unexpected_type = Unexpected; + + template + using rebind = Expected; + + // ---------------------------------- + // ctors + // ---------------------------------- + + // Disengaged by default + constexpr + Expected() noexcept + : p_(nullptr), has_value_(false) {} + + // Success from lvalue: bind + template + requires(!std::is_same_v, Expected> + && !std::is_same_v, std::in_place_t> + && !detail::isUnexpected> && ok_bind_v) + constexpr + explicit(!std::is_convertible_v) + Expected(U& u) noexcept(std::is_nothrow_constructible_v) + : p_(std::addressof(static_cast(u))) + , has_value_(true) + {} + + // Deleted when binding would be from a temporary / disallowed + template + requires(!std::is_same_v, Expected> + && !std::is_same_v, std::in_place_t> + && !detail::isUnexpected> + && !ok_bind_v) + constexpr + Expected(U&&) = delete; + + // In-place: bind to an lvalue argument + template + requires ok_bind_v + constexpr + explicit + Expected(std::in_place_t, U& u) noexcept + : p_(std::addressof(static_cast(u))) + , has_value_(true) + {} + + // In-place via invocation result (mirrors your in_place_inv) + template + explicit + constexpr + Expected(detail::in_place_inv, Fn&& fn) + { + // Expect fn() to yield something bindable to R (i.e. an lvalue of T) + auto&& r = std::forward(fn)(); + static_assert(ok_bind_v); + p_ = std::addressof(static_cast(r)); + has_value_ = true; + } + + // Error ctors (same rules as primary) + template + requires std::is_constructible_v + constexpr + explicit(!std::is_convertible_v) + Expected(Unexpected const& u) + noexcept(std::is_nothrow_constructible_v) + : unex_(u.error()) + , has_value_(false) + {} + + template + requires std::is_constructible_v + constexpr + explicit(!std::is_convertible_v) + Expected(Unexpected&& u) + noexcept(std::is_nothrow_constructible_v) + : unex_(std::move(u).error()) + , has_value_(false) + {} + + // Error via invocation-result (mirrors your unexpect_inv) + template + explicit + constexpr + Expected(detail::unexpect_inv, Fn&& fn) + : unex_(std::forward(fn)()) + , has_value_(false) + {} + + // Converting ctors from other Expected ----------------------- + + // From Expected: safe to bind for any value category + template + requires detail::ok_bind_ref_v + constexpr + explicit(!std::is_convertible_v) + Expected(Expected const& other) + noexcept(std::is_nothrow_constructible_v + && std::is_nothrow_copy_constructible_v) + : has_value_(other.has_value_) + { + if (has_value_) + { + p_ = std::addressof(static_cast(other.value())); + } else + { + std::construct_at(std::addressof(unex_), other.error()); + } + } + + template + requires detail::ok_bind_ref_v + constexpr + explicit(!std::is_convertible_v) + Expected(Expected&& other) + noexcept(std::is_nothrow_constructible_v + && std::is_nothrow_move_constructible_v) + : has_value_(other.has_value_) + { + if (has_value_) + { + p_ = std::addressof(static_cast(other.value())); + } else + { + std::construct_at(std::addressof(unex_), std::move(other).error()); + } + } + + // From Expected (non-ref): only from lvalue object; forbid rvalue + template + requires detail::ok_bind_ref_v + constexpr + explicit(!std::is_convertible_v) + Expected(Expected& other) + noexcept(std::is_nothrow_constructible_v + && std::is_nothrow_copy_constructible_v) + : has_value_(other.has_value()) + { + if (has_value_) + { + p_ = std::addressof(other.value()); + } else + { + std::construct_at(std::addressof(unex_), other.error()); + } + } + + template + constexpr + Expected(Expected&&) = delete; // would dangle + + // Copy/move/dtor + constexpr + Expected(Expected const&) = default; + + constexpr + Expected(Expected&&) = default; + + template + requires std::is_constructible_v + constexpr + explicit + Expected(unexpect_t, Args&&... args) + noexcept(std::is_nothrow_constructible_v) + : unex_(std::forward(args)...) + , has_value_(false) + {} + + template + requires std::is_constructible_v&, Args...> + constexpr + explicit + Expected(unexpect_t, std::initializer_list il, Args&&... args) + noexcept(std::is_nothrow_constructible_v&, Args...>) + : unex_(il, std::forward(args)...) + , has_value_(false) + {} + + constexpr + ~Expected() + { + if (!has_value_) + { + std::destroy_at(std::addressof(unex_)); + } + } + + // ---------------------------------- + // assignment (always rebind) + // ---------------------------------- + + constexpr + Expected& + operator=(Expected const&) = default; + + constexpr + Expected& + operator=(Expected&&) = default; + + // Assign from lvalue -> rebind + template + requires ok_bind_v + constexpr + Expected& + operator=(U& u) + noexcept(std::is_nothrow_constructible_v) + { + if (!has_value_) + { + std::destroy_at(std::addressof(unex_)); + has_value_ = true; + } + p_ = std::addressof(static_cast(u)); + return *this; + } + + // Deleted for temporaries + template + requires(!ok_bind_v) + constexpr + Expected& + operator=(U&&) = delete; + + // Assign from Expected -> rebind or store error + template + requires detail::ok_bind_ref_v + constexpr + Expected& + operator=(Expected const& other) + { + if (other.has_value()) + { + if (!has_value_) + { + std::destroy_at(std::addressof(unex_)); + has_value_ = true; + } + p_ = std::addressof(static_cast(other.value())); + } else + { + if (has_value_) + { + std::construct_at(std::addressof(unex_), other.error()); + has_value_ = false; + } else + { + unex_ = other.error(); + } + } + return *this; + } + + template + requires detail::ok_bind_ref_v + constexpr + Expected& + operator=(Expected&& other) + { + if (other.has_value()) + { + if (!has_value_) + { + std::destroy_at(std::addressof(unex_)); + has_value_ = true; + } + p_ = std::addressof(static_cast(other.value())); + } else + { + if (has_value_) + { + std::construct_at( + std::addressof(unex_), + std::move(other).error()); + has_value_ = false; + } else + { + unex_ = std::move(other).error(); + } + } + return *this; + } + + // Assign from Expected lvalue only (non-ref). Rvalue deleted to avoid + // dangling. + template + requires detail::ok_bind_ref_v + constexpr + Expected& + operator=(Expected& other) + { + if (other.has_value()) + { + if (!has_value_) + { + std::destroy_at(std::addressof(unex_)); + has_value_ = true; + } + p_ = std::addressof(other.value()); + } else + { + if (has_value_) + { + std::construct_at(std::addressof(unex_), other.error()); + has_value_ = false; + } else + { + unex_ = other.error(); + } + } + return *this; + } + + template + constexpr + Expected& + operator=(Expected&&) = delete; + + // Assign error + template + requires std::is_constructible_v + && std::is_assignable_v + constexpr + Expected& + operator=(Unexpected const& e) + { + if (has_value_) + { + std::construct_at(std::addressof(unex_), e.error()); + has_value_ = false; + } else + { + unex_ = e.error(); + } + return *this; + } + + template + requires std::is_constructible_v && std::is_assignable_v + constexpr + Expected& + operator=(Unexpected&& e) + { + if (has_value_) + { + std::construct_at(std::addressof(unex_), std::move(e).error()); + has_value_ = false; + } else + { + unex_ = std::move(e).error(); + } + return *this; + } + + // Emplace: bind to an lvalue + template + requires ok_bind_v + constexpr + T& + emplace(U& u) noexcept + { + if (!has_value_) + { + std::destroy_at(std::addressof(unex_)); + has_value_ = true; + } + p_ = std::addressof(static_cast(u)); + return *p_; + } + + template + requires(!ok_bind_v) + constexpr + T& + emplace(U&&) = delete; + + // swap + constexpr + void + swap(Expected& x) + noexcept( + std::is_nothrow_move_constructible_v + && std::is_nothrow_swappable_v) + requires std::is_swappable_v + { + if (has_value_) + { + if (x.has_value_) + { + using std::swap; + swap(p_, x.p_); + } else + { + // this has value, x has error + E tmp(std::move(x.unex_)); + std::destroy_at(std::addressof(x.unex_)); + x.p_ = p_; + x.has_value_ = true; + + std::construct_at(std::addressof(unex_), std::move(tmp)); + has_value_ = false; + } + } else + { + if (x.has_value_) + { + x.swap(*this); + } else + { + using std::swap; + swap(unex_, x.unex_); + } + } + } + + friend constexpr + void + swap(Expected& a, Expected& b) + noexcept(noexcept(a.swap(b))) + requires requires { a.swap(b); } + { + a.swap(b); + } + + // ---------------------------------- + // observers + // ---------------------------------- + [[nodiscard]] + constexpr + explicit + operator bool() const noexcept + { + return has_value_; + } + + [[nodiscard]] + constexpr + bool + has_value() const noexcept + { + return has_value_; + } + + [[nodiscard]] + constexpr + T* + operator->() noexcept + { + MRDOCS_ASSERT(has_value_); + return p_; + } + + [[nodiscard]] + constexpr + T const* + operator->() const noexcept + { + MRDOCS_ASSERT(has_value_); + return p_; + } + + [[nodiscard]] + constexpr + T& + operator*() & noexcept + { + MRDOCS_ASSERT(has_value_); + return *p_; + } + + [[nodiscard]] + constexpr + T const& + operator*() const& noexcept + { + MRDOCS_ASSERT(has_value_); + return *p_; + } + + [[nodiscard]] + constexpr + T&& + operator*() && noexcept + { + MRDOCS_ASSERT(has_value_); + return std::move(*p_); + } + + [[nodiscard]] + constexpr + T const&& + operator*() const&& noexcept + { + MRDOCS_ASSERT(has_value_); + return std::move(*p_); + } + + constexpr + T& + value() & + { + if (has_value_) + { + return *p_; + } + throw BadExpectedAccess(error()); + } + + constexpr + T const& + value() const& + { + if (has_value_) + { + return *p_; + } + throw BadExpectedAccess(error()); + } + + constexpr + T&& + value() && + { + if (has_value_) + { + return std::move(*p_); + } + throw BadExpectedAccess(std::move(error())); + } + + constexpr + T const&& + value() const&& + { + if (has_value_) + { + return std::move(*p_); + } + throw BadExpectedAccess(std::move(error())); + } + + [[nodiscard]] + constexpr + E& + error() & noexcept + { + MRDOCS_ASSERT(!has_value_); + return unex_; + } + + [[nodiscard]] + constexpr + E const& + error() const& noexcept + { + MRDOCS_ASSERT(!has_value_); + return unex_; + } + + [[nodiscard]] + constexpr + E&& + error() && noexcept + { + MRDOCS_ASSERT(!has_value_); + return std::move(unex_); + } + + [[nodiscard]] + constexpr + E const&& + error() const&& noexcept + { + MRDOCS_ASSERT(!has_value_); + return std::move(unex_); + } + + // value_or: return by value (copy/move), like your non-ref primary + template + constexpr + std::remove_reference_t + value_or(U&& u) const& + { + using Rval = std::remove_reference_t; + static_assert(std::is_copy_constructible_v); + static_assert(std::is_convertible_v); + return has_value_ ? *p_ : static_cast(std::forward(u)); + } + + template + constexpr + std::remove_reference_t + value_or(U&& u) && + { + using Rval = std::remove_reference_t; + static_assert(std::is_move_constructible_v); + static_assert(std::is_convertible_v); + return has_value_ ? std::move(*p_) : + static_cast(std::forward(u)); + } + + // error_or: identical to primary + template + constexpr + E + error_or(G&& g) const& + { + return has_value_ ? static_cast(std::forward(g)) : unex_; + } + + template + constexpr + E + error_or(G&& g) && + { + return has_value_ ? static_cast(std::forward(g)) : + std::move(unex_); + } + + // ---------------------------------- + // monadic ops + // ---------------------------------- + + // and_then: F(T&) -> Expected<*, E> + template + constexpr + auto + and_then(Fn&& f) & + { + using U = std::remove_cvref_t>; + static_assert(detail::isExpected); + static_assert(std::is_same_v); + if (has_value_) + { + return std::invoke(std::forward(f), *p_); + } + return U(unexpect, unex_); + } + + template + constexpr + auto + and_then(Fn&& f) const& + { + using U = std::remove_cvref_t>; + static_assert(detail::isExpected); + static_assert(std::is_same_v); + if (has_value_) + { + return std::invoke(std::forward(f), *p_); + } + return U(unexpect, unex_); + } + + template + constexpr + auto + and_then(Fn&& f) && + { + using U = std::remove_cvref_t>; + static_assert(detail::isExpected); + static_assert(std::is_same_v); + if (has_value_) + { + return std::invoke(std::forward(f), std::move(*p_)); + } + return U(unexpect, std::move(unex_)); + } + + template + constexpr + auto + and_then(Fn&& f) const&& + { + using U = std::remove_cvref_t>; + static_assert(detail::isExpected); + static_assert(std::is_same_v); + if (has_value_) + { + return std::invoke(std::forward(f), std::move(*p_)); + } + return U(unexpect, std::move(unex_)); + } + + // or_else: same signature/behavior as primary; when engaged, return + // self-type with same binding + template + constexpr + Expected + or_else(Fn&& f) & + { + if (has_value_) + { + return *this; + } + auto g = std::forward(f)(unex_); + static_assert( + std::is_same_v, Expected>); + return g; + } + + template + constexpr + Expected + or_else(Fn&& f) const& + { + if (has_value_) + { + return *this; + } + auto g = std::forward(f)(unex_); + static_assert( + std::is_same_v, Expected>); + return g; + } + + template + constexpr + Expected + or_else(Fn&& f) && + { + if (has_value_) + { + return *this; + } + auto g = std::forward(f)(std::move(unex_)); + static_assert( + std::is_same_v, Expected>); + return g; + } + + template + constexpr + Expected + or_else(Fn&& f) const&& + { + if (has_value_) + { + return *this; + } + auto g = std::forward(f)(std::move(unex_)); + static_assert( + std::is_same_v, Expected>); + return g; + } + + // transform: F(T&) -> U ; returns Expected + template + constexpr + auto + transform(Fn&& f) & + { + using U = std::remove_cv_t>; + using Res = Expected; + if (has_value_) + { + return Res(detail::in_place_inv{}, [&] { + return std::invoke(std::forward(f), *p_); + }); + } + return Res(unexpect, unex_); + } + + template + constexpr + auto + transform(Fn&& f) const& + { + using U = std::remove_cv_t>; + using Res = Expected; + if (has_value_) + { + return Res(detail::in_place_inv{}, [&] { + return std::invoke(std::forward(f), *p_); + }); + } + return Res(unexpect, unex_); + } + + template + constexpr + auto + transform(Fn&& f) && + { + using U = std::remove_cv_t>; + using Res = Expected; + if (has_value_) + { + return Res(detail::in_place_inv{}, [&] { + return std::invoke(std::forward(f), std::move(*p_)); + }); + } + return Res(unexpect, std::move(unex_)); + } + + template + constexpr + auto + transform(Fn&& f) const&& + { + using U = std::remove_cv_t>; + using Res = Expected; + if (has_value_) + { + return Res(detail::in_place_inv{}, [&] { + return std::invoke(std::forward(f), std::move(*p_)); + }); + } + return Res(unexpect, std::move(unex_)); + } + + // transform_error: identical to primary + template + constexpr + auto + transform_error(Fn&& f) & + { + using G = std::remove_cv_t>; + using Res = Expected; + if (has_value_) + { + return Res(std::in_place, *p_); + } + return Res(detail::unexpect_inv{}, [&] { + return std::invoke(std::forward(f), unex_); + }); + } + + template + constexpr + auto + transform_error(Fn&& f) const& + { + using G = std::remove_cv_t>; + using Res = Expected; + if (has_value_) + { + return Res(std::in_place, *p_); + } + return Res(detail::unexpect_inv{}, [&] { + return std::invoke(std::forward(f), unex_); + }); + } + + template + constexpr + auto + transform_error(Fn&& f) && + { + using G = std::remove_cv_t>; + using Res = Expected; + if (has_value_) + { + return Res(std::in_place, *p_); + } + return Res(detail::unexpect_inv{}, [&] { + return std::invoke(std::forward(f), std::move(unex_)); + }); + } + + template + constexpr + auto + transform_error(Fn&& f) const&& + { + using G = std::remove_cv_t>; + using Res = Expected; + if (has_value_) + { + return Res(std::in_place, *p_); + } + return Res(detail::unexpect_inv{}, [&] { + return std::invoke(std::forward(f), std::move(unex_)); + }); + } + + template + friend + constexpr + bool + operator==(Expected const& x, Expected const& y) + noexcept(noexcept(bool(*x == *y)) && + noexcept(bool(x.error() == y.error()))) + requires (!std::is_void_v) + { + if (x.has_value()) + { + return y.has_value() && bool(*x == *y); + } else + { + return !y.has_value() && bool(x.error() == y.error()); + } + } + + + template + friend + constexpr + bool + operator==(Expected const& x, U const& v) + noexcept(noexcept(bool(*x == v))) + { + return x.has_value() && bool(*x == v); + } + + template + friend + constexpr + bool + operator==(Expected const& x, Unexpected const& e) + noexcept(noexcept(bool(x.error() == e.error()))) + { + return !x.has_value() && bool(x.error() == e.error()); + } +}; // class Expected + } // clang::mrdocs #endif diff --git a/src/lib/CorpusImpl.cpp b/src/lib/CorpusImpl.cpp index 1dad574bd..6b947fb97 100644 --- a/src/lib/CorpusImpl.cpp +++ b/src/lib/CorpusImpl.cpp @@ -374,14 +374,14 @@ isDecayedEqual( } } -Expected> +Expected CorpusImpl:: lookup(SymbolID const& context, std::string_view const name) const { return lookupImpl(*this, context, name); } -Expected> +Expected CorpusImpl:: lookup(SymbolID const& context, std::string_view name) { @@ -389,7 +389,7 @@ lookup(SymbolID const& context, std::string_view name) } template -Expected> +Expected CorpusImpl:: lookupImpl(Self&& self, SymbolID const& contextId0, std::string_view name) { @@ -412,7 +412,7 @@ lookupImpl(Self&& self, SymbolID const& contextId0, std::string_view name) name, self.Corpus::qualifiedName(*self.find(contextId)))); } - return std::cref(*info); + return *info; } auto const expRef = parse(name); if (!expRef) @@ -433,7 +433,7 @@ lookupImpl(Self&& self, SymbolID const& contextId0, std::string_view name) name, self.Corpus::qualifiedName(*contextPtr))); } - return std::cref(*res); + return *res; } template diff --git a/src/lib/CorpusImpl.hpp b/src/lib/CorpusImpl.hpp index 0e628264b..2a0c7efd1 100644 --- a/src/lib/CorpusImpl.hpp +++ b/src/lib/CorpusImpl.hpp @@ -142,10 +142,10 @@ class CorpusImpl final : public Corpus std::views::common; } - Expected> + Expected lookup(SymbolID const& context, std::string_view name) const override; - Expected> + Expected lookup(SymbolID const& context, std::string_view name); /** Build metadata for a set of translation units. @@ -198,7 +198,7 @@ class CorpusImpl final : public Corpus template static - Expected> + Expected lookupImpl( Self&& self, SymbolID const& contextId, diff --git a/src/lib/Metadata/Finalizers/JavadocFinalizer.cpp b/src/lib/Metadata/Finalizers/JavadocFinalizer.cpp index 87e04a857..48dca5260 100644 --- a/src/lib/Metadata/Finalizers/JavadocFinalizer.cpp +++ b/src/lib/Metadata/Finalizers/JavadocFinalizer.cpp @@ -791,9 +791,9 @@ finalize(doc::Reference& ref, bool const emitWarning) } if (auto resRef = corpus_.lookup(current_context_->id, ref.string)) { - // KRYSTIAN NOTE: we should provide an overload that + // KRYSTIAN NOTE: We should provide an overload that // returns a non-const reference. - auto& res = const_cast(resRef->get()); + auto& res = const_cast(*resRef); ref.id = res.id; } else if ( diff --git a/src/test/Support/Expected.cpp b/src/test/Support/Expected.cpp new file mode 100644 index 000000000..432da2d36 --- /dev/null +++ b/src/test/Support/Expected.cpp @@ -0,0 +1,477 @@ +// +// Licensed under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// Copyright (c) 2025 Alan de Freitas (vinnie.falco@gmail.com) +// +// Official repository: https://github.com/cppalliance/mrdocs +// + +// +// Licensed under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// Official repository: https://github.com/cppalliance/mrdocs +// + +#include +#include +#include +#include +#include + +namespace clang { +namespace mrdocs { + +struct ExpectedTest +{ + struct S { + int v = 0; + int + get() const noexcept + { + return v; + } + auto + operator<=>(S const&) const + = default; + }; + + // Helpers returning Expected for monadic tests + static + Expected + plus_one(int x) + { + return Expected(x + 1); + } + + static + Expected + fail_with(std::string msg) + { + return Expected(unexpect, Error(std::move(msg))); + } + + static + Expected + ok_void() + { + return Expected(std::in_place); + } + + static + Expected + fail_void(std::string msg) + { + return Expected(unexpect, Error(std::move(msg))); + } + + void + test_value_expected_basic() + { + using E = Error; + + // default-construct value (if T is default-constructible) + { + Expected e(std::in_place, 0); + BOOST_TEST(e.has_value()); + BOOST_TEST(*e == 0); + BOOST_TEST(e.value() == 0); + } + + // construct from value + { + Expected e(42); + BOOST_TEST(e); + BOOST_TEST(*e == 42); + + // copy/move + Expected c = e; + BOOST_TEST(c); + BOOST_TEST(*c == 42); + + Expected m = std::move(e); + BOOST_TEST(m); + BOOST_TEST(*m == 42); + + // assign value + c = 7; + BOOST_TEST(c); + BOOST_TEST(*c == 7); + } + + // construct unexpected + { + Expected e(unexpect, E("bang")); + BOOST_TEST(!e); + BOOST_TEST(e.error().failed()); + BOOST_TEST(!e.has_value()); + // error_or + auto er = e.error_or(E("alt")); + BOOST_TEST(er.failed()); + } + + // assign unexpected + { + Expected e(3); + e = Unexpected(E("nope")); + BOOST_TEST(!e); + BOOST_TEST(e.error().failed()); + } + + // emplace + { + Expected e(unexpect, E("x")); + e.emplace(99); + BOOST_TEST(e); + BOOST_TEST(*e == 99); + } + + // operator-> / operator* with object type + { + Expected es(S{ 5 }); + BOOST_TEST(es->get() == 5); + BOOST_TEST((*es).v == 5); + } + + // value_or + { + Expected a(10); + Expected b(unexpect, E("err")); + BOOST_TEST(a.value_or(1) == 10); + BOOST_TEST(b.value_or(1) == 1); + } + + // and_then (success) + { + Expected e(10); + auto r = e.and_then([](int& x) { return plus_one(x); }); + BOOST_TEST(r); + BOOST_TEST(*r == 11); + } + + // and_then (error propagates) + { + Expected e(unexpect, E("err")); + auto r = e.and_then([](int& x) { return plus_one(x); }); + BOOST_TEST(!r); + BOOST_TEST(r.error().failed()); + } + + // or_else (success path returns same value) + { + Expected e(3); + auto r = e.or_else([](E&) { return fail_with("should-not-run"); }); + BOOST_TEST(r); + BOOST_TEST(*r == 3); + } + + // or_else (error path produces alternate) + { + Expected e(unexpect, E("oops")); + auto r = e.or_else([](E&) { return Expected(7); }); + BOOST_TEST(r); + BOOST_TEST(*r == 7); + } + + // transform maps the value + { + Expected e(8); + auto r = e.transform([](int& x) { return x * 2; }); + static_assert(std::is_same_v>); + BOOST_TEST(r); + BOOST_TEST(*r == 16); + } + + // transform_error maps the error + { + struct MyErr { + std::string s; + }; + Expected e(unexpect, E("bad")); + auto r = e.transform_error([](E& old) { + return MyErr{ old.message() }; + }); + static_assert(std::is_same_v>); + BOOST_TEST(!r); + BOOST_TEST(r.error().s.find("bad") != std::string::npos); + } + + // swap combinations + { + Expected a(1); + Expected b(2); + swap(a, b); + BOOST_TEST(*a == 2); + BOOST_TEST(*b == 1); + + Expected c(unexpect, E("err")); + swap(a, c); + BOOST_TEST(!a); + BOOST_TEST(c); + BOOST_TEST(*c == 2); + } + + // equality (value vs value, error vs error) + { + Expected a(5), b(5), c(6); + Expected xe(unexpect, E("x")), ye(unexpect, E("x")); + BOOST_TEST(a == b); + BOOST_TEST(!(a == c)); + BOOST_TEST(xe == ye); + BOOST_TEST(!(a == xe)); + } + } + + void + test_void_expected_basic() + { + using Ev = Error; + + // default engaged + { + Expected e(std::in_place); + BOOST_TEST(e); + // operator* is a no-op with an assert, we won't call it here. + e.value(); // should not throw + } + + // unexpected + { + Expected e(unexpect, Ev("boom")); + BOOST_TEST(!e); + BOOST_TEST(e.error().failed()); + auto er = e.error_or(Ev("alt")); + BOOST_TEST(er.failed()); + } + + // copy/move assign between states + { + Expected ok(std::in_place); + Expected err(unexpect, Ev("x")); + + ok = err; // ok -> err + BOOST_TEST(!ok); + + err = Expected(std::in_place); // err -> ok + BOOST_TEST(err); + } + + // emplace clears error + { + Expected e(unexpect, Ev("no")); + e.emplace(); + BOOST_TEST(e); + } + + // and_then + { + Expected e(std::in_place); + auto r = e.and_then([] { return ok_void(); }); + BOOST_TEST(r); + } + { + Expected e(unexpect, Ev("n")); + auto r = e.and_then([] { return ok_void(); }); + BOOST_TEST(!r); + } + + // or_else + { + Expected e(unexpect, Ev("nope")); + auto r = e.or_else([](Ev&) { return ok_void(); }); + BOOST_TEST(r); + } + + // transform to non-void + { + Expected e(std::in_place); + auto r = e.transform([] { return 17; }); + static_assert(std::is_same_v>); + BOOST_TEST(r); + BOOST_TEST(*r == 17); + } + + // transform_error + { + struct MyErr { + std::string s; + }; + Expected e(unexpect, Ev("zzz")); + auto r = e.transform_error([](Ev& old) { + return MyErr{ old.message() }; + }); + static_assert(std::is_same_v>); + BOOST_TEST(!r); + BOOST_TEST(r.error().s.find("zzz") != std::string::npos); + } + + // swap + { + Expected a(std::in_place); + Expected b(unexpect, Ev("e")); + swap(a, b); + BOOST_TEST(!a); + BOOST_TEST(b); + } + + // equality + { + Expected ok1(std::in_place), ok2(std::in_place); + Expected er1(unexpect, Ev("e1")), er2(unexpect, Ev("e1")); + BOOST_TEST(ok1 == ok2); + BOOST_TEST(er1 == er2); + BOOST_TEST(!(ok1 == er1)); + } + } + + void + test_reference_expected_basic() + { + using E = Error; + + int x = 10; + int y = 20; + + // bind to lvalue, arrow/deref/value + { + Expected er(std::in_place, x); + BOOST_TEST(er); + BOOST_TEST(&er.value() == &x); + BOOST_TEST(*er == 10); + + er = y; // rebinding + BOOST_TEST(&er.value() == &y); + BOOST_TEST(*er == 20); + } + + // construct from Expected& (binds to contained lvalue) + { + Expected ev(std::in_place, 42); + Expected er(std::in_place, x); + er = ev; // rebind to ev.value() + BOOST_TEST(&er.value() == &ev.value()); + BOOST_TEST(*er == 42); + } + + // value_or returns by value (copy) + { + Expected er(std::in_place, x); + Expected bad(unexpect, E("err")); + auto v1 = er.value_or(5); + auto v2 = bad.value_or(5); + static_assert(std::is_same_v); + BOOST_TEST(v1 == 10); + BOOST_TEST(v2 == 5); + } + + // error transitions + { + Expected er(unexpect, E("e")); + BOOST_TEST(!er); + er = x; // rebind from error -> success + BOOST_TEST(er); + BOOST_TEST(&er.value() == &x); + } + + // transform + { + Expected er(std::in_place, x); + auto r = er.transform([](int& r) { return r * 3; }); + static_assert(std::is_same_v>); + BOOST_TEST(r); + BOOST_TEST(*r == 30); + } + + // and_then (success) + { + Expected er(std::in_place, x); + auto r = er.and_then([](int& r) { return plus_one(r); }); + BOOST_TEST(r); + BOOST_TEST(*r == 11); + } + + // and_then (error propagates) + { + Expected er(unexpect, E("err")); + auto r = er.and_then([](int& r) { return plus_one(r); }); + BOOST_TEST(!r); + } + + // transform_error changes error type, preserves binding semantics on + // success + { + struct MyErr { + std::string s; + }; + + Expected ok(std::in_place, x); + auto r1 = ok.transform_error([](E& e) { + return MyErr{ e.message() }; + }); + static_assert(std::is_same_v>); + BOOST_TEST(r1); + BOOST_TEST(&r1.value() == &x); + + Expected bad(unexpect, E("xx")); + auto r2 = bad.transform_error([](E& e) { + return MyErr{ e.message() }; + }); + BOOST_TEST(!r2); + BOOST_TEST(r2.error().s.find("xx") != std::string::npos); + } + + // swap: value<->value and value<->error + { + Expected a(std::in_place, x); + Expected b(std::in_place, y); + swap(a, b); + BOOST_TEST(&a.value() == &y); + BOOST_TEST(&b.value() == &x); + + Expected c(unexpect, E("err")); + swap(a, c); + BOOST_TEST(!a); + BOOST_TEST(c); + BOOST_TEST(&c.value() == &y); + } + + // equality (value vs value, error vs error) + { + Expected a(std::in_place, x); + Expected b(std::in_place, x); + Expected c(std::in_place, y); + Expected xe(unexpect, E("e")), ye(unexpect, E("e")); + + BOOST_TEST(a == b); + BOOST_TEST(!(a == c)); + BOOST_TEST(xe == ye); + BOOST_TEST(!(a == xe)); + } + + // deleted constructs/assignments from temporaries (compile-time checks) + { + static_assert(!std::is_constructible_v, int&&>); + static_assert(!std::is_assignable_v, int&&>); + static_assert(!std::is_constructible_v, Expected&&>); + static_assert(!std::is_assignable_v, Expected&&>); + } + } + + void + run() + { + test_value_expected_basic(); + test_void_expected_basic(); + test_reference_expected_basic(); + } +}; + +TEST_SUITE( + ExpectedTest, + "clang.mrdocs.Expected"); + +} // mrdocs +} // clang From fe2a192b14728b5514a7e99af0462e170497c9e8 Mon Sep 17 00:00:00 2001 From: Alan de Freitas Date: Fri, 26 Sep 2025 00:38:33 -0500 Subject: [PATCH 13/23] fix(Report): do not attempt to format logs without parameters This leads to segmentation faults when the string contains reserved sequences. --- include/mrdocs/Support/Report.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/mrdocs/Support/Report.hpp b/include/mrdocs/Support/Report.hpp index c8da3716f..0deffc886 100644 --- a/include/mrdocs/Support/Report.hpp +++ b/include/mrdocs/Support/Report.hpp @@ -184,7 +184,7 @@ log_impl( Level level, Located fs) { - std::string str = std::vformat(fs.value, std::make_format_args()); + std::string str(fs.value); return print(level, str, &fs.where); } } From ea3d445035f7671f72fc0cd93f57421e1c728904 Mon Sep 17 00:00:00 2001 From: Alan de Freitas Date: Fri, 26 Sep 2025 00:39:58 -0500 Subject: [PATCH 14/23] feat(Corpus): location objects include column number --- include/mrdocs/Metadata/Info/Location.hpp | 6 ++++++ src/lib/AST/ASTVisitor.cpp | 15 +++++++++++---- src/lib/Metadata/Source.cpp | 1 + 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/include/mrdocs/Metadata/Info/Location.hpp b/include/mrdocs/Metadata/Info/Location.hpp index f102947a9..260557586 100644 --- a/include/mrdocs/Metadata/Info/Location.hpp +++ b/include/mrdocs/Metadata/Info/Location.hpp @@ -39,6 +39,10 @@ struct MRDOCS_DECL */ unsigned LineNumber = 0; + /** Column number within the line + */ + unsigned ColumnNumber = 0; + /** Whether this location has documentation. */ bool Documented = false; @@ -51,11 +55,13 @@ struct MRDOCS_DECL std::string_view const short_path = {}, std::string_view const source_path = {}, unsigned const line = 0, + unsigned const col = 0, bool const documented = false) : FullPath(full_path) , ShortPath(short_path) , SourcePath(source_path) , LineNumber(line) + , ColumnNumber(col) , Documented(documented) { } diff --git a/src/lib/AST/ASTVisitor.cpp b/src/lib/AST/ASTVisitor.cpp index 53eee91c8..24bdd9639 100644 --- a/src/lib/AST/ASTVisitor.cpp +++ b/src/lib/AST/ASTVisitor.cpp @@ -580,21 +580,28 @@ populate( bool const definition, bool const documented) { - unsigned line = source_.getPresumedLoc( - loc, false).getLine(); + auto presLoc = source_.getPresumedLoc(loc, false); + unsigned line = presLoc.getLine(); + unsigned col = presLoc.getColumn(); FileInfo* file = findFileInfo(loc); // No file is not an error, it just typically means it has been generated // in the virtual filesystem. MRDOCS_CHECK_OR(file); + Location Loc(file->full_path, + file->short_path, + file->source_path, + line, + col, + documented); if (definition) { if (I.DefLoc) { return; } - I.DefLoc.emplace(file->full_path, file->short_path, file->source_path, line, documented); + I.DefLoc = std::move(Loc); } else { @@ -609,7 +616,7 @@ populate( { return; } - I.Loc.emplace_back(file->full_path, file->short_path, file->source_path, line, documented); + I.Loc.push_back(std::move(Loc)); } } diff --git a/src/lib/Metadata/Source.cpp b/src/lib/Metadata/Source.cpp index 85c5e5737..b0ca0814f 100644 --- a/src/lib/Metadata/Source.cpp +++ b/src/lib/Metadata/Source.cpp @@ -111,6 +111,7 @@ tag_invoke( io.map("shortPath", loc.ShortPath); io.map("sourcePath", loc.SourcePath); io.map("line", loc.LineNumber); + io.map("column", loc.ColumnNumber); io.map("documented", loc.Documented); } From bbfcd93d9db648befc9d8b283590c056b5dc4fac Mon Sep 17 00:00:00 2001 From: Alan de Freitas Date: Fri, 26 Sep 2025 00:40:16 -0500 Subject: [PATCH 15/23] feat(Corpus): render source line and caret in warning output Warnings now include a snippet of the source file similar to GCC and Clang diagnostics. Each warning prints the file path, line, and column, followed by the line of source text and a caret marker pointing to the column. This makes it easier to identify and fix issues directly in context without having to open the file manually. --- .../Metadata/Finalizers/JavadocFinalizer.cpp | 172 ++++++++++++++++-- .../Metadata/Finalizers/JavadocFinalizer.hpp | 6 +- 2 files changed, 160 insertions(+), 18 deletions(-) diff --git a/src/lib/Metadata/Finalizers/JavadocFinalizer.cpp b/src/lib/Metadata/Finalizers/JavadocFinalizer.cpp index 48dca5260..67dc1bfad 100644 --- a/src/lib/Metadata/Finalizers/JavadocFinalizer.cpp +++ b/src/lib/Metadata/Finalizers/JavadocFinalizer.cpp @@ -14,6 +14,7 @@ #include #include #include +#include #include #include @@ -1672,9 +1673,64 @@ checkExists(SymbolID const& id) const MRDOCS_ASSERT(corpus_.info_.contains(id)); } +namespace { +// Expand tabs to spaces using a tab stop of 8 (common in toolchains) +inline +std::string +expand_tabs(std::string_view s, std::size_t tabw = 8) +{ + std::string out; + out.reserve(s.size()); + std::size_t col = 0; + for (char ch: s) + { + if (ch == '\t') + { + std::size_t spaces = tabw - (col % tabw); + out.append(spaces, ' '); + col += spaces; + } else + { + out.push_back(ch); + // naive column advance; + // good enough for ASCII/byte-based columns + ++col; + } + } + return out; +} + +// Split into lines; tolerates \n, \r\n, and final line w/o newline +inline +std::vector +split_lines(std::string const& text) +{ + std::vector lines; + std::size_t start = 0; + while (start <= text.size()) + { + auto nl = text.find('\n', start); + if (nl == std::string::npos) + { + // last line (may be empty) + lines.emplace_back(text.data() + start, text.size() - start); + break; + } + // trim a preceding '\r' if present + std::size_t len = nl - start; + if (len > 0 && text[nl - 1] == '\r') + { + --len; + } + lines.emplace_back(text.data() + start, len); + start = nl + 1; + } + return lines; +} +} // namespace + void -JavadocFinalizer:: -emitWarnings() +JavadocFinalizer::emitWarnings() { MRDOCS_CHECK_OR(corpus_.config->warnings); warnUndocumented(); @@ -1683,26 +1739,107 @@ emitWarnings() warnUndocEnumValues(); warnUnnamedParams(); - // Print to the console - auto const level = !corpus_.config->warnAsError ? report::Level::warn : report::Level::error; - for (auto const& [loc, msgs] : warnings_) + auto const level = !corpus_.config->warnAsError ? + report::Level::warn : + report::Level::error; + + // Simple cache for the last file we touched + std::string_view lastPath; + std::string fileContents; + std::vector fileLines; + + for (auto const& [loc, msgs]: warnings_) { - std::string locWarning = - std::format("{}:{}\n", loc.FullPath, loc.LineNumber); - int i = 1; - for (auto const &msg : msgs) { - locWarning += std::format(" {}) {}\n", i++, msg); - } - report::log(level, locWarning); + // Build the location header + std::string out; + out += std::format("{}:{}:{}:\n", loc.FullPath, loc.LineNumber, loc.ColumnNumber); + + // Append grouped messages for this location + { + int i = 1; + for (auto const& msg: msgs) + { + out += std::format(" {}) {}\n", i++, msg); + } + } + + // Render the source snippet if possible + // Load file if path changed + if (loc.FullPath != lastPath) + { + lastPath = loc.FullPath; + fileContents.clear(); + fileLines.clear(); + + if (auto expFileContents = files::getFileText(loc.FullPath); + expFileContents) + { + fileContents = std::move(*expFileContents); + fileLines = split_lines(fileContents); + } + else + { + fileLines.clear(); + } + } + + if (loc.LineNumber < fileLines.size() && + loc.LineNumber > 0) + { + std::string_view rawLine = fileLines[loc.LineNumber - 1]; + std::size_t caretCol = + loc.ColumnNumber < rawLine.size() && + loc.ColumnNumber > 0 + ? loc.ColumnNumber - 1 + : std::size_t(-1); + std::string lineExpanded = expand_tabs(rawLine, 8); + + // Compute width for the line number gutter + std::string gutter = std::format(" {} | ", loc.LineNumber); + out += gutter; + + // Line text + out += lineExpanded; + out += "\n"; + + // Create gutter for the caret line + std::size_t const gutterWidth = gutter.size(); + gutter = std::string(gutterWidth - 2, ' ') + "| "; + out += gutter; + + if (caretCol != std::size_t(-1) && caretCol < rawLine.size()) + { + std::size_t expandedCaretCol = 0; + for (std::size_t i = 0; i < caretCol; ++i) + { + if (rawLine[i] == '\t') + { + expandedCaretCol += 8; + } + else + { + ++expandedCaretCol; + } + } + MRDOCS_ASSERT(expandedCaretCol <= lineExpanded.size()); + + out += std::string(expandedCaretCol, ' '); + out += "^"; + + out += std::string(lineExpanded.size() - expandedCaretCol - 1, '~'); + out += "\n"; + } + } + + report::log(level, out); } } void -JavadocFinalizer:: -warnUndocumented() +JavadocFinalizer::warnUndocumented() { MRDOCS_CHECK_OR(corpus_.config->warnIfUndocumented); - for (auto& undocI : corpus_.undocumented_) + for (auto& undocI: corpus_.undocumented_) { if (Info const* I = corpus_.find(undocI.id)) { @@ -1710,10 +1847,11 @@ warnUndocumented() !I->javadoc || I->Extraction == ExtractionMode::Regular); } bool const prefer_definition = undocI.kind == InfoKind::Record - || undocI.kind == InfoKind::Enum; + || undocI.kind == InfoKind::Enum; this->warn( *getPrimaryLocation(undocI.Loc, prefer_definition), - "{}: Symbol is undocumented", undocI.name); + "{}: Symbol is undocumented", + undocI.name); } corpus_.undocumented_.clear(); } diff --git a/src/lib/Metadata/Finalizers/JavadocFinalizer.hpp b/src/lib/Metadata/Finalizers/JavadocFinalizer.hpp index b0814aab8..48fb6bf90 100644 --- a/src/lib/Metadata/Finalizers/JavadocFinalizer.hpp +++ b/src/lib/Metadata/Finalizers/JavadocFinalizer.hpp @@ -71,7 +71,11 @@ class JavadocFinalizer { return lhs.FullPath < rhs.FullPath; } - return lhs.LineNumber > rhs.LineNumber; + if (lhs.LineNumber != rhs.LineNumber) + { + return lhs.LineNumber > rhs.LineNumber; + } + return lhs.ColumnNumber > rhs.ColumnNumber; } }; From 616217a4988c29ac47bd0d35d3ec5f0fd7837d28 Mon Sep 17 00:00:00 2001 From: Alan de Freitas Date: Fri, 26 Sep 2025 18:11:29 -0500 Subject: [PATCH 16/23] refactor(Corpus): enforce non-optional polymorphic types Ensure optional polymorphic types are only used for members that are really optional in terms of application logic. Otherwise, we only make them polymorphic objects that cannot be empty and give them reasonable defaults among the derived types in that type family. --- include/mrdocs/Metadata/Info/Concept.hpp | 2 +- include/mrdocs/Metadata/Info/Enum.hpp | 25 +- include/mrdocs/Metadata/Info/Friend.hpp | 10 +- include/mrdocs/Metadata/Info/Function.hpp | 11 +- include/mrdocs/Metadata/Info/Guide.hpp | 4 +- .../mrdocs/Metadata/Info/NamespaceAlias.hpp | 2 +- include/mrdocs/Metadata/Info/Overloads.hpp | 9 +- include/mrdocs/Metadata/Info/Param.hpp | 2 +- include/mrdocs/Metadata/Info/RecordBase.hpp | 16 +- include/mrdocs/Metadata/Info/Source.hpp | 2 +- include/mrdocs/Metadata/Info/Typedef.hpp | 4 +- include/mrdocs/Metadata/Info/Variable.hpp | 4 +- include/mrdocs/Metadata/TArg.hpp | 2 +- include/mrdocs/Metadata/TArg/NonTypeTArg.hpp | 2 +- include/mrdocs/Metadata/TArg/TArgBase.hpp | 4 +- include/mrdocs/Metadata/TArg/TArgKind.hpp | 2 +- include/mrdocs/Metadata/TArg/TypeTArg.hpp | 5 +- include/mrdocs/Metadata/TParam.hpp | 6 +- .../{NonTypeTParam.hpp => ConstantTParam.hpp} | 20 +- include/mrdocs/Metadata/TParam/TParamBase.hpp | 13 +- include/mrdocs/Metadata/TParam/TParamKind.hpp | 6 +- .../mrdocs/Metadata/Type/ArrayTypeInfo.hpp | 3 +- include/mrdocs/Metadata/Type/AutoTypeInfo.hpp | 3 + .../mrdocs/Metadata/Type/FunctionTypeInfo.hpp | 3 +- .../Metadata/Type/LValueReferenceTypeInfo.hpp | 2 +- .../Metadata/Type/MemberPointerTypeInfo.hpp | 4 +- .../mrdocs/Metadata/Type/PointerTypeInfo.hpp | 3 +- .../Metadata/Type/RValueReferenceTypeInfo.hpp | 3 +- include/mrdocs/Support/Expected.hpp | 2 +- mrdocs.rnc | 4 +- .../generator/adoc/partials/symbol.adoc.hbs | 4 +- .../common/partials/template/arg.hbs | 4 +- .../common/partials/template/param-text.hbs | 2 +- .../common/partials/template/param.hbs | 4 +- .../generator/html/partials/symbol.html.hbs | 4 +- src/lib/AST/ASTVisitor.cpp | 89 ++-- src/lib/AST/ParseRef.cpp | 9 +- src/lib/AST/TypeInfoBuilder.cpp | 73 ++-- src/lib/AST/TypeInfoBuilder.hpp | 14 +- src/lib/CorpusImpl.cpp | 13 +- src/lib/Gen/hbs/TagfileWriter.cpp | 18 +- src/lib/Gen/hbs/VisitorHelpers.cpp | 17 +- src/lib/Gen/xml/CXXTags.hpp | 79 ++-- src/lib/Gen/xml/XMLTags.hpp | 2 +- src/lib/Gen/xml/XMLWriter.cpp | 19 +- src/lib/Gen/xml/XMLWriter.hpp | 2 +- .../Finalizers/BaseMembersFinalizer.cpp | 21 +- .../Metadata/Finalizers/DerivedFinalizer.cpp | 6 +- .../Metadata/Finalizers/Javadoc/Function.hpp | 112 +++-- .../Metadata/Finalizers/JavadocFinalizer.cpp | 90 ++-- .../Finalizers/OverloadsFinalizer.cpp | 8 +- .../Finalizers/SortMembersFinalizer.cpp | 35 +- src/lib/Metadata/Info/Function.cpp | 7 +- src/lib/Metadata/Info/Guide.cpp | 3 +- src/lib/Metadata/Info/NamespaceAlias.cpp | 8 +- src/lib/Metadata/Info/Overloads.cpp | 3 +- src/lib/Metadata/Info/Record.cpp | 7 +- src/lib/Metadata/Info/Typedef.cpp | 2 +- src/lib/Metadata/Info/Variable.cpp | 2 +- src/lib/Metadata/Name.cpp | 9 +- src/lib/Metadata/Source.cpp | 4 +- src/lib/Metadata/Template.cpp | 25 +- src/lib/Metadata/Type.cpp | 26 +- src/lib/Support/Report.cpp | 2 +- src/lib/clang.natvis | 4 +- src/test/ADT/Optional.cpp | 2 +- src/test/Support/Expected.cpp | 2 +- src/tool/ToolMain.cpp | 2 +- .../golden-tests/config/auto-relates/enum.xml | 2 +- .../config/auto-relates/return-type.xml | 2 +- .../symbol-type/nested-private-template.xml | 4 +- .../javadoc/copydoc/param-types.xml | 2 +- .../javadoc/copydoc/qualified.xml | 2 +- .../javadoc/copydoc/template-arguments.xml | 14 +- .../function/explicit-conv-operator.xml | 2 +- .../symbols/function/explicit-ctor.xml | 2 +- .../symbols/function/function-template.xml | 10 +- .../symbols/function/function-tparm-decay.xml | 8 +- .../symbols/guide/explicit-deduct-guide.xml | 4 +- .../class-template-specializations-1.xml | 410 +++++++++--------- .../symbols/record/local-class.cpp | 12 +- .../symbols/record/local-class.xml | 2 +- .../symbols/record/record-data.xml | 2 +- .../template-specialization-inheritance.xml | 10 +- .../symbols/using/using-member-function.xml | 2 +- 85 files changed, 717 insertions(+), 684 deletions(-) rename include/mrdocs/Metadata/TParam/{NonTypeTParam.hpp => ConstantTParam.hpp} (58%) diff --git a/include/mrdocs/Metadata/Info/Concept.hpp b/include/mrdocs/Metadata/Info/Concept.hpp index ba6a15d15..48c97fb0f 100644 --- a/include/mrdocs/Metadata/Info/Concept.hpp +++ b/include/mrdocs/Metadata/Info/Concept.hpp @@ -12,8 +12,8 @@ #define MRDOCS_API_METADATA_INFO_CONCEPT_HPP #include -#include #include +#include #include #include #include diff --git a/include/mrdocs/Metadata/Info/Enum.hpp b/include/mrdocs/Metadata/Info/Enum.hpp index fc8550548..9affb60d4 100644 --- a/include/mrdocs/Metadata/Info/Enum.hpp +++ b/include/mrdocs/Metadata/Info/Enum.hpp @@ -24,17 +24,32 @@ namespace clang::mrdocs { struct EnumInfo final : InfoCommonBase { - // Indicates whether this enum is scoped (e.g. enum class). + /** Indicates whether this enum is scoped (e.g. enum class). + + If true, the enumerators are accessed with the scope resolution + operator (e.g. EnumName::Enumerator). + + If false, the enumerators are accessed directly (e.g. Enumerator) + in the parent context. + */ bool Scoped = false; - // Set too nonempty to the type when this is an explicitly typed enum. For - // enum Foo : short { ... }; - // this will be "short". + /** The underlying type of this enum, if explicitly specified. + + If not specified, the underlying type is an implementation-defined + integral type that can represent all the enumerator values defined in + the enumeration. + + For `enum Foo : short { ... };` this will be represent `short`. + */ Optional> UnderlyingType = std::nullopt; /** The members of this scope. - All members are enum constants; + All members are enum constants. + + Enum constants are independent symbol types that + can be documented separately. */ std::vector Constants; diff --git a/include/mrdocs/Metadata/Info/Friend.hpp b/include/mrdocs/Metadata/Info/Friend.hpp index ef76e3ff6..15ae6cb0d 100644 --- a/include/mrdocs/Metadata/Info/Friend.hpp +++ b/include/mrdocs/Metadata/Info/Friend.hpp @@ -21,7 +21,13 @@ namespace clang::mrdocs { - Friendship is not transitive - Friendship is not inherited - - Access specifiers have no effect on the meaning of friend declarations + - Access specifiers do not affect the meaning of friend declarations + + The friends of a record are stored directly in the record's metadata. + + If the friend declaration is documented, the documentation is + stored in the befriended symbol's metadata rather than in the + relationship. */ struct FriendInfo final { @@ -30,6 +36,8 @@ struct FriendInfo final SymbolID id = SymbolID::invalid; /** Befriended type. + + This member is nullable and only used when befriending a type. */ Optional> Type = std::nullopt; }; diff --git a/include/mrdocs/Metadata/Info/Function.hpp b/include/mrdocs/Metadata/Info/Function.hpp index de1b9f09d..1d2963e79 100644 --- a/include/mrdocs/Metadata/Info/Function.hpp +++ b/include/mrdocs/Metadata/Info/Function.hpp @@ -30,8 +30,15 @@ namespace clang::mrdocs { struct FunctionInfo final : InfoCommonBase { - /// Info about the return type of this function. - Optional> ReturnType = std::nullopt; + /** Info about the return type of this function. + + If the function has a deduced return type, this contains + `auto` to indicate that. + + By default, we also use `auto` in the member to indicate + an unknown return type. + */ + Polymorphic ReturnType = Polymorphic(AutoTypeInfo{}); /// List of parameters. std::vector Params; diff --git a/include/mrdocs/Metadata/Info/Guide.hpp b/include/mrdocs/Metadata/Info/Guide.hpp index 67de5f07f..f1272ceab 100644 --- a/include/mrdocs/Metadata/Info/Guide.hpp +++ b/include/mrdocs/Metadata/Info/Guide.hpp @@ -12,8 +12,8 @@ #define MRDOCS_API_METADATA_INFO_GUIDE_HPP #include -#include #include +#include #include #include #include @@ -32,7 +32,7 @@ struct GuideInfo final This is always a SpecializationTypeInfo. */ - Optional> Deduced = std::nullopt; + Polymorphic Deduced = Polymorphic(AutoTypeInfo{}); /** Template head, if any. */ diff --git a/include/mrdocs/Metadata/Info/NamespaceAlias.hpp b/include/mrdocs/Metadata/Info/NamespaceAlias.hpp index ba0d4a00d..ed17922fc 100644 --- a/include/mrdocs/Metadata/Info/NamespaceAlias.hpp +++ b/include/mrdocs/Metadata/Info/NamespaceAlias.hpp @@ -28,7 +28,7 @@ struct NamespaceAliasInfo final This is another namespace that might or might not be in the same project. */ - Optional> AliasedSymbol; + IdentifierNameInfo AliasedSymbol; //-------------------------------------------- diff --git a/include/mrdocs/Metadata/Info/Overloads.hpp b/include/mrdocs/Metadata/Info/Overloads.hpp index d76c541f6..252efe11f 100644 --- a/include/mrdocs/Metadata/Info/Overloads.hpp +++ b/include/mrdocs/Metadata/Info/Overloads.hpp @@ -31,8 +31,13 @@ struct OverloadsInfo final /// The members of the overload set. std::vector Members; - /// Info about the return type of this function. - Optional> ReturnType = std::nullopt; + /** Info about the return type of these function overloads. + + If all overloads have the same return type, this contains + that type. Otherwise, it contains `auto` to indicate that + the return type varies according to the parameters. + */ + Polymorphic ReturnType = Polymorphic(AutoTypeInfo{}); //-------------------------------------------- diff --git a/include/mrdocs/Metadata/Info/Param.hpp b/include/mrdocs/Metadata/Info/Param.hpp index 9463a3496..0de17e20d 100644 --- a/include/mrdocs/Metadata/Info/Param.hpp +++ b/include/mrdocs/Metadata/Info/Param.hpp @@ -27,7 +27,7 @@ struct Param final { /** The type of this parameter */ - Optional> Type = std::nullopt; + Polymorphic Type = Polymorphic(AutoTypeInfo{}); /** The parameter name. */ diff --git a/include/mrdocs/Metadata/Info/RecordBase.hpp b/include/mrdocs/Metadata/Info/RecordBase.hpp index 6981db72a..982371c0a 100644 --- a/include/mrdocs/Metadata/Info/RecordBase.hpp +++ b/include/mrdocs/Metadata/Info/RecordBase.hpp @@ -22,11 +22,23 @@ namespace clang::mrdocs { */ struct BaseInfo { - Optional> Type; + /** The base type. + + This is typically a `NamedTypeInfo` that refers to a + `RecordInfo`, but it could also be a more complex type + such as a `decltype`. + */ + Polymorphic Type; + + /** The access specifier for the base. + */ AccessKind Access = AccessKind::Public; + + /** Whether the base is virtual. + */ bool IsVirtual = false; - BaseInfo() = default; + BaseInfo() = delete; BaseInfo( Polymorphic&& type, diff --git a/include/mrdocs/Metadata/Info/Source.hpp b/include/mrdocs/Metadata/Info/Source.hpp index bbf39accc..b38a20c67 100644 --- a/include/mrdocs/Metadata/Info/Source.hpp +++ b/include/mrdocs/Metadata/Info/Source.hpp @@ -14,9 +14,9 @@ #define MRDOCS_API_METADATA_INFO_SOURCE_HPP #include -#include #include #include +#include #include namespace clang::mrdocs { diff --git a/include/mrdocs/Metadata/Info/Typedef.hpp b/include/mrdocs/Metadata/Info/Typedef.hpp index a8c66aa6e..06d4c367d 100644 --- a/include/mrdocs/Metadata/Info/Typedef.hpp +++ b/include/mrdocs/Metadata/Info/Typedef.hpp @@ -13,8 +13,8 @@ #ifndef MRDOCS_API_METADATA_INFO_TYPEDEF_HPP #define MRDOCS_API_METADATA_INFO_TYPEDEF_HPP -#include #include +#include #include #include #include @@ -26,7 +26,7 @@ namespace clang::mrdocs { struct TypedefInfo final : InfoCommonBase { - Optional> Type = std::nullopt; + Polymorphic Type = Polymorphic(NamedTypeInfo{}); /** Indicates if this is a new C++ "using"-style typedef diff --git a/include/mrdocs/Metadata/Info/Variable.hpp b/include/mrdocs/Metadata/Info/Variable.hpp index 5512318b7..cfdfbee2f 100644 --- a/include/mrdocs/Metadata/Info/Variable.hpp +++ b/include/mrdocs/Metadata/Info/Variable.hpp @@ -32,8 +32,10 @@ struct VariableInfo final : InfoCommonBase { /** The type of the variable */ - Optional> Type = std::nullopt; + Polymorphic Type = Polymorphic(NamedTypeInfo{}); + /** The template information, if any. + */ Optional Template; /** The default member initializer, if any. diff --git a/include/mrdocs/Metadata/TArg.hpp b/include/mrdocs/Metadata/TArg.hpp index 0094ce2ea..ac1af6837 100644 --- a/include/mrdocs/Metadata/TArg.hpp +++ b/include/mrdocs/Metadata/TArg.hpp @@ -39,7 +39,7 @@ visit( return f(static_cast&>(A), std::forward(args)...); - case TArgKind::NonType: + case TArgKind::Constant: return f(static_cast&>(A), std::forward(args)...); diff --git a/include/mrdocs/Metadata/TArg/NonTypeTArg.hpp b/include/mrdocs/Metadata/TArg/NonTypeTArg.hpp index f3cad9dcd..39849cd93 100644 --- a/include/mrdocs/Metadata/TArg/NonTypeTArg.hpp +++ b/include/mrdocs/Metadata/TArg/NonTypeTArg.hpp @@ -21,7 +21,7 @@ namespace clang::mrdocs { struct NonTypeTArg final - : TArgCommonBase + : TArgCommonBase { /** Template argument expression. */ ExprInfo Value; diff --git a/include/mrdocs/Metadata/TArg/TArgBase.hpp b/include/mrdocs/Metadata/TArg/TArgBase.hpp index 0ce2269cf..5e877a92f 100644 --- a/include/mrdocs/Metadata/TArg/TArgBase.hpp +++ b/include/mrdocs/Metadata/TArg/TArgBase.hpp @@ -30,7 +30,7 @@ struct TArg constexpr virtual ~TArg() = default; constexpr bool isType() const noexcept { return Kind == TArgKind::Type; } - constexpr bool isNonType() const noexcept { return Kind == TArgKind::NonType; } + constexpr bool isConstant() const noexcept { return Kind == TArgKind::Constant; } constexpr bool isTemplate() const noexcept { return Kind == TArgKind::Template; } auto operator<=>(TArg const&) const = default; @@ -52,7 +52,7 @@ struct TArgCommonBase : TArg static constexpr TArgKind kind_id = K; static constexpr bool isType() noexcept { return K == TArgKind::Type; } - static constexpr bool isNonType() noexcept { return K == TArgKind::NonType; } + static constexpr bool isConstant() noexcept { return K == TArgKind::Constant; } static constexpr bool isTemplate() noexcept { return K == TArgKind::Template; } protected: diff --git a/include/mrdocs/Metadata/TArg/TArgKind.hpp b/include/mrdocs/Metadata/TArg/TArgKind.hpp index d14174765..633753140 100644 --- a/include/mrdocs/Metadata/TArg/TArgKind.hpp +++ b/include/mrdocs/Metadata/TArg/TArgKind.hpp @@ -27,7 +27,7 @@ enum class TArgKind : int /// type arguments Type = 1, // for bitstream /// non-type arguments, i.e. expressions - NonType, + Constant, /// template template arguments, i.e. template names Template }; diff --git a/include/mrdocs/Metadata/TArg/TypeTArg.hpp b/include/mrdocs/Metadata/TArg/TypeTArg.hpp index 642ec2d4a..a061d6124 100644 --- a/include/mrdocs/Metadata/TArg/TypeTArg.hpp +++ b/include/mrdocs/Metadata/TArg/TypeTArg.hpp @@ -23,8 +23,9 @@ namespace clang::mrdocs { struct TypeTArg final : TArgCommonBase { - /** Template argument type. */ - Optional> Type = std::nullopt; + /** Template argument type. + */ + Polymorphic Type = Polymorphic(AutoTypeInfo{}); auto operator<=>(TypeTArg const&) const = default; }; diff --git a/include/mrdocs/Metadata/TParam.hpp b/include/mrdocs/Metadata/TParam.hpp index 9831a87f5..19d211c92 100644 --- a/include/mrdocs/Metadata/TParam.hpp +++ b/include/mrdocs/Metadata/TParam.hpp @@ -15,7 +15,7 @@ #define MRDOCS_API_METADATA_TPARAM_HPP #include -#include +#include #include #include #include @@ -40,9 +40,9 @@ visit( return f(static_cast&>(P), std::forward(args)...); - case TParamKind::NonType: + case TParamKind::Constant: return f(static_cast&>(P), + TParamTy, ConstantTParam>&>(P), std::forward(args)...); case TParamKind::Template: return f(static_cast #include @@ -22,15 +22,21 @@ namespace clang::mrdocs { -struct NonTypeTParam final - : TParamCommonBase +/** A constant template parameter + + Before C++26, constant template parameters were called + non-type template parameter in the standard wording. + The terminology was changed by P2841R6 / PR#7587. + */ +struct ConstantTParam final + : TParamCommonBase { /** Type of the non-type template parameter */ - Optional> Type = std::nullopt; + Polymorphic Type = Polymorphic(AutoTypeInfo{}); - std::strong_ordering operator<=>(NonTypeTParam const&) const; + std::strong_ordering operator<=>(ConstantTParam const&) const; }; } // clang::mrdocs -#endif +#endif // MRDOCS_API_METADATA_TPARAM_CONSTANTTPARAM_HPP diff --git a/include/mrdocs/Metadata/TParam/TParamBase.hpp b/include/mrdocs/Metadata/TParam/TParamBase.hpp index 5b201035d..6aa07bb11 100644 --- a/include/mrdocs/Metadata/TParam/TParamBase.hpp +++ b/include/mrdocs/Metadata/TParam/TParamBase.hpp @@ -26,22 +26,25 @@ class DomCorpus; struct TParam { - /** The kind of template parameter this is */ + /** The kind of template parameter this is + */ TParamKind Kind = TParamKind::Type; - /** The template parameters name, if any */ + /** The template parameters name, if any + */ std::string Name; /** Whether this template parameter is a parameter pack */ bool IsParameterPack = false; - /** The default template argument, if any */ + /** The default template argument, if any + */ Optional> Default = std::nullopt; constexpr virtual ~TParam() = default; constexpr bool isType() const noexcept { return Kind == TParamKind::Type; } - constexpr bool isNonType() const noexcept { return Kind == TParamKind::NonType; } + constexpr bool isConstant() const noexcept { return Kind == TParamKind::Constant; } constexpr bool isTemplate() const noexcept { return Kind == TParamKind::Template; } std::strong_ordering operator<=>(TParam const&) const; @@ -71,7 +74,7 @@ struct TParamCommonBase : TParam static constexpr TParamKind kind_id = K; static constexpr bool isType() noexcept { return K == TParamKind::Type; } - static constexpr bool isNonType() noexcept { return K == TParamKind::NonType; } + static constexpr bool isConstant() noexcept { return K == TParamKind::Constant; } static constexpr bool isTemplate() noexcept { return K == TParamKind::Template; } auto operator<=>(TParamCommonBase const&) const = default; diff --git a/include/mrdocs/Metadata/TParam/TParamKind.hpp b/include/mrdocs/Metadata/TParam/TParamKind.hpp index 8af7b910b..ae4467da9 100644 --- a/include/mrdocs/Metadata/TParam/TParamKind.hpp +++ b/include/mrdocs/Metadata/TParam/TParamKind.hpp @@ -24,12 +24,14 @@ enum class TParamKind : int /// Template type parameter, e.g. "typename T" or "class T" Type = 1, // for bitstream /// Template non-type parameter, e.g. "int N" or "auto N" - NonType, + Constant, /// Template-template parameter, e.g. "template typename T" Template }; -MRDOCS_DECL std::string_view toString(TParamKind kind) noexcept; +MRDOCS_DECL +std::string_view +toString(TParamKind kind) noexcept; } // clang::mrdocs diff --git a/include/mrdocs/Metadata/Type/ArrayTypeInfo.hpp b/include/mrdocs/Metadata/Type/ArrayTypeInfo.hpp index da746e2b2..53495933b 100644 --- a/include/mrdocs/Metadata/Type/ArrayTypeInfo.hpp +++ b/include/mrdocs/Metadata/Type/ArrayTypeInfo.hpp @@ -14,6 +14,7 @@ #include #include #include +#include #include namespace clang::mrdocs { @@ -21,7 +22,7 @@ namespace clang::mrdocs { struct ArrayTypeInfo final : TypeInfoCommonBase { - Optional> ElementType = std::nullopt; + Polymorphic ElementType = Polymorphic(AutoTypeInfo{}); ConstantExprInfo Bounds; std::strong_ordering diff --git a/include/mrdocs/Metadata/Type/AutoTypeInfo.hpp b/include/mrdocs/Metadata/Type/AutoTypeInfo.hpp index 4522e72d8..724881b24 100644 --- a/include/mrdocs/Metadata/Type/AutoTypeInfo.hpp +++ b/include/mrdocs/Metadata/Type/AutoTypeInfo.hpp @@ -23,6 +23,9 @@ struct AutoTypeInfo final : TypeInfoCommonBase { AutoKind Keyword = AutoKind::Auto; + + /** Constraint on the auto type, if any. + */ Optional> Constraint = std::nullopt; std::strong_ordering diff --git a/include/mrdocs/Metadata/Type/FunctionTypeInfo.hpp b/include/mrdocs/Metadata/Type/FunctionTypeInfo.hpp index 2c1658ba8..605b3b837 100644 --- a/include/mrdocs/Metadata/Type/FunctionTypeInfo.hpp +++ b/include/mrdocs/Metadata/Type/FunctionTypeInfo.hpp @@ -15,6 +15,7 @@ #include #include #include +#include #include namespace clang::mrdocs { @@ -22,7 +23,7 @@ namespace clang::mrdocs { struct FunctionTypeInfo final : TypeInfoCommonBase { - Optional> ReturnType = std::nullopt; + Polymorphic ReturnType = Polymorphic(AutoTypeInfo{}); std::vector> ParamTypes; ReferenceKind RefQualifier = ReferenceKind::None; NoexceptInfo ExceptionSpec; diff --git a/include/mrdocs/Metadata/Type/LValueReferenceTypeInfo.hpp b/include/mrdocs/Metadata/Type/LValueReferenceTypeInfo.hpp index d1eea06e2..e54cf6a1a 100644 --- a/include/mrdocs/Metadata/Type/LValueReferenceTypeInfo.hpp +++ b/include/mrdocs/Metadata/Type/LValueReferenceTypeInfo.hpp @@ -21,7 +21,7 @@ namespace clang::mrdocs { struct LValueReferenceTypeInfo final : TypeInfoCommonBase { - Optional> PointeeType = std::nullopt; + Polymorphic PointeeType = Polymorphic(AutoTypeInfo{}); std::strong_ordering operator<=>(LValueReferenceTypeInfo const&) const; diff --git a/include/mrdocs/Metadata/Type/MemberPointerTypeInfo.hpp b/include/mrdocs/Metadata/Type/MemberPointerTypeInfo.hpp index 3fd3ab1fc..46bf05097 100644 --- a/include/mrdocs/Metadata/Type/MemberPointerTypeInfo.hpp +++ b/include/mrdocs/Metadata/Type/MemberPointerTypeInfo.hpp @@ -21,8 +21,8 @@ namespace clang::mrdocs { struct MemberPointerTypeInfo final : TypeInfoCommonBase { - Optional> ParentType = std::nullopt; - Optional> PointeeType = std::nullopt; + Polymorphic ParentType = Polymorphic(AutoTypeInfo{}); + Polymorphic PointeeType = Polymorphic(AutoTypeInfo{}); std::strong_ordering operator<=>(MemberPointerTypeInfo const&) const; diff --git a/include/mrdocs/Metadata/Type/PointerTypeInfo.hpp b/include/mrdocs/Metadata/Type/PointerTypeInfo.hpp index ffb070f8e..fdd2c42c3 100644 --- a/include/mrdocs/Metadata/Type/PointerTypeInfo.hpp +++ b/include/mrdocs/Metadata/Type/PointerTypeInfo.hpp @@ -21,7 +21,8 @@ namespace clang::mrdocs { struct PointerTypeInfo final : TypeInfoCommonBase { - Optional> PointeeType = std::nullopt; + Polymorphic PointeeType = Polymorphic(AutoTypeInfo{}); + std::strong_ordering operator<=>(PointerTypeInfo const&) const; }; diff --git a/include/mrdocs/Metadata/Type/RValueReferenceTypeInfo.hpp b/include/mrdocs/Metadata/Type/RValueReferenceTypeInfo.hpp index 03d41575a..e435bc7d4 100644 --- a/include/mrdocs/Metadata/Type/RValueReferenceTypeInfo.hpp +++ b/include/mrdocs/Metadata/Type/RValueReferenceTypeInfo.hpp @@ -21,7 +21,8 @@ namespace clang::mrdocs { struct RValueReferenceTypeInfo final : TypeInfoCommonBase { - Optional> PointeeType = std::nullopt; + Polymorphic PointeeType = Polymorphic(AutoTypeInfo{}); + std::strong_ordering operator<=>(RValueReferenceTypeInfo const&) const; }; diff --git a/include/mrdocs/Support/Expected.hpp b/include/mrdocs/Support/Expected.hpp index 3bdcfaf2b..34f430751 100644 --- a/include/mrdocs/Support/Expected.hpp +++ b/include/mrdocs/Support/Expected.hpp @@ -13,8 +13,8 @@ #define MRDOCS_API_SUPPORT_EXPECTED_HPP #include -#include #include +#include #include #include #include diff --git a/mrdocs.rnc b/mrdocs.rnc index f1ba87798..07042fa9e 100644 --- a/mrdocs.rnc +++ b/mrdocs.rnc @@ -288,7 +288,7 @@ grammar TemplateArg = element targ { - attribute class { "type"|"non-type"|"template" }, + attribute class { "type"|"constant"|"template" }, attribute name { text } ?, ID ?, attribute type { text } ?, @@ -299,7 +299,7 @@ grammar element tparam { attribute name { text } ?, - attribute class { "type"|"non-type"|"template" }, + attribute class { "type"|"constant"|"template" }, attribute type { text } ?, attribute default { text } ?, TemplateParam * diff --git a/share/mrdocs/addons/generator/adoc/partials/symbol.adoc.hbs b/share/mrdocs/addons/generator/adoc/partials/symbol.adoc.hbs index 9dcfabc93..3cf382e49 100644 --- a/share/mrdocs/addons/generator/adoc/partials/symbol.adoc.hbs +++ b/share/mrdocs/addons/generator/adoc/partials/symbol.adoc.hbs @@ -37,7 +37,7 @@ | Description {{#each (filter_by symbol.bases "isPublic")}} | {{#>markup/code}}{{> type/declarator type }}{{/markup/code}} -| {{> javadoc/inline-brief symbol.doc.brief }} +| {{> javadoc/inline-brief type.name.symbol.doc.brief }} {{/each}} |=== @@ -51,7 +51,7 @@ | Description {{#each (filter_by symbol.bases "isProtected")}} | {{#>markup/code}}{{> type/declarator type }}{{/markup/code}} -| {{> javadoc/inline-brief symbol.doc.brief }} +| {{> javadoc/inline-brief type.name.symbol.doc.brief }} {{/each}} |=== diff --git a/share/mrdocs/addons/generator/common/partials/template/arg.hbs b/share/mrdocs/addons/generator/common/partials/template/arg.hbs index 601600679..4b6c55f07 100644 --- a/share/mrdocs/addons/generator/common/partials/template/arg.hbs +++ b/share/mrdocs/addons/generator/common/partials/template/arg.hbs @@ -13,8 +13,8 @@ {{#if (eq kind "type")~}} {{! TArg is a type: render the declarator ~}} {{~>type/declarator type link-components-impl=link-components-impl~}} -{{else if (eq kind "non-type")~}} - {{! TArg is a non-type: render the value string as is ~}} +{{else if (eq kind "constant")~}} + {{! TArg is a constant: render the value string as is ~}} {{~value~}} {{else if (eq kind "template")~}} {{! TArg is another template: render the template head ~}} diff --git a/share/mrdocs/addons/generator/common/partials/template/param-text.hbs b/share/mrdocs/addons/generator/common/partials/template/param-text.hbs index 1f11c5272..458628f27 100644 --- a/share/mrdocs/addons/generator/common/partials/template/param-text.hbs +++ b/share/mrdocs/addons/generator/common/partials/template/param-text.hbs @@ -2,7 +2,7 @@ Renders a template parameter as text. If the template parameter is a type, the templated type name is rendered. - If the template parameter is a non-type, the declarator of the type is rendered. + If the template parameter is a constant, the declarator of the type is rendered. If the template parameter is a template, the template head is rendered. Expected Context: {TParam} diff --git a/share/mrdocs/addons/generator/common/partials/template/param.hbs b/share/mrdocs/addons/generator/common/partials/template/param.hbs index 808e7c533..83178c7a4 100644 --- a/share/mrdocs/addons/generator/common/partials/template/param.hbs +++ b/share/mrdocs/addons/generator/common/partials/template/param.hbs @@ -2,7 +2,7 @@ Renders a template parameter with links to any named components. If the template parameter is a type, the templated type name is rendered. - If the template parameter is a non-type, the declarator of the type is rendered. + If the template parameter is a constant, the declarator of the type is rendered. If the template parameter is a template, the template head is rendered. Expected Context: {TParam} @@ -17,7 +17,7 @@ {{#if is-pack}}{{ str "..." }}{{/if~}} {{#if name}} {{name}}{{/if~}} {{#if default}} = {{>template/arg default link-components-impl=link-components-impl ~}}{{/if~}} -{{else if (eq kind "non-type")~}} +{{else if (eq kind "constant")~}} {{>type/declarator type decl-name=name link-components-impl=link-components-impl }}{{#if is-pack}}{{ str "..." }}{{/if~}} {{#if default}} = {{>template/arg default link-components-impl=link-components-impl~}}{{/if~}} {{else if (eq kind "template")~}} diff --git a/share/mrdocs/addons/generator/html/partials/symbol.html.hbs b/share/mrdocs/addons/generator/html/partials/symbol.html.hbs index 4691fc895..aea81542d 100644 --- a/share/mrdocs/addons/generator/html/partials/symbol.html.hbs +++ b/share/mrdocs/addons/generator/html/partials/symbol.html.hbs @@ -53,7 +53,7 @@
{{#each (filter_by symbol.bases "isPublic")}} - + {{/each}}
{{#>markup/code}}{{> type/declarator type }}{{/markup/code}}{{> javadoc/inline-brief symbol.doc.brief }}
{{#>markup/code}}{{> type/declarator type }}{{/markup/code}}{{> javadoc/inline-brief type.name.symbol.doc.brief }}
@@ -72,7 +72,7 @@ {{#each (filter_by symbol.bases "isProtected")}} -{{#>markup/code}}{{> type/declarator type }}{{/markup/code}}{{> javadoc/inline-brief symbol.doc.brief }} +{{#>markup/code}}{{> type/declarator type }}{{/markup/code}}{{> javadoc/inline-brief type.name.symbol.doc.brief }} {{/each}} diff --git a/src/lib/AST/ASTVisitor.cpp b/src/lib/AST/ASTVisitor.cpp index 24bdd9639..fa19fcb13 100644 --- a/src/lib/AST/ASTVisitor.cpp +++ b/src/lib/AST/ASTVisitor.cpp @@ -881,7 +881,7 @@ populate( param.Name = P->getName(); } - if (!param.Type) + if (param.Type->isAuto()) { param.Type = toTypeInfo(P->getOriginalType()); } @@ -907,7 +907,7 @@ populate( // extract the return type in direct dependency mode // if it contains a placeholder type which is - // deduceded as a local class type + // deduced as a local class type QualType const RT = D->getReturnType(); MRDOCS_SYMBOL_TRACE(RT, context_); I.ReturnType = toTypeInfo(RT); @@ -918,11 +918,11 @@ populate( } else if (I.Requires.Written.empty()) { + MRDOCS_ASSERT(!I.ReturnType.valueless_after_move()); // Return type SFINAE constraints - if (I.ReturnType && - !(*I.ReturnType)->Constraints.empty()) + if (!I.ReturnType->Constraints.empty()) { - for (ExprInfo const& constraint: (*I.ReturnType)->Constraints) + for (ExprInfo const& constraint: I.ReturnType->Constraints) { if (!I.Requires.Written.empty()) { @@ -935,10 +935,10 @@ populate( // Iterate I.Params to find trailing requires clauses for (auto it = I.Params.begin(); it != I.Params.end(); ) { - if (it->Type && - !(*it->Type)->Constraints.empty()) + MRDOCS_ASSERT(!it->Type.valueless_after_move()); + if (!it->Type->Constraints.empty()) { - for (ExprInfo const& constraint: (*it->Type)->Constraints) + for (ExprInfo const& constraint: it->Type->Constraints) { if (!I.Requires.Written.empty()) { @@ -1249,7 +1249,9 @@ populate( { NamedDecl const* Aliased = D->getAliasedNamespace(); NestedNameSpecifier NNS = D->getQualifier(); - I.AliasedSymbol = toNameInfo(Aliased, {}, NNS); + Polymorphic NI = toNameInfo(Aliased, {}, NNS); + MRDOCS_ASSERT(NI->isIdentifier()); + I.AliasedSymbol = std::move(dynamic_cast(*NI)); } void @@ -1344,21 +1346,22 @@ populate( ++it; continue; } - if (auto* T = dynamic_cast(arg.operator->()); - T && - T->Type && - !(*T->Type)->Constraints.empty()) + if (auto* T = dynamic_cast(arg.operator->())) { - for (ExprInfo const& constraint: (*T->Type)->Constraints) + MRDOCS_ASSERT(!T->Type.valueless_after_move()); + if (!T->Type->Constraints.empty()) { - if (!Template.Requires.Written.empty()) + for (ExprInfo const& constraint: T->Type->Constraints) { - Template.Requires.Written += " && "; + if (!Template.Requires.Written.empty()) + { + Template.Requires.Written += " && "; + } + Template.Requires.Written += constraint.Written; } - Template.Requires.Written += constraint.Written; + it = Template.Args.erase(it); + continue; } - it = Template.Args.erase(it); - continue; } ++it; } @@ -1531,9 +1534,9 @@ populate( { if (I.valueless_after_move()) { - I = Polymorphic(std::in_place_type); + I = Polymorphic(std::in_place_type); } - auto* R = dynamic_cast(I.operator->()); + auto* R = dynamic_cast(I.operator->()); R->Type = toTypeInfo(P->getType()); if (P->hasDefaultArgument() && !R->Default) { @@ -1631,42 +1634,46 @@ populate( for (auto it = TI.Params.begin(); it != TI.Params.end(); ) { Polymorphic& param = *it; + MRDOCS_ASSERT(!param.valueless_after_move()); - if (auto const* T = dynamic_cast(param.operator->()); - T && - T->Type && - !(*T->Type)->Constraints.empty()) + if (param->isConstant()) { - for (ExprInfo const& constraint: (*T->Type)->Constraints) + auto& T = dynamic_cast(*param); + MRDOCS_ASSERT(!T.Type.valueless_after_move()); + if (!T.Type->Constraints.empty()) { - if (!TI.Requires.Written.empty()) + for (ExprInfo const& constraint: T.Type->Constraints) { - TI.Requires.Written += " && "; + if (!TI.Requires.Written.empty()) + { + TI.Requires.Written += " && "; + } + TI.Requires.Written += constraint.Written; } - TI.Requires.Written += constraint.Written; + it = TI.Params.erase(it); + continue; } - it = TI.Params.erase(it); - continue; } if (param->Default && (*param->Default)->isType()) { - if (auto const* T = dynamic_cast((*param->Default).operator->()); - T && - T->Type && - !(*T->Type)->Constraints.empty()) + if (auto const* T = dynamic_cast((*param->Default).operator->())) { - for (ExprInfo const& constraint: (*T->Type)->Constraints) + MRDOCS_ASSERT(!T->Type.valueless_after_move()); + if (!T->Type->Constraints.empty()) { - if (!TI.Requires.Written.empty()) + for (ExprInfo const& constraint: T->Type->Constraints) { - TI.Requires.Written += " && "; + if (!TI.Requires.Written.empty()) + { + TI.Requires.Written += " && "; + } + TI.Requires.Written += constraint.Written; } - TI.Requires.Written += constraint.Written; + it = TI.Params.erase(it); + continue; } - it = TI.Params.erase(it); - continue; } } diff --git a/src/lib/AST/ParseRef.cpp b/src/lib/AST/ParseRef.cpp index 8469da98a..1d161e551 100644 --- a/src/lib/AST/ParseRef.cpp +++ b/src/lib/AST/ParseRef.cpp @@ -832,11 +832,12 @@ class RefParser // https://en.cppreference.com/w/cpp/language/function#Function_type if (curParam->isArray()) { - auto ATI = dynamic_cast(*curParam); + ArrayTypeInfo PrevParamType = dynamic_cast(*curParam); curParam = Polymorphic(std::in_place_type); - *curParam = ATI; - static_cast(*curParam).PointeeType = - std::move(ATI.ElementType); + auto& curAsPointerType = dynamic_cast(*curParam); + curAsPointerType.PointeeType = std::move(PrevParamType.ElementType); + auto& PrevAsBase = dynamic_cast(PrevParamType); + *curParam = std::move(PrevAsBase); } // 3. After producing the list of parameter types, any top-level diff --git a/src/lib/AST/TypeInfoBuilder.cpp b/src/lib/AST/TypeInfoBuilder.cpp index 39c173518..cfb636916 100644 --- a/src/lib/AST/TypeInfoBuilder.cpp +++ b/src/lib/AST/TypeInfoBuilder.cpp @@ -19,8 +19,9 @@ void TypeInfoBuilder:: buildPointer(PointerType const*, unsigned quals) { + MRDOCS_ASSERT(Inner); *Inner = Polymorphic(std::in_place_type); - auto &I = dynamic_cast(***Inner); + auto &I = dynamic_cast(**Inner); I.IsConst = quals & Qualifiers::Const; I.IsVolatile = quals & Qualifiers::Volatile; Inner = &I.PointeeType; @@ -30,16 +31,18 @@ void TypeInfoBuilder:: buildLValueReference(LValueReferenceType const*) { + MRDOCS_ASSERT(Inner); *Inner = Polymorphic(std::in_place_type); - Inner = &dynamic_cast(***Inner).PointeeType; + Inner = &dynamic_cast(**Inner).PointeeType; } void TypeInfoBuilder:: buildRValueReference(RValueReferenceType const*) { + MRDOCS_ASSERT(Inner); *Inner = Polymorphic(std::in_place_type); - Inner = &dynamic_cast(***Inner).PointeeType; + Inner = &dynamic_cast(**Inner).PointeeType; } void @@ -48,8 +51,9 @@ buildMemberPointer( MemberPointerType const* T, unsigned const quals) { + MRDOCS_ASSERT(Inner); *Inner = Polymorphic(std::in_place_type); - auto &I = dynamic_cast(***Inner); + auto &I = dynamic_cast(**Inner); I.IsConst = quals & Qualifiers::Const; I.IsVolatile = quals & Qualifiers::Volatile; // do not set NNS because the parent type is *not* @@ -63,8 +67,9 @@ void TypeInfoBuilder:: buildArray(ArrayType const* T) { + MRDOCS_ASSERT(Inner); *Inner = Polymorphic(std::in_place_type); - auto &I = dynamic_cast(***Inner); + auto &I = dynamic_cast(**Inner); if (auto* CAT = dyn_cast(T)) { getASTVisitor().populate(I.Bounds, CAT->getSizeExpr(), CAT->getSize()); @@ -81,8 +86,9 @@ TypeInfoBuilder:: populate(FunctionType const* T) { auto* FPT = cast(T); + MRDOCS_ASSERT(Inner); *Inner = Polymorphic(std::in_place_type); - auto &I = dynamic_cast(***Inner); + auto &I = dynamic_cast(**Inner); for (QualType const PT : FPT->getParamTypes()) { I.ParamTypes.emplace_back(getASTVisitor().toTypeInfo(PT)); @@ -104,17 +110,18 @@ buildDecltype( unsigned quals, bool pack) { + MRDOCS_ASSERT(Inner); *Inner = Polymorphic(std::in_place_type); - (**Inner)->Constraints = this->Constraints; - (**Inner)->IsPackExpansion = pack; + (*Inner)->Constraints = this->Constraints; + (*Inner)->IsPackExpansion = pack; - auto &I = dynamic_cast(***Inner); + auto &I = dynamic_cast(**Inner); getASTVisitor().populate(I.Operand, T->getUnderlyingExpr()); I.IsConst = quals & Qualifiers::Const; I.IsVolatile = quals & Qualifiers::Volatile; - (*Result)->Constraints = this->Constraints; - (*Result)->IsPackExpansion = pack; + Result->Constraints = this->Constraints; + Result->IsPackExpansion = pack; } void @@ -124,11 +131,12 @@ buildAuto( unsigned const quals, bool const pack) { + MRDOCS_ASSERT(Inner); *Inner = Polymorphic(std::in_place_type); - (**Inner)->Constraints = this->Constraints; - (**Inner)->IsPackExpansion = pack; + (*Inner)->Constraints = this->Constraints; + (*Inner)->IsPackExpansion = pack; - auto &I = dynamic_cast(***Inner); + auto &I = dynamic_cast(**Inner); I.IsConst = quals & Qualifiers::Const; I.IsVolatile = quals & Qualifiers::Volatile; I.Keyword = toAutoKind(T->getKeyword()); @@ -145,8 +153,8 @@ buildAuto( // Constraint->Prefix = getASTVisitor().buildNameInfo( // cast(CD->getDeclContext())); } - (*Result)->Constraints = this->Constraints; - (*Result)->IsPackExpansion = pack; + Result->Constraints = this->Constraints; + Result->IsPackExpansion = pack; } void @@ -157,11 +165,12 @@ buildTerminal( bool pack) { MRDOCS_SYMBOL_TRACE(T, getASTVisitor().context_); + MRDOCS_ASSERT(Inner); *Inner = Polymorphic(std::in_place_type); - (**Inner)->IsPackExpansion = pack; - (**Inner)->Constraints = this->Constraints; + (*Inner)->IsPackExpansion = pack; + (*Inner)->Constraints = this->Constraints; - auto &TI = dynamic_cast(***Inner); + auto &TI = dynamic_cast(**Inner); TI.IsConst = quals & Qualifiers::Const; TI.IsVolatile = quals & Qualifiers::Volatile; TI.Name = Polymorphic(std::in_place_type); @@ -171,8 +180,8 @@ buildTerminal( auto const* FT = cast(T); TI.FundamentalType = toFundamentalTypeKind(FT->getKind()); } - (*Result)->Constraints = this->Constraints; - (*Result)->IsPackExpansion = pack; + Result->Constraints = this->Constraints; + Result->IsPackExpansion = pack; } void @@ -184,11 +193,12 @@ buildTerminal( unsigned quals, bool pack) { + MRDOCS_ASSERT(Inner); *Inner = Polymorphic(std::in_place_type); - (**Inner)->IsPackExpansion = pack; - (**Inner)->Constraints = this->Constraints; + (*Inner)->IsPackExpansion = pack; + (*Inner)->Constraints = this->Constraints; - auto &I = dynamic_cast(***Inner); + auto &I = dynamic_cast(**Inner); I.IsConst = quals & Qualifiers::Const; I.IsVolatile = quals & Qualifiers::Volatile; @@ -213,8 +223,8 @@ buildTerminal( } Name.Prefix = getASTVisitor().toNameInfo(NNS); } - (*Result)->Constraints = this->Constraints; - (*Result)->IsPackExpansion = pack; + Result->Constraints = this->Constraints; + Result->IsPackExpansion = pack; } void @@ -235,11 +245,12 @@ buildTerminal( Decl const* ID = decayToPrimaryTemplate(D); MRDOCS_SYMBOL_TRACE(ID, getASTVisitor().context_); + MRDOCS_ASSERT(Inner); *Inner = Polymorphic(std::in_place_type); - (**Inner)->IsPackExpansion = pack; - (**Inner)->Constraints = this->Constraints; + (*Inner)->IsPackExpansion = pack; + (*Inner)->Constraints = this->Constraints; - auto &TI = dynamic_cast(***Inner); + auto &TI = dynamic_cast(**Inner); TI.IsConst = quals & Qualifiers::Const; TI.IsVolatile = quals & Qualifiers::Volatile; @@ -272,8 +283,8 @@ buildTerminal( populateNameInfo(Name, D); getASTVisitor().populate(Name.TemplateArgs, *TArgs); } - (*Result)->Constraints = this->Constraints; - (*Result)->IsPackExpansion = pack; + Result->Constraints = this->Constraints; + Result->IsPackExpansion = pack; } } // clang::mrdocs diff --git a/src/lib/AST/TypeInfoBuilder.hpp b/src/lib/AST/TypeInfoBuilder.hpp index 361ce04e9..92fbdda33 100644 --- a/src/lib/AST/TypeInfoBuilder.hpp +++ b/src/lib/AST/TypeInfoBuilder.hpp @@ -40,7 +40,7 @@ class TypeInfoBuilder as a polymorphic `TypeInfo` object. */ - Optional> Result = std::nullopt; + Polymorphic Result = Polymorphic(AutoTypeInfo{}); /* A pointer to the inner type of result currently being populated. @@ -61,7 +61,7 @@ class TypeInfoBuilder `NamedTypeInfo` object, and the visiting process continues populating the `Inner` object. */ - Optional>* Inner = &Result; + Polymorphic* Inner = &Result; public: using TerminalTypeVisitor::TerminalTypeVisitor; @@ -76,15 +76,7 @@ class TypeInfoBuilder Polymorphic result() { - MRDOCS_ASSERT(hasResult()); - return std::move(*Result); - } - - constexpr - bool - hasResult() const noexcept - { - return Result.has_value(); + return std::move(Result); } /** Build type information for a pointer type. diff --git a/src/lib/CorpusImpl.cpp b/src/lib/CorpusImpl.cpp index 6b947fb97..f7dd6d079 100644 --- a/src/lib/CorpusImpl.cpp +++ b/src/lib/CorpusImpl.cpp @@ -365,7 +365,7 @@ isDecayedEqual( static_cast(*rhs).Type, context, corpus); } - if (lhs->isNonType()) + if (lhs->isConstant()) { return trim(static_cast(*lhs).Value.Written) == trim(static_cast(*rhs).Value.Written); @@ -502,8 +502,8 @@ lookupImpl( if (auto* TI = contextPtr->asTypedefPtr()) { MRDOCS_CHECK_OR(TI->Type, nullptr); - MRDOCS_ASSERT(!TI->Type->valueless_after_move()); - SymbolID resolvedSymbolID = (*TI->Type)->namedSymbol(); + MRDOCS_ASSERT(!TI->Type.valueless_after_move()); + SymbolID resolvedSymbolID = (*TI->Type).namedSymbol(); contextPtr = this->find(resolvedSymbolID); MRDOCS_CHECK_OR(contextPtr, nullptr); } @@ -652,9 +652,8 @@ lookupImpl( MRDOCS_CHECK_OR(F.IsExplicitObjectMemberFunction == ref.IsExplicitObjectMemberFunction, matchRes); for (std::size_t i = 0; i < F.Params.size(); ++i) { - auto& lhsTypeOpt = F.Params[i].Type; - MRDOCS_CHECK_OR(lhsTypeOpt, matchRes); - auto& lhsType = *lhsTypeOpt; + Polymorphic const& lhsType = F.Params[i].Type; + MRDOCS_ASSERT(!lhsType.valueless_after_move()); auto& rhsType = ref.FunctionParameters[i]; MRDOCS_CHECK_OR(isDecayedEqual(lhsType, rhsType, context, *this), matchRes); } @@ -680,7 +679,7 @@ lookupImpl( { res = &member; matchLevel = memberMatchLevel; - // Early exit if the matchMatchLevel is the highest possible + // Early exit if the match level is the highest possible // for the component and the parsed reference if (matchLevel >= highestMatchLevel) { diff --git a/src/lib/Gen/hbs/TagfileWriter.cpp b/src/lib/Gen/hbs/TagfileWriter.cpp index 01c8519b9..060bce1d1 100644 --- a/src/lib/Gen/hbs/TagfileWriter.cpp +++ b/src/lib/Gen/hbs/TagfileWriter.cpp @@ -200,11 +200,8 @@ TagfileWriter:: writeFunctionMember(FunctionInfo const& I) { tags_.open("member", {{"kind", "function"}}); - if (I.ReturnType) - { - MRDOCS_ASSERT(!I.ReturnType->valueless_after_move()); - tags_.write("type", toString(**I.ReturnType)); - } + MRDOCS_ASSERT(!I.ReturnType.valueless_after_move()); + tags_.write("type", toString(*I.ReturnType)); tags_.write("name", I.Name); auto [anchorFile, anchor] = generateFileAndAnchor(I); tags_.write("anchorfile", anchorFile); @@ -212,16 +209,11 @@ writeFunctionMember(FunctionInfo const& I) std::string arglist = "("; for(auto const& J : I.Params) { - if (J.Type) - { - arglist += toString(**J.Type); - if (J.Name) - { - arglist += " "; - } - } + MRDOCS_ASSERT(!J.Type.valueless_after_move()); + arglist += toString(*J.Type); if (J.Name) { + arglist += " "; arglist += *J.Name; } arglist += ", "; diff --git a/src/lib/Gen/hbs/VisitorHelpers.cpp b/src/lib/Gen/hbs/VisitorHelpers.cpp index af18610cf..beeda7e9c 100644 --- a/src/lib/Gen/hbs/VisitorHelpers.cpp +++ b/src/lib/Gen/hbs/VisitorHelpers.cpp @@ -51,10 +51,10 @@ resolveTypedef(Corpus const& c, Info const& I) { auto const& TI = I.asTypedef(); MRDOCS_CHECK_OR(TI.Type, &I); - MRDOCS_ASSERT(!TI.Type->valueless_after_move()); - Polymorphic const& T = *TI.Type; - MRDOCS_CHECK_OR(!T.valueless_after_move() && T->Kind == TypeKind::Named, &I); - auto const& NT = dynamic_cast(*T); + MRDOCS_ASSERT(!TI.Type.valueless_after_move()); + TypeInfo const& T = *TI.Type; + MRDOCS_CHECK_OR(T.Kind == TypeKind::Named, &I); + auto const& NT = dynamic_cast(T); MRDOCS_CHECK_OR(NT.Name, &I); Info const* resolved = c.find(NT.Name->id); MRDOCS_CHECK_OR(resolved, &I); @@ -171,11 +171,10 @@ findResolvedPrimarySiblingWithUrl(Corpus const& c, Info const& I) if constexpr (std::same_as) { auto const& TOpt = U.Type; - MRDOCS_CHECK_OR(TOpt, false); - Polymorphic const& T = *TOpt; - MRDOCS_CHECK_OR(!T.valueless_after_move(), false); - MRDOCS_CHECK_OR(T->Kind == TypeKind::Named, false); - auto const& NT = dynamic_cast(*T); + MRDOCS_CHECK_OR(!TOpt.valueless_after_move(), false); + TypeInfo const& T = *TOpt; + MRDOCS_CHECK_OR(T.Kind == TypeKind::Named, false); + auto const& NT = dynamic_cast(T); MRDOCS_CHECK_OR(NT.Name, false); MRDOCS_CHECK_OR(NT.Name->Kind == NameKind::Specialization, false); return true; diff --git a/src/lib/Gen/xml/CXXTags.hpp b/src/lib/Gen/xml/CXXTags.hpp index 28eb954e9..4799d9866 100644 --- a/src/lib/Gen/xml/CXXTags.hpp +++ b/src/lib/Gen/xml/CXXTags.hpp @@ -126,8 +126,7 @@ writeType( XMLTags& tags, std::string_view type_tag = "type") { - visit(I, [&]( - T const& t) + visit(I, [&](T const& t) { Attributes attrs = { { "class", toString(T::kind_id), @@ -135,14 +134,11 @@ writeType( { "is-pack", "1", t.IsPackExpansion } }; - // KRYSTIAN FIXME: parent should is a type itself + // KRYSTIAN FIXME: parent should be a type itself if constexpr(requires { t.ParentType; }) { - if (t.ParentType) - { - MRDOCS_ASSERT(!t.ParentType->valueless_after_move()); - attrs.push({ "parent", toString(**t.ParentType) }); - } + MRDOCS_ASSERT(!t.ParentType.valueless_after_move()); + attrs.push({ "parent", toString(*t.ParentType) }); } if constexpr(T::isNamed()) @@ -223,42 +219,51 @@ writeType( if constexpr(requires { t.PointeeType; }) { - Optional> pointee = t.PointeeType; - if (pointee) - { - MRDOCS_ASSERT(!pointee->valueless_after_move()); - writeType(**t.PointeeType, tags, "pointee-type"); - } + Polymorphic const& pointee = t.PointeeType; + MRDOCS_ASSERT(!pointee.valueless_after_move()); + writeType(*t.PointeeType, tags, "pointee-type"); } if constexpr(T::isArray()) { ArrayTypeInfo const& at = t; - if (at.ElementType) - { - MRDOCS_ASSERT(!at.ElementType->valueless_after_move()); - writeType(**t.ElementType, tags, "element-type"); - } + MRDOCS_ASSERT(!at.ElementType.valueless_after_move()); + writeType(*t.ElementType, tags, "element-type"); } if constexpr(T::isFunction()) { FunctionTypeInfo const& ft = t; - if (ft.ReturnType) + MRDOCS_ASSERT(!ft.ReturnType.valueless_after_move()); + writeType(*t.ReturnType, tags, "return-type"); + for (auto const& p: t.ParamTypes) { - MRDOCS_ASSERT(!ft.ReturnType->valueless_after_move()); - writeType(**t.ReturnType, tags, "return-type"); - for (auto const& p: t.ParamTypes) - { - writeType(*p, tags, "param-type"); - } + writeType(*p, tags, "param-type"); } } - tags.close(type_tag); }); } + +inline +void +writeType( + NameInfo const& I, + XMLTags& tags, + std::string_view type_tag = "type") +{ + Attributes attrs = { + { "class", toString(TypeKind::Named), false }, + { "is-pack", "1", false } + }; + + attrs.push({I.id}); + attrs.push({"name", I.Name}); + + tags.write(type_tag, {}, std::move(attrs)); +} + inline void writeType( @@ -316,14 +321,11 @@ inline void writeTemplateParam(TParam const& I, XMLTags& tags) { "class", toString(T::kind_id) } }; - if constexpr (T::isNonType()) + if constexpr (T::isConstant()) { - NonTypeTParam const& nt = P; - if (nt.Type) - { - MRDOCS_ASSERT(!nt.Type->valueless_after_move()); - attrs.push({ "type", toString(**nt.Type) }); - } + ConstantTParam const& nt = P; + MRDOCS_ASSERT(!nt.Type.valueless_after_move()); + attrs.push({ "type", toString(*nt.Type) }); } if (tp.Default) @@ -357,13 +359,10 @@ inline void writeTemplateArg(TArg const& I, XMLTags& tags) if constexpr (T::isType()) { TypeTArg const& at = A; - if (at.Type) - { - MRDOCS_ASSERT(!at.Type->valueless_after_move()); - attrs.push({ "type", toString(**A.Type) }); - } + MRDOCS_ASSERT(!at.Type.valueless_after_move()); + attrs.push({ "type", toString(*A.Type) }); } - if constexpr (T::isNonType()) + if constexpr (T::isConstant()) { attrs.push({ "value", A.Value.Written }); } diff --git a/src/lib/Gen/xml/XMLTags.hpp b/src/lib/Gen/xml/XMLTags.hpp index 450b726d9..2cd35bf82 100644 --- a/src/lib/Gen/xml/XMLTags.hpp +++ b/src/lib/Gen/xml/XMLTags.hpp @@ -113,7 +113,7 @@ struct Attribute //------------------------------------------------ -/** An vector of zero or more XML attributes. +/** A vector of zero or more XML attributes. */ struct Attributes { diff --git a/src/lib/Gen/xml/XMLWriter.cpp b/src/lib/Gen/xml/XMLWriter.cpp index 06a92ba35..a4af395e9 100644 --- a/src/lib/Gen/xml/XMLWriter.cpp +++ b/src/lib/Gen/xml/XMLWriter.cpp @@ -251,10 +251,8 @@ writeFunction( writeAttr(I.IsNodiscard, "nodiscard", tags_); writeAttr(I.IsExplicitObjectMemberFunction, "is-explicit-object-member-function", tags_); - if (I.ReturnType) - { - writeReturnType(**I.ReturnType, tags_); - } + MRDOCS_ASSERT(!I.ReturnType.valueless_after_move()); + writeReturnType(*I.ReturnType, tags_); for (auto const& J: I.Params) { @@ -350,13 +348,10 @@ writeNamespaceAlias( writeJavadoc(I.javadoc); - if (I.AliasedSymbol) - { - tags_.write("aliased", {}, { - {"name", toString(**I.AliasedSymbol)}, - { (*I.AliasedSymbol)->id } - }); - } + tags_.write("aliased", {}, { + {"name", toString(I.AliasedSymbol)}, + { I.AliasedSymbol.id } + }); tags_.close(namespaceAliasTagName); } @@ -431,7 +426,7 @@ writeRecord( { B.Access }, { "class", "virtual", B.IsVirtual }, }); - writeType(B.Type, tags_); + writeType(*B.Type, tags_); tags_.close(baseTagName); } diff --git a/src/lib/Gen/xml/XMLWriter.hpp b/src/lib/Gen/xml/XMLWriter.hpp index b165c7ac3..9af8ed3d0 100644 --- a/src/lib/Gen/xml/XMLWriter.hpp +++ b/src/lib/Gen/xml/XMLWriter.hpp @@ -23,7 +23,7 @@ namespace clang::mrdocs::xml { class jit_indenter; -/** A writer which outputs XML. +/** A writer that outputs XML. */ class XMLWriter { diff --git a/src/lib/Metadata/Finalizers/BaseMembersFinalizer.cpp b/src/lib/Metadata/Finalizers/BaseMembersFinalizer.cpp index ad214cf13..d52af11e4 100644 --- a/src/lib/Metadata/Finalizers/BaseMembersFinalizer.cpp +++ b/src/lib/Metadata/Finalizers/BaseMembersFinalizer.cpp @@ -227,20 +227,17 @@ operator()(RecordInfo& I) MRDOCS_CHECK_OR(!finalized_.contains(I.id)); for (BaseInfo const& baseI: I.Bases) { - auto const *baseNameType = - dynamic_cast(&**baseI.Type); - MRDOCS_CHECK_OR_CONTINUE(baseNameType); - auto const *baseName = - dynamic_cast(&*baseNameType->Name); - MRDOCS_CHECK_OR_CONTINUE(baseName); - SymbolID baseID = baseName->id; + MRDOCS_ASSERT(!baseI.Type.valueless_after_move()); + MRDOCS_CHECK_OR_CONTINUE(baseI.Type->isNamed()); + auto& baseNameType = dynamic_cast(*baseI.Type); + MRDOCS_ASSERT(!baseNameType.Name.valueless_after_move()); + auto& baseName = dynamic_cast(*baseNameType.Name); + SymbolID baseID = baseName.id; if (corpus_.config->extractImplicitSpecializations && - baseName->isSpecialization()) + baseName.isSpecialization()) { - auto const *baseSpec = - dynamic_cast(baseName); - MRDOCS_CHECK_OR_CONTINUE(baseSpec); - baseID = baseSpec->specializationID; + auto& baseSpec = dynamic_cast(baseName); + baseID = baseSpec.specializationID; } MRDOCS_CHECK_OR_CONTINUE(baseID); auto basePtr = corpus_.find(baseID); diff --git a/src/lib/Metadata/Finalizers/DerivedFinalizer.cpp b/src/lib/Metadata/Finalizers/DerivedFinalizer.cpp index 31daac914..63ab1f9c6 100644 --- a/src/lib/Metadata/Finalizers/DerivedFinalizer.cpp +++ b/src/lib/Metadata/Finalizers/DerivedFinalizer.cpp @@ -30,9 +30,9 @@ build() { MRDOCS_CHECK_OR_CONTINUE(base.Access == AccessKind::Public); MRDOCS_CHECK_OR_CONTINUE(base.Type); - MRDOCS_ASSERT(!base.Type->valueless_after_move()); - MRDOCS_CHECK_OR_CONTINUE((*base.Type)->isNamed()); - auto& namedType = dynamic_cast(**base.Type); + MRDOCS_ASSERT(!base.Type.valueless_after_move()); + MRDOCS_CHECK_OR_CONTINUE(base.Type->isNamed()); + auto& namedType = dynamic_cast(*base.Type); MRDOCS_CHECK_OR_CONTINUE(namedType.Name); SymbolID const namedSymbolID = namedType.Name->id; MRDOCS_CHECK_OR_CONTINUE(namedSymbolID != SymbolID::invalid); diff --git a/src/lib/Metadata/Finalizers/Javadoc/Function.hpp b/src/lib/Metadata/Finalizers/Javadoc/Function.hpp index bd301d7c6..0415292b1 100644 --- a/src/lib/Metadata/Finalizers/Javadoc/Function.hpp +++ b/src/lib/Metadata/Finalizers/Javadoc/Function.hpp @@ -47,10 +47,8 @@ isCopyOrMoveConstructorOrAssignment(FunctionInfo const& I) } MRDOCS_CHECK_OR(I.Params.size() == 1, false); auto const& param = I.Params[0]; - auto const& paramTypeOpt = param.Type; - MRDOCS_CHECK_OR(paramTypeOpt, false); - auto const& paramType = *paramTypeOpt; - MRDOCS_CHECK_OR(!paramType.valueless_after_move(), false); + Polymorphic const& paramType = param.Type; + MRDOCS_ASSERT(!paramType.valueless_after_move()); if constexpr (!move) { MRDOCS_CHECK_OR(paramType->isLValueReference(), false); @@ -63,12 +61,9 @@ isCopyOrMoveConstructorOrAssignment(FunctionInfo const& I) auto const& paramRefType = static_cast(*paramType); auto const& paramRefPointeeOpt = paramRefType.PointeeType; MRDOCS_CHECK_OR(paramRefPointeeOpt, false); - auto const& paramRefPointee = *paramRefPointeeOpt; - MRDOCS_CHECK_OR(!paramRefPointee.valueless_after_move(), false); - auto const *paramRefPointeeNamed = - static_cast(&*paramRefPointee); - if (!paramRefPointeeNamed) - return false; + TypeInfo const& paramRefPointee = *paramRefPointeeOpt; + auto const *paramRefPointeeNamed = dynamic_cast(¶mRefPointee); + MRDOCS_CHECK_OR(paramRefPointeeNamed, false); MRDOCS_CHECK_OR(paramRefPointeeNamed->Name, false); auto const& paramName = paramRefPointeeNamed->Name; MRDOCS_CHECK_OR(paramName, false); @@ -108,19 +103,19 @@ innermostTypenameString(Polymorphic const& T) { auto& R = innermostType(T); MRDOCS_CHECK_OR(R->isNamed(), {}); - MRDOCS_CHECK_OR(static_cast(*R).Name, {}); - MRDOCS_CHECK_OR(!static_cast(*R).Name->Name.empty(), + MRDOCS_CHECK_OR(dynamic_cast(*R).Name, {}); + MRDOCS_CHECK_OR(!dynamic_cast(*R).Name->Name.empty(), {}); - auto& RStr = static_cast(*R).Name->Name; + auto& RStr = dynamic_cast(*R).Name->Name; return RStr; } -Optional -innermostTypenameString(Optional> const& T) -{ - MRDOCS_CHECK_OR(T, {}); - return innermostTypenameString(*T); -} +//Optional +//innermostTypenameString(Optional> const& T) +//{ +// MRDOCS_CHECK_OR(T, {}); +// return innermostTypenameString(*T); +//} bool populateFunctionBriefFromClass(FunctionInfo& I, CorpusImpl const& corpus) @@ -204,19 +199,18 @@ isStreamInsertion(FunctionInfo const& function) MRDOCS_CHECK_OR(!function.IsRecordMethod, false); MRDOCS_CHECK_OR(function.Params.size() == 2, false); MRDOCS_CHECK_OR(function.OverloadedOperator == OperatorKind::LessLess, false); - // Check first param is mutable left reference + // Check first param is a mutable left reference auto& firstParam = function.Params[0]; MRDOCS_CHECK_OR(firstParam, false); - auto& firstQualTypeOpt = firstParam.Type; - MRDOCS_CHECK_OR(firstQualTypeOpt, false); - auto& firstQualType = *firstQualTypeOpt; + Polymorphic const& firstQualType = firstParam.Type; + MRDOCS_ASSERT(!firstQualType.valueless_after_move()); MRDOCS_CHECK_OR(firstQualType->isLValueReference(), false); auto& firstNamedTypeOpt = - static_cast(*firstQualType) + dynamic_cast(*firstQualType) .PointeeType; MRDOCS_CHECK_OR(firstNamedTypeOpt, false); auto& firstNamedType = *firstNamedTypeOpt; - MRDOCS_CHECK_OR(firstNamedType->isNamed(), false); + MRDOCS_CHECK_OR(firstNamedType.isNamed(), false); // Check return type return firstQualType == function.ReturnType; } @@ -356,8 +350,8 @@ populateFunctionReturnsForSpecial( } // Special functions that should return a reference to self - if (I.ReturnType && - (*I.ReturnType)->isLValueReference()) + MRDOCS_ASSERT(!I.ReturnType.valueless_after_move()); + if (I.ReturnType->isLValueReference()) { Info const* RInfo = getInfo(innerR, corpus); MRDOCS_CHECK_OR(RInfo, false); @@ -365,10 +359,7 @@ populateFunctionReturnsForSpecial( I.javadoc->returns.emplace_back("Reference to the current object"); return true; } - - // Special functions that should return a pointer to self - if (I.ReturnType && - (*I.ReturnType)->isPointer()) + else if (I.ReturnType->isPointer()) { Info const* RInfo = getInfo(innerR, corpus); MRDOCS_CHECK_OR(RInfo, false); @@ -389,10 +380,9 @@ populateFunctionReturnsForSpecial( OperatorKind::Exclaim })) { MRDOCS_CHECK_OR(I.ReturnType, false); - MRDOCS_CHECK_OR((*I.ReturnType)->isNamed(), false); - MRDOCS_ASSERT(!I.ReturnType->valueless_after_move()); + MRDOCS_CHECK_OR(I.ReturnType->isNamed(), false); MRDOCS_CHECK_OR( - static_cast(**I.ReturnType).FundamentalType == + dynamic_cast(*I.ReturnType).FundamentalType == FundamentalTypeKind::Bool, false); doc::Returns r; @@ -448,22 +438,22 @@ populateFunctionReturnsForSpecial( if (I.IsRecordMethod && !innerR.valueless_after_move() && innerR->isNamed() && - !static_cast(*innerR).Name.valueless_after_move() && - static_cast(*innerR).Name->id && - static_cast(*innerR).Name->id == I.Parent) + !dynamic_cast(*innerR).Name.valueless_after_move() && + dynamic_cast(*innerR).Name->id && + dynamic_cast(*innerR).Name->id == I.Parent) { MRDOCS_CHECK_OR(I.ReturnType, false); - MRDOCS_ASSERT(!I.ReturnType->valueless_after_move()); - if ((*I.ReturnType)->isLValueReference()) + MRDOCS_ASSERT(!I.ReturnType.valueless_after_move()); + if (I.ReturnType->isLValueReference()) { I.javadoc->returns.emplace_back("Reference to the current object"); } - else if ((*I.ReturnType)->isRValueReference()) + else if (I.ReturnType->isRValueReference()) { I.javadoc->returns.emplace_back( "Rvalue reference to the current object"); } - else if ((*I.ReturnType)->isPointer()) + else if (I.ReturnType->isPointer()) { I.javadoc->returns.emplace_back("Pointer to the current object"); } @@ -502,12 +492,12 @@ populateFunctionReturns(FunctionInfo& I, CorpusImpl const& corpus) // Check if we have a named return type MRDOCS_CHECK_OR(I.ReturnType); - MRDOCS_CHECK_OR(!I.ReturnType->valueless_after_move()); - auto& inner = innermostType(*I.ReturnType); + MRDOCS_CHECK_OR(!I.ReturnType.valueless_after_move()); + auto& inner = innermostType(I.ReturnType); MRDOCS_CHECK_OR(inner); if (inner->isNamed()) { - auto& Ninner = static_cast(*inner); + auto& Ninner = dynamic_cast(*inner); MRDOCS_CHECK_OR(Ninner.Name); MRDOCS_CHECK_OR(!Ninner.Name->Name.empty()); MRDOCS_CHECK_OR(Ninner.FundamentalType != FundamentalTypeKind::Void); @@ -564,8 +554,8 @@ setCntrOrAssignParamName( return *p.Name; }); MRDOCS_CHECK_OR(param.Type, false); - MRDOCS_ASSERT(!param.Type->valueless_after_move()); - auto& innerP = innermostType(*param.Type); + MRDOCS_ASSERT(!param.Type.valueless_after_move()); + Polymorphic& innerP = innermostType(param.Type); std::string_view paramName = "value"; if (innerP->namedSymbol() == I.Parent) { @@ -676,30 +666,27 @@ setCntrOrAssignParamDoc( // Set the parameter description if we can MRDOCS_CHECK_OR(param, false); MRDOCS_CHECK_OR(param.Type, false); - MRDOCS_ASSERT(!param.Type->valueless_after_move()); - auto& innerParam = innermostType(*param.Type); + MRDOCS_ASSERT(!param.Type.valueless_after_move()); + auto& innerParam = innermostType(param.Type); MRDOCS_CHECK_OR(innerParam, false); MRDOCS_CHECK_OR(innerParam->isNamed(), false); std::string_view const paramNoun - = static_cast(*innerParam).FundamentalType ? "value" + = dynamic_cast(*innerParam).FundamentalType ? "value" : "object"; std::string_view const functionVerb = [&]() { bool const isAssign = I.OverloadedOperator == OperatorKind::Equal; - if (static_cast(*innerParam).FundamentalType) + if (dynamic_cast(*innerParam).FundamentalType) { return !isAssign ? "construct" : "assign"; } - if (param.Type) + MRDOCS_ASSERT(!param.Type.valueless_after_move()); + if (param.Type->isLValueReference()) { - MRDOCS_ASSERT(!param.Type->valueless_after_move()); - if ((*param.Type)->isLValueReference()) - { - return !isAssign ? "copy construct" : "copy assign"; - } - if ((*param.Type)->isRValueReference()) - { - return !isAssign ? "move construct" : "move assign"; - } + return !isAssign ? "copy construct" : "copy assign"; + } + if (param.Type->isRValueReference()) + { + return !isAssign ? "move construct" : "move assign"; } return !isAssign ? "construct" : "assign"; }(); @@ -789,9 +776,8 @@ setFunctionParamDoc( // param is a named parameter: use the brief of the type // as a description for the parameter - MRDOCS_CHECK_OR(param.Type); - MRDOCS_ASSERT(!param.Type->valueless_after_move()); - auto const& innerParam = innermostType(*param.Type); + MRDOCS_ASSERT(!param.Type.valueless_after_move()); + auto const& innerParam = innermostType(param.Type); doc::Brief const* paramBrief = getInfoBrief(innerParam, corpus); MRDOCS_CHECK_OR(paramBrief); I.javadoc->params.emplace_back(*param.Name, *paramBrief); diff --git a/src/lib/Metadata/Finalizers/JavadocFinalizer.cpp b/src/lib/Metadata/Finalizers/JavadocFinalizer.cpp index 67dc1bfad..90970d597 100644 --- a/src/lib/Metadata/Finalizers/JavadocFinalizer.cpp +++ b/src/lib/Metadata/Finalizers/JavadocFinalizer.cpp @@ -12,9 +12,10 @@ #include #include #include +#include #include -#include #include +#include #include #include @@ -440,9 +441,8 @@ finalizeMetadataCopies(Info& I) // Copy exceptions only if destination exceptions are empty // and the destination is not noexcept bool const destIsNoExcept = - I.isFunction() ? - I.asFunction().Noexcept.Kind == NoexceptKind::False : - false; + I.isFunction() && + I.asFunction().Noexcept.Kind == NoexceptKind::False; if (destJavadoc.exceptions.empty() && !destIsNoExcept) { @@ -720,10 +720,8 @@ finalizeInfoData(InfoTy& I) } if constexpr (requires { I.ReturnType; }) { - if (I.ReturnType) - { - finalize(**I.ReturnType); - } + MRDOCS_ASSERT(!I.ReturnType.valueless_after_move()); + finalize(*I.ReturnType); } if constexpr (requires { I.Params; }) { @@ -731,9 +729,23 @@ finalizeInfoData(InfoTy& I) } if constexpr (requires { I.Type; }) { - if (I.Type) + if constexpr (detail::isOptionalV) { - finalize(**I.Type); + if (I.Type) + { + finalize(**I.Type); + } + } + else if constexpr (detail::IsPolymorphic) + { + if (!I.Type.valueless_after_move()) + { + finalize(*I.Type); + } + } + else if (I.Type) + { + finalize(*I.Type); } } if constexpr (requires { I.UnderlyingType; }) @@ -753,10 +765,7 @@ finalizeInfoData(InfoTy& I) } if constexpr (requires { I.AliasedSymbol; }) { - if (I.AliasedSymbol) - { - finalize(**I.AliasedSymbol); - } + finalize(I.AliasedSymbol); } if constexpr (requires { I.IntroducedName; }) { @@ -771,10 +780,7 @@ finalizeInfoData(InfoTy& I) } if constexpr (requires { I.Deduced; }) { - if (I.Deduced) - { - finalize(**I.Deduced); - } + finalize(*I.Deduced); } } @@ -1265,7 +1271,7 @@ setAutoRelates() // 1) Inner type of the first parameter [&] { MRDOCS_CHECK_OR(!I.Params.empty()); - auto* firstParamInfo = toRecordOrEnum(*I.Params.front().Type); + auto* firstParamInfo = toRecordOrEnum(I.Params.front().Type); MRDOCS_CHECK_OR(firstParamInfo); if (firstParamInfo->Extraction == ExtractionMode::Regular) { @@ -1276,15 +1282,15 @@ setAutoRelates() MRDOCS_CHECK_OR(firstParamInfo->isRecord()); auto const* firstParamRecord = dynamic_cast(firstParamInfo); MRDOCS_CHECK_OR( - (*I.Params.front().Type)->isLValueReference() || - (*I.Params.front().Type)->isRValueReference() || - (*I.Params.front().Type)->isPointer()); + I.Params.front().Type->isLValueReference() || + I.Params.front().Type->isRValueReference() || + I.Params.front().Type->isPointer()); // Get all transitively derived classes of firstParamRecord pushAllDerivedClasses(firstParamRecord, relatedRecordsOrEnums, corpus_); }(); // 3) The return type of the function - if (auto* returnTypeInfo = toRecordOrEnum(*I.ReturnType)) + if (auto* returnTypeInfo = toRecordOrEnum(I.ReturnType)) { if (returnTypeInfo->Extraction == ExtractionMode::Regular) { @@ -1295,8 +1301,8 @@ setAutoRelates() // each template parameter is also a related record [&] { MRDOCS_CHECK_OR(I.ReturnType); - MRDOCS_CHECK_OR((*I.ReturnType)->isNamed()); - auto& NTI = dynamic_cast(**I.ReturnType); + MRDOCS_CHECK_OR(I.ReturnType->isNamed()); + auto& NTI = dynamic_cast(*I.ReturnType); MRDOCS_CHECK_OR(NTI.Name); MRDOCS_CHECK_OR(NTI.Name->isSpecialization()); auto const& NTIS = dynamic_cast(*NTI.Name); @@ -1304,7 +1310,7 @@ setAutoRelates() Polymorphic const& firstArg = NTIS.TemplateArgs.front(); MRDOCS_CHECK_OR(firstArg->isType()); auto const& typeArg = dynamic_cast(*firstArg); - if (auto* argInfo = toRecordOrEnum(*typeArg.Type)) + if (auto* argInfo = toRecordOrEnum(typeArg.Type)) { if (argInfo->Extraction == ExtractionMode::Regular) { @@ -1552,10 +1558,8 @@ finalize(TArg& arg) { if constexpr (Ty::isType()) { - if (A.Type) - { - finalize(**A.Type); - } + MRDOCS_ASSERT(!A.Type.valueless_after_move()); + finalize(*A.Type); } if constexpr (Ty::isTemplate()) { @@ -1581,13 +1585,10 @@ finalize(TParam& param) finalize(**P.Constraint); } } - - if constexpr (Ty::isNonType()) + if constexpr (Ty::isConstant()) { - if (P.Type) - { - finalize(**P.Type); - } + MRDOCS_ASSERT(!P.Type.valueless_after_move()); + finalize(*P.Type); } if constexpr (Ty::isTemplate()) @@ -1601,20 +1602,16 @@ void JavadocFinalizer:: finalize(Param& param) { - if (param.Type) - { - finalize(**param.Type); - } + MRDOCS_ASSERT(!param.Type.valueless_after_move()); + finalize(*param.Type); } void JavadocFinalizer:: finalize(BaseInfo& info) { - if (info.Type) - { - finalize(**info.Type); - } + MRDOCS_ASSERT(!info.Type.valueless_after_move()); + finalize(*info.Type); } void @@ -1950,8 +1947,9 @@ warnNoParamDocs(FunctionInfo const& I) } // Check for undocumented return type - if (I.javadoc->returns.empty() && I.ReturnType) + if (I.javadoc->returns.empty()) { + MRDOCS_ASSERT(!I.ReturnType.valueless_after_move()); auto isVoid = [](TypeInfo const& returnType) -> bool { if (returnType.isNamed()) @@ -1961,7 +1959,7 @@ warnNoParamDocs(FunctionInfo const& I) } return false; }; - if (!isVoid(**I.ReturnType)) + if (!isVoid(*I.ReturnType)) { this->warn( *getPrimaryLocation(I), diff --git a/src/lib/Metadata/Finalizers/OverloadsFinalizer.cpp b/src/lib/Metadata/Finalizers/OverloadsFinalizer.cpp index 3d377dd2c..57ff43840 100644 --- a/src/lib/Metadata/Finalizers/OverloadsFinalizer.cpp +++ b/src/lib/Metadata/Finalizers/OverloadsFinalizer.cpp @@ -28,7 +28,7 @@ findBaseClassPermutation( { // Find the i-th base class MRDOCS_CHECK_OR(base.Type, SymbolID::invalid); - auto const baseInfo = corpus.find((*base.Type)->namedSymbol()); + auto const baseInfo = corpus.find(base.Type->namedSymbol()); MRDOCS_CHECK_OR_CONTINUE(baseInfo); auto const baseRecord = baseInfo->asRecordPtr(); MRDOCS_CHECK_OR_CONTINUE(baseRecord); @@ -290,9 +290,9 @@ operator()(RecordInfo& I) for (auto& b: I.Bases) { auto& BT = b.Type; - MRDOCS_CHECK_OR(BT); - MRDOCS_CHECK_OR((*BT)->isNamed()); - auto& NT = dynamic_cast(**BT); + MRDOCS_ASSERT(!BT.valueless_after_move()); + MRDOCS_CHECK_OR(BT->isNamed()); + auto& NT = dynamic_cast(*BT); MRDOCS_CHECK_OR(NT.Name); auto& NI = dynamic_cast(*NT.Name); MRDOCS_CHECK_OR(NI.id); diff --git a/src/lib/Metadata/Finalizers/SortMembersFinalizer.cpp b/src/lib/Metadata/Finalizers/SortMembersFinalizer.cpp index eaa345770..01fe2f00d 100644 --- a/src/lib/Metadata/Finalizers/SortMembersFinalizer.cpp +++ b/src/lib/Metadata/Finalizers/SortMembersFinalizer.cpp @@ -163,35 +163,32 @@ struct SymbolIDCompareFn (lhsOp && *lhsOp == OperatorKind::Equal && rhsOp && *rhsOp == OperatorKind::Equal)) { - auto& lhsF = lhs.asFunction(); - auto& rhsF = rhs.asFunction(); + FunctionInfo const& lhsF = lhs.asFunction(); + FunctionInfo const& rhsF = rhs.asFunction(); if (lhsF.Params.size() == 1 && rhsF.Params.size() == 1) { auto isCopyOrMoveConstOrAssign = [](FunctionInfo const& I) { if (I.Params.size() == 1) { auto const& param = I.Params[0]; - auto const& paramTypeOpt = param.Type; - MRDOCS_CHECK_OR(paramTypeOpt, false); - auto const& paramType = *paramTypeOpt; - if (!paramType->isLValueReference() - && !paramType->isRValueReference()) - { - return false; - } - auto const ¶mRefPointeeOpt = + Polymorphic const& paramType = param.Type; + MRDOCS_ASSERT(!paramType.valueless_after_move()); + MRDOCS_CHECK_OR( + paramType->isLValueReference() || + paramType->isRValueReference(), false); + Polymorphic const ¶mRefPointeeOpt = paramType->isLValueReference() - ? static_cast(*paramType) + ? dynamic_cast(*paramType) .PointeeType - : static_cast(*paramType) + : dynamic_cast(*paramType) .PointeeType; MRDOCS_CHECK_OR(paramRefPointeeOpt, false); auto const& paramRefPointee = *paramRefPointeeOpt; - if (!paramRefPointee->isNamed()) + if (!paramRefPointee.isNamed()) { return false; } - return paramRefPointee->namedSymbol() == I.Parent; + return paramRefPointee.namedSymbol() == I.Parent; } return false; }; @@ -206,10 +203,10 @@ struct SymbolIDCompareFn // Ensure move comes after copy if (lhsIsCopyOrMove && rhsIsCopyOrMove) { - MRDOCS_CHECK_OR(!lhsF.Params[0].Type, false); - MRDOCS_CHECK_OR(!rhsF.Params[0].Type, true); - bool const lhsIsMove = (*lhsF.Params[0].Type)->isRValueReference(); - bool const rhsIsMove = (*rhsF.Params[0].Type)->isRValueReference(); + MRDOCS_ASSERT(!lhsF.Params[0].Type.valueless_after_move()); + MRDOCS_ASSERT(!rhsF.Params[0].Type.valueless_after_move()); + bool const lhsIsMove = lhsF.Params[0].Type->isRValueReference(); + bool const rhsIsMove = rhsF.Params[0].Type->isRValueReference(); if (lhsIsMove != rhsIsMove) { return !lhsIsMove; diff --git a/src/lib/Metadata/Info/Function.cpp b/src/lib/Metadata/Info/Function.cpp index 73fec236f..0958ce35b 100644 --- a/src/lib/Metadata/Info/Function.cpp +++ b/src/lib/Metadata/Info/Function.cpp @@ -292,7 +292,7 @@ toString(FunctionClass const kind) noexcept void merge(Param& I, Param&& Other) { - if (!I.Type) + if (I.Type->isAuto()) { I.Type = std::move(Other.Type); } @@ -391,10 +391,7 @@ merge(FunctionInfo& I, FunctionInfo&& Other) { I.Class = Other.Class; } - if (!I.ReturnType) - { - I.ReturnType = std::move(Other.ReturnType); - } + I.ReturnType = std::move(Other.ReturnType); std::size_t const n = std::min(I.Params.size(), Other.Params.size()); for (std::size_t i = 0; i < n; ++i) { diff --git a/src/lib/Metadata/Info/Guide.cpp b/src/lib/Metadata/Info/Guide.cpp index ef3b232e5..1fc51fcd2 100644 --- a/src/lib/Metadata/Info/Guide.cpp +++ b/src/lib/Metadata/Info/Guide.cpp @@ -83,7 +83,7 @@ void merge(GuideInfo& I, GuideInfo&& Other) { MRDOCS_ASSERT(canMerge(I, Other)); merge(I.asInfo(), std::move(Other.asInfo())); - if (!I.Deduced) + if (I.Deduced->isAuto()) { I.Deduced = std::move(Other.Deduced); } @@ -102,4 +102,3 @@ void merge(GuideInfo& I, GuideInfo&& Other) } } // clang::mrdocs - diff --git a/src/lib/Metadata/Info/NamespaceAlias.cpp b/src/lib/Metadata/Info/NamespaceAlias.cpp index ee20ac9bc..8f79a616f 100644 --- a/src/lib/Metadata/Info/NamespaceAlias.cpp +++ b/src/lib/Metadata/Info/NamespaceAlias.cpp @@ -20,9 +20,13 @@ merge(NamespaceAliasInfo& I, NamespaceAliasInfo&& Other) { MRDOCS_ASSERT(canMerge(I, Other)); merge(I.asInfo(), std::move(Other.asInfo())); - if (!I.AliasedSymbol) + if (I.AliasedSymbol.Name.empty()) { - I.AliasedSymbol = std::move(Other.AliasedSymbol); + I.AliasedSymbol.Name = std::move(Other.AliasedSymbol.Name); + } + if (!I.AliasedSymbol.id) + { + I.AliasedSymbol.id = Other.AliasedSymbol.id; } } diff --git a/src/lib/Metadata/Info/Overloads.cpp b/src/lib/Metadata/Info/Overloads.cpp index 4982bd1c6..e7659d37c 100644 --- a/src/lib/Metadata/Info/Overloads.cpp +++ b/src/lib/Metadata/Info/Overloads.cpp @@ -57,7 +57,8 @@ addMember(OverloadsInfo& I, FunctionInfo const& Member) I.Extraction = leastSpecific(I.Extraction, Member.Extraction); if (I.ReturnType != Member.ReturnType) { - I.ReturnType = std::nullopt; + // The return types differ, so we use 'auto' to indicate that. + I.ReturnType = Polymorphic(AutoTypeInfo{}); } } merge(I.Loc, Member.Loc); diff --git a/src/lib/Metadata/Info/Record.cpp b/src/lib/Metadata/Info/Record.cpp index 89216ea30..b5cd1f261 100644 --- a/src/lib/Metadata/Info/Record.cpp +++ b/src/lib/Metadata/Info/Record.cpp @@ -10,6 +10,7 @@ #include #include +#include #include namespace clang::mrdocs { @@ -170,12 +171,6 @@ tag_invoke( io.map("isPrivate", I.Access == AccessKind::Private); io.map("isVirtual", I.IsVirtual); io.map("type", dom::ValueFrom(I.Type, domCorpus)); - if (I.Type) - { - MRDOCS_ASSERT(!I.Type->valueless_after_move()); - io.map("symbol", (*I.Type)->namedSymbol()); - } - } void diff --git a/src/lib/Metadata/Info/Typedef.cpp b/src/lib/Metadata/Info/Typedef.cpp index 22809f4b9..666a0cea8 100644 --- a/src/lib/Metadata/Info/Typedef.cpp +++ b/src/lib/Metadata/Info/Typedef.cpp @@ -67,7 +67,7 @@ void merge(TypedefInfo& I, TypedefInfo&& Other) { I.IsUsing = Other.IsUsing; } - if (!I.Type) + if (I.Type.valueless_after_move()) { I.Type = std::move(Other.Type); } diff --git a/src/lib/Metadata/Info/Variable.cpp b/src/lib/Metadata/Info/Variable.cpp index 5a6d6435b..6f8283479 100644 --- a/src/lib/Metadata/Info/Variable.cpp +++ b/src/lib/Metadata/Info/Variable.cpp @@ -63,7 +63,7 @@ merge(VariableInfo& I, VariableInfo&& Other) { MRDOCS_ASSERT(canMerge(I, Other)); merge(I.asInfo(), std::move(Other.asInfo())); - if (!I.Type) + if (I.Type.valueless_after_move()) { I.Type = std::move(Other.Type); } diff --git a/src/lib/Metadata/Name.cpp b/src/lib/Metadata/Name.cpp index 6202f5f30..76554248f 100644 --- a/src/lib/Metadata/Name.cpp +++ b/src/lib/Metadata/Name.cpp @@ -119,13 +119,10 @@ toStringImpl( { if constexpr(U::isType()) { - if (u.Type) - { - MRDOCS_ASSERT(!u.Type->valueless_after_move()); - writeTo(result, toString(**u.Type)); - } + MRDOCS_ASSERT(!u.Type.valueless_after_move()); + writeTo(result, toString(*u.Type)); } - if constexpr(U::isNonType()) + if constexpr(U::isConstant()) { writeTo(result, u.Value.Written); } diff --git a/src/lib/Metadata/Source.cpp b/src/lib/Metadata/Source.cpp index b0ca0814f..1dcaf2af8 100644 --- a/src/lib/Metadata/Source.cpp +++ b/src/lib/Metadata/Source.cpp @@ -11,9 +11,9 @@ #include #include -#include -#include #include +#include +#include #include #include diff --git a/src/lib/Metadata/Template.cpp b/src/lib/Metadata/Template.cpp index 5aad05a58..d52c94cf0 100644 --- a/src/lib/Metadata/Template.cpp +++ b/src/lib/Metadata/Template.cpp @@ -25,8 +25,8 @@ toString(TArgKind kind) noexcept { case TArgKind::Type: return "type"; - case TArgKind::NonType: - return "non-type"; + case TArgKind::Constant: + return "constant"; case TArgKind::Template: return "template"; default: @@ -42,8 +42,8 @@ toString( { case TParamKind::Type: return "type"; - case TParamKind::NonType: - return "non-type"; + case TParamKind::Constant: + return "constant"; case TParamKind::Template: return "template"; default: @@ -129,13 +129,10 @@ toString( std::string result; if constexpr(T::isType()) { - if (t.Type) - { - MRDOCS_ASSERT(!t.Type->valueless_after_move()); - result += toString(**t.Type); - } + MRDOCS_ASSERT(!t.Type.valueless_after_move()); + result += toString(*t.Type); } - if constexpr(T::isNonType()) + if constexpr(T::isConstant()) { result += t.Value.Written; } @@ -165,7 +162,7 @@ tag_invoke( { io.map("type", t.Type); } - if constexpr(T::isNonType()) + if constexpr(T::isConstant()) { io.map("value", t.Value.Written); } @@ -193,8 +190,8 @@ TypeTParam:: operator<=>(TypeTParam const&) const = default; std::strong_ordering -NonTypeTParam:: -operator<=>(NonTypeTParam const&) const = default; +ConstantTParam:: +operator<=>(ConstantTParam const&) const = default; std::strong_ordering TemplateTParam:: @@ -240,7 +237,7 @@ tag_invoke( io.map("constraint", t.Constraint); } } - if constexpr(T::isNonType()) + if constexpr(T::isConstant()) { io.map("type", t.Type); } diff --git a/src/lib/Metadata/Type.cpp b/src/lib/Metadata/Type.cpp index 16fed0b8f..6343caa36 100644 --- a/src/lib/Metadata/Type.cpp +++ b/src/lib/Metadata/Type.cpp @@ -172,11 +172,9 @@ operator()( if constexpr(requires { t.ParentType; }) { - if(t.ParentType) - { - writeFullType(**t.ParentType, write); - write("::"); - } + MRDOCS_ASSERT(!t.ParentType.valueless_after_move()); + writeFullType(*t.ParentType, write); + write("::"); } if constexpr(T::isDecltype()) @@ -790,24 +788,18 @@ innerTypeImpl(TypeInfoTy&& TI) noexcept { if constexpr(requires { t.PointeeType; }) { - if (t.PointeeType) - { - return &*t.PointeeType; - } + MRDOCS_ASSERT(!t.PointeeType.valueless_after_move()); + return &t.PointeeType; } if constexpr(requires { t.ElementType; }) { - if (t.ElementType) - { - return &*t.ElementType; - } + MRDOCS_ASSERT(!t.ElementType.valueless_after_move()); + return &t.ElementType; } if constexpr(requires { t.ReturnType; }) { - if (t.ReturnType) - { - return &*t.ReturnType; - } + MRDOCS_ASSERT(!t.ReturnType.valueless_after_move()); + return &t.ReturnType; } return nullptr; }); diff --git a/src/lib/Support/Report.cpp b/src/lib/Support/Report.cpp index 54180cbfb..24c1d4cde 100644 --- a/src/lib/Support/Report.cpp +++ b/src/lib/Support/Report.cpp @@ -13,8 +13,8 @@ #include #include #include -#include #include +#include #include #include #include diff --git a/src/lib/clang.natvis b/src/lib/clang.natvis index 99226d36f..0f3cc7c9c 100644 --- a/src/lib/clang.natvis +++ b/src/lib/clang.natvis @@ -109,12 +109,12 @@ For later versions of Visual Studio, no setup is required--> {(clang::QualType *)Arg,view(cpp)na} {*(clang::QualType *)Arg} - {*(clang::Expr *)Arg} + {*(clang::Expr *)Arg} {*(clang::TemplateName *)Arg Kind,en (clang::QualType *)Arg - (clang::Expr *)Arg + (clang::Expr *)Arg (clang::TemplateName *)Arg diff --git a/src/test/ADT/Optional.cpp b/src/test/ADT/Optional.cpp index 539233a48..00e8496d3 100644 --- a/src/test/ADT/Optional.cpp +++ b/src/test/ADT/Optional.cpp @@ -10,9 +10,9 @@ #include #include -#include #include #include +#include namespace clang::mrdocs { diff --git a/src/test/Support/Expected.cpp b/src/test/Support/Expected.cpp index 432da2d36..b633a90b3 100644 --- a/src/test/Support/Expected.cpp +++ b/src/test/Support/Expected.cpp @@ -17,10 +17,10 @@ // #include -#include #include #include #include +#include namespace clang { namespace mrdocs { diff --git a/src/tool/ToolMain.cpp b/src/tool/ToolMain.cpp index 3e4717d89..4b65e3ed9 100644 --- a/src/tool/ToolMain.cpp +++ b/src/tool/ToolMain.cpp @@ -16,8 +16,8 @@ #include #include #include -#include #include +#include #include #include #include diff --git a/test-files/golden-tests/config/auto-relates/enum.xml b/test-files/golden-tests/config/auto-relates/enum.xml index 5667f16fc..6c4490ced 100644 --- a/test-files/golden-tests/config/auto-relates/enum.xml +++ b/test-files/golden-tests/config/auto-relates/enum.xml @@ -18,7 +18,7 @@