diff --git a/include/mrdocs/Metadata/Type.hpp b/include/mrdocs/Metadata/Type.hpp index 4570140727..679ecdfe9c 100644 --- a/include/mrdocs/Metadata/Type.hpp +++ b/include/mrdocs/Metadata/Type.hpp @@ -208,11 +208,185 @@ struct TypeInfoCommonBase : TypeInfo } }; +/** 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. + + @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::optional FundamentalType; + std::strong_ordering operator<=>(NamedTypeInfo const& other) const; }; diff --git a/include/mrdocs/Support/Algorithm.hpp b/include/mrdocs/Support/Algorithm.hpp index 4293af0667..8ea4a15beb 100644 --- a/include/mrdocs/Support/Algorithm.hpp +++ b/include/mrdocs/Support/Algorithm.hpp @@ -26,7 +26,9 @@ requires std::equality_comparable_with> bool contains(Range const& range, El const& el) { - return std::find(range.begin(), range.end(), el) != range.end(); + return std::find( + std::ranges::begin(range), + std::ranges::end(range), el) != std::ranges::end(range); } // A second overload where the range is an initializer list @@ -41,7 +43,9 @@ requires std::equality_comparable_with bool contains(std::initializer_list const& range, U const& el) { - return std::find(range.begin(), range.end(), el) != range.end(); + return std::find( + std::ranges::begin(range), + std::ranges::end(range), el) != std::ranges::end(range); } /** Determine if a range contains any of the specified elements. @@ -54,15 +58,16 @@ requires std::equality_comparable_with, std::ran bool contains_any(Range const& range, Els const& els) { - return std::ranges::find_first_of(range, els) != range.end(); + return std::ranges::find_first_of(range, els) != std::ranges::end(range); } +/// @copydoc contains_any(Range const&, Els const&) template requires std::equality_comparable_with> bool contains_any(Range const& range, std::initializer_list const& els) { - return std::ranges::find_first_of(range, els) != range.end(); + return std::ranges::find_first_of(range, els) != std::ranges::end(range); } /** Determine if a range contains at least N instances of the specified element. @@ -90,10 +95,55 @@ contains_n(Range const& range, El const& el, std::size_t n) return false; } +/** Determine if a range contains at least N instances of any of the specified elements. + @param range The range to search. + @param els The elements to search for. + @param n The number of instances to search for. + @return True if the element is found, false otherwise. + */ +template +requires std::equality_comparable_with, std::ranges::range_value_t> +bool +contains_n_any(Range const& range, Els const& els, std::size_t n) +{ + for (auto const& item : range) + { + if (contains(els, item)) + { + --n; + if (n == 0) + { + return true; + } + } + } + return false; +} + +/// @copydoc contains_n_any(Range const&, Els const&, std::size_t) +template +requires std::equality_comparable_with> +bool +contains_n_any(Range const& range, std::initializer_list const& els, std::size_t n) +{ + for (auto const& item : range) + { + if (contains(els, item)) + { + --n; + if (n == 0) + { + return true; + } + } + } + return false; +} + /** Find the last element in a range that matches an element in the specified range. @param range The range to search. @param els The elements to search for. - @return An iterator to the last element found, or range.end() if not found. + @return An iterator to the last element found, or std::ranges::end(range) if not found. */ template requires std::equality_comparable_with, std::ranges::range_value_t> diff --git a/src/lib/AST/ClangHelpers.cpp b/src/lib/AST/ClangHelpers.cpp index 3f3d995b4b..23d84ffd77 100644 --- a/src/lib/AST/ClangHelpers.cpp +++ b/src/lib/AST/ClangHelpers.cpp @@ -281,7 +281,7 @@ decayToPrimaryTemplate(Decl const* D) SmallString<128> symbolName; llvm::raw_svector_ostream os(symbolName); D->print(os); - report::debug("symbolName: ", std::string_view(os.str())); + report::trace("symbolName: ", std::string_view(os.str())); #endif Decl const* ID = D; diff --git a/src/lib/AST/ClangHelpers.hpp b/src/lib/AST/ClangHelpers.hpp index 1be300ae77..d33c9bab89 100644 --- a/src/lib/AST/ClangHelpers.hpp +++ b/src/lib/AST/ClangHelpers.hpp @@ -500,7 +500,7 @@ toFunctionClass(Decl::Kind const kind) */ inline AutoKind -convertToAutoKind(AutoTypeKeyword const kind) +toAutoKind(AutoTypeKeyword const kind) { switch(kind) { @@ -514,6 +514,63 @@ convertToAutoKind(AutoTypeKeyword const kind) } } +/** Convert a Clang AutoTypeKeyword into a MrDocs AutoKind + */ +inline +std::optional +toFundamentalTypeKind(BuiltinType::Kind const kind) +{ + switch(kind) + { + case BuiltinType::Kind::Void: + return FundamentalTypeKind::Void; + case BuiltinType::Kind::NullPtr: + return FundamentalTypeKind::Nullptr; + case BuiltinType::Kind::Bool: + return FundamentalTypeKind::Bool; + case BuiltinType::Kind::Char_U: + case BuiltinType::Kind::Char_S: + return FundamentalTypeKind::Char; + case BuiltinType::Kind::SChar: + return FundamentalTypeKind::SignedChar; + case BuiltinType::Kind::UChar: + return FundamentalTypeKind::UnsignedChar; + case BuiltinType::Kind::Char8: + return FundamentalTypeKind::Char8; + case BuiltinType::Kind::Char16: + return FundamentalTypeKind::Char16; + case BuiltinType::Kind::Char32: + return FundamentalTypeKind::Char32; + case BuiltinType::Kind::WChar_S: + case BuiltinType::Kind::WChar_U: + return FundamentalTypeKind::WChar; + case BuiltinType::Kind::Short: + return FundamentalTypeKind::Short; + case BuiltinType::Kind::UShort: + return FundamentalTypeKind::UnsignedShort; + case BuiltinType::Kind::Int: + return FundamentalTypeKind::Int; + case BuiltinType::Kind::UInt: + return FundamentalTypeKind::UnsignedInt; + case BuiltinType::Kind::Long: + return FundamentalTypeKind::Long; + case BuiltinType::Kind::ULong: + return FundamentalTypeKind::UnsignedLong; + case BuiltinType::Kind::LongLong: + return FundamentalTypeKind::LongLong; + case BuiltinType::Kind::ULongLong: + return FundamentalTypeKind::UnsignedLongLong; + case BuiltinType::Kind::Float: + return FundamentalTypeKind::Float; + case BuiltinType::Kind::Double: + return FundamentalTypeKind::Double; + case BuiltinType::Kind::LongDouble: + return FundamentalTypeKind::LongDouble; + default: + return std::nullopt; + } +} + // ---------------------------------------------------------------- /** Visit a Decl and call the appropriate visitor function. diff --git a/src/lib/AST/ParseJavadoc.cpp b/src/lib/AST/ParseJavadoc.cpp index 751563c75c..081a9e2b37 100644 --- a/src/lib/AST/ParseJavadoc.cpp +++ b/src/lib/AST/ParseJavadoc.cpp @@ -79,7 +79,7 @@ namespace detail { #define MRDOCS_COMMENT_TRACE(D, C) \ SmallString<1024> MRDOCS_COMMENT_TRACE_UNIQUE_NAME; \ ::detail::dumpCommentContent(D, C, MRDOCS_COMMENT_TRACE_UNIQUE_NAME); \ - report::debug("{}", std::string_view(MRDOCS_COMMENT_TRACE_UNIQUE_NAME.str())) + report::trace("{}", std::string_view(MRDOCS_COMMENT_TRACE_UNIQUE_NAME.str())) #endif diff --git a/src/lib/AST/ParseRef.cpp b/src/lib/AST/ParseRef.cpp index fcb5174f7b..b5cff716ed 100644 --- a/src/lib/AST/ParseRef.cpp +++ b/src/lib/AST/ParseRef.cpp @@ -820,6 +820,16 @@ class RefParser bool parseDeclarationSpecifiers(Polymorphic& dest) { + static constexpr std::string_view typeQualifiers[] = { + "const", "volatile" + }; + static constexpr std::string_view typeModifiers[] = { + "long", "short", "signed", "unsigned" + }; + static constexpr std::string_view typeSpecifiers[] = { + "long", "short", "signed", "unsigned", "const", "volatile" + }; + // https://en.cppreference.com/w/cpp/language/declarations#Specifiers // decl-specifier-seq is a sequence whitespace-separated decl-specifier's char const* start = ptr_; @@ -842,111 +852,106 @@ class RefParser // specifiers, then we don't have an error because // we can later infer the type from these. if (!dest && - !contains_any(specifiers, {"long", "short", "signed", "unsigned"})) + !contains_any(specifiers, typeModifiers)) { setError(specStart, "expected declaration specifier"); ptr_ = start; return false; } + // Clear the error and let the type modifiers set `dest` error_.clear(); error_pos_ = nullptr; - return true; + break; } auto const specifierStr = trim(std::string_view(specStart, ptr_ - specStart)); - if (!specifiers.empty()) - { - // If we already have a declaration specifier, we need to - // check if we have a valid sequence of specifiers: - // - In general, only one type specifier is allowed - // - "const" and "volatile" can be combined with any type specifier - // except itself - if (specifierStr == "const" && - contains(specifiers, "const")) - { - setError(specStart, "multiple 'const' specifiers"); - ptr_ = start; - return false; - } - - if (specifierStr == "volatile" && - contains(specifiers, "volatile")) - { - setError(specStart, "multiple 'volatile' specifiers"); - ptr_ = start; - return false; - } - - // - "signed" or "unsigned" can be combined with "char", "long", "short", or "int". - if (contains({"signed", "unsigned"}, specifierStr) && - contains_any(specifiers, {"signed", "unsigned"})) - { - setError(specStart, "multiple 'signed' or 'unsigned' specifiers"); - ptr_ = start; - return false; - } - - // - "short" or "long" can be combined with int. - // - "long" can be combined with "double" and "long" - // "short" is allowed only once - // "long" is allowed twice - if (specifierStr == "short") - { - if (contains(specifiers, "short")) - { - setError(specStart, "multiple 'short' specifiers"); - ptr_ = start; - return false; - } - if (contains(specifiers, "long")) - { - setError(specStart, "cannot combine 'short' with 'long'"); - ptr_ = start; - return false; - } - } - - if (specifierStr == "long") - { - if (contains_n(specifiers, "long", 2)) - { - setError(specStart, "too many 'long' specifiers"); - ptr_ = start; - return false; - } - if (contains(specifiers, "short")) - { - setError(specStart, "cannot combine 'long' with 'short'"); - ptr_ = start; - return false; - } - } + if (contains(typeSpecifiers, specifierStr)) + { + specifiers.push_back(specifierStr); } - specifiers.push_back(specifierStr); if (!skipWhitespace()) { break; } } - if (specifiers.empty()) + if (!dest && specifiers.empty()) { - // We need at least one declarator specifier + // We need at least one type declarator or specifier ptr_ = start; return false; } + // Look for conflicting specifiers + if (specifiers.size() > 1) + { + // If we already have a declaration specifier, we need to + // check if we have a valid sequence of specifiers: + // - In general, only one type specifier is allowed + // - "const" and "volatile" can be combined with any type specifier + // except itself + if (contains_n(specifiers, "const", 2)) + { + setError(start, "multiple 'const' specifiers"); + ptr_ = start; + return false; + } + + if (contains_n(specifiers, "volatile", 2)) + { + setError(start, "multiple 'volatile' specifiers"); + ptr_ = start; + return false; + } + + // - "signed" or "unsigned" can be combined with "char", "long", "short", or "int". + if (contains_n_any(specifiers, {"signed", "unsigned"}, 2)) + { + setError(start, "multiple 'signed' or 'unsigned' specifiers"); + ptr_ = start; + return false; + } + + // - "short" or "long" can be combined with int. + // - "long" can be combined with "double" and "long" + // "short" is allowed only once + // "long" is allowed twice + if (contains_n(specifiers, "short", 2)) + { + setError(start, "too many 'short' specifiers"); + ptr_ = start; + return false; + } + + if (contains(specifiers, "short") && + contains(specifiers, "long")) + { + setError(start, "cannot combine 'short' with 'long'"); + ptr_ = start; + return false; + } + + if (contains_n(specifiers, "long", 3)) + { + setError(start, "too many 'long' specifiers"); + ptr_ = start; + return false; + } + } + // "signed" or "unsigned" can be combined with "char", "long", "short", or "int". if (contains_any(specifiers, {"signed", "unsigned"})) { bool explicitlySigned = contains(specifiers, "signed"); std::string_view signStr = explicitlySigned ? "signed" : "unsigned"; - // Infer basic fundamental type from "signed" or "unsigned" + // Infer basic fundamental type from "signed" or "unsigned", + // which is "int" if (!dest) { NamedTypeInfo NTI; NameInfo NI; NI.Name = "int"; NTI.Name = NI; + NTI.FundamentalType = FundamentalTypeKind::Int; dest = NTI; } // Check if the type is named @@ -958,26 +963,37 @@ class RefParser } // Check if the type is "int" or "char" auto& namedParam = dynamic_cast(*dest); - if (!contains({"int", "char"}, namedParam.Name->Name)) + if (!namedParam.FundamentalType) + { + setError(fmt::format("expected fundamental type for '{}' specifier", signStr)); + ptr_ = start; + return false; + } + bool promoted = + explicitlySigned ? + makeSigned(*namedParam.FundamentalType) : + makeUnsigned(*namedParam.FundamentalType); + if (!promoted) { setError(fmt::format("expected 'int' or 'char' for '{}' specifier", signStr)); ptr_ = start; return false; } // Add the specifier to the type name - namedParam.Name->Name = fmt::format("{} {}", signStr, namedParam.Name->Name); + namedParam.Name->Name = toString(*namedParam.FundamentalType); } // - "short" can be combined with int. if (contains(specifiers, "short")) { - // Infer basic fundamental type from "short" + // Infer basic fundamental type for "short", which is "int" if (!dest) { NamedTypeInfo NTI; NameInfo NI; NI.Name = "int"; NTI.Name = NI; + NTI.FundamentalType = FundamentalTypeKind::Int; dest = NTI; } // Check if the type is named @@ -987,28 +1003,37 @@ class RefParser ptr_ = start; return false; } + // Check if the type is "int" auto& namedParam = dynamic_cast(*dest); - if (!contains({"int", "signed int", "unsigned int"}, namedParam.Name->Name)) + if (!namedParam.FundamentalType) + { + setError(start, "expected fundamental type for 'short' specifier"); + ptr_ = start; + return false; + } + if (bool promoted = makeShort(*namedParam.FundamentalType); + !promoted) { setError(start, "expected 'int' for 'short' specifier"); ptr_ = start; return false; } // Add the specifier to the type name - namedParam.Name->Name = fmt::format("short {}", namedParam.Name->Name); + namedParam.Name->Name = toString(*namedParam.FundamentalType); } // - "long" can be combined with "int", "double" and "long" if (contains(specifiers, "long")) { - // Infer basic fundamental type from "long" + // Infer basic fundamental type for "long", which is "int" if (!dest) { NamedTypeInfo NTI; NameInfo NI; NI.Name = "int"; NTI.Name = NI; + NTI.FundamentalType = FundamentalTypeKind::Int; dest = NTI; } // Check if the type is named @@ -1019,15 +1044,31 @@ class RefParser return false; } auto& namedParam = dynamic_cast(*dest); - if (!contains({"int", "signed int", "unsigned int", "double"}, namedParam.Name->Name)) + if (!namedParam.FundamentalType) + { + setError(start, "expected fundamental type for 'long' specifier"); + ptr_ = start; + return false; + } + if (bool const promoted = makeLong(*namedParam.FundamentalType); + !promoted) { setError(start, "expected 'int' or 'double' for 'long' specifier"); ptr_ = start; return false; } + if (contains_n(specifiers, "long", 2)) + { + bool const promoted = makeLong(*namedParam.FundamentalType); + if (!promoted) + { + setError(start, "expected 'int' or 'double' for 'long long' specifier"); + ptr_ = start; + return false; + } + } // Add the specifier to the type name - bool const isLongLong = contains_n(specifiers, "long", 2); - namedParam.Name->Name = fmt::format("{} {}", isLongLong ? "long long" : "long", namedParam.Name->Name); + namedParam.Name->Name = toString(*namedParam.FundamentalType); } // Final check: if dest is still empty, we have an error @@ -1105,7 +1146,12 @@ class RefParser NameInfo NI; NI.Name = std::string_view(start, ptr_ - start); NTI.Name = NI; - dest = NTI; + if (FundamentalTypeKind k; + fromString(NI.Name, k)) + { + NTI.FundamentalType = k; + } + dest = std::move(NTI); return true; } diff --git a/src/lib/AST/TypeInfoBuilder.cpp b/src/lib/AST/TypeInfoBuilder.cpp index 8f8bb71a7a..a07a77101e 100644 --- a/src/lib/AST/TypeInfoBuilder.cpp +++ b/src/lib/AST/TypeInfoBuilder.cpp @@ -126,7 +126,7 @@ buildAuto( AutoTypeInfo I; I.IsConst = quals & Qualifiers::Const; I.IsVolatile = quals & Qualifiers::Volatile; - I.Keyword = convertToAutoKind(T->getKeyword()); + I.Keyword = toAutoKind(T->getKeyword()); if(T->isConstrained()) { std::optional> TArgs; @@ -153,12 +153,18 @@ buildTerminal( unsigned quals, bool pack) { + MRDOCS_SYMBOL_TRACE(T, getASTVisitor().context_); NamedTypeInfo TI; TI.IsConst = quals & Qualifiers::Const; TI.IsVolatile = quals & Qualifiers::Volatile; TI.Name = MakePolymorphic(); TI.Name->Name = getASTVisitor().toString(T); TI.Name->Prefix = getASTVisitor().toNameInfo(NNS); + if (isa(T)) + { + auto const* FT = cast(T); + TI.FundamentalType = toFundamentalTypeKind(FT->getKind()); + } TI.Constraints = this->Constraints; *Inner = std::move(TI); Result->Constraints = this->Constraints; diff --git a/src/lib/Metadata/Type.cpp b/src/lib/Metadata/Type.cpp index 7db9df5cdf..91969e7ab0 100644 --- a/src/lib/Metadata/Type.cpp +++ b/src/lib/Metadata/Type.cpp @@ -324,6 +324,17 @@ operator<=>(NamedTypeInfo const& other) const { return br; } + bool const LhsHoldsFundamentalType = static_cast(FundamentalType); + bool const RhsHoldsFundamentalType = static_cast(other.FundamentalType); + if (auto const r = LhsHoldsFundamentalType <=> RhsHoldsFundamentalType; + !std::is_eq(r)) + { + return r; + } + if (FundamentalType && other.FundamentalType) + { + return FundamentalType <=> other.FundamentalType; + } return Name <=> other.Name; } @@ -472,6 +483,276 @@ tag_invoke( v = dom::LazyObject(I, domCorpus); } +std::string_view +toString(FundamentalTypeKind const kind) noexcept +{ + switch (kind) + { + case FundamentalTypeKind::Void: + return "void"; + case FundamentalTypeKind::Nullptr: + return "std::nullptr_t"; + case FundamentalTypeKind::Bool: + return "bool"; + case FundamentalTypeKind::Char: + return "char"; + case FundamentalTypeKind::SignedChar: + return "signed char"; + case FundamentalTypeKind::UnsignedChar: + return "unsigned char"; + case FundamentalTypeKind::Char8: + return "char8_t"; + case FundamentalTypeKind::Char16: + return "char16_t"; + case FundamentalTypeKind::Char32: + return "char32_t"; + case FundamentalTypeKind::WChar: + return "wchar_t"; + case FundamentalTypeKind::Short: + return "short"; + case FundamentalTypeKind::UnsignedShort: + return "unsigned short"; + case FundamentalTypeKind::Int: + return "int"; + case FundamentalTypeKind::UnsignedInt: + return "unsigned int"; + case FundamentalTypeKind::Long: + return "long"; + case FundamentalTypeKind::UnsignedLong: + return "unsigned long"; + case FundamentalTypeKind::LongLong: + return "long long"; + case FundamentalTypeKind::UnsignedLongLong: + return "unsigned long long"; + case FundamentalTypeKind::Float: + return "float"; + case FundamentalTypeKind::Double: + return "double"; + case FundamentalTypeKind::LongDouble: + return "long double"; + default: + MRDOCS_UNREACHABLE(); + } +} + +bool +fromString(std::string_view str, FundamentalTypeKind& kind) noexcept +{ + static constexpr std::pair map[] = { + {"void", FundamentalTypeKind::Void}, + {"std::nullptr_t", FundamentalTypeKind::Nullptr}, + {"bool", FundamentalTypeKind::Bool}, + {"char", FundamentalTypeKind::Char}, + {"signed char", FundamentalTypeKind::SignedChar}, + {"unsigned char", FundamentalTypeKind::UnsignedChar}, + {"char8_t", FundamentalTypeKind::Char8}, + {"char16_t", FundamentalTypeKind::Char16}, + {"char32_t", FundamentalTypeKind::Char32}, + {"wchar_t", FundamentalTypeKind::WChar}, + {"short", FundamentalTypeKind::Short}, + {"short int", FundamentalTypeKind::Short}, + {"int short", FundamentalTypeKind::Short}, + {"signed short", FundamentalTypeKind::Short}, + {"short signed", FundamentalTypeKind::Short}, + {"signed short int", FundamentalTypeKind::Short}, + {"signed int short", FundamentalTypeKind::Short}, + {"short signed int", FundamentalTypeKind::Short}, + {"short int signed", FundamentalTypeKind::Short}, + {"int signed short", FundamentalTypeKind::Short}, + {"int short signed", FundamentalTypeKind::Short}, + {"unsigned short", FundamentalTypeKind::UnsignedShort}, + {"short unsigned", FundamentalTypeKind::UnsignedShort}, + {"unsigned short int", FundamentalTypeKind::UnsignedShort}, + {"unsigned int short", FundamentalTypeKind::UnsignedShort}, + {"short unsigned int", FundamentalTypeKind::UnsignedShort}, + {"short int unsigned", FundamentalTypeKind::UnsignedShort}, + {"int unsigned short", FundamentalTypeKind::UnsignedShort}, + {"int short unsigned", FundamentalTypeKind::UnsignedShort}, + {"int", FundamentalTypeKind::Int}, + {"signed", FundamentalTypeKind::Int}, + {"signed int", FundamentalTypeKind::Int}, + {"int signed", FundamentalTypeKind::Int}, + {"unsigned", FundamentalTypeKind::UnsignedInt}, + {"unsigned int", FundamentalTypeKind::UnsignedInt}, + {"int unsigned", FundamentalTypeKind::UnsignedInt}, + {"long", FundamentalTypeKind::Long}, + {"long int", FundamentalTypeKind::Long}, + {"int long", FundamentalTypeKind::Long}, + {"signed long", FundamentalTypeKind::Long}, + {"long signed", FundamentalTypeKind::Long}, + {"signed long int", FundamentalTypeKind::Long}, + {"signed int long", FundamentalTypeKind::Long}, + {"long signed int", FundamentalTypeKind::Long}, + {"long int signed", FundamentalTypeKind::Long}, + {"int signed long", FundamentalTypeKind::Long}, + {"int long signed", FundamentalTypeKind::Long}, + {"unsigned long", FundamentalTypeKind::UnsignedLong}, + {"long unsigned", FundamentalTypeKind::UnsignedLong}, + {"unsigned long int", FundamentalTypeKind::UnsignedLong}, + {"unsigned int long", FundamentalTypeKind::UnsignedLong}, + {"long unsigned int", FundamentalTypeKind::UnsignedLong}, + {"long int unsigned", FundamentalTypeKind::UnsignedLong}, + {"int unsigned long", FundamentalTypeKind::UnsignedLong}, + {"int long unsigned", FundamentalTypeKind::UnsignedLong}, + {"long long", FundamentalTypeKind::LongLong}, + {"long long int", FundamentalTypeKind::LongLong}, + {"long int long", FundamentalTypeKind::LongLong}, + {"int long long", FundamentalTypeKind::LongLong}, + {"signed long long", FundamentalTypeKind::LongLong}, + {"long signed long", FundamentalTypeKind::LongLong}, + {"long long signed", FundamentalTypeKind::LongLong}, + {"signed long long int", FundamentalTypeKind::LongLong}, + {"signed int long long", FundamentalTypeKind::LongLong}, + {"long long signed int", FundamentalTypeKind::LongLong}, + {"long long int signed", FundamentalTypeKind::LongLong}, + {"int signed long long", FundamentalTypeKind::LongLong}, + {"int long long signed", FundamentalTypeKind::LongLong}, + {"unsigned long long", FundamentalTypeKind::UnsignedLongLong}, + {"long long unsigned", FundamentalTypeKind::UnsignedLongLong}, + {"unsigned long long int", FundamentalTypeKind::UnsignedLongLong}, + {"unsigned int long long", FundamentalTypeKind::UnsignedLongLong}, + {"long long unsigned int", FundamentalTypeKind::UnsignedLongLong}, + {"long long int unsigned", FundamentalTypeKind::UnsignedLongLong}, + {"int unsigned long long", FundamentalTypeKind::UnsignedLongLong}, + {"int long long unsigned", FundamentalTypeKind::UnsignedLongLong}, + {"float", FundamentalTypeKind::Float}, + {"double", FundamentalTypeKind::Double}, + {"long double", FundamentalTypeKind::LongDouble} + }; + for (auto const& [key, value]: map) + { + if (key == str) + { + kind = value; + return true; + } + } + return false; +} + +bool +makeLong(FundamentalTypeKind& kind) noexcept +{ + if (kind == FundamentalTypeKind::Int) + { + kind = FundamentalTypeKind::Long; + return true; + } + if (kind == FundamentalTypeKind::Long) + { + kind = FundamentalTypeKind::LongLong; + return true; + } + if (kind == FundamentalTypeKind::UnsignedInt) + { + kind = FundamentalTypeKind::UnsignedLong; + return true; + } + if (kind == FundamentalTypeKind::UnsignedLong) + { + kind = FundamentalTypeKind::UnsignedLongLong; + return true; + } + if (kind == FundamentalTypeKind::Double) + { + kind = FundamentalTypeKind::LongDouble; + return true; + } + return false; +} + +bool +makeShort(FundamentalTypeKind& kind) noexcept +{ + if (kind == FundamentalTypeKind::Int) + { + kind = FundamentalTypeKind::Short; + return true; + } + if (kind == FundamentalTypeKind::UnsignedInt) + { + kind = FundamentalTypeKind::UnsignedShort; + return true; + } + return false; +} + +bool +makeSigned(FundamentalTypeKind& kind) noexcept +{ + if (kind == FundamentalTypeKind::Char) + { + kind = FundamentalTypeKind::SignedChar; + return true; + } + if (kind == FundamentalTypeKind::Short || + kind == FundamentalTypeKind::Int || + kind == FundamentalTypeKind::Long || + kind == FundamentalTypeKind::LongLong) + { + // Already signed, but return true + // because applying the signed specifier + // is a valid operation + return true; + } + return false; +} + +bool +makeUnsigned(FundamentalTypeKind& kind) noexcept +{ + if (kind == FundamentalTypeKind::Char) + { + kind = FundamentalTypeKind::UnsignedChar; + return true; + } + // For signed int types, applying the specifier + // is valid as long as the type was not already + // declared with "signed" + if (kind == FundamentalTypeKind::Short) + { + kind = FundamentalTypeKind::UnsignedShort; + return true; + } + if (kind == FundamentalTypeKind::Int) + { + kind = FundamentalTypeKind::UnsignedInt; + return true; + } + if (kind == FundamentalTypeKind::Long) + { + kind = FundamentalTypeKind::UnsignedLong; + return true; + } + if (kind == FundamentalTypeKind::LongLong) + { + kind = FundamentalTypeKind::UnsignedLongLong; + return true; + } + // For already unsigned types, the operation + // is invalid because the type already used the + // unsigned specifier. + return false; +} + +bool +makeChar(FundamentalTypeKind& kind) noexcept +{ + if (kind == FundamentalTypeKind::Int) + { + // Assumes "int" was declared with "signed" + kind = FundamentalTypeKind::SignedChar; + return true; + } + if (kind == FundamentalTypeKind::UnsignedInt) + { + // Assumes "unsigned int" was declared with "unsigned" + kind = FundamentalTypeKind::UnsignedChar; + return true; + } + return false; +} + std::strong_ordering operator<=>(Polymorphic const& lhs, Polymorphic const& rhs) { diff --git a/test-files/golden-tests/config/sort/sort-members.adoc b/test-files/golden-tests/config/sort/sort-members.adoc index 1043344a02..76bc53d16b 100644 --- a/test-files/golden-tests/config/sort/sort-members.adoc +++ b/test-files/golden-tests/config/sort/sort-members.adoc @@ -449,20 +449,20 @@ void [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- char -<>(double); +<>(int); ---- -[.small]#<># +[.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- char -<>(int); +<>(double); ---- -[.small]#<># +[.small]#<># @@ -532,7 +532,7 @@ void g(); ---- -[#g-06] +[#g-04] == g @@ -544,10 +544,10 @@ Declared in `<sort‐members.cpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- char -g(double); +g(int); ---- -[#g-04] +[#g-06] == g @@ -559,7 +559,7 @@ Declared in `<sort‐members.cpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- char -g(int); +g(double); ---- [#g-03a] diff --git a/test-files/golden-tests/config/sort/sort-members.html b/test-files/golden-tests/config/sort/sort-members.html index bd3c8c8360..54f344ad2c 100644 --- a/test-files/golden-tests/config/sort/sort-members.html +++ b/test-files/golden-tests/config/sort/sort-members.html @@ -459,18 +459,18 @@

Synopses

 
 char
-g(double);
+g(int);
 
-
» more... +» more...
 
 char
-g(int);
+g(double);
 
-
» more... +» more... @@ -542,7 +542,7 @@

Synopsis

-

g

+

g

Synopsis

@@ -551,14 +551,14 @@

Synopsis

 
 char
-g(double);
+g(int);
 
 
-

g

+

g

Synopsis

@@ -567,7 +567,7 @@

Synopsis

 
 char
-g(int);
+g(double);
 
 
diff --git a/test-files/golden-tests/config/sort/sort-members.xml b/test-files/golden-tests/config/sort/sort-members.xml index a525afc9ce..2ce66d0685 100644 --- a/test-files/golden-tests/config/sort/sort-members.xml +++ b/test-files/golden-tests/config/sort/sort-members.xml @@ -130,23 +130,23 @@ - - + + + - + - - - + + - + diff --git a/test-files/golden-tests/javadoc/brief/brief-3.adoc b/test-files/golden-tests/javadoc/brief/brief-3.adoc index 28275dc6d0..930d3ac701 100644 --- a/test-files/golden-tests/javadoc/brief/brief-3.adoc +++ b/test-files/golden-tests/javadoc/brief/brief-3.adoc @@ -34,10 +34,10 @@ Integer overload. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- void -<>(double); +<>(int); ---- -[.small]#<># +[.small]#<># Integer overload. @@ -45,10 +45,10 @@ Integer overload. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- void -<>(int); +<>(double); ---- -[.small]#<># +[.small]#<># C string overload. @@ -72,7 +72,7 @@ void [.small]#<># -[#f-0f] +[#f-06] == f @@ -86,10 +86,17 @@ Declared in `<brief‐3.cpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- void -f(double); +f(int); ---- -[#f-06] +=== Description + + +More info + + + +[#f-0f] == f @@ -103,16 +110,9 @@ Declared in `<brief‐3.cpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- void -f(int); +f(double); ---- -=== Description - - -More info - - - [#f-07] == f diff --git a/test-files/golden-tests/javadoc/brief/brief-3.html b/test-files/golden-tests/javadoc/brief/brief-3.html index e7f8a53291..468cd4ff85 100644 --- a/test-files/golden-tests/javadoc/brief/brief-3.html +++ b/test-files/golden-tests/javadoc/brief/brief-3.html @@ -47,9 +47,9 @@

Synopses

 
 void
-f(double);
+f(int);
 
-
» more... +» more...

Integer overload. @@ -60,9 +60,9 @@

Synopses

 
 void
-f(int);
+f(double);
 
-
» more... +» more...

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

Synopses

-

f

+

f

Integer overload. @@ -109,14 +109,20 @@

Synopsis

 
 void
-f(double);
+f(int);
 
 
+
+
+

Description

+

More info

+ +
-

f

+

f

Integer overload. @@ -130,15 +136,9 @@

Synopsis

 
 void
-f(int);
+f(double);
 
 
-
-
-

Description

-

More info

- -
diff --git a/test-files/golden-tests/javadoc/brief/brief-3.xml b/test-files/golden-tests/javadoc/brief/brief-3.xml index a27a7367d1..41d0de94e6 100644 --- a/test-files/golden-tests/javadoc/brief/brief-3.xml +++ b/test-files/golden-tests/javadoc/brief/brief-3.xml @@ -2,17 +2,6 @@ - - - - - - - - Integer overload. - - - @@ -27,6 +16,17 @@ + + + + + + + + Integer overload. + + + diff --git a/test-files/golden-tests/javadoc/copydoc/fundamental.adoc b/test-files/golden-tests/javadoc/copydoc/fundamental.adoc new file mode 100644 index 0000000000..ef25d5f99a --- /dev/null +++ b/test-files/golden-tests/javadoc/copydoc/fundamental.adoc @@ -0,0 +1,205 @@ += Reference +:mrdocs: + +[#index] +== Global namespace + + +=== Functions + +[cols=2] +|=== +| Name +| Description + +| <> +| `f` overloads + +| <> +| Brief + +| <> +| Brief + +|=== + +[#f-0e] +== f + + +`f` overloads + +=== Synopses + + +Declared in `<fundamental.cpp>` + +Fail + + +[source,cpp,subs="verbatim,replacements,macros,-callouts"] +---- +void +<>(int a); +---- + +[.small]#<># + +Brief + + +[source,cpp,subs="verbatim,replacements,macros,-callouts"] +---- +void +<>(long a); +---- + +[.small]#<># + +=== Parameters + + +|=== +| Name | Description + +| *a* +| Fail param + +|=== + +[#f-06] +== f + + +Fail + +=== Synopsis + + +Declared in `<fundamental.cpp>` + +[source,cpp,subs="verbatim,replacements,macros,-callouts"] +---- +void +f(int a); +---- + +=== Parameters + + +|=== +| Name | Description + +| *a* +| Fail param + +|=== + +[#f-04] +== f + + +Brief + +=== Synopsis + + +Declared in `<fundamental.cpp>` + +[source,cpp,subs="verbatim,replacements,macros,-callouts"] +---- +void +f(long a); +---- + +=== Description + + +Details + + + +=== Parameters + + +|=== +| Name | Description + +| *a* +| Param description + +|=== + +[#g] +== g + + +Brief + +=== Synopsis + + +Declared in `<fundamental.cpp>` + +[source,cpp,subs="verbatim,replacements,macros,-callouts"] +---- +void +g(long a); +---- + +=== Description + + +Details + + + +=== Parameters + + +|=== +| Name | Description + +| *a* +| Param description + +|=== + +[#h] +== h + + +Brief + +=== Synopsis + + +Declared in `<fundamental.cpp>` + +[source,cpp,subs="verbatim,replacements,macros,-callouts"] +---- +void +h(long a); +---- + +=== Description + + +Details + + + +=== Parameters + + +|=== +| Name | Description + +| *a* +| Param description + +|=== + + + +[.small]#Created with https://www.mrdocs.com[MrDocs]# diff --git a/test-files/golden-tests/javadoc/copydoc/fundamental.cpp b/test-files/golden-tests/javadoc/copydoc/fundamental.cpp new file mode 100644 index 0000000000..2a70d3360d --- /dev/null +++ b/test-files/golden-tests/javadoc/copydoc/fundamental.cpp @@ -0,0 +1,19 @@ +/** Fail + + @param a Fail param + */ +void f(int a); + +/** Brief + + Details + + @param a Param description + */ +void f(int long a); + +/// @copydoc f(long int) +void g(long int a); + +/// @copydoc f(long) +void h(long a); \ No newline at end of file diff --git a/test-files/golden-tests/javadoc/copydoc/fundamental.html b/test-files/golden-tests/javadoc/copydoc/fundamental.html new file mode 100644 index 0000000000..2fd75607c2 --- /dev/null +++ b/test-files/golden-tests/javadoc/copydoc/fundamental.html @@ -0,0 +1,274 @@ + + +Reference + + +
+

Reference

+
+
+

Global namespace

+
+

Functions

+ + + + + + + + + + + + + + + + +
NameDescription
f f overloads +
g Brief +
h Brief +
+
+
+
+

f

+
+f overloads + + +
+
+
+

Synopses

+
+Declared in <fundamental.cpp>
+

+ Fail + +

+ + +
+
+void
+f(int a);
+
+
» more... + +

+ Brief + +

+ + +
+
+void
+f(long a);
+
+
» more... + + +
+
+

Parameters

+ + + + + + + + + + + + + +
NameDescription
a

Fail param

+
+
+
+
+
+

f

+
+Fail + + +
+
+
+

Synopsis

+
+Declared in <fundamental.cpp>
+
+
+void
+f(int a);
+
+
+
+
+

Parameters

+ + + + + + + + + + + + + +
NameDescription
a

Fail param

+
+
+
+
+
+

f

+
+Brief + + +
+
+
+

Synopsis

+
+Declared in <fundamental.cpp>
+
+
+void
+f(long a);
+
+
+
+
+

Description

+

Details

+ + +
+
+

Parameters

+ + + + + + + + + + + + + +
NameDescription
a

Param description

+
+
+
+
+
+

g

+
+Brief + + +
+
+
+

Synopsis

+
+Declared in <fundamental.cpp>
+
+
+void
+g(long a);
+
+
+
+
+

Description

+

Details

+ + +
+
+

Parameters

+ + + + + + + + + + + + + +
NameDescription
a

Param description

+
+
+
+
+
+

h

+
+Brief + + +
+
+
+

Synopsis

+
+Declared in <fundamental.cpp>
+
+
+void
+h(long a);
+
+
+
+
+

Description

+

Details

+ + +
+
+

Parameters

+ + + + + + + + + + + + + +
NameDescription
a

Param description

+
+
+
+ +
+
+

Created with MrDocs

+
+ + \ No newline at end of file diff --git a/test-files/golden-tests/javadoc/copydoc/fundamental.xml b/test-files/golden-tests/javadoc/copydoc/fundamental.xml new file mode 100644 index 0000000000..f8207639c9 --- /dev/null +++ b/test-files/golden-tests/javadoc/copydoc/fundamental.xml @@ -0,0 +1,71 @@ + + + + + + + + + + + Fail + + + Fail param + + + + + + + + + + + Brief + + + Details + + + Param description + + + + + + + + + + + Brief + + + Details + + + Param description + + + + + + + + + + + Brief + + + Details + + + Param description + + + + + diff --git a/test-files/golden-tests/javadoc/copydoc/param-types.adoc b/test-files/golden-tests/javadoc/copydoc/param-types.adoc index cf1d8d3312..fcfd77cdf1 100644 --- a/test-files/golden-tests/javadoc/copydoc/param-types.adoc +++ b/test-files/golden-tests/javadoc/copydoc/param-types.adoc @@ -775,38 +775,38 @@ void [.small]#<># -Variadic function +Enum param function [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- void -<>(int a, ...); +<>(<> a); ---- -[.small]#<># +[.small]#<># -Non‐variadic function +Variadic function [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- void -<>(int a); +<>(int a, ...); ---- -[.small]#<># +[.small]#<># -Enum param function +Non‐variadic function [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- void -<>(<> a); +<>(int a); ---- -[.small]#<># +[.small]#<># @@ -916,11 +916,11 @@ Documentation for a function with a qualified identifier parameter. |=== -[#g-096] +[#g-04c] == g -Variadic function +Enum param function === Synopsis @@ -930,13 +930,13 @@ Declared in `<param‐types.cpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- void -g(int a, ...); +g(<> a); ---- === Description -Documentation for the variadic function. +Documentation for a function with an enum parameter. @@ -951,11 +951,11 @@ Documentation for the variadic function. |=== -[#g-04a] +[#g-096] == g -Non‐variadic function +Variadic function === Synopsis @@ -965,13 +965,13 @@ Declared in `<param‐types.cpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- void -g(int a); +g(int a, ...); ---- === Description -Documentation for the non‐variadic function. +Documentation for the variadic function. @@ -986,11 +986,11 @@ Documentation for the non‐variadic function. |=== -[#g-04c] +[#g-04a] == g -Enum param function +Non‐variadic function === Synopsis @@ -1000,13 +1000,13 @@ Declared in `<param‐types.cpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- void -g(<> a); +g(int a); ---- === Description -Documentation for a function with an enum parameter. +Documentation for the non‐variadic function. diff --git a/test-files/golden-tests/javadoc/copydoc/param-types.html b/test-files/golden-tests/javadoc/copydoc/param-types.html index 857465f777..deb2a7e36f 100644 --- a/test-files/golden-tests/javadoc/copydoc/param-types.html +++ b/test-files/golden-tests/javadoc/copydoc/param-types.html @@ -980,7 +980,7 @@

Synopses

» more...

- Variadic function + Enum param function

@@ -988,12 +988,12 @@

Synopses

 
 void
-g(int a, ...);
+g(testEnum a);
 
-
» more... +» more...

- Non-variadic function + Variadic function

@@ -1001,12 +1001,12 @@

Synopses

 
 void
-g(int a);
+g(int a, ...);
 
-
» more... +» more...

- Enum param function + Non-variadic function

@@ -1014,9 +1014,9 @@

Synopses

 
 void
-g(testEnum a);
+g(int a);
 
-
» more... +» more... @@ -1161,9 +1161,9 @@

Parameters

-

g

+

g

-Variadic function +Enum param function
@@ -1175,13 +1175,13 @@

Synopsis

 
 void
-g(int a, ...);
+g(testEnum a);
 
 

Description

-

Documentation for the variadic function.

+

Documentation for a function with an enum parameter.

@@ -1206,9 +1206,9 @@

Parameters

-

g

+

g

-Non-variadic function +Variadic function
@@ -1220,13 +1220,13 @@

Synopsis

 
 void
-g(int a);
+g(int a, ...);
 
 

Description

-

Documentation for the non-variadic function.

+

Documentation for the variadic function.

@@ -1251,9 +1251,9 @@

Parameters

-

g

+

g

-Enum param function +Non-variadic function
@@ -1265,13 +1265,13 @@

Synopsis

 
 void
-g(testEnum a);
+g(int a);
 
 

Description

-

Documentation for a function with an enum parameter.

+

Documentation for the non-variadic function.

diff --git a/test-files/golden-tests/javadoc/copydoc/param-types.xml b/test-files/golden-tests/javadoc/copydoc/param-types.xml index d383c41910..62ccc1f807 100644 --- a/test-files/golden-tests/javadoc/copydoc/param-types.xml +++ b/test-files/golden-tests/javadoc/copydoc/param-types.xml @@ -337,52 +337,52 @@ - - - + + - + - Variadic function + Enum param function - Documentation for the variadic function. + Documentation for a function with an enum parameter. The first parameter of g - - + + + - Non-variadic function + Variadic function - Documentation for the non-variadic function. + Documentation for the variadic function. The first parameter of g - - + + - + - Enum param function + Non-variadic function - Documentation for a function with an enum parameter. + Documentation for the non-variadic function. The first parameter of g diff --git a/test-files/golden-tests/symbols/function/spec-mem-implicit-instantiation.adoc b/test-files/golden-tests/symbols/function/spec-mem-implicit-instantiation.adoc index b142751084..8ff53e399a 100644 --- a/test-files/golden-tests/symbols/function/spec-mem-implicit-instantiation.adoc +++ b/test-files/golden-tests/symbols/function/spec-mem-implicit-instantiation.adoc @@ -15,10 +15,10 @@ | <> -| <> - | <> +| <> + | <> |=== @@ -337,8 +337,8 @@ void f(); ---- -[#A-000] -== A<int> +[#A-00b] +== A<short> === Synopsis @@ -349,7 +349,7 @@ Declared in `<spec‐mem‐implicit‐instantiation.cpp [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<> -struct <><int>; +struct <><short>; ---- === Types @@ -358,11 +358,9 @@ struct <><int>; |=== | Name -| <> - -| <> +| <> -| <> +| <> |=== === Member Functions @@ -371,14 +369,14 @@ struct <><int>; |=== | Name -| <> +| <> |=== -[#A-000-B-03] -== <><int>::B +[#A-00b-B] +== <><short>::B === Synopsis @@ -395,8 +393,8 @@ struct B; -[#A-000-B-09] -== <><int>::B<long> +[#A-00b-C] +== <><short>::C === Synopsis @@ -406,8 +404,8 @@ Declared in `<spec‐mem‐implicit‐instantiation.cpp [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- -template<> -struct <><long>; +template<typename U> +struct C; ---- === Member Functions @@ -416,14 +414,14 @@ struct <><long>; |=== | Name -| <> +| <> |=== -[#A-000-B-09-g] -== <><int>::<><long>::g +[#A-00b-C-i] +== <><short>::<>::i === Synopsis @@ -434,29 +432,11 @@ Declared in `<spec‐mem‐implicit‐instantiation.cpp [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- void -g(); ----- - -[#A-000-C] -== <><int>::C - - -=== Synopsis - - -Declared in `<spec‐mem‐implicit‐instantiation.cpp>` - -[source,cpp,subs="verbatim,replacements,macros,-callouts"] ----- -template<typename U> -struct C; +i(); ---- - - - -[#A-000-f] -== <><int>::f +[#A-00b-f] +== <><short>::f === Synopsis @@ -470,8 +450,8 @@ void f(); ---- -[#A-00b] -== A<short> +[#A-000] +== A<int> === Synopsis @@ -482,7 +462,7 @@ Declared in `<spec‐mem‐implicit‐instantiation.cpp [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<> -struct <><short>; +struct <><int>; ---- === Types @@ -491,9 +471,11 @@ struct <><short>; |=== | Name -| <> +| <> -| <> +| <> + +| <> |=== === Member Functions @@ -502,14 +484,14 @@ struct <><short>; |=== | Name -| <> +| <> |=== -[#A-00b-B] -== <><short>::B +[#A-000-B-03] +== <><int>::B === Synopsis @@ -526,8 +508,8 @@ struct B; -[#A-00b-C] -== <><short>::C +[#A-000-B-09] +== <><int>::B<long> === Synopsis @@ -537,8 +519,8 @@ Declared in `<spec‐mem‐implicit‐instantiation.cpp [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- -template<typename U> -struct C; +template<> +struct <><long>; ---- === Member Functions @@ -547,14 +529,14 @@ struct C; |=== | Name -| <> +| <> |=== -[#A-00b-C-i] -== <><short>::<>::i +[#A-000-B-09-g] +== <><int>::<><long>::g === Synopsis @@ -565,11 +547,29 @@ Declared in `<spec‐mem‐implicit‐instantiation.cpp [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- void -i(); +g(); ---- -[#A-00b-f] -== <><short>::f +[#A-000-C] +== <><int>::C + + +=== Synopsis + + +Declared in `<spec‐mem‐implicit‐instantiation.cpp>` + +[source,cpp,subs="verbatim,replacements,macros,-callouts"] +---- +template<typename U> +struct C; +---- + + + + +[#A-000-f] +== <><int>::f === Synopsis 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 36f68c9397..832b31e033 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 @@ -22,10 +22,10 @@

Types

A<bool> -A<int> - A<short> +A<int> + D @@ -385,7 +385,7 @@

Synopsis

-

A<int>

+

A<short>

Synopsis

@@ -394,7 +394,7 @@

Synopsis

 
 template<>
-struct A<int>;
+struct A<short>;
 
 
@@ -407,11 +407,9 @@

Types

-B - -B<long> +B -C +C @@ -424,7 +422,7 @@

Member Functions

-f +f @@ -433,7 +431,7 @@

Member Functions

-

A<int>::B

+

A<short>::B

Synopsis

@@ -451,7 +449,7 @@

Synopsis

-

A<int>::B<long>

+

A<short>::C

Synopsis

@@ -459,8 +457,8 @@

Synopsis

Declared in <spec-mem-implicit-instantiation.cpp>
 
-template<>
-struct B<long>;
+template<typename U>
+struct C;
 
 
@@ -473,7 +471,7 @@

Member Functions

-g +i @@ -482,7 +480,7 @@

Member Functions

-

A<int>::B<long>::g

+

A<short>::C::i

Synopsis

@@ -491,32 +489,14 @@

Synopsis

 
 void
-g();
-
-
-
-
-
-
-

A<int>::C

-
-
-

Synopsis

-
-Declared in <spec-mem-implicit-instantiation.cpp>
-
-
-template<typename U>
-struct C;
+i();
 
 
- -
-

A<int>::f

+

A<short>::f

Synopsis

@@ -532,7 +512,7 @@

Synopsis

-

A<short>

+

A<int>

Synopsis

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

Synopsis

 
 template<>
-struct A<short>;
+struct A<int>;
 
 
@@ -554,9 +534,11 @@

Types

-B +B -C +B<long> + +C @@ -569,7 +551,7 @@

Member Functions

-f +f @@ -578,7 +560,7 @@

Member Functions

-

A<short>::B

+

A<int>::B

Synopsis

@@ -596,7 +578,7 @@

Synopsis

-

A<short>::C

+

A<int>::B<long>

Synopsis

@@ -604,8 +586,8 @@

Synopsis

Declared in <spec-mem-implicit-instantiation.cpp>
 
-template<typename U>
-struct C;
+template<>
+struct B<long>;
 
 
@@ -618,7 +600,7 @@

Member Functions

-i +g @@ -627,7 +609,7 @@

Member Functions

-

A<short>::C::i

+

A<int>::B<long>::g

Synopsis

@@ -636,14 +618,32 @@

Synopsis

 
 void
-i();
+g();
 
 
-

A<short>::f

+

A<int>::C

+
+
+

Synopsis

+
+Declared in <spec-mem-implicit-instantiation.cpp>
+
+
+template<typename U>
+struct C;
+
+
+
+ + +
+
+
+

A<int>::f

Synopsis

diff --git a/test-files/golden-tests/symbols/function/spec-mem-implicit-instantiation.xml b/test-files/golden-tests/symbols/function/spec-mem-implicit-instantiation.xml index e17c4fa0d8..f5c04a69d0 100644 --- a/test-files/golden-tests/symbols/function/spec-mem-implicit-instantiation.xml +++ b/test-files/golden-tests/symbols/function/spec-mem-implicit-instantiation.xml @@ -71,58 +71,58 @@ - +