Migrate from tint::ast::Module to tint::Program

Depends on: https://dawn-review.googlesource.com/c/tint/+/38556

Bug: tint:390
Change-Id: I12104d80370ddc1a3277770ca051cbd0992b758e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/38522
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
diff --git a/src/dawn_native/ShaderModule.cpp b/src/dawn_native/ShaderModule.cpp
index 3f4e4db..141a219 100644
--- a/src/dawn_native/ShaderModule.cpp
+++ b/src/dawn_native/ShaderModule.cpp
@@ -179,7 +179,7 @@
         }
 
 #ifdef DAWN_ENABLE_WGSL
-        ResultOrError<tint::ast::Module> ParseWGSL(const tint::Source::File* file) {
+        ResultOrError<tint::Program> ParseWGSL(const tint::Source::File* file) {
             std::ostringstream errorStream;
             errorStream << "Tint WGSL reader failure:" << std::endl;
 
@@ -192,22 +192,23 @@
                 return DAWN_VALIDATION_ERROR(errorStream.str().c_str());
             }
 
-            tint::ast::Module module = parser.module();
-            if (!module.IsValid()) {
-                errorStream << "Invalid module generated..." << std::endl;
+            tint::Program program = parser.program();
+            if (!program.IsValid()) {
+                errorStream << "Invalid program generated..." << std::endl;
                 return DAWN_VALIDATION_ERROR(errorStream.str().c_str());
             }
 
-            tint::TypeDeterminer typeDeterminer(&module);
-            if (!typeDeterminer.Determine()) {
-                errorStream << "Type Determination: " << typeDeterminer.error();
+            tint::diag::List diagnostics = tint::TypeDeterminer::Run(&program);
+            if (diagnostics.contains_errors()) {
+                std::string err = tint::diag::Formatter{}.format(diagnostics);
+                errorStream << "Type Determination: " << err;
                 return DAWN_VALIDATION_ERROR(errorStream.str().c_str());
             }
 
-            return std::move(module);
+            return std::move(program);
         }
 
-        ResultOrError<tint::ast::Module> ParseSPIRV(const std::vector<uint32_t>& spirv) {
+        ResultOrError<tint::Program> ParseSPIRV(const std::vector<uint32_t>& spirv) {
             std::ostringstream errorStream;
             errorStream << "Tint SPIRV reader failure:" << std::endl;
 
@@ -217,27 +218,28 @@
                 return DAWN_VALIDATION_ERROR(errorStream.str().c_str());
             }
 
-            tint::ast::Module module = parser.module();
-            if (!module.IsValid()) {
-                errorStream << "Invalid module generated..." << std::endl;
+            tint::Program program = parser.program();
+            if (!program.IsValid()) {
+                errorStream << "Invalid program generated..." << std::endl;
                 return DAWN_VALIDATION_ERROR(errorStream.str().c_str());
             }
 
-            tint::TypeDeterminer typeDeterminer(&module);
-            if (!typeDeterminer.Determine()) {
-                errorStream << "Type Determination: " << typeDeterminer.error();
+            tint::diag::List diagnostics = tint::TypeDeterminer::Run(&program);
+            if (diagnostics.contains_errors()) {
+                std::string err = tint::diag::Formatter{}.format(diagnostics);
+                errorStream << "Type Determination: " << err;
                 return DAWN_VALIDATION_ERROR(errorStream.str().c_str());
             }
 
-            return std::move(module);
+            return std::move(program);
         }
 
-        MaybeError ValidateModule(tint::ast::Module* module) {
+        MaybeError ValidateModule(tint::Program* program) {
             std::ostringstream errorStream;
-            errorStream << "Tint module validation" << std::endl;
+            errorStream << "Tint program validation" << std::endl;
 
             tint::Validator validator;
-            if (!validator.Validate(module)) {
+            if (!validator.Validate(program)) {
                 auto err = tint::diag::Formatter{}.format(validator.diagnostics());
                 errorStream << "Validation: " << err << std::endl;
                 return DAWN_VALIDATION_ERROR(errorStream.str().c_str());
@@ -246,11 +248,11 @@
             return {};
         }
 
-        ResultOrError<std::vector<uint32_t>> ModuleToSPIRV(tint::ast::Module module) {
+        ResultOrError<std::vector<uint32_t>> ModuleToSPIRV(tint::Program program) {
             std::ostringstream errorStream;
             errorStream << "Tint SPIR-V writer failure:" << std::endl;
 
-            tint::writer::spirv::Generator generator(std::move(module));
+            tint::writer::spirv::Generator generator(&program);
             if (!generator.Generate()) {
                 errorStream << "Generator: " << generator.error() << std::endl;
                 return DAWN_VALIDATION_ERROR(errorStream.str().c_str());
@@ -691,14 +693,14 @@
         // PopulateMetadataUsingSPIRVCross will be removed.
         ResultOrError<EntryPointMetadataTable> ReflectShaderUsingTint(
             DeviceBase*,
-            const tint::ast::Module& module) {
-            ASSERT(module.IsValid());
+            const tint::Program& program) {
+            ASSERT(program.IsValid());
 
             EntryPointMetadataTable result;
             std::ostringstream errorStream;
             errorStream << "Tint Reflection failure:" << std::endl;
 
-            tint::inspector::Inspector inspector(module);
+            tint::inspector::Inspector inspector(&program);
             auto entryPoints = inspector.GetEntryPoints();
             if (inspector.has_error()) {
                 errorStream << "Inspector: " << inspector.error() << std::endl;
@@ -857,12 +859,12 @@
                 std::vector<uint32_t> spirv(spirvDesc->code, spirvDesc->code + spirvDesc->codeSize);
                 if (device->IsToggleEnabled(Toggle::UseTintGenerator)) {
 #ifdef DAWN_ENABLE_WGSL
-                    tint::ast::Module module;
-                    DAWN_TRY_ASSIGN(module, ParseSPIRV(spirv));
+                    tint::Program program;
+                    DAWN_TRY_ASSIGN(program, ParseSPIRV(spirv));
                     if (device->IsValidationEnabled()) {
-                        DAWN_TRY(ValidateModule(&module));
+                        DAWN_TRY(ValidateModule(&program));
                     }
-                    parseResult.tintModule = std::make_unique<tint::ast::Module>(std::move(module));
+                    parseResult.tintProgram = std::make_unique<tint::Program>(std::move(program));
 #else
                     return DAWN_VALIDATION_ERROR("Using Tint is not enabled in this build.");
 #endif  // DAWN_ENABLE_WGSL
@@ -883,37 +885,37 @@
                 tint::Source::File file("", wgslDesc->source);
 
                 if (device->IsToggleEnabled(Toggle::UseTintGenerator)) {
-                    tint::ast::Module module;
-                    DAWN_TRY_ASSIGN(module, ParseWGSL(&file));
+                    tint::Program program;
+                    DAWN_TRY_ASSIGN(program, ParseWGSL(&file));
                     if (device->IsValidationEnabled()) {
-                        DAWN_TRY(ValidateModule(&module));
+                        DAWN_TRY(ValidateModule(&program));
                     }
-                    parseResult.tintModule = std::make_unique<tint::ast::Module>(std::move(module));
+                    parseResult.tintProgram = std::make_unique<tint::Program>(std::move(program));
                 } else {
-                    tint::ast::Module module;
-                    DAWN_TRY_ASSIGN(module, ParseWGSL(&file));
+                    tint::Program program;
+                    DAWN_TRY_ASSIGN(program, ParseWGSL(&file));
 
                     {
                         tint::transform::Manager transformManager;
                         transformManager.append(
                             std::make_unique<tint::transform::EmitVertexPointSize>());
-                        DAWN_TRY_ASSIGN(module, RunTransforms(&transformManager, &module));
+                        DAWN_TRY_ASSIGN(program, RunTransforms(&transformManager, &program));
                     }
 
                     if (device->IsValidationEnabled()) {
-                        DAWN_TRY(ValidateModule(&module));
+                        DAWN_TRY(ValidateModule(&program));
                     }
 
-                    // Keep the Tint module around. The Metal backend will use it for vertex
+                    // Keep the Tint program around. The Metal backend will use it for vertex
                     // pulling since we can't go WGSL->point size transform->spirv->Tint.
                     // Tint's spirv reader doesn't understand point size. crbug.com/tint/412.
-                    auto tintModule = std::make_unique<tint::ast::Module>(module.Clone());
+                    auto tintProgram = std::make_unique<tint::Program>(program.Clone());
 
                     std::vector<uint32_t> spirv;
-                    DAWN_TRY_ASSIGN(spirv, ModuleToSPIRV(std::move(module)));
+                    DAWN_TRY_ASSIGN(spirv, ModuleToSPIRV(std::move(program)));
                     DAWN_TRY(ValidateSpirv(spirv.data(), spirv.size()));
 
-                    parseResult.tintModule = std::move(tintModule);
+                    parseResult.tintProgram = std::move(tintProgram);
                     parseResult.spirv = std::move(spirv);
                 }
                 break;
@@ -940,19 +942,19 @@
     }
 
 #ifdef DAWN_ENABLE_WGSL
-    ResultOrError<tint::ast::Module> RunTransforms(tint::transform::Manager* manager,
-                                                   tint::ast::Module* module) {
-        tint::transform::Transform::Output output = manager->Run(module);
+    ResultOrError<tint::Program> RunTransforms(tint::transform::Manager* manager,
+                                               tint::Program* program) {
+        tint::transform::Transform::Output output = manager->Run(program);
         if (output.diagnostics.contains_errors()) {
             std::string err =
                 "Tint transform failure: " + tint::diag::Formatter{}.format(output.diagnostics);
             return DAWN_VALIDATION_ERROR(err.c_str());
         }
 
-        if (!output.module.IsValid()) {
-            return DAWN_VALIDATION_ERROR("Tint transform did not produce valid module.");
+        if (!output.program.IsValid()) {
+            return DAWN_VALIDATION_ERROR("Tint transform did not produce valid program.");
         }
-        return std::move(output.module);
+        return std::move(output.program);
     }
 
     std::unique_ptr<tint::transform::VertexPulling> MakeVertexPullingTransform(
@@ -1080,14 +1082,14 @@
         const VertexStateDescriptor& vertexState,
         const std::string& entryPoint,
         BindGroupIndex pullingBufferBindingSet) const {
-        tint::ast::Module module;
-        DAWN_TRY_ASSIGN(module, ParseSPIRV(spirv));
+        tint::Program program;
+        DAWN_TRY_ASSIGN(program, ParseSPIRV(spirv));
 
-        return GeneratePullingSpirv(&module, vertexState, entryPoint, pullingBufferBindingSet);
+        return GeneratePullingSpirv(&program, vertexState, entryPoint, pullingBufferBindingSet);
     }
 
     ResultOrError<std::vector<uint32_t>> ShaderModuleBase::GeneratePullingSpirv(
-        tint::ast::Module* moduleIn,
+        tint::Program* programIn,
         const VertexStateDescriptor& vertexState,
         const std::string& entryPoint,
         BindGroupIndex pullingBufferBindingSet) const {
@@ -1104,10 +1106,10 @@
             // transformManager.append(std::make_unique<tint::transform::BoundArrayAccessors>());
         }
 
-        tint::ast::Module module;
-        DAWN_TRY_ASSIGN(module, RunTransforms(&transformManager, moduleIn));
+        tint::Program program;
+        DAWN_TRY_ASSIGN(program, RunTransforms(&transformManager, programIn));
 
-        tint::writer::spirv::Generator generator(std::move(module));
+        tint::writer::spirv::Generator generator(&program);
         if (!generator.Generate()) {
             errorStream << "Generator: " << generator.error() << std::endl;
             return DAWN_VALIDATION_ERROR(errorStream.str().c_str());
@@ -1124,7 +1126,7 @@
 
     MaybeError ShaderModuleBase::InitializeBase(ShaderModuleParseResult* parseResult) {
 #ifdef DAWN_ENABLE_WGSL
-        tint::ast::Module* module = parseResult->tintModule.get();
+        tint::Program* program = parseResult->tintProgram.get();
 #endif
         mSpirv = std::move(parseResult->spirv);
 
@@ -1142,13 +1144,15 @@
         std::vector<uint32_t> localSpirv;
         if (GetDevice()->IsToggleEnabled(Toggle::UseTintGenerator)) {
 #ifdef DAWN_ENABLE_WGSL
-            ASSERT(module != nullptr);
-            tint::ast::Module clonedModule = module->Clone();
-            tint::TypeDeterminer typeDeterminer(&clonedModule);
-            if (!typeDeterminer.Determine()) {
-                return DAWN_VALIDATION_ERROR(typeDeterminer.error().c_str());
+            ASSERT(program != nullptr);
+            tint::Program clonedProgram = program->Clone();
+
+            tint::diag::List diagnostics = tint::TypeDeterminer::Run(&clonedProgram);
+            if (diagnostics.contains_errors()) {
+                std::string err = tint::diag::Formatter{}.format(diagnostics);
+                return DAWN_VALIDATION_ERROR(err.c_str());
             }
-            DAWN_TRY_ASSIGN(localSpirv, ModuleToSPIRV(std::move(clonedModule)));
+            DAWN_TRY_ASSIGN(localSpirv, ModuleToSPIRV(std::move(clonedProgram)));
             DAWN_TRY(ValidateSpirv(localSpirv.data(), localSpirv.size()));
             spirvPtr = &localSpirv;
 #else
@@ -1158,18 +1162,18 @@
 
         if (GetDevice()->IsToggleEnabled(Toggle::UseTintInspector)) {
 #ifdef DAWN_ENABLE_WGSL
-            tint::ast::Module localModule;
+            tint::Program localProgram;
 
-            tint::ast::Module* modulePtr = module;
+            tint::Program* programPtr = program;
             if (!GetDevice()->IsToggleEnabled(Toggle::UseTintGenerator)) {
-                // We have mSpirv, but no Tint module
-                DAWN_TRY_ASSIGN(localModule, ParseSPIRV(mSpirv));
-                DAWN_TRY(ValidateModule(&localModule));
-                modulePtr = &localModule;
+                // We have mSpirv, but no Tint program
+                DAWN_TRY_ASSIGN(localProgram, ParseSPIRV(mSpirv));
+                DAWN_TRY(ValidateModule(&localProgram));
+                programPtr = &localProgram;
             }
 
             EntryPointMetadataTable table;
-            DAWN_TRY_ASSIGN(table, ReflectShaderUsingTint(GetDevice(), *modulePtr));
+            DAWN_TRY_ASSIGN(table, ReflectShaderUsingTint(GetDevice(), *programPtr));
             DAWN_TRY(PopulateMetadataUsingSPIRVCross(GetDevice(), *spirvPtr, &table));
             mEntryPoints = std::move(table);
 #else
diff --git a/src/dawn_native/ShaderModule.h b/src/dawn_native/ShaderModule.h
index bedeb22..217e2dd 100644
--- a/src/dawn_native/ShaderModule.h
+++ b/src/dawn_native/ShaderModule.h
@@ -33,9 +33,7 @@
 
 namespace tint {
 
-    namespace ast {
-        class Module;
-    }  // namespace ast
+    class Program;
 
     namespace transform {
         class Manager;
@@ -63,7 +61,7 @@
         ShaderModuleParseResult& operator=(ShaderModuleParseResult&& rhs);
 
 #ifdef DAWN_ENABLE_WGSL
-        std::unique_ptr<tint::ast::Module> tintModule;
+        std::unique_ptr<tint::Program> tintProgram;
 #endif
         std::vector<uint32_t> spirv;
     };
@@ -78,8 +76,8 @@
     RequiredBufferSizes ComputeRequiredBufferSizesForLayout(const EntryPointMetadata& entryPoint,
                                                             const PipelineLayoutBase* layout);
 #ifdef DAWN_ENABLE_WGSL
-    ResultOrError<tint::ast::Module> RunTransforms(tint::transform::Manager* manager,
-                                                   tint::ast::Module* module);
+    ResultOrError<tint::Program> RunTransforms(tint::transform::Manager* manager,
+                                               tint::Program* program);
 
     std::unique_ptr<tint::transform::VertexPulling> MakeVertexPullingTransform(
         const VertexStateDescriptor& vertexState,
@@ -88,7 +86,7 @@
 #endif
 
     // Contains all the reflection data for a valid (ShaderModule, entryPoint, stage). They are
-    // stored in the ShaderModuleBase and destroyed only when the shader module is destroyed so
+    // stored in the ShaderModuleBase and destroyed only when the shader program is destroyed so
     // pointers to EntryPointMetadata are safe to store as long as you also keep a Ref to the
     // ShaderModuleBase.
     struct EntryPointMetadata {
@@ -132,7 +130,7 @@
 
         static ShaderModuleBase* MakeError(DeviceBase* device);
 
-        // Return true iff the module has an entrypoint called `entryPoint`.
+        // Return true iff the program has an entrypoint called `entryPoint`.
         bool HasEntryPoint(const std::string& entryPoint) const;
 
         // Returns the metadata for the given `entryPoint`. HasEntryPoint with the same argument
@@ -156,7 +154,7 @@
             BindGroupIndex pullingBufferBindingSet) const;
 
         ResultOrError<std::vector<uint32_t>> GeneratePullingSpirv(
-            tint::ast::Module* module,
+            tint::Program* program,
             const VertexStateDescriptor& vertexState,
             const std::string& entryPoint,
             BindGroupIndex pullingBufferBindingSet) const;
diff --git a/src/dawn_native/d3d12/ShaderModuleD3D12.cpp b/src/dawn_native/d3d12/ShaderModuleD3D12.cpp
index b91450f..0f7be68 100644
--- a/src/dawn_native/d3d12/ShaderModuleD3D12.cpp
+++ b/src/dawn_native/d3d12/ShaderModuleD3D12.cpp
@@ -188,7 +188,7 @@
     MaybeError ShaderModule::Initialize(ShaderModuleParseResult* parseResult) {
         DAWN_TRY(InitializeBase(parseResult));
 #ifdef DAWN_ENABLE_WGSL
-        mTintModule = std::move(parseResult->tintModule);
+        mTintProgram = std::move(parseResult->tintProgram);
 #endif
         return {};
     }
@@ -217,8 +217,8 @@
             transformManager.append(std::move(transformer));
         }
 
-        tint::ast::Module module;
-        DAWN_TRY_ASSIGN(module, RunTransforms(&transformManager, mTintModule.get()));
+        tint::Program program;
+        DAWN_TRY_ASSIGN(program, RunTransforms(&transformManager, mTintProgram.get()));
 
         if (firstOffsetTransform != nullptr) {
             // Functions are only available after transform has been performed
@@ -235,10 +235,10 @@
         }
 
         ASSERT(remappedEntryPointName != nullptr);
-        tint::inspector::Inspector inspector(module);
+        tint::inspector::Inspector inspector(&program);
         *remappedEntryPointName = inspector.GetRemappedNameForEntryPoint(entryPointName);
 
-        tint::writer::hlsl::Generator generator(std::move(module));
+        tint::writer::hlsl::Generator generator(&program);
         // TODO: Switch to GenerateEntryPoint once HLSL writer supports it.
         if (!generator.Generate()) {
             errorStream << "Generator: " << generator.error() << std::endl;
diff --git a/src/dawn_native/d3d12/ShaderModuleD3D12.h b/src/dawn_native/d3d12/ShaderModuleD3D12.h
index ed8e1e8..b3850bc 100644
--- a/src/dawn_native/d3d12/ShaderModuleD3D12.h
+++ b/src/dawn_native/d3d12/ShaderModuleD3D12.h
@@ -78,7 +78,7 @@
         uint64_t GetD3DCompilerVersion() const;
 
 #ifdef DAWN_ENABLE_WGSL
-        std::unique_ptr<tint::ast::Module> mTintModule;
+        std::unique_ptr<tint::Program> mTintProgram;
 #endif
     };
 
diff --git a/src/dawn_native/metal/ShaderModuleMTL.h b/src/dawn_native/metal/ShaderModuleMTL.h
index 1729fda..621c198 100644
--- a/src/dawn_native/metal/ShaderModuleMTL.h
+++ b/src/dawn_native/metal/ShaderModuleMTL.h
@@ -71,7 +71,7 @@
         MaybeError Initialize(ShaderModuleParseResult* parseResult);
 
 #ifdef DAWN_ENABLE_WGSL
-        std::unique_ptr<tint::ast::Module> mTintModule;
+        std::unique_ptr<tint::Program> mTintProgram;
 #endif
     };
 
diff --git a/src/dawn_native/metal/ShaderModuleMTL.mm b/src/dawn_native/metal/ShaderModuleMTL.mm
index b0958ec..11241e9 100644
--- a/src/dawn_native/metal/ShaderModuleMTL.mm
+++ b/src/dawn_native/metal/ShaderModuleMTL.mm
@@ -50,7 +50,7 @@
     MaybeError ShaderModule::Initialize(ShaderModuleParseResult* parseResult) {
         DAWN_TRY(InitializeBase(parseResult));
 #ifdef DAWN_ENABLE_WGSL
-        mTintModule = std::move(parseResult->tintModule);
+        mTintProgram = std::move(parseResult->tintProgram);
 #endif
         return {};
     }
@@ -88,14 +88,14 @@
         }
         transformManager.append(std::make_unique<tint::transform::BoundArrayAccessors>());
 
-        tint::ast::Module module;
-        DAWN_TRY_ASSIGN(module, RunTransforms(&transformManager, mTintModule.get()));
+        tint::Program program;
+        DAWN_TRY_ASSIGN(program, RunTransforms(&transformManager, mTintProgram.get()));
 
         ASSERT(remappedEntryPointName != nullptr);
-        tint::inspector::Inspector inspector(module);
+        tint::inspector::Inspector inspector(&program);
         *remappedEntryPointName = inspector.GetRemappedNameForEntryPoint(entryPointName);
 
-        tint::writer::msl::Generator generator(std::move(module));
+        tint::writer::msl::Generator generator(&program);
         if (!generator.Generate()) {
             errorStream << "Generator: " << generator.error() << std::endl;
             return DAWN_VALIDATION_ERROR(errorStream.str().c_str());
@@ -123,9 +123,9 @@
         std::vector<uint32_t> pullingSpirv;
         if (GetDevice()->IsToggleEnabled(Toggle::MetalEnableVertexPulling) &&
             stage == SingleShaderStage::Vertex) {
-            if (mTintModule) {
+            if (mTintProgram) {
                 DAWN_TRY_ASSIGN(pullingSpirv,
-                                GeneratePullingSpirv(mTintModule.get(),
+                                GeneratePullingSpirv(mTintProgram.get(),
                                                      *renderPipeline->GetVertexStateDescriptor(),
                                                      entryPointName, kPullingBufferBindingSet));
             } else {
diff --git a/src/dawn_native/opengl/ShaderModuleGL.cpp b/src/dawn_native/opengl/ShaderModuleGL.cpp
index ab8ae71..916027d 100644
--- a/src/dawn_native/opengl/ShaderModuleGL.cpp
+++ b/src/dawn_native/opengl/ShaderModuleGL.cpp
@@ -82,7 +82,7 @@
         DAWN_TRY(InitializeBase(parseResult));
         if (GetDevice()->IsToggleEnabled(Toggle::UseTintGenerator)) {
 #ifdef DAWN_ENABLE_WGSL
-            tint::ast::Module module = std::move(*parseResult->tintModule.release());
+            tint::Program program = std::move(*parseResult->tintProgram.release());
 
             std::ostringstream errorStream;
             errorStream << "Tint SPIR-V (for GLSL) writer failure:" << std::endl;
@@ -91,9 +91,9 @@
             transformManager.append(std::make_unique<tint::transform::BoundArrayAccessors>());
             transformManager.append(std::make_unique<tint::transform::EmitVertexPointSize>());
 
-            DAWN_TRY_ASSIGN(module, RunTransforms(&transformManager, &module));
+            DAWN_TRY_ASSIGN(program, RunTransforms(&transformManager, &program));
 
-            tint::writer::spirv::Generator generator(std::move(module));
+            tint::writer::spirv::Generator generator(&program);
             if (!generator.Generate()) {
                 errorStream << "Generator: " << generator.error() << std::endl;
                 return DAWN_VALIDATION_ERROR(errorStream.str().c_str());
diff --git a/src/dawn_native/vulkan/ShaderModuleVk.cpp b/src/dawn_native/vulkan/ShaderModuleVk.cpp
index b0edeb6..61c7f1c 100644
--- a/src/dawn_native/vulkan/ShaderModuleVk.cpp
+++ b/src/dawn_native/vulkan/ShaderModuleVk.cpp
@@ -53,7 +53,7 @@
         const std::vector<uint32_t>* spirvPtr;
         if (GetDevice()->IsToggleEnabled(Toggle::UseTintGenerator)) {
 #ifdef DAWN_ENABLE_WGSL
-            tint::ast::Module module = std::move(*std::move(parseResult->tintModule).release());
+            tint::Program program = std::move(*std::move(parseResult->tintProgram).release());
 
             std::ostringstream errorStream;
             errorStream << "Tint SPIR-V writer failure:" << std::endl;
@@ -62,9 +62,9 @@
             transformManager.append(std::make_unique<tint::transform::BoundArrayAccessors>());
             transformManager.append(std::make_unique<tint::transform::EmitVertexPointSize>());
 
-            DAWN_TRY_ASSIGN(module, RunTransforms(&transformManager, &module));
+            DAWN_TRY_ASSIGN(program, RunTransforms(&transformManager, &program));
 
-            tint::writer::spirv::Generator generator(std::move(module));
+            tint::writer::spirv::Generator generator(&program);
             if (!generator.Generate()) {
                 errorStream << "Generator: " << generator.error() << std::endl;
                 return DAWN_VALIDATION_ERROR(errorStream.str().c_str());
diff --git a/src/fuzzers/DawnSPIRVCrossFuzzer.cpp b/src/fuzzers/DawnSPIRVCrossFuzzer.cpp
index 1bac958..649c926 100644
--- a/src/fuzzers/DawnSPIRVCrossFuzzer.cpp
+++ b/src/fuzzers/DawnSPIRVCrossFuzzer.cpp
@@ -79,17 +79,17 @@
             return 0;
         }
 
-        tint::ast::Module module = parser.module();
-        if (!module.IsValid()) {
+        tint::Program program = parser.program();
+        if (!program.IsValid()) {
             return 0;
         }
 
-        tint::TypeDeterminer type_determiner(&module);
+        tint::TypeDeterminer type_determiner(&program);
         if (!type_determiner.Determine()) {
             return 0;
         }
 
-        tint::writer::spirv::Generator generator(std::move(module));
+       tint::writer::spirv::Generator generator(&program);
         if (!generator.Generate()) {
             return 0;
         }