Handle inline forward-declared CXXRecordDecl types used as adjacent field/return/var/typedef types - #59
Merged
Merged
Conversation
* Fix inline forward decls used as adjacent types * Add TreeBuilder::isInlineForwardDeclOfDeclType and use it in * TraverseCXXRecordDecl and BuildCXXRecordNode to detect inline * forward decls used as field, return, variable or typedef types * Prevent qualified name overrides for these record types * Ensure forward-declared record types appear in the API tree Signed-off-by: likith viswanath <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
TreeBuilder::isInlineForwardDeclOfDeclTypeas a member method (moved out of the duplicate free function previously intree_builder_utils.cpp/.hpp), with an added!Decl->isFreeStanding()guard.TraverseCXXRecordDeclnow excludes inline forward decls of the decl type so they aren't processed like regular non-templated main-file records.BuildCXXRecordNodenow detects a forward decl used as an adjacent field/return/var/typedef type and, when no definition exists and it isn't already cached, creates and caches anAPINodefor it by USR instead of silently skipping the qualified-name push.NodeKind(Struct/Union/Class) is now computed once up front instead of via a separate if/else block later in the function.struct struct alpha5::alpha6) by suppressing the tag keyword on the qualifier's own printing policy incustom_type_printer.cpp.qualified_name_builder.cpp.Tests
cxx_forward_decl_definition_resolutioncovering forward-declared struct fields/return types/vars/typedefs, including nested namespaces and never-defined types.cxx_node_cachingto reflect the corrected qualified-name/kind handling.