Skip to content

Commit

Permalink
Function lookup, more stripping of declarators
Browse files Browse the repository at this point in the history
  • Loading branch information
jakobandersen committed Sep 2, 2021
1 parent bd26a7f commit b3ec822
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 8 deletions.
21 changes: 13 additions & 8 deletions breathe/directives/function.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,15 +148,20 @@ def stripParamQual(paramQual):
continue
p.arg.init = None # type: ignore
declarator = p.arg.type.decl
while hasattr(declarator, 'next'):
if isinstance(declarator, cpp.ASTDeclaratorParen):
assert hasattr(declarator, 'inner')
declarator = declarator.inner # type: ignore

def stripDeclarator(declarator):
if hasattr(declarator, 'next'):
stripDeclarator(declarator.next)
if isinstance(declarator, cpp.ASTDeclaratorParen):
assert hasattr(declarator, 'inner')
stripDeclarator(declarator.inner)
else:
declarator = declarator.next # type: ignore
assert hasattr(declarator, 'declId')
assert isinstance(declarator, cpp.ASTDeclaratorNameParamQual)
declarator.declId = None # type: ignore
assert isinstance(declarator, cpp.ASTDeclaratorNameParamQual)
assert hasattr(declarator, 'declId')
declarator.declId = None # type: ignore
if declarator.paramQual is not None:
stripParamQual(declarator.paramQual)
stripDeclarator(declarator)
stripParamQual(paramQual)
return paramQual

Expand Down
3 changes: 3 additions & 0 deletions documentation/source/specific.rst
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,9 @@ This one should actually have ``[[myattr]]`` but Doxygen seems to not put attrib
.. doxygenfunction:: fParen(void (*)())
:project: cpp_function_lookup

.. doxygenfunction:: fParenPlain(void (*)(int))
:project: cpp_function_lookup


Doxygen xrefsect
----------------
Expand Down
3 changes: 3 additions & 0 deletions examples/specific/cpp_function_lookup.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,6 @@ void fParamPack(T ...arg);
class A {};
void fMemPtr(int A::*arg);
void fParen(void (*arg)());

// different parameters in a function pointer
void fParenPlain(void (*arg)(int argInner));

0 comments on commit b3ec822

Please sign in to comment.