tint: Rename SourceVariable() to RootIdentifier()

This is now a well-defined term in the WGSL spec, so we should use it.

Change-Id: Icc46a77f0a465afbfd39cdaec84e506b143c8c0c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/109220
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Auto-Submit: James Price <jrprice@google.com>
This commit is contained in:
James Price
2022-11-09 12:16:56 +00:00
committed by Dawn LUCI CQ
parent bb8d7341d6
commit a7cd3aeff0
18 changed files with 108 additions and 108 deletions

View File

@@ -28,9 +28,9 @@ Expression::Expression(const ast::Expression* declaration,
const Statement* statement,
const Constant* constant,
bool has_side_effects,
const Variable* source_var /* = nullptr */)
const Variable* root_ident /* = nullptr */)
: declaration_(declaration),
source_variable_(source_var),
root_identifier_(root_ident),
type_(type),
stage_(stage),
statement_(statement),

View File

@@ -40,14 +40,14 @@ class Expression : public Castable<Expression, Node> {
/// @param statement the statement that owns this expression
/// @param constant the constant value of the expression. May be null
/// @param has_side_effects true if this expression may have side-effects
/// @param source_var the (optional) source variable for this expression
/// @param root_ident the (optional) root identifier for this expression
Expression(const ast::Expression* declaration,
const sem::Type* type,
EvaluationStage stage,
const Statement* statement,
const Constant* constant,
bool has_side_effects,
const Variable* source_var = nullptr);
const Variable* root_ident = nullptr);
/// Destructor
~Expression() override;
@@ -71,8 +71,8 @@ class Expression : public Castable<Expression, Node> {
/// For reference and pointer expressions, this will either be the originating
/// variable or a function parameter. For other types of expressions, it will
/// either be the parameter or constant declaration, or nullptr.
/// @return the source variable of this expression, or nullptr
const Variable* SourceVariable() const { return source_variable_; }
/// @return the root identifier of this expression, or nullptr
const Variable* RootIdentifier() const { return root_identifier_; }
/// @return the behaviors of this statement
const sem::Behaviors& Behaviors() const { return behaviors_; }
@@ -89,8 +89,8 @@ class Expression : public Castable<Expression, Node> {
protected:
/// The AST expression node for this semantic expression
const ast::Expression* const declaration_;
/// The source variable for this semantic expression, or nullptr
const Variable* source_variable_;
/// The root identifier for this semantic expression, or nullptr
const Variable* root_identifier_;
private:
const sem::Type* const type_;

View File

@@ -46,7 +46,7 @@ TEST_F(ExpressionTest, UnwrapMaterialize) {
auto* a = create<Expression>(/* declaration */ nullptr, create<I32>(),
sem::EvaluationStage::kRuntime, /* statement */ nullptr,
/* constant_value */ nullptr,
/* has_side_effects */ false, /* source_var */ nullptr);
/* has_side_effects */ false, /* root_ident */ nullptr);
auto* b = create<Materialize>(a, /* statement */ nullptr, &c);
EXPECT_EQ(a, a->UnwrapMaterialize());

View File

@@ -30,8 +30,8 @@ IndexAccessorExpression::IndexAccessorExpression(const ast::IndexAccessorExpress
const Statement* statement,
const Constant* constant,
bool has_side_effects,
const Variable* source_var /* = nullptr */)
: Base(declaration, type, stage, statement, constant, has_side_effects, source_var),
const Variable* root_ident /* = nullptr */)
: Base(declaration, type, stage, statement, constant, has_side_effects, root_ident),
object_(object),
index_(index) {}

View File

@@ -38,7 +38,7 @@ class IndexAccessorExpression final : public Castable<IndexAccessorExpression, E
/// @param statement the statement that owns this expression
/// @param constant the constant value of the expression. May be null
/// @param has_side_effects whether this expression may have side effects
/// @param source_var the (optional) source variable for this expression
/// @param root_ident the (optional) root identifier for this expression
IndexAccessorExpression(const ast::IndexAccessorExpression* declaration,
const sem::Type* type,
EvaluationStage stage,
@@ -47,7 +47,7 @@ class IndexAccessorExpression final : public Castable<IndexAccessorExpression, E
const Statement* statement,
const Constant* constant,
bool has_side_effects,
const Variable* source_var = nullptr);
const Variable* root_ident = nullptr);
/// Destructor
~IndexAccessorExpression() override;

View File

@@ -26,7 +26,7 @@ Materialize::Materialize(const Expression* expr,
/* statement */ statement,
/* constant */ constant,
/* has_side_effects */ false,
/* source_var */ expr->SourceVariable()),
/* root_ident */ expr->RootIdentifier()),
expr_(expr) {}
Materialize::~Materialize() = default;

View File

@@ -30,8 +30,8 @@ MemberAccessorExpression::MemberAccessorExpression(const ast::MemberAccessorExpr
const Constant* constant,
const Expression* object,
bool has_side_effects,
const Variable* source_var /* = nullptr */)
: Base(declaration, type, stage, statement, constant, has_side_effects, source_var),
const Variable* root_ident /* = nullptr */)
: Base(declaration, type, stage, statement, constant, has_side_effects, root_ident),
object_(object) {}
MemberAccessorExpression::~MemberAccessorExpression() = default;
@@ -43,7 +43,7 @@ StructMemberAccess::StructMemberAccess(const ast::MemberAccessorExpression* decl
const Expression* object,
const StructMember* member,
bool has_side_effects,
const Variable* source_var /* = nullptr */)
const Variable* root_ident /* = nullptr */)
: Base(declaration,
type,
object->Stage(),
@@ -51,7 +51,7 @@ StructMemberAccess::StructMemberAccess(const ast::MemberAccessorExpression* decl
constant,
object,
has_side_effects,
source_var),
root_ident),
member_(member) {}
StructMemberAccess::~StructMemberAccess() = default;
@@ -63,7 +63,7 @@ Swizzle::Swizzle(const ast::MemberAccessorExpression* declaration,
const Expression* object,
utils::VectorRef<uint32_t> indices,
bool has_side_effects,
const Variable* source_var /* = nullptr */)
const Variable* root_ident /* = nullptr */)
: Base(declaration,
type,
object->Stage(),
@@ -71,7 +71,7 @@ Swizzle::Swizzle(const ast::MemberAccessorExpression* declaration,
constant,
object,
has_side_effects,
source_var),
root_ident),
indices_(std::move(indices)) {}
Swizzle::~Swizzle() = default;

View File

@@ -48,7 +48,7 @@ class MemberAccessorExpression : public Castable<MemberAccessorExpression, Expre
/// @param constant the constant value of the expression. May be null.
/// @param object the object that holds the member being accessed
/// @param has_side_effects whether this expression may have side effects
/// @param source_var the (optional) source variable for this expression
/// @param root_ident the (optional) root identifier for this expression
MemberAccessorExpression(const ast::MemberAccessorExpression* declaration,
const sem::Type* type,
EvaluationStage stage,
@@ -56,7 +56,7 @@ class MemberAccessorExpression : public Castable<MemberAccessorExpression, Expre
const Constant* constant,
const Expression* object,
bool has_side_effects,
const Variable* source_var = nullptr);
const Variable* root_ident = nullptr);
private:
Expression const* const object_;
@@ -75,7 +75,7 @@ class StructMemberAccess final : public Castable<StructMemberAccess, MemberAcces
/// @param object the object that holds the member being accessed
/// @param member the structure member
/// @param has_side_effects whether this expression may have side effects
/// @param source_var the (optional) source variable for this expression
/// @param root_ident the (optional) root identifier for this expression
StructMemberAccess(const ast::MemberAccessorExpression* declaration,
const sem::Type* type,
const Statement* statement,
@@ -83,7 +83,7 @@ class StructMemberAccess final : public Castable<StructMemberAccess, MemberAcces
const Expression* object,
const StructMember* member,
bool has_side_effects,
const Variable* source_var = nullptr);
const Variable* root_ident = nullptr);
/// Destructor
~StructMemberAccess() override;
@@ -107,7 +107,7 @@ class Swizzle final : public Castable<Swizzle, MemberAccessorExpression> {
/// @param object the object that holds the member being accessed
/// @param indices the swizzle indices
/// @param has_side_effects whether this expression may have side effects
/// @param source_var the (optional) source variable for this expression
/// @param root_ident the (optional) root identifier for this expression
Swizzle(const ast::MemberAccessorExpression* declaration,
const sem::Type* type,
const Statement* statement,
@@ -115,7 +115,7 @@ class Swizzle final : public Castable<Swizzle, MemberAccessorExpression> {
const Expression* object,
utils::VectorRef<uint32_t> indices,
bool has_side_effects,
const Variable* source_var = nullptr);
const Variable* root_ident = nullptr);
/// Destructor
~Swizzle() override;

View File

@@ -97,9 +97,9 @@ VariableUser::VariableUser(const ast::IdentifierExpression* declaration,
variable_(variable) {
auto* type = variable->Type();
if (type->Is<sem::Pointer>() && variable->Initializer()) {
source_variable_ = variable->Initializer()->SourceVariable();
root_identifier_ = variable->Initializer()->RootIdentifier();
} else {
source_variable_ = variable;
root_identifier_ = variable;
}
}