We previously moved container identification later in CodeGen in order
to preserve information for AlignmentCalc.
However, Flattener needs to know if a class is a container in order to
apply its special handling for this case.
This new approach moves container identification in front of Flattener,
but has Container own a type node, representing its layout. This
underlying type node can be used for calculating a container's
alignment in a later pass.
We can catch these exceptions and print clearer failure messages.
Before:
unknown file: Failure
C++ exception with description "Invalid type for child" thrown in the test body.
After:
../test/type_graph_utils.cpp:44: Failure
Failed
Error parsing input graph: Invalid type for child
TypeGraphParser parses a textual type graph, as emitted by Printer.
It also doubles as a way of ensuring that Printer displays all
information about a type graph, to aid with debugging.
Convert Flattener unit tests over to this new framework as a first step.