writer: Remove legacy generator API
Make the sanitizer transforms internal, as the new generator API
automatically runs them.
Change-Id: Ia2674762328b5d91d8370b8c18c31693936e8566
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/57102
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
diff --git a/include/tint/tint.h b/include/tint/tint.h
index d989f92..ac1c8b3 100644
--- a/include/tint/tint.h
+++ b/include/tint/tint.h
@@ -44,7 +44,6 @@
#if TINT_BUILD_SPV_WRITER
#include "spirv-tools/libspirv.hpp"
-#include "src/transform/spirv.h"
#include "src/writer/spirv/generator.h"
#endif // TINT_BUILD_SPV_WRITER
@@ -53,12 +52,10 @@
#endif // TINT_BUILD_WGSL_WRITER
#if TINT_BUILD_MSL_WRITER
-#include "src/transform/msl.h"
#include "src/writer/msl/generator.h"
#endif // TINT_BUILD_MSL_WRITER
#if TINT_BUILD_HLSL_WRITER
-#include "src/transform/hlsl.h"
#include "src/writer/hlsl/generator.h"
#endif // TINT_BUILD_HLSL_WRITER
diff --git a/src/writer/hlsl/generator.cc b/src/writer/hlsl/generator.cc
index d6815a3..5dc8693 100644
--- a/src/writer/hlsl/generator.cc
+++ b/src/writer/hlsl/generator.cc
@@ -54,27 +54,6 @@
return result;
}
-Generator::Generator(const Program* program)
- : impl_(std::make_unique<GeneratorImpl>(program)) {}
-
-Generator::~Generator() = default;
-
-bool Generator::Generate() {
- auto ret = impl_->Generate();
- if (!ret) {
- error_ = impl_->error();
- }
- return ret;
-}
-
-std::string Generator::result() const {
- return impl_->result();
-}
-
-std::string Generator::error() const {
- return impl_->error();
-}
-
} // namespace hlsl
} // namespace writer
} // namespace tint
diff --git a/src/writer/hlsl/generator.h b/src/writer/hlsl/generator.h
index 75d47d8..f467348 100644
--- a/src/writer/hlsl/generator.h
+++ b/src/writer/hlsl/generator.h
@@ -69,31 +69,6 @@
/// @returns the resulting HLSL and supplementary information
Result Generate(const Program* program, const Options& options);
-// TODO(jrprice): Remove this once Dawn is using the new interface.
-/// Class to generate HLSL source
-class Generator : public Text {
- public:
- /// Constructor
- /// @param program the program to convert
- explicit Generator(const Program* program);
-
- /// Destructor
- ~Generator() override;
-
- /// Generates the result data
- /// @returns true on successful generation; false otherwise
- bool Generate() override;
-
- /// @returns the result data
- std::string result() const override;
-
- /// @returns the error
- std::string error() const;
-
- private:
- std::unique_ptr<GeneratorImpl> impl_;
-};
-
} // namespace hlsl
} // namespace writer
} // namespace tint
diff --git a/src/writer/msl/generator.cc b/src/writer/msl/generator.cc
index 215d650..e73541e 100644
--- a/src/writer/msl/generator.cc
+++ b/src/writer/msl/generator.cc
@@ -53,27 +53,6 @@
return result;
}
-Generator::Generator(const Program* program)
- : impl_(std::make_unique<GeneratorImpl>(program)) {}
-
-Generator::~Generator() = default;
-
-bool Generator::Generate() {
- auto ret = impl_->Generate();
- if (!ret) {
- error_ = impl_->error();
- }
- return ret;
-}
-
-std::string Generator::result() const {
- return impl_->result();
-}
-
-std::string Generator::error() const {
- return impl_->error();
-}
-
} // namespace msl
} // namespace writer
} // namespace tint
diff --git a/src/writer/msl/generator.h b/src/writer/msl/generator.h
index 5028458..9a182d3 100644
--- a/src/writer/msl/generator.h
+++ b/src/writer/msl/generator.h
@@ -76,34 +76,6 @@
/// @returns the resulting MSL and supplementary information
Result Generate(const Program* program, const Options& options);
-// TODO(jrprice): Remove this once Dawn is using the new interface.
-/// Class to generate MSL source
-class Generator : public Text {
- public:
- /// Constructor
- /// @param program the program to convert
- explicit Generator(const Program* program);
-
- /// Destructor
- ~Generator() override;
-
- /// Generates the result data
- /// @returns true on successful generation; false otherwise
- bool Generate() override;
-
- /// @returns the result data
- std::string result() const override;
-
- /// @returns the error
- std::string error() const;
-
- private:
- Generator(const Generator&) = delete;
- Generator& operator=(const Generator&) = delete;
-
- std::unique_ptr<GeneratorImpl> impl_;
-};
-
} // namespace msl
} // namespace writer
} // namespace tint
diff --git a/src/writer/spirv/generator.cc b/src/writer/spirv/generator.cc
index 8fae66c..6270e50 100644
--- a/src/writer/spirv/generator.cc
+++ b/src/writer/spirv/generator.cc
@@ -57,27 +57,6 @@
return result;
}
-Generator::Generator(const Program* program)
- : builder_(std::make_unique<Builder>(program)),
- writer_(std::make_unique<BinaryWriter>()) {}
-
-Generator::~Generator() = default;
-
-bool Generator::Generate() {
- if (!builder_->Build()) {
- set_error(builder_->error());
- return false;
- }
-
- writer_->WriteHeader(builder_->id_bound());
- writer_->WriteBuilder(builder_.get());
- return true;
-}
-
-const std::vector<uint32_t>& Generator::result() const {
- return writer_->result();
-}
-
} // namespace spirv
} // namespace writer
} // namespace tint
diff --git a/src/writer/spirv/generator.h b/src/writer/spirv/generator.h
index 122f12b..2b06032 100644
--- a/src/writer/spirv/generator.h
+++ b/src/writer/spirv/generator.h
@@ -69,29 +69,6 @@
/// @returns the resulting SPIR-V and supplementary information
Result Generate(const Program* program, const Options& options);
-// TODO(jrprice): Remove this once Dawn is using the new interface.
-/// Class to generate SPIR-V from a Tint program
-class Generator : public writer::Writer {
- public:
- /// Constructor
- /// @param program the program to convert
- explicit Generator(const Program* program);
-
- /// Destructor
- ~Generator() override;
-
- /// Generates the result data
- /// @returns true on successful generation; false otherwise
- bool Generate() override;
-
- /// @returns the result data
- const std::vector<uint32_t>& result() const;
-
- private:
- std::unique_ptr<Builder> builder_;
- std::unique_ptr<BinaryWriter> writer_;
-};
-
} // namespace spirv
} // namespace writer
} // namespace tint
diff --git a/src/writer/wgsl/generator.cc b/src/writer/wgsl/generator.cc
index 48e1ceb..b7c3566 100644
--- a/src/writer/wgsl/generator.cc
+++ b/src/writer/wgsl/generator.cc
@@ -35,27 +35,6 @@
return result;
}
-Generator::Generator(const Program* program)
- : impl_(std::make_unique<GeneratorImpl>(program)) {}
-
-Generator::~Generator() = default;
-
-bool Generator::Generate() {
- auto ret = impl_->Generate();
- if (!ret) {
- error_ = impl_->error();
- }
- return ret;
-}
-
-std::string Generator::result() const {
- return impl_->result();
-}
-
-std::string Generator::error() const {
- return impl_->error();
-}
-
} // namespace wgsl
} // namespace writer
} // namespace tint
diff --git a/src/writer/wgsl/generator.h b/src/writer/wgsl/generator.h
index 35f194f..9e93c76 100644
--- a/src/writer/wgsl/generator.h
+++ b/src/writer/wgsl/generator.h
@@ -62,34 +62,6 @@
/// @returns the resulting WGSL and supplementary information
Result Generate(const Program* program, const Options& options);
-// TODO(jrprice): Remove this once Dawn is using the new interface.
-/// Class to generate WGSL source
-class Generator : public Text {
- public:
- /// Constructor
- /// @param program the program to convert
- explicit Generator(const Program* program);
-
- /// Destructor
- ~Generator() override;
-
- /// Generates the result data
- /// @returns true on successful generation; false otherwise
- bool Generate() override;
-
- /// @returns the result data
- std::string result() const override;
-
- /// @returns the error
- std::string error() const;
-
- private:
- Generator(const Generator&) = delete;
- Generator& operator=(const Generator&) = delete;
-
- std::unique_ptr<GeneratorImpl> impl_;
-};
-
} // namespace wgsl
} // namespace writer
} // namespace tint