diff options
author | Topi Reinio <topi.reinio@qt.io> | 2020-05-08 12:24:51 +0200 |
---|---|---|
committer | Topi Reinio <topi.reinio@qt.io> | 2020-06-04 10:51:50 +0200 |
commit | 4f97a639cc39e8b1a42181a662b1059cd9c1d581 (patch) | |
tree | 4a8143582d59a0faf8a254c4d87fd9d5868c483e /src/qdoc/cppcodemarker.cpp | |
parent | 2ac73d6427b9e305a0af45f03733ae0a84190e40 (diff) | |
download | qttools-4f97a639cc39e8b1a42181a662b1059cd9c1d581.tar.gz |
qdoc: Improve handling of templated types
The Clang visitor did not differentiate between templated class-like
types, always assuming that it is a 'class'. Fix this by retrieving
the type of the specialization the template refers to.
Ensure that templated structs and unions are named correctly in the
generated output.
Handle the type of the cursor that refers to a templated type alias,
and improve the code for resolving the template parameters for aliases.
[ChangeLog][qdoc] QDoc now correctly handles templated structs, unions,
and type aliases.
Pick-to: 5.15
Fixes: QTBUG-67432
Change-Id: Ia0fbfe7b7f22a54270650d96d0d67a4b8b8fd182
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Diffstat (limited to 'src/qdoc/cppcodemarker.cpp')
-rw-r--r-- | src/qdoc/cppcodemarker.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/qdoc/cppcodemarker.cpp b/src/qdoc/cppcodemarker.cpp index 5ccac07ac..5abcbb59d 100644 --- a/src/qdoc/cppcodemarker.cpp +++ b/src/qdoc/cppcodemarker.cpp @@ -110,10 +110,11 @@ QString CppCodeMarker::markedUpSynopsis(const Node *node, const Node * /* relati switch (node->nodeType()) { case Node::Namespace: - synopsis = "namespace " + name; - break; case Node::Class: - synopsis = "class " + name; + case Node::Struct: + case Node::Union: + synopsis = Node::nodeTypeString(node->nodeType()); + synopsis += QLatin1Char(' ') + name; break; case Node::Function: func = (const FunctionNode *)node; @@ -236,8 +237,12 @@ QString CppCodeMarker::markedUpSynopsis(const Node *node, const Node * /* relati case Node::TypeAlias: if (style == Section::Summary) synopsis = "(alias) "; - else if (style == Section::Details) + else if (style == Section::Details) { extra = QStringLiteral("[alias] "); + QString templateDecl = node->templateDecl(); + if (!templateDecl.isEmpty()) + synopsis = templateDecl + QLatin1Char(' '); + } synopsis += name; break; case Node::Typedef: |