The underlying type of bitfield is important to the size of a struct:
struct Foo { int64_t bitfield : 1; };
struct Bar { int8_t bitfield : 1; };
sizeof(Foo) = 8;
sizeof(Bar) = 1;
Previously this code would not have removed all members which it was
supposed to.
Also remove some now-redundant code from TypeIdentifier. RemoveIgnored
will take over the responsibility of removing members from classes.
Containers store references to ContainerInfos, so the ContainerInfos
must live beyond the stack they were created on. Use static variables
for simplicity.
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
i.e. unions with non-POD members
We can't examine untagged unions, but we should be able to support
looking inside tagged unions at some point in the future.
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.
Summary:
Stubbing tuple without alignment info can cause failures. I added a test
case for this which failed before this fix but works now.
Test Plan:
Ran the test.
Summary:
If a container has 0 template params (e.g. IOBuf, IOBufQueue), it wasn't
being added to containerTypeMap. This causes the deserialization to go wrong
as TreeBuilder doesn't treat the types as container
Test Plan:
make test
Use fully qualified names to determine if a class is really the child of
our type. It may be that it is the child of another type with an
identical name in another namespace.
visit(Type&) and visit(Type*) were helper functions than did cycle
detection and provided nicer syntax for the type.accept(*this) calls.
However, because they overloaded the visit() function, it was easy to
accidentally call a concrete visit method (e.g. visit(Class&)) instead
of the virtual-dispatching visit(Type&).
By changing the name of this wrapper, it will make it much more obvious
when code is introduced which bypasses the cycle detection.
Pass-through-types represent classes to be turned into containers. We
don't want these to turn these containers into Dummy's on a second run
of TypeIdentifier.
This will eventually be used to enable running with Tree Builder v2.
For now, when it is disabled it puts CodeGen v2 into compatibility mode,
disabling features which weren't present in CodeGen v1 so that its
output can be understood by Tree Builder v1.
These aren't used for anything yet, but should be useful for stable IDs
when printing nodes before and after passes and for faster cycle
detection than the current map of pointers.