diff --git a/docs/modules/ROOT/pages/generators.adoc b/docs/modules/ROOT/pages/generators.adoc index 1592c45d35..94f7110592 100644 --- a/docs/modules/ROOT/pages/generators.adoc +++ b/docs/modules/ROOT/pages/generators.adoc @@ -438,14 +438,18 @@ When the symbol kind is `variable`, the symbol object has the following addition | `<>` | The template information of the variable. -| `constexprKind` -| `string` -| The constexpr kind of the variable (e.g., `consteval`, `constexpr`). - | `storageClass` | `string` | The storage class of the variable (e.g., `static`, `extern`). +| `isInline` +| `bool` +| Whether the variable is `inline`. + +| `isConstexpr` +| `bool` +| Whether the variable is `constexpr`. + | `isConstinit` | `bool` | Whether the variable is `constinit`. @@ -457,6 +461,10 @@ When the symbol kind is `variable`, the symbol object has the following addition | `initializer` | `string` | The initializer of the variable. + +| `attributes` +| `string[]` +| The attributes of the variable. |=== When the symbol kind is `field` (i.e. non-static data members), the symbol object has the following additional properties: diff --git a/include/mrdocs/Metadata/Variable.hpp b/include/mrdocs/Metadata/Variable.hpp index b4069aa4d9..af0f21c627 100644 --- a/include/mrdocs/Metadata/Variable.hpp +++ b/include/mrdocs/Metadata/Variable.hpp @@ -40,12 +40,16 @@ struct VariableInfo StorageClassKind StorageClass = StorageClassKind::None; - ConstexprKind Constexpr = ConstexprKind::None; + bool IsInline = false; + + bool IsConstexpr = false; bool IsConstinit = false; bool IsThreadLocal = false; + std::vector Attributes; + //-------------------------------------------- explicit VariableInfo(SymbolID ID) noexcept diff --git a/share/mrdocs/addons/generator/common/partials/symbol/signature/variable.hbs b/share/mrdocs/addons/generator/common/partials/symbol/signature/variable.hbs index 5fd8e22b76..77caeb6a15 100644 --- a/share/mrdocs/addons/generator/common/partials/symbol/signature/variable.hbs +++ b/share/mrdocs/addons/generator/common/partials/symbol/signature/variable.hbs @@ -1,7 +1,7 @@ {{#if template}}{{>template/head template}} {{/if~}} -{{#if constexprKind}}{{constexprKind}} -{{/if~}} +{{#if isInline}}inline {{/if~}} +{{#if isConstexpr}}constexpr {{/if~}} {{#if storageClass}}{{storageClass}} {{/if~}} {{#if isThreadLocal}}thread_local diff --git a/src/lib/AST/ASTVisitor.cpp b/src/lib/AST/ASTVisitor.cpp index 7c6a952bc9..54e5b6fbef 100644 --- a/src/lib/AST/ASTVisitor.cpp +++ b/src/lib/AST/ASTVisitor.cpp @@ -1089,9 +1089,11 @@ populate( default_arg) { param.Default = getSourceCode(default_arg->getSourceRange()); + param.Default = trim(param.Default); if (param.Default.starts_with("= ")) { param.Default.erase(0, 2); + param.Default = ltrim(param.Default); } } } @@ -1110,17 +1112,7 @@ populate( populate(I.Requires, TRC); } - if (D->hasAttrs()) - { - for (AttrVec& attrs = D->getAttrs(); - Attr const* attr: attrs) - { - if (IdentifierInfo const* II = attr->getAttrName()) - { - I.Attributes.emplace_back(II->getName()); - } - } - } + populateAttributes(I, D); } void @@ -1200,15 +1192,20 @@ populate( // it is possible to declare a static data member // as both constexpr and constinit in separate declarations.. I.IsConstinit |= D->hasAttr(); - if (D->isConstexpr()) - { - I.Constexpr = ConstexprKind::Constexpr; - } + I.IsConstexpr |= D->isConstexpr(); + I.IsInline |= D->isInline(); if (Expr const* E = D->getInit()) { populate(I.Initializer, E); } - I.Type = toTypeInfo(D->getType()); + auto QT = D->getType(); + if (D->isConstexpr()) { + // when D->isConstexpr() is true, QT contains a redundant + // `const` qualifier which we need to remove + QT.removeLocalConst(); + } + I.Type = toTypeInfo(QT); + populateAttributes(I, D); } void @@ -1232,14 +1229,7 @@ populate( I.HasNoUniqueAddress = D->hasAttr(); I.IsDeprecated = D->hasAttr(); I.IsMaybeUnused = D->hasAttr(); - if (D->hasAttrs()) - { - for (AttrVec& attrs = D->getAttrs(); - Attr const* attr: attrs) - { - I.Attributes.emplace_back(attr->getAttrName()->getName()); - } - } + populateAttributes(I, D); } void @@ -1671,6 +1661,29 @@ populate( })); } +template InfoTy> +void +ASTVisitor:: +populateAttributes(InfoTy& I, const Decl* D) +{ + if constexpr (requires { I.Attributes; }) + { + MRDOCS_CHECK_OR(D->hasAttrs()); + for (Attr const* attr: D->getAttrs()) + { + IdentifierInfo const* II = attr->getAttrName(); + if (!II) + { + continue; + } + if (std::ranges::find(I.Attributes, II->getName()) == I.Attributes.end()) + { + I.Attributes.emplace_back(II->getName()); + } + } + } +} + std::string ASTVisitor:: extractName(NamedDecl const* D) diff --git a/src/lib/AST/ASTVisitor.hpp b/src/lib/AST/ASTVisitor.hpp index 3f469651d0..41ac5a40be 100644 --- a/src/lib/AST/ASTVisitor.hpp +++ b/src/lib/AST/ASTVisitor.hpp @@ -560,6 +560,11 @@ class ASTVisitor std::vector>& result, const ASTTemplateArgumentListInfo* args); + template InfoTy> + static + void + populateAttributes(InfoTy& I, const Decl* D); + // ================================================= // Populate function helpers // ================================================= diff --git a/src/lib/Gen/xml/XMLWriter.cpp b/src/lib/Gen/xml/XMLWriter.cpp index bdc783e686..5b99a34ea3 100644 --- a/src/lib/Gen/xml/XMLWriter.cpp +++ b/src/lib/Gen/xml/XMLWriter.cpp @@ -598,7 +598,8 @@ writeVariable( writeSourceInfo(I); writeAttr(I.StorageClass, "storage-class", tags_); - writeAttr(I.Constexpr, "constexpr-kind", tags_); + writeAttr(I.IsInline, "is-inline", tags_); + writeAttr(I.IsConstexpr, "is-constexpr", tags_); writeAttr(I.IsConstinit, "is-constinit", tags_); writeAttr(I.IsThreadLocal, "is-thread-local", tags_); diff --git a/src/lib/Metadata/Info.cpp b/src/lib/Metadata/Info.cpp index 75b15b7bc5..6b9a37c31e 100644 --- a/src/lib/Metadata/Info.cpp +++ b/src/lib/Metadata/Info.cpp @@ -189,22 +189,22 @@ tag_invoke( } if constexpr (T::isVariable()) { - io.map("type", I.Type); - io.map("template", I.Template); - if (I.Constexpr != ConstexprKind::None) - { - io.map("constexprKind", I.Constexpr); - } - if (I.StorageClass != StorageClassKind::None) + auto const& U = static_cast(I); + io.map("type", U.Type); + io.map("template", U.Template); + if (U.StorageClass != StorageClassKind::None) { - io.map("storageClass", I.StorageClass); + io.map("storageClass", U.StorageClass); } - io.map("isConstinit", I.IsConstinit); - io.map("isThreadLocal", I.IsThreadLocal); - if (!I.Initializer.Written.empty()) + io.map("isInline", U.IsInline); + io.map("isConstexpr", U.IsConstexpr); + io.map("isConstinit", U.IsConstinit); + io.map("isThreadLocal", U.IsThreadLocal); + if (!U.Initializer.Written.empty()) { - io.map("initializer", I.Initializer.Written); + io.map("initializer", U.Initializer.Written); } + io.map("attributes", dom::LazyArray(U.Attributes)); } if constexpr (T::isField()) { diff --git a/src/lib/Metadata/Reduce.cpp b/src/lib/Metadata/Reduce.cpp index c8a1240767..8f58d6af16 100644 --- a/src/lib/Metadata/Reduce.cpp +++ b/src/lib/Metadata/Reduce.cpp @@ -325,11 +325,19 @@ void merge(VariableInfo& I, VariableInfo&& Other) I.IsConstinit |= Other.IsConstinit; I.IsThreadLocal |= Other.IsThreadLocal; - - if(I.Constexpr == ConstexprKind::None) - I.Constexpr = Other.Constexpr; - if(I.StorageClass == StorageClassKind::None) + I.IsConstexpr |= Other.IsConstexpr; + I.IsInline |= Other.IsInline; + if (I.StorageClass == StorageClassKind::None) + { I.StorageClass = Other.StorageClass; + } + for (auto& otherAttr: Other.Attributes) + { + if (std::ranges::find(I.Attributes, otherAttr) == I.Attributes.end()) + { + I.Attributes.push_back(otherAttr); + } + } } void merge(SpecializationInfo& I, SpecializationInfo&& Other) diff --git a/test-files/golden-tests/filters/symbol-name/impl-defined-member.adoc b/test-files/golden-tests/filters/symbol-name/impl-defined-member.adoc index ef8bb4fa4c..fb3438743c 100644 --- a/test-files/golden-tests/filters/symbol-name/impl-defined-member.adoc +++ b/test-files/golden-tests/filters/symbol-name/impl-defined-member.adoc @@ -64,8 +64,7 @@ Declared in `<impl‐defined‐member.cpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- -constexpr -/* implementation-defined */ const absolute_uri_rule = {}; +constexpr /* implementation-defined */ absolute_uri_rule = {}; ---- [#regular_absolute_uri_rule] @@ -79,8 +78,7 @@ Declared in `<impl‐defined‐member.cpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- -constexpr -<>::<> const regular_absolute_uri_rule = {}; +constexpr <>::<> regular_absolute_uri_rule = {}; ---- diff --git a/test-files/golden-tests/filters/symbol-name/impl-defined-member.html b/test-files/golden-tests/filters/symbol-name/impl-defined-member.html index fb6a7cb4fb..1ed58284ea 100644 --- a/test-files/golden-tests/filters/symbol-name/impl-defined-member.html +++ b/test-files/golden-tests/filters/symbol-name/impl-defined-member.html @@ -79,8 +79,7 @@

Synopsis

Declared in <impl-defined-member.cpp>
 
-constexpr
-/* implementation-defined */ const absolute_uri_rule = {};
+constexpr /* implementation-defined */ absolute_uri_rule = {};
 
 
@@ -95,8 +94,7 @@

Synopsis

Declared in <impl-defined-member.cpp>
 
-constexpr
-regular::absolute_uri_rule_t const regular_absolute_uri_rule = {};
+constexpr regular::absolute_uri_rule_t regular_absolute_uri_rule = {};
 
 
diff --git a/test-files/golden-tests/filters/symbol-name/impl-defined-member.xml b/test-files/golden-tests/filters/symbol-name/impl-defined-member.xml index 692a10746a..520ddba86c 100644 --- a/test-files/golden-tests/filters/symbol-name/impl-defined-member.xml +++ b/test-files/golden-tests/filters/symbol-name/impl-defined-member.xml @@ -14,13 +14,13 @@ - - + + - - + + diff --git a/test-files/golden-tests/metadata/ns-variables.adoc b/test-files/golden-tests/metadata/ns-variables.adoc index d1b059ecfa..3fb5c55f41 100644 --- a/test-files/golden-tests/metadata/ns-variables.adoc +++ b/test-files/golden-tests/metadata/ns-variables.adoc @@ -58,8 +58,7 @@ Declared in `<ns‐variables.cpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- -constexpr -int const i = 0; +constexpr int i = 0; ---- [#j] @@ -87,9 +86,8 @@ Declared in `<ns‐variables.cpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- -constexpr -extern -int const k = 1; +constexpr extern +int k = 1; ---- [#l] @@ -178,10 +176,9 @@ Declared in `<ns‐variables.cpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- -constexpr -static +constexpr static thread_local -int const x2 = 0; +int x2 = 0; ---- diff --git a/test-files/golden-tests/metadata/ns-variables.html b/test-files/golden-tests/metadata/ns-variables.html index 51ae20c1bb..5373a9c346 100644 --- a/test-files/golden-tests/metadata/ns-variables.html +++ b/test-files/golden-tests/metadata/ns-variables.html @@ -69,8 +69,7 @@

Synopsis

Declared in <ns-variables.cpp>
 
-constexpr
-int const i = 0;
+constexpr int i = 0;
 
 
@@ -100,9 +99,8 @@

Synopsis

Declared in <ns-variables.cpp>
 
-constexpr
-extern
-int const k = 1;
+constexpr extern
+int k = 1;
 
 
@@ -197,10 +195,9 @@

Synopsis

Declared in <ns-variables.cpp>
 
-constexpr
-static
+constexpr static
 thread_local
-int const x2 = 0;
+int x2 = 0;
 
 
diff --git a/test-files/golden-tests/metadata/ns-variables.xml b/test-files/golden-tests/metadata/ns-variables.xml index 75271055e8..70302edcbb 100644 --- a/test-files/golden-tests/metadata/ns-variables.xml +++ b/test-files/golden-tests/metadata/ns-variables.xml @@ -4,8 +4,8 @@ - - + + @@ -16,8 +16,8 @@ - - + + @@ -52,9 +52,9 @@ - + - + diff --git a/test-files/golden-tests/metadata/static-data-def-constexpr.adoc b/test-files/golden-tests/metadata/static-data-def-constexpr.adoc index 6f3d1cc17d..7f2af620d3 100644 --- a/test-files/golden-tests/metadata/static-data-def-constexpr.adoc +++ b/test-files/golden-tests/metadata/static-data-def-constexpr.adoc @@ -51,9 +51,8 @@ Declared in `<static‐data‐def‐constexpr.cpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- -constexpr -static -<> const s = S{}; +inline constexpr static +<> s = S{}; ---- [#T] @@ -92,9 +91,8 @@ Declared in `<static‐data‐def‐constexpr.cpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- -constexpr -static -int const t = 0; +inline constexpr static +int t = 0; ---- diff --git a/test-files/golden-tests/metadata/static-data-def-constexpr.html b/test-files/golden-tests/metadata/static-data-def-constexpr.html index 5ca5a5afc7..339def123a 100644 --- a/test-files/golden-tests/metadata/static-data-def-constexpr.html +++ b/test-files/golden-tests/metadata/static-data-def-constexpr.html @@ -62,9 +62,8 @@

Synopsis

Declared in <static-data-def-constexpr.cpp>
 
-constexpr
-static
-S const s = S{};
+inline constexpr static
+S s = S{};
 
 
@@ -108,9 +107,8 @@

Synopsis

Declared in <static-data-def-constexpr.cpp>
 
-constexpr
-static
-int const t = 0;
+inline constexpr static
+int t = 0;
 
 
diff --git a/test-files/golden-tests/metadata/static-data-def-constexpr.xml b/test-files/golden-tests/metadata/static-data-def-constexpr.xml index d22dac21e0..784f883090 100644 --- a/test-files/golden-tests/metadata/static-data-def-constexpr.xml +++ b/test-files/golden-tests/metadata/static-data-def-constexpr.xml @@ -8,8 +8,9 @@ - - + + + @@ -18,9 +19,10 @@ - + + - + diff --git a/test-files/golden-tests/metadata/static-data-def.adoc b/test-files/golden-tests/metadata/static-data-def.adoc index db48573a28..6c89c64c91 100644 --- a/test-files/golden-tests/metadata/static-data-def.adoc +++ b/test-files/golden-tests/metadata/static-data-def.adoc @@ -82,7 +82,7 @@ Declared in `<static‐data‐def.cpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- -static +inline static int v1 = 1; ---- @@ -97,9 +97,8 @@ Declared in `<static‐data‐def.cpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- -constexpr -static -int const v2 = 2; +inline constexpr static +int v2 = 2; ---- [#A-v3] @@ -113,7 +112,7 @@ Declared in `<static‐data‐def.cpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- -static +inline static int const v3 = 3; ---- @@ -143,7 +142,7 @@ Declared in `<static‐data‐def.cpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- -static +inline static int v5 = 5; ---- @@ -158,7 +157,7 @@ Declared in `<static‐data‐def.cpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- -static +inline static int const v6 = 6; ---- @@ -173,9 +172,8 @@ Declared in `<static‐data‐def.cpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- -constexpr -static -int const v7 = 7; +inline constexpr static +int v7 = 7; ---- [#B] @@ -231,10 +229,9 @@ Declared in `<static‐data‐def.cpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- -constexpr -static +inline constexpr static thread_local -int const x1 = 0; +int x1 = 0; ---- [#f] diff --git a/test-files/golden-tests/metadata/static-data-def.html b/test-files/golden-tests/metadata/static-data-def.html index 746ffe5c96..86ff27203b 100644 --- a/test-files/golden-tests/metadata/static-data-def.html +++ b/test-files/golden-tests/metadata/static-data-def.html @@ -98,7 +98,7 @@

Synopsis

Declared in <static-data-def.cpp>
 
-static
+inline static
 int v1 = 1;
 
 
@@ -114,9 +114,8 @@

Synopsis

Declared in <static-data-def.cpp>
 
-constexpr
-static
-int const v2 = 2;
+inline constexpr static
+int v2 = 2;
 
 
@@ -131,7 +130,7 @@

Synopsis

Declared in <static-data-def.cpp>
 
-static
+inline static
 int const v3 = 3;
 
 
@@ -163,7 +162,7 @@

Synopsis

Declared in <static-data-def.cpp>
 
-static
+inline static
 int v5 = 5;
 
 
@@ -179,7 +178,7 @@

Synopsis

Declared in <static-data-def.cpp>
 
-static
+inline static
 int const v6 = 6;
 
 
@@ -195,9 +194,8 @@

Synopsis

Declared in <static-data-def.cpp>
 
-constexpr
-static
-int const v7 = 7;
+inline constexpr static
+int v7 = 7;
 
 
@@ -259,10 +257,9 @@

Synopsis

Declared in <static-data-def.cpp>
 
-constexpr
-static
+inline constexpr static
 thread_local
-int const x1 = 0;
+int x1 = 0;
 
 
diff --git a/test-files/golden-tests/metadata/static-data-def.xml b/test-files/golden-tests/metadata/static-data-def.xml index 79fe1c65c9..015773fd0c 100644 --- a/test-files/golden-tests/metadata/static-data-def.xml +++ b/test-files/golden-tests/metadata/static-data-def.xml @@ -16,19 +16,22 @@ + - - + + + + @@ -40,18 +43,21 @@ + + - - + + + @@ -67,9 +73,10 @@ - + + - + diff --git a/test-files/golden-tests/metadata/static-data-template.adoc b/test-files/golden-tests/metadata/static-data-template.adoc index 0928dc8240..4ee119fb1a 100644 --- a/test-files/golden-tests/metadata/static-data-template.adoc +++ b/test-files/golden-tests/metadata/static-data-template.adoc @@ -56,9 +56,8 @@ Declared in `<static‐data‐template.cpp>` template< typename U, typename V> -constexpr -static -T const x = 0; +inline constexpr static +T x = 0; ---- [#A-x-0a] @@ -73,9 +72,8 @@ Declared in `<static‐data‐template.cpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<typename U> -constexpr -static -T const x<U*, T> = 1; +inline constexpr static +T x<U*, T> = 1; ---- [#A-x-07] @@ -90,9 +88,8 @@ Declared in `<static‐data‐template.cpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<> -constexpr -static -bool const x<T, long> = 2; +inline constexpr static +bool x<T, long> = 2; ---- diff --git a/test-files/golden-tests/metadata/static-data-template.html b/test-files/golden-tests/metadata/static-data-template.html index 38e1f6fd81..ef681642f1 100644 --- a/test-files/golden-tests/metadata/static-data-template.html +++ b/test-files/golden-tests/metadata/static-data-template.html @@ -67,9 +67,8 @@

Synopsis

template< typename U, typename V> -constexpr -static -T const x = 0; +inline constexpr static +T x = 0; @@ -85,9 +84,8 @@

Synopsis

 
 template<typename U>
-constexpr
-static
-T const x<U*, T> = 1;
+inline constexpr static
+T x<U*, T> = 1;
 
 
@@ -103,9 +101,8 @@

Synopsis

 
 template<>
-constexpr
-static
-bool const x<T, long> = 2;
+inline constexpr static
+bool x<T, long> = 2;
 
 
diff --git a/test-files/golden-tests/metadata/static-data-template.xml b/test-files/golden-tests/metadata/static-data-template.xml index aab81791bb..23e3580a00 100644 --- a/test-files/golden-tests/metadata/static-data-template.xml +++ b/test-files/golden-tests/metadata/static-data-template.xml @@ -12,8 +12,9 @@ - - + + + diff --git a/test-files/golden-tests/metadata/var-inline-constexpr.adoc b/test-files/golden-tests/metadata/var-inline-constexpr.adoc new file mode 100644 index 0000000000..1349b4239c --- /dev/null +++ b/test-files/golden-tests/metadata/var-inline-constexpr.adoc @@ -0,0 +1,173 @@ += Reference +:mrdocs: + +[#index] +== Global namespace + + +=== Variables + +[cols=1] +|=== +| Name + +| <> +| <> +| <> +| <> +| <> +| <> +| <> +| <> +| <> +| <> +|=== + +[#var] +== var + + +=== Synopsis + + +Declared in `<var‐inline‐constexpr.cpp>` + +[source,cpp,subs="verbatim,replacements,macros,-callouts"] +---- +int var = 5; +---- + +[#var_const] +== var_const + + +=== Synopsis + + +Declared in `<var‐inline‐constexpr.cpp>` + +[source,cpp,subs="verbatim,replacements,macros,-callouts"] +---- +int const var_const = 4; +---- + +[#var_const_t] +== var_const_t + + +=== Synopsis + + +Declared in `<var‐inline‐constexpr.cpp>` + +[source,cpp,subs="verbatim,replacements,macros,-callouts"] +---- +template<class T> +T const var_const_t; +---- + +[#var_constexpr] +== var_constexpr + + +=== Synopsis + + +Declared in `<var‐inline‐constexpr.cpp>` + +[source,cpp,subs="verbatim,replacements,macros,-callouts"] +---- +constexpr int var_constexpr = 2; +---- + +[#var_constexpr_t] +== var_constexpr_t + + +=== Synopsis + + +Declared in `<var‐inline‐constexpr.cpp>` + +[source,cpp,subs="verbatim,replacements,macros,-callouts"] +---- +template<class T> +constexpr T var_constexpr_t; +---- + +[#var_inline_const] +== var_inline_const + + +=== Synopsis + + +Declared in `<var‐inline‐constexpr.cpp>` + +[source,cpp,subs="verbatim,replacements,macros,-callouts"] +---- +inline int const var_inline_const = 3; +---- + +[#var_inline_const_t] +== var_inline_const_t + + +=== Synopsis + + +Declared in `<var‐inline‐constexpr.cpp>` + +[source,cpp,subs="verbatim,replacements,macros,-callouts"] +---- +template<class T> +inline T const var_inline_const_t; +---- + +[#var_inline_constexpr] +== var_inline_constexpr + + +=== Synopsis + + +Declared in `<var‐inline‐constexpr.cpp>` + +[source,cpp,subs="verbatim,replacements,macros,-callouts"] +---- +inline constexpr int var_inline_constexpr = 1; +---- + +[#var_inline_constexpr_t] +== var_inline_constexpr_t + + +=== Synopsis + + +Declared in `<var‐inline‐constexpr.cpp>` + +[source,cpp,subs="verbatim,replacements,macros,-callouts"] +---- +template<class T> +inline constexpr T var_inline_constexpr_t; +---- + +[#var_t] +== var_t + + +=== Synopsis + + +Declared in `<var‐inline‐constexpr.cpp>` + +[source,cpp,subs="verbatim,replacements,macros,-callouts"] +---- +template<class T> +T var_t; +---- + + + +[.small]#Created with https://www.mrdocs.com[MrDocs]# diff --git a/test-files/golden-tests/metadata/var-inline-constexpr.cpp b/test-files/golden-tests/metadata/var-inline-constexpr.cpp new file mode 100644 index 0000000000..ab900d4ba8 --- /dev/null +++ b/test-files/golden-tests/metadata/var-inline-constexpr.cpp @@ -0,0 +1,25 @@ +inline constexpr int var_inline_constexpr = 1; + +constexpr int var_constexpr = 2; + +inline const int var_inline_const = 3; + +const int var_const = 4; + +int var = 5; + +template +inline constexpr T var_inline_constexpr_t; + +template +constexpr T var_constexpr_t; + +template +inline const T var_inline_const_t; + +template +const T var_const_t; + +template +T var_t; + diff --git a/test-files/golden-tests/metadata/var-inline-constexpr.html b/test-files/golden-tests/metadata/var-inline-constexpr.html new file mode 100644 index 0000000000..55fdbf0036 --- /dev/null +++ b/test-files/golden-tests/metadata/var-inline-constexpr.html @@ -0,0 +1,195 @@ + + +Reference + + +
+

Reference

+
+
+

Global namespace

+
+

Variables

+ + + + + + + + + + + + + + + + + + + +
Name
var
var_const
var_const_t
var_constexpr
var_constexpr_t
var_inline_const
var_inline_const_t
var_inline_constexpr
var_inline_constexpr_t
var_t
+
+
+
+

var

+
+
+

Synopsis

+
+Declared in <var-inline-constexpr.cpp>
+
+
+int var = 5;
+
+
+
+
+
+
+

var_const

+
+
+

Synopsis

+
+Declared in <var-inline-constexpr.cpp>
+
+
+int const var_const = 4;
+
+
+
+
+
+
+

var_const_t

+
+
+

Synopsis

+
+Declared in <var-inline-constexpr.cpp>
+
+
+template<class T>
+T const var_const_t;
+
+
+
+
+
+
+

var_constexpr

+
+
+

Synopsis

+
+Declared in <var-inline-constexpr.cpp>
+
+
+constexpr int var_constexpr = 2;
+
+
+
+
+
+
+

var_constexpr_t

+
+
+

Synopsis

+
+Declared in <var-inline-constexpr.cpp>
+
+
+template<class T>
+constexpr T var_constexpr_t;
+
+
+
+
+
+
+

var_inline_const

+
+
+

Synopsis

+
+Declared in <var-inline-constexpr.cpp>
+
+
+inline int const var_inline_const = 3;
+
+
+
+
+
+
+

var_inline_const_t

+
+
+

Synopsis

+
+Declared in <var-inline-constexpr.cpp>
+
+
+template<class T>
+inline T const var_inline_const_t;
+
+
+
+
+
+
+

var_inline_constexpr

+
+
+

Synopsis

+
+Declared in <var-inline-constexpr.cpp>
+
+
+inline constexpr int var_inline_constexpr = 1;
+
+
+
+
+
+
+

var_inline_constexpr_t

+
+
+

Synopsis

+
+Declared in <var-inline-constexpr.cpp>
+
+
+template<class T>
+inline constexpr T var_inline_constexpr_t;
+
+
+
+
+
+
+

var_t

+
+
+

Synopsis

+
+Declared in <var-inline-constexpr.cpp>
+
+
+template<class T>
+T var_t;
+
+
+
+
+ +
+
+

Created with MrDocs

+
+ + \ No newline at end of file diff --git a/test-files/golden-tests/metadata/var-inline-constexpr.xml b/test-files/golden-tests/metadata/var-inline-constexpr.xml new file mode 100644 index 0000000000..e87f5b9dba --- /dev/null +++ b/test-files/golden-tests/metadata/var-inline-constexpr.xml @@ -0,0 +1,69 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/test-files/golden-tests/metadata/var-template.adoc b/test-files/golden-tests/metadata/var-template.adoc index 17c01e73cf..bac7195a04 100644 --- a/test-files/golden-tests/metadata/var-template.adoc +++ b/test-files/golden-tests/metadata/var-template.adoc @@ -63,7 +63,7 @@ Declared in `<var‐template.cpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<typename T> -static +inline static unsigned int C = 0; ---- @@ -79,7 +79,7 @@ Declared in `<var‐template.cpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<> -static +inline static unsigned int C<int> = ‐1; ---- @@ -95,7 +95,7 @@ Declared in `<var‐template.cpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<typename T> -static +inline static unsigned int C<T*> = sizeof(T); ---- diff --git a/test-files/golden-tests/metadata/var-template.html b/test-files/golden-tests/metadata/var-template.html index f6252239a0..94ab5fa9c8 100644 --- a/test-files/golden-tests/metadata/var-template.html +++ b/test-files/golden-tests/metadata/var-template.html @@ -78,7 +78,7 @@

Synopsis

 
 template<typename T>
-static
+inline static
 unsigned int C = 0;
 
 
@@ -95,7 +95,7 @@

Synopsis

 
 template<>
-static
+inline static
 unsigned int C<int> = -1;
 
 
@@ -112,7 +112,7 @@

Synopsis

 
 template<typename T>
-static
+inline static
 unsigned int C<T*> = sizeof(T);
 
 
diff --git a/test-files/golden-tests/metadata/var-template.xml b/test-files/golden-tests/metadata/var-template.xml index 23acd786c1..b651d6287a 100644 --- a/test-files/golden-tests/metadata/var-template.xml +++ b/test-files/golden-tests/metadata/var-template.xml @@ -31,6 +31,7 @@ + @@ -39,6 +40,7 @@ + @@ -48,6 +50,7 @@ +