Skip to content

[IRGenDebugInfo][CodeView] Name inner type member in bound generic sized containers#88419

Open
speednoisemovement wants to merge 1 commit intoswiftlang:mainfrom
speednoisemovement:inner_struct_name
Open

[IRGenDebugInfo][CodeView] Name inner type member in bound generic sized containers#88419
speednoisemovement wants to merge 1 commit intoswiftlang:mainfrom
speednoisemovement:inner_struct_name

Conversation

@speednoisemovement
Copy link
Copy Markdown
Contributor

As a workaround for issues with uniquing, bound generics are emitted as a nested structure:

  • A sized outer structure with no name or identifier
  • A sizeless inner structure with the mangled name as the name and no identifier.

The actual mechanism of connection for the inner and outer structures is that the outer structure has a single unnamed member whose type is the inner structure.

However, LLVM CodeView emission treats unnamed members as anonymous structs and tries to inline their members into the parent. But since the inner struct has no members, the effect is that it gets dropped.

This change names the inner struct with the mangled type name. This will have the effect of preserving the inner struct in CodeView output, and allow us to use a variation of the DWARF logic at
https://github.com/swiftlang/llvm-project/blob/cd1235e59b87c84144802ab85592ee75a615f231/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserSwift.cpp#L166 to recognize and handle this pattern.

More details and discussion at #87093

…zed containers

As a workaround for issues with uniquing, bound generics are emitted as a nested structure:
- A sized outer structure with no name or identifier
- A sizeless inner structure with the mangled name as the name and no identifier.

The actual mechanism of connection for the inner and outer structures is
that the outer structure has a single unnamed member whose type is the
inner structure.

However, LLVM CodeView emission treats unnamed members as anonymous
structs and tries to inline their members into the parent. But since the
inner struct has no members, the effect is that it gets dropped.

This change names the inner struct with the mangled type name. This will
have the effect of preserving the inner struct in CodeView output, and
allow us to use a variation of the DWARF logic at
https://github.com/swiftlang/llvm-project/blob/cd1235e59b87c84144802ab85592ee75a615f231/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserSwift.cpp#L166
to recognize and handle this pattern.

More details and discussion at swiftlang#87093
@speednoisemovement
Copy link
Copy Markdown
Contributor Author

@swift-ci Please test

@speednoisemovement speednoisemovement marked this pull request as ready for review April 13, 2026 12:29
@speednoisemovement speednoisemovement requested a review from a team as a code owner April 13, 2026 12:29
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.

1 participant