reader/wgsl: Replace std::make_unique<T> -> create<T>
create() is currently just a simple forwarder to std::make_unique<>, but
will be later replaced with a function that returns a raw pointer,
and owned by the context.
Bug: tint:322
Change-Id: I281fe91864a98365db5ccd40e264d042e6476172
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/32861
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
diff --git a/src/reader/wgsl/parser_impl.h b/src/reader/wgsl/parser_impl.h
index 0e7dd45..3edb6b2 100644
--- a/src/reader/wgsl/parser_impl.h
+++ b/src/reader/wgsl/parser_impl.h
@@ -751,6 +751,13 @@
Maybe<std::unique_ptr<ast::Statement>> for_header_initializer();
Maybe<std::unique_ptr<ast::Statement>> for_header_continuing();
+ /// @return a `std::unique_ptr` to a new `T` constructed with `args`
+ /// @param args the arguments to forward to the constructor for `T`
+ template <typename T, typename... ARGS>
+ std::unique_ptr<T> create(ARGS&&... args) const {
+ return std::make_unique<T>(std::forward<ARGS>(args)...);
+ }
+
Context& ctx_;
diag::List diags_;
std::unique_ptr<Lexer> lexer_;