From d0dda258cc52c1855ff883245dd477e6b5c2cfb1 Mon Sep 17 00:00:00 2001 From: Ben Clayton Date: Mon, 7 Dec 2020 21:09:57 +0000 Subject: [PATCH] ast: Remove ReturnStatement constructors that don't take a source set_source() will be removed, so sources will only be specifiable at construction time. Bug: tint:390 Change-Id: I2b81929e362ccf75145ebc45028dd973a77ae068 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/35010 Commit-Queue: Ben Clayton Reviewed-by: dan sinclair --- src/ast/return_statement.cc | 4 - src/ast/return_statement.h | 5 -- src/ast/return_statement_test.cc | 18 ++--- src/inspector/inspector_test.cc | 22 +++--- src/reader/spirv/function.cc | 8 +- src/type_determiner_test.cc | 8 +- src/validator/validator_function_test.cc | 20 ++--- src/validator/validator_test.cc | 6 +- src/writer/hlsl/generator_impl_binary_test.cc | 26 ++++--- .../hlsl/generator_impl_function_test.cc | 72 +++++++++--------- src/writer/hlsl/generator_impl_if_test.cc | 16 ++-- src/writer/hlsl/generator_impl_loop_test.cc | 4 +- src/writer/hlsl/generator_impl_return_test.cc | 4 +- .../msl/generator_impl_function_test.cc | 74 +++++++++---------- src/writer/msl/generator_impl_if_test.cc | 16 ++-- src/writer/msl/generator_impl_loop_test.cc | 4 +- src/writer/msl/generator_impl_return_test.cc | 4 +- src/writer/spirv/builder_call_test.cc | 14 ++-- src/writer/spirv/builder_function_test.cc | 16 ++-- src/writer/spirv/builder_if_test.cc | 4 +- src/writer/spirv/builder_return_test.cc | 7 +- .../wgsl/generator_impl_function_test.cc | 14 ++-- src/writer/wgsl/generator_impl_return_test.cc | 4 +- 23 files changed, 183 insertions(+), 187 deletions(-) diff --git a/src/ast/return_statement.cc b/src/ast/return_statement.cc index 43a2ac5877..3583138bbe 100644 --- a/src/ast/return_statement.cc +++ b/src/ast/return_statement.cc @@ -22,12 +22,8 @@ TINT_INSTANTIATE_CLASS_ID(tint::ast::ReturnStatement); namespace tint { namespace ast { -ReturnStatement::ReturnStatement() : Base() {} - ReturnStatement::ReturnStatement(const Source& source) : Base(source) {} -ReturnStatement::ReturnStatement(Expression* value) : Base(), value_(value) {} - ReturnStatement::ReturnStatement(const Source& source, Expression* value) : Base(source), value_(value) {} diff --git a/src/ast/return_statement.h b/src/ast/return_statement.h index c90079b891..547411ace6 100644 --- a/src/ast/return_statement.h +++ b/src/ast/return_statement.h @@ -27,15 +27,10 @@ namespace ast { /// A return statement class ReturnStatement : public Castable { public: - /// Constructor - ReturnStatement(); /// Constructor /// @param source the source information explicit ReturnStatement(const Source& source); /// Constructor - /// @param value the return value - explicit ReturnStatement(Expression* value); - /// Constructor /// @param source the return statement source /// @param value the return value ReturnStatement(const Source& source, Expression* value); diff --git a/src/ast/return_statement_test.cc b/src/ast/return_statement_test.cc index 384b49eb13..8e9e5253ac 100644 --- a/src/ast/return_statement_test.cc +++ b/src/ast/return_statement_test.cc @@ -28,7 +28,7 @@ using ReturnStatementTest = TestHelper; TEST_F(ReturnStatementTest, Creation) { auto* expr = create("expr"); - ReturnStatement r(expr); + ReturnStatement r(Source{}, expr); EXPECT_EQ(r.value(), expr); } @@ -40,41 +40,41 @@ TEST_F(ReturnStatementTest, Creation_WithSource) { } TEST_F(ReturnStatementTest, IsReturn) { - ReturnStatement r; + ReturnStatement r(Source{}); EXPECT_TRUE(r.Is()); } TEST_F(ReturnStatementTest, HasValue_WithoutValue) { - ReturnStatement r; + ReturnStatement r(Source{}); EXPECT_FALSE(r.has_value()); } TEST_F(ReturnStatementTest, HasValue_WithValue) { auto* expr = create("expr"); - ReturnStatement r(expr); + ReturnStatement r(Source{}, expr); EXPECT_TRUE(r.has_value()); } TEST_F(ReturnStatementTest, IsValid_WithoutValue) { - ReturnStatement r; + ReturnStatement r(Source{}); EXPECT_TRUE(r.IsValid()); } TEST_F(ReturnStatementTest, IsValid_WithValue) { auto* expr = create("expr"); - ReturnStatement r(expr); + ReturnStatement r(Source{}, expr); EXPECT_TRUE(r.IsValid()); } TEST_F(ReturnStatementTest, IsValid_InvalidValue) { auto* expr = create(""); - ReturnStatement r(expr); + ReturnStatement r(Source{}, expr); EXPECT_FALSE(r.IsValid()); } TEST_F(ReturnStatementTest, ToStr_WithValue) { auto* expr = create("expr"); - ReturnStatement r(expr); + ReturnStatement r(Source{}, expr); std::ostringstream out; r.to_str(out, 2); EXPECT_EQ(out.str(), R"( Return{ @@ -86,7 +86,7 @@ TEST_F(ReturnStatementTest, ToStr_WithValue) { } TEST_F(ReturnStatementTest, ToStr_WithoutValue) { - ReturnStatement r; + ReturnStatement r(Source{}); std::ostringstream out; r.to_str(out, 2); EXPECT_EQ(out.str(), R"( Return{} diff --git a/src/inspector/inspector_test.cc b/src/inspector/inspector_test.cc index 9cddc87f3e..9439593bab 100644 --- a/src/inspector/inspector_test.cc +++ b/src/inspector/inspector_test.cc @@ -82,7 +82,7 @@ class InspectorHelper { std::string name, ast::FunctionDecorationList decorations = {}) { auto* body = create(); - body->append(create()); + body->append(create(Source{})); return create(Source{}, name, ast::VariableList(), void_type(), body, decorations); } @@ -101,7 +101,7 @@ class InspectorHelper { auto* call_expr = create(ident_expr, ast::ExpressionList()); body->append(create(call_expr)); - body->append(create()); + body->append(create(Source{})); return create(Source{}, caller, ast::VariableList(), void_type(), body, decorations); } @@ -141,7 +141,7 @@ class InspectorHelper { create(out), create(in))); } - body->append(create()); + body->append(create(Source{})); return create(Source{}, name, ast::VariableList(), void_type(), body, decorations); } @@ -171,7 +171,7 @@ class InspectorHelper { auto* call_expr = create(ident_expr, ast::ExpressionList()); body->append(create(call_expr)); - body->append(create()); + body->append(create(Source{})); return create(Source{}, caller, ast::VariableList(), void_type(), body, decorations); } @@ -416,7 +416,7 @@ class InspectorHelper { create(member_name)))); } - body->append(create()); + body->append(create(Source{})); return create(Source{}, func_name, ast::VariableList(), void_type(), body, ast::FunctionDecorationList{}); @@ -540,7 +540,7 @@ class InspectorHelper { body->append(create( create("sampler_result"), call_expr)); - body->append(create()); + body->append(create(Source{})); return create(Source{}, func_name, ast::VariableList(), void_type(), body, decorations); @@ -582,7 +582,7 @@ class InspectorHelper { body->append(create( create("sampler_result"), call_expr)); - body->append(create()); + body->append(create(Source{})); return create(Source{}, func_name, ast::VariableList(), void_type(), body, decorations); @@ -624,7 +624,7 @@ class InspectorHelper { body->append(create( create("sampler_result"), call_expr)); - body->append(create()); + body->append(create(Source{})); return create(Source{}, func_name, ast::VariableList(), void_type(), body, decorations); @@ -1455,7 +1455,7 @@ TEST_F(InspectorGetUniformBufferResourceBindingsTest, MultipleUniformBuffers) { AddFuncCall(body, "ub_bar_func"); AddFuncCall(body, "ub_baz_func"); - body->append(create()); + body->append(create(Source{})); ast::Function* func = create( Source{}, "ep_func", ast::VariableList(), void_type(), body, ast::FunctionDecorationList{ @@ -1601,7 +1601,7 @@ TEST_F(InspectorGetStorageBufferResourceBindingsTest, MultipleStorageBuffers) { AddFuncCall(body, "sb_bar_func"); AddFuncCall(body, "sb_baz_func"); - body->append(create()); + body->append(create(Source{})); ast::Function* func = create( Source{}, "ep_func", ast::VariableList(), void_type(), body, ast::FunctionDecorationList{ @@ -1774,7 +1774,7 @@ TEST_F(InspectorGetReadOnlyStorageBufferResourceBindingsTest, AddFuncCall(body, "sb_bar_func"); AddFuncCall(body, "sb_baz_func"); - body->append(create()); + body->append(create(Source{})); ast::Function* func = create( Source{}, "ep_func", ast::VariableList(), void_type(), body, ast::FunctionDecorationList{ diff --git a/src/reader/spirv/function.cc b/src/reader/spirv/function.cc index 03be176299..a2d90f70fd 100644 --- a/src/reader/spirv/function.cc +++ b/src/reader/spirv/function.cc @@ -2374,11 +2374,11 @@ bool FunctionEmitter::EmitNormalTerminator(const BlockInfo& block_info) { const auto& terminator = *(block_info.basic_block->terminator()); switch (terminator.opcode()) { case SpvOpReturn: - AddStatement(create()); + AddStatement(create(Source{})); return true; case SpvOpReturnValue: { auto value = MakeExpression(terminator.GetSingleWordInOperand(0)); - AddStatement(create(value.expr)); + AddStatement(create(Source{}, value.expr)); } return true; case SpvOpKill: @@ -2392,11 +2392,11 @@ bool FunctionEmitter::EmitNormalTerminator(const BlockInfo& block_info) { { const auto* result_type = type_mgr_->GetType(function_.type_id()); if (result_type->AsVoid() != nullptr) { - AddStatement(create()); + AddStatement(create(Source{})); } else { auto* ast_type = parser_impl_.ConvertType(function_.type_id()); AddStatement(create( - parser_impl_.MakeNullValue(ast_type))); + Source{}, parser_impl_.MakeNullValue(ast_type))); } } return true; diff --git a/src/type_determiner_test.cc b/src/type_determiner_test.cc index f9a21ad6e3..a761335e40 100644 --- a/src/type_determiner_test.cc +++ b/src/type_determiner_test.cc @@ -291,7 +291,7 @@ TEST_F(TypeDeterminerTest, Stmt_Return) { auto* cond = create( create(&i32, 2)); - ast::ReturnStatement ret(cond); + ast::ReturnStatement ret(Source{}, cond); EXPECT_TRUE(td()->DetermineResultType(&ret)); ASSERT_NE(cond->result_type(), nullptr); @@ -300,7 +300,7 @@ TEST_F(TypeDeterminerTest, Stmt_Return) { TEST_F(TypeDeterminerTest, Stmt_Return_WithoutValue) { ast::type::I32 i32; - ast::ReturnStatement ret; + ast::ReturnStatement ret(Source{}); EXPECT_TRUE(td()->DetermineResultType(&ret)); } @@ -370,14 +370,14 @@ TEST_F(TypeDeterminerTest, Stmt_Call_undeclared) { ast::VariableList params0; auto* main_body = create(); main_body->append(create(call_expr)); - main_body->append(create()); + main_body->append(create(Source{})); auto* func_main = create(Source{}, "main", params0, &f32, main_body, ast::FunctionDecorationList{}); mod->AddFunction(func_main); auto* body = create(); - body->append(create()); + body->append(create(Source{})); auto* func = create(Source{}, "func", params0, &f32, body, ast::FunctionDecorationList{}); mod->AddFunction(func); diff --git a/src/validator/validator_function_test.cc b/src/validator/validator_function_test.cc index 4911941b56..23272204dd 100644 --- a/src/validator/validator_function_test.cc +++ b/src/validator/validator_function_test.cc @@ -124,7 +124,7 @@ TEST_F(ValidateFunctionTest, FunctionTypeMustMatchReturnStatementType_Pass) { ast::VariableList params; auto* body = create(); - body->append(create()); + body->append(create(Source{})); auto* func = create( Source{}, "func", params, &void_type, body, ast::FunctionDecorationList{ @@ -193,7 +193,7 @@ TEST_F(ValidateFunctionTest, FunctionNamesMustBeUnique_fail) { auto* return_expr = create( create(&i32, 2)); - body->append(create(return_expr)); + body->append(create(Source{}, return_expr)); auto* func = create(Source{}, "func", params, &i32, body, ast::FunctionDecorationList{}); @@ -202,7 +202,7 @@ TEST_F(ValidateFunctionTest, FunctionNamesMustBeUnique_fail) { auto* return_expr_copy = create( create(&i32, 2)); - body_copy->append(create(return_expr_copy)); + body_copy->append(create(Source{}, return_expr_copy)); auto* func_copy = create(Source{Source::Location{12, 34}}, "func", params_copy, &i32, body_copy, ast::FunctionDecorationList{}); @@ -226,7 +226,7 @@ TEST_F(ValidateFunctionTest, RecursionIsNotAllowed_Fail) { ast::VariableList params0; auto* body0 = create(); body0->append(create(call_expr)); - body0->append(create()); + body0->append(create(Source{})); auto* func0 = create(Source{}, "func", params0, &f32, body0, ast::FunctionDecorationList{}); mod()->AddFunction(func0); @@ -252,7 +252,7 @@ TEST_F(ValidateFunctionTest, RecursionIsNotAllowedExpr_Fail) { auto* return_expr = create( create(&i32, 2)); - body0->append(create(return_expr)); + body0->append(create(Source{}, return_expr)); auto* func0 = create(Source{}, "func", params0, &i32, body0, ast::FunctionDecorationList{}); mod()->AddFunction(func0); @@ -271,7 +271,7 @@ TEST_F(ValidateFunctionTest, Function_WithPipelineStage_NotVoid_Fail) { create(&i32, 0)); auto* body = create(); - body->append(create(return_expr)); + body->append(create(Source{}, return_expr)); auto* func = create( Source{Source::Location{12, 34}}, "vtx_main", params, &i32, body, ast::FunctionDecorationList{ @@ -294,7 +294,7 @@ TEST_F(ValidateFunctionTest, Function_WithPipelineStage_WithParams_Fail) { params.push_back( create(Source{}, "a", ast::StorageClass::kNone, &i32)); auto* body = create(); - body->append(create()); + body->append(create(Source{})); auto* func = create( Source{Source::Location{12, 34}}, "vtx_func", params, &void_type, body, ast::FunctionDecorationList{ @@ -316,7 +316,7 @@ TEST_F(ValidateFunctionTest, PipelineStage_MustBeUnique_Fail) { ast::type::Void void_type; ast::VariableList params; auto* body = create(); - body->append(create()); + body->append(create(Source{})); auto* func = create( Source{Source::Location{12, 34}}, "main", params, &void_type, body, ast::FunctionDecorationList{ @@ -338,7 +338,7 @@ TEST_F(ValidateFunctionTest, OnePipelineStageFunctionMustBePresent_Pass) { ast::type::Void void_type; ast::VariableList params; auto* body = create(); - body->append(create()); + body->append(create(Source{})); auto* func = create( Source{}, "vtx_func", params, &void_type, body, ast::FunctionDecorationList{ @@ -355,7 +355,7 @@ TEST_F(ValidateFunctionTest, OnePipelineStageFunctionMustBePresent_Fail) { ast::type::Void void_type; ast::VariableList params; auto* body = create(); - body->append(create()); + body->append(create(Source{})); auto* func = create(Source{}, "vtx_func", params, &void_type, body, ast::FunctionDecorationList{}); mod()->AddFunction(func); diff --git a/src/validator/validator_test.cc b/src/validator/validator_test.cc index 49a8d2fb44..8c955019e9 100644 --- a/src/validator/validator_test.cc +++ b/src/validator/validator_test.cc @@ -326,7 +326,7 @@ TEST_F(ValidatorTest, UsingUndefinedVariableGlobalVariable_Pass) { auto* body = create(); body->append(create( Source{Source::Location{12, 34}}, lhs, rhs)); - body->append(create()); + body->append(create(Source{})); auto* func = create( Source{}, "my_func", params, &void_type, body, ast::FunctionDecorationList{ @@ -634,7 +634,7 @@ TEST_F(ValidatorTest, RedeclaredIdentifierDifferentFunctions_Pass) { auto* body0 = create(); body0->append(create( Source{Source::Location{12, 34}}, var0)); - body0->append(create()); + body0->append(create(Source{})); auto* func0 = create(Source{}, "func0", params0, &void_type, body0, ast::FunctionDecorationList{}); @@ -642,7 +642,7 @@ TEST_F(ValidatorTest, RedeclaredIdentifierDifferentFunctions_Pass) { auto* body1 = create(); body1->append(create( Source{Source::Location{13, 34}}, var1)); - body1->append(create()); + body1->append(create(Source{})); auto* func1 = create( Source{}, "func1", params1, &void_type, body1, ast::FunctionDecorationList{ diff --git a/src/writer/hlsl/generator_impl_binary_test.cc b/src/writer/hlsl/generator_impl_binary_test.cc index 4dd592ffb6..1a7310a6bc 100644 --- a/src/writer/hlsl/generator_impl_binary_test.cc +++ b/src/writer/hlsl/generator_impl_binary_test.cc @@ -378,15 +378,15 @@ TEST_F(HlslGeneratorImplTest_Binary, If_WithLogical) { ast::type::I32 i32; auto* body = create(); - body->append( - create(create( - create(&i32, 3)))); + body->append(create( + Source{}, create( + create(&i32, 3)))); auto* else_stmt = create(body); body = create(); - body->append( - create(create( - create(&i32, 2)))); + body->append(create( + Source{}, create( + create(&i32, 2)))); auto* else_if_stmt = create( create(ast::BinaryOp::kLogicalOr, create("b"), @@ -394,9 +394,9 @@ TEST_F(HlslGeneratorImplTest_Binary, If_WithLogical) { body); body = create(); - body->append( - create(create( - create(&i32, 1)))); + body->append(create( + Source{}, create( + create(&i32, 1)))); ast::IfStatement expr( Source{}, @@ -436,9 +436,11 @@ TEST_F(HlslGeneratorImplTest_Binary, Return_WithLogical) { auto* b = create("b"); auto* c = create("c"); - ast::ReturnStatement expr(create( - ast::BinaryOp::kLogicalOr, - create(ast::BinaryOp::kLogicalAnd, a, b), c)); + ast::ReturnStatement expr( + Source{}, + create( + ast::BinaryOp::kLogicalOr, + create(ast::BinaryOp::kLogicalAnd, a, b), c)); ASSERT_TRUE(gen.EmitStatement(out, &expr)) << gen.error(); EXPECT_EQ(result(), R"(bool _tint_tmp = a; diff --git a/src/writer/hlsl/generator_impl_function_test.cc b/src/writer/hlsl/generator_impl_function_test.cc index 2f107ef083..315394c2be 100644 --- a/src/writer/hlsl/generator_impl_function_test.cc +++ b/src/writer/hlsl/generator_impl_function_test.cc @@ -57,7 +57,7 @@ TEST_F(HlslGeneratorImplTest_Function, Emit_Function) { ast::type::Void void_type; auto* body = create(); - body->append(create()); + body->append(create(Source{})); auto* func = create(Source{}, "my_func", ast::VariableList{}, &void_type, body, ast::FunctionDecorationList{}); @@ -77,7 +77,7 @@ TEST_F(HlslGeneratorImplTest_Function, Emit_Function_Name_Collision) { ast::type::Void void_type; auto* body = create(); - body->append(create()); + body->append(create(Source{})); auto* func = create(Source{}, "GeometryShader", ast::VariableList{}, &void_type, body, ast::FunctionDecorationList{}); @@ -106,7 +106,7 @@ TEST_F(HlslGeneratorImplTest_Function, Emit_Function_WithParams) { ast::type::Void void_type; auto* body = create(); - body->append(create()); + body->append(create(Source{})); auto* func = create(Source{}, "my_func", params, &void_type, body, ast::FunctionDecorationList{}); @@ -145,7 +145,7 @@ TEST_F(HlslGeneratorImplTest_Function, body->append(create( create("bar"), create("foo"))); - body->append(create()); + body->append(create(Source{})); auto* func = create( Source{}, "frag_main", params, &void_type, body, ast::FunctionDecorationList{ @@ -203,7 +203,7 @@ TEST_F(HlslGeneratorImplTest_Function, create( create("coord"), create("x")))); - body->append(create()); + body->append(create(Source{})); auto* func = create( Source{}, "frag_main", params, &void_type, body, ast::FunctionDecorationList{ @@ -257,7 +257,7 @@ TEST_F(HlslGeneratorImplTest_Function, auto* body = create(); body->append(create(var)); - body->append(create()); + body->append(create(Source{})); auto* func = create( Source{}, "frag_main", params, &void_type, body, ast::FunctionDecorationList{ @@ -318,7 +318,7 @@ TEST_F(HlslGeneratorImplTest_Function, auto* body = create(); body->append(create(var)); - body->append(create()); + body->append(create(Source{})); auto* func = create( Source{}, "frag_main", params, &void_type, body, ast::FunctionDecorationList{ @@ -383,7 +383,7 @@ TEST_F(HlslGeneratorImplTest_Function, auto* body = create(); body->append(create(var)); - body->append(create()); + body->append(create(Source{})); auto* func = create( Source{}, "frag_main", params, &void_type, body, ast::FunctionDecorationList{ @@ -444,7 +444,7 @@ TEST_F(HlslGeneratorImplTest_Function, auto* body = create(); body->append(create(var)); - body->append(create()); + body->append(create(Source{})); auto* func = create( Source{}, "frag_main", params, &void_type, body, ast::FunctionDecorationList{ @@ -507,7 +507,7 @@ TEST_F(HlslGeneratorImplTest_Function, auto* body = create(); body->append(assign); - body->append(create()); + body->append(create(Source{})); auto* func = create( Source{}, "frag_main", params, &void_type, body, ast::FunctionDecorationList{ @@ -565,8 +565,8 @@ TEST_F( body->append(create( create("val"), create("param"))); - body->append( - create(create("foo"))); + body->append(create( + Source{}, create("foo"))); auto* sub_func = create(Source{}, "sub_func", params, &f32, body, ast::FunctionDecorationList{}); @@ -581,7 +581,7 @@ TEST_F( create("bar"), create(create("sub_func"), expr))); - body->append(create()); + body->append(create(Source{})); auto* func_1 = create( Source{}, "ep_1", params, &void_type, body, ast::FunctionDecorationList{ @@ -639,8 +639,8 @@ TEST_F(HlslGeneratorImplTest_Function, ast::StorageClass::kFunction, &f32)); auto* body = create(); - body->append( - create(create("param"))); + body->append(create( + Source{}, create("param"))); auto* sub_func = create(Source{}, "sub_func", params, &f32, body, ast::FunctionDecorationList{}); @@ -655,7 +655,7 @@ TEST_F(HlslGeneratorImplTest_Function, create("depth"), create(create("sub_func"), expr))); - body->append(create()); + body->append(create(Source{})); auto* func_1 = create( Source{}, "ep_1", params, &void_type, body, ast::FunctionDecorationList{ @@ -716,8 +716,8 @@ TEST_F( create( create("coord"), create("x")))); - body->append( - create(create("param"))); + body->append(create( + Source{}, create("param"))); auto* sub_func = create(Source{}, "sub_func", params, &f32, body, ast::FunctionDecorationList{}); @@ -732,7 +732,7 @@ TEST_F( create("depth"), create(create("sub_func"), expr))); - body->append(create()); + body->append(create(Source{})); auto* func_1 = create( Source{}, "ep_1", params, &void_type, body, ast::FunctionDecorationList{ @@ -788,10 +788,10 @@ TEST_F(HlslGeneratorImplTest_Function, ast::StorageClass::kFunction, &f32)); auto* body = create(); - body->append( - create(create( - create("coord"), - create("x")))); + body->append(create( + Source{}, create( + create("coord"), + create("x")))); auto* sub_func = create(Source{}, "sub_func", params, &f32, body, ast::FunctionDecorationList{}); @@ -808,7 +808,7 @@ TEST_F(HlslGeneratorImplTest_Function, body = create(); body->append(create(var)); - body->append(create()); + body->append(create(Source{})); auto* func = create( Source{}, "frag_main", params, &void_type, body, ast::FunctionDecorationList{ @@ -858,10 +858,10 @@ TEST_F(HlslGeneratorImplTest_Function, ast::StorageClass::kFunction, &f32)); auto* body = create(); - body->append( - create(create( - create("coord"), - create("x")))); + body->append(create( + Source{}, create( + create("coord"), + create("x")))); auto* sub_func = create(Source{}, "sub_func", params, &f32, body, ast::FunctionDecorationList{}); @@ -878,7 +878,7 @@ TEST_F(HlslGeneratorImplTest_Function, body = create(); body->append(create(var)); - body->append(create()); + body->append(create(Source{})); auto* func = create( Source{}, "frag_main", params, &void_type, body, ast::FunctionDecorationList{ @@ -926,7 +926,7 @@ TEST_F(HlslGeneratorImplTest_Function, create(&f32, 1.0f)))); auto* list = create(); - list->append(create()); + list->append(create(Source{})); body->append(create( Source{}, @@ -937,7 +937,7 @@ TEST_F(HlslGeneratorImplTest_Function, create(&i32, 1))), list, ast::ElseStatementList{})); - body->append(create()); + body->append(create(Source{})); auto* func_1 = create( Source{}, "ep_1", params, &void_type, body, ast::FunctionDecorationList{ @@ -990,7 +990,7 @@ TEST_F(HlslGeneratorImplTest_Function, ast::VariableList params; auto* body = create(); - body->append(create()); + body->append(create(Source{})); auto* func = create( Source{}, "main", params, &void_type, body, ast::FunctionDecorationList{ @@ -1015,7 +1015,7 @@ TEST_F(HlslGeneratorImplTest_Function, ast::VariableList params; auto* body = create(); - body->append(create()); + body->append(create(Source{})); auto* func = create( Source{}, "main", params, &void_type, body, ast::FunctionDecorationList{ @@ -1046,7 +1046,7 @@ TEST_F(HlslGeneratorImplTest_Function, Emit_Function_WithArrayParams) { ast::type::Void void_type; auto* body = create(); - body->append(create()); + body->append(create(Source{})); auto* func = create(Source{}, "my_func", params, &void_type, body, ast::FunctionDecorationList{}); @@ -1117,7 +1117,7 @@ TEST_F(HlslGeneratorImplTest_Function, auto* body = create(); body->append(create(var)); - body->append(create()); + body->append(create(Source{})); auto* func = create(Source{}, "a", params, &void_type, body, ast::FunctionDecorationList{ @@ -1138,7 +1138,7 @@ TEST_F(HlslGeneratorImplTest_Function, auto* body = create(); body->append(create(var)); - body->append(create()); + body->append(create(Source{})); auto* func = create(Source{}, "b", params, &void_type, body, ast::FunctionDecorationList{ diff --git a/src/writer/hlsl/generator_impl_if_test.cc b/src/writer/hlsl/generator_impl_if_test.cc index 0ce0fed6fc..c5993621a2 100644 --- a/src/writer/hlsl/generator_impl_if_test.cc +++ b/src/writer/hlsl/generator_impl_if_test.cc @@ -29,7 +29,7 @@ using HlslGeneratorImplTest_If = TestHelper; TEST_F(HlslGeneratorImplTest_If, Emit_If) { auto* cond = create("cond"); auto* body = create(); - body->append(create()); + body->append(create(Source{})); ast::IfStatement i(Source{}, cond, body, ast::ElseStatementList{}); gen.increment_indent(); @@ -44,11 +44,11 @@ TEST_F(HlslGeneratorImplTest_If, Emit_If) { TEST_F(HlslGeneratorImplTest_If, Emit_IfWithElseIf) { auto* else_cond = create("else_cond"); auto* else_body = create(); - else_body->append(create()); + else_body->append(create(Source{})); auto* cond = create("cond"); auto* body = create(); - body->append(create()); + body->append(create(Source{})); ast::IfStatement i(Source{}, cond, body, {create(else_cond, else_body)}); @@ -68,11 +68,11 @@ TEST_F(HlslGeneratorImplTest_If, Emit_IfWithElseIf) { TEST_F(HlslGeneratorImplTest_If, Emit_IfWithElse) { auto* else_body = create(); - else_body->append(create()); + else_body->append(create(Source{})); auto* cond = create("cond"); auto* body = create(); - body->append(create()); + body->append(create(Source{})); ast::IfStatement i(Source{}, cond, body, {create(else_body)}); @@ -92,14 +92,14 @@ TEST_F(HlslGeneratorImplTest_If, Emit_IfWithMultiple) { auto* else_cond = create("else_cond"); auto* else_body = create(); - else_body->append(create()); + else_body->append(create(Source{})); auto* else_body_2 = create(); - else_body_2->append(create()); + else_body_2->append(create(Source{})); auto* cond = create("cond"); auto* body = create(); - body->append(create()); + body->append(create(Source{})); ast::IfStatement i(Source{}, cond, body, { diff --git a/src/writer/hlsl/generator_impl_loop_test.cc b/src/writer/hlsl/generator_impl_loop_test.cc index 00dec1fa29..d79af0ac02 100644 --- a/src/writer/hlsl/generator_impl_loop_test.cc +++ b/src/writer/hlsl/generator_impl_loop_test.cc @@ -52,7 +52,7 @@ TEST_F(HlslGeneratorImplTest_Loop, Emit_LoopWithContinuing) { body->append(create()); auto* continuing = create(); - continuing->append(create()); + continuing->append(create(Source{})); ast::LoopStatement l(body, continuing); gen.increment_indent(); @@ -79,7 +79,7 @@ TEST_F(HlslGeneratorImplTest_Loop, Emit_LoopNestedWithContinuing) { body->append(create()); auto* continuing = create(); - continuing->append(create()); + continuing->append(create(Source{})); auto* inner = create(body, continuing); diff --git a/src/writer/hlsl/generator_impl_return_test.cc b/src/writer/hlsl/generator_impl_return_test.cc index 4744be82d7..d2a6ad64e3 100644 --- a/src/writer/hlsl/generator_impl_return_test.cc +++ b/src/writer/hlsl/generator_impl_return_test.cc @@ -28,7 +28,7 @@ namespace { using HlslGeneratorImplTest_Return = TestHelper; TEST_F(HlslGeneratorImplTest_Return, Emit_Return) { - ast::ReturnStatement r; + ast::ReturnStatement r(Source{}); gen.increment_indent(); ASSERT_TRUE(gen.EmitStatement(out, &r)) << gen.error(); @@ -37,7 +37,7 @@ TEST_F(HlslGeneratorImplTest_Return, Emit_Return) { TEST_F(HlslGeneratorImplTest_Return, Emit_ReturnWithValue) { auto* expr = create("expr"); - ast::ReturnStatement r(expr); + ast::ReturnStatement r(Source{}, expr); gen.increment_indent(); ASSERT_TRUE(gen.EmitStatement(out, &r)) << gen.error(); diff --git a/src/writer/msl/generator_impl_function_test.cc b/src/writer/msl/generator_impl_function_test.cc index 22eb8899a3..5290a23d7f 100644 --- a/src/writer/msl/generator_impl_function_test.cc +++ b/src/writer/msl/generator_impl_function_test.cc @@ -60,7 +60,7 @@ TEST_F(MslGeneratorImplTest, Emit_Function) { ast::type::Void void_type; auto* body = create(); - body->append(create()); + body->append(create(Source{})); auto* func = create(Source{}, "my_func", ast::VariableList{}, &void_type, body, ast::FunctionDecorationList{}); @@ -82,7 +82,7 @@ TEST_F(MslGeneratorImplTest, Emit_Function_Name_Collision) { ast::type::Void void_type; auto* body = create(); - body->append(create()); + body->append(create(Source{})); auto* func = create(Source{}, "main", ast::VariableList{}, &void_type, body, ast::FunctionDecorationList{}); @@ -113,7 +113,7 @@ TEST_F(MslGeneratorImplTest, Emit_Function_WithParams) { ast::type::Void void_type; auto* body = create(); - body->append(create()); + body->append(create(Source{})); auto* func = create(Source{}, "my_func", params, &void_type, body, ast::FunctionDecorationList{}); @@ -153,7 +153,7 @@ TEST_F(MslGeneratorImplTest, Emit_FunctionDecoration_EntryPoint_WithInOutVars) { body->append(create( create("bar"), create("foo"))); - body->append(create()); + body->append(create(Source{})); auto* func = create( Source{}, "frag_main", params, &void_type, body, @@ -213,7 +213,7 @@ TEST_F(MslGeneratorImplTest, create( create("coord"), create("x")))); - body->append(create()); + body->append(create(Source{})); auto* func = create( Source{}, "frag_main", params, &void_type, body, @@ -267,7 +267,7 @@ TEST_F(MslGeneratorImplTest, Emit_FunctionDecoration_EntryPoint_With_Uniform) { auto* body = create(); body->append(create(var)); - body->append(create()); + body->append(create(Source{})); auto* func = create( Source{}, "frag_main", params, &void_type, body, @@ -333,7 +333,7 @@ TEST_F(MslGeneratorImplTest, auto* body = create(); body->append(create(var)); - body->append(create()); + body->append(create(Source{})); auto* func = create( Source{}, "frag_main", params, &void_type, body, @@ -404,7 +404,7 @@ TEST_F(MslGeneratorImplTest, auto* body = create(); body->append(create(var)); - body->append(create()); + body->append(create(Source{})); auto* func = create( Source{}, "frag_main", params, &void_type, body, @@ -469,8 +469,8 @@ TEST_F( body->append(create( create("val"), create("param"))); - body->append( - create(create("foo"))); + body->append(create( + Source{}, create("foo"))); auto* sub_func = create(Source{}, "sub_func", params, &f32, body, ast::FunctionDecorationList{}); @@ -485,7 +485,7 @@ TEST_F( create("bar"), create(create("sub_func"), expr))); - body->append(create()); + body->append(create(Source{})); auto* func_1 = create( Source{}, "ep_1", params, &void_type, body, ast::FunctionDecorationList{ @@ -546,8 +546,8 @@ TEST_F(MslGeneratorImplTest, ast::StorageClass::kFunction, &f32)); auto* body = create(); - body->append( - create(create("param"))); + body->append(create( + Source{}, create("param"))); auto* sub_func = create(Source{}, "sub_func", params, &f32, body, ast::FunctionDecorationList{}); @@ -562,7 +562,7 @@ TEST_F(MslGeneratorImplTest, create("depth"), create(create("sub_func"), expr))); - body->append(create()); + body->append(create(Source{})); auto* func_1 = create( Source{}, "ep_1", params, &void_type, body, @@ -627,8 +627,8 @@ TEST_F( create( create("coord"), create("x")))); - body->append( - create(create("param"))); + body->append(create( + Source{}, create("param"))); auto* sub_func = create(Source{}, "sub_func", params, &f32, body, ast::FunctionDecorationList{}); @@ -643,7 +643,7 @@ TEST_F( create("depth"), create(create("sub_func"), expr))); - body->append(create()); + body->append(create(Source{})); auto* func_1 = create( Source{}, "ep_1", params, &void_type, body, ast::FunctionDecorationList{ @@ -697,10 +697,10 @@ TEST_F(MslGeneratorImplTest, ast::StorageClass::kFunction, &f32)); auto* body = create(); - body->append( - create(create( - create("coord"), - create("x")))); + body->append(create( + Source{}, create( + create("coord"), + create("x")))); auto* sub_func = create(Source{}, "sub_func", params, &f32, body, ast::FunctionDecorationList{}); @@ -717,7 +717,7 @@ TEST_F(MslGeneratorImplTest, body = create(); body->append(create(var)); - body->append(create()); + body->append(create(Source{})); auto* func = create( Source{}, "frag_main", params, &void_type, body, @@ -781,10 +781,10 @@ TEST_F(MslGeneratorImplTest, ast::StorageClass::kFunction, &f32)); auto* body = create(); - body->append( - create(create( - create("coord"), - create("b")))); + body->append(create( + Source{}, create( + create("coord"), + create("b")))); auto* sub_func = create(Source{}, "sub_func", params, &f32, body, ast::FunctionDecorationList{}); @@ -801,7 +801,7 @@ TEST_F(MslGeneratorImplTest, body = create(); body->append(create(var)); - body->append(create()); + body->append(create(Source{})); auto* func = create( Source{}, "frag_main", params, &void_type, body, @@ -871,10 +871,10 @@ TEST_F(MslGeneratorImplTest, ast::StorageClass::kFunction, &f32)); auto* body = create(); - body->append( - create(create( - create("coord"), - create("b")))); + body->append(create( + Source{}, create( + create("coord"), + create("b")))); auto* sub_func = create(Source{}, "sub_func", params, &f32, body, ast::FunctionDecorationList{}); @@ -891,7 +891,7 @@ TEST_F(MslGeneratorImplTest, body = create(); body->append(create(var)); - body->append(create()); + body->append(create(Source{})); auto* func = create( Source{}, "frag_main", params, &void_type, body, @@ -946,7 +946,7 @@ TEST_F(MslGeneratorImplTest, create(&f32, 1.0f)))); auto* list = create(); - list->append(create()); + list->append(create(Source{})); body->append(create( Source{}, @@ -957,7 +957,7 @@ TEST_F(MslGeneratorImplTest, create(&i32, 1))), list, ast::ElseStatementList{})); - body->append(create()); + body->append(create(Source{})); auto* func_1 = create( Source{}, "ep_1", params, &void_type, body, @@ -1020,7 +1020,7 @@ TEST_F(MslGeneratorImplTest, Emit_Function_WithArrayParams) { ast::type::Void void_type; auto* body = create(); - body->append(create()); + body->append(create(Source{})); auto* func = create(Source{}, "my_func", params, &void_type, body, ast::FunctionDecorationList{}); @@ -1095,7 +1095,7 @@ TEST_F(MslGeneratorImplTest, auto* body = create(); body->append(create(var)); - body->append(create()); + body->append(create(Source{})); auto* func = create(Source{}, "a", params, &void_type, body, @@ -1117,7 +1117,7 @@ TEST_F(MslGeneratorImplTest, auto* body = create(); body->append(create(var)); - body->append(create()); + body->append(create(Source{})); auto* func = create(Source{}, "b", params, &void_type, body, diff --git a/src/writer/msl/generator_impl_if_test.cc b/src/writer/msl/generator_impl_if_test.cc index dd34be7ad9..3a86c4d165 100644 --- a/src/writer/msl/generator_impl_if_test.cc +++ b/src/writer/msl/generator_impl_if_test.cc @@ -31,7 +31,7 @@ using MslGeneratorImplTest = TestHelper; TEST_F(MslGeneratorImplTest, Emit_If) { auto* cond = create("cond"); auto* body = create(); - body->append(create()); + body->append(create(Source{})); ast::IfStatement i(Source{}, cond, body, ast::ElseStatementList{}); @@ -47,11 +47,11 @@ TEST_F(MslGeneratorImplTest, Emit_If) { TEST_F(MslGeneratorImplTest, Emit_IfWithElseIf) { auto* else_cond = create("else_cond"); auto* else_body = create(); - else_body->append(create()); + else_body->append(create(Source{})); auto* cond = create("cond"); auto* body = create(); - body->append(create()); + body->append(create(Source{})); ast::IfStatement i(Source{}, cond, body, {create(else_cond, else_body)}); @@ -69,11 +69,11 @@ TEST_F(MslGeneratorImplTest, Emit_IfWithElseIf) { TEST_F(MslGeneratorImplTest, Emit_IfWithElse) { auto* else_body = create(); - else_body->append(create()); + else_body->append(create(Source{})); auto* cond = create("cond"); auto* body = create(); - body->append(create()); + body->append(create(Source{})); ast::IfStatement i(Source{}, cond, body, {create(else_body)}); @@ -93,14 +93,14 @@ TEST_F(MslGeneratorImplTest, Emit_IfWithMultiple) { auto* else_cond = create("else_cond"); auto* else_body = create(); - else_body->append(create()); + else_body->append(create(Source{})); auto* else_body_2 = create(); - else_body_2->append(create()); + else_body_2->append(create(Source{})); auto* cond = create("cond"); auto* body = create(); - body->append(create()); + body->append(create(Source{})); ast::IfStatement i(Source{}, cond, body, { diff --git a/src/writer/msl/generator_impl_loop_test.cc b/src/writer/msl/generator_impl_loop_test.cc index c4ef2581d0..bd05c99220 100644 --- a/src/writer/msl/generator_impl_loop_test.cc +++ b/src/writer/msl/generator_impl_loop_test.cc @@ -55,7 +55,7 @@ TEST_F(MslGeneratorImplTest, Emit_LoopWithContinuing) { body->append(create()); auto* continuing = create(); - continuing->append(create()); + continuing->append(create(Source{})); ast::LoopStatement l(body, continuing); @@ -83,7 +83,7 @@ TEST_F(MslGeneratorImplTest, Emit_LoopNestedWithContinuing) { body->append(create()); auto* continuing = create(); - continuing->append(create()); + continuing->append(create(Source{})); auto* inner = create(body, continuing); diff --git a/src/writer/msl/generator_impl_return_test.cc b/src/writer/msl/generator_impl_return_test.cc index 408a51ccd9..be2138e25b 100644 --- a/src/writer/msl/generator_impl_return_test.cc +++ b/src/writer/msl/generator_impl_return_test.cc @@ -30,7 +30,7 @@ namespace { using MslGeneratorImplTest = TestHelper; TEST_F(MslGeneratorImplTest, Emit_Return) { - ast::ReturnStatement r; + ast::ReturnStatement r(Source{}); gen.increment_indent(); @@ -40,7 +40,7 @@ TEST_F(MslGeneratorImplTest, Emit_Return) { TEST_F(MslGeneratorImplTest, Emit_ReturnWithValue) { auto* expr = create("expr"); - ast::ReturnStatement r(expr); + ast::ReturnStatement r(Source{}, expr); gen.increment_indent(); diff --git a/src/writer/spirv/builder_call_test.cc b/src/writer/spirv/builder_call_test.cc index fff29bfc88..fb83808373 100644 --- a/src/writer/spirv/builder_call_test.cc +++ b/src/writer/spirv/builder_call_test.cc @@ -49,9 +49,10 @@ TEST_F(BuilderTest, Expression_Call) { create(Source{}, "b", ast::StorageClass::kFunction, &f32)); auto* body = create(); - body->append(create(create( - ast::BinaryOp::kAdd, create("a"), - create("b")))); + body->append(create( + Source{}, create( + ast::BinaryOp::kAdd, create("a"), + create("b")))); ast::Function a_func(Source{}, "a_func", func_params, &f32, body, ast::FunctionDecorationList{}); @@ -113,9 +114,10 @@ TEST_F(BuilderTest, Statement_Call) { create(Source{}, "b", ast::StorageClass::kFunction, &f32)); auto* body = create(); - body->append(create(create( - ast::BinaryOp::kAdd, create("a"), - create("b")))); + body->append(create( + Source{}, create( + ast::BinaryOp::kAdd, create("a"), + create("b")))); ast::Function a_func(Source{}, "a_func", func_params, &void_type, body, ast::FunctionDecorationList{}); diff --git a/src/writer/spirv/builder_function_test.cc b/src/writer/spirv/builder_function_test.cc index 82de2affaf..659f3ead68 100644 --- a/src/writer/spirv/builder_function_test.cc +++ b/src/writer/spirv/builder_function_test.cc @@ -67,7 +67,7 @@ TEST_F(BuilderTest, Function_Terminator_Return) { ast::type::Void void_type; auto* body = create(); - body->append(create()); + body->append(create(Source{})); ast::Function func(Source{}, "a_func", {}, &void_type, body, ast::FunctionDecorationList{}); @@ -92,8 +92,8 @@ TEST_F(BuilderTest, Function_Terminator_ReturnValue) { td.RegisterVariableForTesting(var_a); auto* body = create(); - body->append( - create(create("a"))); + body->append(create( + Source{}, create("a"))); ASSERT_TRUE(td.DetermineResultType(body)) << td.error(); ast::Function func(Source{}, "a_func", {}, &void_type, body, @@ -153,8 +153,8 @@ TEST_F(BuilderTest, Function_WithParams) { params.push_back(var_b); auto* body = create(); - body->append( - create(create("a"))); + body->append(create( + Source{}, create("a"))); ast::Function func(Source{}, "a_func", params, &f32, body, ast::FunctionDecorationList{}); @@ -182,7 +182,7 @@ TEST_F(BuilderTest, Function_WithBody) { ast::type::Void void_type; auto* body = create(); - body->append(create()); + body->append(create(Source{})); ast::Function func(Source{}, "a_func", {}, &void_type, body, ast::FunctionDecorationList{}); @@ -282,7 +282,7 @@ TEST_F(BuilderTest, Emit_Multiple_EntryPoint_With_Same_ModuleVar) { auto* body = create(); body->append(create(var)); - body->append(create()); + body->append(create(Source{})); auto* func = create(Source{}, "a", params, &void_type, body, @@ -304,7 +304,7 @@ TEST_F(BuilderTest, Emit_Multiple_EntryPoint_With_Same_ModuleVar) { auto* body = create(); body->append(create(var)); - body->append(create()); + body->append(create(Source{})); auto* func = create(Source{}, "b", params, &void_type, body, diff --git a/src/writer/spirv/builder_if_test.cc b/src/writer/spirv/builder_if_test.cc index 4ad6d014ac..565860fc8f 100644 --- a/src/writer/spirv/builder_if_test.cc +++ b/src/writer/spirv/builder_if_test.cc @@ -549,7 +549,7 @@ TEST_F(BuilderTest, If_WithReturn) { create(&bool_type, true)); auto* if_body = create(); - if_body->append(create()); + if_body->append(create(Source{})); ast::IfStatement expr(Source{}, cond, if_body, ast::ElseStatementList{}); @@ -581,7 +581,7 @@ TEST_F(BuilderTest, If_WithReturnValue) { create(&bool_type, false)); auto* if_body = create(); - if_body->append(create(cond2)); + if_body->append(create(Source{}, cond2)); ast::IfStatement expr(Source{}, cond, if_body, ast::ElseStatementList{}); diff --git a/src/writer/spirv/builder_return_test.cc b/src/writer/spirv/builder_return_test.cc index db18f852da..91f1656e94 100644 --- a/src/writer/spirv/builder_return_test.cc +++ b/src/writer/spirv/builder_return_test.cc @@ -35,7 +35,7 @@ namespace { using BuilderTest = TestHelper; TEST_F(BuilderTest, Return) { - ast::ReturnStatement ret; + ast::ReturnStatement ret(Source{}); b.push_function(Function{}); EXPECT_TRUE(b.GenerateReturnStatement(&ret)); @@ -59,7 +59,7 @@ TEST_F(BuilderTest, Return_WithValue) { auto* val = create(&vec, vals); - ast::ReturnStatement ret(val); + ast::ReturnStatement ret(Source{}, val); EXPECT_TRUE(td.DetermineResultType(&ret)) << td.error(); @@ -83,7 +83,8 @@ TEST_F(BuilderTest, Return_WithValue_GeneratesLoad) { ast::Variable var(Source{}, "param", ast::StorageClass::kFunction, &f32); - ast::ReturnStatement ret(create("param")); + ast::ReturnStatement ret(Source{}, + create("param")); td.RegisterVariableForTesting(&var); EXPECT_TRUE(td.DetermineResultType(&ret)) << td.error(); diff --git a/src/writer/wgsl/generator_impl_function_test.cc b/src/writer/wgsl/generator_impl_function_test.cc index f93836ded5..cbc0192a29 100644 --- a/src/writer/wgsl/generator_impl_function_test.cc +++ b/src/writer/wgsl/generator_impl_function_test.cc @@ -44,7 +44,7 @@ using WgslGeneratorImplTest = TestHelper; TEST_F(WgslGeneratorImplTest, Emit_Function) { auto* body = create(); body->append(create()); - body->append(create()); + body->append(create(Source{})); ast::type::Void void_type; ast::Function func(Source{}, "my_func", {}, &void_type, body, @@ -63,7 +63,7 @@ TEST_F(WgslGeneratorImplTest, Emit_Function) { TEST_F(WgslGeneratorImplTest, Emit_Function_WithParams) { auto* body = create(); body->append(create()); - body->append(create()); + body->append(create(Source{})); ast::type::F32 f32; ast::type::I32 i32; @@ -90,7 +90,7 @@ TEST_F(WgslGeneratorImplTest, Emit_Function_WithParams) { TEST_F(WgslGeneratorImplTest, Emit_Function_WithDecoration_WorkgroupSize) { auto* body = create(); body->append(create()); - body->append(create()); + body->append(create(Source{})); ast::type::Void void_type; ast::Function func(Source{}, "my_func", {}, &void_type, body, @@ -112,7 +112,7 @@ TEST_F(WgslGeneratorImplTest, Emit_Function_WithDecoration_WorkgroupSize) { TEST_F(WgslGeneratorImplTest, Emit_Function_WithDecoration_Stage) { auto* body = create(); body->append(create()); - body->append(create()); + body->append(create(Source{})); ast::type::Void void_type; ast::Function func( @@ -135,7 +135,7 @@ TEST_F(WgslGeneratorImplTest, Emit_Function_WithDecoration_Stage) { TEST_F(WgslGeneratorImplTest, Emit_Function_WithDecoration_Multiple) { auto* body = create(); body->append(create()); - body->append(create()); + body->append(create(Source{})); ast::type::Void void_type; ast::Function func( @@ -214,7 +214,7 @@ TEST_F(WgslGeneratorImplTest, auto* body = create(); body->append(create(var)); - body->append(create()); + body->append(create(Source{})); auto* func = create(Source{}, "a", params, &void_type, body, @@ -236,7 +236,7 @@ TEST_F(WgslGeneratorImplTest, auto* body = create(); body->append(create(var)); - body->append(create()); + body->append(create(Source{})); auto* func = create(Source{}, "b", params, &void_type, body, diff --git a/src/writer/wgsl/generator_impl_return_test.cc b/src/writer/wgsl/generator_impl_return_test.cc index 51b1e78cba..12703a7bd2 100644 --- a/src/writer/wgsl/generator_impl_return_test.cc +++ b/src/writer/wgsl/generator_impl_return_test.cc @@ -29,7 +29,7 @@ namespace { using WgslGeneratorImplTest = TestHelper; TEST_F(WgslGeneratorImplTest, Emit_Return) { - ast::ReturnStatement r; + ast::ReturnStatement r(Source{}); gen.increment_indent(); @@ -39,7 +39,7 @@ TEST_F(WgslGeneratorImplTest, Emit_Return) { TEST_F(WgslGeneratorImplTest, Emit_ReturnWithValue) { auto* expr = create("expr"); - ast::ReturnStatement r(expr); + ast::ReturnStatement r(Source{}, expr); gen.increment_indent();