sem: Add BindingPoint() to sem::Variable

The Resolver already has this information, so just propagate it to the
semantic variable.

Change-Id: Id9fc58d3fc706a1433aba7cb3845b4f53f3fc386
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/55120
Auto-Submit: James Price <jrprice@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
This commit is contained in:
James Price
2021-06-18 09:27:13 +00:00
committed by Tint LUCI CQ
parent 44382a1857
commit e55e2109b3
4 changed files with 30 additions and 4 deletions

View File

@@ -26,11 +26,13 @@ namespace sem {
Variable::Variable(const ast::Variable* declaration,
const sem::Type* type,
ast::StorageClass storage_class,
ast::Access access)
ast::Access access,
sem::BindingPoint binding_point)
: declaration_(declaration),
type_(type),
storage_class_(storage_class),
access_(access),
binding_point_(binding_point),
is_pipeline_constant_(false) {}
Variable::Variable(const ast::Variable* declaration,

View File

@@ -19,6 +19,7 @@
#include "src/ast/access.h"
#include "src/ast/storage_class.h"
#include "src/sem/binding_point.h"
#include "src/sem/expression.h"
namespace tint {
@@ -43,10 +44,12 @@ class Variable : public Castable<Variable, Node> {
/// @param type the variable type
/// @param storage_class the variable storage class
/// @param access the variable access control type
/// @param binding_point the optional resource binding point of the variable
Variable(const ast::Variable* declaration,
const sem::Type* type,
ast::StorageClass storage_class,
ast::Access access);
ast::Access access,
sem::BindingPoint binding_point = {});
/// Constructor for overridable pipeline constants
/// @param declaration the AST declaration node
@@ -71,6 +74,9 @@ class Variable : public Castable<Variable, Node> {
/// @returns the access control for the variable
ast::Access Access() const { return access_; }
/// @returns the resource binding point for the variable
sem::BindingPoint BindingPoint() const { return binding_point_; }
/// @returns the expressions that use the variable
const std::vector<const VariableUser*>& Users() const { return users_; }
@@ -88,6 +94,7 @@ class Variable : public Castable<Variable, Node> {
const sem::Type* const type_;
ast::StorageClass const storage_class_;
ast::Access const access_;
sem::BindingPoint binding_point_;
std::vector<const VariableUser*> users_;
const bool is_pipeline_constant_;
const uint16_t constant_id_ = 0;