Skip to content

Commit 4c0b7a8

Browse files
committed
Function lookup, more stripping of declarators
1 parent a89224e commit 4c0b7a8

3 files changed

Lines changed: 19 additions & 8 deletions

File tree

breathe/directives/function.py

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -148,15 +148,20 @@ def stripParamQual(paramQual):
148148
continue
149149
p.arg.init = None # type: ignore
150150
declarator = p.arg.type.decl
151-
while hasattr(declarator, 'next'):
152-
if isinstance(declarator, cpp.ASTDeclaratorParen):
153-
assert hasattr(declarator, 'inner')
154-
declarator = declarator.inner # type: ignore
151+
152+
def stripDeclarator(declarator):
153+
if hasattr(declarator, 'next'):
154+
stripDeclarator(declarator.next)
155+
if isinstance(declarator, cpp.ASTDeclaratorParen):
156+
assert hasattr(declarator, 'inner')
157+
stripDeclarator(declarator.inner)
155158
else:
156-
declarator = declarator.next # type: ignore
157-
assert hasattr(declarator, 'declId')
158-
assert isinstance(declarator, cpp.ASTDeclaratorNameParamQual)
159-
declarator.declId = None # type: ignore
159+
assert isinstance(declarator, cpp.ASTDeclaratorNameParamQual)
160+
assert hasattr(declarator, 'declId')
161+
declarator.declId = None # type: ignore
162+
if declarator.paramQual is not None:
163+
stripParamQual(declarator.paramQual)
164+
stripDeclarator(declarator)
160165
stripParamQual(paramQual)
161166
return paramQual
162167

documentation/source/specific.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,9 @@ This one should actually have ``[[myattr]]`` but Doxygen seems to not put attrib
274274
.. doxygenfunction:: fParen(void (*)())
275275
:project: cpp_function_lookup
276276

277+
.. doxygenfunction:: fParenPlain(void (*)(int))
278+
:project: cpp_function_lookup
279+
277280

278281
Doxygen xrefsect
279282
----------------

examples/specific/cpp_function_lookup.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,6 @@ void fParamPack(T ...arg);
1717
class A {};
1818
void fMemPtr(int A::*arg);
1919
void fParen(void (*arg)());
20+
21+
// different parameters in a function pointer
22+
void fParenPlain(void (*arg)(int argInner));

0 commit comments

Comments
 (0)