Add ProgramID feed it into all ast::Nodes
This will be used to detect accidental leaks of program objects between programs. Bug: tint:709 Change-Id: I20f784a2c673d19a04a880b3ec91dfe2eb743bdb Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/47622 Commit-Queue: Ben Clayton <bclayton@google.com> Kokoro: Kokoro <noreply+kokoro@google.com> Reviewed-by: Antonio Maiorano <amaiorano@google.com> Reviewed-by: James Price <jrprice@google.com>
This commit is contained in:
parent
f01ed13a25
commit
e6995de232
|
@ -362,6 +362,8 @@ source_set("libtint_core_src") {
|
||||||
"inspector/scalar.h",
|
"inspector/scalar.h",
|
||||||
"intrinsic_table.cc",
|
"intrinsic_table.cc",
|
||||||
"intrinsic_table.h",
|
"intrinsic_table.h",
|
||||||
|
"program_id.cc",
|
||||||
|
"program_id.h",
|
||||||
"program.cc",
|
"program.cc",
|
||||||
"program.h",
|
"program.h",
|
||||||
"program_builder.cc",
|
"program_builder.cc",
|
||||||
|
|
|
@ -179,6 +179,8 @@ set(TINT_LIB_SRCS
|
||||||
inspector/scalar.h
|
inspector/scalar.h
|
||||||
program_builder.cc
|
program_builder.cc
|
||||||
program_builder.h
|
program_builder.h
|
||||||
|
program_id.cc
|
||||||
|
program_id.h
|
||||||
program.cc
|
program.cc
|
||||||
program.h
|
program.h
|
||||||
reader/reader.cc
|
reader/reader.cc
|
||||||
|
|
|
@ -21,8 +21,10 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::AccessDecoration);
|
||||||
namespace tint {
|
namespace tint {
|
||||||
namespace ast {
|
namespace ast {
|
||||||
|
|
||||||
AccessDecoration::AccessDecoration(const Source& source, AccessControl val)
|
AccessDecoration::AccessDecoration(ProgramID program_id,
|
||||||
: Base(source), value_(val) {}
|
const Source& source,
|
||||||
|
AccessControl val)
|
||||||
|
: Base(program_id, source), value_(val) {}
|
||||||
|
|
||||||
AccessDecoration::~AccessDecoration() = default;
|
AccessDecoration::~AccessDecoration() = default;
|
||||||
|
|
||||||
|
|
|
@ -25,9 +25,12 @@ namespace ast {
|
||||||
class AccessDecoration : public Castable<AccessDecoration, Decoration> {
|
class AccessDecoration : public Castable<AccessDecoration, Decoration> {
|
||||||
public:
|
public:
|
||||||
/// constructor
|
/// constructor
|
||||||
|
/// @param program_id the identifier of the program that owns this node
|
||||||
/// @param source the source of this decoration
|
/// @param source the source of this decoration
|
||||||
/// @param value the access value
|
/// @param value the access value
|
||||||
explicit AccessDecoration(const Source& source, AccessControl value);
|
AccessDecoration(ProgramID program_id,
|
||||||
|
const Source& source,
|
||||||
|
AccessControl value);
|
||||||
~AccessDecoration() override;
|
~AccessDecoration() override;
|
||||||
|
|
||||||
/// @returns the access control value
|
/// @returns the access control value
|
||||||
|
|
|
@ -21,10 +21,11 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::ArrayAccessorExpression);
|
||||||
namespace tint {
|
namespace tint {
|
||||||
namespace ast {
|
namespace ast {
|
||||||
|
|
||||||
ArrayAccessorExpression::ArrayAccessorExpression(const Source& source,
|
ArrayAccessorExpression::ArrayAccessorExpression(ProgramID program_id,
|
||||||
|
const Source& source,
|
||||||
Expression* array,
|
Expression* array,
|
||||||
Expression* idx_expr)
|
Expression* idx_expr)
|
||||||
: Base(source), array_(array), idx_expr_(idx_expr) {
|
: Base(program_id, source), array_(array), idx_expr_(idx_expr) {
|
||||||
TINT_ASSERT(array_);
|
TINT_ASSERT(array_);
|
||||||
TINT_ASSERT(idx_expr_);
|
TINT_ASSERT(idx_expr_);
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,10 +25,12 @@ class ArrayAccessorExpression
|
||||||
: public Castable<ArrayAccessorExpression, Expression> {
|
: public Castable<ArrayAccessorExpression, Expression> {
|
||||||
public:
|
public:
|
||||||
/// Constructor
|
/// Constructor
|
||||||
|
/// @param program_id the identifier of the program that owns this node
|
||||||
/// @param source the array accessor source
|
/// @param source the array accessor source
|
||||||
/// @param array the array
|
/// @param array the array
|
||||||
/// @param idx_expr the index expression
|
/// @param idx_expr the index expression
|
||||||
ArrayAccessorExpression(const Source& source,
|
ArrayAccessorExpression(ProgramID program_id,
|
||||||
|
const Source& source,
|
||||||
Expression* array,
|
Expression* array,
|
||||||
Expression* idx_expr);
|
Expression* idx_expr);
|
||||||
/// Move constructor
|
/// Move constructor
|
||||||
|
|
|
@ -21,10 +21,11 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::AssignmentStatement);
|
||||||
namespace tint {
|
namespace tint {
|
||||||
namespace ast {
|
namespace ast {
|
||||||
|
|
||||||
AssignmentStatement::AssignmentStatement(const Source& source,
|
AssignmentStatement::AssignmentStatement(ProgramID program_id,
|
||||||
|
const Source& source,
|
||||||
Expression* lhs,
|
Expression* lhs,
|
||||||
Expression* rhs)
|
Expression* rhs)
|
||||||
: Base(source), lhs_(lhs), rhs_(rhs) {
|
: Base(program_id, source), lhs_(lhs), rhs_(rhs) {
|
||||||
TINT_ASSERT(lhs_);
|
TINT_ASSERT(lhs_);
|
||||||
TINT_ASSERT(rhs_);
|
TINT_ASSERT(rhs_);
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,10 +25,14 @@ namespace ast {
|
||||||
class AssignmentStatement : public Castable<AssignmentStatement, Statement> {
|
class AssignmentStatement : public Castable<AssignmentStatement, Statement> {
|
||||||
public:
|
public:
|
||||||
/// Constructor
|
/// Constructor
|
||||||
|
/// @param program_id the identifier of the program that owns this node
|
||||||
/// @param source the assignment statement source
|
/// @param source the assignment statement source
|
||||||
/// @param lhs the left side of the expression
|
/// @param lhs the left side of the expression
|
||||||
/// @param rhs the right side of the expression
|
/// @param rhs the right side of the expression
|
||||||
AssignmentStatement(const Source& source, Expression* lhs, Expression* rhs);
|
AssignmentStatement(ProgramID program_id,
|
||||||
|
const Source& source,
|
||||||
|
Expression* lhs,
|
||||||
|
Expression* rhs);
|
||||||
/// Move constructor
|
/// Move constructor
|
||||||
AssignmentStatement(AssignmentStatement&&);
|
AssignmentStatement(AssignmentStatement&&);
|
||||||
~AssignmentStatement() override;
|
~AssignmentStatement() override;
|
||||||
|
|
|
@ -21,11 +21,12 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::BinaryExpression);
|
||||||
namespace tint {
|
namespace tint {
|
||||||
namespace ast {
|
namespace ast {
|
||||||
|
|
||||||
BinaryExpression::BinaryExpression(const Source& source,
|
BinaryExpression::BinaryExpression(ProgramID program_id,
|
||||||
|
const Source& source,
|
||||||
BinaryOp op,
|
BinaryOp op,
|
||||||
Expression* lhs,
|
Expression* lhs,
|
||||||
Expression* rhs)
|
Expression* rhs)
|
||||||
: Base(source), op_(op), lhs_(lhs), rhs_(rhs) {
|
: Base(program_id, source), op_(op), lhs_(lhs), rhs_(rhs) {
|
||||||
TINT_ASSERT(lhs_);
|
TINT_ASSERT(lhs_);
|
||||||
TINT_ASSERT(rhs_);
|
TINT_ASSERT(rhs_);
|
||||||
TINT_ASSERT(op_ != BinaryOp::kNone);
|
TINT_ASSERT(op_ != BinaryOp::kNone);
|
||||||
|
|
|
@ -47,11 +47,13 @@ enum class BinaryOp {
|
||||||
class BinaryExpression : public Castable<BinaryExpression, Expression> {
|
class BinaryExpression : public Castable<BinaryExpression, Expression> {
|
||||||
public:
|
public:
|
||||||
/// Constructor
|
/// Constructor
|
||||||
|
/// @param program_id the identifier of the program that owns this node
|
||||||
/// @param source the binary expression source
|
/// @param source the binary expression source
|
||||||
/// @param op the operation type
|
/// @param op the operation type
|
||||||
/// @param lhs the left side of the expression
|
/// @param lhs the left side of the expression
|
||||||
/// @param rhs the right side of the expression
|
/// @param rhs the right side of the expression
|
||||||
BinaryExpression(const Source& source,
|
BinaryExpression(ProgramID program_id,
|
||||||
|
const Source& source,
|
||||||
BinaryOp op,
|
BinaryOp op,
|
||||||
Expression* lhs,
|
Expression* lhs,
|
||||||
Expression* rhs);
|
Expression* rhs);
|
||||||
|
|
|
@ -21,8 +21,10 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::BindingDecoration);
|
||||||
namespace tint {
|
namespace tint {
|
||||||
namespace ast {
|
namespace ast {
|
||||||
|
|
||||||
BindingDecoration::BindingDecoration(const Source& source, uint32_t val)
|
BindingDecoration::BindingDecoration(ProgramID program_id,
|
||||||
: Base(source), value_(val) {}
|
const Source& source,
|
||||||
|
uint32_t val)
|
||||||
|
: Base(program_id, source), value_(val) {}
|
||||||
|
|
||||||
BindingDecoration::~BindingDecoration() = default;
|
BindingDecoration::~BindingDecoration() = default;
|
||||||
|
|
||||||
|
|
|
@ -24,9 +24,10 @@ namespace ast {
|
||||||
class BindingDecoration : public Castable<BindingDecoration, Decoration> {
|
class BindingDecoration : public Castable<BindingDecoration, Decoration> {
|
||||||
public:
|
public:
|
||||||
/// constructor
|
/// constructor
|
||||||
/// @param value the binding value
|
/// @param program_id the identifier of the program that owns this node
|
||||||
/// @param source the source of this decoration
|
/// @param source the source of this decoration
|
||||||
BindingDecoration(const Source& source, uint32_t value);
|
/// @param value the binding value
|
||||||
|
BindingDecoration(ProgramID program_id, const Source& source, uint32_t value);
|
||||||
~BindingDecoration() override;
|
~BindingDecoration() override;
|
||||||
|
|
||||||
/// @returns the binding value
|
/// @returns the binding value
|
||||||
|
|
|
@ -21,10 +21,11 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::BitcastExpression);
|
||||||
namespace tint {
|
namespace tint {
|
||||||
namespace ast {
|
namespace ast {
|
||||||
|
|
||||||
BitcastExpression::BitcastExpression(const Source& source,
|
BitcastExpression::BitcastExpression(ProgramID program_id,
|
||||||
|
const Source& source,
|
||||||
type::Type* type,
|
type::Type* type,
|
||||||
Expression* expr)
|
Expression* expr)
|
||||||
: Base(source), type_(type), expr_(expr) {
|
: Base(program_id, source), type_(type), expr_(expr) {
|
||||||
TINT_ASSERT(type_);
|
TINT_ASSERT(type_);
|
||||||
TINT_ASSERT(expr_);
|
TINT_ASSERT(expr_);
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,10 +24,14 @@ namespace ast {
|
||||||
class BitcastExpression : public Castable<BitcastExpression, Expression> {
|
class BitcastExpression : public Castable<BitcastExpression, Expression> {
|
||||||
public:
|
public:
|
||||||
/// Constructor
|
/// Constructor
|
||||||
|
/// @param program_id the identifier of the program that owns this node
|
||||||
/// @param source the bitcast expression source
|
/// @param source the bitcast expression source
|
||||||
/// @param type the type
|
/// @param type the type
|
||||||
/// @param expr the expr
|
/// @param expr the expr
|
||||||
BitcastExpression(const Source& source, type::Type* type, Expression* expr);
|
BitcastExpression(ProgramID program_id,
|
||||||
|
const Source& source,
|
||||||
|
type::Type* type,
|
||||||
|
Expression* expr);
|
||||||
/// Move constructor
|
/// Move constructor
|
||||||
BitcastExpression(BitcastExpression&&);
|
BitcastExpression(BitcastExpression&&);
|
||||||
~BitcastExpression() override;
|
~BitcastExpression() override;
|
||||||
|
|
|
@ -21,9 +21,10 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::BlockStatement);
|
||||||
namespace tint {
|
namespace tint {
|
||||||
namespace ast {
|
namespace ast {
|
||||||
|
|
||||||
BlockStatement::BlockStatement(const Source& source,
|
BlockStatement::BlockStatement(ProgramID program_id,
|
||||||
|
const Source& source,
|
||||||
const StatementList& statements)
|
const StatementList& statements)
|
||||||
: Base(source), statements_(std::move(statements)) {
|
: Base(program_id, source), statements_(std::move(statements)) {
|
||||||
for (auto* stmt : *this) {
|
for (auto* stmt : *this) {
|
||||||
TINT_ASSERT(stmt);
|
TINT_ASSERT(stmt);
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,9 +26,12 @@ namespace ast {
|
||||||
class BlockStatement : public Castable<BlockStatement, Statement> {
|
class BlockStatement : public Castable<BlockStatement, Statement> {
|
||||||
public:
|
public:
|
||||||
/// Constructor
|
/// Constructor
|
||||||
|
/// @param program_id the identifier of the program that owns this node
|
||||||
/// @param source the block statement source
|
/// @param source the block statement source
|
||||||
/// @param statements the statements
|
/// @param statements the statements
|
||||||
BlockStatement(const Source& source, const StatementList& statements);
|
BlockStatement(ProgramID program_id,
|
||||||
|
const Source& source,
|
||||||
|
const StatementList& statements);
|
||||||
/// Move constructor
|
/// Move constructor
|
||||||
BlockStatement(BlockStatement&&);
|
BlockStatement(BlockStatement&&);
|
||||||
~BlockStatement() override;
|
~BlockStatement() override;
|
||||||
|
|
|
@ -21,8 +21,11 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::BoolLiteral);
|
||||||
namespace tint {
|
namespace tint {
|
||||||
namespace ast {
|
namespace ast {
|
||||||
|
|
||||||
BoolLiteral::BoolLiteral(const Source& source, type::Type* type, bool value)
|
BoolLiteral::BoolLiteral(ProgramID program_id,
|
||||||
: Base(source, type), value_(value) {}
|
const Source& source,
|
||||||
|
type::Type* type,
|
||||||
|
bool value)
|
||||||
|
: Base(program_id, source, type), value_(value) {}
|
||||||
|
|
||||||
BoolLiteral::~BoolLiteral() = default;
|
BoolLiteral::~BoolLiteral() = default;
|
||||||
|
|
||||||
|
|
|
@ -26,10 +26,14 @@ namespace ast {
|
||||||
class BoolLiteral : public Castable<BoolLiteral, Literal> {
|
class BoolLiteral : public Castable<BoolLiteral, Literal> {
|
||||||
public:
|
public:
|
||||||
/// Constructor
|
/// Constructor
|
||||||
|
/// @param program_id the identifier of the program that owns this node
|
||||||
/// @param source the input source
|
/// @param source the input source
|
||||||
/// @param type the type of the literal
|
/// @param type the type of the literal
|
||||||
/// @param value the bool literals value
|
/// @param value the bool literals value
|
||||||
BoolLiteral(const Source& source, type::Type* type, bool value);
|
BoolLiteral(ProgramID program_id,
|
||||||
|
const Source& source,
|
||||||
|
type::Type* type,
|
||||||
|
bool value);
|
||||||
~BoolLiteral() override;
|
~BoolLiteral() override;
|
||||||
|
|
||||||
/// @returns true if the bool literal is true
|
/// @returns true if the bool literal is true
|
||||||
|
|
|
@ -21,7 +21,8 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::BreakStatement);
|
||||||
namespace tint {
|
namespace tint {
|
||||||
namespace ast {
|
namespace ast {
|
||||||
|
|
||||||
BreakStatement::BreakStatement(const Source& source) : Base(source) {}
|
BreakStatement::BreakStatement(ProgramID program_id, const Source& source)
|
||||||
|
: Base(program_id, source) {}
|
||||||
|
|
||||||
BreakStatement::BreakStatement(BreakStatement&&) = default;
|
BreakStatement::BreakStatement(BreakStatement&&) = default;
|
||||||
|
|
||||||
|
|
|
@ -24,8 +24,9 @@ namespace ast {
|
||||||
class BreakStatement : public Castable<BreakStatement, Statement> {
|
class BreakStatement : public Castable<BreakStatement, Statement> {
|
||||||
public:
|
public:
|
||||||
/// Constructor
|
/// Constructor
|
||||||
|
/// @param program_id the identifier of the program that owns this node
|
||||||
/// @param source the break statement source
|
/// @param source the break statement source
|
||||||
explicit BreakStatement(const Source& source);
|
BreakStatement(ProgramID program_id, const Source& source);
|
||||||
/// Move constructor
|
/// Move constructor
|
||||||
BreakStatement(BreakStatement&&);
|
BreakStatement(BreakStatement&&);
|
||||||
~BreakStatement() override;
|
~BreakStatement() override;
|
||||||
|
|
|
@ -21,8 +21,10 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::BuiltinDecoration);
|
||||||
namespace tint {
|
namespace tint {
|
||||||
namespace ast {
|
namespace ast {
|
||||||
|
|
||||||
BuiltinDecoration::BuiltinDecoration(const Source& source, Builtin builtin)
|
BuiltinDecoration::BuiltinDecoration(ProgramID program_id,
|
||||||
: Base(source), builtin_(builtin) {}
|
const Source& source,
|
||||||
|
Builtin builtin)
|
||||||
|
: Base(program_id, source), builtin_(builtin) {}
|
||||||
|
|
||||||
BuiltinDecoration::~BuiltinDecoration() = default;
|
BuiltinDecoration::~BuiltinDecoration() = default;
|
||||||
|
|
||||||
|
|
|
@ -25,9 +25,12 @@ namespace ast {
|
||||||
class BuiltinDecoration : public Castable<BuiltinDecoration, Decoration> {
|
class BuiltinDecoration : public Castable<BuiltinDecoration, Decoration> {
|
||||||
public:
|
public:
|
||||||
/// constructor
|
/// constructor
|
||||||
|
/// @param program_id the identifier of the program that owns this node
|
||||||
/// @param source the source of this decoration
|
/// @param source the source of this decoration
|
||||||
/// @param builtin the builtin value
|
/// @param builtin the builtin value
|
||||||
BuiltinDecoration(const Source& source, Builtin builtin);
|
BuiltinDecoration(ProgramID program_id,
|
||||||
|
const Source& source,
|
||||||
|
Builtin builtin);
|
||||||
~BuiltinDecoration() override;
|
~BuiltinDecoration() override;
|
||||||
|
|
||||||
/// @returns the builtin value
|
/// @returns the builtin value
|
||||||
|
|
|
@ -21,10 +21,11 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::CallExpression);
|
||||||
namespace tint {
|
namespace tint {
|
||||||
namespace ast {
|
namespace ast {
|
||||||
|
|
||||||
CallExpression::CallExpression(const Source& source,
|
CallExpression::CallExpression(ProgramID program_id,
|
||||||
|
const Source& source,
|
||||||
Expression* func,
|
Expression* func,
|
||||||
ExpressionList params)
|
ExpressionList params)
|
||||||
: Base(source), func_(func), params_(params) {
|
: Base(program_id, source), func_(func), params_(params) {
|
||||||
TINT_ASSERT(func_);
|
TINT_ASSERT(func_);
|
||||||
for (auto* param : params_) {
|
for (auto* param : params_) {
|
||||||
TINT_ASSERT(param);
|
TINT_ASSERT(param);
|
||||||
|
|
|
@ -24,10 +24,14 @@ namespace ast {
|
||||||
class CallExpression : public Castable<CallExpression, Expression> {
|
class CallExpression : public Castable<CallExpression, Expression> {
|
||||||
public:
|
public:
|
||||||
/// Constructor
|
/// Constructor
|
||||||
|
/// @param program_id the identifier of the program that owns this node
|
||||||
/// @param source the call expression source
|
/// @param source the call expression source
|
||||||
/// @param func the function
|
/// @param func the function
|
||||||
/// @param params the parameters
|
/// @param params the parameters
|
||||||
CallExpression(const Source& source, Expression* func, ExpressionList params);
|
CallExpression(ProgramID program_id,
|
||||||
|
const Source& source,
|
||||||
|
Expression* func,
|
||||||
|
ExpressionList params);
|
||||||
/// Move constructor
|
/// Move constructor
|
||||||
CallExpression(CallExpression&&);
|
CallExpression(CallExpression&&);
|
||||||
~CallExpression() override;
|
~CallExpression() override;
|
||||||
|
|
|
@ -21,8 +21,10 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::CallStatement);
|
||||||
namespace tint {
|
namespace tint {
|
||||||
namespace ast {
|
namespace ast {
|
||||||
|
|
||||||
CallStatement::CallStatement(const Source& source, CallExpression* call)
|
CallStatement::CallStatement(ProgramID program_id,
|
||||||
: Base(source), call_(call) {
|
const Source& source,
|
||||||
|
CallExpression* call)
|
||||||
|
: Base(program_id, source), call_(call) {
|
||||||
TINT_ASSERT(call_);
|
TINT_ASSERT(call_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,9 +25,12 @@ namespace ast {
|
||||||
class CallStatement : public Castable<CallStatement, Statement> {
|
class CallStatement : public Castable<CallStatement, Statement> {
|
||||||
public:
|
public:
|
||||||
/// Constructor
|
/// Constructor
|
||||||
|
/// @param program_id the identifier of the program that owns this node
|
||||||
/// @param source the input source for the statement
|
/// @param source the input source for the statement
|
||||||
/// @param call the function
|
/// @param call the function
|
||||||
CallStatement(const Source& source, CallExpression* call);
|
CallStatement(ProgramID program_id,
|
||||||
|
const Source& source,
|
||||||
|
CallExpression* call);
|
||||||
/// Move constructor
|
/// Move constructor
|
||||||
CallStatement(CallStatement&&);
|
CallStatement(CallStatement&&);
|
||||||
~CallStatement() override;
|
~CallStatement() override;
|
||||||
|
|
|
@ -21,10 +21,11 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::CaseStatement);
|
||||||
namespace tint {
|
namespace tint {
|
||||||
namespace ast {
|
namespace ast {
|
||||||
|
|
||||||
CaseStatement::CaseStatement(const Source& source,
|
CaseStatement::CaseStatement(ProgramID program_id,
|
||||||
|
const Source& source,
|
||||||
CaseSelectorList selectors,
|
CaseSelectorList selectors,
|
||||||
BlockStatement* body)
|
BlockStatement* body)
|
||||||
: Base(source), selectors_(selectors), body_(body) {
|
: Base(program_id, source), selectors_(selectors), body_(body) {
|
||||||
TINT_ASSERT(body_);
|
TINT_ASSERT(body_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,10 +30,12 @@ using CaseSelectorList = std::vector<IntLiteral*>;
|
||||||
class CaseStatement : public Castable<CaseStatement, Statement> {
|
class CaseStatement : public Castable<CaseStatement, Statement> {
|
||||||
public:
|
public:
|
||||||
/// Constructor
|
/// Constructor
|
||||||
|
/// @param program_id the identifier of the program that owns this node
|
||||||
/// @param source the source information
|
/// @param source the source information
|
||||||
/// @param selectors the case selectors
|
/// @param selectors the case selectors
|
||||||
/// @param body the case body
|
/// @param body the case body
|
||||||
CaseStatement(const Source& source,
|
CaseStatement(ProgramID program_id,
|
||||||
|
const Source& source,
|
||||||
CaseSelectorList selectors,
|
CaseSelectorList selectors,
|
||||||
BlockStatement* body);
|
BlockStatement* body);
|
||||||
/// Move constructor
|
/// Move constructor
|
||||||
|
|
|
@ -21,8 +21,10 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::ConstantIdDecoration);
|
||||||
namespace tint {
|
namespace tint {
|
||||||
namespace ast {
|
namespace ast {
|
||||||
|
|
||||||
ConstantIdDecoration::ConstantIdDecoration(const Source& source, uint32_t val)
|
ConstantIdDecoration::ConstantIdDecoration(ProgramID program_id,
|
||||||
: Base(source), value_(val) {}
|
const Source& source,
|
||||||
|
uint32_t val)
|
||||||
|
: Base(program_id, source), value_(val) {}
|
||||||
|
|
||||||
ConstantIdDecoration::~ConstantIdDecoration() = default;
|
ConstantIdDecoration::~ConstantIdDecoration() = default;
|
||||||
|
|
||||||
|
|
|
@ -24,9 +24,12 @@ namespace ast {
|
||||||
class ConstantIdDecoration : public Castable<ConstantIdDecoration, Decoration> {
|
class ConstantIdDecoration : public Castable<ConstantIdDecoration, Decoration> {
|
||||||
public:
|
public:
|
||||||
/// constructor
|
/// constructor
|
||||||
|
/// @param program_id the identifier of the program that owns this node
|
||||||
/// @param source the source of this decoration
|
/// @param source the source of this decoration
|
||||||
/// @param val the constant_id value
|
/// @param val the constant_id value
|
||||||
ConstantIdDecoration(const Source& source, uint32_t val);
|
ConstantIdDecoration(ProgramID program_id,
|
||||||
|
const Source& source,
|
||||||
|
uint32_t val);
|
||||||
~ConstantIdDecoration() override;
|
~ConstantIdDecoration() override;
|
||||||
|
|
||||||
/// @returns the constant id value
|
/// @returns the constant id value
|
||||||
|
|
|
@ -23,8 +23,9 @@ ConstructorExpression::~ConstructorExpression() = default;
|
||||||
|
|
||||||
ConstructorExpression::ConstructorExpression(ConstructorExpression&&) = default;
|
ConstructorExpression::ConstructorExpression(ConstructorExpression&&) = default;
|
||||||
|
|
||||||
ConstructorExpression::ConstructorExpression(const Source& source)
|
ConstructorExpression::ConstructorExpression(ProgramID program_id,
|
||||||
: Base(source) {}
|
const Source& source)
|
||||||
|
: Base(program_id, source) {}
|
||||||
|
|
||||||
} // namespace ast
|
} // namespace ast
|
||||||
} // namespace tint
|
} // namespace tint
|
||||||
|
|
|
@ -28,8 +28,9 @@ class ConstructorExpression
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/// Constructor
|
/// Constructor
|
||||||
|
/// @param program_id the identifier of the program that owns this node
|
||||||
/// @param source the constructor source
|
/// @param source the constructor source
|
||||||
explicit ConstructorExpression(const Source& source);
|
ConstructorExpression(ProgramID program_id, const Source& source);
|
||||||
/// Move constructor
|
/// Move constructor
|
||||||
ConstructorExpression(ConstructorExpression&&);
|
ConstructorExpression(ConstructorExpression&&);
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,8 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::ContinueStatement);
|
||||||
namespace tint {
|
namespace tint {
|
||||||
namespace ast {
|
namespace ast {
|
||||||
|
|
||||||
ContinueStatement::ContinueStatement(const Source& source) : Base(source) {}
|
ContinueStatement::ContinueStatement(ProgramID program_id, const Source& source)
|
||||||
|
: Base(program_id, source) {}
|
||||||
|
|
||||||
ContinueStatement::ContinueStatement(ContinueStatement&&) = default;
|
ContinueStatement::ContinueStatement(ContinueStatement&&) = default;
|
||||||
|
|
||||||
|
|
|
@ -24,8 +24,9 @@ namespace ast {
|
||||||
class ContinueStatement : public Castable<ContinueStatement, Statement> {
|
class ContinueStatement : public Castable<ContinueStatement, Statement> {
|
||||||
public:
|
public:
|
||||||
/// Constructor
|
/// Constructor
|
||||||
|
/// @param program_id the identifier of the program that owns this node
|
||||||
/// @param source the continue statement source
|
/// @param source the continue statement source
|
||||||
explicit ContinueStatement(const Source& source);
|
ContinueStatement(ProgramID program_id, const Source& source);
|
||||||
/// Move constructor
|
/// Move constructor
|
||||||
ContinueStatement(ContinueStatement&&);
|
ContinueStatement(ContinueStatement&&);
|
||||||
~ContinueStatement() override;
|
~ContinueStatement() override;
|
||||||
|
|
|
@ -29,8 +29,10 @@ class Decoration : public Castable<Decoration, Node> {
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/// Constructor
|
/// Constructor
|
||||||
|
/// @param program_id the identifier of the program that owns this node
|
||||||
/// @param source the source of this decoration
|
/// @param source the source of this decoration
|
||||||
explicit Decoration(const Source& source) : Base(source) {}
|
Decoration(ProgramID program_id, const Source& source)
|
||||||
|
: Base(program_id, source) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
/// A list of decorations
|
/// A list of decorations
|
||||||
|
|
|
@ -21,7 +21,8 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::DiscardStatement);
|
||||||
namespace tint {
|
namespace tint {
|
||||||
namespace ast {
|
namespace ast {
|
||||||
|
|
||||||
DiscardStatement::DiscardStatement(const Source& source) : Base(source) {}
|
DiscardStatement::DiscardStatement(ProgramID program_id, const Source& source)
|
||||||
|
: Base(program_id, source) {}
|
||||||
|
|
||||||
DiscardStatement::DiscardStatement(DiscardStatement&&) = default;
|
DiscardStatement::DiscardStatement(DiscardStatement&&) = default;
|
||||||
|
|
||||||
|
|
|
@ -24,8 +24,9 @@ namespace ast {
|
||||||
class DiscardStatement : public Castable<DiscardStatement, Statement> {
|
class DiscardStatement : public Castable<DiscardStatement, Statement> {
|
||||||
public:
|
public:
|
||||||
/// Constructor
|
/// Constructor
|
||||||
|
/// @param program_id the identifier of the program that owns this node
|
||||||
/// @param source the discard statement source
|
/// @param source the discard statement source
|
||||||
explicit DiscardStatement(const Source& source);
|
DiscardStatement(ProgramID program_id, const Source& source);
|
||||||
/// Move constructor
|
/// Move constructor
|
||||||
DiscardStatement(DiscardStatement&&);
|
DiscardStatement(DiscardStatement&&);
|
||||||
~DiscardStatement() override;
|
~DiscardStatement() override;
|
||||||
|
|
|
@ -21,10 +21,11 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::ElseStatement);
|
||||||
namespace tint {
|
namespace tint {
|
||||||
namespace ast {
|
namespace ast {
|
||||||
|
|
||||||
ElseStatement::ElseStatement(const Source& source,
|
ElseStatement::ElseStatement(ProgramID program_id,
|
||||||
|
const Source& source,
|
||||||
Expression* condition,
|
Expression* condition,
|
||||||
BlockStatement* body)
|
BlockStatement* body)
|
||||||
: Base(source), condition_(condition), body_(body) {
|
: Base(program_id, source), condition_(condition), body_(body) {
|
||||||
TINT_ASSERT(body_);
|
TINT_ASSERT(body_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,10 +27,12 @@ namespace ast {
|
||||||
class ElseStatement : public Castable<ElseStatement, Statement> {
|
class ElseStatement : public Castable<ElseStatement, Statement> {
|
||||||
public:
|
public:
|
||||||
/// Constructor
|
/// Constructor
|
||||||
|
/// @param program_id the identifier of the program that owns this node
|
||||||
/// @param source the source information
|
/// @param source the source information
|
||||||
/// @param condition the else condition
|
/// @param condition the else condition
|
||||||
/// @param body the else body
|
/// @param body the else body
|
||||||
ElseStatement(const Source& source,
|
ElseStatement(ProgramID program_id,
|
||||||
|
const Source& source,
|
||||||
Expression* condition,
|
Expression* condition,
|
||||||
BlockStatement* body);
|
BlockStatement* body);
|
||||||
/// Move constructor
|
/// Move constructor
|
||||||
|
|
|
@ -22,7 +22,8 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::Expression);
|
||||||
namespace tint {
|
namespace tint {
|
||||||
namespace ast {
|
namespace ast {
|
||||||
|
|
||||||
Expression::Expression(const Source& source) : Base(source) {}
|
Expression::Expression(ProgramID program_id, const Source& source)
|
||||||
|
: Base(program_id, source) {}
|
||||||
|
|
||||||
Expression::Expression(Expression&&) = default;
|
Expression::Expression(Expression&&) = default;
|
||||||
|
|
||||||
|
|
|
@ -31,8 +31,9 @@ class Expression : public Castable<Expression, Node> {
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/// Constructor
|
/// Constructor
|
||||||
|
/// @param program_id the identifier of the program that owns this node
|
||||||
/// @param source the source of the expression
|
/// @param source the source of the expression
|
||||||
explicit Expression(const Source& source);
|
Expression(ProgramID program_id, const Source& source);
|
||||||
/// Move constructor
|
/// Move constructor
|
||||||
Expression(Expression&&);
|
Expression(Expression&&);
|
||||||
|
|
||||||
|
|
|
@ -21,8 +21,9 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::FallthroughStatement);
|
||||||
namespace tint {
|
namespace tint {
|
||||||
namespace ast {
|
namespace ast {
|
||||||
|
|
||||||
FallthroughStatement::FallthroughStatement(const Source& source)
|
FallthroughStatement::FallthroughStatement(ProgramID program_id,
|
||||||
: Base(source) {}
|
const Source& source)
|
||||||
|
: Base(program_id, source) {}
|
||||||
|
|
||||||
FallthroughStatement::FallthroughStatement(FallthroughStatement&&) = default;
|
FallthroughStatement::FallthroughStatement(FallthroughStatement&&) = default;
|
||||||
|
|
||||||
|
|
|
@ -24,8 +24,9 @@ namespace ast {
|
||||||
class FallthroughStatement : public Castable<FallthroughStatement, Statement> {
|
class FallthroughStatement : public Castable<FallthroughStatement, Statement> {
|
||||||
public:
|
public:
|
||||||
/// Constructor
|
/// Constructor
|
||||||
|
/// @param program_id the identifier of the program that owns this node
|
||||||
/// @param source the source information
|
/// @param source the source information
|
||||||
explicit FallthroughStatement(const Source& source);
|
FallthroughStatement(ProgramID program_id, const Source& source);
|
||||||
/// Move constructor
|
/// Move constructor
|
||||||
FallthroughStatement(FallthroughStatement&&);
|
FallthroughStatement(FallthroughStatement&&);
|
||||||
~FallthroughStatement() override;
|
~FallthroughStatement() override;
|
||||||
|
|
|
@ -23,8 +23,11 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::FloatLiteral);
|
||||||
namespace tint {
|
namespace tint {
|
||||||
namespace ast {
|
namespace ast {
|
||||||
|
|
||||||
FloatLiteral::FloatLiteral(const Source& source, type::Type* type, float value)
|
FloatLiteral::FloatLiteral(ProgramID program_id,
|
||||||
: Base(source, type), value_(value) {}
|
const Source& source,
|
||||||
|
type::Type* type,
|
||||||
|
float value)
|
||||||
|
: Base(program_id, source, type), value_(value) {}
|
||||||
|
|
||||||
FloatLiteral::~FloatLiteral() = default;
|
FloatLiteral::~FloatLiteral() = default;
|
||||||
|
|
||||||
|
|
|
@ -26,10 +26,14 @@ namespace ast {
|
||||||
class FloatLiteral : public Castable<FloatLiteral, Literal> {
|
class FloatLiteral : public Castable<FloatLiteral, Literal> {
|
||||||
public:
|
public:
|
||||||
/// Constructor
|
/// Constructor
|
||||||
|
/// @param program_id the identifier of the program that owns this node
|
||||||
/// @param source the input source
|
/// @param source the input source
|
||||||
/// @param type the type of the literal
|
/// @param type the type of the literal
|
||||||
/// @param value the float literals value
|
/// @param value the float literals value
|
||||||
FloatLiteral(const Source& source, type::Type* type, float value);
|
FloatLiteral(ProgramID program_id,
|
||||||
|
const Source& source,
|
||||||
|
type::Type* type,
|
||||||
|
float value);
|
||||||
~FloatLiteral() override;
|
~FloatLiteral() override;
|
||||||
|
|
||||||
/// @returns the float literal value
|
/// @returns the float literal value
|
||||||
|
|
|
@ -23,14 +23,15 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::Function);
|
||||||
namespace tint {
|
namespace tint {
|
||||||
namespace ast {
|
namespace ast {
|
||||||
|
|
||||||
Function::Function(const Source& source,
|
Function::Function(ProgramID program_id,
|
||||||
|
const Source& source,
|
||||||
Symbol symbol,
|
Symbol symbol,
|
||||||
VariableList params,
|
VariableList params,
|
||||||
type::Type* return_type,
|
type::Type* return_type,
|
||||||
BlockStatement* body,
|
BlockStatement* body,
|
||||||
DecorationList decorations,
|
DecorationList decorations,
|
||||||
DecorationList return_type_decorations)
|
DecorationList return_type_decorations)
|
||||||
: Base(source),
|
: Base(program_id, source),
|
||||||
symbol_(symbol),
|
symbol_(symbol),
|
||||||
params_(std::move(params)),
|
params_(std::move(params)),
|
||||||
return_type_(return_type),
|
return_type_(return_type),
|
||||||
|
|
|
@ -36,6 +36,7 @@ namespace ast {
|
||||||
class Function : public Castable<Function, Node> {
|
class Function : public Castable<Function, Node> {
|
||||||
public:
|
public:
|
||||||
/// Create a function
|
/// Create a function
|
||||||
|
/// @param program_id the identifier of the program that owns this node
|
||||||
/// @param source the variable source
|
/// @param source the variable source
|
||||||
/// @param symbol the function symbol
|
/// @param symbol the function symbol
|
||||||
/// @param params the function parameters
|
/// @param params the function parameters
|
||||||
|
@ -43,7 +44,8 @@ class Function : public Castable<Function, Node> {
|
||||||
/// @param body the function body
|
/// @param body the function body
|
||||||
/// @param decorations the function decorations
|
/// @param decorations the function decorations
|
||||||
/// @param return_type_decorations the return type decorations
|
/// @param return_type_decorations the return type decorations
|
||||||
Function(const Source& source,
|
Function(ProgramID program_id,
|
||||||
|
const Source& source,
|
||||||
Symbol symbol,
|
Symbol symbol,
|
||||||
VariableList params,
|
VariableList params,
|
||||||
type::Type* return_type,
|
type::Type* return_type,
|
||||||
|
|
|
@ -21,8 +21,10 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::GroupDecoration);
|
||||||
namespace tint {
|
namespace tint {
|
||||||
namespace ast {
|
namespace ast {
|
||||||
|
|
||||||
GroupDecoration::GroupDecoration(const Source& source, uint32_t val)
|
GroupDecoration::GroupDecoration(ProgramID program_id,
|
||||||
: Base(source), value_(val) {}
|
const Source& source,
|
||||||
|
uint32_t val)
|
||||||
|
: Base(program_id, source), value_(val) {}
|
||||||
|
|
||||||
GroupDecoration::~GroupDecoration() = default;
|
GroupDecoration::~GroupDecoration() = default;
|
||||||
|
|
||||||
|
|
|
@ -24,9 +24,10 @@ namespace ast {
|
||||||
class GroupDecoration : public Castable<GroupDecoration, Decoration> {
|
class GroupDecoration : public Castable<GroupDecoration, Decoration> {
|
||||||
public:
|
public:
|
||||||
/// constructor
|
/// constructor
|
||||||
|
/// @param program_id the identifier of the program that owns this node
|
||||||
/// @param value the group value
|
/// @param value the group value
|
||||||
/// @param source the source of this decoration
|
/// @param source the source of this decoration
|
||||||
GroupDecoration(const Source& source, uint32_t value);
|
GroupDecoration(ProgramID program_id, const Source& source, uint32_t value);
|
||||||
~GroupDecoration() override;
|
~GroupDecoration() override;
|
||||||
|
|
||||||
/// @returns the group value
|
/// @returns the group value
|
||||||
|
|
|
@ -21,8 +21,10 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::IdentifierExpression);
|
||||||
namespace tint {
|
namespace tint {
|
||||||
namespace ast {
|
namespace ast {
|
||||||
|
|
||||||
IdentifierExpression::IdentifierExpression(const Source& source, Symbol sym)
|
IdentifierExpression::IdentifierExpression(ProgramID program_id,
|
||||||
: Base(source), sym_(sym) {
|
const Source& source,
|
||||||
|
Symbol sym)
|
||||||
|
: Base(program_id, source), sym_(sym) {
|
||||||
TINT_ASSERT(sym_.IsValid());
|
TINT_ASSERT(sym_.IsValid());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,9 +25,10 @@ namespace ast {
|
||||||
class IdentifierExpression : public Castable<IdentifierExpression, Expression> {
|
class IdentifierExpression : public Castable<IdentifierExpression, Expression> {
|
||||||
public:
|
public:
|
||||||
/// Constructor
|
/// Constructor
|
||||||
|
/// @param program_id the identifier of the program that owns this node
|
||||||
/// @param source the source
|
/// @param source the source
|
||||||
/// @param sym the symbol for the identifier
|
/// @param sym the symbol for the identifier
|
||||||
IdentifierExpression(const Source& source, Symbol sym);
|
IdentifierExpression(ProgramID program_id, const Source& source, Symbol sym);
|
||||||
/// Move constructor
|
/// Move constructor
|
||||||
IdentifierExpression(IdentifierExpression&&);
|
IdentifierExpression(IdentifierExpression&&);
|
||||||
~IdentifierExpression() override;
|
~IdentifierExpression() override;
|
||||||
|
|
|
@ -21,11 +21,12 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::IfStatement);
|
||||||
namespace tint {
|
namespace tint {
|
||||||
namespace ast {
|
namespace ast {
|
||||||
|
|
||||||
IfStatement::IfStatement(const Source& source,
|
IfStatement::IfStatement(ProgramID program_id,
|
||||||
|
const Source& source,
|
||||||
Expression* condition,
|
Expression* condition,
|
||||||
BlockStatement* body,
|
BlockStatement* body,
|
||||||
ElseStatementList else_stmts)
|
ElseStatementList else_stmts)
|
||||||
: Base(source),
|
: Base(program_id, source),
|
||||||
condition_(condition),
|
condition_(condition),
|
||||||
body_(body),
|
body_(body),
|
||||||
else_statements_(std::move(else_stmts)) {
|
else_statements_(std::move(else_stmts)) {
|
||||||
|
|
|
@ -26,11 +26,13 @@ namespace ast {
|
||||||
class IfStatement : public Castable<IfStatement, Statement> {
|
class IfStatement : public Castable<IfStatement, Statement> {
|
||||||
public:
|
public:
|
||||||
/// Constructor
|
/// Constructor
|
||||||
|
/// @param program_id the identifier of the program that owns this node
|
||||||
/// @param source the source information
|
/// @param source the source information
|
||||||
/// @param condition the if condition
|
/// @param condition the if condition
|
||||||
/// @param body the if body
|
/// @param body the if body
|
||||||
/// @param else_stmts the else statements
|
/// @param else_stmts the else statements
|
||||||
IfStatement(const Source& source,
|
IfStatement(ProgramID program_id,
|
||||||
|
const Source& source,
|
||||||
Expression* condition,
|
Expression* condition,
|
||||||
BlockStatement* body,
|
BlockStatement* body,
|
||||||
ElseStatementList else_stmts);
|
ElseStatementList else_stmts);
|
||||||
|
|
|
@ -19,8 +19,11 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::IntLiteral);
|
||||||
namespace tint {
|
namespace tint {
|
||||||
namespace ast {
|
namespace ast {
|
||||||
|
|
||||||
IntLiteral::IntLiteral(const Source& source, type::Type* type, uint32_t value)
|
IntLiteral::IntLiteral(ProgramID program_id,
|
||||||
: Base(source, type), value_(value) {}
|
const Source& source,
|
||||||
|
type::Type* type,
|
||||||
|
uint32_t value)
|
||||||
|
: Base(program_id, source, type), value_(value) {}
|
||||||
|
|
||||||
IntLiteral::~IntLiteral() = default;
|
IntLiteral::~IntLiteral() = default;
|
||||||
|
|
||||||
|
|
|
@ -30,10 +30,14 @@ class IntLiteral : public Castable<IntLiteral, Literal> {
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/// Constructor
|
/// Constructor
|
||||||
|
/// @param program_id the identifier of the program that owns this node
|
||||||
/// @param source the input source
|
/// @param source the input source
|
||||||
/// @param type the type of the literal
|
/// @param type the type of the literal
|
||||||
/// @param value value of the literal
|
/// @param value value of the literal
|
||||||
IntLiteral(const Source& source, type::Type* type, uint32_t value);
|
IntLiteral(ProgramID program_id,
|
||||||
|
const Source& source,
|
||||||
|
type::Type* type,
|
||||||
|
uint32_t value);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint32_t const value_;
|
uint32_t const value_;
|
||||||
|
|
|
@ -19,7 +19,8 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::InternalDecoration);
|
||||||
namespace tint {
|
namespace tint {
|
||||||
namespace ast {
|
namespace ast {
|
||||||
|
|
||||||
InternalDecoration::InternalDecoration() : Base(Source{}) {}
|
InternalDecoration::InternalDecoration(ProgramID program_id)
|
||||||
|
: Base(program_id, Source{}) {}
|
||||||
|
|
||||||
InternalDecoration::~InternalDecoration() = default;
|
InternalDecoration::~InternalDecoration() = default;
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,8 @@ namespace ast {
|
||||||
class InternalDecoration : public Castable<InternalDecoration, Decoration> {
|
class InternalDecoration : public Castable<InternalDecoration, Decoration> {
|
||||||
public:
|
public:
|
||||||
/// Constructor
|
/// Constructor
|
||||||
InternalDecoration();
|
/// @param program_id the identifier of the program that owns this node
|
||||||
|
explicit InternalDecoration(ProgramID program_id);
|
||||||
|
|
||||||
/// Destructor
|
/// Destructor
|
||||||
~InternalDecoration() override;
|
~InternalDecoration() override;
|
||||||
|
|
|
@ -19,8 +19,8 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::Literal);
|
||||||
namespace tint {
|
namespace tint {
|
||||||
namespace ast {
|
namespace ast {
|
||||||
|
|
||||||
Literal::Literal(const Source& source, type::Type* type)
|
Literal::Literal(ProgramID program_id, const Source& source, type::Type* type)
|
||||||
: Base(source), type_(type) {}
|
: Base(program_id, source), type_(type) {}
|
||||||
|
|
||||||
Literal::~Literal() = default;
|
Literal::~Literal() = default;
|
||||||
|
|
||||||
|
|
|
@ -47,9 +47,12 @@ class Literal : public Castable<Literal, Node> {
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/// Constructor
|
/// Constructor
|
||||||
|
/// @param program_id the identifier of the program that owns this node
|
||||||
/// @param source the input source
|
/// @param source the input source
|
||||||
/// @param type the type of the literal
|
/// @param type the type of the literal
|
||||||
explicit Literal(const Source& source, type::Type* type);
|
explicit Literal(ProgramID program_id,
|
||||||
|
const Source& source,
|
||||||
|
type::Type* type);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
type::Type* const type_;
|
type::Type* const type_;
|
||||||
|
|
|
@ -21,8 +21,10 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::LocationDecoration);
|
||||||
namespace tint {
|
namespace tint {
|
||||||
namespace ast {
|
namespace ast {
|
||||||
|
|
||||||
LocationDecoration::LocationDecoration(const Source& source, uint32_t val)
|
LocationDecoration::LocationDecoration(ProgramID program_id,
|
||||||
: Base(source), value_(val) {}
|
const Source& source,
|
||||||
|
uint32_t val)
|
||||||
|
: Base(program_id, source), value_(val) {}
|
||||||
|
|
||||||
LocationDecoration::~LocationDecoration() = default;
|
LocationDecoration::~LocationDecoration() = default;
|
||||||
|
|
||||||
|
|
|
@ -24,9 +24,12 @@ namespace ast {
|
||||||
class LocationDecoration : public Castable<LocationDecoration, Decoration> {
|
class LocationDecoration : public Castable<LocationDecoration, Decoration> {
|
||||||
public:
|
public:
|
||||||
/// constructor
|
/// constructor
|
||||||
|
/// @param program_id the identifier of the program that owns this node
|
||||||
/// @param source the source of this decoration
|
/// @param source the source of this decoration
|
||||||
/// @param value the location value
|
/// @param value the location value
|
||||||
LocationDecoration(const Source& source, uint32_t value);
|
LocationDecoration(ProgramID program_id,
|
||||||
|
const Source& source,
|
||||||
|
uint32_t value);
|
||||||
~LocationDecoration() override;
|
~LocationDecoration() override;
|
||||||
|
|
||||||
/// @returns the location value
|
/// @returns the location value
|
||||||
|
|
|
@ -21,10 +21,11 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::LoopStatement);
|
||||||
namespace tint {
|
namespace tint {
|
||||||
namespace ast {
|
namespace ast {
|
||||||
|
|
||||||
LoopStatement::LoopStatement(const Source& source,
|
LoopStatement::LoopStatement(ProgramID program_id,
|
||||||
|
const Source& source,
|
||||||
BlockStatement* body,
|
BlockStatement* body,
|
||||||
BlockStatement* continuing)
|
BlockStatement* continuing)
|
||||||
: Base(source), body_(body), continuing_(continuing) {
|
: Base(program_id, source), body_(body), continuing_(continuing) {
|
||||||
TINT_ASSERT(body_);
|
TINT_ASSERT(body_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,10 +24,12 @@ namespace ast {
|
||||||
class LoopStatement : public Castable<LoopStatement, Statement> {
|
class LoopStatement : public Castable<LoopStatement, Statement> {
|
||||||
public:
|
public:
|
||||||
/// Constructor
|
/// Constructor
|
||||||
|
/// @param program_id the identifier of the program that owns this node
|
||||||
/// @param source the loop statement source
|
/// @param source the loop statement source
|
||||||
/// @param body the body statements
|
/// @param body the body statements
|
||||||
/// @param continuing the continuing statements
|
/// @param continuing the continuing statements
|
||||||
LoopStatement(const Source& source,
|
LoopStatement(ProgramID program_id,
|
||||||
|
const Source& source,
|
||||||
BlockStatement* body,
|
BlockStatement* body,
|
||||||
BlockStatement* continuing);
|
BlockStatement* continuing);
|
||||||
/// Move constructor
|
/// Move constructor
|
||||||
|
|
|
@ -21,10 +21,11 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::MemberAccessorExpression);
|
||||||
namespace tint {
|
namespace tint {
|
||||||
namespace ast {
|
namespace ast {
|
||||||
|
|
||||||
MemberAccessorExpression::MemberAccessorExpression(const Source& source,
|
MemberAccessorExpression::MemberAccessorExpression(ProgramID program_id,
|
||||||
|
const Source& source,
|
||||||
Expression* structure,
|
Expression* structure,
|
||||||
IdentifierExpression* member)
|
IdentifierExpression* member)
|
||||||
: Base(source), struct_(structure), member_(member) {
|
: Base(program_id, source), struct_(structure), member_(member) {
|
||||||
TINT_ASSERT(structure);
|
TINT_ASSERT(structure);
|
||||||
TINT_ASSERT(member);
|
TINT_ASSERT(member);
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,10 +25,12 @@ class MemberAccessorExpression
|
||||||
: public Castable<MemberAccessorExpression, Expression> {
|
: public Castable<MemberAccessorExpression, Expression> {
|
||||||
public:
|
public:
|
||||||
/// Constructor
|
/// Constructor
|
||||||
|
/// @param program_id the identifier of the program that owns this node
|
||||||
/// @param source the member accessor expression source
|
/// @param source the member accessor expression source
|
||||||
/// @param structure the structure
|
/// @param structure the structure
|
||||||
/// @param member the member
|
/// @param member the member
|
||||||
MemberAccessorExpression(const Source& source,
|
MemberAccessorExpression(ProgramID program_id,
|
||||||
|
const Source& source,
|
||||||
Expression* structure,
|
Expression* structure,
|
||||||
IdentifierExpression* member);
|
IdentifierExpression* member);
|
||||||
/// Move constructor
|
/// Move constructor
|
||||||
|
|
|
@ -23,10 +23,13 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::Module);
|
||||||
namespace tint {
|
namespace tint {
|
||||||
namespace ast {
|
namespace ast {
|
||||||
|
|
||||||
Module::Module(const Source& source) : Base(source) {}
|
Module::Module(ProgramID program_id, const Source& source)
|
||||||
|
: Base(program_id, source) {}
|
||||||
|
|
||||||
Module::Module(const Source& source, std::vector<Cloneable*> global_decls)
|
Module::Module(ProgramID program_id,
|
||||||
: Base(source), global_declarations_(std::move(global_decls)) {
|
const Source& source,
|
||||||
|
std::vector<Cloneable*> global_decls)
|
||||||
|
: Base(program_id, source), global_declarations_(std::move(global_decls)) {
|
||||||
for (auto* decl : global_declarations_) {
|
for (auto* decl : global_declarations_) {
|
||||||
if (decl == nullptr) {
|
if (decl == nullptr) {
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -28,14 +28,18 @@ namespace ast {
|
||||||
class Module : public Castable<Module, Node> {
|
class Module : public Castable<Module, Node> {
|
||||||
public:
|
public:
|
||||||
/// Constructor
|
/// Constructor
|
||||||
|
/// @param program_id the identifier of the program that owns this node
|
||||||
/// @param source the source of the module
|
/// @param source the source of the module
|
||||||
explicit Module(const Source& source);
|
Module(ProgramID program_id, const Source& source);
|
||||||
|
|
||||||
/// Constructor
|
/// Constructor
|
||||||
|
/// @param program_id the identifier of the program that owns this node
|
||||||
/// @param source the source of the module
|
/// @param source the source of the module
|
||||||
/// @param global_decls the list of global types, functions, and variables, in
|
/// @param global_decls the list of global types, functions, and variables, in
|
||||||
/// the order they were declared in the source program
|
/// the order they were declared in the source program
|
||||||
Module(const Source& source, std::vector<Cloneable*> global_decls);
|
Module(ProgramID program_id,
|
||||||
|
const Source& source,
|
||||||
|
std::vector<Cloneable*> global_decls);
|
||||||
|
|
||||||
/// Destructor
|
/// Destructor
|
||||||
~Module() override;
|
~Module() override;
|
||||||
|
|
|
@ -19,7 +19,8 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::Node);
|
||||||
namespace tint {
|
namespace tint {
|
||||||
namespace ast {
|
namespace ast {
|
||||||
|
|
||||||
Node::Node(const Source& source) : source_(source) {}
|
Node::Node(ProgramID program_id, const Source& source)
|
||||||
|
: program_id_(program_id), source_(source) {}
|
||||||
|
|
||||||
Node::Node(Node&&) = default;
|
Node::Node(Node&&) = default;
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "src/clone_context.h"
|
#include "src/clone_context.h"
|
||||||
|
#include "src/program_id.h"
|
||||||
|
|
||||||
namespace tint {
|
namespace tint {
|
||||||
|
|
||||||
|
@ -37,6 +38,9 @@ class Node : public Castable<Node, Cloneable> {
|
||||||
public:
|
public:
|
||||||
~Node() override;
|
~Node() override;
|
||||||
|
|
||||||
|
/// @returns the identifier of the program that owns this node
|
||||||
|
ProgramID program_id() const { return program_id_; }
|
||||||
|
|
||||||
/// @returns the node source data
|
/// @returns the node source data
|
||||||
const Source& source() const { return source_; }
|
const Source& source() const { return source_; }
|
||||||
|
|
||||||
|
@ -55,8 +59,9 @@ class Node : public Castable<Node, Cloneable> {
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/// Create a new node
|
/// Create a new node
|
||||||
|
/// @param program_id the identifier of the program that owns this node
|
||||||
/// @param source the input source for the node
|
/// @param source the input source for the node
|
||||||
explicit Node(const Source& source);
|
Node(ProgramID program_id, const Source& source);
|
||||||
/// Move constructor
|
/// Move constructor
|
||||||
Node(Node&&);
|
Node(Node&&);
|
||||||
|
|
||||||
|
@ -68,6 +73,7 @@ class Node : public Castable<Node, Cloneable> {
|
||||||
private:
|
private:
|
||||||
Node(const Node&) = delete;
|
Node(const Node&) = delete;
|
||||||
|
|
||||||
|
ProgramID const program_id_;
|
||||||
Source const source_;
|
Source const source_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -21,11 +21,13 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::ReturnStatement);
|
||||||
namespace tint {
|
namespace tint {
|
||||||
namespace ast {
|
namespace ast {
|
||||||
|
|
||||||
ReturnStatement::ReturnStatement(const Source& source)
|
ReturnStatement::ReturnStatement(ProgramID program_id, const Source& source)
|
||||||
: Base(source), value_(nullptr) {}
|
: Base(program_id, source), value_(nullptr) {}
|
||||||
|
|
||||||
ReturnStatement::ReturnStatement(const Source& source, Expression* value)
|
ReturnStatement::ReturnStatement(ProgramID program_id,
|
||||||
: Base(source), value_(value) {}
|
const Source& source,
|
||||||
|
Expression* value)
|
||||||
|
: Base(program_id, source), value_(value) {}
|
||||||
|
|
||||||
ReturnStatement::ReturnStatement(ReturnStatement&&) = default;
|
ReturnStatement::ReturnStatement(ReturnStatement&&) = default;
|
||||||
|
|
||||||
|
|
|
@ -25,12 +25,17 @@ namespace ast {
|
||||||
class ReturnStatement : public Castable<ReturnStatement, Statement> {
|
class ReturnStatement : public Castable<ReturnStatement, Statement> {
|
||||||
public:
|
public:
|
||||||
/// Constructor
|
/// Constructor
|
||||||
|
/// @param program_id the identifier of the program that owns this node
|
||||||
/// @param source the source information
|
/// @param source the source information
|
||||||
explicit ReturnStatement(const Source& source);
|
ReturnStatement(ProgramID program_id, const Source& source);
|
||||||
|
|
||||||
/// Constructor
|
/// Constructor
|
||||||
|
/// @param program_id the identifier of the program that owns this node
|
||||||
/// @param source the return statement source
|
/// @param source the return statement source
|
||||||
/// @param value the return value
|
/// @param value the return value
|
||||||
ReturnStatement(const Source& source, Expression* value);
|
ReturnStatement(ProgramID program_id,
|
||||||
|
const Source& source,
|
||||||
|
Expression* value);
|
||||||
/// Move constructor
|
/// Move constructor
|
||||||
ReturnStatement(ReturnStatement&&);
|
ReturnStatement(ReturnStatement&&);
|
||||||
~ReturnStatement() override;
|
~ReturnStatement() override;
|
||||||
|
|
|
@ -21,9 +21,10 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::ScalarConstructorExpression);
|
||||||
namespace tint {
|
namespace tint {
|
||||||
namespace ast {
|
namespace ast {
|
||||||
|
|
||||||
ScalarConstructorExpression::ScalarConstructorExpression(const Source& source,
|
ScalarConstructorExpression::ScalarConstructorExpression(ProgramID program_id,
|
||||||
|
const Source& source,
|
||||||
Literal* literal)
|
Literal* literal)
|
||||||
: Base(source), literal_(literal) {
|
: Base(program_id, source), literal_(literal) {
|
||||||
TINT_ASSERT(literal);
|
TINT_ASSERT(literal);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,9 +26,12 @@ class ScalarConstructorExpression
|
||||||
: public Castable<ScalarConstructorExpression, ConstructorExpression> {
|
: public Castable<ScalarConstructorExpression, ConstructorExpression> {
|
||||||
public:
|
public:
|
||||||
/// Constructor
|
/// Constructor
|
||||||
|
/// @param program_id the identifier of the program that owns this node
|
||||||
/// @param source the constructor source
|
/// @param source the constructor source
|
||||||
/// @param literal the const literal
|
/// @param literal the const literal
|
||||||
ScalarConstructorExpression(const Source& source, Literal* literal);
|
ScalarConstructorExpression(ProgramID program_id,
|
||||||
|
const Source& source,
|
||||||
|
Literal* literal);
|
||||||
/// Move constructor
|
/// Move constructor
|
||||||
ScalarConstructorExpression(ScalarConstructorExpression&&);
|
ScalarConstructorExpression(ScalarConstructorExpression&&);
|
||||||
~ScalarConstructorExpression() override;
|
~ScalarConstructorExpression() override;
|
||||||
|
|
|
@ -21,8 +21,11 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::SintLiteral);
|
||||||
namespace tint {
|
namespace tint {
|
||||||
namespace ast {
|
namespace ast {
|
||||||
|
|
||||||
SintLiteral::SintLiteral(const Source& source, type::Type* type, int32_t value)
|
SintLiteral::SintLiteral(ProgramID program_id,
|
||||||
: Base(source, type, static_cast<uint32_t>(value)) {}
|
const Source& source,
|
||||||
|
type::Type* type,
|
||||||
|
int32_t value)
|
||||||
|
: Base(program_id, source, type, static_cast<uint32_t>(value)) {}
|
||||||
|
|
||||||
SintLiteral::~SintLiteral() = default;
|
SintLiteral::~SintLiteral() = default;
|
||||||
|
|
||||||
|
|
|
@ -26,10 +26,14 @@ namespace ast {
|
||||||
class SintLiteral : public Castable<SintLiteral, IntLiteral> {
|
class SintLiteral : public Castable<SintLiteral, IntLiteral> {
|
||||||
public:
|
public:
|
||||||
/// Constructor
|
/// Constructor
|
||||||
|
/// @param program_id the identifier of the program that owns this node
|
||||||
/// @param source the input source
|
/// @param source the input source
|
||||||
/// @param type the type
|
/// @param type the type
|
||||||
/// @param value the signed int literals value
|
/// @param value the signed int literals value
|
||||||
SintLiteral(const Source& source, type::Type* type, int32_t value);
|
SintLiteral(ProgramID program_id,
|
||||||
|
const Source& source,
|
||||||
|
type::Type* type,
|
||||||
|
int32_t value);
|
||||||
~SintLiteral() override;
|
~SintLiteral() override;
|
||||||
|
|
||||||
/// @returns the int literal value
|
/// @returns the int literal value
|
||||||
|
|
|
@ -21,8 +21,10 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::StageDecoration);
|
||||||
namespace tint {
|
namespace tint {
|
||||||
namespace ast {
|
namespace ast {
|
||||||
|
|
||||||
StageDecoration::StageDecoration(const Source& source, PipelineStage stage)
|
StageDecoration::StageDecoration(ProgramID program_id,
|
||||||
: Base(source), stage_(stage) {}
|
const Source& source,
|
||||||
|
PipelineStage stage)
|
||||||
|
: Base(program_id, source), stage_(stage) {}
|
||||||
|
|
||||||
StageDecoration::~StageDecoration() = default;
|
StageDecoration::~StageDecoration() = default;
|
||||||
|
|
||||||
|
|
|
@ -25,9 +25,12 @@ namespace ast {
|
||||||
class StageDecoration : public Castable<StageDecoration, Decoration> {
|
class StageDecoration : public Castable<StageDecoration, Decoration> {
|
||||||
public:
|
public:
|
||||||
/// constructor
|
/// constructor
|
||||||
|
/// @param program_id the identifier of the program that owns this node
|
||||||
/// @param stage the pipeline stage
|
/// @param stage the pipeline stage
|
||||||
/// @param source the source of this decoration
|
/// @param source the source of this decoration
|
||||||
StageDecoration(const Source& source, PipelineStage stage);
|
StageDecoration(ProgramID program_id,
|
||||||
|
const Source& source,
|
||||||
|
PipelineStage stage);
|
||||||
~StageDecoration() override;
|
~StageDecoration() override;
|
||||||
|
|
||||||
/// @returns the stage
|
/// @returns the stage
|
||||||
|
|
|
@ -31,7 +31,8 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::Statement);
|
||||||
namespace tint {
|
namespace tint {
|
||||||
namespace ast {
|
namespace ast {
|
||||||
|
|
||||||
Statement::Statement(const Source& source) : Base(source) {}
|
Statement::Statement(ProgramID program_id, const Source& source)
|
||||||
|
: Base(program_id, source) {}
|
||||||
|
|
||||||
Statement::Statement(Statement&&) = default;
|
Statement::Statement(Statement&&) = default;
|
||||||
|
|
||||||
|
|
|
@ -32,8 +32,9 @@ class Statement : public Castable<Statement, Node> {
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/// Constructor
|
/// Constructor
|
||||||
|
/// @param program_id the identifier of the program that owns this node
|
||||||
/// @param source the source of the expression
|
/// @param source the source of the expression
|
||||||
explicit Statement(const Source& source);
|
Statement(ProgramID program_id, const Source& source);
|
||||||
/// Move constructor
|
/// Move constructor
|
||||||
Statement(Statement&&);
|
Statement(Statement&&);
|
||||||
|
|
||||||
|
|
|
@ -21,8 +21,10 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::StrideDecoration);
|
||||||
namespace tint {
|
namespace tint {
|
||||||
namespace ast {
|
namespace ast {
|
||||||
|
|
||||||
StrideDecoration::StrideDecoration(const Source& source, uint32_t stride)
|
StrideDecoration::StrideDecoration(ProgramID program_id,
|
||||||
: Base(source), stride_(stride) {}
|
const Source& source,
|
||||||
|
uint32_t stride)
|
||||||
|
: Base(program_id, source), stride_(stride) {}
|
||||||
|
|
||||||
StrideDecoration::~StrideDecoration() = default;
|
StrideDecoration::~StrideDecoration() = default;
|
||||||
|
|
||||||
|
|
|
@ -24,9 +24,10 @@ namespace ast {
|
||||||
class StrideDecoration : public Castable<StrideDecoration, Decoration> {
|
class StrideDecoration : public Castable<StrideDecoration, Decoration> {
|
||||||
public:
|
public:
|
||||||
/// constructor
|
/// constructor
|
||||||
|
/// @param program_id the identifier of the program that owns this node
|
||||||
/// @param stride the stride value
|
/// @param stride the stride value
|
||||||
/// @param source the source of this decoration
|
/// @param source the source of this decoration
|
||||||
StrideDecoration(const Source& source, uint32_t stride);
|
StrideDecoration(ProgramID program_id, const Source& source, uint32_t stride);
|
||||||
~StrideDecoration() override;
|
~StrideDecoration() override;
|
||||||
|
|
||||||
/// @returns the stride value
|
/// @returns the stride value
|
||||||
|
|
|
@ -22,10 +22,11 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::Struct);
|
||||||
namespace tint {
|
namespace tint {
|
||||||
namespace ast {
|
namespace ast {
|
||||||
|
|
||||||
Struct::Struct(const Source& source,
|
Struct::Struct(ProgramID program_id,
|
||||||
|
const Source& source,
|
||||||
StructMemberList members,
|
StructMemberList members,
|
||||||
DecorationList decorations)
|
DecorationList decorations)
|
||||||
: Base(source),
|
: Base(program_id, source),
|
||||||
members_(std::move(members)),
|
members_(std::move(members)),
|
||||||
decorations_(std::move(decorations)) {
|
decorations_(std::move(decorations)) {
|
||||||
for (auto* mem : members_) {
|
for (auto* mem : members_) {
|
||||||
|
|
|
@ -27,10 +27,12 @@ namespace ast {
|
||||||
class Struct : public Castable<Struct, Node> {
|
class Struct : public Castable<Struct, Node> {
|
||||||
public:
|
public:
|
||||||
/// Create a new struct statement
|
/// Create a new struct statement
|
||||||
|
/// @param program_id the identifier of the program that owns this node
|
||||||
/// @param source The input source for the import statement
|
/// @param source The input source for the import statement
|
||||||
/// @param members The struct members
|
/// @param members The struct members
|
||||||
/// @param decorations The struct decorations
|
/// @param decorations The struct decorations
|
||||||
Struct(const Source& source,
|
Struct(ProgramID program_id,
|
||||||
|
const Source& source,
|
||||||
StructMemberList members,
|
StructMemberList members,
|
||||||
DecorationList decorations);
|
DecorationList decorations);
|
||||||
/// Move constructor
|
/// Move constructor
|
||||||
|
|
|
@ -21,8 +21,9 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::StructBlockDecoration);
|
||||||
namespace tint {
|
namespace tint {
|
||||||
namespace ast {
|
namespace ast {
|
||||||
|
|
||||||
StructBlockDecoration::StructBlockDecoration(const Source& source)
|
StructBlockDecoration::StructBlockDecoration(ProgramID program_id,
|
||||||
: Base(source) {}
|
const Source& source)
|
||||||
|
: Base(program_id, source) {}
|
||||||
|
|
||||||
StructBlockDecoration::~StructBlockDecoration() = default;
|
StructBlockDecoration::~StructBlockDecoration() = default;
|
||||||
|
|
||||||
|
|
|
@ -27,8 +27,9 @@ class StructBlockDecoration
|
||||||
: public Castable<StructBlockDecoration, Decoration> {
|
: public Castable<StructBlockDecoration, Decoration> {
|
||||||
public:
|
public:
|
||||||
/// constructor
|
/// constructor
|
||||||
|
/// @param program_id the identifier of the program that owns this node
|
||||||
/// @param source the source of this decoration
|
/// @param source the source of this decoration
|
||||||
explicit StructBlockDecoration(const Source& source);
|
StructBlockDecoration(ProgramID program_id, const Source& source);
|
||||||
~StructBlockDecoration() override;
|
~StructBlockDecoration() override;
|
||||||
|
|
||||||
/// Outputs the decoration to the given stream
|
/// Outputs the decoration to the given stream
|
||||||
|
|
|
@ -21,11 +21,12 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::StructMember);
|
||||||
namespace tint {
|
namespace tint {
|
||||||
namespace ast {
|
namespace ast {
|
||||||
|
|
||||||
StructMember::StructMember(const Source& source,
|
StructMember::StructMember(ProgramID program_id,
|
||||||
|
const Source& source,
|
||||||
const Symbol& sym,
|
const Symbol& sym,
|
||||||
type::Type* type,
|
type::Type* type,
|
||||||
DecorationList decorations)
|
DecorationList decorations)
|
||||||
: Base(source),
|
: Base(program_id, source),
|
||||||
symbol_(sym),
|
symbol_(sym),
|
||||||
type_(type),
|
type_(type),
|
||||||
decorations_(std::move(decorations)) {
|
decorations_(std::move(decorations)) {
|
||||||
|
|
|
@ -27,11 +27,13 @@ namespace ast {
|
||||||
class StructMember : public Castable<StructMember, Node> {
|
class StructMember : public Castable<StructMember, Node> {
|
||||||
public:
|
public:
|
||||||
/// Create a new struct member statement
|
/// Create a new struct member statement
|
||||||
|
/// @param program_id the identifier of the program that owns this node
|
||||||
/// @param source The input source for the struct member statement
|
/// @param source The input source for the struct member statement
|
||||||
/// @param sym The struct member symbol
|
/// @param sym The struct member symbol
|
||||||
/// @param type The struct member type
|
/// @param type The struct member type
|
||||||
/// @param decorations The struct member decorations
|
/// @param decorations The struct member decorations
|
||||||
StructMember(const Source& source,
|
StructMember(ProgramID program_id,
|
||||||
|
const Source& source,
|
||||||
const Symbol& sym,
|
const Symbol& sym,
|
||||||
type::Type* type,
|
type::Type* type,
|
||||||
DecorationList decorations);
|
DecorationList decorations);
|
||||||
|
|
|
@ -22,9 +22,10 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::StructMemberAlignDecoration);
|
||||||
namespace tint {
|
namespace tint {
|
||||||
namespace ast {
|
namespace ast {
|
||||||
|
|
||||||
StructMemberAlignDecoration::StructMemberAlignDecoration(const Source& source,
|
StructMemberAlignDecoration::StructMemberAlignDecoration(ProgramID program_id,
|
||||||
|
const Source& source,
|
||||||
uint32_t align)
|
uint32_t align)
|
||||||
: Base(source), align_(align) {}
|
: Base(program_id, source), align_(align) {}
|
||||||
|
|
||||||
StructMemberAlignDecoration::~StructMemberAlignDecoration() = default;
|
StructMemberAlignDecoration::~StructMemberAlignDecoration() = default;
|
||||||
|
|
||||||
|
|
|
@ -27,9 +27,12 @@ class StructMemberAlignDecoration
|
||||||
: public Castable<StructMemberAlignDecoration, Decoration> {
|
: public Castable<StructMemberAlignDecoration, Decoration> {
|
||||||
public:
|
public:
|
||||||
/// constructor
|
/// constructor
|
||||||
|
/// @param program_id the identifier of the program that owns this node
|
||||||
/// @param source the source of this decoration
|
/// @param source the source of this decoration
|
||||||
/// @param align the align value
|
/// @param align the align value
|
||||||
StructMemberAlignDecoration(const Source& source, uint32_t align);
|
StructMemberAlignDecoration(ProgramID program_id,
|
||||||
|
const Source& source,
|
||||||
|
uint32_t align);
|
||||||
~StructMemberAlignDecoration() override;
|
~StructMemberAlignDecoration() override;
|
||||||
|
|
||||||
/// @returns the align value
|
/// @returns the align value
|
||||||
|
|
|
@ -21,9 +21,10 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::StructMemberOffsetDecoration);
|
||||||
namespace tint {
|
namespace tint {
|
||||||
namespace ast {
|
namespace ast {
|
||||||
|
|
||||||
StructMemberOffsetDecoration::StructMemberOffsetDecoration(const Source& source,
|
StructMemberOffsetDecoration::StructMemberOffsetDecoration(ProgramID program_id,
|
||||||
|
const Source& source,
|
||||||
uint32_t offset)
|
uint32_t offset)
|
||||||
: Base(source), offset_(offset) {}
|
: Base(program_id, source), offset_(offset) {}
|
||||||
|
|
||||||
StructMemberOffsetDecoration::~StructMemberOffsetDecoration() = default;
|
StructMemberOffsetDecoration::~StructMemberOffsetDecoration() = default;
|
||||||
|
|
||||||
|
|
|
@ -34,9 +34,12 @@ class StructMemberOffsetDecoration
|
||||||
: public Castable<StructMemberOffsetDecoration, Decoration> {
|
: public Castable<StructMemberOffsetDecoration, Decoration> {
|
||||||
public:
|
public:
|
||||||
/// constructor
|
/// constructor
|
||||||
|
/// @param program_id the identifier of the program that owns this node
|
||||||
/// @param source the source of this decoration
|
/// @param source the source of this decoration
|
||||||
/// @param offset the offset value
|
/// @param offset the offset value
|
||||||
StructMemberOffsetDecoration(const Source& source, uint32_t offset);
|
StructMemberOffsetDecoration(ProgramID program_id,
|
||||||
|
const Source& source,
|
||||||
|
uint32_t offset);
|
||||||
~StructMemberOffsetDecoration() override;
|
~StructMemberOffsetDecoration() override;
|
||||||
|
|
||||||
/// @returns the offset value
|
/// @returns the offset value
|
||||||
|
|
|
@ -22,9 +22,10 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::StructMemberSizeDecoration);
|
||||||
namespace tint {
|
namespace tint {
|
||||||
namespace ast {
|
namespace ast {
|
||||||
|
|
||||||
StructMemberSizeDecoration::StructMemberSizeDecoration(const Source& source,
|
StructMemberSizeDecoration::StructMemberSizeDecoration(ProgramID program_id,
|
||||||
|
const Source& source,
|
||||||
uint32_t size)
|
uint32_t size)
|
||||||
: Base(source), size_(size) {}
|
: Base(program_id, source), size_(size) {}
|
||||||
|
|
||||||
StructMemberSizeDecoration::~StructMemberSizeDecoration() = default;
|
StructMemberSizeDecoration::~StructMemberSizeDecoration() = default;
|
||||||
|
|
||||||
|
|
|
@ -27,9 +27,12 @@ class StructMemberSizeDecoration
|
||||||
: public Castable<StructMemberSizeDecoration, Decoration> {
|
: public Castable<StructMemberSizeDecoration, Decoration> {
|
||||||
public:
|
public:
|
||||||
/// constructor
|
/// constructor
|
||||||
|
/// @param program_id the identifier of the program that owns this node
|
||||||
/// @param source the source of this decoration
|
/// @param source the source of this decoration
|
||||||
/// @param size the size value
|
/// @param size the size value
|
||||||
StructMemberSizeDecoration(const Source& source, uint32_t size);
|
StructMemberSizeDecoration(ProgramID program_id,
|
||||||
|
const Source& source,
|
||||||
|
uint32_t size);
|
||||||
~StructMemberSizeDecoration() override;
|
~StructMemberSizeDecoration() override;
|
||||||
|
|
||||||
/// @returns the size value
|
/// @returns the size value
|
||||||
|
|
|
@ -21,10 +21,11 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::SwitchStatement);
|
||||||
namespace tint {
|
namespace tint {
|
||||||
namespace ast {
|
namespace ast {
|
||||||
|
|
||||||
SwitchStatement::SwitchStatement(const Source& source,
|
SwitchStatement::SwitchStatement(ProgramID program_id,
|
||||||
|
const Source& source,
|
||||||
Expression* condition,
|
Expression* condition,
|
||||||
CaseStatementList body)
|
CaseStatementList body)
|
||||||
: Base(source), condition_(condition), body_(body) {
|
: Base(program_id, source), condition_(condition), body_(body) {
|
||||||
TINT_ASSERT(condition_);
|
TINT_ASSERT(condition_);
|
||||||
for (auto* stmt : body_) {
|
for (auto* stmt : body_) {
|
||||||
TINT_ASSERT(stmt);
|
TINT_ASSERT(stmt);
|
||||||
|
|
|
@ -25,10 +25,12 @@ namespace ast {
|
||||||
class SwitchStatement : public Castable<SwitchStatement, Statement> {
|
class SwitchStatement : public Castable<SwitchStatement, Statement> {
|
||||||
public:
|
public:
|
||||||
/// Constructor
|
/// Constructor
|
||||||
|
/// @param program_id the identifier of the program that owns this node
|
||||||
/// @param source the source information
|
/// @param source the source information
|
||||||
/// @param condition the switch condition
|
/// @param condition the switch condition
|
||||||
/// @param body the switch body
|
/// @param body the switch body
|
||||||
SwitchStatement(const Source& source,
|
SwitchStatement(ProgramID program_id,
|
||||||
|
const Source& source,
|
||||||
Expression* condition,
|
Expression* condition,
|
||||||
CaseStatementList body);
|
CaseStatementList body);
|
||||||
/// Move constructor
|
/// Move constructor
|
||||||
|
|
|
@ -21,10 +21,11 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::TypeConstructorExpression);
|
||||||
namespace tint {
|
namespace tint {
|
||||||
namespace ast {
|
namespace ast {
|
||||||
|
|
||||||
TypeConstructorExpression::TypeConstructorExpression(const Source& source,
|
TypeConstructorExpression::TypeConstructorExpression(ProgramID program_id,
|
||||||
|
const Source& source,
|
||||||
type::Type* type,
|
type::Type* type,
|
||||||
ExpressionList values)
|
ExpressionList values)
|
||||||
: Base(source), type_(type), values_(std::move(values)) {
|
: Base(program_id, source), type_(type), values_(std::move(values)) {
|
||||||
TINT_ASSERT(type);
|
TINT_ASSERT(type);
|
||||||
for (auto* val : values_) {
|
for (auto* val : values_) {
|
||||||
TINT_ASSERT(val);
|
TINT_ASSERT(val);
|
||||||
|
|
|
@ -27,10 +27,12 @@ class TypeConstructorExpression
|
||||||
: public Castable<TypeConstructorExpression, ConstructorExpression> {
|
: public Castable<TypeConstructorExpression, ConstructorExpression> {
|
||||||
public:
|
public:
|
||||||
/// Constructor
|
/// Constructor
|
||||||
|
/// @param program_id the identifier of the program that owns this node
|
||||||
/// @param source the constructor source
|
/// @param source the constructor source
|
||||||
/// @param type the type
|
/// @param type the type
|
||||||
/// @param values the constructor values
|
/// @param values the constructor values
|
||||||
TypeConstructorExpression(const Source& source,
|
TypeConstructorExpression(ProgramID program_id,
|
||||||
|
const Source& source,
|
||||||
type::Type* type,
|
type::Type* type,
|
||||||
ExpressionList values);
|
ExpressionList values);
|
||||||
/// Move constructor
|
/// Move constructor
|
||||||
|
|
|
@ -21,8 +21,11 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::UintLiteral);
|
||||||
namespace tint {
|
namespace tint {
|
||||||
namespace ast {
|
namespace ast {
|
||||||
|
|
||||||
UintLiteral::UintLiteral(const Source& source, type::Type* type, uint32_t value)
|
UintLiteral::UintLiteral(ProgramID program_id,
|
||||||
: Base(source, type, value) {}
|
const Source& source,
|
||||||
|
type::Type* type,
|
||||||
|
uint32_t value)
|
||||||
|
: Base(program_id, source, type, value) {}
|
||||||
|
|
||||||
UintLiteral::~UintLiteral() = default;
|
UintLiteral::~UintLiteral() = default;
|
||||||
|
|
||||||
|
|
|
@ -26,10 +26,14 @@ namespace ast {
|
||||||
class UintLiteral : public Castable<UintLiteral, IntLiteral> {
|
class UintLiteral : public Castable<UintLiteral, IntLiteral> {
|
||||||
public:
|
public:
|
||||||
/// Constructor
|
/// Constructor
|
||||||
|
/// @param program_id the identifier of the program that owns this node
|
||||||
/// @param source the input source
|
/// @param source the input source
|
||||||
/// @param type the type of the literal
|
/// @param type the type of the literal
|
||||||
/// @param value the uint literals value
|
/// @param value the uint literals value
|
||||||
UintLiteral(const Source& source, type::Type* type, uint32_t value);
|
UintLiteral(ProgramID program_id,
|
||||||
|
const Source& source,
|
||||||
|
type::Type* type,
|
||||||
|
uint32_t value);
|
||||||
~UintLiteral() override;
|
~UintLiteral() override;
|
||||||
|
|
||||||
/// @returns the uint literal value
|
/// @returns the uint literal value
|
||||||
|
|
|
@ -21,10 +21,11 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::UnaryOpExpression);
|
||||||
namespace tint {
|
namespace tint {
|
||||||
namespace ast {
|
namespace ast {
|
||||||
|
|
||||||
UnaryOpExpression::UnaryOpExpression(const Source& source,
|
UnaryOpExpression::UnaryOpExpression(ProgramID program_id,
|
||||||
|
const Source& source,
|
||||||
UnaryOp op,
|
UnaryOp op,
|
||||||
Expression* expr)
|
Expression* expr)
|
||||||
: Base(source), op_(op), expr_(expr) {
|
: Base(program_id, source), op_(op), expr_(expr) {
|
||||||
TINT_ASSERT(expr_);
|
TINT_ASSERT(expr_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue