Add ability to clone types.
This CL adds a `Clone` method into the type base classes. This allows
the IR to clone types provided by the program into the IR context.
Bug: tint:1718
Change-Id: Ieebf011dcf40bedc98bf5acebd3888acfde863bc
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/116362
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
diff --git a/src/tint/type/pointer.cc b/src/tint/type/pointer.cc
index 0ae8e0a..8716b92 100644
--- a/src/tint/type/pointer.cc
+++ b/src/tint/type/pointer.cc
@@ -53,4 +53,9 @@
Pointer::~Pointer() = default;
+Pointer* Pointer::Clone(CloneContext& ctx) const {
+ auto* ty = subtype_->Clone(ctx);
+ return ctx.dst.mgr->Get<Pointer>(ty, address_space_, access_);
+}
+
} // namespace tint::type