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 1, 2021
1 parent a89224e commit 4c0b7a8
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 @@ -274,6 +274,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 4c0b7a8

Please sign in to comment.