Validate function call arguments

- Add resolver/call_test.cc for new unit tests, and move a couple that
were in resolver/validation_test.cc to it

- Fix CalculateArrayLength transform so that it passes the address of
the u32 it creates to the internal function

- Fix tests broken as a result of this change

Bug: tint:664
Change-Id: If713f9828790cd51224d2392d42c01c0057cb652
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53920
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
This commit is contained in:
Antonio Maiorano
2021-06-09 20:17:59 +00:00
committed by Tint LUCI CQ
parent 1987fd80f4
commit 14b3403148
19 changed files with 371 additions and 139 deletions

View File

@@ -19,7 +19,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::sem::Call);
namespace tint {
namespace sem {
Call::Call(ast::Expression* declaration,
Call::Call(const ast::Expression* declaration,
const CallTarget* target,
Statement* statement)
: Base(declaration, target->ReturnType(), statement), target_(target) {}

View File

@@ -29,7 +29,7 @@ class Call : public Castable<Call, Expression> {
/// @param declaration the AST node
/// @param target the call target
/// @param statement the statement that owns this expression
Call(ast::Expression* declaration,
Call(const ast::Expression* declaration,
const CallTarget* target,
Statement* statement);

View File

@@ -19,7 +19,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::sem::Expression);
namespace tint {
namespace sem {
Expression::Expression(ast::Expression* declaration,
Expression::Expression(const ast::Expression* declaration,
const sem::Type* type,
Statement* statement)
: declaration_(declaration), type_(type), statement_(statement) {

View File

@@ -31,7 +31,7 @@ class Expression : public Castable<Expression, Node> {
/// @param declaration the AST node
/// @param type the resolved type of the expression
/// @param statement the statement that owns this expression
Expression(ast::Expression* declaration,
Expression(const ast::Expression* declaration,
const sem::Type* type,
Statement* statement);
@@ -42,10 +42,12 @@ class Expression : public Castable<Expression, Node> {
Statement* Stmt() const { return statement_; }
/// @returns the AST node
ast::Expression* Declaration() const { return declaration_; }
ast::Expression* Declaration() const {
return const_cast<ast::Expression*>(declaration_);
}
private:
ast::Expression* declaration_;
const ast::Expression* declaration_;
const sem::Type* const type_;
Statement* const statement_;
};