[spirv-writer] Fixing memory leaks in texture intrinsics tests

The variables are no longer released.

Bug: tint:143
Change-Id: I56a3edd0e7acb3c729aa82851879d69e510298db
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/28164
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Tomek Ponitka <tommek@google.com>
This commit is contained in:
Tomek Ponitka 2020-09-07 12:05:28 +00:00 committed by Commit Bot service account
parent f51a48dc49
commit e4f60fa0be
1 changed files with 6 additions and 4 deletions

View File

@ -471,12 +471,13 @@ class Builder_TextureOperation
void add_call_param(std::string name, void add_call_param(std::string name,
ast::type::Type* type, ast::type::Type* type,
ast::ExpressionList* call_params) { ast::ExpressionList* call_params) {
auto var = variables_.push_back(
std::make_unique<ast::Variable>(name, ast::StorageClass::kNone, type); std::make_unique<ast::Variable>(name, ast::StorageClass::kNone, type));
td()->RegisterVariableForTesting(var.get()); td()->RegisterVariableForTesting(variables_.back().get());
call_params->push_back(std::make_unique<ast::IdentifierExpression>(name)); call_params->push_back(std::make_unique<ast::IdentifierExpression>(name));
ASSERT_TRUE(b()->GenerateGlobalVariable(var.release())) << b()->error(); ASSERT_TRUE(b()->GenerateGlobalVariable(variables_.back().get()))
<< b()->error();
} }
std::unique_ptr<ast::type::Type> subtype(TextureType type) { std::unique_ptr<ast::type::Type> subtype(TextureType type) {
@ -556,6 +557,7 @@ class Builder_TextureOperation
ast::Module mod_; ast::Module mod_;
std::unique_ptr<TypeDeterminer> td_; std::unique_ptr<TypeDeterminer> td_;
std::unique_ptr<Builder> b_; std::unique_ptr<Builder> b_;
std::vector<std::unique_ptr<ast::Variable>> variables_;
}; };
class Builder_TextureLoad : public Builder_TextureOperation { class Builder_TextureLoad : public Builder_TextureOperation {