From: Vladimír Vondruš Date: Mon, 7 May 2018 20:53:05 +0000 (+0200) Subject: doxygen: fix crash with class inheritance outside of a namespace. X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~cjwatson/git?a=commitdiff_plain;h=4629958928d5bcf3b6f4e8854ed342c8b8bd39f1;p=blog.git doxygen: fix crash with class inheritance outside of a namespace. Amazing that I didn't come across this until now. --- diff --git a/doxygen/dox2html5.py b/doxygen/dox2html5.py index 54c9def5..c70df8c7 100755 --- a/doxygen/dox2html5.py +++ b/doxygen/dox2html5.py @@ -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 @@ -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 diff --git a/doxygen/test/cpp_derived/classBaseOutsideANamespace.html b/doxygen/test/cpp_derived/classBaseOutsideANamespace.html new file mode 100644 index 00000000..58fc4d92 --- /dev/null +++ b/doxygen/test/cpp_derived/classBaseOutsideANamespace.html @@ -0,0 +1,40 @@ + + + + + BaseOutsideANamespace class | My Project + + + + + +
+
+ + diff --git a/doxygen/test/cpp_derived/classDerivedOutsideANamespace.html b/doxygen/test/cpp_derived/classDerivedOutsideANamespace.html new file mode 100644 index 00000000..fc670e89 --- /dev/null +++ b/doxygen/test/cpp_derived/classDerivedOutsideANamespace.html @@ -0,0 +1,40 @@ + + + + + DerivedOutsideANamespace class | My Project + + + + + +
+
+
+
+
+

+ DerivedOutsideANamespace class +

+

A derived class outside of a namespace.

+
+

Base classes

+
+
+ class BaseOutsideANamespace +
+
A base class outside of a namespace.
+
+
+
+
+
+
+ + diff --git a/doxygen/test/cpp_derived/input.h b/doxygen/test/cpp_derived/input.h index 5554104d..2800095b 100644 --- a/doxygen/test/cpp_derived/input.h +++ b/doxygen/test/cpp_derived/input.h @@ -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 {}; diff --git a/doxygen/test/test_cpp.py b/doxygen/test/test_cpp.py index 1b3d6e71..d88db18f 100644 --- a/doxygen/test/test_cpp.py +++ b/doxygen/test/test_cpp.py @@ -59,3 +59,5 @@ class Derived(IntegrationTestCase): 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'))