Automatically run the TypeDeterminer when building programs

Removes the need for Dawn to use the TypeDeterminer directly.
TypeDeterminer errors will be added to the Program diagnostics list.

Change-Id: I4cfb405e7e6b0e94727296eea872a3ddc4412b66
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/38921
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
This commit is contained in:
Ben Clayton
2021-01-27 19:23:55 +00:00
committed by Commit Bot service account
parent 844217fa34
commit dd69ac3505
9 changed files with 33 additions and 132 deletions

View File

@@ -96,22 +96,6 @@ Transform::Output FirstIndexOffset::Run(const Program* in) {
}
}
// Running TypeDeterminer as we require local_referenced_builtin_variables()
// to be populated. TODO(bclayton) - it should not be necessary to re-run the
// type determiner if semantic information is already generated. Remove.
Program program;
{
ProgramBuilder builder = in->CloneAsBuilder();
TypeDeterminer td(&builder);
if (!td.Determine()) {
Output out;
out.diagnostics.add_error(td.error());
return out;
}
program = Program(std::move(builder));
in = &program;
}
Symbol vertex_index_sym;
Symbol instance_index_sym;

View File

@@ -36,11 +36,9 @@ Transform::Output Manager::Run(const Program* program) {
program = &out.program;
}
} else {
out.program = Program(program->Clone());
out.program = program->Clone();
}
out.diagnostics.add(TypeDeterminer::Run(&out.program));
return out;
}

View File

@@ -56,14 +56,6 @@ class TransformTest : public testing::Test {
return diag::Formatter(style).format(program.Diagnostics());
}
{
auto diagnostics = TypeDeterminer::Run(&program);
if (diagnostics.contains_errors()) {
return "Type determination failed:\n" +
diag::Formatter(style).format(diagnostics);
}
}
{
Manager manager;
for (auto& transform : transforms) {