Remove the context object.

This CL strips the context object out of Tint.

Change-Id: Id0dcb9c557b217c03a8d9ac08fc9fe1c799f3fdc
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/34742
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
diff --git a/BUILD.gn b/BUILD.gn
index 304ae38..e24c6b1 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -331,6 +331,7 @@
     "src/ast/struct_member_offset_decoration.h",
     "src/ast/switch_statement.cc",
     "src/ast/switch_statement.h",
+    "src/ast/traits.h",
     "src/ast/type/access_control_type.cc",
     "src/ast/type/access_control_type.h",
     "src/ast/type/alias_type.cc",
@@ -369,7 +370,6 @@
     "src/ast/type/vector_type.h",
     "src/ast/type/void_type.cc",
     "src/ast/type/void_type.h",
-    "src/ast/traits.h",
     "src/ast/type_constructor_expression.cc",
     "src/ast/type_constructor_expression.h",
     "src/ast/type_decoration.cc",
@@ -392,8 +392,6 @@
     "src/ast/workgroup_decoration.h",
     "src/castable.cc",
     "src/castable.h",
-    "src/context.cc",
-    "src/context.h",
     "src/diagnostic/diagnostic.cc",
     "src/diagnostic/diagnostic.h",
     "src/diagnostic/formatter.cc",
@@ -413,10 +411,10 @@
     "src/scope_stack.h",
     "src/source.cc",
     "src/source.h",
-    "src/transform/emit_vertex_point_size.cc",
-    "src/transform/emit_vertex_point_size.h",
     "src/transform/bound_array_accessors.cc",
     "src/transform/bound_array_accessors.h",
+    "src/transform/emit_vertex_point_size.cc",
+    "src/transform/emit_vertex_point_size.h",
     "src/transform/manager.cc",
     "src/transform/manager.h",
     "src/transform/transform.cc",
@@ -791,6 +789,7 @@
     "src/ast/struct_test.cc",
     "src/ast/switch_statement_test.cc",
     "src/ast/test_helper.h",
+    "src/ast/traits_test.cc",
     "src/ast/type/access_control_type_test.cc",
     "src/ast/type/alias_type_test.cc",
     "src/ast/type/array_type_test.cc",
@@ -807,7 +806,6 @@
     "src/ast/type/struct_type_test.cc",
     "src/ast/type/u32_type_test.cc",
     "src/ast/type/vector_type_test.cc",
-    "src/ast/traits_test.cc",
     "src/ast/type_constructor_expression_test.cc",
     "src/ast/type_manager_test.cc",
     "src/ast/uint_literal_test.cc",
@@ -821,8 +819,8 @@
     "src/inspector/inspector_test.cc",
     "src/namer_test.cc",
     "src/scope_stack_test.cc",
-    "src/transform/emit_vertex_point_size_test.cc",
     "src/transform/bound_array_accessors_test.cc",
+    "src/transform/emit_vertex_point_size_test.cc",
     "src/transform/vertex_pulling_test.cc",
     "src/type_determiner_test.cc",
     "src/validator/validator_control_block_test.cc",
diff --git a/include/tint/tint.h b/include/tint/tint.h
index 9f601f6..329c715 100644
--- a/include/tint/tint.h
+++ b/include/tint/tint.h
@@ -20,7 +20,6 @@
 
 #include "src/ast/pipeline_stage.h"
 #include "src/ast/type_manager.h"
-#include "src/context.h"
 #include "src/diagnostic/printer.h"
 #include "src/inspector/inspector.h"
 #include "src/namer.h"
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index c23d16a..780cf78 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -213,8 +213,6 @@
   ast/workgroup_decoration.h
   castable.cc
   castable.h
-  context.cc
-  context.h
   diagnostic/diagnostic.cc
   diagnostic/diagnostic.h
   diagnostic/formatter.cc
diff --git a/src/ast/module_clone_test.cc b/src/ast/module_clone_test.cc
index 93ec7ee..23be2ad 100644
--- a/src/ast/module_clone_test.cc
+++ b/src/ast/module_clone_test.cc
@@ -12,9 +12,10 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-#include "src/ast/case_statement.h"
+#include <unordered_set>
 
 #include "gtest/gtest.h"
+#include "src/ast/case_statement.h"
 #include "src/reader/wgsl/parser.h"
 #include "src/writer/wgsl/generator.h"
 
@@ -107,8 +108,7 @@
 )");
 
   // Parse the wgsl, create the src module
-  Context ctx;
-  reader::wgsl::Parser parser(&ctx, &file);
+  reader::wgsl::Parser parser(&file);
   ASSERT_TRUE(parser.Parse()) << parser.error();
   auto src = parser.module();
 
diff --git a/src/ast/type/storage_texture_type_test.cc b/src/ast/type/storage_texture_type_test.cc
index 95289ff..0ed1e51 100644
--- a/src/ast/type/storage_texture_type_test.cc
+++ b/src/ast/type/storage_texture_type_test.cc
@@ -92,12 +92,11 @@
 }
 
 TEST_F(StorageTextureTest, F32) {
-  Context ctx;
   Module mod;
   Type* s = mod.create<StorageTexture>(TextureDimension::k2dArray,
                                        ast::AccessControl::kReadOnly,
                                        ImageFormat::kRgba32Float);
-  TypeDeterminer td(&ctx, &mod);
+  TypeDeterminer td(&mod);
 
   ASSERT_TRUE(td.Determine()) << td.error();
   ASSERT_TRUE(s->Is<Texture>());
@@ -106,12 +105,11 @@
 }
 
 TEST_F(StorageTextureTest, U32) {
-  Context ctx;
   Module mod;
   Type* s = mod.create<StorageTexture>(TextureDimension::k2dArray,
                                        ast::AccessControl::kReadOnly,
                                        ImageFormat::kRg32Uint);
-  TypeDeterminer td(&ctx, &mod);
+  TypeDeterminer td(&mod);
 
   ASSERT_TRUE(td.Determine()) << td.error();
   ASSERT_TRUE(s->Is<Texture>());
@@ -120,12 +118,11 @@
 }
 
 TEST_F(StorageTextureTest, I32) {
-  Context ctx;
   Module mod;
   Type* s = mod.create<StorageTexture>(TextureDimension::k2dArray,
                                        ast::AccessControl::kReadOnly,
                                        ImageFormat::kRgba32Sint);
-  TypeDeterminer td(&ctx, &mod);
+  TypeDeterminer td(&mod);
 
   ASSERT_TRUE(td.Determine()) << td.error();
   ASSERT_TRUE(s->Is<Texture>());
diff --git a/src/context.cc b/src/context.cc
deleted file mode 100644
index e637879..0000000
--- a/src/context.cc
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright 2020 The Tint Authors.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "src/context.h"
-
-#include <utility>
-
-#include "src/ast/node.h"
-#include "src/namer.h"
-
-namespace tint {
-
-Context::Context() = default;
-
-Context::Context(std::unique_ptr<Namer>) {}
-
-Context::~Context() = default;
-
-}  // namespace tint
diff --git a/src/context.h b/src/context.h
deleted file mode 100644
index 89a89b3..0000000
--- a/src/context.h
+++ /dev/null
@@ -1,48 +0,0 @@
-// Copyright 2020 The Tint Authors.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef SRC_CONTEXT_H_
-#define SRC_CONTEXT_H_
-
-#include <assert.h>
-
-#include <memory>
-#include <type_traits>
-#include <utility>
-#include <vector>
-
-#include "src/namer.h"
-
-namespace tint {
-
-namespace ast {
-class Node;
-}
-
-/// Context object for Tint. Holds various global resources used through
-/// the system.
-class Context {
- public:
-  /// Constructor
-  Context();
-  /// Constructor
-  /// @param namer the namer to set into the context
-  explicit Context(std::unique_ptr<Namer> namer);
-  /// Destructor
-  ~Context();
-};
-
-}  // namespace tint
-
-#endif  // SRC_CONTEXT_H_
diff --git a/src/inspector/inspector.cc b/src/inspector/inspector.cc
index 031723b..18b4aad 100644
--- a/src/inspector/inspector.cc
+++ b/src/inspector/inspector.cc
@@ -45,9 +45,6 @@
 
 Inspector::Inspector(const ast::Module& module) : module_(module) {}
 
-Inspector::Inspector(Context*, const ast::Module& module)
-    : Inspector(std::move(module)) {}
-
 Inspector::~Inspector() = default;
 
 std::vector<EntryPoint> Inspector::GetEntryPoints() {
diff --git a/src/inspector/inspector.h b/src/inspector/inspector.h
index f1189b0..552dab6 100644
--- a/src/inspector/inspector.h
+++ b/src/inspector/inspector.h
@@ -23,7 +23,6 @@
 
 #include "src/ast/module.h"
 #include "src/ast/pipeline_stage.h"
-#include "src/context.h"
 #include "src/inspector/entry_point.h"
 #include "src/inspector/scalar.h"
 
@@ -74,11 +73,6 @@
   /// Constructor
   /// @param module Shader module to extract information from.
   explicit Inspector(const ast::Module& module);
-  /// Constructor
-  /// DEPRECATED
-  /// @param ctx the context, must be non-null
-  /// @param module Shader module to extract information from.
-  Inspector(Context* ctx, const ast::Module& module);
   ~Inspector();
 
   /// @returns error messages from the Inspector
diff --git a/src/reader/spirv/parser.cc b/src/reader/spirv/parser.cc
index 751b59d..de8078a 100644
--- a/src/reader/spirv/parser.cc
+++ b/src/reader/spirv/parser.cc
@@ -23,9 +23,6 @@
 Parser::Parser(const std::vector<uint32_t>& spv_binary)
     : Reader(), impl_(std::make_unique<ParserImpl>(spv_binary)) {}
 
-Parser::Parser(Context*, const std::vector<uint32_t>& spv_binary)
-    : Parser(spv_binary) {}
-
 Parser::~Parser() = default;
 
 bool Parser::Parse() {
diff --git a/src/reader/spirv/parser.h b/src/reader/spirv/parser.h
index e2084e2..0ace60c 100644
--- a/src/reader/spirv/parser.h
+++ b/src/reader/spirv/parser.h
@@ -19,7 +19,6 @@
 #include <memory>
 #include <vector>
 
-#include "src/context.h"
 #include "src/reader/reader.h"
 
 namespace tint {
@@ -34,11 +33,6 @@
   /// Creates a new parser
   /// @param input the input data to parse
   explicit Parser(const std::vector<uint32_t>& input);
-  /// Creates a new parser
-  /// DEPRECATED
-  /// @param ctx the non-null context object
-  /// @param input the input data to parse
-  Parser(Context* ctx, const std::vector<uint32_t>& input);
   /// Destructor
   ~Parser() override;
 
diff --git a/src/reader/spirv/parser_test.cc b/src/reader/spirv/parser_test.cc
index bef23df..962354c 100644
--- a/src/reader/spirv/parser_test.cc
+++ b/src/reader/spirv/parser_test.cc
@@ -18,7 +18,6 @@
 #include <vector>
 
 #include "gtest/gtest.h"
-#include "src/context.h"
 
 namespace tint {
 namespace reader {
@@ -29,8 +28,7 @@
 
 TEST_F(ParserTest, Uint32VecEmpty) {
   std::vector<uint32_t> data;
-  Context ctx;
-  Parser p(&ctx, data);
+  Parser p(data);
   EXPECT_FALSE(p.Parse());
   // TODO(dneto): What message?
 }
diff --git a/src/reader/wgsl/parser.cc b/src/reader/wgsl/parser.cc
index 503910b..9a16198 100644
--- a/src/reader/wgsl/parser.cc
+++ b/src/reader/wgsl/parser.cc
@@ -25,8 +25,6 @@
 Parser::Parser(Source::File const* file)
     : Reader(), impl_(std::make_unique<ParserImpl>(file)) {}
 
-Parser::Parser(Context*, Source::File const* file) : Parser(file) {}
-
 Parser::~Parser() = default;
 
 bool Parser::Parse() {
diff --git a/src/reader/wgsl/parser.h b/src/reader/wgsl/parser.h
index 110fafc..3aaca80 100644
--- a/src/reader/wgsl/parser.h
+++ b/src/reader/wgsl/parser.h
@@ -18,7 +18,6 @@
 #include <memory>
 #include <string>
 
-#include "src/context.h"
 #include "src/reader/reader.h"
 #include "src/source.h"
 
@@ -34,11 +33,6 @@
   /// Creates a new parser from the given file.
   /// @param file the input source file to parse
   explicit Parser(Source::File const* file);
-  /// Creates a new parser from the given file.
-  /// DEPRECATED
-  /// @param ctx the non-null context object
-  /// @param file the input source file to parse
-  Parser(Context* ctx, Source::File const* file);
   ~Parser() override;
 
   /// Run the parser
diff --git a/src/reader/wgsl/parser_impl_test_helper.h b/src/reader/wgsl/parser_impl_test_helper.h
index f1bdf3b..1c65852 100644
--- a/src/reader/wgsl/parser_impl_test_helper.h
+++ b/src/reader/wgsl/parser_impl_test_helper.h
@@ -21,7 +21,6 @@
 #include <vector>
 
 #include "gtest/gtest.h"
-#include "src/context.h"
 #include "src/reader/wgsl/parser_impl.h"
 
 namespace tint {
diff --git a/src/reader/wgsl/parser_test.cc b/src/reader/wgsl/parser_test.cc
index 01990fd..0ee28ab 100644
--- a/src/reader/wgsl/parser_test.cc
+++ b/src/reader/wgsl/parser_test.cc
@@ -15,7 +15,6 @@
 #include "src/reader/wgsl/parser.h"
 
 #include "gtest/gtest.h"
-#include "src/context.h"
 
 namespace tint {
 namespace reader {
@@ -25,14 +24,12 @@
 using ParserTest = testing::Test;
 
 TEST_F(ParserTest, Empty) {
-  Context ctx;
   Source::File file("test.wgsl", "");
-  Parser p(&ctx, &file);
+  Parser p(&file);
   ASSERT_TRUE(p.Parse()) << p.error();
 }
 
 TEST_F(ParserTest, Parses) {
-  Context ctx;
   Source::File file("test.wgsl", R"(
 [[location(0)]] var<out> gl_FragColor : vec4<f32>;
 
@@ -41,7 +38,7 @@
   gl_FragColor = vec4<f32>(.4, .2, .3, 1);
 }
 )");
-  Parser p(&ctx, &file);
+  Parser p(&file);
   ASSERT_TRUE(p.Parse()) << p.error();
 
   auto m = p.module();
@@ -50,12 +47,11 @@
 }
 
 TEST_F(ParserTest, HandlesError) {
-  Context ctx;
   Source::File file("test.wgsl", R"(
 fn main() ->  {  # missing return type
   return;
 })");
-  Parser p(&ctx, &file);
+  Parser p(&file);
 
   ASSERT_FALSE(p.Parse());
   ASSERT_TRUE(p.has_error());
diff --git a/src/transform/bound_array_accessors.h b/src/transform/bound_array_accessors.h
index b781b4d..bfb7546 100644
--- a/src/transform/bound_array_accessors.h
+++ b/src/transform/bound_array_accessors.h
@@ -21,7 +21,6 @@
 #include "src/ast/expression.h"
 #include "src/ast/module.h"
 #include "src/ast/statement.h"
-#include "src/context.h"
 #include "src/scope_stack.h"
 #include "src/transform/transform.h"
 
diff --git a/src/transform/transform.h b/src/transform/transform.h
index a09d925..2a68467 100644
--- a/src/transform/transform.h
+++ b/src/transform/transform.h
@@ -20,7 +20,6 @@
 #include <utility>
 
 #include "src/ast/module.h"
-#include "src/context.h"
 #include "src/diagnostic/diagnostic.h"
 
 namespace tint {
diff --git a/src/transform/vertex_pulling_test.cc b/src/transform/vertex_pulling_test.cc
index 176a812..942c2c5 100644
--- a/src/transform/vertex_pulling_test.cc
+++ b/src/transform/vertex_pulling_test.cc
@@ -58,7 +58,7 @@
   void InitTransform(VertexStateDescriptor vertex_state) {
     EXPECT_TRUE(mod_->IsValid());
 
-    TypeDeterminer td(&ctx_, mod_.get());
+    TypeDeterminer td(mod_.get());
     EXPECT_TRUE(td.Determine());
 
     transform_->SetVertexState(vertex_state);
@@ -80,6 +80,7 @@
   }
 
   ast::Module* mod() { return mod_.get(); }
+
   Manager* manager() { return manager_.get(); }
   VertexPulling* transform() { return transform_; }
 
@@ -93,7 +94,6 @@
   }
 
  private:
-  Context ctx_;
   std::unique_ptr<ast::Module> mod_;
   std::unique_ptr<Manager> manager_;
   VertexPulling* transform_;
diff --git a/src/type_determiner.cc b/src/type_determiner.cc
index 41e143a..f1c58de 100644
--- a/src/type_determiner.cc
+++ b/src/type_determiner.cc
@@ -60,9 +60,6 @@
 
 TypeDeterminer::TypeDeterminer(ast::Module* mod) : mod_(mod) {}
 
-TypeDeterminer::TypeDeterminer(Context*, ast::Module* mod)
-    : TypeDeterminer(mod) {}
-
 TypeDeterminer::~TypeDeterminer() = default;
 
 void TypeDeterminer::set_error(const Source& src, const std::string& msg) {
diff --git a/src/type_determiner.h b/src/type_determiner.h
index 1632af2..0934d42 100644
--- a/src/type_determiner.h
+++ b/src/type_determiner.h
@@ -21,7 +21,6 @@
 
 #include "src/ast/module.h"
 #include "src/ast/type/storage_texture_type.h"
-#include "src/context.h"
 #include "src/scope_stack.h"
 
 namespace tint {
@@ -46,11 +45,6 @@
   /// Constructor
   /// @param mod the module to update with typing information
   explicit TypeDeterminer(ast::Module* mod);
-  /// Constructor
-  /// DEPRECATED
-  /// @param ctx the tint context, must be non-null
-  /// @param mod the module to update with typing information
-  TypeDeterminer(Context* ctx, ast::Module* mod);
   ~TypeDeterminer();
 
   /// @returns error messages from the type determiner
diff --git a/src/validator/validator_test_helper.cc b/src/validator/validator_test_helper.cc
index 9f2ae15..eae9e96 100644
--- a/src/validator/validator_test_helper.cc
+++ b/src/validator/validator_test_helper.cc
@@ -19,7 +19,7 @@
 namespace tint {
 
 ValidatorTestHelper::ValidatorTestHelper() {
-  td_ = std::make_unique<TypeDeterminer>(&ctx_, &mod_);
+  td_ = std::make_unique<TypeDeterminer>(&mod_);
   v_ = std::make_unique<ValidatorImpl>();
 }
 
diff --git a/src/validator/validator_test_helper.h b/src/validator/validator_test_helper.h
index f448d2f..e5f3cfc 100644
--- a/src/validator/validator_test_helper.h
+++ b/src/validator/validator_test_helper.h
@@ -52,7 +52,6 @@
 
  private:
   std::unique_ptr<ValidatorImpl> v_;
-  Context ctx_;
   ast::Module mod_;
   std::unique_ptr<TypeDeterminer> td_;
   ast::type::Void void_type_;
diff --git a/src/writer/hlsl/generator.cc b/src/writer/hlsl/generator.cc
index 437d0d5..d521533 100644
--- a/src/writer/hlsl/generator.cc
+++ b/src/writer/hlsl/generator.cc
@@ -24,9 +24,6 @@
     : Text(std::move(module)),
       impl_(std::make_unique<GeneratorImpl>(&module_)) {}
 
-Generator::Generator(Context*, ast::Module module)
-    : Generator(std::move(module)) {}
-
 Generator::~Generator() = default;
 
 void Generator::Reset() {
diff --git a/src/writer/hlsl/generator.h b/src/writer/hlsl/generator.h
index 6f4fa1b..83f6d27 100644
--- a/src/writer/hlsl/generator.h
+++ b/src/writer/hlsl/generator.h
@@ -32,11 +32,6 @@
   /// Constructor
   /// @param module the module to convert
   explicit Generator(ast::Module module);
-  /// Constructor
-  /// DEPRECATED
-  /// @param ctx the context, must be non-null
-  /// @param module the module to convert
-  Generator(Context* ctx, ast::Module module);
   ~Generator() override;
 
   /// Resets the generator
diff --git a/src/writer/hlsl/generator_impl_function_entry_point_data_test.cc b/src/writer/hlsl/generator_impl_function_entry_point_data_test.cc
index fe7b171..24448a2 100644
--- a/src/writer/hlsl/generator_impl_function_entry_point_data_test.cc
+++ b/src/writer/hlsl/generator_impl_function_entry_point_data_test.cc
@@ -29,7 +29,6 @@
 #include "src/ast/type/vector_type.h"
 #include "src/ast/type/void_type.h"
 #include "src/ast/variable.h"
-#include "src/context.h"
 #include "src/type_determiner.h"
 #include "src/writer/hlsl/test_helper.h"
 
diff --git a/src/writer/hlsl/generator_impl_function_test.cc b/src/writer/hlsl/generator_impl_function_test.cc
index 487230e..476f720 100644
--- a/src/writer/hlsl/generator_impl_function_test.cc
+++ b/src/writer/hlsl/generator_impl_function_test.cc
@@ -43,7 +43,6 @@
 #include "src/ast/variable.h"
 #include "src/ast/variable_decl_statement.h"
 #include "src/ast/workgroup_decoration.h"
-#include "src/context.h"
 #include "src/type_determiner.h"
 #include "src/writer/hlsl/test_helper.h"
 
diff --git a/src/writer/hlsl/generator_impl_import_test.cc b/src/writer/hlsl/generator_impl_import_test.cc
index 237ce11..6cec975 100644
--- a/src/writer/hlsl/generator_impl_import_test.cc
+++ b/src/writer/hlsl/generator_impl_import_test.cc
@@ -27,7 +27,6 @@
 #include "src/ast/type/matrix_type.h"
 #include "src/ast/type/vector_type.h"
 #include "src/ast/type_constructor_expression.h"
-#include "src/context.h"
 #include "src/type_determiner.h"
 #include "src/writer/hlsl/test_helper.h"
 
diff --git a/src/writer/hlsl/generator_impl_intrinsic_test.cc b/src/writer/hlsl/generator_impl_intrinsic_test.cc
index 669d91f..fb019f0 100644
--- a/src/writer/hlsl/generator_impl_intrinsic_test.cc
+++ b/src/writer/hlsl/generator_impl_intrinsic_test.cc
@@ -17,7 +17,6 @@
 #include "src/ast/module.h"
 #include "src/ast/type/f32_type.h"
 #include "src/ast/type/vector_type.h"
-#include "src/context.h"
 #include "src/type_determiner.h"
 #include "src/writer/hlsl/test_helper.h"
 
diff --git a/src/writer/hlsl/generator_impl_intrinsic_texture_test.cc b/src/writer/hlsl/generator_impl_intrinsic_texture_test.cc
index cd385c4..82a5e0f 100644
--- a/src/writer/hlsl/generator_impl_intrinsic_texture_test.cc
+++ b/src/writer/hlsl/generator_impl_intrinsic_texture_test.cc
@@ -19,7 +19,6 @@
 #include "src/ast/intrinsic_texture_helper_test.h"
 #include "src/ast/type/depth_texture_type.h"
 #include "src/ast/type/sampled_texture_type.h"
-#include "src/context.h"
 #include "src/type_determiner.h"
 #include "src/writer/hlsl/generator_impl.h"
 
diff --git a/src/writer/hlsl/generator_impl_member_accessor_test.cc b/src/writer/hlsl/generator_impl_member_accessor_test.cc
index 516d397..dab22e1 100644
--- a/src/writer/hlsl/generator_impl_member_accessor_test.cc
+++ b/src/writer/hlsl/generator_impl_member_accessor_test.cc
@@ -35,7 +35,6 @@
 #include "src/ast/type/struct_type.h"
 #include "src/ast/type/vector_type.h"
 #include "src/ast/type_constructor_expression.h"
-#include "src/context.h"
 #include "src/type_determiner.h"
 #include "src/writer/hlsl/test_helper.h"
 
diff --git a/src/writer/msl/generator.cc b/src/writer/msl/generator.cc
index 5a9e810..46fa073 100644
--- a/src/writer/msl/generator.cc
+++ b/src/writer/msl/generator.cc
@@ -24,9 +24,6 @@
     : Text(std::move(module)),
       impl_(std::make_unique<GeneratorImpl>(&module_)) {}
 
-Generator::Generator(Context*, ast::Module module)
-    : Generator(std::move(module)) {}
-
 Generator::~Generator() = default;
 
 void Generator::Reset() {
diff --git a/src/writer/msl/generator.h b/src/writer/msl/generator.h
index 9675223..d0a9de2 100644
--- a/src/writer/msl/generator.h
+++ b/src/writer/msl/generator.h
@@ -31,11 +31,6 @@
   /// Constructor
   /// @param module the module to convert
   explicit Generator(ast::Module module);
-  /// Constructor
-  /// DEPRECATED
-  /// @param ctx the context object, must be non-null
-  /// @param module the module to convert
-  Generator(Context* ctx, ast::Module module);
   ~Generator() override;
 
   /// Resets the generator
diff --git a/src/writer/msl/generator_impl_function_entry_point_data_test.cc b/src/writer/msl/generator_impl_function_entry_point_data_test.cc
index d4b3f87..819085e 100644
--- a/src/writer/msl/generator_impl_function_entry_point_data_test.cc
+++ b/src/writer/msl/generator_impl_function_entry_point_data_test.cc
@@ -28,7 +28,6 @@
 #include "src/ast/type/vector_type.h"
 #include "src/ast/type/void_type.h"
 #include "src/ast/variable.h"
-#include "src/context.h"
 #include "src/type_determiner.h"
 #include "src/writer/msl/generator_impl.h"
 #include "src/writer/msl/test_helper.h"
diff --git a/src/writer/msl/generator_impl_function_test.cc b/src/writer/msl/generator_impl_function_test.cc
index 1f9d0e9..53378d4 100644
--- a/src/writer/msl/generator_impl_function_test.cc
+++ b/src/writer/msl/generator_impl_function_test.cc
@@ -45,7 +45,6 @@
 #include "src/ast/type/void_type.h"
 #include "src/ast/variable.h"
 #include "src/ast/variable_decl_statement.h"
-#include "src/context.h"
 #include "src/type_determiner.h"
 #include "src/writer/msl/generator_impl.h"
 #include "src/writer/msl/test_helper.h"
diff --git a/src/writer/msl/generator_impl_import_test.cc b/src/writer/msl/generator_impl_import_test.cc
index c6c1d57..c36bf3c 100644
--- a/src/writer/msl/generator_impl_import_test.cc
+++ b/src/writer/msl/generator_impl_import_test.cc
@@ -28,7 +28,6 @@
 #include "src/ast/type/matrix_type.h"
 #include "src/ast/type/vector_type.h"
 #include "src/ast/type_constructor_expression.h"
-#include "src/context.h"
 #include "src/type_determiner.h"
 #include "src/writer/msl/generator_impl.h"
 #include "src/writer/msl/test_helper.h"
diff --git a/src/writer/msl/generator_impl_intrinsic_test.cc b/src/writer/msl/generator_impl_intrinsic_test.cc
index f4d1b76..ca69fc0 100644
--- a/src/writer/msl/generator_impl_intrinsic_test.cc
+++ b/src/writer/msl/generator_impl_intrinsic_test.cc
@@ -18,7 +18,6 @@
 #include "src/ast/module.h"
 #include "src/ast/type/f32_type.h"
 #include "src/ast/type/vector_type.h"
-#include "src/context.h"
 #include "src/type_determiner.h"
 #include "src/writer/msl/generator_impl.h"
 #include "src/writer/msl/test_helper.h"
diff --git a/src/writer/msl/generator_impl_intrinsic_texture_test.cc b/src/writer/msl/generator_impl_intrinsic_texture_test.cc
index d3ece25..5905e8a 100644
--- a/src/writer/msl/generator_impl_intrinsic_texture_test.cc
+++ b/src/writer/msl/generator_impl_intrinsic_texture_test.cc
@@ -19,7 +19,6 @@
 #include "src/ast/intrinsic_texture_helper_test.h"
 #include "src/ast/type/depth_texture_type.h"
 #include "src/ast/type/sampled_texture_type.h"
-#include "src/context.h"
 #include "src/type_determiner.h"
 #include "src/writer/msl/generator_impl.h"
 
diff --git a/src/writer/msl/generator_impl_type_test.cc b/src/writer/msl/generator_impl_type_test.cc
index e3a58ee..9854cf1 100644
--- a/src/writer/msl/generator_impl_type_test.cc
+++ b/src/writer/msl/generator_impl_type_test.cc
@@ -35,7 +35,6 @@
 #include "src/ast/type/u32_type.h"
 #include "src/ast/type/vector_type.h"
 #include "src/ast/type/void_type.h"
-#include "src/context.h"
 #include "src/type_determiner.h"
 #include "src/writer/msl/generator_impl.h"
 #include "src/writer/msl/test_helper.h"
diff --git a/src/writer/spirv/builder.cc b/src/writer/spirv/builder.cc
index 0fc7f49..7a565bf 100644
--- a/src/writer/spirv/builder.cc
+++ b/src/writer/spirv/builder.cc
@@ -279,8 +279,6 @@
 
 Builder::Builder(ast::Module* mod) : mod_(mod), scope_stack_({}) {}
 
-Builder::Builder(Context*, ast::Module* mod) : Builder(mod) {}
-
 Builder::~Builder() = default;
 
 bool Builder::Build() {
diff --git a/src/writer/spirv/builder.h b/src/writer/spirv/builder.h
index 57ca018..e578c29 100644
--- a/src/writer/spirv/builder.h
+++ b/src/writer/spirv/builder.h
@@ -51,7 +51,6 @@
 #include "src/ast/type_constructor_expression.h"
 #include "src/ast/unary_op_expression.h"
 #include "src/ast/variable_decl_statement.h"
-#include "src/context.h"
 #include "src/scope_stack.h"
 #include "src/writer/spirv/function.h"
 #include "src/writer/spirv/instruction.h"
@@ -85,11 +84,6 @@
   /// Constructor
   /// @param mod the module to generate from
   explicit Builder(ast::Module* mod);
-  /// Constructor
-  /// DEPRECATED
-  /// @param ctx the context, must be non-null
-  /// @param mod the module to generate from
-  Builder(Context* ctx, ast::Module* mod);
   ~Builder();
 
   /// Generates the SPIR-V instructions for the given module
diff --git a/src/writer/spirv/builder_accessor_expression_test.cc b/src/writer/spirv/builder_accessor_expression_test.cc
index 2f22a1d..a834a90 100644
--- a/src/writer/spirv/builder_accessor_expression_test.cc
+++ b/src/writer/spirv/builder_accessor_expression_test.cc
@@ -33,7 +33,6 @@
 #include "src/ast/type_constructor_expression.h"
 #include "src/ast/uint_literal.h"
 #include "src/ast/variable.h"
-#include "src/context.h"
 #include "src/type_determiner.h"
 #include "src/writer/spirv/builder.h"
 #include "src/writer/spirv/spv_dump.h"
diff --git a/src/writer/spirv/builder_assign_test.cc b/src/writer/spirv/builder_assign_test.cc
index 7698c5f..c8ee307 100644
--- a/src/writer/spirv/builder_assign_test.cc
+++ b/src/writer/spirv/builder_assign_test.cc
@@ -29,7 +29,6 @@
 #include "src/ast/type/struct_type.h"
 #include "src/ast/type/vector_type.h"
 #include "src/ast/type_constructor_expression.h"
-#include "src/context.h"
 #include "src/type_determiner.h"
 #include "src/writer/spirv/builder.h"
 #include "src/writer/spirv/spv_dump.h"
diff --git a/src/writer/spirv/builder_binary_expression_test.cc b/src/writer/spirv/builder_binary_expression_test.cc
index bc7463a..89e9af8 100644
--- a/src/writer/spirv/builder_binary_expression_test.cc
+++ b/src/writer/spirv/builder_binary_expression_test.cc
@@ -29,7 +29,6 @@
 #include "src/ast/type/vector_type.h"
 #include "src/ast/type_constructor_expression.h"
 #include "src/ast/uint_literal.h"
-#include "src/context.h"
 #include "src/type_determiner.h"
 #include "src/writer/spirv/builder.h"
 #include "src/writer/spirv/spv_dump.h"
diff --git a/src/writer/spirv/builder_bitcast_expression_test.cc b/src/writer/spirv/builder_bitcast_expression_test.cc
index 9db26dc..ee166f7 100644
--- a/src/writer/spirv/builder_bitcast_expression_test.cc
+++ b/src/writer/spirv/builder_bitcast_expression_test.cc
@@ -19,7 +19,6 @@
 #include "src/ast/scalar_constructor_expression.h"
 #include "src/ast/type/f32_type.h"
 #include "src/ast/type/u32_type.h"
-#include "src/context.h"
 #include "src/type_determiner.h"
 #include "src/writer/spirv/builder.h"
 #include "src/writer/spirv/spv_dump.h"
diff --git a/src/writer/spirv/builder_block_test.cc b/src/writer/spirv/builder_block_test.cc
index bcb5a98..192a0d2 100644
--- a/src/writer/spirv/builder_block_test.cc
+++ b/src/writer/spirv/builder_block_test.cc
@@ -22,7 +22,6 @@
 #include "src/ast/scalar_constructor_expression.h"
 #include "src/ast/type/f32_type.h"
 #include "src/ast/variable_decl_statement.h"
-#include "src/context.h"
 #include "src/type_determiner.h"
 #include "src/writer/spirv/builder.h"
 #include "src/writer/spirv/spv_dump.h"
diff --git a/src/writer/spirv/builder_call_test.cc b/src/writer/spirv/builder_call_test.cc
index af7ec5b..2027617 100644
--- a/src/writer/spirv/builder_call_test.cc
+++ b/src/writer/spirv/builder_call_test.cc
@@ -26,7 +26,6 @@
 #include "src/ast/type/f32_type.h"
 #include "src/ast/type/i32_type.h"
 #include "src/ast/type/void_type.h"
-#include "src/context.h"
 #include "src/type_determiner.h"
 #include "src/writer/spirv/builder.h"
 #include "src/writer/spirv/spv_dump.h"
diff --git a/src/writer/spirv/builder_constructor_expression_test.cc b/src/writer/spirv/builder_constructor_expression_test.cc
index bc06bd5..f48bed6 100644
--- a/src/writer/spirv/builder_constructor_expression_test.cc
+++ b/src/writer/spirv/builder_constructor_expression_test.cc
@@ -37,7 +37,6 @@
 #include "src/ast/type/vector_type.h"
 #include "src/ast/type_constructor_expression.h"
 #include "src/ast/uint_literal.h"
-#include "src/context.h"
 #include "src/type_determiner.h"
 #include "src/writer/spirv/builder.h"
 #include "src/writer/spirv/spv_dump.h"
diff --git a/src/writer/spirv/builder_discard_test.cc b/src/writer/spirv/builder_discard_test.cc
index 9a22335..caf5b81 100644
--- a/src/writer/spirv/builder_discard_test.cc
+++ b/src/writer/spirv/builder_discard_test.cc
@@ -14,7 +14,6 @@
 
 #include "gtest/gtest.h"
 #include "src/ast/discard_statement.h"
-#include "src/context.h"
 #include "src/type_determiner.h"
 #include "src/writer/spirv/builder.h"
 #include "src/writer/spirv/spv_dump.h"
diff --git a/src/writer/spirv/builder_function_decoration_test.cc b/src/writer/spirv/builder_function_decoration_test.cc
index 179432d..4eb517a 100644
--- a/src/writer/spirv/builder_function_decoration_test.cc
+++ b/src/writer/spirv/builder_function_decoration_test.cc
@@ -26,7 +26,6 @@
 #include "src/ast/type/void_type.h"
 #include "src/ast/variable.h"
 #include "src/ast/workgroup_decoration.h"
-#include "src/context.h"
 #include "src/type_determiner.h"
 #include "src/writer/spirv/builder.h"
 #include "src/writer/spirv/spv_dump.h"
diff --git a/src/writer/spirv/builder_function_test.cc b/src/writer/spirv/builder_function_test.cc
index d9fb3c8..cc30814 100644
--- a/src/writer/spirv/builder_function_test.cc
+++ b/src/writer/spirv/builder_function_test.cc
@@ -34,7 +34,6 @@
 #include "src/ast/type/void_type.h"
 #include "src/ast/variable.h"
 #include "src/ast/variable_decl_statement.h"
-#include "src/context.h"
 #include "src/type_determiner.h"
 #include "src/writer/spirv/builder.h"
 #include "src/writer/spirv/spv_dump.h"
diff --git a/src/writer/spirv/builder_function_variable_test.cc b/src/writer/spirv/builder_function_variable_test.cc
index ebc092f..163f66e 100644
--- a/src/writer/spirv/builder_function_variable_test.cc
+++ b/src/writer/spirv/builder_function_variable_test.cc
@@ -33,7 +33,6 @@
 #include "src/ast/type_constructor_expression.h"
 #include "src/ast/variable.h"
 #include "src/ast/variable_decoration.h"
-#include "src/context.h"
 #include "src/type_determiner.h"
 #include "src/writer/spirv/builder.h"
 #include "src/writer/spirv/spv_dump.h"
diff --git a/src/writer/spirv/builder_global_variable_test.cc b/src/writer/spirv/builder_global_variable_test.cc
index da997b1..5a3bd8c 100644
--- a/src/writer/spirv/builder_global_variable_test.cc
+++ b/src/writer/spirv/builder_global_variable_test.cc
@@ -38,7 +38,6 @@
 #include "src/ast/type_constructor_expression.h"
 #include "src/ast/variable.h"
 #include "src/ast/variable_decoration.h"
-#include "src/context.h"
 #include "src/type_determiner.h"
 #include "src/writer/spirv/builder.h"
 #include "src/writer/spirv/spv_dump.h"
diff --git a/src/writer/spirv/builder_ident_expression_test.cc b/src/writer/spirv/builder_ident_expression_test.cc
index dd6b7e4..661082b 100644
--- a/src/writer/spirv/builder_ident_expression_test.cc
+++ b/src/writer/spirv/builder_ident_expression_test.cc
@@ -25,7 +25,6 @@
 #include "src/ast/type/vector_type.h"
 #include "src/ast/type_constructor_expression.h"
 #include "src/ast/variable.h"
-#include "src/context.h"
 #include "src/type_determiner.h"
 #include "src/writer/spirv/builder.h"
 #include "src/writer/spirv/spv_dump.h"
diff --git a/src/writer/spirv/builder_if_test.cc b/src/writer/spirv/builder_if_test.cc
index aa503be..71115c3 100644
--- a/src/writer/spirv/builder_if_test.cc
+++ b/src/writer/spirv/builder_if_test.cc
@@ -28,7 +28,6 @@
 #include "src/ast/sint_literal.h"
 #include "src/ast/type/bool_type.h"
 #include "src/ast/type/i32_type.h"
-#include "src/context.h"
 #include "src/type_determiner.h"
 #include "src/writer/spirv/builder.h"
 #include "src/writer/spirv/spv_dump.h"
diff --git a/src/writer/spirv/builder_intrinsic_test.cc b/src/writer/spirv/builder_intrinsic_test.cc
index 37f18a9..b42252e 100644
--- a/src/writer/spirv/builder_intrinsic_test.cc
+++ b/src/writer/spirv/builder_intrinsic_test.cc
@@ -42,7 +42,6 @@
 #include "src/ast/type_constructor_expression.h"
 #include "src/ast/uint_literal.h"
 #include "src/ast/variable.h"
-#include "src/context.h"
 #include "src/type_determiner.h"
 #include "src/writer/spirv/builder.h"
 #include "src/writer/spirv/spv_dump.h"
diff --git a/src/writer/spirv/builder_intrinsic_texture_test.cc b/src/writer/spirv/builder_intrinsic_texture_test.cc
index c065cfc..5b81b8d 100644
--- a/src/writer/spirv/builder_intrinsic_texture_test.cc
+++ b/src/writer/spirv/builder_intrinsic_texture_test.cc
@@ -19,7 +19,6 @@
 #include "src/ast/intrinsic_texture_helper_test.h"
 #include "src/ast/type/depth_texture_type.h"
 #include "src/ast/type/sampled_texture_type.h"
-#include "src/context.h"
 #include "src/type_determiner.h"
 #include "src/writer/spirv/builder.h"
 #include "src/writer/spirv/spv_dump.h"
diff --git a/src/writer/spirv/builder_loop_test.cc b/src/writer/spirv/builder_loop_test.cc
index 2345a55..66ced50 100644
--- a/src/writer/spirv/builder_loop_test.cc
+++ b/src/writer/spirv/builder_loop_test.cc
@@ -23,7 +23,6 @@
 #include "src/ast/scalar_constructor_expression.h"
 #include "src/ast/sint_literal.h"
 #include "src/ast/type/i32_type.h"
-#include "src/context.h"
 #include "src/type_determiner.h"
 #include "src/writer/spirv/builder.h"
 #include "src/writer/spirv/spv_dump.h"
diff --git a/src/writer/spirv/builder_return_test.cc b/src/writer/spirv/builder_return_test.cc
index 132a6fd..b7912bb 100644
--- a/src/writer/spirv/builder_return_test.cc
+++ b/src/writer/spirv/builder_return_test.cc
@@ -22,7 +22,6 @@
 #include "src/ast/type/f32_type.h"
 #include "src/ast/type/vector_type.h"
 #include "src/ast/type_constructor_expression.h"
-#include "src/context.h"
 #include "src/type_determiner.h"
 #include "src/writer/spirv/builder.h"
 #include "src/writer/spirv/spv_dump.h"
diff --git a/src/writer/spirv/builder_switch_test.cc b/src/writer/spirv/builder_switch_test.cc
index fb99a2a..add53b8 100644
--- a/src/writer/spirv/builder_switch_test.cc
+++ b/src/writer/spirv/builder_switch_test.cc
@@ -27,7 +27,6 @@
 #include "src/ast/switch_statement.h"
 #include "src/ast/type/bool_type.h"
 #include "src/ast/type/i32_type.h"
-#include "src/context.h"
 #include "src/type_determiner.h"
 #include "src/writer/spirv/builder.h"
 #include "src/writer/spirv/spv_dump.h"
diff --git a/src/writer/spirv/builder_unary_op_expression_test.cc b/src/writer/spirv/builder_unary_op_expression_test.cc
index c423293..7fabad8 100644
--- a/src/writer/spirv/builder_unary_op_expression_test.cc
+++ b/src/writer/spirv/builder_unary_op_expression_test.cc
@@ -25,7 +25,6 @@
 #include "src/ast/type/i32_type.h"
 #include "src/ast/type/vector_type.h"
 #include "src/ast/unary_op_expression.h"
-#include "src/context.h"
 #include "src/type_determiner.h"
 #include "src/writer/spirv/builder.h"
 #include "src/writer/spirv/spv_dump.h"
diff --git a/src/writer/spirv/generator.cc b/src/writer/spirv/generator.cc
index 1fac75e..c28cb13 100644
--- a/src/writer/spirv/generator.cc
+++ b/src/writer/spirv/generator.cc
@@ -25,9 +25,6 @@
       builder_(std::make_unique<Builder>(&module_)),
       writer_(std::make_unique<BinaryWriter>()) {}
 
-Generator::Generator(Context*, ast::Module module)
-    : Generator(std::move(module)) {}
-
 Generator::~Generator() = default;
 
 void Generator::Reset() {
diff --git a/src/writer/spirv/generator.h b/src/writer/spirv/generator.h
index 97825eb..f5968b2 100644
--- a/src/writer/spirv/generator.h
+++ b/src/writer/spirv/generator.h
@@ -34,11 +34,6 @@
   /// Constructor
   /// @param module the module to convert
   explicit Generator(ast::Module module);
-  /// Constructor
-  /// DEPRECATED
-  /// @param ctx the context, must be non-null
-  /// @param module the module to convert
-  Generator(Context* ctx, ast::Module module);
   ~Generator() override;
 
   /// Resets the generator
diff --git a/src/writer/wgsl/generator.cc b/src/writer/wgsl/generator.cc
index c96cafd..3f01dc9 100644
--- a/src/writer/wgsl/generator.cc
+++ b/src/writer/wgsl/generator.cc
@@ -23,9 +23,6 @@
 Generator::Generator(ast::Module module)
     : Text(std::move(module)), impl_(std::make_unique<GeneratorImpl>()) {}
 
-Generator::Generator(Context*, ast::Module module)
-    : Generator(std::move(module)) {}
-
 Generator::~Generator() = default;
 
 void Generator::Reset() {
diff --git a/src/writer/wgsl/generator.h b/src/writer/wgsl/generator.h
index e269ec9..2d3a234 100644
--- a/src/writer/wgsl/generator.h
+++ b/src/writer/wgsl/generator.h
@@ -31,11 +31,6 @@
   /// Constructor
   /// @param module the module to convert
   explicit Generator(ast::Module module);
-  /// Constructor
-  /// DEPRECATED
-  /// @param ctx the context, must be non-null
-  /// @param module the module to convert
-  Generator(Context* ctx, ast::Module module);
   ~Generator() override;
 
   /// Resets the generator
diff --git a/src/writer/wgsl/generator_impl_function_test.cc b/src/writer/wgsl/generator_impl_function_test.cc
index 3d337f8..f2ae9ad 100644
--- a/src/writer/wgsl/generator_impl_function_test.cc
+++ b/src/writer/wgsl/generator_impl_function_test.cc
@@ -30,7 +30,6 @@
 #include "src/ast/variable.h"
 #include "src/ast/variable_decl_statement.h"
 #include "src/ast/workgroup_decoration.h"
-#include "src/context.h"
 #include "src/type_determiner.h"
 #include "src/writer/wgsl/generator_impl.h"
 #include "src/writer/wgsl/test_helper.h"
diff --git a/src/writer/writer.h b/src/writer/writer.h
index 46d8801..b38657b 100644
--- a/src/writer/writer.h
+++ b/src/writer/writer.h
@@ -19,7 +19,6 @@
 
 #include "src/ast/module.h"
 #include "src/ast/pipeline_stage.h"
-#include "src/context.h"
 
 namespace tint {
 namespace writer {