From fcd523048f02025e7563a4a6a17f6e5ff98ca6bb Mon Sep 17 00:00:00 2001 From: Paul Wicking Date: Fri, 6 Mar 2020 06:38:01 +0100 Subject: QDoc: Use correct node type string for \since in shared comments MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Shared comment nodes were not handled as a special case when generating "This [class/function/method/type/etc] was introduced in" strings when QDoc encountered a \since command. These ended up with the default value, "documentation", which led to unexpected text in the documentation. * Add handling of shared comment nodes and get the node type from the first node in the collective. * Amend generated output test to cover this scenario. Fixes: QTBUG-82534 Change-Id: I444e95e0214f312649ec2720c23c98e698402abf Reviewed-by: Kai Koehne Reviewed-by: Topi Reiniƶ --- src/qdoc/generator.cpp | 4 ++++ .../qdoc/generatedoutput/expected_output/docbook/testqdoc-test.xml | 1 + .../generatedoutput/expected_output/ignoresince/testqdoc-test.html | 1 + .../generatedoutput/expected_output/scopedenum/testqdoc-test.html | 1 + .../qdoc/generatedoutput/expected_output/template/testqdoc-test.html | 1 + tests/auto/qdoc/generatedoutput/expected_output/testqdoc-test.html | 1 + tests/auto/qdoc/generatedoutput/testdata/testcpp/testcpp.cpp | 1 + 7 files changed, 10 insertions(+) diff --git a/src/qdoc/generator.cpp b/src/qdoc/generator.cpp index abf0602df..bdeeec2be 100644 --- a/src/qdoc/generator.cpp +++ b/src/qdoc/generator.cpp @@ -2219,6 +2219,10 @@ QString Generator::typeString(const Node *node) case Node::JsModule: case Node::QmlModule: return "module"; + case Node::SharedComment: { + const auto &collective = static_cast(node)->collective(); + return collective.first()->nodeTypeString(); + } default: return "documentation"; } diff --git a/tests/auto/qdoc/generatedoutput/expected_output/docbook/testqdoc-test.xml b/tests/auto/qdoc/generatedoutput/expected_output/docbook/testqdoc-test.xml index 0cfeb1724..ad6a4f30f 100644 --- a/tests/auto/qdoc/generatedoutput/expected_output/docbook/testqdoc-test.xml +++ b/tests/auto/qdoc/generatedoutput/expected_output/docbook/testqdoc-test.xml @@ -45,6 +45,7 @@ TestCPP Overloads that share a documentation comment, optionally taking a parameter b. +This function was introduced in Test 1.2. Test::void inlineFunction() diff --git a/tests/auto/qdoc/generatedoutput/expected_output/ignoresince/testqdoc-test.html b/tests/auto/qdoc/generatedoutput/expected_output/ignoresince/testqdoc-test.html index 71c54c2e9..52a10f706 100644 --- a/tests/auto/qdoc/generatedoutput/expected_output/ignoresince/testqdoc-test.html +++ b/tests/auto/qdoc/generatedoutput/expected_output/ignoresince/testqdoc-test.html @@ -61,6 +61,7 @@

[protected] void Test::overload()

[protected] void Test::overload(bool b)

Overloads that share a documentation comment, optionally taking a parameter b.

+

This function was introduced in Test 1.2.

void Test::inlineFunction()

diff --git a/tests/auto/qdoc/generatedoutput/expected_output/scopedenum/testqdoc-test.html b/tests/auto/qdoc/generatedoutput/expected_output/scopedenum/testqdoc-test.html index 145fc724a..3fc1f2bc7 100644 --- a/tests/auto/qdoc/generatedoutput/expected_output/scopedenum/testqdoc-test.html +++ b/tests/auto/qdoc/generatedoutput/expected_output/scopedenum/testqdoc-test.html @@ -78,6 +78,7 @@

[protected] void Test::overload()

[protected] void Test::overload(bool b)

Overloads that share a documentation comment, optionally taking a parameter b.

+

This function was introduced in Test 1.2.

void Test::inlineFunction()

diff --git a/tests/auto/qdoc/generatedoutput/expected_output/template/testqdoc-test.html b/tests/auto/qdoc/generatedoutput/expected_output/template/testqdoc-test.html index d19d15535..4ec52916a 100644 --- a/tests/auto/qdoc/generatedoutput/expected_output/template/testqdoc-test.html +++ b/tests/auto/qdoc/generatedoutput/expected_output/template/testqdoc-test.html @@ -62,6 +62,7 @@

[protected] void Test::overload()

[protected] void Test::overload(bool b)

Overloads that share a documentation comment, optionally taking a parameter b.

+

This function was introduced in Test 1.2.

[protected] template <typename T1, typename T2> void Test::funcTemplate(T1 a, T2 b)

diff --git a/tests/auto/qdoc/generatedoutput/expected_output/testqdoc-test.html b/tests/auto/qdoc/generatedoutput/expected_output/testqdoc-test.html index f3c8d55d0..84c0c4fe3 100644 --- a/tests/auto/qdoc/generatedoutput/expected_output/testqdoc-test.html +++ b/tests/auto/qdoc/generatedoutput/expected_output/testqdoc-test.html @@ -61,6 +61,7 @@

[protected] void Test::overload()

[protected] void Test::overload(bool b)

Overloads that share a documentation comment, optionally taking a parameter b.

+

This function was introduced in Test 1.2.

void Test::inlineFunction()

diff --git a/tests/auto/qdoc/generatedoutput/testdata/testcpp/testcpp.cpp b/tests/auto/qdoc/generatedoutput/testdata/testcpp/testcpp.cpp index c8b3f2f46..643a6db6a 100644 --- a/tests/auto/qdoc/generatedoutput/testdata/testcpp/testcpp.cpp +++ b/tests/auto/qdoc/generatedoutput/testdata/testcpp/testcpp.cpp @@ -155,6 +155,7 @@ void TestDerived::virtualFun() /*! \fn TestQDoc::Test::overload() \fn Test::overload(bool b) + \since Test 1.2 //! The second overload should match even without the fully qualified path Overloads that share a documentation comment, optionally taking -- cgit v1.2.3