[tint][fuzz] Skip DemoteToHelper with shadowing
The transform introduces address space names, so will fail if these
are shadowed.
Bug: 349054824
Change-Id: I88d18f3b52fd6c70ad1577391579faf4a44cf950
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/195716
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: James Price <jrprice@google.com>
diff --git a/src/tint/lang/wgsl/ast/transform/demote_to_helper_fuzz.cc b/src/tint/lang/wgsl/ast/transform/demote_to_helper_fuzz.cc
index 16e3833..87c0ef6 100644
--- a/src/tint/lang/wgsl/ast/transform/demote_to_helper_fuzz.cc
+++ b/src/tint/lang/wgsl/ast/transform/demote_to_helper_fuzz.cc
@@ -31,7 +31,19 @@
namespace tint::ast::transform {
namespace {
-void DemoteToHelperFuzzer(const Program& program) {
+bool CanRun(const Program& program, const fuzz::wgsl::Context& context) {
+ if (context.program_properties.Contains(
+ fuzz::wgsl::ProgramProperties::kAddressSpacesShadowed)) {
+ return false; // DemoteToHelper assumes the Renamer transform has been run
+ }
+ return true;
+}
+
+void DemoteToHelperFuzzer(const Program& program, const fuzz::wgsl::Context& context) {
+ if (!CanRun(program, context)) {
+ return;
+ }
+
DataMap outputs;
if (auto result = DemoteToHelper{}.Apply(program, DataMap{}, outputs)) {
if (!result->IsValid()) {