Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add various specifiers to functions and variables #628

Merged
merged 2 commits into from
Feb 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 21 additions & 7 deletions breathe/renderer/sphinxrenderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1607,8 +1607,19 @@ def visit_function(self, node) -> List[Node]:
declaration = name + node.get_argsstring()
else:
elements = [self.create_template_prefix(node)]
if node.static == 'yes':
elements.append('static')
if node.inline == 'yes':
elements.append('inline')
if node.kind == 'friend':
elements.append('friend')
if node.virt in ('virtual', 'pure-virtual'):
elements.append('virtual')
if node.explicit == 'yes':
elements.append('explicit')
if 'constexpr' in dir(node):
assert node.constexpr == 'yes'
elements.append('constexpr')
elements.append(''.join(n.astext()
for n in self.render(node.get_type()))) # type: ignore
elements.append(name)
Expand Down Expand Up @@ -1758,16 +1769,19 @@ def visit_variable(self, node) -> List[Node]:
if len(initializer) != 0:
options['value'] = initializer
else:
elements = [self.create_template_prefix(node)]
if node.static == 'yes':
elements.append('static')
if node.mutable == 'yes':
elements.append('mutable')
typename = ''.join(n.astext() for n in self.render(node.get_type()))
if dom == 'c' and '::' in typename:
typename = typename.replace('::', '.')
declaration = ' '.join([
self.create_template_prefix(node),
typename,
name,
node.get_argsstring(),
self.make_initializer(node)
])
elements.append(typename)
elements.append(name)
elements.append(node.get_argsstring())
elements.append(self.make_initializer(node))
declaration = ' '.join(elements)
if not dom or dom in ('c', 'cpp', 'py', 'cs'):
return self.handle_declaration(node, declaration, options=options)
else:
Expand Down
2 changes: 2 additions & 0 deletions tests/warnings/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
#
# All configuration values have a default; values that are commented out
# serve to show the default.
#
# mypy: ignore-errors

import sys
import os
Expand Down