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,
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;
}

View File

@ -618,12 +618,12 @@ TEST_F(BuilderTest, If_WithLoad_Bug327) {
// }
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();