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>
This commit is contained in:
Ben Clayton 2020-11-16 16:24:37 +00:00 committed by Commit Bot service account
parent 0575449b82
commit 0613890eed
2 changed files with 5 additions and 5 deletions

View File

@ -26,7 +26,7 @@ Builder::~Builder() = default;
std::unique_ptr<ast::Variable> Builder::make_var(const std::string& name, std::unique_ptr<ast::Variable> Builder::make_var(const std::string& name,
ast::StorageClass storage, ast::StorageClass storage,
ast::type::Type* type) { ast::type::Type* type) {
auto var = std::make_unique<ast::Variable>(name, storage, type); auto var = create<ast::Variable>(name, storage, type);
return var; return var;
} }

View File

@ -618,12 +618,12 @@ TEST_F(BuilderTest, If_WithLoad_Bug327) {
// } // }
ast::type::BoolType bool_type; ast::type::BoolType bool_type;
auto var = std::make_unique<ast::Variable>("a", ast::StorageClass::kFunction, auto var =
&bool_type); create<ast::Variable>("a", ast::StorageClass::kFunction, &bool_type);
td.RegisterVariableForTesting(var.get()); td.RegisterVariableForTesting(var.get());
ast::IfStatement expr(std::make_unique<ast::IdentifierExpression>("a"), ast::IfStatement expr(create<ast::IdentifierExpression>("a"),
std::make_unique<ast::BlockStatement>()); create<ast::BlockStatement>());
ASSERT_TRUE(td.DetermineResultType(&expr)) << td.error(); ASSERT_TRUE(td.DetermineResultType(&expr)) << td.error();