mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-18 09:25:25 +00:00
sem: Add constructor field to sem::Variable
Produces a direct SEM -> SEM pointer, reducing AST <-> SEM hopping. Change-Id: I233b4c47d4e55b5f2c6e14ed08699a302b8fb64d Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/71321 Kokoro: Kokoro <noreply+kokoro@google.com> Commit-Queue: Ben Clayton <bclayton@chromium.org> Reviewed-by: James Price <jrprice@google.com>
This commit is contained in:
committed by
Tint LUCI CQ
parent
f71784fc2b
commit
8e39ffd512
@@ -72,6 +72,16 @@ class Variable : public Castable<Variable, Node> {
|
||||
/// @return the constant value of this expression
|
||||
const Constant& ConstantValue() const { return constant_value_; }
|
||||
|
||||
/// @returns the variable constructor expression, or nullptr if the variable
|
||||
/// does not have one.
|
||||
const Expression* Constructor() const { return constructor_; }
|
||||
|
||||
/// Sets the variable constructor expression.
|
||||
/// @param constructor the constructor expression to assign to this variable.
|
||||
void SetConstructor(const Expression* constructor) {
|
||||
constructor_ = constructor;
|
||||
}
|
||||
|
||||
/// @returns the expressions that use the variable
|
||||
const std::vector<const VariableUser*>& Users() const { return users_; }
|
||||
|
||||
@@ -81,9 +91,10 @@ class Variable : public Castable<Variable, Node> {
|
||||
private:
|
||||
const ast::Variable* const declaration_;
|
||||
const sem::Type* const type_;
|
||||
ast::StorageClass const storage_class_;
|
||||
ast::Access const access_;
|
||||
const ast::StorageClass storage_class_;
|
||||
const ast::Access access_;
|
||||
const Constant constant_value_;
|
||||
const Expression* constructor_ = nullptr;
|
||||
std::vector<const VariableUser*> users_;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user