Skip to content

Commit

Permalink
doxygen: fix crash with class inheritance outside of a namespace.
Browse files Browse the repository at this point in the history
Amazing that I didn't come across this until now.
  • Loading branch information
mosra committed May 7, 2018
1 parent 389e5ba commit 4629958
Show file tree
Hide file tree
Showing 5 changed files with 90 additions and 2 deletions.
4 changes: 2 additions & 2 deletions doxygen/dox2html5.py
Original file line number Diff line number Diff line change
Expand Up @@ -2139,7 +2139,7 @@ def parse_xml(state: State, xml: str):
class_ = Empty()
class_.kind = symbol.kind
class_.url = symbol.url
class_.name = symbol.leaf_name if symbol.parent.startswith(state.compounds[compound.id].parent) else symbol.name
class_.name = symbol.leaf_name if state.compounds[compound.id].parent and symbol.parent.startswith(state.compounds[compound.id].parent) else symbol.name
class_.brief = symbol.brief
class_.templates = symbol.templates
class_.is_deprecated = symbol.is_deprecated
Expand All @@ -2162,7 +2162,7 @@ def parse_xml(state: State, xml: str):
class_ = Empty()
class_.kind = symbol.kind
class_.url = symbol.url
class_.name = symbol.leaf_name if symbol.parent.startswith(state.compounds[compound.id].parent) else symbol.name
class_.name = symbol.leaf_name if state.compounds[compound.id].parent and symbol.parent.startswith(state.compounds[compound.id].parent) else symbol.name
class_.brief = symbol.brief
class_.templates = symbol.templates
class_.is_deprecated = symbol.is_deprecated
Expand Down
40 changes: 40 additions & 0 deletions doxygen/test/cpp_derived/classBaseOutsideANamespace.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 40 additions & 0 deletions doxygen/test/cpp_derived/classDerivedOutsideANamespace.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions doxygen/test/cpp_derived/input.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,9 @@ namespace Namespace {
struct UndocumentedDerived: A {};

}

/** @brief A base class outside of a namespace */
class BaseOutsideANamespace {};

/** @brief A derived class outside of a namespace */
class DerivedOutsideANamespace: public BaseOutsideANamespace {};
2 changes: 2 additions & 0 deletions doxygen/test/test_cpp.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,5 @@ def test(self):
self.assertEqual(*self.actual_expected_contents('classNamespace_1_1PrivateBase.html'))
self.assertEqual(*self.actual_expected_contents('classAnother_1_1ProtectedBase.html'))
self.assertEqual(*self.actual_expected_contents('classNamespace_1_1VirtualBase.html'))
self.assertEqual(*self.actual_expected_contents('classBaseOutsideANamespace.html'))
self.assertEqual(*self.actual_expected_contents('classDerivedOutsideANamespace.html'))

0 comments on commit 4629958

Please sign in to comment.