mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-18 17:35:30 +00:00
resolver: Implement Behavior Analysis
This change implements the behavior analysis for expressions and statements as described in: https://www.w3.org/TR/WGSL/#behaviors This CL makes no changes to the validation rules. This will be done as a followup change. Bug: tint:1302 Change-Id: If0a251a7982ea15ff5d93b54a5cc5ed03ba60608 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/68408 Kokoro: Kokoro <noreply+kokoro@google.com> Commit-Queue: Ben Clayton <bclayton@google.com> Reviewed-by: David Neto <dneto@google.com>
This commit is contained in:
committed by
Tint LUCI CQ
parent
bf39c8fb19
commit
3298625760
@@ -68,7 +68,7 @@ class Expression : public Castable<Expression, Node> {
|
||||
const sem::Type* const type_;
|
||||
const Statement* const statement_;
|
||||
const Constant constant_;
|
||||
sem::Behaviors behaviors_;
|
||||
sem::Behaviors behaviors_{sem::Behavior::kNext};
|
||||
};
|
||||
|
||||
} // namespace sem
|
||||
|
||||
@@ -240,6 +240,12 @@ class Function : public Castable<Function, CallTarget> {
|
||||
/// @returns true if this function has a discard statement
|
||||
bool HasDiscard() const { return has_discard_; }
|
||||
|
||||
/// @return the behaviors of this function
|
||||
const sem::Behaviors& Behaviors() const { return behaviors_; }
|
||||
|
||||
/// @return the behaviors of this function
|
||||
sem::Behaviors& Behaviors() { return behaviors_; }
|
||||
|
||||
private:
|
||||
VariableBindings TransitivelyReferencedSamplerVariablesImpl(
|
||||
ast::SamplerKind kind) const;
|
||||
@@ -257,6 +263,7 @@ class Function : public Castable<Function, CallTarget> {
|
||||
std::vector<const Call*> callsites_;
|
||||
std::vector<const Function*> ancestor_entry_points_;
|
||||
bool has_discard_ = false;
|
||||
sem::Behaviors behaviors_{sem::Behavior::kNext};
|
||||
};
|
||||
|
||||
} // namespace sem
|
||||
|
||||
@@ -110,8 +110,7 @@ class Statement : public Castable<Statement, Node> {
|
||||
const ast::Statement* const declaration_;
|
||||
const CompoundStatement* const parent_;
|
||||
const sem::Function* const function_;
|
||||
|
||||
sem::Behaviors behaviors_;
|
||||
sem::Behaviors behaviors_{sem::Behavior::kNext};
|
||||
};
|
||||
|
||||
/// CompoundStatement is the base class of statements that can hold other
|
||||
|
||||
Reference in New Issue
Block a user