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 /tests/auto/qdoc/generatedoutput/testdata | |
parent | 2ac73d6427b9e305a0af45f03733ae0a84190e40 (diff) |
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 'tests/auto/qdoc/generatedoutput/testdata')
3 files changed, 26 insertions, 0 deletions
diff --git a/tests/auto/qdoc/generatedoutput/testdata/testcpp/testcpp.cpp b/tests/auto/qdoc/generatedoutput/testdata/testcpp/testcpp.cpp index 2343e7918..de8a9e4ec 100644 --- a/tests/auto/qdoc/generatedoutput/testdata/testcpp/testcpp.cpp +++ b/tests/auto/qdoc/generatedoutput/testdata/testcpp/testcpp.cpp @@ -197,4 +197,22 @@ void TestDerived::virtualFun() \endif */ +/*! +\if defined(test_template) + \struct TestQDoc::Test::Struct + \inmodule TestCPP + \brief Templated struct. +\else + \nothing +\endif +*/ + +/*! +\if defined(test_template) + \typealias TestQDoc::Test::Specialized +\else + \nothing +\endif +*/ + } // namespace TestQDoc diff --git a/tests/auto/qdoc/generatedoutput/testdata/testcpp/testcpp.h b/tests/auto/qdoc/generatedoutput/testdata/testcpp/testcpp.h index b9644eb94..b3dc3df2a 100644 --- a/tests/auto/qdoc/generatedoutput/testdata/testcpp/testcpp.h +++ b/tests/auto/qdoc/generatedoutput/testdata/testcpp/testcpp.h @@ -33,6 +33,13 @@ namespace TestQDoc { class Test { public: + +#ifdef test_template +template<typename D, typename T> struct Struct {}; +template<typename T> +using Specialized = Struct<int, T>; +#endif + #ifdef test_scopedenum enum class ScopedEnum : unsigned char { This = 0x01, diff --git a/tests/auto/qdoc/generatedoutput/testdata/testtemplate/testtemplate.cpp b/tests/auto/qdoc/generatedoutput/testdata/testtemplate/testtemplate.cpp index e9755769f..3214f4061 100644 --- a/tests/auto/qdoc/generatedoutput/testdata/testtemplate/testtemplate.cpp +++ b/tests/auto/qdoc/generatedoutput/testdata/testtemplate/testtemplate.cpp @@ -41,6 +41,7 @@ */ /*! + //! Baz is a struct, QDoc auto-converts this to the correct type \class Baz \inmodule TestCPP \brief Class template template. |