google / graphicsfuzz

A testing framework for automatically finding and simplifying bugs in graphics shader compilers.
Apache License 2.0
569 stars 117 forks source link

Make Typer available in OpaqueExpressionGenerator #540

Open afd opened 5 years ago

afd commented 5 years ago

Currently OpaqueExpressionGenerator does not have access to a Typer field, making it had to implement transformations such as #511.

Typer should be added as a field of OpqaueExpressionGenerator and passed into its constructor.

All functions that take both an expr and the expected BasicType of the expr should have the BasicType argument removed, and instead should get the expr's type from the typer, assert that it is a BasicType and downcast it to the BasicType.

This will end up requiring quite a lot of changes in the code base because OpaqueExpressionGenerators get created in contexts where a Typer is not readily available, so a Typer will need to be passed through to those contexts.

There is also at least one test where OpaqueExpressionGenerator is used to construct an AST; this test (and any others like it) will need to be re-worked.

afd commented 5 years ago

@abelbriggs1 you might like to work on this one as a "slow burner" issue - it might take a while and some discussion to figure out all the changes we need to make to have Typer available in the right places.