lassade / c2z

C++ to Zig bindings and transpiler
102 stars 7 forks source link

Nested structs & unions #28

Closed Srekel closed 8 months ago

Srekel commented 8 months ago

As indicated in the tests, this now supports various forms of structs and unions inside structs.

The main thing I had to change was that previously, an anonymous struct would immediately yield a field defining that struct, which was nice. But I couldn't get that behavior to work together with various other kinds of struct definitions.

In the clang ast, the RecordDecl always comes first and then the FieldDecl referencing it comes, and so I had to register the record by it's line & column.

Future work: Add similar support for enums.