Skip to content

Commit

Permalink
doxygen: it gets extra shitty when encountering decltype(auto).
Browse files Browse the repository at this point in the history
Seriously, is the parser a box full of angry monkeys?! How is this
possible.
  • Loading branch information
mosra committed Feb 23, 2019
1 parent 540c41f commit 193ab80
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 0 deletions.
6 changes: 6 additions & 0 deletions doxygen/dox2html5.py
Original file line number Diff line number Diff line change
Expand Up @@ -1849,6 +1849,12 @@ def parse_func(state: State, element: ET.Element):
elif func.type.startswith('constexpr'):
func.type = func.type[10:]
func.is_constexpr = True
# For some effing reason, when a constexpr function has decltype(auto)
# return type, Doxygen swaps the order of those two, causing the constexpr
# to be last. See the cpp_function_attributes test for a verification.
elif func.type.endswith('constexpr'):
func.type = func.type[:-10]
func.is_constexpr = True
else:
func.is_constexpr = False
func.prefix = ''
Expand Down
16 changes: 16 additions & 0 deletions doxygen/test/cpp_function_attributes/input.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,22 @@ struct Foo {
* Details.
*/
virtual void foo() const noexcept(false) = 0;

/**
* @brief Random type and constexpr together
*
* This is okay.
*/
constexpr Foo& bar() noexcept;

/**
* @brief decltype(auto) and constexpr together
*
* For some reason, due to decltype(auto), Doxygen swaps the order, causing
* the constexpr to be hard to detect. Don't even ask how it handles
* trailing return types. It's just HORRIBLE.
*/
constexpr decltype(auto) baz() noexcept;
};

/** @brief Base class */
Expand Down
22 changes: 22 additions & 0 deletions doxygen/test/cpp_function_attributes/structFoo.html

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

0 comments on commit 193ab80

Please sign in to comment.