[tint] Move ApplySubstitueOverrides() fuzzers -> wgsl/helper

Change-Id: Ia0094b697e38b8be15710ac1c0a67ed83823214b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/153782
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
diff --git a/src/tint/fuzzers/BUILD.gn b/src/tint/fuzzers/BUILD.gn
index 0ee6e78..d10eb7a 100644
--- a/src/tint/fuzzers/BUILD.gn
+++ b/src/tint/fuzzers/BUILD.gn
@@ -86,8 +86,6 @@
     ]
 
     sources = [
-      "apply_substitute_overrides.cc",
-      "apply_substitute_overrides.h",
       "data_builder.h",
       "mersenne_twister_engine.cc",
       "mersenne_twister_engine.h",
diff --git a/src/tint/fuzzers/CMakeLists.txt b/src/tint/fuzzers/CMakeLists.txt
index cd13c19..f9c8747 100644
--- a/src/tint/fuzzers/CMakeLists.txt
+++ b/src/tint/fuzzers/CMakeLists.txt
@@ -15,8 +15,6 @@
 function(add_tint_fuzzer NAME)
   add_executable(${NAME}
     ${NAME}.cc
-    apply_substitute_overrides.cc
-    apply_substitute_overrides.h
     cli.cc
     cli.h
     data_builder.h
diff --git a/src/tint/fuzzers/tint_ast_fuzzer/CMakeLists.txt b/src/tint/fuzzers/tint_ast_fuzzer/CMakeLists.txt
index 4e920a6..f822030 100644
--- a/src/tint/fuzzers/tint_ast_fuzzer/CMakeLists.txt
+++ b/src/tint/fuzzers/tint_ast_fuzzer/CMakeLists.txt
@@ -111,8 +111,6 @@
         cli.h
         fuzzer.cc
         override_cli_params.h
-        ../apply_substitute_overrides.cc
-        ../apply_substitute_overrides.h
         ../tint_common_fuzzer.cc
         ../tint_common_fuzzer.h)
 
diff --git a/src/tint/fuzzers/tint_common_fuzzer.cc b/src/tint/fuzzers/tint_common_fuzzer.cc
index a9e2e83..04dd2ef 100644
--- a/src/tint/fuzzers/tint_common_fuzzer.cc
+++ b/src/tint/fuzzers/tint_common_fuzzer.cc
@@ -31,9 +31,9 @@
 #endif  // TINT_BUILD_SPV_READER || TINT_BUILD_SPV_WRITER
 
 #include "src/tint/api/common/binding_point.h"
-#include "src/tint/fuzzers/apply_substitute_overrides.h"
 #include "src/tint/lang/core/type/external_texture.h"
 #include "src/tint/lang/wgsl/ast/module.h"
+#include "src/tint/lang/wgsl/helpers/apply_substitute_overrides.h"
 #include "src/tint/lang/wgsl/helpers/flatten_bindings.h"
 #include "src/tint/lang/wgsl/program/program.h"
 #include "src/tint/lang/wgsl/sem/variable.h"
@@ -237,7 +237,7 @@
     }
 
     // Run SubstituteOverride if required
-    program = ApplySubstituteOverrides(std::move(program));
+    program = tint::wgsl::ApplySubstituteOverrides(std::move(program));
     if (!program.IsValid()) {
         return 0;
     }
diff --git a/src/tint/fuzzers/tint_concurrency_fuzzer.cc b/src/tint/fuzzers/tint_concurrency_fuzzer.cc
index b55568f..9c6ac99 100644
--- a/src/tint/fuzzers/tint_concurrency_fuzzer.cc
+++ b/src/tint/fuzzers/tint_concurrency_fuzzer.cc
@@ -19,11 +19,11 @@
 
 #include <thread>
 
-#include "src/tint/fuzzers/apply_substitute_overrides.h"
 #include "src/tint/lang/glsl/writer/writer.h"
 #include "src/tint/lang/hlsl/writer/writer.h"
 #include "src/tint/lang/msl/writer/writer.h"
 #include "src/tint/lang/spirv/writer/writer.h"
+#include "src/tint/lang/wgsl/helpers/apply_substitute_overrides.h"
 #include "src/tint/lang/wgsl/helpers/flatten_bindings.h"
 #include "src/tint/lang/wgsl/inspector/inspector.h"
 #include "src/tint/lang/wgsl/reader/reader.h"
@@ -53,7 +53,7 @@
         return 0;  // Not supported
     }
 
-    program = tint::fuzzers::ApplySubstituteOverrides(std::move(program));
+    program = tint::wgsl::ApplySubstituteOverrides(std::move(program));
     if (!program.IsValid()) {
         return 0;
     }
diff --git a/src/tint/fuzzers/tint_ir_roundtrip_fuzzer.cc b/src/tint/fuzzers/tint_ir_roundtrip_fuzzer.cc
index 0f1cc86..22db596 100644
--- a/src/tint/fuzzers/tint_ir_roundtrip_fuzzer.cc
+++ b/src/tint/fuzzers/tint_ir_roundtrip_fuzzer.cc
@@ -16,7 +16,7 @@
 #include <string>
 #include <unordered_set>
 
-#include "src/tint/fuzzers/apply_substitute_overrides.h"
+#include "src/tint/lang/wgsl/helpers/apply_substitute_overrides.h"
 #include "src/tint/lang/wgsl/reader/lower/lower.h"
 #include "src/tint/lang/wgsl/reader/parser/parser.h"
 #include "src/tint/lang/wgsl/reader/program_to_ir/program_to_ir.h"
@@ -68,7 +68,7 @@
         return 0;
     }
 
-    src = tint::fuzzers::ApplySubstituteOverrides(std::move(src));
+    src = tint::wgsl::ApplySubstituteOverrides(std::move(src));
     if (!src.IsValid()) {
         return 0;
     }
diff --git a/src/tint/fuzzers/tint_regex_fuzzer/CMakeLists.txt b/src/tint/fuzzers/tint_regex_fuzzer/CMakeLists.txt
index 45802cd..f062d97 100644
--- a/src/tint/fuzzers/tint_regex_fuzzer/CMakeLists.txt
+++ b/src/tint/fuzzers/tint_regex_fuzzer/CMakeLists.txt
@@ -40,8 +40,6 @@
         cli.h
         fuzzer.cc
         override_cli_params.h
-        ../apply_substitute_overrides.cc
-        ../apply_substitute_overrides.h
         ../tint_common_fuzzer.cc
         ../tint_common_fuzzer.h)
 
diff --git a/src/tint/lang/wgsl/helpers/BUILD.bazel b/src/tint/lang/wgsl/helpers/BUILD.bazel
index 16067dd..12a1a5e 100644
--- a/src/tint/lang/wgsl/helpers/BUILD.bazel
+++ b/src/tint/lang/wgsl/helpers/BUILD.bazel
@@ -27,11 +27,13 @@
   name = "helpers",
   srcs = [
     "append_vector.cc",
+    "apply_substitute_overrides.cc",
     "check_supported_extensions.cc",
     "flatten_bindings.cc",
   ],
   hdrs = [
     "append_vector.h",
+    "apply_substitute_overrides.h",
     "check_supported_extensions.h",
     "flatten_bindings.h",
   ],
diff --git a/src/tint/lang/wgsl/helpers/BUILD.cmake b/src/tint/lang/wgsl/helpers/BUILD.cmake
index 6eb49fb..82cf9d2 100644
--- a/src/tint/lang/wgsl/helpers/BUILD.cmake
+++ b/src/tint/lang/wgsl/helpers/BUILD.cmake
@@ -28,6 +28,8 @@
 tint_add_target(tint_lang_wgsl_helpers lib
   lang/wgsl/helpers/append_vector.cc
   lang/wgsl/helpers/append_vector.h
+  lang/wgsl/helpers/apply_substitute_overrides.cc
+  lang/wgsl/helpers/apply_substitute_overrides.h
   lang/wgsl/helpers/check_supported_extensions.cc
   lang/wgsl/helpers/check_supported_extensions.h
   lang/wgsl/helpers/flatten_bindings.cc
diff --git a/src/tint/lang/wgsl/helpers/BUILD.gn b/src/tint/lang/wgsl/helpers/BUILD.gn
index 25ea790..3ce0df4 100644
--- a/src/tint/lang/wgsl/helpers/BUILD.gn
+++ b/src/tint/lang/wgsl/helpers/BUILD.gn
@@ -33,6 +33,8 @@
   sources = [
     "append_vector.cc",
     "append_vector.h",
+    "apply_substitute_overrides.cc",
+    "apply_substitute_overrides.h",
     "check_supported_extensions.cc",
     "check_supported_extensions.h",
     "flatten_bindings.cc",
diff --git a/src/tint/fuzzers/apply_substitute_overrides.cc b/src/tint/lang/wgsl/helpers/apply_substitute_overrides.cc
similarity index 93%
rename from src/tint/fuzzers/apply_substitute_overrides.cc
rename to src/tint/lang/wgsl/helpers/apply_substitute_overrides.cc
index e5ef24d..93990e9 100644
--- a/src/tint/fuzzers/apply_substitute_overrides.cc
+++ b/src/tint/lang/wgsl/helpers/apply_substitute_overrides.cc
@@ -12,7 +12,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-#include "src/tint/fuzzers/apply_substitute_overrides.h"
+#include "src/tint/lang/wgsl/helpers/apply_substitute_overrides.h"
 
 #include <memory>
 #include <utility>
@@ -22,7 +22,7 @@
 #include "src/tint/lang/wgsl/inspector/inspector.h"
 #include "src/tint/lang/wgsl/program/program.h"
 
-namespace tint::fuzzers {
+namespace tint::wgsl {
 
 Program ApplySubstituteOverrides(Program&& program) {
     ast::transform::SubstituteOverride::Config cfg;
@@ -50,4 +50,4 @@
     return mgr.Run(program, override_data, outputs);
 }
 
-}  // namespace tint::fuzzers
+}  // namespace tint::wgsl
diff --git a/src/tint/fuzzers/apply_substitute_overrides.h b/src/tint/lang/wgsl/helpers/apply_substitute_overrides.h
similarity index 76%
rename from src/tint/fuzzers/apply_substitute_overrides.h
rename to src/tint/lang/wgsl/helpers/apply_substitute_overrides.h
index 31f0263..5278e9f 100644
--- a/src/tint/fuzzers/apply_substitute_overrides.h
+++ b/src/tint/lang/wgsl/helpers/apply_substitute_overrides.h
@@ -12,20 +12,20 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-#ifndef SRC_TINT_FUZZERS_APPLY_SUBSTITUTE_OVERRIDES_H_
-#define SRC_TINT_FUZZERS_APPLY_SUBSTITUTE_OVERRIDES_H_
+#ifndef SRC_TINT_LANG_WGSL_HELPERS_APPLY_SUBSTITUTE_OVERRIDES_H_
+#define SRC_TINT_LANG_WGSL_HELPERS_APPLY_SUBSTITUTE_OVERRIDES_H_
 
 // Forward declarations
 namespace tint {
 class Program;
 }
 
-namespace tint::fuzzers {
+namespace tint::wgsl {
 
 /// @returns a new program with all overrides subsituted with const variables
 /// @param program the input program
 Program ApplySubstituteOverrides(Program&& program);
 
-}  // namespace tint::fuzzers
+}  // namespace tint::wgsl
 
-#endif  // SRC_TINT_FUZZERS_APPLY_SUBSTITUTE_OVERRIDES_H_
+#endif  // SRC_TINT_LANG_WGSL_HELPERS_APPLY_SUBSTITUTE_OVERRIDES_H_