Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

polymorphic info members use value semantics #820

Merged
merged 1 commit into from
Jan 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
test-files/**/*.xml binary
test-files/golden-tests/** text eol=lf
56 changes: 54 additions & 2 deletions docs/mrdocs.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
"anonymous-namespaces": {
"default": true,
"description": "Determine whether symbols in anonymous namespaces should be extracted. When set to `always`, symbols in anonymous namespaces are always extracted. When set to `dependency`, symbols in anonymous namespaces are extracted only if they are referenced by the source code. When set to `never`, symbols in anonymous namespaces are never extracted.",
"enum": [
true,
false
],
"title": "Extraction policy for anonymous namespaces",
"type": "boolean"
},
Expand Down Expand Up @@ -43,6 +47,10 @@
"embedded": {
"default": false,
"description": "Output an embeddable document, which excludes the header, the footer, and everything outside the body of the document. This option is useful for producing documents that can be inserted into an external template.",
"enum": [
true,
false
],
"title": "Output an embeddable document",
"type": "boolean"
},
Expand Down Expand Up @@ -106,12 +114,20 @@
"ignore-failures": {
"default": false,
"description": "When set to true, MrDocs continues to generate the documentation even if there are AST visitation failures. AST visitation failures occur when the source code contains constructs that are not supported by MrDocs.",
"enum": [
true,
false
],
"title": "Whether AST visitation failures should not stop the program",
"type": "boolean"
},
"ignore-map-errors": {
"default": false,
"description": "When set to true, MrDocs continues to generate the documentation even if some files are not mapped correctly. Files are not mapped correctly when the source file is not found or the compilation database does not contain the compiler flags for the source file.",
"enum": [
true,
false
],
"title": "Continue if files are not mapped correctly",
"type": "boolean"
},
Expand Down Expand Up @@ -156,6 +172,10 @@
"legible-names": {
"default": true,
"description": "Use legible names for ids in the documentation. When set to true, MrDocs uses legible names for symbols in the documentation. These are symbols that are legible but still safe for URLs. When the option is set to false, MrDocs uses a hash of the symbol ID.",
"enum": [
true,
false
],
"title": "Use legible names",
"type": "boolean"
},
Expand All @@ -173,6 +193,10 @@
"multipage": {
"default": true,
"description": "Generates a multipage documentation. The output directory must be a directory. This option acts as a hint to the generator to create a multipage documentation. Whether the hint is followed or not depends on the generator.",
"enum": [
true,
false
],
"title": "Generate a multipage documentation",
"type": "boolean"
},
Expand All @@ -185,18 +209,30 @@
"private-bases": {
"default": true,
"description": "Determine whether private base classes should be extracted",
"enum": [
true,
false
],
"title": "Extraction policy for private base classes",
"type": "boolean"
},
"private-members": {
"default": false,
"description": "Determine whether private class members should be extracted",
"enum": [
true,
false
],
"title": "Extraction policy for private class members",
"type": "boolean"
},
"recursive": {
"default": true,
"description": "Recursively include files. When set to true, MrDocs includes files in subdirectories of the input directories. When set to false, MrDocs includes only the files in the input directories.",
"enum": [
true,
false
],
"title": "Recursively include files from \"input\" paths",
"type": "boolean"
},
Expand All @@ -210,16 +246,20 @@
},
"see-below": {
"default": [],
"description": "Symbols that match one of these filters are tagged as \"see-below\" in the documentation, and so do symbols in scopes tagged as \"see-below\". This option is used to remove details about symbols that are considered part of the private API of the project. In the documentation page for this symbol, the synopsis of the implementation is rendered as \"see-below\" and members of scopes (such as a namespace or record) are not listed. The rest of the documentation is rendered as usual. See the documentation for \"include-symbol\" for the pattern syntax.",
"description": "Symbols that match one of these filters are tagged as \"see-below\" in the documentation, and so do symbols in scopes tagged as \"see-below\". This option is used to remove details about symbols that are considered part of the private API of the project but the user might need to interact with. In the documentation page for this symbol, the symbol is exposition only: the synopsis of the implementation is rendered as \"see-below\" and members of scopes (such as a namespace or record) are not listed. The rest of the documentation is rendered as usual to explain the symbol. See the documentation for \"include-symbol\" for the pattern syntax.",
"items": {
"type": "string"
},
"title": "Symbols rendered as \"see-below\"",
"title": "Exposition only symbols rendered as \"see-below\".",
"type": "array"
},
"sfinae": {
"default": true,
"description": "When set to true, MrDocs detects SFINAE expressions in the source code and extracts them as part of the documentation. Expressions such as `std::enable_if<...>` are detected, removed, and documented as a requirement. MrDocs uses an algorithm that extracts SFINAE infomation from types by identifying inspecting the primary template and specializations to detect the result type and the controlling expressions in a specialization.",
"enum": [
true,
false
],
"title": "Detect and reduce SFINAE expressions",
"type": "boolean"
},
Expand Down Expand Up @@ -259,18 +299,30 @@
"use-system-libc": {
"default": false,
"description": "To achieve reproducible results, MrDocs bundles the LibC headers with its definitions. To use the C standard library available in the system instead, set this option to true.",
"enum": [
true,
false
],
"title": "Use the system C standard library",
"type": "boolean"
},
"use-system-stdlib": {
"default": false,
"description": "To achieve reproducible results, MrDocs bundles the LibC++ headers. To use the C++ standard library available in the system instead, set this option to true.",
"enum": [
true,
false
],
"title": "Use the system C++ standard library",
"type": "boolean"
},
"verbose": {
"default": false,
"description": "Verbose output. When set to true, MrDocs outputs additional information during the generation of the documentation.",
"enum": [
true,
false
],
"title": "Verbose output",
"type": "boolean"
}
Expand Down
27 changes: 14 additions & 13 deletions include/mrdocs/ADT/Optional.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
#include <concepts>
#include <type_traits>
#include <utility>
#include <ranges>

namespace clang {
namespace mrdocs {
namespace clang::mrdocs {

/** The default empty predicate.

Expand All @@ -27,21 +27,23 @@ namespace mrdocs {
*/
struct DefaultEmptyPredicate
{
template<class T>
constexpr bool operator()(T const& t) const noexcept
requires requires
{
{ t.empty() } -> std::convertible_to<bool>;
}
template <std::ranges::range T>
constexpr
bool
operator()(T const& t) const noexcept
{
return t.empty();
return std::ranges::empty(t);
}

template<class T>
constexpr bool operator()(T const& t) const noexcept
constexpr
bool
operator()(T const& t) const noexcept
{
return ! t;
return !t;
}


};

/** A compact optional.
Expand Down Expand Up @@ -138,7 +140,6 @@ class Optional
}
};

} // mrdocs
} // clang
} // clang::mrdocs

#endif
Loading