From d4064dd83eca3df5c766d1c456fa060233a1288d Mon Sep 17 00:00:00 2001 From: Topi Reinio Date: Thu, 2 Jan 2020 10:42:33 +0100 Subject: qdoc: Fix regression in C++ functions sharing a documentation comment After a recent refactoring, the function that distributes c++ documentation nodes failed to do anything with a function node that was sharing a comment with other nodes. Fix the issue and add a testcase for shared c++ \fn documentation comments. Fixes: QTBUG-81005 Change-Id: I6320bab232671f8cd969a37136708fc172de8409 Reviewed-by: Paul Wicking --- src/qdoc/sections.cpp | 6 ++---- .../expected_output/html/testqdoc-test.webxml | 7 +++++++ .../expected_output/html/testqdoc-testderived.webxml | 4 ++-- .../expected_output/testqdoc-test-members.html | 2 ++ .../qdoc/generatedoutput/expected_output/testqdoc-test.html | 12 ++++++++++++ tests/auto/qdoc/generatedoutput/testcpp.cpp | 8 ++++++++ tests/auto/qdoc/generatedoutput/testcpp.h | 4 ++++ 7 files changed, 37 insertions(+), 6 deletions(-) diff --git a/src/qdoc/sections.cpp b/src/qdoc/sections.cpp index 7d5bcf03f..edfa212ce 100644 --- a/src/qdoc/sections.cpp +++ b/src/qdoc/sections.cpp @@ -826,10 +826,8 @@ void Sections::distributeNodeInDetailsVector(SectionVector &dv, Node *n) } if (fn->isIgnored()) return; - if (!fn->isSharingComment()) { - if (!fn->hasAssociatedProperties() || !fn->doc().isEmpty()) - dv[DetailsMemberFunctions].insert(n); - } + if (!fn->hasAssociatedProperties() || !fn->doc().isEmpty()) + dv[DetailsMemberFunctions].insert(n); return; } if (t->isRelatedNonmember()) { diff --git a/tests/auto/qdoc/generatedoutput/expected_output/html/testqdoc-test.webxml b/tests/auto/qdoc/generatedoutput/expected_output/html/testqdoc-test.webxml index 028921a6e..5d88b6e7c 100644 --- a/tests/auto/qdoc/generatedoutput/expected_output/html/testqdoc-test.webxml +++ b/tests/auto/qdoc/generatedoutput/expected_output/html/testqdoc-test.webxml @@ -31,6 +31,13 @@ Use someFunction() instead. + + + + + + + diff --git a/tests/auto/qdoc/generatedoutput/expected_output/html/testqdoc-testderived.webxml b/tests/auto/qdoc/generatedoutput/expected_output/html/testqdoc-testderived.webxml index 07b6c4caf..c0c8d852f 100644 --- a/tests/auto/qdoc/generatedoutput/expected_output/html/testqdoc-testderived.webxml +++ b/tests/auto/qdoc/generatedoutput/expected_output/html/testqdoc-testderived.webxml @@ -1,11 +1,11 @@ - + A derived class in a namespace. - + diff --git a/tests/auto/qdoc/generatedoutput/expected_output/testqdoc-test-members.html b/tests/auto/qdoc/generatedoutput/expected_output/testqdoc-test-members.html index a52123a32..3900ff8cb 100644 --- a/tests/auto/qdoc/generatedoutput/expected_output/testqdoc-test-members.html +++ b/tests/auto/qdoc/generatedoutput/expected_output/testqdoc-test-members.html @@ -13,6 +13,8 @@

This is the complete list of members for TestQDoc::Test, including inherited members.

  • inlineFunction()
  • +
  • overload()
  • +
  • overload(bool )
  • someFunction(int ) : int
  • someFunctionDefaultArg(int , bool )
  • virtualFun()
  • diff --git a/tests/auto/qdoc/generatedoutput/expected_output/testqdoc-test.html b/tests/auto/qdoc/generatedoutput/expected_output/testqdoc-test.html index f172a10e7..c4fb4ad0a 100644 --- a/tests/auto/qdoc/generatedoutput/expected_output/testqdoc-test.html +++ b/tests/auto/qdoc/generatedoutput/expected_output/testqdoc-test.html @@ -13,6 +13,7 @@

    Contents

    @@ -38,6 +39,12 @@ void someFunctionDefaultArg(int i, bool b = false) virtual void virtualFun() + +

    Protected Functions

    +
    + + +
    void overload()
    void overload(bool b)

    Macros

    @@ -51,6 +58,11 @@

    Member Function Documentation

    + +
    +

    [protected] void Test::overload()

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

    +

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

    +

    void Test::inlineFunction()

    An inline function, documented using the \fn QDoc command.

    diff --git a/tests/auto/qdoc/generatedoutput/testcpp.cpp b/tests/auto/qdoc/generatedoutput/testcpp.cpp index 3277d496d..f33a6a83c 100644 --- a/tests/auto/qdoc/generatedoutput/testcpp.cpp +++ b/tests/auto/qdoc/generatedoutput/testcpp.cpp @@ -139,4 +139,12 @@ void TestDerived::virtualFun() return; } +/*! + \fn TestQDoc::Test::overload() + \fn TestQDoc::Test::overload(bool b) + + Overloads that share a documentation comment, optionally taking + a parameter \a b. +*/ + } // namespace TestQDoc diff --git a/tests/auto/qdoc/generatedoutput/testcpp.h b/tests/auto/qdoc/generatedoutput/testcpp.h index 733f9e751..c34ada99b 100644 --- a/tests/auto/qdoc/generatedoutput/testcpp.h +++ b/tests/auto/qdoc/generatedoutput/testcpp.h @@ -40,6 +40,10 @@ public: void deprecatedMember(); inline void inlineFunction() {}; virtual void virtualFun(); + +protected: + void overload() {} + void overload(bool b) { if (!b) return; } }; class TestDerived : public Test { -- cgit v1.2.3