Replace remaining std::make_unique<T> -> create<T> for ast::Nodes
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: I9d85e925538789d9b58f32c2bba32a05e22aea1c
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/32863
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
diff --git a/src/ast/builder.cc b/src/ast/builder.cc
index 957ce17..fce7b91 100644
--- a/src/ast/builder.cc
+++ b/src/ast/builder.cc
@@ -26,7 +26,7 @@
std::unique_ptr<ast::Variable> Builder::make_var(const std::string& name,
ast::StorageClass storage,
ast::type::Type* type) {
- auto var = std::make_unique<ast::Variable>(name, storage, type);
+ auto var = create<ast::Variable>(name, storage, type);
return var;
}
diff --git a/src/writer/spirv/builder_if_test.cc b/src/writer/spirv/builder_if_test.cc
index e86a6ac..0842d76 100644
--- a/src/writer/spirv/builder_if_test.cc
+++ b/src/writer/spirv/builder_if_test.cc
@@ -618,12 +618,12 @@
// }
ast::type::BoolType bool_type;
- auto var = std::make_unique<ast::Variable>("a", ast::StorageClass::kFunction,
- &bool_type);
+ auto var =
+ create<ast::Variable>("a", ast::StorageClass::kFunction, &bool_type);
td.RegisterVariableForTesting(var.get());
- ast::IfStatement expr(std::make_unique<ast::IdentifierExpression>("a"),
- std::make_unique<ast::BlockStatement>());
+ ast::IfStatement expr(create<ast::IdentifierExpression>("a"),
+ create<ast::BlockStatement>());
ASSERT_TRUE(td.DetermineResultType(&expr)) << td.error();