ast: Remove Variable constructor that doesn't take a source

set_source() will be removed, so sources will only be specifiable at construction time.

Bug: tint:390
Change-Id: I5c79efd3fa501ebd9308f7f93cfb77bc12198047
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/35009
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
This commit is contained in:
Ben Clayton
2020-12-07 21:08:07 +00:00
committed by Commit Bot service account
parent b4b29639a1
commit 321e5a9d7e
54 changed files with 813 additions and 631 deletions

View File

@@ -2094,8 +2094,9 @@ bool FunctionEmitter::EmitIfStart(const BlockInfo& block_info) {
const std::string guard_name = block_info.flow_guard_name;
if (!guard_name.empty()) {
// Declare the guard variable just before the "if", initialized to true.
auto* guard_var = create<ast::Variable>(
guard_name, ast::StorageClass::kFunction, parser_impl_.Bool());
auto* guard_var = create<ast::Variable>(Source{}, guard_name,
ast::StorageClass::kFunction,
parser_impl_.Bool());
guard_var->set_constructor(MakeTrue());
auto* guard_decl = create<ast::VariableDeclStatement>(guard_var);
AddStatement(guard_decl);
@@ -2637,9 +2638,9 @@ bool FunctionEmitter::EmitStatementsInBasicBlock(const BlockInfo& block_info,
assert(def_inst);
const auto phi_var_name = GetDefInfo(id)->phi_var;
assert(!phi_var_name.empty());
auto* var =
create<ast::Variable>(phi_var_name, ast::StorageClass::kFunction,
parser_impl_.ConvertType(def_inst->type_id()));
auto* var = create<ast::Variable>(
Source{}, phi_var_name, ast::StorageClass::kFunction,
parser_impl_.ConvertType(def_inst->type_id()));
AddStatement(create<ast::VariableDeclStatement>(var));
}

View File

@@ -1171,7 +1171,7 @@ ast::Variable* ParserImpl::MakeVariable(uint32_t id,
type = ast_module_.create<ast::type::AccessControl>(access, type);
}
auto* ast_var = create<ast::Variable>(namer_.Name(id), sc, type);
auto* ast_var = create<ast::Variable>(Source{}, namer_.Name(id), sc, type);
ast::VariableDecorationList ast_decorations;
for (auto& deco : GetDecorationsFor(id)) {