transform: Fix Manager::Run() with no transforms
If there are transforms added to the manager, then Run() would output an empty module. Fix this. Bug: tint:390 Bug: tint:389 Change-Id: I439fe7a28816761f3702e304ef130b7a6992ecce Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/35280 Reviewed-by: dan sinclair <dsinclair@chromium.org> Commit-Queue: Ben Clayton <bclayton@google.com>
This commit is contained in:
parent
f3717fa249
commit
7a0daa233d
|
@ -24,17 +24,21 @@ Manager::~Manager() = default;
|
||||||
|
|
||||||
Transform::Output Manager::Run(ast::Module* module) {
|
Transform::Output Manager::Run(ast::Module* module) {
|
||||||
Output out;
|
Output out;
|
||||||
for (auto& transform : transforms_) {
|
if (!transforms_.empty()) {
|
||||||
auto res = transform->Run(module);
|
for (auto& transform : transforms_) {
|
||||||
out.module = std::move(res.module);
|
auto res = transform->Run(module);
|
||||||
out.diagnostics.add(std::move(res.diagnostics));
|
out.module = std::move(res.module);
|
||||||
if (out.diagnostics.contains_errors()) {
|
out.diagnostics.add(std::move(res.diagnostics));
|
||||||
return out;
|
if (out.diagnostics.contains_errors()) {
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
module = &out.module;
|
||||||
}
|
}
|
||||||
module = &out.module;
|
} else {
|
||||||
|
out.module = module->Clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
TypeDeterminer td(module);
|
TypeDeterminer td(&out.module);
|
||||||
if (!td.Determine()) {
|
if (!td.Determine()) {
|
||||||
diag::Diagnostic err;
|
diag::Diagnostic err;
|
||||||
err.severity = diag::Severity::Error;
|
err.severity = diag::Severity::Error;
|
||||||
|
|
Loading…
Reference in New Issue