summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Wicking <paul.wicking@qt.io>2020-03-06 06:38:01 +0100
committerPaul Wicking <paul.wicking@qt.io>2020-03-06 14:54:41 +0100
commitfcd523048f02025e7563a4a6a17f6e5ff98ca6bb (patch)
tree4cfd07631eaf73a259745e2beb96356c539712b8
parente18472fdd03a1a0633aa153ba8e579be4869fcf3 (diff)
QDoc: Use correct node type string for \since in shared comments
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 <kai.koehne@qt.io> Reviewed-by: Topi Reiniƶ <topi.reinio@qt.io>
-rw-r--r--src/qdoc/generator.cpp4
-rw-r--r--tests/auto/qdoc/generatedoutput/expected_output/docbook/testqdoc-test.xml1
-rw-r--r--tests/auto/qdoc/generatedoutput/expected_output/ignoresince/testqdoc-test.html1
-rw-r--r--tests/auto/qdoc/generatedoutput/expected_output/scopedenum/testqdoc-test.html1
-rw-r--r--tests/auto/qdoc/generatedoutput/expected_output/template/testqdoc-test.html1
-rw-r--r--tests/auto/qdoc/generatedoutput/expected_output/testqdoc-test.html1
-rw-r--r--tests/auto/qdoc/generatedoutput/testdata/testcpp/testcpp.cpp1
7 files changed, 10 insertions, 0 deletions
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<const SharedCommentNode *>(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 @@
<db:synopsisinfo db:role="module">TestCPP</db:synopsisinfo>
</db:synopsis>
<db:para>Overloads that share a documentation comment, optionally taking a parameter <db:code role="parameter">b</db:code>.</db:para>
+<db:para>This function was introduced in Test 1.2.</db:para>
</db:section>
<db:section xml:id="inlineFunction">
<db:title>Test::void inlineFunction()</db:title>
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 @@
<div class="fngroup">
<h3 class="fn fngroupitem" id="overload"><a name="overload"></a><code>[protected] </code><span class="type">void</span> Test::<span class="name">overload</span>()</h3><h3 class="fn fngroupitem" id="overload-1"><a name="overload-1"></a><code>[protected] </code><span class="type">void</span> Test::<span class="name">overload</span>(<span class="type">bool</span> <i>b</i>)</h3></div>
<p>Overloads that share a documentation comment, optionally taking a parameter <i>b</i>.</p>
+<p>This function was introduced in Test 1.2.</p>
<!-- @@@ -->
<!-- $$$inlineFunction[overload1]$$$inlineFunction -->
<h3 class="fn" id="inlineFunction"><a name="inlineFunction"></a><span class="type">void</span> Test::<span class="name">inlineFunction</span>()</h3>
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 @@
<div class="fngroup">
<h3 class="fn fngroupitem" id="overload"><a name="overload"></a><code>[protected] </code><span class="type">void</span> Test::<span class="name">overload</span>()</h3><h3 class="fn fngroupitem" id="overload-1"><a name="overload-1"></a><code>[protected] </code><span class="type">void</span> Test::<span class="name">overload</span>(<span class="type">bool</span> <i>b</i>)</h3></div>
<p>Overloads that share a documentation comment, optionally taking a parameter <i>b</i>.</p>
+<p>This function was introduced in Test 1.2.</p>
<!-- @@@ -->
<!-- $$$inlineFunction[overload1]$$$inlineFunction -->
<h3 class="fn" id="inlineFunction"><a name="inlineFunction"></a><span class="type">void</span> Test::<span class="name">inlineFunction</span>()</h3>
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 @@
<div class="fngroup">
<h3 class="fn fngroupitem" id="overload"><a name="overload"></a><code>[protected] </code><span class="type">void</span> Test::<span class="name">overload</span>()</h3><h3 class="fn fngroupitem" id="overload-1"><a name="overload-1"></a><code>[protected] </code><span class="type">void</span> Test::<span class="name">overload</span>(<span class="type">bool</span> <i>b</i>)</h3></div>
<p>Overloads that share a documentation comment, optionally taking a parameter <i>b</i>.</p>
+<p>This function was introduced in Test 1.2.</p>
<!-- @@@ -->
<!-- $$$funcTemplate[overload1]$$$funcTemplateT1T2 -->
<h3 class="fn" id="funcTemplate"><a name="funcTemplate"></a><code>[protected] </code>template &lt;typename T1, typename T2&gt; <span class="type">void</span> Test::<span class="name">funcTemplate</span>(<span class="type">T1</span> <i>a</i>, <span class="type">T2</span> <i>b</i>)</h3>
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 @@
<div class="fngroup">
<h3 class="fn fngroupitem" id="overload"><a name="overload"></a><code>[protected] </code><span class="type">void</span> Test::<span class="name">overload</span>()</h3><h3 class="fn fngroupitem" id="overload-1"><a name="overload-1"></a><code>[protected] </code><span class="type">void</span> Test::<span class="name">overload</span>(<span class="type">bool</span> <i>b</i>)</h3></div>
<p>Overloads that share a documentation comment, optionally taking a parameter <i>b</i>.</p>
+<p>This function was introduced in Test 1.2.</p>
<!-- @@@ -->
<!-- $$$inlineFunction[overload1]$$$inlineFunction -->
<h3 class="fn" id="inlineFunction"><a name="inlineFunction"></a><span class="type">void</span> Test::<span class="name">inlineFunction</span>()</h3>
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