Skip to content

v4: use a slice of TranslationUnits in the AST

Denys Smirnov requested to merge dennwc/cc:4_tu_slice into master

This is the first change in a possible series to make cc/v4 AST even more dev-friendly. This particular change switches to using a slice of TranslationUnit nodes in AST instead of a linked list.

The reasoning is that with a slice it becomes obvious if/how the list needs to be traversed and makes it easier to count TUs. For this particular case it makes little difference, but it becomes more impactful for other AST nodes that will be updated later.

Since the parser is hand-written, it's possible to move TranslationUnit definition to non-generated files and ignore it in parser.yy as well. Examples are also moved to all_test.go, since they are no longer controlled by the codegen.

Signed-off-by: Denys Smirnov dennwc@pm.me

Edited by Denys Smirnov

Merge request reports