-
-
Notifications
You must be signed in to change notification settings - Fork 201
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
Scoped rendering #512
Scoped rendering #512
Conversation
This looks like it might also fix #511. I will try to properly review this within a few days, need to find a timeslot to take a good look at this. On a side note, does this need Sphinx >= 3.0 still or is scoped rendering something from 3.1.x or similar future version? |
It will at least change the result, but if I remember correctly there is something icky with the Doxygen XML and anon unions.
It should work with >= 3.0.0. |
Hello. I'm encountering a bunch of errors when running Exhale + Breathe on my C++ project (planning to open an issue); I'm posting here because this PR fixes a lot of them, and maybe this can help identify duplicates or other potential issues that can be fixed. Fixed by this PR:
Link to the log file. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am almost ashamed only posting some pedantic style inconsistency comments. Still, Everything else seems fine to me. @jakobandersen I intend on merging after the two comments are handled. Thanks again.
Also, switches from deprecated PyModulelevel to PyFunction. Also, fixes issue with false typing of function arguments.
Also, switches from deprecated PyClassmember to PyAttribute. Also, fixes the cases with initializer.
Also, fixes the display, 'module' instead of 'namespace'.
6de2223
to
fa6df5a
Compare
@LizardM4 thanks for posting other related issues, will handle those too. |
The Short Version
Implement the idea sketched in #354 (comment):
definition
XML, and construct a fully qualified name,construct the declaration string from other parts of the XML.
The qualification is now provided by the previous point.
The Slightly Longer Version
When processing the rst
Sphinx will run the class directive with
A
and then in a nested parse eventually run the var directive withint i
. The C/C++/Python domains then handle the scoping ofi
insideA
.Breathe was created before this scoping mechanism was implemented, and thus worked around it by executing a hybrid of
with respect to the domains, but rendered as if the variable was nested in the class directive. Breathe then removes the
A::
part by manipulation of the doctree.In order to construct the fully qualified name for
i
thedefinition
tag in the XML is used. However, the content of this tag is not always correct. For example, many of the problems with templates is due to this, and the function pointer reshuffling is as well.This PR changes the rendering such that Breathe renders the content of a directive as if it was the result of a nested parse, meaning the fully qualified name is no longer needed. The declarations are therefore now stitched together using other parts of the XML.
Changes (apart from the scoped rendering)
PyModulelevel
directive toPyFunction
.(e.g.,
__init__(self self)
.PyClassmember
directive toPyAttribute
.namespace
->module
.Testing
I have only tested with Breathe it self and a few repro projects mentioned in issues.
Fixed Issues
Issues that I have tested to be fixed with this PR:
noexcept
not rendered #338, help me fix the full template specializations? #354, Duplicate IDs when using INLINE_INHERITED_MEMBERS=YES #356, Spurious "Too many template argument lists compared to parameter lists" error #407, "WARNING: Duplicate declaration" for enum class members #470, C domain generation doesn't work with Breathe v4.12+ #483, Bug in generated HTML when using function pointer inside a struct #489Perhaps Fixed Issues
Issues with a good chance of being fixed by this PR, but not confirmed:
TODOs for the future(?)
::
the name extraction will probably fail.CPPExpr
to get an xref, but itsconstruction requires some arguments that I'm not sure how to immediately get
(perhaps from the context object?).
and there are no test cases). Once done, a lot of old code can be removed.
one in the Doxygen XML. I'm not not where these IDs are actually used.
doxygenfunction
directive results inDuplicate declaration
warnings. I believe the problem is that Breatherenders function declarations twice, once to figure out if the function
is actually selected by the directive (
directives.py:237
), and thensecondly to actual rendering into the output. The first round is discarded.
Instead of the full rendering it may be possible to use the Sphinx C++ parser
directly to essentially do the same trick.
My best guess is that this is the issue reported in Duplicate declaration warning for overloaded functions #504.
It looks like this PR breaks the current trick when function templates are
involved.