Skip to content

Handle inline forward-declared CXXRecordDecl types used as adjacent field/return/var/typedef types - #59

Merged
quic-rnamburi merged 1 commit into
qualcomm:mainfrom
likivisw:main
Aug 26, 2026
Merged

Handle inline forward-declared CXXRecordDecl types used as adjacent field/return/var/typedef types#59
quic-rnamburi merged 1 commit into
qualcomm:mainfrom
likivisw:main

Conversation

@likivisw

Copy link
Copy Markdown
Contributor

What changed

  • Added TreeBuilder::isInlineForwardDeclOfDeclType as a member method (moved out of the duplicate free function previously in tree_builder_utils.cpp/.hpp), with an added !Decl->isFreeStanding() guard.
  • TraverseCXXRecordDecl now excludes inline forward decls of the decl type so they aren't processed like regular non-templated main-file records.
  • BuildCXXRecordNode now 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 an APINode for 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.
  • Fixed a duplicated "struct" keyword in printed elaborated types (e.g. struct struct alpha5::alpha6) by suppressing the tag keyword on the qualifier's own printing policy in custom_type_printer.cpp.
  • Removed a stray debug print left in qualified_name_builder.cpp.

Tests

  • Added functional test cxx_forward_decl_definition_resolution covering forward-declared struct fields/return types/vars/typedefs, including nested namespaces and never-defined types.
  • Updated expected output for cxx_node_caching to reflect the corrected qualified-name/kind handling.

* 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]>
@quic-rnamburi quic-rnamburi changed the title Handle inline forward-declared CXXRecordDecl types used as adjacent field/return/var/typedef types (Release 0.7.5) Handle inline forward-declared CXXRecordDecl types used as adjacent field/return/var/typedef types Aug 26, 2026
@quic-rnamburi
quic-rnamburi merged commit dd0969f into qualcomm:main Aug 26, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants