diff --git a/src/lib/AST/ASTVisitor.cpp b/src/lib/AST/ASTVisitor.cpp index d973395f69..ada2b000a6 100644 --- a/src/lib/AST/ASTVisitor.cpp +++ b/src/lib/AST/ASTVisitor.cpp @@ -22,6 +22,7 @@ #include "lib/Lib/Diagnostics.hpp" #include #include +#include #include #include #include @@ -180,7 +181,7 @@ traverse(UsingDirectiveDecl const* D) MRDOCS_ASSERT(res); MRDOCS_ASSERT(res->isIdentifier()); if (NameInfo NI = *res; - std::ranges::find(PNI->UsingDirectives, NI) == PNI->UsingDirectives.end()) + !contains(PNI->UsingDirectives, NI)) { PNI->UsingDirectives.push_back(std::move(NI)); } @@ -1582,7 +1583,7 @@ populateAttributes(InfoTy& I, Decl const* D) { continue; } - if (std::ranges::find(I.Attributes, II->getName()) == I.Attributes.end()) + if (!contains(I.Attributes, II->getName())) { I.Attributes.emplace_back(II->getName()); } @@ -1779,7 +1780,7 @@ void ASTVisitor:: addMember(std::vector& container, Info const& Member) const { - if (std::ranges::find(container, Member.id) == container.end()) + if (!contains(container, Member.id)) { container.push_back(Member.id); } @@ -2821,45 +2822,48 @@ checkSymbolFilters(Decl const* D, bool const AllowParent) // Update cache auto updateCache = [this, D](ExtractionInfo const result) { extraction_.emplace(D, result); + return result; }; // If not a NamedDecl, then symbol filters don't apply auto const* ND = dyn_cast(D); if (!ND) { - ExtractionInfo const res{ExtractionMode::Regular, ExtractionMatchType::Strict}; - updateCache(res); - return res; + constexpr ExtractionInfo res{ExtractionMode::Regular, ExtractionMatchType::Strict}; + return updateCache(res); } // Get the symbol name SmallString<256> const name = qualifiedName(ND); auto const symbolName = name.str(); - // We should check the exclusion filters first. If a symbol is + // Function to check if parent is of a certain extraction mode + auto ParentIs = [&](Decl const* D, ExtractionMode expected) { + if (Decl const* P = getParent(D); + P && + !isa(P)) + { + auto const [parentMode, kind] = checkSymbolFilters(P); + return parentMode == expected; + } + return false; + }; + + // 0) We should check the exclusion filters first. If a symbol is // explicitly excluded, there's nothing else to check. if (!config_->excludeSymbols.empty()) { if (checkSymbolFiltersImpl(config_->excludeSymbols, symbolName)) { ExtractionInfo const res{ExtractionMode::Dependency, ExtractionMatchType::Strict}; - updateCache(res); - return res; + return updateCache(res); } - // If the parent scope is excluded, the symbol should also be excluded - // since it would not be possible to refer to this member. - if (AllowParent) + + // 0a) Check if the parent is excluded + if (AllowParent && + ParentIs(D, ExtractionMode::Dependency)) { - if (Decl const* P = getParent(D)) - { - if (auto const [mode, kind] = checkSymbolFilters(P); - mode == ExtractionMode::Dependency) - { - ExtractionInfo const res = {mode, ExtractionMatchType::StrictParent}; - updateCache(res); - return res; - } - } + return updateCache({ExtractionMode::Dependency, ExtractionMatchType::StrictParent}); } } @@ -2875,14 +2879,47 @@ checkSymbolFilters(Decl const* D, bool const AllowParent) }; // 1) The symbol strictly matches one of the patterns - for (auto const& [patterns, mode] : patternsAndModes) + for (auto const& [patterns, patternsMode] : patternsAndModes) { - if (!patterns->empty() && - checkSymbolFiltersImpl(*patterns, symbolName)) + if (!patterns->empty()) { - ExtractionInfo res = {mode, ExtractionMatchType::Strict}; - updateCache(res); - return res; + if (checkSymbolFiltersImpl(*patterns, symbolName)) + { + ExtractionInfo const res = {patternsMode, ExtractionMatchType::Strict}; + return updateCache(res); + } + + // 1a) Check if the parent in the same exclusion category + // (see-below or implementation defined). + if (AllowParent && + patternsMode != ExtractionMode::Regular && + ParentIs(D, patternsMode)) + { + if (patternsMode == ExtractionMode::ImplementationDefined) + { + // A child of implementation defined is also + // implementation defined. + return updateCache( + { ExtractionMode::ImplementationDefined, + ExtractionMatchType::StrictParent }); + } + if (patternsMode == ExtractionMode::SeeBelow) + { + // A child of see-below is also see-below (if namespace) + // or dependency (if record) + if (Decl const* P = getParent(D); + P && + isa(P)) + { + return updateCache( + { ExtractionMode::SeeBelow, + ExtractionMatchType::StrictParent }); + } + return updateCache( + { ExtractionMode::Dependency, + ExtractionMatchType::StrictParent }); + } + } } } @@ -2922,8 +2959,7 @@ checkSymbolFilters(Decl const* D, bool const AllowParent) checkSymbolFiltersImpl(*patterns, namespaceName.str())) { ExtractionInfo const res = {mode, ExtractionMatchType::LiteralParent}; - updateCache(res); - return res; + return updateCache(res); } } } @@ -2996,9 +3032,8 @@ checkSymbolFilters(Decl const* D, bool const AllowParent) } if (childrenMode != ExtractionMode::Dependency) { - ExtractionInfo const res = {mode, ExtractionMatchType::Prefix}; - updateCache(res); - return res; + ExtractionInfo const res = {childrenMode, ExtractionMatchType::Prefix}; + return updateCache(res); } } } @@ -3028,8 +3063,7 @@ checkSymbolFilters(Decl const* D, bool const AllowParent) // being extracted so that symbols that match // the full pattern are included and not all symbols. ExtractionInfo const res = {mode, ExtractionMatchType::StrictParent}; - updateCache(res); - return res; + return updateCache(res); } } } @@ -3042,14 +3076,12 @@ checkSymbolFilters(Decl const* D, bool const AllowParent) if (config_->includeSymbols.empty()) { constexpr ExtractionInfo res = {ExtractionMode::Regular, ExtractionMatchType::Strict}; - updateCache(res); - return res; + return updateCache(res); } // 4b) Otherwise, we don't extract the symbol // because it doesn't match any of `include-symbol` filters constexpr ExtractionInfo res = {ExtractionMode::Dependency, ExtractionMatchType::Strict}; - updateCache(res); - return res; + return updateCache(res); } template diff --git a/src/lib/Metadata/Finalizers/BaseMembersFinalizer.cpp b/src/lib/Metadata/Finalizers/BaseMembersFinalizer.cpp index cc31cfc439..feffff6e13 100644 --- a/src/lib/Metadata/Finalizers/BaseMembersFinalizer.cpp +++ b/src/lib/Metadata/Finalizers/BaseMembersFinalizer.cpp @@ -10,6 +10,7 @@ #include "BaseMembersFinalizer.hpp" #include +#include namespace clang::mrdocs { @@ -101,12 +102,19 @@ inheritBaseMembers( for (SymbolID const& otherID: base) { // Find the info from the base class - auto idIt = std::ranges::find(derived, otherID); - MRDOCS_CHECK_OR_CONTINUE(idIt == derived.end()); + MRDOCS_CHECK_OR_CONTINUE(!contains(derived, otherID)); Info* otherInfoPtr = corpus_.find(otherID); MRDOCS_CHECK_OR_CONTINUE(otherInfoPtr); Info& otherInfo = *otherInfoPtr; + // Check if we're not attempt to copy a special member function + if (auto const* funcPtr = static_cast(otherInfoPtr)) + { + MRDOCS_CHECK_OR_CONTINUE(!is_one_of( + funcPtr->Class, + { FunctionClass::Constructor, FunctionClass::Destructor })); + } + // Check if derived class has a member that shadows the base member auto shadowIt = std::ranges::find_if( derived, @@ -126,12 +134,9 @@ inheritBaseMembers( std::tie(func.Name, func.Params, func.Template) == std::tie(otherFunc.Name, otherFunc.Params, func.Template); } - else - { - // For other kinds of members, it's a shadow if the names - // are the same - return info.Name == otherInfo.Name; - } + // For other kinds of members, it's a shadow if the names + // are the same + return info.Name == otherInfo.Name; }); MRDOCS_CHECK_OR_CONTINUE(shadowIt == derived.end()); @@ -220,6 +225,7 @@ void BaseMembersFinalizer:: operator()(RecordInfo& I) { + MRDOCS_CHECK_OR(I.Extraction == ExtractionMode::Regular); report::trace( "Extracting base members for record '{}'", corpus_.Corpus::qualifiedName(I)); diff --git a/test-files/golden-tests/config/inherit-base-members/skip-special.adoc b/test-files/golden-tests/config/inherit-base-members/skip-special.adoc new file mode 100644 index 0000000000..395ed4f9ee --- /dev/null +++ b/test-files/golden-tests/config/inherit-base-members/skip-special.adoc @@ -0,0 +1,713 @@ += Reference +:mrdocs: + +[#index] +== Global namespace + +=== Types + +[cols=2] +|=== +| Name +| Description +| <> +| +| <> +| +| <> +| +| <> +| +| <> +| Should inherit functions as protected. +|=== + +[#base] +== base + +=== Synopsis + +Declared in `<skip‐special.cpp>` + +[source,cpp,subs="verbatim,replacements,macros,-callouts"] +---- +class base + : public <>; +---- + +=== Member Functions + +[cols=2] +|=== +| Name +| Description +| <> [.small]#[constructor]# +| Constructor should not be inherited +| <> [.small]#[destructor]# +| Destructor should not be inherited +| <> +| This function should be indirectly inherited by derived classes. +| <> +| This function should be inherited by derived classes. +| <> +| This function should shadow the excluded_base function. +| <> +| This function should be shadowed by derived classes. +| <> +| This function should be indirectly inherited by derived classes. +|=== + +=== Protected Member Functions + +[cols=2] +|=== +| Name +| Description +| <> +| This function should be inherited by derived classes. +| <> +| This function should shadow the excluded_base function. +| <> +| This function should be shadowed by derived classes. +|=== + +=== Derived Classes + +[,cols=2] +|=== +| Name +| Description +| <> +| +|=== + +[#base-2constructor] +== <>::base + +Constructor should not be inherited + +=== Synopsis + +Declared in `<skip‐special.cpp>` + +[source,cpp,subs="verbatim,replacements,macros,-callouts"] +---- +base(); +---- + +[#base-2destructor] +== <>::~base + +Destructor should not be inherited + +=== Synopsis + +Declared in `<skip‐special.cpp>` + +[source,cpp,subs="verbatim,replacements,macros,-callouts"] +---- +~base(); +---- + +[#base-base_inherited] +== <>::base_inherited + +This function should be inherited by derived classes. + +=== Synopsis + +Declared in `<skip‐special.cpp>` + +[source,cpp,subs="verbatim,replacements,macros,-callouts"] +---- +<>& +base_inherited(); +---- + +[#base-base_shadowed] +== <>::base_shadowed + +This function should shadow the excluded_base function. + +=== Synopsis + +Declared in `<skip‐special.cpp>` + +[source,cpp,subs="verbatim,replacements,macros,-callouts"] +---- +<>& +base_shadowed(); +---- + +[#base-derived_shadowed] +== <>::derived_shadowed + +This function should be shadowed by derived classes. + +=== Synopsis + +Declared in `<skip‐special.cpp>` + +[source,cpp,subs="verbatim,replacements,macros,-callouts"] +---- +<>& +derived_shadowed(); +---- + +[#base-do_base_inherited] +== <>::do_base_inherited + +This function should be inherited by derived classes. + +=== Synopsis + +Declared in `<skip‐special.cpp>` + +[source,cpp,subs="verbatim,replacements,macros,-callouts"] +---- +<>& +do_base_inherited(); +---- + +[#base-do_base_shadowed] +== <>::do_base_shadowed + +This function should shadow the excluded_base function. + +=== Synopsis + +Declared in `<skip‐special.cpp>` + +[source,cpp,subs="verbatim,replacements,macros,-callouts"] +---- +<>& +do_base_shadowed(); +---- + +[#base-do_derived_shadowed] +== <>::do_derived_shadowed + +This function should be shadowed by derived classes. + +=== Synopsis + +Declared in `<skip‐special.cpp>` + +[source,cpp,subs="verbatim,replacements,macros,-callouts"] +---- +<>& +do_derived_shadowed(); +---- + +[#base_base] +== base_base + +=== Synopsis + +Declared in `<skip‐special.cpp>` + +[source,cpp,subs="verbatim,replacements,macros,-callouts"] +---- +class base_base; +---- + +=== Member Functions + +[cols=2] +|=== +| Name +| Description +| <> [.small]#[constructor]# +| Constructor should not be inherited +| <> [.small]#[destructor]# +| Destructor should not be inherited +| <> +| This function should be indirectly inherited by derived classes. +| <> +| This function should be indirectly inherited by derived classes. +|=== + +=== Derived Classes + +[,cols=2] +|=== +| Name +| Description +| <> +| +|=== + +[#base_base-2constructor] +== <>::base_base + +Constructor should not be inherited + +=== Synopsis + +Declared in `<skip‐special.cpp>` + +[source,cpp,subs="verbatim,replacements,macros,-callouts"] +---- +base_base(); +---- + +[#base_base-2destructor] +== <>::~base_base + +Destructor should not be inherited + +=== Synopsis + +Declared in `<skip‐special.cpp>` + +[source,cpp,subs="verbatim,replacements,macros,-callouts"] +---- +~base_base(); +---- + +[#base_base-base_base_inherited] +== <>::base_base_inherited + +This function should be indirectly inherited by derived classes. + +=== Synopsis + +Declared in `<skip‐special.cpp>` + +[source,cpp,subs="verbatim,replacements,macros,-callouts"] +---- +<>& +base_base_inherited(); +---- + +[#base_base-do_base_base_inherited] +== <>::do_base_base_inherited + +This function should be indirectly inherited by derived classes. + +=== Synopsis + +Declared in `<skip‐special.cpp>` + +[source,cpp,subs="verbatim,replacements,macros,-callouts"] +---- +<>& +do_base_base_inherited(); +---- + +[#derived] +== derived + +=== Synopsis + +Declared in `<skip‐special.cpp>` + +[source,cpp,subs="verbatim,replacements,macros,-callouts"] +---- +class derived + : public <> + , public excluded_base; +---- + +=== Member Functions + +[cols=2] +|=== +| Name +| Description +| <> [.small]#[constructor]# +| Constructor should not be inherited +| <> [.small]#[destructor]# +| Destructor should not be inherited +| <> +| This function should be indirectly inherited by derived classes. +| <> +| This function should be inherited by derived classes. +| <> +| This function should shadow the excluded_base function. +| <> +| This function should shadow the base class function. +| <> +| This function should be indirectly inherited by derived classes. +| <> +| This function should shadow the base class function. +| <> +| This function should be inherited by derived classes. +|=== + +=== Protected Member Functions + +[cols=2] +|=== +| Name +| Description +| <> +| This function should be inherited by derived classes. +| <> +| This function should shadow the excluded_base function. +| <> +| This function should be shadowed by derived classes. +| <> +| This function should be inherited by derived classes. +| <> +| This function should be shadowed by derived classes. +|=== + +[#derived-2constructor] +== <>::derived + +Constructor should not be inherited + +=== Synopsis + +Declared in `<skip‐special.cpp>` + +[source,cpp,subs="verbatim,replacements,macros,-callouts"] +---- +derived(); +---- + +[#derived-2destructor] +== <>::~derived + +Destructor should not be inherited + +=== Synopsis + +Declared in `<skip‐special.cpp>` + +[source,cpp,subs="verbatim,replacements,macros,-callouts"] +---- +~derived(); +---- + +[#derived-derived_shadowed] +== <>::derived_shadowed + +This function should shadow the base class function. + +=== Synopsis + +Declared in `<skip‐special.cpp>` + +[source,cpp,subs="verbatim,replacements,macros,-callouts"] +---- +<>& +derived_shadowed(); +---- + +[#derived-do_derived_shadowed] +== <>::do_derived_shadowed + +This function should shadow the base class function. + +=== Synopsis + +Declared in `<skip‐special.cpp>` + +[source,cpp,subs="verbatim,replacements,macros,-callouts"] +---- +<>& +do_derived_shadowed(); +---- + +[#derived-excluded_inherited] +== <>::excluded_inherited + +This function should be inherited by derived classes. + +=== Synopsis + +Declared in `<skip‐special.cpp>` + +[source,cpp,subs="verbatim,replacements,macros,-callouts"] +---- +excluded_base& +excluded_inherited(); +---- + +[#derived-do_excluded_inherited] +== <>::do_excluded_inherited + +This function should be inherited by derived classes. + +=== Synopsis + +Declared in `<skip‐special.cpp>` + +[source,cpp,subs="verbatim,replacements,macros,-callouts"] +---- +excluded_base& +do_excluded_inherited(); +---- + +[#derived-do_shadowed] +== <>::do_shadowed + +This function should be shadowed by derived classes. + +=== Synopsis + +Declared in `<skip‐special.cpp>` + +[source,cpp,subs="verbatim,replacements,macros,-callouts"] +---- +excluded_base& +do_shadowed(); +---- + +[#private_derived] +== private_derived + +=== Synopsis + +Declared in `<skip‐special.cpp>` + +[source,cpp,subs="verbatim,replacements,macros,-callouts"] +---- +class private_derived + : <> + , excluded_base; +---- + +=== Member Functions + +[cols=2] +|=== +| Name +| Description +| <> [.small]#[constructor]# +| Constructor should not be inherited +| <> [.small]#[destructor]# +| Destructor should not be inherited +| <> +| This function should shadow the base class function. +| <> +| This function should shadow the base class function. +|=== + +[#private_derived-2constructor] +== <>::private_derived + +Constructor should not be inherited + +=== Synopsis + +Declared in `<skip‐special.cpp>` + +[source,cpp,subs="verbatim,replacements,macros,-callouts"] +---- +private_derived(); +---- + +[#private_derived-2destructor] +== <>::~private_derived + +Destructor should not be inherited + +=== Synopsis + +Declared in `<skip‐special.cpp>` + +[source,cpp,subs="verbatim,replacements,macros,-callouts"] +---- +~private_derived(); +---- + +[#private_derived-derived_shadowed] +== <>::derived_shadowed + +This function should shadow the base class function. + +=== Synopsis + +Declared in `<skip‐special.cpp>` + +[source,cpp,subs="verbatim,replacements,macros,-callouts"] +---- +<>& +derived_shadowed(); +---- + +[#private_derived-do_derived_shadowed] +== <>::do_derived_shadowed + +This function should shadow the base class function. + +=== Synopsis + +Declared in `<skip‐special.cpp>` + +[source,cpp,subs="verbatim,replacements,macros,-callouts"] +---- +<>& +do_derived_shadowed(); +---- + +[#protected_derived] +== protected_derived + +Should inherit functions as protected. + +=== Synopsis + +Declared in `<skip‐special.cpp>` + +[source,cpp,subs="verbatim,replacements,macros,-callouts"] +---- +class protected_derived + : protected <> + , protected excluded_base; +---- + +=== Member Functions + +[cols=2] +|=== +| Name +| Description +| <> [.small]#[constructor]# +| Constructor should not be inherited +| <> [.small]#[destructor]# +| Destructor should not be inherited +| <> +| This function should shadow the base class function. +| <> +| This function should shadow the base class function. +|=== + +=== Protected Member Functions + +[cols=2] +|=== +| Name +| Description +| <> +| This function should be indirectly inherited by derived classes. +| <> +| This function should be inherited by derived classes. +| <> +| This function should shadow the excluded_base function. +| <> +| This function should be shadowed by derived classes. +| <> +| This function should be indirectly inherited by derived classes. +| <> +| This function should be inherited by derived classes. +| <> +| This function should shadow the excluded_base function. +| <> +| This function should be shadowed by derived classes. +| <> +| This function should be inherited by derived classes. +| <> +| This function should be shadowed by derived classes. +| <> +| This function should be inherited by derived classes. +|=== + +[#protected_derived-2constructor] +== <>::protected_derived + +Constructor should not be inherited + +=== Synopsis + +Declared in `<skip‐special.cpp>` + +[source,cpp,subs="verbatim,replacements,macros,-callouts"] +---- +protected_derived(); +---- + +[#protected_derived-2destructor] +== <>::~protected_derived + +Destructor should not be inherited + +=== Synopsis + +Declared in `<skip‐special.cpp>` + +[source,cpp,subs="verbatim,replacements,macros,-callouts"] +---- +~protected_derived(); +---- + +[#protected_derived-derived_shadowed] +== <>::derived_shadowed + +This function should shadow the base class function. + +=== Synopsis + +Declared in `<skip‐special.cpp>` + +[source,cpp,subs="verbatim,replacements,macros,-callouts"] +---- +<>& +derived_shadowed(); +---- + +[#protected_derived-do_derived_shadowed] +== <>::do_derived_shadowed + +This function should shadow the base class function. + +=== Synopsis + +Declared in `<skip‐special.cpp>` + +[source,cpp,subs="verbatim,replacements,macros,-callouts"] +---- +<>& +do_derived_shadowed(); +---- + +[#protected_derived-do_excluded_inherited] +== <>::do_excluded_inherited + +This function should be inherited by derived classes. + +=== Synopsis + +Declared in `<skip‐special.cpp>` + +[source,cpp,subs="verbatim,replacements,macros,-callouts"] +---- +excluded_base& +do_excluded_inherited(); +---- + +[#protected_derived-do_shadowed] +== <>::do_shadowed + +This function should be shadowed by derived classes. + +=== Synopsis + +Declared in `<skip‐special.cpp>` + +[source,cpp,subs="verbatim,replacements,macros,-callouts"] +---- +excluded_base& +do_shadowed(); +---- + +[#protected_derived-excluded_inherited] +== <>::excluded_inherited + +This function should be inherited by derived classes. + +=== Synopsis + +Declared in `<skip‐special.cpp>` + +[source,cpp,subs="verbatim,replacements,macros,-callouts"] +---- +excluded_base& +excluded_inherited(); +---- + + +[.small]#Created with https://www.mrdocs.com[MrDocs]# diff --git a/test-files/golden-tests/config/inherit-base-members/skip-special.cpp b/test-files/golden-tests/config/inherit-base-members/skip-special.cpp new file mode 100644 index 0000000000..3563c85fbe --- /dev/null +++ b/test-files/golden-tests/config/inherit-base-members/skip-special.cpp @@ -0,0 +1,117 @@ +class excluded_base { +public: + /// Constructor should not be inherited + excluded_base(); + + /// Destructor should not be inherited + ~excluded_base(); + + /// This function should be shadowed by derived classes. + excluded_base& derived_shadowed(); + /// This function should be shadowed by the base class. + excluded_base& base_shadowed(); + /// This function should be inherited by derived classes. + excluded_base& excluded_inherited(); +protected: + /// This function should be shadowed by derived classes. + excluded_base& do_shadowed(); + /// This function should be shadowed by the base class. + excluded_base& do_base_shadowed(); + /// This function should be inherited by derived classes. + excluded_base& do_excluded_inherited(); +}; + +class base_base { +public: + /// Constructor should not be inherited + base_base(); + + /// Destructor should not be inherited + ~base_base(); + + /// This function should be indirectly inherited by derived classes. + base_base& base_base_inherited(); +public: + /// This function should be indirectly inherited by derived classes. + base_base& do_base_base_inherited(); +}; + +class base : + public base_base +{ +public: + /// Constructor should not be inherited + base(); + + /// Destructor should not be inherited + ~base(); + + /// This function should be shadowed by derived classes. + base& derived_shadowed(); + /// This function should shadow the excluded_base function. + base& base_shadowed(); + /// This function should be inherited by derived classes. + base& base_inherited(); +protected: + /// This function should be shadowed by derived classes. + base& do_derived_shadowed(); + /// This function should shadow the excluded_base function. + base& do_base_shadowed(); + /// This function should be inherited by derived classes. + base& do_base_inherited(); +}; + +class derived + : public base + , public excluded_base +{ +public: + /// Constructor should not be inherited + derived(); + + /// Destructor should not be inherited + ~derived(); + + /// This function should shadow the base class function. + derived& derived_shadowed(); +public: + /// This function should shadow the base class function. + derived& do_derived_shadowed(); +}; + +/// Should inherit functions as protected. +class protected_derived + : protected base + , protected excluded_base +{ +public: + /// Constructor should not be inherited + protected_derived(); + + /// Destructor should not be inherited + ~protected_derived(); + + /// This function should shadow the base class function. + protected_derived& derived_shadowed(); +public: + /// This function should shadow the base class function. + protected_derived& do_derived_shadowed(); +}; + +class private_derived + : private base + , private excluded_base +{ +public: + /// Constructor should not be inherited + private_derived(); + + /// Destructor should not be inherited + ~private_derived(); + + /// This function should shadow the base class function. + private_derived& derived_shadowed(); +public: + /// This function should shadow the base class function. + private_derived& do_derived_shadowed(); +}; 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 new file mode 100644 index 0000000000..d4c3bcd2ca --- /dev/null +++ b/test-files/golden-tests/config/inherit-base-members/skip-special.html @@ -0,0 +1,904 @@ + + +Reference + + +
+

Reference

+
+
+

Global namespace

+
+

Types

+ + + + + + + + + + + + + + + +
NameDescription
base
base_base
derived
private_derived
protected_derived Should inherit functions as protected.
+ +
+
+
+

base

+
+
+

Synopsis

+
+Declared in <skip-special.cpp>
+
+
+class base
+    : public base_base;
+
+
+
+

Member Functions

+ + + + + + + + + + + + + + + + + +
NameDescription
base [constructor]Constructor should not be inherited
~base [destructor]Destructor should not be inherited
base_base_inherited This function should be indirectly inherited by derived classes.
base_inherited This function should be inherited by derived classes.
base_shadowed This function should shadow the excluded_base function.
derived_shadowed This function should be shadowed by derived classes.
do_base_base_inherited This function should be indirectly inherited by derived classes.
+ + +

Protected Member Functions

+ + + + + + + + + + + + + +
NameDescription
do_base_inherited This function should be inherited by derived classes.
do_base_shadowed This function should shadow the excluded_base function.
do_derived_shadowed This function should be shadowed by derived classes.
+ + +
+

Derived Classes

+ + + + + + + + + + +
NameDescription
derived +
+
+
+
+
+

base::base

+
+Constructor should not be inherited + +
+
+
+

Synopsis

+
+Declared in <skip-special.cpp>
+
+
+base();
+
+
+
+
+
+
+

base::~base

+
+Destructor should not be inherited + +
+
+
+

Synopsis

+
+Declared in <skip-special.cpp>
+
+
+~base();
+
+
+
+
+
+
+

base::base_inherited

+
+This function should be inherited by derived classes. + +
+
+
+

Synopsis

+
+Declared in <skip-special.cpp>
+
+
+base&
+base_inherited();
+
+
+
+
+
+
+

base::base_shadowed

+
+This function should shadow the excluded_base function. + +
+
+
+

Synopsis

+
+Declared in <skip-special.cpp>
+
+
+base&
+base_shadowed();
+
+
+
+
+
+
+

base::derived_shadowed

+
+This function should be shadowed by derived classes. + +
+
+
+

Synopsis

+
+Declared in <skip-special.cpp>
+
+
+base&
+derived_shadowed();
+
+
+
+
+
+
+

base::do_base_inherited

+
+This function should be inherited by derived classes. + +
+
+
+

Synopsis

+
+Declared in <skip-special.cpp>
+
+
+base&
+do_base_inherited();
+
+
+
+
+
+
+

base::do_base_shadowed

+
+This function should shadow the excluded_base function. + +
+
+
+

Synopsis

+
+Declared in <skip-special.cpp>
+
+
+base&
+do_base_shadowed();
+
+
+
+
+
+
+

base::do_derived_shadowed

+
+This function should be shadowed by derived classes. + +
+
+
+

Synopsis

+
+Declared in <skip-special.cpp>
+
+
+base&
+do_derived_shadowed();
+
+
+
+
+
+
+

base_base

+
+
+

Synopsis

+
+Declared in <skip-special.cpp>
+
+
+class base_base;
+
+
+
+

Member Functions

+ + + + + + + + + + + + + + +
NameDescription
base_base [constructor]Constructor should not be inherited
~base_base [destructor]Destructor should not be inherited
base_base_inherited This function should be indirectly inherited by derived classes.
do_base_base_inherited This function should be indirectly inherited by derived classes.
+ + + +
+

Derived Classes

+ + + + + + + + + + +
NameDescription
base +
+
+
+
+
+

base_base::base_base

+
+Constructor should not be inherited + +
+
+
+

Synopsis

+
+Declared in <skip-special.cpp>
+
+
+base_base();
+
+
+
+
+
+
+

base_base::~base_base

+
+Destructor should not be inherited + +
+
+
+

Synopsis

+
+Declared in <skip-special.cpp>
+
+
+~base_base();
+
+
+
+
+
+
+

base_base::base_base_inherited

+
+This function should be indirectly inherited by derived classes. + +
+
+
+

Synopsis

+
+Declared in <skip-special.cpp>
+
+
+base_base&
+base_base_inherited();
+
+
+
+
+
+
+

base_base::do_base_base_inherited

+
+This function should be indirectly inherited by derived classes. + +
+
+
+

Synopsis

+
+Declared in <skip-special.cpp>
+
+
+base_base&
+do_base_base_inherited();
+
+
+
+
+
+
+

derived

+
+
+

Synopsis

+
+Declared in <skip-special.cpp>
+
+
+class derived
+    : public base
+    , public excluded_base;
+
+
+
+

Member Functions

+ + + + + + + + + + + + + + + + + + + +
NameDescription
derived [constructor]Constructor should not be inherited
~derived [destructor]Destructor should not be inherited
base_base_inherited This function should be indirectly inherited by derived classes.
base_inherited This function should be inherited by derived classes.
base_shadowed This function should shadow the excluded_base function.
derived_shadowed This function should shadow the base class function.
do_base_base_inherited This function should be indirectly inherited by derived classes.
do_derived_shadowed This function should shadow the base class function.
excluded_inherited This function should be inherited by derived classes.
+ + +

Protected Member Functions

+ + + + + + + + + + + + + + + +
NameDescription
do_base_inherited This function should be inherited by derived classes.
do_base_shadowed This function should shadow the excluded_base function.
do_derived_shadowed This function should be shadowed by derived classes.
do_excluded_inherited This function should be inherited by derived classes.
do_shadowed This function should be shadowed by derived classes.
+ + +
+
+
+

derived::derived

+
+Constructor should not be inherited + +
+
+
+

Synopsis

+
+Declared in <skip-special.cpp>
+
+
+derived();
+
+
+
+
+
+
+

derived::~derived

+
+Destructor should not be inherited + +
+
+
+

Synopsis

+
+Declared in <skip-special.cpp>
+
+
+~derived();
+
+
+
+
+
+
+

derived::derived_shadowed

+
+This function should shadow the base class function. + +
+
+
+

Synopsis

+
+Declared in <skip-special.cpp>
+
+
+derived&
+derived_shadowed();
+
+
+
+
+
+
+

derived::do_derived_shadowed

+
+This function should shadow the base class function. + +
+
+
+

Synopsis

+
+Declared in <skip-special.cpp>
+
+
+derived&
+do_derived_shadowed();
+
+
+
+
+
+
+

derived::excluded_inherited

+
+This function should be inherited by derived classes. + +
+
+
+

Synopsis

+
+Declared in <skip-special.cpp>
+
+
+excluded_base&
+excluded_inherited();
+
+
+
+
+
+
+

derived::do_excluded_inherited

+
+This function should be inherited by derived classes. + +
+
+
+

Synopsis

+
+Declared in <skip-special.cpp>
+
+
+excluded_base&
+do_excluded_inherited();
+
+
+
+
+
+
+

derived::do_shadowed

+
+This function should be shadowed by derived classes. + +
+
+
+

Synopsis

+
+Declared in <skip-special.cpp>
+
+
+excluded_base&
+do_shadowed();
+
+
+
+
+
+
+

private_derived

+
+
+

Synopsis

+
+Declared in <skip-special.cpp>
+
+
+class private_derived
+    : base
+    , excluded_base;
+
+
+
+

Member Functions

+ + + + + + + + + + + + + + +
NameDescription
private_derived [constructor]Constructor should not be inherited
~private_derived [destructor]Destructor should not be inherited
derived_shadowed This function should shadow the base class function.
do_derived_shadowed This function should shadow the base class function.
+ + + +
+
+
+

private_derived::private_derived

+
+Constructor should not be inherited + +
+
+
+

Synopsis

+
+Declared in <skip-special.cpp>
+
+
+private_derived();
+
+
+
+
+
+
+

private_derived::~private_derived

+
+Destructor should not be inherited + +
+
+
+

Synopsis

+
+Declared in <skip-special.cpp>
+
+
+~private_derived();
+
+
+
+
+
+
+

private_derived::derived_shadowed

+
+This function should shadow the base class function. + +
+
+
+

Synopsis

+
+Declared in <skip-special.cpp>
+
+
+private_derived&
+derived_shadowed();
+
+
+
+
+
+
+

private_derived::do_derived_shadowed

+
+This function should shadow the base class function. + +
+
+
+

Synopsis

+
+Declared in <skip-special.cpp>
+
+
+private_derived&
+do_derived_shadowed();
+
+
+
+
+
+
+

protected_derived

+
+Should inherit functions as protected. + +
+
+
+

Synopsis

+
+Declared in <skip-special.cpp>
+
+
+class protected_derived
+    : protected base
+    , protected excluded_base;
+
+
+
+

Member Functions

+ + + + + + + + + + + + + + +
NameDescription
protected_derived [constructor]Constructor should not be inherited
~protected_derived [destructor]Destructor should not be inherited
derived_shadowed This function should shadow the base class function.
do_derived_shadowed This function should shadow the base class function.
+ + +

Protected Member Functions

+ + + + + + + + + + + + + + + + + + + + + +
NameDescription
base_base_inherited This function should be indirectly inherited by derived classes.
base_inherited This function should be inherited by derived classes.
base_shadowed This function should shadow the excluded_base function.
derived_shadowed This function should be shadowed by derived classes.
do_base_base_inherited This function should be indirectly inherited by derived classes.
do_base_inherited This function should be inherited by derived classes.
do_base_shadowed This function should shadow the excluded_base function.
do_derived_shadowed This function should be shadowed by derived classes.
do_excluded_inherited This function should be inherited by derived classes.
do_shadowed This function should be shadowed by derived classes.
excluded_inherited This function should be inherited by derived classes.
+ + +
+
+
+

protected_derived::protected_derived

+
+Constructor should not be inherited + +
+
+
+

Synopsis

+
+Declared in <skip-special.cpp>
+
+
+protected_derived();
+
+
+
+
+
+
+

protected_derived::~protected_derived

+
+Destructor should not be inherited + +
+
+
+

Synopsis

+
+Declared in <skip-special.cpp>
+
+
+~protected_derived();
+
+
+
+
+
+
+

protected_derived::derived_shadowed

+
+This function should shadow the base class function. + +
+
+
+

Synopsis

+
+Declared in <skip-special.cpp>
+
+
+protected_derived&
+derived_shadowed();
+
+
+
+
+
+
+

protected_derived::do_derived_shadowed

+
+This function should shadow the base class function. + +
+
+
+

Synopsis

+
+Declared in <skip-special.cpp>
+
+
+protected_derived&
+do_derived_shadowed();
+
+
+
+
+
+
+

protected_derived::do_excluded_inherited

+
+This function should be inherited by derived classes. + +
+
+
+

Synopsis

+
+Declared in <skip-special.cpp>
+
+
+excluded_base&
+do_excluded_inherited();
+
+
+
+
+
+
+

protected_derived::do_shadowed

+
+This function should be shadowed by derived classes. + +
+
+
+

Synopsis

+
+Declared in <skip-special.cpp>
+
+
+excluded_base&
+do_shadowed();
+
+
+
+
+
+
+

protected_derived::excluded_inherited

+
+This function should be inherited by derived classes. + +
+
+
+

Synopsis

+
+Declared in <skip-special.cpp>
+
+
+excluded_base&
+excluded_inherited();
+
+
+
+
+ +
+
+

Created with MrDocs

+
+ + \ No newline at end of file diff --git a/test-files/golden-tests/config/inherit-base-members/skip-special.xml b/test-files/golden-tests/config/inherit-base-members/skip-special.xml new file mode 100644 index 0000000000..e4a4293da3 --- /dev/null +++ b/test-files/golden-tests/config/inherit-base-members/skip-special.xml @@ -0,0 +1,608 @@ + + + + + + + + + + + + + Constructor should not be inherited + + + + + + + + Destructor should not be inherited + + + + + + + + + + + + + This function should be indirectly inherited by derived classes. + + + + + + + + + + + + + This function should be inherited by derived classes. + + + + + + + + + + + + + This function should shadow the excluded_base function. + + + + + + + + + + + + + This function should be shadowed by derived classes. + + + + + + + + + + + + + This function should be indirectly inherited by derived classes. + + + + + + + + + + + + + This function should be inherited by derived classes. + + + + + + + + + + + + + This function should shadow the excluded_base function. + + + + + + + + + + + + + This function should be shadowed by derived classes. + + + + + + + + + + + Constructor should not be inherited + + + + + + + + Destructor should not be inherited + + + + + + + + + + + + + This function should be indirectly inherited by derived classes. + + + + + + + + + + + + + This function should be indirectly inherited by derived classes. + + + + + + + + + + + + + + + + + Constructor should not be inherited + + + + + + + + Destructor should not be inherited + + + + + + + + + + + + + This function should be indirectly inherited by derived classes. + + + + + + + + + + + + + This function should be inherited by derived classes. + + + + + + + + + + + + + This function should shadow the excluded_base function. + + + + + + + + + + + + + This function should shadow the base class function. + + + + + + + + + + + + + This function should be indirectly inherited by derived classes. + + + + + + + + + + + + + This function should shadow the base class function. + + + + + + + + + + + + + This function should be inherited by derived classes. + + + + + + + + + + + + + This function should be inherited by derived classes. + + + + + + + + + + + + + This function should shadow the excluded_base function. + + + + + + + + + + + + + This function should be shadowed by derived classes. + + + + + + + + + + + + + This function should be inherited by derived classes. + + + + + + + + + + + + + This function should be shadowed by derived classes. + + + + + + + + + + + + + + + + + Constructor should not be inherited + + + + + + + + Destructor should not be inherited + + + + + + + + + + + + + This function should shadow the base class function. + + + + + + + + + + + + + This function should shadow the base class function. + + + + + + + + + + + + + + + Should inherit functions as protected. + + + + + + + Constructor should not be inherited + + + + + + + + Destructor should not be inherited + + + + + + + + + + + + + This function should shadow the base class function. + + + + + + + + + + + + + This function should shadow the base class function. + + + + + + + + + + + + + This function should be indirectly inherited by derived classes. + + + + + + + + + + + + + This function should be inherited by derived classes. + + + + + + + + + + + + + This function should shadow the excluded_base function. + + + + + + + + + + + + + This function should be shadowed by derived classes. + + + + + + + + + + + + + This function should be indirectly inherited by derived classes. + + + + + + + + + + + + + This function should be inherited by derived classes. + + + + + + + + + + + + + This function should shadow the excluded_base function. + + + + + + + + + + + + + This function should be shadowed by derived classes. + + + + + + + + + + + + + This function should be inherited by derived classes. + + + + + + + + + + + + + This function should be shadowed by derived classes. + + + + + + + + + + + + + This function should be inherited by derived classes. + + + + + + diff --git a/test-files/golden-tests/config/inherit-base-members/skip-special.yml b/test-files/golden-tests/config/inherit-base-members/skip-special.yml new file mode 100644 index 0000000000..9d5f260102 --- /dev/null +++ b/test-files/golden-tests/config/inherit-base-members/skip-special.yml @@ -0,0 +1,5 @@ +inherit-base-members: copy-dependencies +exclude-symbols: + - excluded_base +extract-private-bases: true +warn-no-paramdoc: false