diff --git a/src/ast/array_accessor_expression_test.cc b/src/ast/array_accessor_expression_test.cc index d24bb4ddab..92b38fa270 100644 --- a/src/ast/array_accessor_expression_test.cc +++ b/src/ast/array_accessor_expression_test.cc @@ -27,19 +27,16 @@ TEST_F(ArrayAccessorExpressionTest, Create) { auto* ary = create("ary"); auto* idx = create("idx"); - auto* ary_ptr = ary; - auto* idx_ptr = idx; - - ArrayAccessorExpression exp(std::move(ary), std::move(idx)); - ASSERT_EQ(exp.array(), ary_ptr); - ASSERT_EQ(exp.idx_expr(), idx_ptr); + ArrayAccessorExpression exp(ary, idx); + ASSERT_EQ(exp.array(), ary); + ASSERT_EQ(exp.idx_expr(), idx); } + TEST_F(ArrayAccessorExpressionTest, CreateWithSource) { auto* ary = create("ary"); auto* idx = create("idx"); - ArrayAccessorExpression exp(Source{Source::Location{20, 2}}, std::move(ary), - std::move(idx)); + ArrayAccessorExpression exp(Source{Source::Location{20, 2}}, ary, idx); auto src = exp.source(); EXPECT_EQ(src.range.begin.line, 20u); EXPECT_EQ(src.range.begin.column, 2u); @@ -54,7 +51,7 @@ TEST_F(ArrayAccessorExpressionTest, IsValid) { auto* ary = create("ary"); auto* idx = create("idx"); - ArrayAccessorExpression exp(std::move(ary), std::move(idx)); + ArrayAccessorExpression exp(ary, idx); EXPECT_TRUE(exp.IsValid()); } @@ -62,7 +59,7 @@ TEST_F(ArrayAccessorExpressionTest, IsValid_MissingArray) { auto* idx = create("idx"); ArrayAccessorExpression exp; - exp.set_idx_expr(std::move(idx)); + exp.set_idx_expr(idx); EXPECT_FALSE(exp.IsValid()); } @@ -70,21 +67,21 @@ TEST_F(ArrayAccessorExpressionTest, IsValid_MissingIndex) { auto* ary = create("ary"); ArrayAccessorExpression exp; - exp.set_array(std::move(ary)); + exp.set_array(ary); EXPECT_FALSE(exp.IsValid()); } TEST_F(ArrayAccessorExpressionTest, IsValid_InvalidArray) { auto* ary = create(""); auto* idx = create("idx"); - ArrayAccessorExpression exp(std::move(ary), std::move(idx)); + ArrayAccessorExpression exp(ary, idx); EXPECT_FALSE(exp.IsValid()); } TEST_F(ArrayAccessorExpressionTest, IsValid_InvalidIndex) { auto* ary = create("ary"); auto* idx = create(""); - ArrayAccessorExpression exp(std::move(ary), std::move(idx)); + ArrayAccessorExpression exp(ary, idx); EXPECT_FALSE(exp.IsValid()); } @@ -92,7 +89,7 @@ TEST_F(ArrayAccessorExpressionTest, ToStr) { auto* ary = create("ary"); auto* idx = create("idx"); - ArrayAccessorExpression exp(std::move(ary), std::move(idx)); + ArrayAccessorExpression exp(ary, idx); std::ostringstream out; exp.to_str(out, 2); diff --git a/src/ast/assignment_statement_test.cc b/src/ast/assignment_statement_test.cc index 6be673e3e9..fa01c7ea6f 100644 --- a/src/ast/assignment_statement_test.cc +++ b/src/ast/assignment_statement_test.cc @@ -27,20 +27,16 @@ TEST_F(AssignmentStatementTest, Creation) { auto* lhs = create("lhs"); auto* rhs = create("rhs"); - auto* lhs_ptr = lhs; - auto* rhs_ptr = rhs; - - AssignmentStatement stmt(std::move(lhs), std::move(rhs)); - EXPECT_EQ(stmt.lhs(), lhs_ptr); - EXPECT_EQ(stmt.rhs(), rhs_ptr); + AssignmentStatement stmt(lhs, rhs); + EXPECT_EQ(stmt.lhs(), lhs); + EXPECT_EQ(stmt.rhs(), rhs); } TEST_F(AssignmentStatementTest, CreationWithSource) { auto* lhs = create("lhs"); auto* rhs = create("rhs"); - AssignmentStatement stmt(Source{Source::Location{20, 2}}, std::move(lhs), - std::move(rhs)); + AssignmentStatement stmt(Source{Source::Location{20, 2}}, lhs, rhs); auto src = stmt.source(); EXPECT_EQ(src.range.begin.line, 20u); EXPECT_EQ(src.range.begin.column, 2u); @@ -50,7 +46,7 @@ TEST_F(AssignmentStatementTest, IsAssign) { auto* lhs = create("lhs"); auto* rhs = create("rhs"); - AssignmentStatement stmt(std::move(lhs), std::move(rhs)); + AssignmentStatement stmt(lhs, rhs); EXPECT_TRUE(stmt.IsAssign()); } @@ -58,7 +54,7 @@ TEST_F(AssignmentStatementTest, IsValid) { auto* lhs = create("lhs"); auto* rhs = create("rhs"); - AssignmentStatement stmt(std::move(lhs), std::move(rhs)); + AssignmentStatement stmt(lhs, rhs); EXPECT_TRUE(stmt.IsValid()); } @@ -66,7 +62,7 @@ TEST_F(AssignmentStatementTest, IsValid_MissingLHS) { auto* rhs = create("rhs"); AssignmentStatement stmt; - stmt.set_rhs(std::move(rhs)); + stmt.set_rhs(rhs); EXPECT_FALSE(stmt.IsValid()); } @@ -74,21 +70,21 @@ TEST_F(AssignmentStatementTest, IsValid_MissingRHS) { auto* lhs = create("lhs"); AssignmentStatement stmt; - stmt.set_lhs(std::move(lhs)); + stmt.set_lhs(lhs); EXPECT_FALSE(stmt.IsValid()); } TEST_F(AssignmentStatementTest, IsValid_InvalidLHS) { auto* lhs = create(""); auto* rhs = create("rhs"); - AssignmentStatement stmt(std::move(lhs), std::move(rhs)); + AssignmentStatement stmt(lhs, rhs); EXPECT_FALSE(stmt.IsValid()); } TEST_F(AssignmentStatementTest, IsValid_InvalidRHS) { auto* lhs = create("lhs"); auto* rhs = create(""); - AssignmentStatement stmt(std::move(lhs), std::move(rhs)); + AssignmentStatement stmt(lhs, rhs); EXPECT_FALSE(stmt.IsValid()); } @@ -96,7 +92,7 @@ TEST_F(AssignmentStatementTest, ToStr) { auto* lhs = create("lhs"); auto* rhs = create("rhs"); - AssignmentStatement stmt(std::move(lhs), std::move(rhs)); + AssignmentStatement stmt(lhs, rhs); std::ostringstream out; stmt.to_str(out, 2); diff --git a/src/ast/binary_expression_test.cc b/src/ast/binary_expression_test.cc index 5648bb2c71..7727cbd6fb 100644 --- a/src/ast/binary_expression_test.cc +++ b/src/ast/binary_expression_test.cc @@ -29,12 +29,9 @@ TEST_F(BinaryExpressionTest, Creation) { auto* lhs = create("lhs"); auto* rhs = create("rhs"); - auto* lhs_ptr = lhs; - auto* rhs_ptr = rhs; - - BinaryExpression r(BinaryOp::kEqual, std::move(lhs), std::move(rhs)); - EXPECT_EQ(r.lhs(), lhs_ptr); - EXPECT_EQ(r.rhs(), rhs_ptr); + BinaryExpression r(BinaryOp::kEqual, lhs, rhs); + EXPECT_EQ(r.lhs(), lhs); + EXPECT_EQ(r.rhs(), rhs); EXPECT_EQ(r.op(), BinaryOp::kEqual); } @@ -42,8 +39,8 @@ TEST_F(BinaryExpressionTest, Creation_WithSource) { auto* lhs = create("lhs"); auto* rhs = create("rhs"); - BinaryExpression r(Source{Source::Location{20, 2}}, BinaryOp::kEqual, - std::move(lhs), std::move(rhs)); + BinaryExpression r(Source{Source::Location{20, 2}}, BinaryOp::kEqual, lhs, + rhs); auto src = r.source(); EXPECT_EQ(src.range.begin.line, 20u); EXPECT_EQ(src.range.begin.column, 2u); @@ -58,7 +55,7 @@ TEST_F(BinaryExpressionTest, IsValid) { auto* lhs = create("lhs"); auto* rhs = create("rhs"); - BinaryExpression r(BinaryOp::kEqual, std::move(lhs), std::move(rhs)); + BinaryExpression r(BinaryOp::kEqual, lhs, rhs); EXPECT_TRUE(r.IsValid()); } @@ -67,7 +64,7 @@ TEST_F(BinaryExpressionTest, IsValid_Null_LHS) { BinaryExpression r; r.set_op(BinaryOp::kEqual); - r.set_rhs(std::move(rhs)); + r.set_rhs(rhs); EXPECT_FALSE(r.IsValid()); } @@ -75,7 +72,7 @@ TEST_F(BinaryExpressionTest, IsValid_Invalid_LHS) { auto* lhs = create(""); auto* rhs = create("rhs"); - BinaryExpression r(BinaryOp::kEqual, std::move(lhs), std::move(rhs)); + BinaryExpression r(BinaryOp::kEqual, lhs, rhs); EXPECT_FALSE(r.IsValid()); } @@ -84,7 +81,7 @@ TEST_F(BinaryExpressionTest, IsValid_Null_RHS) { BinaryExpression r; r.set_op(BinaryOp::kEqual); - r.set_lhs(std::move(lhs)); + r.set_lhs(lhs); EXPECT_FALSE(r.IsValid()); } @@ -92,7 +89,7 @@ TEST_F(BinaryExpressionTest, IsValid_Invalid_RHS) { auto* lhs = create("lhs"); auto* rhs = create(""); - BinaryExpression r(BinaryOp::kEqual, std::move(lhs), std::move(rhs)); + BinaryExpression r(BinaryOp::kEqual, lhs, rhs); EXPECT_FALSE(r.IsValid()); } @@ -100,7 +97,7 @@ TEST_F(BinaryExpressionTest, IsValid_Binary_None) { auto* lhs = create("lhs"); auto* rhs = create("rhs"); - BinaryExpression r(BinaryOp::kNone, std::move(lhs), std::move(rhs)); + BinaryExpression r(BinaryOp::kNone, lhs, rhs); EXPECT_FALSE(r.IsValid()); } @@ -108,7 +105,7 @@ TEST_F(BinaryExpressionTest, ToStr) { auto* lhs = create("lhs"); auto* rhs = create("rhs"); - BinaryExpression r(BinaryOp::kEqual, std::move(lhs), std::move(rhs)); + BinaryExpression r(BinaryOp::kEqual, lhs, rhs); std::ostringstream out; r.to_str(out, 2); EXPECT_EQ(out.str(), R"( Binary[not set]{ diff --git a/src/ast/bitcast_expression_test.cc b/src/ast/bitcast_expression_test.cc index 64565d4ed0..3f02451cb3 100644 --- a/src/ast/bitcast_expression_test.cc +++ b/src/ast/bitcast_expression_test.cc @@ -28,18 +28,16 @@ TEST_F(BitcastExpressionTest, Create) { type::F32Type f32; auto* expr = create("expr"); - auto* expr_ptr = expr; - - BitcastExpression exp(&f32, std::move(expr)); + BitcastExpression exp(&f32, expr); ASSERT_EQ(exp.type(), &f32); - ASSERT_EQ(exp.expr(), expr_ptr); + ASSERT_EQ(exp.expr(), expr); } TEST_F(BitcastExpressionTest, CreateWithSource) { type::F32Type f32; auto* expr = create("expr"); - BitcastExpression exp(Source{Source::Location{20, 2}}, &f32, std::move(expr)); + BitcastExpression exp(Source{Source::Location{20, 2}}, &f32, expr); auto src = exp.source(); EXPECT_EQ(src.range.begin.line, 20u); EXPECT_EQ(src.range.begin.column, 2u); @@ -54,7 +52,7 @@ TEST_F(BitcastExpressionTest, IsValid) { type::F32Type f32; auto* expr = create("expr"); - BitcastExpression exp(&f32, std::move(expr)); + BitcastExpression exp(&f32, expr); EXPECT_TRUE(exp.IsValid()); } @@ -62,7 +60,7 @@ TEST_F(BitcastExpressionTest, IsValid_MissingType) { auto* expr = create("expr"); BitcastExpression exp; - exp.set_expr(std::move(expr)); + exp.set_expr(expr); EXPECT_FALSE(exp.IsValid()); } @@ -77,7 +75,7 @@ TEST_F(BitcastExpressionTest, IsValid_MissingExpr) { TEST_F(BitcastExpressionTest, IsValid_InvalidExpr) { type::F32Type f32; auto* expr = create(""); - BitcastExpression e(&f32, std::move(expr)); + BitcastExpression e(&f32, expr); EXPECT_FALSE(e.IsValid()); } @@ -85,7 +83,7 @@ TEST_F(BitcastExpressionTest, ToStr) { type::F32Type f32; auto* expr = create("expr"); - BitcastExpression exp(&f32, std::move(expr)); + BitcastExpression exp(&f32, expr); std::ostringstream out; exp.to_str(out, 2); diff --git a/src/ast/block_statement_test.cc b/src/ast/block_statement_test.cc index 010b7d49bf..1c25885107 100644 --- a/src/ast/block_statement_test.cc +++ b/src/ast/block_statement_test.cc @@ -32,7 +32,7 @@ TEST_F(BlockStatementTest, Creation) { auto* ptr = d; BlockStatement b; - b.append(std::move(d)); + b.append(d); ASSERT_EQ(b.size(), 1u); EXPECT_EQ(b[0], ptr); @@ -42,21 +42,18 @@ TEST_F(BlockStatementTest, Creation_WithInsert) { auto* s1 = create(); auto* s2 = create(); auto* s3 = create(); - auto* p1 = s1; - auto* p2 = s2; - auto* p3 = s3; BlockStatement b; - b.insert(0, std::move(s1)); - b.insert(0, std::move(s2)); - b.insert(1, std::move(s3)); + b.insert(0, s1); + b.insert(0, s2); + b.insert(1, s3); // |b| should contain s2, s3, s1 ASSERT_EQ(b.size(), 3u); - EXPECT_EQ(b[0], p2); - EXPECT_EQ(b[1], p3); - EXPECT_EQ(b[2], p1); + EXPECT_EQ(b[0], s2); + EXPECT_EQ(b[1], s3); + EXPECT_EQ(b[2], s1); } TEST_F(BlockStatementTest, Creation_WithSource) { diff --git a/src/ast/call_expression_test.cc b/src/ast/call_expression_test.cc index 885bc87e59..e736cb768a 100644 --- a/src/ast/call_expression_test.cc +++ b/src/ast/call_expression_test.cc @@ -29,22 +29,18 @@ TEST_F(CallExpressionTest, Creation) { params.push_back(create("param1")); params.push_back(create("param2")); - auto* func_ptr = func; - auto* param1_ptr = params[0]; - auto* param2_ptr = params[1]; - - CallExpression stmt(std::move(func), std::move(params)); - EXPECT_EQ(stmt.func(), func_ptr); + CallExpression stmt(func, params); + EXPECT_EQ(stmt.func(), func); const auto& vec = stmt.params(); ASSERT_EQ(vec.size(), 2u); - EXPECT_EQ(vec[0], param1_ptr); - EXPECT_EQ(vec[1], param2_ptr); + EXPECT_EQ(vec[0], params[0]); + EXPECT_EQ(vec[1], params[1]); } TEST_F(CallExpressionTest, Creation_WithSource) { auto* func = create("func"); - CallExpression stmt(Source{Source::Location{20, 2}}, std::move(func), {}); + CallExpression stmt(Source{Source::Location{20, 2}}, func, {}); auto src = stmt.source(); EXPECT_EQ(src.range.begin.line, 20u); EXPECT_EQ(src.range.begin.column, 2u); @@ -52,13 +48,13 @@ TEST_F(CallExpressionTest, Creation_WithSource) { TEST_F(CallExpressionTest, IsCall) { auto* func = create("func"); - CallExpression stmt(std::move(func), {}); + CallExpression stmt(func, {}); EXPECT_TRUE(stmt.IsCall()); } TEST_F(CallExpressionTest, IsValid) { auto* func = create("func"); - CallExpression stmt(std::move(func), {}); + CallExpression stmt(func, {}); EXPECT_TRUE(stmt.IsValid()); } @@ -74,7 +70,7 @@ TEST_F(CallExpressionTest, IsValid_NullParam) { params.push_back(nullptr); params.push_back(create("param2")); - CallExpression stmt(std::move(func), std::move(params)); + CallExpression stmt(func, params); EXPECT_FALSE(stmt.IsValid()); } @@ -83,7 +79,7 @@ TEST_F(CallExpressionTest, IsValid_InvalidFunction) { ExpressionList params; params.push_back(create("param1")); - CallExpression stmt(std::move(func), std::move(params)); + CallExpression stmt(func, params); EXPECT_FALSE(stmt.IsValid()); } @@ -92,13 +88,13 @@ TEST_F(CallExpressionTest, IsValid_InvalidParam) { ExpressionList params; params.push_back(create("")); - CallExpression stmt(std::move(func), std::move(params)); + CallExpression stmt(func, params); EXPECT_FALSE(stmt.IsValid()); } TEST_F(CallExpressionTest, ToStr_NoParams) { auto* func = create("func"); - CallExpression stmt(std::move(func), {}); + CallExpression stmt(func, {}); std::ostringstream out; stmt.to_str(out, 2); EXPECT_EQ(out.str(), R"( Call[not set]{ @@ -115,7 +111,7 @@ TEST_F(CallExpressionTest, ToStr_WithParams) { params.push_back(create("param1")); params.push_back(create("param2")); - CallExpression stmt(std::move(func), std::move(params)); + CallExpression stmt(func, params); std::ostringstream out; stmt.to_str(out, 2); EXPECT_EQ(out.str(), R"( Call[not set]{ diff --git a/src/ast/call_statement_test.cc b/src/ast/call_statement_test.cc index 4201fce07f..363918deb9 100644 --- a/src/ast/call_statement_test.cc +++ b/src/ast/call_statement_test.cc @@ -27,10 +27,9 @@ using CallStatementTest = TestHelper; TEST_F(CallStatementTest, Creation) { auto* expr = create( create("func"), ExpressionList{}); - auto* expr_ptr = expr; - CallStatement c(std::move(expr)); - EXPECT_EQ(c.expr(), expr_ptr); + CallStatement c(expr); + EXPECT_EQ(c.expr(), expr); } TEST_F(CallStatementTest, IsCall) { diff --git a/src/ast/case_statement_test.cc b/src/ast/case_statement_test.cc index bc87b85033..30c298e7d8 100644 --- a/src/ast/case_statement_test.cc +++ b/src/ast/case_statement_test.cc @@ -32,38 +32,36 @@ TEST_F(CaseStatementTest, Creation_i32) { ast::type::I32Type i32; CaseSelectorList b; - b.push_back(create(&i32, 2)); + auto* selector = create(&i32, 2); + b.push_back(selector); auto* body = create(); - body->append(create()); + auto* discard = create(); + body->append(discard); - auto* int_ptr = b.back(); - auto* discard_ptr = body->get(0); - - CaseStatement c(std::move(b), std::move(body)); + CaseStatement c(b, body); ASSERT_EQ(c.selectors().size(), 1u); - EXPECT_EQ(c.selectors()[0], int_ptr); + EXPECT_EQ(c.selectors()[0], selector); ASSERT_EQ(c.body()->size(), 1u); - EXPECT_EQ(c.body()->get(0), discard_ptr); + EXPECT_EQ(c.body()->get(0), discard); } TEST_F(CaseStatementTest, Creation_u32) { ast::type::U32Type u32; CaseSelectorList b; - b.push_back(create(&u32, 2)); + auto* selector = create(&u32, 2); + b.push_back(selector); auto* body = create(); - body->append(create()); + auto* discard = create(); + body->append(discard); - auto* int_ptr = b.back(); - auto* discard_ptr = body->get(0); - - CaseStatement c(std::move(b), std::move(body)); + CaseStatement c(b, body); ASSERT_EQ(c.selectors().size(), 1u); - EXPECT_EQ(c.selectors()[0], int_ptr); + EXPECT_EQ(c.selectors()[0], selector); ASSERT_EQ(c.body()->size(), 1u); - EXPECT_EQ(c.body()->get(0), discard_ptr); + EXPECT_EQ(c.body()->get(0), discard); } TEST_F(CaseStatementTest, Creation_WithSource) { @@ -74,8 +72,7 @@ TEST_F(CaseStatementTest, Creation_WithSource) { auto* body = create(); body->append(create()); - CaseStatement c(Source{Source::Location{20, 2}}, std::move(b), - std::move(body)); + CaseStatement c(Source{Source::Location{20, 2}}, b, body); auto src = c.source(); EXPECT_EQ(src.range.begin.line, 20u); EXPECT_EQ(src.range.begin.column, 2u); @@ -86,7 +83,7 @@ TEST_F(CaseStatementTest, IsDefault_WithoutSelectors) { body->append(create()); CaseStatement c(create()); - c.set_body(std::move(body)); + c.set_body(body); EXPECT_TRUE(c.IsDefault()); } @@ -96,7 +93,7 @@ TEST_F(CaseStatementTest, IsDefault_WithSelectors) { b.push_back(create(&i32, 2)); CaseStatement c(create()); - c.set_selectors(std::move(b)); + c.set_selectors(b); EXPECT_FALSE(c.IsDefault()); } @@ -119,7 +116,7 @@ TEST_F(CaseStatementTest, IsValid_NullBodyStatement) { body->append(create()); body->append(nullptr); - CaseStatement c(std::move(b), std::move(body)); + CaseStatement c(b, body); EXPECT_FALSE(c.IsValid()); } @@ -131,7 +128,7 @@ TEST_F(CaseStatementTest, IsValid_InvalidBodyStatement) { auto* body = create(); body->append(create(nullptr, create())); - CaseStatement c({std::move(b)}, std::move(body)); + CaseStatement c({b}, body); EXPECT_FALSE(c.IsValid()); } @@ -142,7 +139,7 @@ TEST_F(CaseStatementTest, ToStr_WithSelectors_i32) { auto* body = create(); body->append(create()); - CaseStatement c({std::move(b)}, std::move(body)); + CaseStatement c({b}, body); std::ostringstream out; c.to_str(out, 2); @@ -159,7 +156,7 @@ TEST_F(CaseStatementTest, ToStr_WithSelectors_u32) { auto* body = create(); body->append(create()); - CaseStatement c({std::move(b)}, std::move(body)); + CaseStatement c({b}, body); std::ostringstream out; c.to_str(out, 2); @@ -178,7 +175,7 @@ TEST_F(CaseStatementTest, ToStr_WithMultipleSelectors) { auto* body = create(); body->append(create()); - CaseStatement c(std::move(b), std::move(body)); + CaseStatement c(b, body); std::ostringstream out; c.to_str(out, 2); @@ -191,7 +188,7 @@ TEST_F(CaseStatementTest, ToStr_WithMultipleSelectors) { TEST_F(CaseStatementTest, ToStr_WithoutSelectors) { auto* body = create(); body->append(create()); - CaseStatement c(CaseSelectorList{}, std::move(body)); + CaseStatement c(CaseSelectorList{}, body); std::ostringstream out; c.to_str(out, 2); diff --git a/src/ast/decorated_variable_test.cc b/src/ast/decorated_variable_test.cc index 70f1ab7e58..f133a132b9 100644 --- a/src/ast/decorated_variable_test.cc +++ b/src/ast/decorated_variable_test.cc @@ -35,7 +35,7 @@ using DecoratedVariableTest = TestHelper; TEST_F(DecoratedVariableTest, Creation) { type::I32Type t; auto* var = create("my_var", StorageClass::kFunction, &t); - DecoratedVariable dv(std::move(var)); + DecoratedVariable dv(var); EXPECT_EQ(dv.name(), "my_var"); EXPECT_EQ(dv.storage_class(), StorageClass::kFunction); @@ -50,7 +50,7 @@ TEST_F(DecoratedVariableTest, CreationWithSource) { Source s{Source::Range{Source::Location{27, 4}, Source::Location{27, 5}}}; type::F32Type t; auto* var = create(s, "i", StorageClass::kPrivate, &t); - DecoratedVariable dv(std::move(var)); + DecoratedVariable dv(var); EXPECT_EQ(dv.name(), "i"); EXPECT_EQ(dv.storage_class(), StorageClass::kPrivate); @@ -64,7 +64,7 @@ TEST_F(DecoratedVariableTest, CreationWithSource) { TEST_F(DecoratedVariableTest, NoDecorations) { type::I32Type t; auto* var = create("my_var", StorageClass::kFunction, &t); - DecoratedVariable dv(std::move(var)); + DecoratedVariable dv(var); EXPECT_FALSE(dv.HasLocationDecoration()); EXPECT_FALSE(dv.HasBuiltinDecoration()); EXPECT_FALSE(dv.HasConstantIdDecoration()); @@ -73,14 +73,14 @@ TEST_F(DecoratedVariableTest, NoDecorations) { TEST_F(DecoratedVariableTest, WithDecorations) { type::F32Type t; auto* var = create("my_var", StorageClass::kFunction, &t); - DecoratedVariable dv(std::move(var)); + DecoratedVariable dv(var); VariableDecorationList decos; decos.push_back(create(1, Source{})); decos.push_back(create(ast::Builtin::kPosition, Source{})); decos.push_back(create(1200, Source{})); - dv.set_decorations(std::move(decos)); + dv.set_decorations(decos); EXPECT_TRUE(dv.HasLocationDecoration()); EXPECT_TRUE(dv.HasBuiltinDecoration()); @@ -90,11 +90,11 @@ TEST_F(DecoratedVariableTest, WithDecorations) { TEST_F(DecoratedVariableTest, ConstantId) { type::F32Type t; auto* var = create("my_var", StorageClass::kFunction, &t); - DecoratedVariable dv(std::move(var)); + DecoratedVariable dv(var); VariableDecorationList decos; decos.push_back(create(1200, Source{})); - dv.set_decorations(std::move(decos)); + dv.set_decorations(decos); EXPECT_EQ(dv.constant_id(), 1200u); } @@ -102,7 +102,7 @@ TEST_F(DecoratedVariableTest, ConstantId) { TEST_F(DecoratedVariableTest, IsValid) { type::I32Type t; auto* var = create("my_var", StorageClass::kNone, &t); - DecoratedVariable dv(std::move(var)); + DecoratedVariable dv(var); EXPECT_TRUE(dv.IsValid()); } @@ -114,14 +114,14 @@ TEST_F(DecoratedVariableTest, IsDecorated) { TEST_F(DecoratedVariableTest, to_str) { type::F32Type t; auto* var = create("my_var", StorageClass::kFunction, &t); - DecoratedVariable dv(std::move(var)); + DecoratedVariable dv(var); dv.set_constructor(create("expr")); VariableDecorationList decos; decos.push_back(create(2, Source{})); decos.push_back(create(1, Source{})); - dv.set_decorations(std::move(decos)); + dv.set_decorations(decos); std::ostringstream out; dv.to_str(out, 2); EXPECT_EQ(out.str(), R"( DecoratedVariable{ diff --git a/src/ast/else_statement_test.cc b/src/ast/else_statement_test.cc index b52cbec095..948a94b4cb 100644 --- a/src/ast/else_statement_test.cc +++ b/src/ast/else_statement_test.cc @@ -34,13 +34,12 @@ TEST_F(ElseStatementTest, Creation) { auto* body = create(); body->append(create()); - auto* cond_ptr = cond; - auto* discard_ptr = body->get(0); + auto* discard = body->get(0); - ElseStatement e(std::move(cond), std::move(body)); - EXPECT_EQ(e.condition(), cond_ptr); + ElseStatement e(cond, body); + EXPECT_EQ(e.condition(), cond); ASSERT_EQ(e.body()->size(), 1u); - EXPECT_EQ(e.body()->get(0), discard_ptr); + EXPECT_EQ(e.body()->get(0), discard); } TEST_F(ElseStatementTest, Creation_WithSource) { @@ -59,7 +58,7 @@ TEST_F(ElseStatementTest, HasCondition) { ast::type::BoolType bool_type; auto* cond = create( create(&bool_type, true)); - ElseStatement e(std::move(cond), create()); + ElseStatement e(cond, create()); EXPECT_TRUE(e.HasCondition()); } @@ -77,7 +76,7 @@ TEST_F(ElseStatementTest, IsValid_WithBody) { auto* body = create(); body->append(create()); - ElseStatement e(std::move(body)); + ElseStatement e(body); EXPECT_TRUE(e.IsValid()); } @@ -86,13 +85,13 @@ TEST_F(ElseStatementTest, IsValid_WithNullBodyStatement) { body->append(create()); body->append(nullptr); - ElseStatement e(std::move(body)); + ElseStatement e(body); EXPECT_FALSE(e.IsValid()); } TEST_F(ElseStatementTest, IsValid_InvalidCondition) { auto* cond = create(); - ElseStatement e(std::move(cond), create()); + ElseStatement e(cond, create()); EXPECT_FALSE(e.IsValid()); } @@ -100,7 +99,7 @@ TEST_F(ElseStatementTest, IsValid_InvalidBodyStatement) { auto* body = create(); body->append(create(nullptr, create())); - ElseStatement e(std::move(body)); + ElseStatement e(body); EXPECT_FALSE(e.IsValid()); } @@ -111,7 +110,7 @@ TEST_F(ElseStatementTest, ToStr) { auto* body = create(); body->append(create()); - ElseStatement e(std::move(cond), std::move(body)); + ElseStatement e(cond, body); std::ostringstream out; e.to_str(out, 2); EXPECT_EQ(out.str(), R"( Else{ @@ -129,7 +128,7 @@ TEST_F(ElseStatementTest, ToStr_NoCondition) { auto* body = create(); body->append(create()); - ElseStatement e(std::move(body)); + ElseStatement e(body); std::ostringstream out; e.to_str(out, 2); EXPECT_EQ(out.str(), R"( Else{ diff --git a/src/ast/function_test.cc b/src/ast/function_test.cc index 5ba7e18fb1..a305c96b1c 100644 --- a/src/ast/function_test.cc +++ b/src/ast/function_test.cc @@ -38,14 +38,13 @@ TEST_F(FunctionTest, Creation) { VariableList params; params.push_back(create("var", StorageClass::kNone, &i32)); - auto* var_ptr = params[0]; + auto* var = params[0]; - Function f("func", std::move(params), &void_type, - create()); + Function f("func", params, &void_type, create()); EXPECT_EQ(f.name(), "func"); ASSERT_EQ(f.params().size(), 1u); EXPECT_EQ(f.return_type(), &void_type); - EXPECT_EQ(f.params()[0], var_ptr); + EXPECT_EQ(f.params()[0], var); } TEST_F(FunctionTest, Creation_WithSource) { @@ -55,8 +54,8 @@ TEST_F(FunctionTest, Creation_WithSource) { VariableList params; params.push_back(create("var", StorageClass::kNone, &i32)); - Function f(Source{Source::Location{20, 2}}, "func", std::move(params), - &void_type, create()); + Function f(Source{Source::Location{20, 2}}, "func", params, &void_type, + create()); auto src = f.source(); EXPECT_EQ(src.range.begin.line, 20u); EXPECT_EQ(src.range.begin.column, 2u); @@ -86,28 +85,23 @@ TEST_F(FunctionTest, GetReferenceLocations) { type::VoidType void_type; type::I32Type i32; - VariableDecorationList decos; DecoratedVariable loc1( create("loc1", StorageClass::kInput, &i32)); - decos.push_back(create(0, Source{})); - loc1.set_decorations(std::move(decos)); + loc1.set_decorations({create(0, Source{})}); DecoratedVariable loc2( create("loc2", StorageClass::kInput, &i32)); - decos.push_back(create(1, Source{})); - loc2.set_decorations(std::move(decos)); + loc2.set_decorations({create(1, Source{})}); DecoratedVariable builtin1( create("builtin1", StorageClass::kInput, &i32)); - decos.push_back( - create(ast::Builtin::kPosition, Source{})); - builtin1.set_decorations(std::move(decos)); + builtin1.set_decorations( + {create(ast::Builtin::kPosition, Source{})}); DecoratedVariable builtin2( create("builtin2", StorageClass::kInput, &i32)); - decos.push_back( - create(ast::Builtin::kFragDepth, Source{})); - builtin2.set_decorations(std::move(decos)); + builtin2.set_decorations( + {create(ast::Builtin::kFragDepth, Source{})}); Function f("func", VariableList{}, &void_type, create()); @@ -129,28 +123,23 @@ TEST_F(FunctionTest, GetReferenceBuiltins) { type::VoidType void_type; type::I32Type i32; - VariableDecorationList decos; DecoratedVariable loc1( create("loc1", StorageClass::kInput, &i32)); - decos.push_back(create(0, Source{})); - loc1.set_decorations(std::move(decos)); + loc1.set_decorations({create(0, Source{})}); DecoratedVariable loc2( create("loc2", StorageClass::kInput, &i32)); - decos.push_back(create(1, Source{})); - loc2.set_decorations(std::move(decos)); + loc2.set_decorations({create(1, Source{})}); DecoratedVariable builtin1( create("builtin1", StorageClass::kInput, &i32)); - decos.push_back( - create(ast::Builtin::kPosition, Source{})); - builtin1.set_decorations(std::move(decos)); + builtin1.set_decorations( + {create(ast::Builtin::kPosition, Source{})}); DecoratedVariable builtin2( create("builtin2", StorageClass::kInput, &i32)); - decos.push_back( - create(ast::Builtin::kFragDepth, Source{})); - builtin2.set_decorations(std::move(decos)); + builtin2.set_decorations( + {create(ast::Builtin::kFragDepth, Source{})}); Function f("func", VariableList{}, &void_type, create()); @@ -191,9 +180,8 @@ TEST_F(FunctionTest, IsValid) { auto* block = create(); block->append(create()); - Function f("func", std::move(params), &void_type, - create()); - f.set_body(std::move(block)); + Function f("func", params, &void_type, create()); + f.set_body(block); EXPECT_TRUE(f.IsValid()); } @@ -204,7 +192,7 @@ TEST_F(FunctionTest, IsValid_EmptyName) { VariableList params; params.push_back(create("var", StorageClass::kNone, &i32)); - Function f("", std::move(params), &void_type, create()); + Function f("", params, &void_type, create()); EXPECT_FALSE(f.IsValid()); } @@ -214,7 +202,7 @@ TEST_F(FunctionTest, IsValid_MissingReturnType) { VariableList params; params.push_back(create("var", StorageClass::kNone, &i32)); - Function f("func", std::move(params), nullptr, create()); + Function f("func", params, nullptr, create()); EXPECT_FALSE(f.IsValid()); } @@ -226,8 +214,7 @@ TEST_F(FunctionTest, IsValid_NullParam) { params.push_back(create("var", StorageClass::kNone, &i32)); params.push_back(nullptr); - Function f("func", std::move(params), &void_type, - create()); + Function f("func", params, &void_type, create()); EXPECT_FALSE(f.IsValid()); } @@ -237,8 +224,7 @@ TEST_F(FunctionTest, IsValid_InvalidParam) { VariableList params; params.push_back(create("var", StorageClass::kNone, nullptr)); - Function f("func", std::move(params), &void_type, - create()); + Function f("func", params, &void_type, create()); EXPECT_FALSE(f.IsValid()); } @@ -253,9 +239,8 @@ TEST_F(FunctionTest, IsValid_NullBodyStatement) { block->append(create()); block->append(nullptr); - Function f("func", std::move(params), &void_type, - create()); - f.set_body(std::move(block)); + Function f("func", params, &void_type, create()); + f.set_body(block); EXPECT_FALSE(f.IsValid()); } @@ -270,9 +255,8 @@ TEST_F(FunctionTest, IsValid_InvalidBodyStatement) { block->append(create()); block->append(nullptr); - Function f("func", std::move(params), &void_type, - create()); - f.set_body(std::move(block)); + Function f("func", params, &void_type, create()); + f.set_body(block); EXPECT_FALSE(f.IsValid()); } @@ -284,7 +268,7 @@ TEST_F(FunctionTest, ToStr) { block->append(create()); Function f("func", {}, &void_type, create()); - f.set_body(std::move(block)); + f.set_body(block); std::ostringstream out; f.to_str(out, 2); @@ -304,7 +288,7 @@ TEST_F(FunctionTest, ToStr_WithDecoration) { block->append(create()); Function f("func", {}, &void_type, create()); - f.set_body(std::move(block)); + f.set_body(block); f.add_decoration(create(2, 4, 6, Source{})); std::ostringstream out; @@ -328,9 +312,8 @@ TEST_F(FunctionTest, ToStr_WithParams) { auto* block = create(); block->append(create()); - Function f("func", std::move(params), &void_type, - create()); - f.set_body(std::move(block)); + Function f("func", params, &void_type, create()); + f.set_body(block); std::ostringstream out; f.to_str(out, 2); @@ -364,8 +347,7 @@ TEST_F(FunctionTest, TypeName_WithParams) { params.push_back(create("var1", StorageClass::kNone, &i32)); params.push_back(create("var2", StorageClass::kNone, &f32)); - Function f("func", std::move(params), &void_type, - create()); + Function f("func", params, &void_type, create()); EXPECT_EQ(f.type_name(), "__func__void__i32__f32"); } @@ -375,13 +357,11 @@ TEST_F(FunctionTest, GetLastStatement) { VariableList params; auto* body = create(); auto* stmt = create(); - auto* stmt_ptr = stmt; - body->append(std::move(stmt)); - Function f("func", std::move(params), &void_type, - create()); - f.set_body(std::move(body)); + body->append(stmt); + Function f("func", params, &void_type, create()); + f.set_body(body); - EXPECT_EQ(f.get_last_statement(), stmt_ptr); + EXPECT_EQ(f.get_last_statement(), stmt); } TEST_F(FunctionTest, GetLastStatement_nullptr) { @@ -389,9 +369,8 @@ TEST_F(FunctionTest, GetLastStatement_nullptr) { VariableList params; auto* body = create(); - Function f("func", std::move(params), &void_type, - create()); - f.set_body(std::move(body)); + Function f("func", params, &void_type, create()); + f.set_body(body); EXPECT_EQ(f.get_last_statement(), nullptr); } diff --git a/src/ast/if_statement_test.cc b/src/ast/if_statement_test.cc index a37afe3c87..5c6d04d4af 100644 --- a/src/ast/if_statement_test.cc +++ b/src/ast/if_statement_test.cc @@ -27,15 +27,13 @@ using IfStatementTest = TestHelper; TEST_F(IfStatementTest, Creation) { auto* cond = create("cond"); auto* body = create(); - body->append(create()); + auto* discard = create(); + body->append(discard); - auto* cond_ptr = cond; - auto* stmt_ptr = body->get(0); - - IfStatement stmt(std::move(cond), std::move(body)); - EXPECT_EQ(stmt.condition(), cond_ptr); + IfStatement stmt(cond, body); + EXPECT_EQ(stmt.condition(), cond); ASSERT_EQ(stmt.body()->size(), 1u); - EXPECT_EQ(stmt.body()->get(0), stmt_ptr); + EXPECT_EQ(stmt.body()->get(0), discard); } TEST_F(IfStatementTest, Creation_WithSource) { @@ -43,8 +41,7 @@ TEST_F(IfStatementTest, Creation_WithSource) { auto* body = create(); body->append(create()); - IfStatement stmt(Source{Source::Location{20, 2}}, std::move(cond), - std::move(body)); + IfStatement stmt(Source{Source::Location{20, 2}}, cond, body); auto src = stmt.source(); EXPECT_EQ(src.range.begin.line, 20u); EXPECT_EQ(src.range.begin.column, 2u); @@ -60,7 +57,7 @@ TEST_F(IfStatementTest, IsValid) { auto* body = create(); body->append(create()); - IfStatement stmt(std::move(cond), std::move(body)); + IfStatement stmt(cond, body); EXPECT_TRUE(stmt.IsValid()); } @@ -74,8 +71,8 @@ TEST_F(IfStatementTest, IsValid_WithElseStatements) { else_stmts[0]->set_condition(create("Ident")); else_stmts.push_back(create(create())); - IfStatement stmt(std::move(cond), std::move(body)); - stmt.set_else_statements(std::move(else_stmts)); + IfStatement stmt(cond, body); + stmt.set_else_statements(else_stmts); EXPECT_TRUE(stmt.IsValid()); } @@ -83,7 +80,7 @@ TEST_F(IfStatementTest, IsValid_MissingCondition) { auto* body = create(); body->append(create()); - IfStatement stmt(nullptr, std::move(body)); + IfStatement stmt(nullptr, body); EXPECT_FALSE(stmt.IsValid()); } @@ -92,7 +89,7 @@ TEST_F(IfStatementTest, IsValid_InvalidCondition) { auto* body = create(); body->append(create()); - IfStatement stmt(std::move(cond), std::move(body)); + IfStatement stmt(cond, body); EXPECT_FALSE(stmt.IsValid()); } @@ -102,7 +99,7 @@ TEST_F(IfStatementTest, IsValid_NullBodyStatement) { body->append(create()); body->append(nullptr); - IfStatement stmt(std::move(cond), std::move(body)); + IfStatement stmt(cond, body); EXPECT_FALSE(stmt.IsValid()); } @@ -112,7 +109,7 @@ TEST_F(IfStatementTest, IsValid_InvalidBodyStatement) { body->append(create()); body->append(create(nullptr, create())); - IfStatement stmt(std::move(cond), std::move(body)); + IfStatement stmt(cond, body); EXPECT_FALSE(stmt.IsValid()); } @@ -127,8 +124,8 @@ TEST_F(IfStatementTest, IsValid_NullElseStatement) { else_stmts.push_back(create(create())); else_stmts.push_back(nullptr); - IfStatement stmt(std::move(cond), std::move(body)); - stmt.set_else_statements(std::move(else_stmts)); + IfStatement stmt(cond, body); + stmt.set_else_statements(else_stmts); EXPECT_FALSE(stmt.IsValid()); } @@ -141,8 +138,8 @@ TEST_F(IfStatementTest, IsValid_InvalidElseStatement) { else_stmts.push_back(create(create())); else_stmts[0]->set_condition(create("")); - IfStatement stmt(std::move(cond), std::move(body)); - stmt.set_else_statements(std::move(else_stmts)); + IfStatement stmt(cond, body); + stmt.set_else_statements(else_stmts); EXPECT_FALSE(stmt.IsValid()); } @@ -155,8 +152,8 @@ TEST_F(IfStatementTest, IsValid_MultipleElseWiththoutCondition) { else_stmts.push_back(create(create())); else_stmts.push_back(create(create())); - IfStatement stmt(std::move(cond), std::move(body)); - stmt.set_else_statements(std::move(else_stmts)); + IfStatement stmt(cond, body); + stmt.set_else_statements(else_stmts); EXPECT_FALSE(stmt.IsValid()); } @@ -170,8 +167,8 @@ TEST_F(IfStatementTest, IsValid_ElseNotLast) { else_stmts.push_back(create(create())); else_stmts[1]->set_condition(create("ident")); - IfStatement stmt(std::move(cond), std::move(body)); - stmt.set_else_statements(std::move(else_stmts)); + IfStatement stmt(cond, body); + stmt.set_else_statements(else_stmts); EXPECT_FALSE(stmt.IsValid()); } @@ -180,7 +177,7 @@ TEST_F(IfStatementTest, ToStr) { auto* body = create(); body->append(create()); - IfStatement stmt(std::move(cond), std::move(body)); + IfStatement stmt(cond, body); std::ostringstream out; stmt.to_str(out, 2); @@ -210,12 +207,12 @@ TEST_F(IfStatementTest, ToStr_WithElseStatements) { ElseStatementList else_stmts; else_stmts.push_back(create(create())); else_stmts[0]->set_condition(create("ident")); - else_stmts[0]->set_body(std::move(else_if_body)); + else_stmts[0]->set_body(else_if_body); else_stmts.push_back(create(create())); - else_stmts[1]->set_body(std::move(else_body)); + else_stmts[1]->set_body(else_body); - IfStatement stmt(std::move(cond), std::move(body)); - stmt.set_else_statements(std::move(else_stmts)); + IfStatement stmt(cond, body); + stmt.set_else_statements(else_stmts); std::ostringstream out; stmt.to_str(out, 2); diff --git a/src/ast/loop_statement_test.cc b/src/ast/loop_statement_test.cc index e8ce319c78..6e242e33ea 100644 --- a/src/ast/loop_statement_test.cc +++ b/src/ast/loop_statement_test.cc @@ -30,17 +30,16 @@ using LoopStatementTest = TestHelper; TEST_F(LoopStatementTest, Creation) { auto* body = create(); body->append(create()); - auto* b_ptr = body->last(); + auto* b = body->last(); auto* continuing = create(); continuing->append(create()); - auto* c_ptr = continuing->last(); - LoopStatement l(std::move(body), std::move(continuing)); + LoopStatement l(body, continuing); ASSERT_EQ(l.body()->size(), 1u); - EXPECT_EQ(l.body()->get(0), b_ptr); + EXPECT_EQ(l.body()->get(0), b); ASSERT_EQ(l.continuing()->size(), 1u); - EXPECT_EQ(l.continuing()->get(0), c_ptr); + EXPECT_EQ(l.continuing()->get(0), continuing->last()); } TEST_F(LoopStatementTest, Creation_WithSource) { @@ -50,8 +49,7 @@ TEST_F(LoopStatementTest, Creation_WithSource) { auto* continuing = create(); continuing->append(create()); - LoopStatement l(Source{Source::Location{20, 2}}, std::move(body), - std::move(continuing)); + LoopStatement l(Source{Source::Location{20, 2}}, body, continuing); auto src = l.source(); EXPECT_EQ(src.range.begin.line, 20u); EXPECT_EQ(src.range.begin.column, 2u); @@ -66,7 +64,7 @@ TEST_F(LoopStatementTest, HasContinuing_WithoutContinuing) { auto* body = create(); body->append(create()); - LoopStatement l(std::move(body), {}); + LoopStatement l(body, {}); EXPECT_FALSE(l.has_continuing()); } @@ -77,7 +75,7 @@ TEST_F(LoopStatementTest, HasContinuing_WithContinuing) { auto* continuing = create(); continuing->append(create()); - LoopStatement l(std::move(body), std::move(continuing)); + LoopStatement l(body, continuing); EXPECT_TRUE(l.has_continuing()); } @@ -88,7 +86,7 @@ TEST_F(LoopStatementTest, IsValid) { auto* continuing = create(); continuing->append(create()); - LoopStatement l(std::move(body), std::move(continuing)); + LoopStatement l(body, continuing); EXPECT_TRUE(l.IsValid()); } @@ -96,7 +94,7 @@ TEST_F(LoopStatementTest, IsValid_WithoutContinuing) { auto* body = create(); body->append(create()); - LoopStatement l(std::move(body), create()); + LoopStatement l(body, create()); EXPECT_TRUE(l.IsValid()); } @@ -113,7 +111,7 @@ TEST_F(LoopStatementTest, IsValid_NullBodyStatement) { auto* continuing = create(); continuing->append(create()); - LoopStatement l(std::move(body), std::move(continuing)); + LoopStatement l(body, continuing); EXPECT_FALSE(l.IsValid()); } @@ -125,7 +123,7 @@ TEST_F(LoopStatementTest, IsValid_InvalidBodyStatement) { auto* continuing = create(); continuing->append(create()); - LoopStatement l(std::move(body), std::move(continuing)); + LoopStatement l(body, continuing); EXPECT_FALSE(l.IsValid()); } @@ -137,7 +135,7 @@ TEST_F(LoopStatementTest, IsValid_NullContinuingStatement) { continuing->append(create()); continuing->append(nullptr); - LoopStatement l(std::move(body), std::move(continuing)); + LoopStatement l(body, continuing); EXPECT_FALSE(l.IsValid()); } @@ -149,7 +147,7 @@ TEST_F(LoopStatementTest, IsValid_InvalidContinuingStatement) { continuing->append(create()); continuing->append(create(nullptr, create())); - LoopStatement l(std::move(body), std::move(continuing)); + LoopStatement l(body, continuing); EXPECT_FALSE(l.IsValid()); } @@ -157,7 +155,7 @@ TEST_F(LoopStatementTest, ToStr) { auto* body = create(); body->append(create()); - LoopStatement l(std::move(body), {}); + LoopStatement l(body, {}); std::ostringstream out; l.to_str(out, 2); EXPECT_EQ(out.str(), R"( Loop{ @@ -173,7 +171,7 @@ TEST_F(LoopStatementTest, ToStr_WithContinuing) { auto* continuing = create(); continuing->append(create()); - LoopStatement l(std::move(body), std::move(continuing)); + LoopStatement l(body, continuing); std::ostringstream out; l.to_str(out, 2); EXPECT_EQ(out.str(), R"( Loop{ diff --git a/src/ast/member_accessor_expression_test.cc b/src/ast/member_accessor_expression_test.cc index 78c06ff3c6..756f65f855 100644 --- a/src/ast/member_accessor_expression_test.cc +++ b/src/ast/member_accessor_expression_test.cc @@ -29,20 +29,16 @@ TEST_F(MemberAccessorExpressionTest, Creation) { auto* str = create("structure"); auto* mem = create("member"); - auto* str_ptr = str; - auto* mem_ptr = mem; - - MemberAccessorExpression stmt(std::move(str), std::move(mem)); - EXPECT_EQ(stmt.structure(), str_ptr); - EXPECT_EQ(stmt.member(), mem_ptr); + MemberAccessorExpression stmt(str, mem); + EXPECT_EQ(stmt.structure(), str); + EXPECT_EQ(stmt.member(), mem); } TEST_F(MemberAccessorExpressionTest, Creation_WithSource) { auto* str = create("structure"); auto* mem = create("member"); - MemberAccessorExpression stmt(Source{Source::Location{20, 2}}, std::move(str), - std::move(mem)); + MemberAccessorExpression stmt(Source{Source::Location{20, 2}}, str, mem); auto src = stmt.source(); EXPECT_EQ(src.range.begin.line, 20u); EXPECT_EQ(src.range.begin.column, 2u); @@ -57,7 +53,7 @@ TEST_F(MemberAccessorExpressionTest, IsValid) { auto* str = create("structure"); auto* mem = create("member"); - MemberAccessorExpression stmt(std::move(str), std::move(mem)); + MemberAccessorExpression stmt(str, mem); EXPECT_TRUE(stmt.IsValid()); } @@ -65,7 +61,7 @@ TEST_F(MemberAccessorExpressionTest, IsValid_NullStruct) { auto* mem = create("member"); MemberAccessorExpression stmt; - stmt.set_member(std::move(mem)); + stmt.set_member(mem); EXPECT_FALSE(stmt.IsValid()); } @@ -73,7 +69,7 @@ TEST_F(MemberAccessorExpressionTest, IsValid_InvalidStruct) { auto* str = create(""); auto* mem = create("member"); - MemberAccessorExpression stmt(std::move(str), std::move(mem)); + MemberAccessorExpression stmt(str, mem); EXPECT_FALSE(stmt.IsValid()); } @@ -81,7 +77,7 @@ TEST_F(MemberAccessorExpressionTest, IsValid_NullMember) { auto* str = create("structure"); MemberAccessorExpression stmt; - stmt.set_structure(std::move(str)); + stmt.set_structure(str); EXPECT_FALSE(stmt.IsValid()); } @@ -89,7 +85,7 @@ TEST_F(MemberAccessorExpressionTest, IsValid_InvalidMember) { auto* str = create("structure"); auto* mem = create(""); - MemberAccessorExpression stmt(std::move(str), std::move(mem)); + MemberAccessorExpression stmt(str, mem); EXPECT_FALSE(stmt.IsValid()); } @@ -97,7 +93,7 @@ TEST_F(MemberAccessorExpressionTest, ToStr) { auto* str = create("structure"); auto* mem = create("member"); - MemberAccessorExpression stmt(std::move(str), std::move(mem)); + MemberAccessorExpression stmt(str, mem); std::ostringstream out; stmt.to_str(out, 2); EXPECT_EQ(out.str(), R"( MemberAccessor[not set]{ diff --git a/src/ast/module_test.cc b/src/ast/module_test.cc index 5a55874a53..f52f9d6b06 100644 --- a/src/ast/module_test.cc +++ b/src/ast/module_test.cc @@ -49,10 +49,9 @@ TEST_F(ModuleTest, LookupFunction) { Module m; auto* func = create("main", VariableList{}, &f32, - create()); - auto* func_ptr = func; - m.AddFunction(std::move(func)); - EXPECT_EQ(func_ptr, m.FindFunctionByName("main")); + create()); + m.AddFunction(func); + EXPECT_EQ(func, m.FindFunctionByName("main")); } TEST_F(ModuleTest, LookupFunctionMissing) { @@ -70,7 +69,7 @@ TEST_F(ModuleTest, IsValid_GlobalVariable) { auto* var = create("var", StorageClass::kInput, &f32); Module m; - m.AddGlobalVariable(std::move(var)); + m.AddGlobalVariable(var); EXPECT_TRUE(m.IsValid()); } @@ -84,7 +83,7 @@ TEST_F(ModuleTest, IsValid_Invalid_GlobalVariable) { auto* var = create("var", StorageClass::kInput, nullptr); Module m; - m.AddGlobalVariable(std::move(var)); + m.AddGlobalVariable(var); EXPECT_FALSE(m.IsValid()); } @@ -126,10 +125,10 @@ TEST_F(ModuleTest, IsValid_Struct_EmptyName) { TEST_F(ModuleTest, IsValid_Function) { type::F32Type f32; auto* func = create("main", VariableList(), &f32, - create()); + create()); Module m; - m.AddFunction(std::move(func)); + m.AddFunction(func); EXPECT_TRUE(m.IsValid()); } @@ -143,7 +142,7 @@ TEST_F(ModuleTest, IsValid_Invalid_Function) { auto* func = create(); Module m; - m.AddFunction(std::move(func)); + m.AddFunction(func); EXPECT_FALSE(m.IsValid()); } diff --git a/src/ast/return_statement_test.cc b/src/ast/return_statement_test.cc index e883177f33..42261c4989 100644 --- a/src/ast/return_statement_test.cc +++ b/src/ast/return_statement_test.cc @@ -27,10 +27,9 @@ using ReturnStatementTest = TestHelper; TEST_F(ReturnStatementTest, Creation) { auto* expr = create("expr"); - auto* expr_ptr = expr; - ReturnStatement r(std::move(expr)); - EXPECT_EQ(r.value(), expr_ptr); + ReturnStatement r(expr); + EXPECT_EQ(r.value(), expr); } TEST_F(ReturnStatementTest, Creation_WithSource) { @@ -52,7 +51,7 @@ TEST_F(ReturnStatementTest, HasValue_WithoutValue) { TEST_F(ReturnStatementTest, HasValue_WithValue) { auto* expr = create("expr"); - ReturnStatement r(std::move(expr)); + ReturnStatement r(expr); EXPECT_TRUE(r.has_value()); } @@ -63,19 +62,19 @@ TEST_F(ReturnStatementTest, IsValid_WithoutValue) { TEST_F(ReturnStatementTest, IsValid_WithValue) { auto* expr = create("expr"); - ReturnStatement r(std::move(expr)); + ReturnStatement r(expr); EXPECT_TRUE(r.IsValid()); } TEST_F(ReturnStatementTest, IsValid_InvalidValue) { auto* expr = create(""); - ReturnStatement r(std::move(expr)); + ReturnStatement r(expr); EXPECT_FALSE(r.IsValid()); } TEST_F(ReturnStatementTest, ToStr_WithValue) { auto* expr = create("expr"); - ReturnStatement r(std::move(expr)); + ReturnStatement r(expr); std::ostringstream out; r.to_str(out, 2); EXPECT_EQ(out.str(), R"( Return{ diff --git a/src/ast/scalar_constructor_expression_test.cc b/src/ast/scalar_constructor_expression_test.cc index b1525c0156..61f1bd269e 100644 --- a/src/ast/scalar_constructor_expression_test.cc +++ b/src/ast/scalar_constructor_expression_test.cc @@ -27,15 +27,14 @@ using ScalarConstructorExpressionTest = TestHelper; TEST_F(ScalarConstructorExpressionTest, Creation) { ast::type::BoolType bool_type; auto* b = create(&bool_type, true); - auto* b_ptr = b; - ScalarConstructorExpression c(std::move(b)); - EXPECT_EQ(c.literal(), b_ptr); + ScalarConstructorExpression c(b); + EXPECT_EQ(c.literal(), b); } TEST_F(ScalarConstructorExpressionTest, Creation_WithSource) { ast::type::BoolType bool_type; auto* b = create(&bool_type, true); - ScalarConstructorExpression c(Source{Source::Location{20, 2}}, std::move(b)); + ScalarConstructorExpression c(Source{Source::Location{20, 2}}, b); auto src = c.source(); EXPECT_EQ(src.range.begin.line, 20u); EXPECT_EQ(src.range.begin.column, 2u); @@ -44,7 +43,7 @@ TEST_F(ScalarConstructorExpressionTest, Creation_WithSource) { TEST_F(ScalarConstructorExpressionTest, IsValid) { ast::type::BoolType bool_type; auto* b = create(&bool_type, true); - ScalarConstructorExpression c(std::move(b)); + ScalarConstructorExpression c(b); EXPECT_TRUE(c.IsValid()); } @@ -56,7 +55,7 @@ TEST_F(ScalarConstructorExpressionTest, IsValid_MissingLiteral) { TEST_F(ScalarConstructorExpressionTest, ToStr) { ast::type::BoolType bool_type; auto* b = create(&bool_type, true); - ScalarConstructorExpression c(std::move(b)); + ScalarConstructorExpression c(b); std::ostringstream out; c.to_str(out, 2); EXPECT_EQ(out.str(), R"( ScalarConstructor[not set]{true} diff --git a/src/ast/struct_member_test.cc b/src/ast/struct_member_test.cc index 4981a2c837..a7fe388713 100644 --- a/src/ast/struct_member_test.cc +++ b/src/ast/struct_member_test.cc @@ -32,7 +32,7 @@ TEST_F(StructMemberTest, Creation) { StructMemberDecorationList decorations; decorations.emplace_back(create(4, Source{})); - StructMember st{"a", &i32, std::move(decorations)}; + StructMember st{"a", &i32, decorations}; EXPECT_EQ(st.name(), "a"); EXPECT_EQ(st.type(), &i32); EXPECT_EQ(st.decorations().size(), 1u); @@ -80,7 +80,7 @@ TEST_F(StructMemberTest, IsValid_Null_Decoration) { decorations.emplace_back(create(4, Source{})); decorations.push_back(nullptr); - StructMember st{"a", &i32, std::move(decorations)}; + StructMember st{"a", &i32, decorations}; EXPECT_FALSE(st.IsValid()); } @@ -89,7 +89,7 @@ TEST_F(StructMemberTest, ToStr) { StructMemberDecorationList decorations; decorations.emplace_back(create(4, Source{})); - StructMember st{"a", &i32, std::move(decorations)}; + StructMember st{"a", &i32, decorations}; std::ostringstream out; st.to_str(out, 2); EXPECT_EQ(out.str(), " StructMember{[[ offset 4 ]] a: __i32}\n"); diff --git a/src/ast/switch_statement_test.cc b/src/ast/switch_statement_test.cc index 66dcd20c55..49427cfb9e 100644 --- a/src/ast/switch_statement_test.cc +++ b/src/ast/switch_statement_test.cc @@ -36,22 +36,19 @@ TEST_F(SwitchStatementTest, Creation) { auto* ident = create("ident"); CaseStatementList body; - body.push_back( - create(std::move(lit), create())); + auto* case_stmt = create(lit, create()); + body.push_back(case_stmt); - auto* ident_ptr = ident; - auto* case_ptr = body[0]; - - SwitchStatement stmt(std::move(ident), std::move(body)); - EXPECT_EQ(stmt.condition(), ident_ptr); + SwitchStatement stmt(ident, body); + EXPECT_EQ(stmt.condition(), ident); ASSERT_EQ(stmt.body().size(), 1u); - EXPECT_EQ(stmt.body()[0], case_ptr); + EXPECT_EQ(stmt.body()[0], case_stmt); } TEST_F(SwitchStatementTest, Creation_WithSource) { auto* ident = create("ident"); - SwitchStatement stmt(Source{Source::Location{20, 2}}, std::move(ident), + SwitchStatement stmt(Source{Source::Location{20, 2}}, ident, CaseStatementList()); auto src = stmt.source(); EXPECT_EQ(src.range.begin.line, 20u); @@ -71,10 +68,9 @@ TEST_F(SwitchStatementTest, IsValid) { auto* ident = create("ident"); CaseStatementList body; - body.push_back( - create(std::move(lit), create())); + body.push_back(create(lit, create())); - SwitchStatement stmt(std::move(ident), std::move(body)); + SwitchStatement stmt(ident, body); EXPECT_TRUE(stmt.IsValid()); } @@ -85,11 +81,10 @@ TEST_F(SwitchStatementTest, IsValid_Null_Condition) { lit.push_back(create(&i32, 2)); CaseStatementList body; - body.push_back( - create(std::move(lit), create())); + body.push_back(create(lit, create())); SwitchStatement stmt; - stmt.set_body(std::move(body)); + stmt.set_body(body); EXPECT_FALSE(stmt.IsValid()); } @@ -101,10 +96,9 @@ TEST_F(SwitchStatementTest, IsValid_Invalid_Condition) { auto* ident = create(""); CaseStatementList body; - body.push_back( - create(std::move(lit), create())); + body.push_back(create(lit, create())); - SwitchStatement stmt(std::move(ident), std::move(body)); + SwitchStatement stmt(ident, body); EXPECT_FALSE(stmt.IsValid()); } @@ -116,11 +110,10 @@ TEST_F(SwitchStatementTest, IsValid_Null_BodyStatement) { auto* ident = create("ident"); CaseStatementList body; - body.push_back( - create(std::move(lit), create())); + body.push_back(create(lit, create())); body.push_back(nullptr); - SwitchStatement stmt(std::move(ident), std::move(body)); + SwitchStatement stmt(ident, body); EXPECT_FALSE(stmt.IsValid()); } @@ -131,17 +124,16 @@ TEST_F(SwitchStatementTest, IsValid_Invalid_BodyStatement) { case_body->append(nullptr); CaseStatementList body; - body.push_back( - create(CaseSelectorList{}, std::move(case_body))); + body.push_back(create(CaseSelectorList{}, case_body)); - SwitchStatement stmt(std::move(ident), std::move(body)); + SwitchStatement stmt(ident, body); EXPECT_FALSE(stmt.IsValid()); } TEST_F(SwitchStatementTest, ToStr_Empty) { auto* ident = create("ident"); - SwitchStatement stmt(std::move(ident), {}); + SwitchStatement stmt(ident, {}); std::ostringstream out; stmt.to_str(out, 2); EXPECT_EQ(out.str(), R"( Switch{ @@ -160,10 +152,9 @@ TEST_F(SwitchStatementTest, ToStr) { auto* ident = create("ident"); CaseStatementList body; - body.push_back( - create(std::move(lit), create())); + body.push_back(create(lit, create())); - SwitchStatement stmt(std::move(ident), std::move(body)); + SwitchStatement stmt(ident, body); std::ostringstream out; stmt.to_str(out, 2); EXPECT_EQ(out.str(), R"( Switch{ diff --git a/src/ast/type/access_control_type_test.cc b/src/ast/type/access_control_type_test.cc index 748114bd7f..ba63f63edb 100644 --- a/src/ast/type/access_control_type_test.cc +++ b/src/ast/type/access_control_type_test.cc @@ -103,7 +103,7 @@ TEST_F(AccessControlTypeTest, MinBufferBindingSizeArray) { ArrayType array(&u32, 4); ArrayDecorationList decos; decos.push_back(create(4, Source{})); - array.set_decorations(std::move(decos)); + array.set_decorations(decos); AccessControlType at{AccessControl::kReadOnly, &array}; EXPECT_EQ(16u, at.MinBufferBindingSize(MemoryLayout::kUniformBuffer)); } @@ -113,7 +113,7 @@ TEST_F(AccessControlTypeTest, MinBufferBindingSizeRuntimeArray) { ArrayType array(&u32); ArrayDecorationList decos; decos.push_back(create(4, Source{})); - array.set_decorations(std::move(decos)); + array.set_decorations(decos); AccessControlType at{AccessControl::kReadOnly, &array}; EXPECT_EQ(4u, at.MinBufferBindingSize(MemoryLayout::kUniformBuffer)); } @@ -124,16 +124,16 @@ TEST_F(AccessControlTypeTest, MinBufferBindingSizeStruct) { StructMemberDecorationList deco; deco.push_back(create(0, Source{})); - members.push_back(create("foo", &u32, std::move(deco))); + members.push_back(create("foo", &u32, deco)); deco = StructMemberDecorationList(); deco.push_back(create(4, Source{})); - members.push_back(create("bar", &u32, std::move(deco))); + members.push_back(create("bar", &u32, deco)); ast::StructDecorationList decos; - auto* str = create(std::move(decos), std::move(members)); - StructType struct_type("struct_type", std::move(str)); + auto* str = create(decos, members); + StructType struct_type("struct_type", str); AccessControlType at{AccessControl::kReadOnly, &struct_type}; EXPECT_EQ(16u, at.MinBufferBindingSize(MemoryLayout::kUniformBuffer)); EXPECT_EQ(8u, at.MinBufferBindingSize(MemoryLayout::kStorageBuffer)); @@ -150,7 +150,7 @@ TEST_F(AccessControlTypeTest, BaseAlignmentArray) { ArrayType array(&u32, 4); ArrayDecorationList decos; decos.push_back(create(4, Source{})); - array.set_decorations(std::move(decos)); + array.set_decorations(decos); AccessControlType at{AccessControl::kReadOnly, &array}; EXPECT_EQ(16u, at.BaseAlignment(MemoryLayout::kUniformBuffer)); } @@ -160,7 +160,7 @@ TEST_F(AccessControlTypeTest, BaseAlignmentRuntimeArray) { ArrayType array(&u32); ArrayDecorationList decos; decos.push_back(create(4, Source{})); - array.set_decorations(std::move(decos)); + array.set_decorations(decos); AccessControlType at{AccessControl::kReadOnly, &array}; EXPECT_EQ(16u, at.BaseAlignment(MemoryLayout::kUniformBuffer)); } @@ -172,17 +172,17 @@ TEST_F(AccessControlTypeTest, BaseAlignmentStruct) { { StructMemberDecorationList deco; deco.push_back(create(0, Source{})); - members.push_back(create("foo", &u32, std::move(deco))); + members.push_back(create("foo", &u32, deco)); } { StructMemberDecorationList deco; deco.push_back(create(4, Source{})); - members.push_back(create("bar", &u32, std::move(deco))); + members.push_back(create("bar", &u32, deco)); } ast::StructDecorationList decos; - auto* str = create(std::move(decos), std::move(members)); - StructType struct_type("struct_type", std::move(str)); + auto* str = create(decos, members); + StructType struct_type("struct_type", str); AccessControlType at{AccessControl::kReadOnly, &struct_type}; EXPECT_EQ(16u, at.BaseAlignment(MemoryLayout::kUniformBuffer)); EXPECT_EQ(4u, at.BaseAlignment(MemoryLayout::kStorageBuffer)); diff --git a/src/ast/type/alias_type_test.cc b/src/ast/type/alias_type_test.cc index ae62a0ff7e..729a12bbec 100644 --- a/src/ast/type/alias_type_test.cc +++ b/src/ast/type/alias_type_test.cc @@ -166,7 +166,7 @@ TEST_F(AliasTypeTest, MinBufferBindingSizeArray) { ArrayType array(&u32, 4); ArrayDecorationList decos; decos.push_back(create(4, Source{})); - array.set_decorations(std::move(decos)); + array.set_decorations(decos); AliasType alias{"alias", &array}; EXPECT_EQ(16u, alias.MinBufferBindingSize(MemoryLayout::kUniformBuffer)); } @@ -176,7 +176,7 @@ TEST_F(AliasTypeTest, MinBufferBindingSizeRuntimeArray) { ArrayType array(&u32); ArrayDecorationList decos; decos.push_back(create(4, Source{})); - array.set_decorations(std::move(decos)); + array.set_decorations(decos); AliasType alias{"alias", &array}; EXPECT_EQ(4u, alias.MinBufferBindingSize(MemoryLayout::kUniformBuffer)); } @@ -188,17 +188,17 @@ TEST_F(AliasTypeTest, MinBufferBindingSizeStruct) { { StructMemberDecorationList deco; deco.push_back(create(0, Source{})); - members.push_back(create("foo", &u32, std::move(deco))); + members.push_back(create("foo", &u32, deco)); } { StructMemberDecorationList deco; deco.push_back(create(4, Source{})); - members.push_back(create("bar", &u32, std::move(deco))); + members.push_back(create("bar", &u32, deco)); } ast::StructDecorationList decos; - auto* str = create(std::move(decos), std::move(members)); - StructType struct_type("struct_type", std::move(str)); + auto* str = create(decos, members); + StructType struct_type("struct_type", str); AliasType alias{"alias", &struct_type}; EXPECT_EQ(16u, alias.MinBufferBindingSize(MemoryLayout::kUniformBuffer)); EXPECT_EQ(8u, alias.MinBufferBindingSize(MemoryLayout::kStorageBuffer)); @@ -215,7 +215,7 @@ TEST_F(AliasTypeTest, BaseAlignmentArray) { ArrayType array(&u32, 4); ArrayDecorationList decos; decos.push_back(create(4, Source{})); - array.set_decorations(std::move(decos)); + array.set_decorations(decos); AliasType alias{"alias", &array}; EXPECT_EQ(16u, alias.BaseAlignment(MemoryLayout::kUniformBuffer)); } @@ -225,7 +225,7 @@ TEST_F(AliasTypeTest, BaseAlignmentRuntimeArray) { ArrayType array(&u32); ArrayDecorationList decos; decos.push_back(create(4, Source{})); - array.set_decorations(std::move(decos)); + array.set_decorations(decos); AliasType alias{"alias", &array}; EXPECT_EQ(16u, alias.BaseAlignment(MemoryLayout::kUniformBuffer)); } @@ -237,17 +237,17 @@ TEST_F(AliasTypeTest, BaseAlignmentStruct) { { StructMemberDecorationList deco; deco.push_back(create(0, Source{})); - members.push_back(create("foo", &u32, std::move(deco))); + members.push_back(create("foo", &u32, deco)); } { StructMemberDecorationList deco; deco.push_back(create(4, Source{})); - members.push_back(create("bar", &u32, std::move(deco))); + members.push_back(create("bar", &u32, deco)); } ast::StructDecorationList decos; - auto* str = create(std::move(decos), std::move(members)); - StructType struct_type("struct_type", std::move(str)); + auto* str = create(decos, members); + StructType struct_type("struct_type", str); AliasType alias{"alias", &struct_type}; EXPECT_EQ(16u, alias.BaseAlignment(MemoryLayout::kUniformBuffer)); EXPECT_EQ(4u, alias.BaseAlignment(MemoryLayout::kStorageBuffer)); diff --git a/src/ast/type/array_type_test.cc b/src/ast/type/array_type_test.cc index a0f745cc7b..447d6b8354 100644 --- a/src/ast/type/array_type_test.cc +++ b/src/ast/type/array_type_test.cc @@ -84,7 +84,7 @@ TEST_F(ArrayTypeTest, TypeName_WithStride) { decos.push_back(create(16, Source{})); ArrayType arr{&i32, 3}; - arr.set_decorations(std::move(decos)); + arr.set_decorations(decos); EXPECT_EQ(arr.type_name(), "__array__i32_3_stride_16"); } @@ -100,7 +100,7 @@ TEST_F(ArrayTypeTest, MinBufferBindingSizeArray) { decos.push_back(create(4, Source{})); ArrayType arr(&u32, 4); - arr.set_decorations(std::move(decos)); + arr.set_decorations(decos); EXPECT_EQ(16u, arr.MinBufferBindingSize(MemoryLayout::kUniformBuffer)); } @@ -110,7 +110,7 @@ TEST_F(ArrayTypeTest, MinBufferBindingSizeRuntimeArray) { decos.push_back(create(4, Source{})); ArrayType arr(&u32); - arr.set_decorations(std::move(decos)); + arr.set_decorations(decos); EXPECT_EQ(4u, arr.MinBufferBindingSize(MemoryLayout::kUniformBuffer)); } @@ -120,7 +120,7 @@ TEST_F(ArrayTypeTest, BaseAlignmentArray) { decos.push_back(create(4, Source{})); ArrayType arr(&u32, 4); - arr.set_decorations(std::move(decos)); + arr.set_decorations(decos); EXPECT_EQ(16u, arr.BaseAlignment(MemoryLayout::kUniformBuffer)); EXPECT_EQ(4u, arr.BaseAlignment(MemoryLayout::kStorageBuffer)); } @@ -131,7 +131,7 @@ TEST_F(ArrayTypeTest, BaseAlignmentRuntimeArray) { decos.push_back(create(4, Source{})); ArrayType arr(&u32); - arr.set_decorations(std::move(decos)); + arr.set_decorations(decos); EXPECT_EQ(16u, arr.BaseAlignment(MemoryLayout::kUniformBuffer)); EXPECT_EQ(4u, arr.BaseAlignment(MemoryLayout::kStorageBuffer)); } diff --git a/src/ast/type/struct_type_test.cc b/src/ast/type/struct_type_test.cc index 44d0cccf09..88bf368688 100644 --- a/src/ast/type/struct_type_test.cc +++ b/src/ast/type/struct_type_test.cc @@ -36,13 +36,13 @@ using StructTypeTest = TestHelper; TEST_F(StructTypeTest, Creation) { auto* impl = create(); auto* ptr = impl; - StructType s{"S", std::move(impl)}; + StructType s{"S", impl}; EXPECT_EQ(s.impl(), ptr); } TEST_F(StructTypeTest, Is) { auto* impl = create(); - StructType s{"S", std::move(impl)}; + StructType s{"S", impl}; EXPECT_FALSE(s.IsAccessControl()); EXPECT_FALSE(s.IsAlias()); EXPECT_FALSE(s.IsArray()); @@ -60,7 +60,7 @@ TEST_F(StructTypeTest, Is) { TEST_F(StructTypeTest, TypeName) { auto* impl = create(); - StructType s{"my_struct", std::move(impl)}; + StructType s{"my_struct", impl}; EXPECT_EQ(s.type_name(), "__struct_my_struct"); } @@ -71,17 +71,17 @@ TEST_F(StructTypeTest, MinBufferBindingSize) { { StructMemberDecorationList deco; deco.push_back(create(0, Source{})); - members.push_back(create("foo", &u32, std::move(deco))); + members.push_back(create("foo", &u32, deco)); } { StructMemberDecorationList deco; deco.push_back(create(4, Source{})); - members.push_back(create("bar", &u32, std::move(deco))); + members.push_back(create("bar", &u32, deco)); } ast::StructDecorationList decos; - auto* str = create(std::move(decos), std::move(members)); - StructType struct_type("struct_type", std::move(str)); + auto* str = create(decos, members); + StructType struct_type("struct_type", str); EXPECT_EQ(16u, struct_type.MinBufferBindingSize(MemoryLayout::kUniformBuffer)); EXPECT_EQ(8u, struct_type.MinBufferBindingSize(MemoryLayout::kStorageBuffer)); @@ -93,29 +93,29 @@ TEST_F(StructTypeTest, MinBufferBindingSizeArray) { { ArrayDecorationList decos; decos.push_back(create(4, Source{})); - arr.set_decorations(std::move(decos)); + arr.set_decorations(decos); } StructMemberList members; { StructMemberDecorationList deco; deco.push_back(create(0, Source{})); - members.push_back(create("foo", &u32, std::move(deco))); + members.push_back(create("foo", &u32, deco)); } { StructMemberDecorationList deco; deco.push_back(create(4, Source{})); - members.push_back(create("bar", &u32, std::move(deco))); + members.push_back(create("bar", &u32, deco)); } { StructMemberDecorationList deco; deco.push_back(create(8, Source{})); - members.push_back(create("bar", &arr, std::move(deco))); + members.push_back(create("bar", &arr, deco)); } ast::StructDecorationList decos; - auto* str = create(std::move(decos), std::move(members)); - StructType struct_type("struct_type", std::move(str)); + auto* str = create(decos, members); + StructType struct_type("struct_type", str); EXPECT_EQ(32u, struct_type.MinBufferBindingSize(MemoryLayout::kUniformBuffer)); EXPECT_EQ(24u, @@ -128,29 +128,29 @@ TEST_F(StructTypeTest, MinBufferBindingSizeRuntimeArray) { { ArrayDecorationList decos; decos.push_back(create(4, Source{})); - arr.set_decorations(std::move(decos)); + arr.set_decorations(decos); } StructMemberList members; { StructMemberDecorationList deco; deco.push_back(create(0, Source{})); - members.push_back(create("foo", &u32, std::move(deco))); + members.push_back(create("foo", &u32, deco)); } { StructMemberDecorationList deco; deco.push_back(create(4, Source{})); - members.push_back(create("bar", &u32, std::move(deco))); + members.push_back(create("bar", &u32, deco)); } { StructMemberDecorationList deco; deco.push_back(create(8, Source{})); - members.push_back(create("bar", &u32, std::move(deco))); + members.push_back(create("bar", &u32, deco)); } ast::StructDecorationList decos; - auto* str = create(std::move(decos), std::move(members)); - StructType struct_type("struct_type", std::move(str)); + auto* str = create(decos, members); + StructType struct_type("struct_type", str); EXPECT_EQ(12u, struct_type.MinBufferBindingSize(MemoryLayout::kStorageBuffer)); } @@ -163,12 +163,12 @@ TEST_F(StructTypeTest, MinBufferBindingSizeVec2) { { StructMemberDecorationList deco; deco.push_back(create(0, Source{})); - members.push_back(create("foo", &vec2, std::move(deco))); + members.push_back(create("foo", &vec2, deco)); } ast::StructDecorationList decos; - auto* str = create(std::move(decos), std::move(members)); - StructType struct_type("struct_type", std::move(str)); + auto* str = create(decos, members); + StructType struct_type("struct_type", str); EXPECT_EQ(16u, struct_type.MinBufferBindingSize(MemoryLayout::kUniformBuffer)); EXPECT_EQ(8u, struct_type.MinBufferBindingSize(MemoryLayout::kStorageBuffer)); @@ -182,12 +182,12 @@ TEST_F(StructTypeTest, MinBufferBindingSizeVec3) { { StructMemberDecorationList deco; deco.push_back(create(0, Source{})); - members.push_back(create("foo", &vec3, std::move(deco))); + members.push_back(create("foo", &vec3, deco)); } ast::StructDecorationList decos; - auto* str = create(std::move(decos), std::move(members)); - StructType struct_type("struct_type", std::move(str)); + auto* str = create(decos, members); + StructType struct_type("struct_type", str); EXPECT_EQ(16u, struct_type.MinBufferBindingSize(MemoryLayout::kUniformBuffer)); EXPECT_EQ(16u, @@ -202,12 +202,12 @@ TEST_F(StructTypeTest, MinBufferBindingSizeVec4) { { StructMemberDecorationList deco; deco.push_back(create(0, Source{})); - members.push_back(create("foo", &vec4, std::move(deco))); + members.push_back(create("foo", &vec4, deco)); } ast::StructDecorationList decos; - auto* str = create(std::move(decos), std::move(members)); - StructType struct_type("struct_type", std::move(str)); + auto* str = create(decos, members); + StructType struct_type("struct_type", str); EXPECT_EQ(16u, struct_type.MinBufferBindingSize(MemoryLayout::kUniformBuffer)); EXPECT_EQ(16u, @@ -221,17 +221,17 @@ TEST_F(StructTypeTest, BaseAlignment) { { StructMemberDecorationList deco; deco.push_back(create(0, Source{})); - members.push_back(create("foo", &u32, std::move(deco))); + members.push_back(create("foo", &u32, deco)); } { StructMemberDecorationList deco; deco.push_back(create(4, Source{})); - members.push_back(create("bar", &u32, std::move(deco))); + members.push_back(create("bar", &u32, deco)); } ast::StructDecorationList decos; - auto* str = create(std::move(decos), std::move(members)); - StructType struct_type("struct_type", std::move(str)); + auto* str = create(decos, members); + StructType struct_type("struct_type", str); EXPECT_EQ(16u, struct_type.BaseAlignment(MemoryLayout::kUniformBuffer)); EXPECT_EQ(4u, struct_type.BaseAlignment(MemoryLayout::kStorageBuffer)); } @@ -242,29 +242,29 @@ TEST_F(StructTypeTest, BaseAlignmentArray) { { ArrayDecorationList decos; decos.push_back(create(4, Source{})); - arr.set_decorations(std::move(decos)); + arr.set_decorations(decos); } StructMemberList members; { StructMemberDecorationList deco; deco.push_back(create(0, Source{})); - members.push_back(create("foo", &u32, std::move(deco))); + members.push_back(create("foo", &u32, deco)); } { StructMemberDecorationList deco; deco.push_back(create(4, Source{})); - members.push_back(create("bar", &u32, std::move(deco))); + members.push_back(create("bar", &u32, deco)); } { StructMemberDecorationList deco; deco.push_back(create(8, Source{})); - members.push_back(create("bar", &arr, std::move(deco))); + members.push_back(create("bar", &arr, deco)); } ast::StructDecorationList decos; - auto* str = create(std::move(decos), std::move(members)); - StructType struct_type("struct_type", std::move(str)); + auto* str = create(decos, members); + StructType struct_type("struct_type", str); EXPECT_EQ(16u, struct_type.BaseAlignment(MemoryLayout::kUniformBuffer)); EXPECT_EQ(4u, struct_type.BaseAlignment(MemoryLayout::kStorageBuffer)); } @@ -275,29 +275,29 @@ TEST_F(StructTypeTest, BaseAlignmentRuntimeArray) { { ArrayDecorationList decos; decos.push_back(create(4, Source{})); - arr.set_decorations(std::move(decos)); + arr.set_decorations(decos); } StructMemberList members; { StructMemberDecorationList deco; deco.push_back(create(0, Source{})); - members.push_back(create("foo", &u32, std::move(deco))); + members.push_back(create("foo", &u32, deco)); } { StructMemberDecorationList deco; deco.push_back(create(4, Source{})); - members.push_back(create("bar", &u32, std::move(deco))); + members.push_back(create("bar", &u32, deco)); } { StructMemberDecorationList deco; deco.push_back(create(8, Source{})); - members.push_back(create("bar", &u32, std::move(deco))); + members.push_back(create("bar", &u32, deco)); } ast::StructDecorationList decos; - auto* str = create(std::move(decos), std::move(members)); - StructType struct_type("struct_type", std::move(str)); + auto* str = create(decos, members); + StructType struct_type("struct_type", str); EXPECT_EQ(4u, struct_type.BaseAlignment(MemoryLayout::kStorageBuffer)); } @@ -309,12 +309,12 @@ TEST_F(StructTypeTest, BaseAlignmentVec2) { { StructMemberDecorationList deco; deco.push_back(create(0, Source{})); - members.push_back(create("foo", &vec2, std::move(deco))); + members.push_back(create("foo", &vec2, deco)); } ast::StructDecorationList decos; - auto* str = create(std::move(decos), std::move(members)); - StructType struct_type("struct_type", std::move(str)); + auto* str = create(decos, members); + StructType struct_type("struct_type", str); EXPECT_EQ(16u, struct_type.BaseAlignment(MemoryLayout::kUniformBuffer)); EXPECT_EQ(8u, struct_type.BaseAlignment(MemoryLayout::kStorageBuffer)); } @@ -327,12 +327,12 @@ TEST_F(StructTypeTest, BaseAlignmentVec3) { { StructMemberDecorationList deco; deco.push_back(create(0, Source{})); - members.push_back(create("foo", &vec3, std::move(deco))); + members.push_back(create("foo", &vec3, deco)); } ast::StructDecorationList decos; - auto* str = create(std::move(decos), std::move(members)); - StructType struct_type("struct_type", std::move(str)); + auto* str = create(decos, members); + StructType struct_type("struct_type", str); EXPECT_EQ(16u, struct_type.BaseAlignment(MemoryLayout::kUniformBuffer)); EXPECT_EQ(16u, struct_type.BaseAlignment(MemoryLayout::kStorageBuffer)); } @@ -345,12 +345,12 @@ TEST_F(StructTypeTest, BaseAlignmentVec4) { { StructMemberDecorationList deco; deco.push_back(create(0, Source{})); - members.push_back(create("foo", &vec4, std::move(deco))); + members.push_back(create("foo", &vec4, deco)); } ast::StructDecorationList decos; - auto* str = create(std::move(decos), std::move(members)); - StructType struct_type("struct_type", std::move(str)); + auto* str = create(decos, members); + StructType struct_type("struct_type", str); EXPECT_EQ(16u, struct_type.BaseAlignment(MemoryLayout::kUniformBuffer)); EXPECT_EQ(16u, struct_type.BaseAlignment(MemoryLayout::kStorageBuffer)); } diff --git a/src/ast/type_constructor_expression_test.cc b/src/ast/type_constructor_expression_test.cc index 18914f0c3b..c576fedba7 100644 --- a/src/ast/type_constructor_expression_test.cc +++ b/src/ast/type_constructor_expression_test.cc @@ -33,12 +33,11 @@ TEST_F(TypeConstructorExpressionTest, Creation) { type::F32Type f32; ExpressionList expr; expr.push_back(create("expr")); - auto* expr_ptr = expr[0]; - TypeConstructorExpression t(&f32, std::move(expr)); + TypeConstructorExpression t(&f32, expr); EXPECT_EQ(t.type(), &f32); ASSERT_EQ(t.values().size(), 1u); - EXPECT_EQ(t.values()[0], expr_ptr); + EXPECT_EQ(t.values()[0], expr[0]); } TEST_F(TypeConstructorExpressionTest, Creation_WithSource) { @@ -46,8 +45,7 @@ TEST_F(TypeConstructorExpressionTest, Creation_WithSource) { ExpressionList expr; expr.push_back(create("expr")); - TypeConstructorExpression t(Source{Source::Location{20, 2}}, &f32, - std::move(expr)); + TypeConstructorExpression t(Source{Source::Location{20, 2}}, &f32, expr); auto src = t.source(); EXPECT_EQ(src.range.begin.line, 20u); EXPECT_EQ(src.range.begin.column, 2u); @@ -63,7 +61,7 @@ TEST_F(TypeConstructorExpressionTest, IsValid) { ExpressionList expr; expr.push_back(create("expr")); - TypeConstructorExpression t(&f32, std::move(expr)); + TypeConstructorExpression t(&f32, expr); EXPECT_TRUE(t.IsValid()); } @@ -71,7 +69,7 @@ TEST_F(TypeConstructorExpressionTest, IsValid_EmptyValue) { type::F32Type f32; ExpressionList expr; - TypeConstructorExpression t(&f32, std::move(expr)); + TypeConstructorExpression t(&f32, expr); EXPECT_TRUE(t.IsValid()); } @@ -80,7 +78,7 @@ TEST_F(TypeConstructorExpressionTest, IsValid_NullType) { expr.push_back(create("expr")); TypeConstructorExpression t; - t.set_values(std::move(expr)); + t.set_values(expr); EXPECT_FALSE(t.IsValid()); } @@ -90,7 +88,7 @@ TEST_F(TypeConstructorExpressionTest, IsValid_NullValue) { expr.push_back(create("expr")); expr.push_back(nullptr); - TypeConstructorExpression t(&f32, std::move(expr)); + TypeConstructorExpression t(&f32, expr); EXPECT_FALSE(t.IsValid()); } @@ -99,7 +97,7 @@ TEST_F(TypeConstructorExpressionTest, IsValid_InvalidValue) { ExpressionList expr; expr.push_back(create("")); - TypeConstructorExpression t(&f32, std::move(expr)); + TypeConstructorExpression t(&f32, expr); EXPECT_FALSE(t.IsValid()); } @@ -111,7 +109,7 @@ TEST_F(TypeConstructorExpressionTest, ToStr) { expr.push_back(create("expr_2")); expr.push_back(create("expr_3")); - TypeConstructorExpression t(&vec, std::move(expr)); + TypeConstructorExpression t(&vec, expr); std::ostringstream out; t.to_str(out, 2); EXPECT_EQ(out.str(), R"( TypeConstructor[not set]{ diff --git a/src/ast/unary_op_expression_test.cc b/src/ast/unary_op_expression_test.cc index 9192139088..f474ea9b11 100644 --- a/src/ast/unary_op_expression_test.cc +++ b/src/ast/unary_op_expression_test.cc @@ -27,17 +27,15 @@ using UnaryOpExpressionTest = TestHelper; TEST_F(UnaryOpExpressionTest, Creation) { auto* ident = create("ident"); - auto* ident_ptr = ident; - UnaryOpExpression u(UnaryOp::kNot, std::move(ident)); + UnaryOpExpression u(UnaryOp::kNot, ident); EXPECT_EQ(u.op(), UnaryOp::kNot); - EXPECT_EQ(u.expr(), ident_ptr); + EXPECT_EQ(u.expr(), ident); } TEST_F(UnaryOpExpressionTest, Creation_WithSource) { auto* ident = create("ident"); - UnaryOpExpression u(Source{Source::Location{20, 2}}, UnaryOp::kNot, - std::move(ident)); + UnaryOpExpression u(Source{Source::Location{20, 2}}, UnaryOp::kNot, ident); auto src = u.source(); EXPECT_EQ(src.range.begin.line, 20u); EXPECT_EQ(src.range.begin.column, 2u); @@ -50,7 +48,7 @@ TEST_F(UnaryOpExpressionTest, IsUnaryOp) { TEST_F(UnaryOpExpressionTest, IsValid) { auto* ident = create("ident"); - UnaryOpExpression u(UnaryOp::kNot, std::move(ident)); + UnaryOpExpression u(UnaryOp::kNot, ident); EXPECT_TRUE(u.IsValid()); } @@ -62,13 +60,13 @@ TEST_F(UnaryOpExpressionTest, IsValid_NullExpression) { TEST_F(UnaryOpExpressionTest, IsValid_InvalidExpression) { auto* ident = create(""); - UnaryOpExpression u(UnaryOp::kNot, std::move(ident)); + UnaryOpExpression u(UnaryOp::kNot, ident); EXPECT_FALSE(u.IsValid()); } TEST_F(UnaryOpExpressionTest, ToStr) { auto* ident = create("ident"); - UnaryOpExpression u(UnaryOp::kNot, std::move(ident)); + UnaryOpExpression u(UnaryOp::kNot, ident); std::ostringstream out; u.to_str(out, 2); EXPECT_EQ(out.str(), R"( UnaryOp[not set]{ diff --git a/src/ast/variable_decl_statement_test.cc b/src/ast/variable_decl_statement_test.cc index 9ab2c3b494..8e96e12460 100644 --- a/src/ast/variable_decl_statement_test.cc +++ b/src/ast/variable_decl_statement_test.cc @@ -27,17 +27,16 @@ using VariableDeclStatementTest = TestHelper; TEST_F(VariableDeclStatementTest, Creation) { type::F32Type f32; auto* var = create("a", StorageClass::kNone, &f32); - auto* var_ptr = var; - VariableDeclStatement stmt(std::move(var)); - EXPECT_EQ(stmt.variable(), var_ptr); + VariableDeclStatement stmt(var); + EXPECT_EQ(stmt.variable(), var); } TEST_F(VariableDeclStatementTest, Creation_WithSource) { type::F32Type f32; auto* var = create("a", StorageClass::kNone, &f32); - VariableDeclStatement stmt(Source{Source::Location{20, 2}}, std::move(var)); + VariableDeclStatement stmt(Source{Source::Location{20, 2}}, var); auto src = stmt.source(); EXPECT_EQ(src.range.begin.line, 20u); EXPECT_EQ(src.range.begin.column, 2u); @@ -51,14 +50,14 @@ TEST_F(VariableDeclStatementTest, IsVariableDecl) { TEST_F(VariableDeclStatementTest, IsValid) { type::F32Type f32; auto* var = create("a", StorageClass::kNone, &f32); - VariableDeclStatement stmt(std::move(var)); + VariableDeclStatement stmt(var); EXPECT_TRUE(stmt.IsValid()); } TEST_F(VariableDeclStatementTest, IsValid_InvalidVariable) { type::F32Type f32; auto* var = create("", StorageClass::kNone, &f32); - VariableDeclStatement stmt(std::move(var)); + VariableDeclStatement stmt(var); EXPECT_FALSE(stmt.IsValid()); } @@ -71,7 +70,7 @@ TEST_F(VariableDeclStatementTest, ToStr) { type::F32Type f32; auto* var = create("a", StorageClass::kNone, &f32); - VariableDeclStatement stmt(Source{Source::Location{20, 2}}, std::move(var)); + VariableDeclStatement stmt(Source{Source::Location{20, 2}}, var); std::ostringstream out; stmt.to_str(out, 2); EXPECT_EQ(out.str(), R"( VariableDeclStatement{ diff --git a/src/inspector/inspector.cc b/src/inspector/inspector.cc index dd7849334e..9875ec40f3 100644 --- a/src/inspector/inspector.cc +++ b/src/inspector/inspector.cc @@ -199,7 +199,7 @@ std::vector Inspector::GetUniformBufferResourceBindings( entry.min_buffer_binding_size = var->type()->MinBufferBindingSize( ast::type::MemoryLayout::kUniformBuffer); - result.push_back(std::move(entry)); + result.push_back(entry); } return result; @@ -234,7 +234,7 @@ std::vector Inspector::GetSamplerResourceBindings( entry.bind_group = binding_info.set->value(); entry.binding = binding_info.binding->value(); - result.push_back(std::move(entry)); + result.push_back(entry); } return result; @@ -258,7 +258,7 @@ std::vector Inspector::GetComparisonSamplerResourceBindings( entry.bind_group = binding_info.set->value(); entry.binding = binding_info.binding->value(); - result.push_back(std::move(entry)); + result.push_back(entry); } return result; @@ -321,7 +321,7 @@ std::vector Inspector::GetStorageBufferResourceBindingsImpl( entry.min_buffer_binding_size = var->type()->MinBufferBindingSize( ast::type::MemoryLayout::kStorageBuffer); - result.push_back(std::move(entry)); + result.push_back(entry); } return result; @@ -401,7 +401,7 @@ std::vector Inspector::GetSampledTextureResourceBindingsImpl( entry.sampled_kind = ResourceBinding::SampledKind::kUnknown; } - result.push_back(std::move(entry)); + result.push_back(entry); } return result; diff --git a/src/inspector/inspector_test.cc b/src/inspector/inspector_test.cc index 50a93803e6..44871923ec 100644 --- a/src/inspector/inspector_test.cc +++ b/src/inspector/inspector_test.cc @@ -81,8 +81,7 @@ class InspectorHelper { ast::Function* MakeEmptyBodyFunction(std::string name) { auto* body = create(); body->append(create()); - return create(name, ast::VariableList(), void_type(), - std::move(body)); + return create(name, ast::VariableList(), void_type(), body); } /// Generates a function that calls another @@ -93,12 +92,12 @@ class InspectorHelper { std::string callee) { auto* body = create(); auto* ident_expr = create(callee); - auto* call_expr = create(std::move(ident_expr), - ast::ExpressionList()); - body->append(create(std::move(call_expr))); + auto* call_expr = + create(ident_expr, ast::ExpressionList()); + body->append(create(call_expr)); body->append(create()); return create(caller, ast::VariableList(), void_type(), - std::move(body)); + body); } /// Add In/Out variables to the global variables @@ -113,8 +112,8 @@ class InspectorHelper { create(in, ast::StorageClass::kInput, u32_type()); auto* out_var = create(out, ast::StorageClass::kOutput, u32_type()); - mod()->AddGlobalVariable(std::move(in_var)); - mod()->AddGlobalVariable(std::move(out_var)); + mod()->AddGlobalVariable(in_var); + mod()->AddGlobalVariable(out_var); } } @@ -135,8 +134,7 @@ class InspectorHelper { create(in))); } body->append(create()); - return create(name, ast::VariableList(), void_type(), - std::move(body)); + return create(name, ast::VariableList(), void_type(), body); } /// Generates a function that references in/out variables and calls another @@ -159,12 +157,12 @@ class InspectorHelper { create(in))); } auto* ident_expr = create(callee); - auto* call_expr = create(std::move(ident_expr), - ast::ExpressionList()); - body->append(create(std::move(call_expr))); + auto* call_expr = + create(ident_expr, ast::ExpressionList()); + body->append(create(call_expr)); body->append(create()); return create(caller, ast::VariableList(), void_type(), - std::move(body)); + body); } /// Add a Constant ID to the global variables. @@ -183,12 +181,12 @@ class InspectorHelper { dvar->set_is_const(true); ast::VariableDecorationList decos; decos.push_back(create(id, Source{})); - dvar->set_decorations(std::move(decos)); + dvar->set_decorations(decos); if (val) { dvar->set_constructor( create(MakeLiteral(type, val))); } - mod()->AddGlobalVariable(std::move(dvar)); + mod()->AddGlobalVariable(dvar); } /// @param type AST type of the literal, must resolve to BoolLiteral @@ -261,7 +259,7 @@ class InspectorHelper { create(offset, Source{})); members.push_back(create( - StructMemberName(members.size(), type), type, std::move(deco))); + StructMemberName(members.size(), type), type, deco)); } ast::StructDecorationList decos; @@ -269,9 +267,9 @@ class InspectorHelper { decos.push_back(create(Source{})); } - auto* str = create(std::move(decos), std::move(members)); + auto* str = create(decos, members); - return std::make_unique(name, std::move(str)); + return std::make_unique(name, str); } /// Generates types appropriate for using in an uniform buffer @@ -345,9 +343,9 @@ class InspectorHelper { decorations.push_back(create(binding, Source{})); decorations.push_back(create(set, Source{})); - var->set_decorations(std::move(decorations)); + var->set_decorations(decorations); - mod()->AddGlobalVariable(std::move(var)); + mod()->AddGlobalVariable(var); } /// Adds an uniform buffer variable to the module @@ -408,7 +406,7 @@ class InspectorHelper { body->append(create()); return create(func_name, ast::VariableList(), void_type(), - std::move(body)); + body); } /// Adds a regular sampler variable to the module @@ -514,23 +512,21 @@ class InspectorHelper { auto* call_result = create( "sampler_result", ast::StorageClass::kFunction, vec_type(base_type, 4)); - body->append(create(std::move(call_result))); + body->append(create(call_result)); ast::ExpressionList call_params; call_params.push_back(create(texture_name)); call_params.push_back(create(sampler_name)); call_params.push_back(create(coords_name)); auto* call_expr = create( - create("textureSample"), - std::move(call_params)); + create("textureSample"), call_params); body->append(create( - create("sampler_result"), - std::move(call_expr))); + create("sampler_result"), call_expr)); body->append(create()); return create(func_name, ast::VariableList(), void_type(), - std::move(body)); + body); } /// Generates a function that references a specific comparison sampler @@ -554,7 +550,7 @@ class InspectorHelper { auto* call_result = create( "sampler_result", ast::StorageClass::kFunction, base_type); - body->append(create(std::move(call_result))); + body->append(create(call_result)); ast::ExpressionList call_params; call_params.push_back(create(texture_name)); @@ -562,16 +558,14 @@ class InspectorHelper { call_params.push_back(create(coords_name)); call_params.push_back(create(depth_name)); auto* call_expr = create( - create("textureSampleCompare"), - std::move(call_params)); + create("textureSampleCompare"), call_params); body->append(create( - create("sampler_result"), - std::move(call_expr))); + create("sampler_result"), call_expr)); body->append(create()); return create(func_name, ast::VariableList(), void_type(), - std::move(body)); + body); } /// Gets an appropriate type for the data in a given texture type. @@ -623,7 +617,7 @@ class InspectorHelper { std::make_unique(u32_type(), count); ast::ArrayDecorationList decos; decos.push_back(create(4, Source{})); - array_type_memo_[count]->set_decorations(std::move(decos)); + array_type_memo_[count]->set_decorations(decos); } return array_type_memo_[count].get(); } @@ -726,7 +720,7 @@ TEST_F(InspectorGetEntryPointTest, OneEntryPoint) { auto* foo = MakeEmptyBodyFunction("foo"); foo->add_decoration( create(ast::PipelineStage::kVertex, Source{})); - mod()->AddFunction(std::move(foo)); + mod()->AddFunction(foo); auto result = inspector()->GetEntryPoints(); ASSERT_FALSE(inspector()->has_error()) << inspector()->error(); @@ -741,12 +735,12 @@ TEST_F(InspectorGetEntryPointTest, MultipleEntryPoints) { auto* foo = MakeEmptyBodyFunction("foo"); foo->add_decoration( create(ast::PipelineStage::kVertex, Source{})); - mod()->AddFunction(std::move(foo)); + mod()->AddFunction(foo); auto* bar = MakeEmptyBodyFunction("bar"); bar->add_decoration( create(ast::PipelineStage::kCompute, Source{})); - mod()->AddFunction(std::move(bar)); + mod()->AddFunction(bar); auto result = inspector()->GetEntryPoints(); ASSERT_FALSE(inspector()->has_error()) << inspector()->error(); @@ -762,17 +756,17 @@ TEST_F(InspectorGetEntryPointTest, MultipleEntryPoints) { TEST_F(InspectorGetEntryPointTest, MixFunctionsAndEntryPoints) { auto* func = MakeEmptyBodyFunction("func"); - mod()->AddFunction(std::move(func)); + mod()->AddFunction(func); auto* foo = MakeCallerBodyFunction("foo", "func"); foo->add_decoration( create(ast::PipelineStage::kVertex, Source{})); - mod()->AddFunction(std::move(foo)); + mod()->AddFunction(foo); auto* bar = MakeCallerBodyFunction("bar", "func"); bar->add_decoration( create(ast::PipelineStage::kFragment, Source{})); - mod()->AddFunction(std::move(bar)); + mod()->AddFunction(bar); auto result = inspector()->GetEntryPoints(); EXPECT_FALSE(inspector()->has_error()); @@ -790,7 +784,7 @@ TEST_F(InspectorGetEntryPointTest, DefaultWorkgroupSize) { auto* foo = MakeCallerBodyFunction("foo", "func"); foo->add_decoration( create(ast::PipelineStage::kVertex, Source{})); - mod()->AddFunction(std::move(foo)); + mod()->AddFunction(foo); auto result = inspector()->GetEntryPoints(); ASSERT_FALSE(inspector()->has_error()) << inspector()->error(); @@ -808,7 +802,7 @@ TEST_F(InspectorGetEntryPointTest, NonDefaultWorkgroupSize) { foo->add_decoration( create(ast::PipelineStage::kCompute, Source{})); foo->add_decoration(create(8u, 2u, 1u, Source{})); - mod()->AddFunction(std::move(foo)); + mod()->AddFunction(foo); auto result = inspector()->GetEntryPoints(); ASSERT_FALSE(inspector()->has_error()) << inspector()->error(); @@ -823,12 +817,12 @@ TEST_F(InspectorGetEntryPointTest, NonDefaultWorkgroupSize) { TEST_F(InspectorGetEntryPointTest, NoInOutVariables) { auto* func = MakeEmptyBodyFunction("func"); - mod()->AddFunction(std::move(func)); + mod()->AddFunction(func); auto* foo = MakeCallerBodyFunction("foo", "func"); foo->add_decoration( create(ast::PipelineStage::kVertex, Source{})); - mod()->AddFunction(std::move(foo)); + mod()->AddFunction(foo); auto result = inspector()->GetEntryPoints(); ASSERT_FALSE(inspector()->has_error()) << inspector()->error(); @@ -844,7 +838,7 @@ TEST_F(InspectorGetEntryPointTest, EntryPointInOutVariables) { auto* foo = MakeInOutVariableBodyFunction("foo", {{"in_var", "out_var"}}); foo->add_decoration( create(ast::PipelineStage::kVertex, Source{})); - mod()->AddFunction(std::move(foo)); + mod()->AddFunction(foo); ASSERT_TRUE(td()->Determine()) << td()->error(); @@ -863,12 +857,12 @@ TEST_F(InspectorGetEntryPointTest, FunctionInOutVariables) { AddInOutVariables({{"in_var", "out_var"}}); auto* func = MakeInOutVariableBodyFunction("func", {{"in_var", "out_var"}}); - mod()->AddFunction(std::move(func)); + mod()->AddFunction(func); auto* foo = MakeCallerBodyFunction("foo", "func"); foo->add_decoration( create(ast::PipelineStage::kVertex, Source{})); - mod()->AddFunction(std::move(foo)); + mod()->AddFunction(foo); ASSERT_TRUE(td()->Determine()) << td()->error(); @@ -887,13 +881,13 @@ TEST_F(InspectorGetEntryPointTest, RepeatedInOutVariables) { AddInOutVariables({{"in_var", "out_var"}}); auto* func = MakeInOutVariableBodyFunction("func", {{"in_var", "out_var"}}); - mod()->AddFunction(std::move(func)); + mod()->AddFunction(func); auto* foo = MakeInOutVariableCallerBodyFunction("foo", "func", {{"in_var", "out_var"}}); foo->add_decoration( create(ast::PipelineStage::kVertex, Source{})); - mod()->AddFunction(std::move(foo)); + mod()->AddFunction(foo); ASSERT_TRUE(td()->Determine()) << td()->error(); @@ -915,7 +909,7 @@ TEST_F(InspectorGetEntryPointTest, EntryPointMultipleInOutVariables) { "foo", {{"in_var", "out_var"}, {"in2_var", "out2_var"}}); foo->add_decoration( create(ast::PipelineStage::kVertex, Source{})); - mod()->AddFunction(std::move(foo)); + mod()->AddFunction(foo); ASSERT_TRUE(td()->Determine()) << td()->error(); @@ -937,12 +931,12 @@ TEST_F(InspectorGetEntryPointTest, FunctionMultipleInOutVariables) { auto* func = MakeInOutVariableBodyFunction( "func", {{"in_var", "out_var"}, {"in2_var", "out2_var"}}); - mod()->AddFunction(std::move(func)); + mod()->AddFunction(func); auto* foo = MakeCallerBodyFunction("foo", "func"); foo->add_decoration( create(ast::PipelineStage::kVertex, Source{})); - mod()->AddFunction(std::move(foo)); + mod()->AddFunction(foo); ASSERT_TRUE(td()->Determine()) << td()->error(); @@ -965,12 +959,12 @@ TEST_F(InspectorGetEntryPointTest, MultipleEntryPointsInOutVariables) { auto* foo = MakeInOutVariableBodyFunction("foo", {{"in_var", "out2_var"}}); foo->add_decoration( create(ast::PipelineStage::kVertex, Source{})); - mod()->AddFunction(std::move(foo)); + mod()->AddFunction(foo); auto* bar = MakeInOutVariableBodyFunction("bar", {{"in2_var", "out_var"}}); bar->add_decoration( create(ast::PipelineStage::kCompute, Source{})); - mod()->AddFunction(std::move(bar)); + mod()->AddFunction(bar); ASSERT_TRUE(td()->Determine()) << td()->error(); @@ -998,18 +992,18 @@ TEST_F(InspectorGetEntryPointTest, MultipleEntryPointsSharedInOutVariables) { AddInOutVariables({{"in_var", "out_var"}, {"in2_var", "out2_var"}}); auto* func = MakeInOutVariableBodyFunction("func", {{"in2_var", "out2_var"}}); - mod()->AddFunction(std::move(func)); + mod()->AddFunction(func); auto* foo = MakeInOutVariableCallerBodyFunction("foo", "func", {{"in_var", "out_var"}}); foo->add_decoration( create(ast::PipelineStage::kVertex, Source{})); - mod()->AddFunction(std::move(foo)); + mod()->AddFunction(foo); auto* bar = MakeCallerBodyFunction("bar", "func"); bar->add_decoration( create(ast::PipelineStage::kCompute, Source{})); - mod()->AddFunction(std::move(bar)); + mod()->AddFunction(bar); ASSERT_TRUE(td()->Determine()) << td()->error(); @@ -1061,7 +1055,7 @@ TEST_F(InspectorGetRemappedNameForEntryPointTest, DISABLED_OneEntryPoint) { auto* foo = MakeEmptyBodyFunction("foo"); foo->add_decoration( create(ast::PipelineStage::kVertex, Source{})); - mod()->AddFunction(std::move(foo)); + mod()->AddFunction(foo); auto result = inspector()->GetRemappedNameForEntryPoint("foo"); ASSERT_FALSE(inspector()->has_error()) << inspector()->error(); @@ -1076,12 +1070,12 @@ TEST_F(InspectorGetRemappedNameForEntryPointTest, auto* foo = MakeEmptyBodyFunction("foo"); foo->add_decoration( create(ast::PipelineStage::kVertex, Source{})); - mod()->AddFunction(std::move(foo)); + mod()->AddFunction(foo); auto* bar = MakeEmptyBodyFunction("bar"); bar->add_decoration( create(ast::PipelineStage::kCompute, Source{})); - mod()->AddFunction(std::move(bar)); + mod()->AddFunction(bar); { auto result = inspector()->GetRemappedNameForEntryPoint("foo"); @@ -1199,12 +1193,12 @@ TEST_F(InspectorGetUniformBufferResourceBindingsTest, NonEntryPointFunc) { auto* ub_func = MakeStructVariableReferenceBodyFunction("ub_func", "foo_ub", {{0, i32_type()}}); - mod()->AddFunction(std::move(ub_func)); + mod()->AddFunction(ub_func); auto* ep_func = MakeCallerBodyFunction("ep_func", "ub_func"); ep_func->add_decoration( create(ast::PipelineStage::kVertex, Source{})); - mod()->AddFunction(std::move(ep_func)); + mod()->AddFunction(ep_func); ASSERT_TRUE(td()->Determine()) << td()->error(); @@ -1218,26 +1212,24 @@ TEST_F(InspectorGetUniformBufferResourceBindingsTest, MissingBlockDeco) { ast::StructMemberDecorationList deco; deco.push_back(create(0, Source{})); - members.push_back( - create(StructMemberName(members.size(), i32_type()), - i32_type(), std::move(deco))); + members.push_back(create( + StructMemberName(members.size(), i32_type()), i32_type(), deco)); ast::StructDecorationList decos; - auto* str = create(std::move(decos), std::move(members)); - auto foo_type = - std::make_unique("foo_type", std::move(str)); + auto* str = create(decos, members); + auto foo_type = std::make_unique("foo_type", str); AddUniformBuffer("foo_ub", foo_type.get(), 0, 0); auto* ub_func = MakeStructVariableReferenceBodyFunction("ub_func", "foo_ub", {{0, i32_type()}}); - mod()->AddFunction(std::move(ub_func)); + mod()->AddFunction(ub_func); auto* ep_func = MakeCallerBodyFunction("ep_func", "ub_func"); ep_func->add_decoration( create(ast::PipelineStage::kVertex, Source{})); - mod()->AddFunction(std::move(ep_func)); + mod()->AddFunction(ep_func); ASSERT_TRUE(td()->Determine()) << td()->error(); @@ -1255,12 +1247,12 @@ TEST_F(InspectorGetUniformBufferResourceBindingsTest, Simple) { auto* ub_func = MakeStructVariableReferenceBodyFunction("ub_func", "foo_ub", {{0, i32_type()}}); - mod()->AddFunction(std::move(ub_func)); + mod()->AddFunction(ub_func); auto* ep_func = MakeCallerBodyFunction("ep_func", "ub_func"); ep_func->add_decoration( create(ast::PipelineStage::kVertex, Source{})); - mod()->AddFunction(std::move(ep_func)); + mod()->AddFunction(ep_func); ASSERT_TRUE(td()->Determine()) << td()->error(); @@ -1282,12 +1274,12 @@ TEST_F(InspectorGetUniformBufferResourceBindingsTest, MultipleMembers) { auto* ub_func = MakeStructVariableReferenceBodyFunction( "ub_func", "foo_ub", {{0, i32_type()}, {1, u32_type()}, {2, f32_type()}}); - mod()->AddFunction(std::move(ub_func)); + mod()->AddFunction(ub_func); auto* ep_func = MakeCallerBodyFunction("ep_func", "ub_func"); ep_func->add_decoration( create(ast::PipelineStage::kVertex, Source{})); - mod()->AddFunction(std::move(ep_func)); + mod()->AddFunction(ep_func); ASSERT_TRUE(td()->Determine()) << td()->error(); @@ -1314,7 +1306,7 @@ TEST_F(InspectorGetUniformBufferResourceBindingsTest, MultipleUniformBuffers) { auto* ub_func = MakeStructVariableReferenceBodyFunction( func_name, var_name, {{0, i32_type()}, {1, u32_type()}, {2, f32_type()}}); - mod()->AddFunction(std::move(ub_func)); + mod()->AddFunction(ub_func); }; AddReferenceFunc("ub_foo_func", "ub_foo"); AddReferenceFunc("ub_bar_func", "ub_bar"); @@ -1322,9 +1314,9 @@ TEST_F(InspectorGetUniformBufferResourceBindingsTest, MultipleUniformBuffers) { auto AddFuncCall = [&](ast::BlockStatement* body, const std::string& callee) { auto* ident_expr = create(callee); - auto* call_expr = create(std::move(ident_expr), - ast::ExpressionList()); - body->append(create(std::move(call_expr))); + auto* call_expr = + create(ident_expr, ast::ExpressionList()); + body->append(create(call_expr)); }; auto* body = create(); @@ -1333,12 +1325,12 @@ TEST_F(InspectorGetUniformBufferResourceBindingsTest, MultipleUniformBuffers) { AddFuncCall(body, "ub_baz_func"); body->append(create()); - ast::Function* func = create("ep_func", ast::VariableList(), - void_type(), std::move(body)); + ast::Function* func = + create("ep_func", ast::VariableList(), void_type(), body); func->add_decoration( create(ast::PipelineStage::kVertex, Source{})); - mod()->AddFunction(std::move(func)); + mod()->AddFunction(func); ASSERT_TRUE(td()->Determine()) << td()->error(); @@ -1368,12 +1360,12 @@ TEST_F(InspectorGetUniformBufferResourceBindingsTest, ContainingArray) { auto* ub_func = MakeStructVariableReferenceBodyFunction("ub_func", "foo_ub", {{0, i32_type()}}); - mod()->AddFunction(std::move(ub_func)); + mod()->AddFunction(ub_func); auto* ep_func = MakeCallerBodyFunction("ep_func", "ub_func"); ep_func->add_decoration( create(ast::PipelineStage::kVertex, Source{})); - mod()->AddFunction(std::move(ep_func)); + mod()->AddFunction(ep_func); ASSERT_TRUE(td()->Determine()) << td()->error(); @@ -1395,12 +1387,12 @@ TEST_F(InspectorGetStorageBufferResourceBindingsTest, Simple) { auto* sb_func = MakeStructVariableReferenceBodyFunction("sb_func", "foo_sb", {{0, i32_type()}}); - mod()->AddFunction(std::move(sb_func)); + mod()->AddFunction(sb_func); auto* ep_func = MakeCallerBodyFunction("ep_func", "sb_func"); ep_func->add_decoration( create(ast::PipelineStage::kVertex, Source{})); - mod()->AddFunction(std::move(ep_func)); + mod()->AddFunction(ep_func); ASSERT_TRUE(td()->Determine()) << td()->error(); @@ -1422,12 +1414,12 @@ TEST_F(InspectorGetStorageBufferResourceBindingsTest, MultipleMembers) { auto* sb_func = MakeStructVariableReferenceBodyFunction( "sb_func", "foo_sb", {{0, i32_type()}, {1, u32_type()}, {2, f32_type()}}); - mod()->AddFunction(std::move(sb_func)); + mod()->AddFunction(sb_func); auto* ep_func = MakeCallerBodyFunction("ep_func", "sb_func"); ep_func->add_decoration( create(ast::PipelineStage::kVertex, Source{})); - mod()->AddFunction(std::move(ep_func)); + mod()->AddFunction(ep_func); ASSERT_TRUE(td()->Determine()) << td()->error(); @@ -1454,7 +1446,7 @@ TEST_F(InspectorGetStorageBufferResourceBindingsTest, MultipleStorageBuffers) { auto* sb_func = MakeStructVariableReferenceBodyFunction( func_name, var_name, {{0, i32_type()}, {1, u32_type()}, {2, f32_type()}}); - mod()->AddFunction(std::move(sb_func)); + mod()->AddFunction(sb_func); }; AddReferenceFunc("sb_foo_func", "sb_foo"); AddReferenceFunc("sb_bar_func", "sb_bar"); @@ -1462,9 +1454,9 @@ TEST_F(InspectorGetStorageBufferResourceBindingsTest, MultipleStorageBuffers) { auto AddFuncCall = [&](ast::BlockStatement* body, const std::string& callee) { auto* ident_expr = create(callee); - auto* call_expr = create(std::move(ident_expr), - ast::ExpressionList()); - body->append(create(std::move(call_expr))); + auto* call_expr = + create(ident_expr, ast::ExpressionList()); + body->append(create(call_expr)); }; auto* body = create(); @@ -1473,12 +1465,12 @@ TEST_F(InspectorGetStorageBufferResourceBindingsTest, MultipleStorageBuffers) { AddFuncCall(body, "sb_baz_func"); body->append(create()); - ast::Function* func = create("ep_func", ast::VariableList(), - void_type(), std::move(body)); + ast::Function* func = + create("ep_func", ast::VariableList(), void_type(), body); func->add_decoration( create(ast::PipelineStage::kVertex, Source{})); - mod()->AddFunction(std::move(func)); + mod()->AddFunction(func); ASSERT_TRUE(td()->Determine()) << td()->error(); @@ -1508,12 +1500,12 @@ TEST_F(InspectorGetStorageBufferResourceBindingsTest, ContainingArray) { auto* sb_func = MakeStructVariableReferenceBodyFunction("sb_func", "foo_sb", {{0, i32_type()}}); - mod()->AddFunction(std::move(sb_func)); + mod()->AddFunction(sb_func); auto* ep_func = MakeCallerBodyFunction("ep_func", "sb_func"); ep_func->add_decoration( create(ast::PipelineStage::kVertex, Source{})); - mod()->AddFunction(std::move(ep_func)); + mod()->AddFunction(ep_func); ASSERT_TRUE(td()->Determine()) << td()->error(); @@ -1535,12 +1527,12 @@ TEST_F(InspectorGetStorageBufferResourceBindingsTest, ContainingRuntimeArray) { auto* sb_func = MakeStructVariableReferenceBodyFunction("sb_func", "foo_sb", {{0, i32_type()}}); - mod()->AddFunction(std::move(sb_func)); + mod()->AddFunction(sb_func); auto* ep_func = MakeCallerBodyFunction("ep_func", "sb_func"); ep_func->add_decoration( create(ast::PipelineStage::kVertex, Source{})); - mod()->AddFunction(std::move(ep_func)); + mod()->AddFunction(ep_func); ASSERT_TRUE(td()->Determine()) << td()->error(); @@ -1562,12 +1554,12 @@ TEST_F(InspectorGetStorageBufferResourceBindingsTest, SkipReadOnly) { auto* sb_func = MakeStructVariableReferenceBodyFunction("sb_func", "foo_sb", {{0, i32_type()}}); - mod()->AddFunction(std::move(sb_func)); + mod()->AddFunction(sb_func); auto* ep_func = MakeCallerBodyFunction("ep_func", "sb_func"); ep_func->add_decoration( create(ast::PipelineStage::kVertex, Source{})); - mod()->AddFunction(std::move(ep_func)); + mod()->AddFunction(ep_func); ASSERT_TRUE(td()->Determine()) << td()->error(); @@ -1585,12 +1577,12 @@ TEST_F(InspectorGetReadOnlyStorageBufferResourceBindingsTest, Simple) { auto* sb_func = MakeStructVariableReferenceBodyFunction("sb_func", "foo_sb", {{0, i32_type()}}); - mod()->AddFunction(std::move(sb_func)); + mod()->AddFunction(sb_func); auto* ep_func = MakeCallerBodyFunction("ep_func", "sb_func"); ep_func->add_decoration( create(ast::PipelineStage::kVertex, Source{})); - mod()->AddFunction(std::move(ep_func)); + mod()->AddFunction(ep_func); ASSERT_TRUE(td()->Determine()) << td()->error(); @@ -1619,7 +1611,7 @@ TEST_F(InspectorGetReadOnlyStorageBufferResourceBindingsTest, auto* sb_func = MakeStructVariableReferenceBodyFunction( func_name, var_name, {{0, i32_type()}, {1, u32_type()}, {2, f32_type()}}); - mod()->AddFunction(std::move(sb_func)); + mod()->AddFunction(sb_func); }; AddReferenceFunc("sb_foo_func", "sb_foo"); AddReferenceFunc("sb_bar_func", "sb_bar"); @@ -1627,9 +1619,9 @@ TEST_F(InspectorGetReadOnlyStorageBufferResourceBindingsTest, auto AddFuncCall = [&](ast::BlockStatement* body, const std::string& callee) { auto* ident_expr = create(callee); - auto* call_expr = create(std::move(ident_expr), - ast::ExpressionList()); - body->append(create(std::move(call_expr))); + auto* call_expr = + create(ident_expr, ast::ExpressionList()); + body->append(create(call_expr)); }; auto* body = create(); @@ -1638,12 +1630,12 @@ TEST_F(InspectorGetReadOnlyStorageBufferResourceBindingsTest, AddFuncCall(body, "sb_baz_func"); body->append(create()); - ast::Function* func = create("ep_func", ast::VariableList(), - void_type(), std::move(body)); + ast::Function* func = + create("ep_func", ast::VariableList(), void_type(), body); func->add_decoration( create(ast::PipelineStage::kVertex, Source{})); - mod()->AddFunction(std::move(func)); + mod()->AddFunction(func); ASSERT_TRUE(td()->Determine()) << td()->error(); @@ -1674,12 +1666,12 @@ TEST_F(InspectorGetReadOnlyStorageBufferResourceBindingsTest, ContainingArray) { auto* sb_func = MakeStructVariableReferenceBodyFunction("sb_func", "foo_sb", {{0, i32_type()}}); - mod()->AddFunction(std::move(sb_func)); + mod()->AddFunction(sb_func); auto* ep_func = MakeCallerBodyFunction("ep_func", "sb_func"); ep_func->add_decoration( create(ast::PipelineStage::kVertex, Source{})); - mod()->AddFunction(std::move(ep_func)); + mod()->AddFunction(ep_func); ASSERT_TRUE(td()->Determine()) << td()->error(); @@ -1703,12 +1695,12 @@ TEST_F(InspectorGetReadOnlyStorageBufferResourceBindingsTest, auto* sb_func = MakeStructVariableReferenceBodyFunction("sb_func", "foo_sb", {{0, i32_type()}}); - mod()->AddFunction(std::move(sb_func)); + mod()->AddFunction(sb_func); auto* ep_func = MakeCallerBodyFunction("ep_func", "sb_func"); ep_func->add_decoration( create(ast::PipelineStage::kVertex, Source{})); - mod()->AddFunction(std::move(ep_func)); + mod()->AddFunction(ep_func); ASSERT_TRUE(td()->Determine()) << td()->error(); @@ -1731,12 +1723,12 @@ TEST_F(InspectorGetReadOnlyStorageBufferResourceBindingsTest, SkipNonReadOnly) { auto* sb_func = MakeStructVariableReferenceBodyFunction("sb_func", "foo_sb", {{0, i32_type()}}); - mod()->AddFunction(std::move(sb_func)); + mod()->AddFunction(sb_func); auto* ep_func = MakeCallerBodyFunction("ep_func", "sb_func"); ep_func->add_decoration( create(ast::PipelineStage::kVertex, Source{})); - mod()->AddFunction(std::move(ep_func)); + mod()->AddFunction(ep_func); ASSERT_TRUE(td()->Determine()) << td()->error(); @@ -1757,7 +1749,7 @@ TEST_F(InspectorGetSamplerResourceBindingsTest, Simple) { "ep", "foo_texture", "foo_sampler", "foo_coords", f32_type()); func->add_decoration( create(ast::PipelineStage::kVertex, Source{})); - mod()->AddFunction(std::move(func)); + mod()->AddFunction(func); ASSERT_TRUE(td()->Determine()) << td()->error(); @@ -1773,7 +1765,7 @@ TEST_F(InspectorGetSamplerResourceBindingsTest, NoSampler) { auto* func = MakeEmptyBodyFunction("ep_func"); func->add_decoration( create(ast::PipelineStage::kVertex, Source{})); - mod()->AddFunction(std::move(func)); + mod()->AddFunction(func); ASSERT_TRUE(td()->Determine()) << td()->error(); @@ -1792,12 +1784,12 @@ TEST_F(InspectorGetSamplerResourceBindingsTest, InFunction) { auto* foo_func = MakeSamplerReferenceBodyFunction( "foo_func", "foo_texture", "foo_sampler", "foo_coords", f32_type()); - mod()->AddFunction(std::move(foo_func)); + mod()->AddFunction(foo_func); auto* ep_func = MakeCallerBodyFunction("ep_func", "foo_func"); ep_func->add_decoration( create(ast::PipelineStage::kVertex, Source{})); - mod()->AddFunction(std::move(ep_func)); + mod()->AddFunction(ep_func); ASSERT_TRUE(td()->Determine()) << td()->error(); @@ -1820,7 +1812,7 @@ TEST_F(InspectorGetSamplerResourceBindingsTest, UnknownEntryPoint) { "ep", "foo_texture", "foo_sampler", "foo_coords", f32_type()); func->add_decoration( create(ast::PipelineStage::kVertex, Source{})); - mod()->AddFunction(std::move(func)); + mod()->AddFunction(func); ASSERT_TRUE(td()->Determine()) << td()->error(); @@ -1841,7 +1833,7 @@ TEST_F(InspectorGetSamplerResourceBindingsTest, SkipsComparisonSamplers) { f32_type()); func->add_decoration( create(ast::PipelineStage::kVertex, Source{})); - mod()->AddFunction(std::move(func)); + mod()->AddFunction(func); ASSERT_TRUE(td()->Determine()) << td()->error(); @@ -1864,7 +1856,7 @@ TEST_F(InspectorGetComparisonSamplerResourceBindingsTest, Simple) { f32_type()); func->add_decoration( create(ast::PipelineStage::kVertex, Source{})); - mod()->AddFunction(std::move(func)); + mod()->AddFunction(func); ASSERT_TRUE(td()->Determine()) << td()->error(); @@ -1880,7 +1872,7 @@ TEST_F(InspectorGetComparisonSamplerResourceBindingsTest, NoSampler) { auto* func = MakeEmptyBodyFunction("ep_func"); func->add_decoration( create(ast::PipelineStage::kVertex, Source{})); - mod()->AddFunction(std::move(func)); + mod()->AddFunction(func); ASSERT_TRUE(td()->Determine()) << td()->error(); @@ -1901,12 +1893,12 @@ TEST_F(InspectorGetComparisonSamplerResourceBindingsTest, InFunction) { auto* foo_func = MakeComparisonSamplerReferenceBodyFunction( "foo_func", "foo_texture", "foo_sampler", "foo_coords", "foo_depth", f32_type()); - mod()->AddFunction(std::move(foo_func)); + mod()->AddFunction(foo_func); auto* ep_func = MakeCallerBodyFunction("ep_func", "foo_func"); ep_func->add_decoration( create(ast::PipelineStage::kVertex, Source{})); - mod()->AddFunction(std::move(ep_func)); + mod()->AddFunction(ep_func); ASSERT_TRUE(td()->Determine()) << td()->error(); @@ -1931,7 +1923,7 @@ TEST_F(InspectorGetComparisonSamplerResourceBindingsTest, UnknownEntryPoint) { f32_type()); func->add_decoration( create(ast::PipelineStage::kVertex, Source{})); - mod()->AddFunction(std::move(func)); + mod()->AddFunction(func); ASSERT_TRUE(td()->Determine()) << td()->error(); @@ -1950,7 +1942,7 @@ TEST_F(InspectorGetComparisonSamplerResourceBindingsTest, SkipsSamplers) { "ep", "foo_texture", "foo_sampler", "foo_coords", f32_type()); func->add_decoration( create(ast::PipelineStage::kVertex, Source{})); - mod()->AddFunction(std::move(func)); + mod()->AddFunction(func); ASSERT_TRUE(td()->Determine()) << td()->error(); @@ -1964,7 +1956,7 @@ TEST_F(InspectorGetSampledTextureResourceBindingsTest, Empty) { auto* foo = MakeEmptyBodyFunction("foo"); foo->add_decoration( create(ast::PipelineStage::kVertex, Source{})); - mod()->AddFunction(std::move(foo)); + mod()->AddFunction(foo); auto result = inspector()->GetSampledTextureResourceBindings("foo"); ASSERT_FALSE(inspector()->has_error()) << inspector()->error(); @@ -1986,7 +1978,7 @@ TEST_P(InspectorGetSampledTextureResourceBindingsTestWithParam, textureSample) { GetBaseType(GetParam().sampled_kind)); func->add_decoration( create(ast::PipelineStage::kVertex, Source{})); - mod()->AddFunction(std::move(func)); + mod()->AddFunction(func); ASSERT_TRUE(td()->Determine()) << td()->error(); @@ -2093,7 +2085,7 @@ TEST_F(InspectorGetMultisampledTextureResourceBindingsTest, Empty) { auto* foo = MakeEmptyBodyFunction("foo"); foo->add_decoration( create(ast::PipelineStage::kVertex, Source{})); - mod()->AddFunction(std::move(foo)); + mod()->AddFunction(foo); auto result = inspector()->GetSampledTextureResourceBindings("foo"); ASSERT_FALSE(inspector()->has_error()) << inspector()->error(); @@ -2116,7 +2108,7 @@ TEST_P(InspectorGetMultisampledTextureResourceBindingsTestWithParam, GetBaseType(GetParam().sampled_kind)); func->add_decoration( create(ast::PipelineStage::kVertex, Source{})); - mod()->AddFunction(std::move(func)); + mod()->AddFunction(func); ASSERT_TRUE(td()->Determine()) << td()->error(); diff --git a/src/reader/spirv/function.cc b/src/reader/spirv/function.cc index ebdca700c9..51010cbffd 100644 --- a/src/reader/spirv/function.cc +++ b/src/reader/spirv/function.cc @@ -517,11 +517,10 @@ void FunctionEmitter::PushGuard(const std::string& guard_name, auto* cond = create(guard_name); auto* body = create(); auto* const guard_stmt = - AddStatement(create(std::move(cond), std::move(body))) - ->AsIf(); + AddStatement(create(cond, body))->AsIf(); PushNewStatementBlock(top.construct_, end_id, [guard_stmt](StatementBlock* s) { - guard_stmt->set_body(std::move(s->statements_)); + guard_stmt->set_body(s->statements_); }); } @@ -531,12 +530,11 @@ void FunctionEmitter::PushTrueGuard(uint32_t end_id) { auto* cond = MakeTrue(); auto* body = create(); auto* const guard_stmt = - AddStatement(create(std::move(cond), std::move(body))) - ->AsIf(); + AddStatement(create(cond, body))->AsIf(); guard_stmt->set_condition(MakeTrue()); PushNewStatementBlock(top.construct_, end_id, [guard_stmt](StatementBlock* s) { - guard_stmt->set_body(std::move(s->statements_)); + guard_stmt->set_body(s->statements_); }); } @@ -549,7 +547,7 @@ ast::Statement* FunctionEmitter::AddStatement(ast::Statement* statement) { assert(!statements_stack_.empty()); auto* result = statement; if (result != nullptr) { - statements_stack_.back().statements_->append(std::move(statement)); + statements_stack_.back().statements_->append(statement); } return result; } @@ -557,7 +555,7 @@ ast::Statement* FunctionEmitter::AddStatement(ast::Statement* statement) { ast::Statement* FunctionEmitter::AddStatementForInstruction( ast::Statement* statement, const spvtools::opt::Instruction& inst) { - auto* node = AddStatement(std::move(statement)); + auto* node = AddStatement(statement); ApplySourceForInstruction(node, inst); return node; } @@ -592,8 +590,8 @@ bool FunctionEmitter::Emit() { "element but has " << statements_stack_.size(); } - auto* body = std::move(statements_stack_[0].statements_); - parser_impl_.get_module().functions().back()->set_body(std::move(body)); + auto* body = statements_stack_[0].statements_; + parser_impl_.get_module().functions().back()->set_body(body); // Maintain the invariant by repopulating the one and only element. statements_stack_.clear(); PushNewStatementBlock(constructs_[0].get(), 0, nullptr); @@ -635,7 +633,7 @@ bool FunctionEmitter::EmitFunctionDeclaration() { param->result_id(), ast::StorageClass::kNone, ast_type); // Parameters are treated as const declarations. ast_param->set_is_const(true); - ast_params.emplace_back(std::move(ast_param)); + ast_params.emplace_back(ast_param); // The value is accessible by name. identifier_values_.insert(param->result_id()); } else { @@ -655,7 +653,7 @@ bool FunctionEmitter::EmitFunctionDeclaration() { create(ep_info_->stage, Source{})); } - ast_module_.AddFunction(std::move(ast_fn)); + ast_module_.AddFunction(ast_fn); return success(); } @@ -1704,8 +1702,8 @@ bool FunctionEmitter::EmitFunctionVariables() { parser_impl_.MakeConstantExpression(inst.GetSingleWordInOperand(1)) .expr); } - auto* var_decl_stmt = create(std::move(var)); - AddStatementForInstruction(std::move(var_decl_stmt), inst); + auto* var_decl_stmt = create(var); + AddStatementForInstruction(var_decl_stmt, inst); // Save this as an already-named value. identifier_values_.insert(inst.result_id()); } @@ -1972,8 +1970,8 @@ bool FunctionEmitter::EmitIfStart(const BlockInfo& block_info) { auto* guard_var = create( guard_name, ast::StorageClass::kFunction, parser_impl_.BoolType()); guard_var->set_constructor(MakeTrue()); - auto* guard_decl = create(std::move(guard_var)); - AddStatement(std::move(guard_decl)); + auto* guard_decl = create(guard_var); + AddStatement(guard_decl); } const auto condition_id = @@ -1981,8 +1979,7 @@ bool FunctionEmitter::EmitIfStart(const BlockInfo& block_info) { auto* cond = MakeExpression(condition_id).expr; auto* body = create(); auto* const if_stmt = - AddStatement(create(std::move(cond), std::move(body))) - ->AsIf(); + AddStatement(create(cond, body))->AsIf(); // Generate the code for the condition. @@ -2029,7 +2026,7 @@ bool FunctionEmitter::EmitIfStart(const BlockInfo& block_info) { // The "then" consists of the statement list // from the top of statments stack, without an // elseif condition. - if_stmt->set_body(std::move(s->statements_)); + if_stmt->set_body(s->statements_); }); }; @@ -2043,8 +2040,8 @@ bool FunctionEmitter::EmitIfStart(const BlockInfo& block_info) { // statments stack, without an elseif condition. ast::ElseStatementList else_stmts; else_stmts.emplace_back( - create(nullptr, std::move(s->statements_))); - if_stmt->set_else_statements(std::move(else_stmts)); + create(nullptr, s->statements_)); + if_stmt->set_else_statements(else_stmts); } }); }; @@ -2099,7 +2096,7 @@ bool FunctionEmitter::EmitSwitchStart(const BlockInfo& block_info) { const auto selector_id = branch->GetSingleWordInOperand(0); // Generate the code for the selector. auto selector = MakeExpression(selector_id); - switch_stmt->set_condition(std::move(selector.expr)); + switch_stmt->set_condition(selector.expr); // First, push the statement block for the entire switch. All the actual // work is done by completion actions of the case/default clauses. @@ -2177,7 +2174,7 @@ bool FunctionEmitter::EmitSwitchStart(const BlockInfo& block_info) { create(selector.type, value32)); } } - clause->set_selectors(std::move(selectors)); + clause->set_selectors(selectors); } // Where does this clause end? @@ -2185,7 +2182,7 @@ bool FunctionEmitter::EmitSwitchStart(const BlockInfo& block_info) { : construct->end_id; PushNewStatementBlock(construct, end_id, [clause](StatementBlock* s) { - clause->set_body(std::move(s->statements_)); + clause->set_body(s->statements_); }); if ((default_info == clause_heads[i]) && has_selectors && @@ -2193,8 +2190,8 @@ bool FunctionEmitter::EmitSwitchStart(const BlockInfo& block_info) { // Generate a default clause with a just fallthrough. auto* stmts = create(); stmts->append(create()); - auto* case_stmt = create(std::move(stmts)); - cases->emplace_back(std::move(case_stmt)); + auto* case_stmt = create(stmts); + cases->emplace_back(case_stmt); } if (i == 0) { @@ -2216,7 +2213,7 @@ bool FunctionEmitter::EmitLoopStart(const Construct* construct) { ->AsLoop(); PushNewStatementBlock( construct, construct->end_id, - [loop](StatementBlock* s) { loop->set_body(std::move(s->statements_)); }); + [loop](StatementBlock* s) { loop->set_body(s->statements_); }); return success(); } @@ -2229,10 +2226,9 @@ bool FunctionEmitter::EmitContinuingStart(const Construct* construct) { "expected loop on top of stack"; } auto* loop = loop_candidate->AsLoop(); - PushNewStatementBlock(construct, construct->end_id, - [loop](StatementBlock* s) { - loop->set_continuing(std::move(s->statements_)); - }); + PushNewStatementBlock( + construct, construct->end_id, + [loop](StatementBlock* s) { loop->set_continuing(s->statements_); }); return success(); } @@ -2244,7 +2240,7 @@ bool FunctionEmitter::EmitNormalTerminator(const BlockInfo& block_info) { return true; case SpvOpReturnValue: { auto value = MakeExpression(terminator.GetSingleWordInOperand(0)); - AddStatement(create(std::move(value.expr))); + AddStatement(create(value.expr)); } return true; case SpvOpKill: @@ -2296,11 +2292,11 @@ bool FunctionEmitter::EmitNormalTerminator(const BlockInfo& block_info) { // The fallthrough case is special because WGSL requires the fallthrough // statement to be last in the case clause. if (true_kind == EdgeKind::kCaseFallThrough) { - return EmitConditionalCaseFallThrough(block_info, std::move(cond), - false_kind, *false_info, true); + return EmitConditionalCaseFallThrough(block_info, cond, false_kind, + *false_info, true); } else if (false_kind == EdgeKind::kCaseFallThrough) { - return EmitConditionalCaseFallThrough(block_info, std::move(cond), - true_kind, *true_info, false); + return EmitConditionalCaseFallThrough(block_info, cond, true_kind, + *true_info, false); } // At this point, at most one edge is kForward or kIfBreak. @@ -2317,8 +2313,7 @@ bool FunctionEmitter::EmitNormalTerminator(const BlockInfo& block_info) { auto* false_branch = MakeBranchDetailed(block_info, *false_info, false, &flow_guard); - AddStatement(MakeSimpleIf(std::move(cond), std::move(true_branch), - std::move(false_branch))); + AddStatement(MakeSimpleIf(cond, true_branch, false_branch)); if (!flow_guard.empty()) { PushGuard(flow_guard, statements_stack_.back().end_id_); } @@ -2413,20 +2408,19 @@ ast::Statement* FunctionEmitter::MakeSimpleIf(ast::Expression* condition, if ((then_stmt == nullptr) && (else_stmt == nullptr)) { return nullptr; } - auto* if_stmt = create(std::move(condition), - create()); + auto* if_stmt = + create(condition, create()); if (then_stmt != nullptr) { auto* stmts = create(); - stmts->append(std::move(then_stmt)); - if_stmt->set_body(std::move(stmts)); + stmts->append(then_stmt); + if_stmt->set_body(stmts); } if (else_stmt != nullptr) { auto* stmts = create(); - stmts->append(std::move(else_stmt)); + stmts->append(else_stmt); ast::ElseStatementList else_stmts; - else_stmts.emplace_back( - create(nullptr, std::move(stmts))); - if_stmt->set_else_statements(std::move(else_stmts)); + else_stmts.emplace_back(create(nullptr, stmts)); + if_stmt->set_else_statements(else_stmts); } return if_stmt; } @@ -2466,11 +2460,9 @@ bool FunctionEmitter::EmitConditionalCaseFallThrough( << int(other_edge_kind); } if (fall_through_is_true_branch) { - AddStatement( - MakeSimpleIf(std::move(cond), nullptr, std::move(other_branch))); + AddStatement(MakeSimpleIf(cond, nullptr, other_branch)); } else { - AddStatement( - MakeSimpleIf(std::move(cond), std::move(other_branch), nullptr)); + AddStatement(MakeSimpleIf(cond, other_branch, nullptr)); } AddStatement(create()); @@ -2513,7 +2505,7 @@ bool FunctionEmitter::EmitStatementsInBasicBlock(const BlockInfo& block_info, auto* var = create(phi_var_name, ast::StorageClass::kFunction, parser_impl_.ConvertType(def_inst->type_id())); - AddStatement(create(std::move(var))); + AddStatement(create(var)); } // Emit regular statements. @@ -2544,7 +2536,7 @@ bool FunctionEmitter::EmitStatementsInBasicBlock(const BlockInfo& block_info, const auto var_name = GetDefInfo(assignment.phi_id)->phi_var; auto expr = MakeExpression(assignment.value); AddStatement(create( - create(var_name), std::move(expr.expr))); + create(var_name), expr.expr)); } } @@ -2563,10 +2555,10 @@ bool FunctionEmitter::EmitConstDefinition( if (!ast_const) { return false; } - ast_const->set_constructor(std::move(ast_expr.expr)); + ast_const->set_constructor(ast_expr.expr); ast_const->set_is_const(true); - AddStatementForInstruction( - create(std::move(ast_const)), inst); + AddStatementForInstruction(create(ast_const), + inst); // Save this as an already-named value. identifier_values_.insert(inst.result_id()); return success(); @@ -2582,11 +2574,11 @@ bool FunctionEmitter::EmitConstDefOrWriteToHoistedVar( AddStatementForInstruction( create( create(namer_.Name(result_id)), - std::move(ast_expr.expr)), + ast_expr.expr), inst); return true; } - return EmitConstDefinition(inst, std::move(ast_expr)); + return EmitConstDefinition(inst, ast_expr); } bool FunctionEmitter::EmitStatement(const spvtools::opt::Instruction& inst) { @@ -2615,13 +2607,11 @@ bool FunctionEmitter::EmitStatement(const spvtools::opt::Instruction& inst) { def_info->num_uses != 1) { // Generate a const definition or an assignment to a hoisted definition // now and later use the const or variable name at the uses of this value. - return EmitConstDefOrWriteToHoistedVar(inst, - std::move(combinatorial_expr)); + return EmitConstDefOrWriteToHoistedVar(inst, combinatorial_expr); } // It is harmless to defer emitting the expression until it's used. // Any supporting statements have already been emitted. - singly_used_values_.insert( - std::make_pair(result_id, std::move(combinatorial_expr))); + singly_used_values_.insert(std::make_pair(result_id, combinatorial_expr)); return success(); } if (failed()) { @@ -2646,9 +2636,8 @@ bool FunctionEmitter::EmitStatement(const spvtools::opt::Instruction& inst) { // TODO(dneto): Order of evaluation? auto lhs = MakeExpression(ptr_id); auto rhs = MakeExpression(value_id); - AddStatementForInstruction(create( - std::move(lhs.expr), std::move(rhs.expr)), - inst); + AddStatementForInstruction( + create(lhs.expr, rhs.expr), inst); return success(); } case SpvOpLoad: { @@ -2658,7 +2647,7 @@ bool FunctionEmitter::EmitStatement(const spvtools::opt::Instruction& inst) { // The load result type is the pointee type of its operand. assert(expr.type->IsPointer()); expr.type = expr.type->AsPointer()->type(); - return EmitConstDefOrWriteToHoistedVar(inst, std::move(expr)); + return EmitConstDefOrWriteToHoistedVar(inst, expr); } case SpvOpCopyObject: { // Arguably, OpCopyObject is purely combinatorial. On the other hand, @@ -2666,14 +2655,14 @@ bool FunctionEmitter::EmitStatement(const spvtools::opt::Instruction& inst) { // a new named constant definition. auto expr = MakeExpression(inst.GetSingleWordInOperand(0)); expr.type = RemapStorageClass(expr.type, result_id); - return EmitConstDefOrWriteToHoistedVar(inst, std::move(expr)); + return EmitConstDefOrWriteToHoistedVar(inst, expr); } case SpvOpPhi: { // Emit a read from the associated state variable. TypedExpression expr{ parser_impl_.ConvertType(inst.type_id()), create(def_info->phi_var)}; - return EmitConstDefOrWriteToHoistedVar(inst, std::move(expr)); + return EmitConstDefOrWriteToHoistedVar(inst, expr); } case SpvOpFunctionCall: return EmitFunctionCall(inst); @@ -2706,21 +2695,18 @@ TypedExpression FunctionEmitter::MaybeEmitCombinatorialValue( if (binary_op != ast::BinaryOp::kNone) { auto arg0 = MakeOperand(inst, 0); auto arg1 = MakeOperand(inst, 1); - auto* binary_expr = create( - binary_op, std::move(arg0.expr), std::move(arg1.expr)); - TypedExpression result{ast_type, std::move(binary_expr)}; - return parser_impl_.RectifyForcedResultType(std::move(result), opcode, - arg0.type); + auto* binary_expr = + create(binary_op, arg0.expr, arg1.expr); + TypedExpression result{ast_type, binary_expr}; + return parser_impl_.RectifyForcedResultType(result, opcode, arg0.type); } auto unary_op = ast::UnaryOp::kNegation; if (GetUnaryOp(opcode, &unary_op)) { auto arg0 = MakeOperand(inst, 0); - auto* unary_expr = - create(unary_op, std::move(arg0.expr)); - TypedExpression result{ast_type, std::move(unary_expr)}; - return parser_impl_.RectifyForcedResultType(std::move(result), opcode, - arg0.type); + auto* unary_expr = create(unary_op, arg0.expr); + TypedExpression result{ast_type, unary_expr}; + return parser_impl_.RectifyForcedResultType(result, opcode, arg0.type); } const char* unary_builtin_name = GetUnaryBuiltInFunctionName(opcode); @@ -2750,11 +2736,11 @@ TypedExpression FunctionEmitter::MaybeEmitCombinatorialValue( if (negated_op != ast::BinaryOp::kNone) { auto arg0 = MakeOperand(inst, 0); auto arg1 = MakeOperand(inst, 1); - auto* binary_expr = create( - negated_op, std::move(arg0.expr), std::move(arg1.expr)); - auto* negated_expr = create(ast::UnaryOp::kNot, - std::move(binary_expr)); - return {ast_type, std::move(negated_expr)}; + auto* binary_expr = + create(negated_op, arg0.expr, arg1.expr); + auto* negated_expr = + create(ast::UnaryOp::kNot, binary_expr); + return {ast_type, negated_expr}; } if (opcode == SpvOpExtInst) { @@ -2836,9 +2822,8 @@ TypedExpression FunctionEmitter::EmitGlslStd450ExtInst( operands.emplace_back(MakeOperand(inst, iarg).expr); } auto* ast_type = parser_impl_.ConvertType(inst.type_id()); - auto* call = - create(std::move(func), std::move(operands)); - return {ast_type, std::move(call)}; + auto* call = create(func, std::move(operands)); + return {ast_type, call}; } TypedExpression FunctionEmitter::MakeAccessChain( @@ -2956,13 +2941,12 @@ TypedExpression FunctionEmitter::MakeAccessChain( } auto* letter_index = create(swizzles[index_const_val]); - next_expr = create( - std::move(current_expr.expr), std::move(letter_index)); + next_expr = create(current_expr.expr, + letter_index); } else { // Non-constant index. Use array syntax next_expr = create( - std::move(current_expr.expr), - std::move(MakeOperand(inst, index).expr)); + current_expr.expr, MakeOperand(inst, index).expr); } // All vector components are the same type. pointee_type_id = pointee_type_inst->GetSingleWordInOperand(0); @@ -2970,21 +2954,18 @@ TypedExpression FunctionEmitter::MakeAccessChain( case SpvOpTypeMatrix: // Use array syntax. next_expr = create( - std::move(current_expr.expr), - std::move(MakeOperand(inst, index).expr)); + current_expr.expr, MakeOperand(inst, index).expr); // All matrix components are the same type. pointee_type_id = pointee_type_inst->GetSingleWordInOperand(0); break; case SpvOpTypeArray: next_expr = create( - std::move(current_expr.expr), - std::move(MakeOperand(inst, index).expr)); + current_expr.expr, MakeOperand(inst, index).expr); pointee_type_id = pointee_type_inst->GetSingleWordInOperand(0); break; case SpvOpTypeRuntimeArray: next_expr = create( - std::move(current_expr.expr), - std::move(MakeOperand(inst, index).expr)); + current_expr.expr, MakeOperand(inst, index).expr); pointee_type_id = pointee_type_inst->GetSingleWordInOperand(0); break; case SpvOpTypeStruct: { @@ -3005,8 +2986,8 @@ TypedExpression FunctionEmitter::MakeAccessChain( auto* member_access = create( namer_.GetMemberName(pointee_type_id, uint32_t(index_const_val))); - next_expr = create( - std::move(current_expr.expr), std::move(member_access)); + next_expr = create(current_expr.expr, + member_access); pointee_type_id = pointee_type_inst->GetSingleWordInOperand( static_cast(index_const_val)); break; @@ -3021,7 +3002,7 @@ TypedExpression FunctionEmitter::MakeAccessChain( auto* ast_pointer_type = parser_impl_.ConvertType(pointer_type_id); assert(ast_pointer_type); assert(ast_pointer_type->IsPointer()); - current_expr = TypedExpression{ast_pointer_type, std::move(next_expr)}; + current_expr = TypedExpression{ast_pointer_type, next_expr}; } return current_expr; } @@ -3080,8 +3061,8 @@ TypedExpression FunctionEmitter::MakeCompositeExtract( } auto* letter_index = create(swizzles[index_val]); - next_expr = create( - std::move(current_expr.expr), std::move(letter_index)); + next_expr = create(current_expr.expr, + letter_index); // All vector components are the same type. current_type_id = current_type_inst->GetSingleWordInOperand(0); break; @@ -3101,8 +3082,8 @@ TypedExpression FunctionEmitter::MakeCompositeExtract( << ((sizeof(swizzles) / sizeof(swizzles[0])) - 1); } // Use array syntax. - next_expr = create( - std::move(current_expr.expr), make_index(index_val)); + next_expr = create(current_expr.expr, + make_index(index_val)); // All matrix components are the same type. current_type_id = current_type_inst->GetSingleWordInOperand(0); break; @@ -3111,8 +3092,8 @@ TypedExpression FunctionEmitter::MakeCompositeExtract( // The array size could be a spec constant, and so it's not always // statically checkable. Instead, rely on a runtime index clamp // or runtime check to keep this safe. - next_expr = create( - std::move(current_expr.expr), make_index(index_val)); + next_expr = create(current_expr.expr, + make_index(index_val)); current_type_id = current_type_inst->GetSingleWordInOperand(0); break; case SpvOpTypeRuntimeArray: @@ -3129,8 +3110,8 @@ TypedExpression FunctionEmitter::MakeCompositeExtract( auto* member_access = create( namer_.GetMemberName(current_type_id, uint32_t(index_val))); - next_expr = create( - std::move(current_expr.expr), std::move(member_access)); + next_expr = create(current_expr.expr, + member_access); current_type_id = current_type_inst->GetSingleWordInOperand(index_val); break; } @@ -3139,8 +3120,8 @@ TypedExpression FunctionEmitter::MakeCompositeExtract( << current_type_inst->PrettyPrint(); return {}; } - current_expr = TypedExpression{parser_impl_.ConvertType(current_type_id), - std::move(next_expr)}; + current_expr = + TypedExpression{parser_impl_.ConvertType(current_type_id), next_expr}; } return current_expr; } @@ -3197,8 +3178,8 @@ TypedExpression FunctionEmitter::MakeVectorShuffle( return {}; } } - return {result_type, create( - result_type, std::move(values))}; + return {result_type, + create(result_type, values)}; } bool FunctionEmitter::RegisterLocallyDefinedValues() { @@ -3487,15 +3468,15 @@ TypedExpression FunctionEmitter::MakeNumericConversion( } ast::ExpressionList params; - params.push_back(std::move(arg_expr.expr)); + params.push_back(arg_expr.expr); TypedExpression result{expr_type, create( expr_type, std::move(params))}; if (requested_type == expr_type) { return result; } - return {requested_type, create( - requested_type, std::move(result.expr))}; + return {requested_type, + create(requested_type, result.expr)}; } bool FunctionEmitter::EmitFunctionCall(const spvtools::opt::Instruction& inst) { @@ -3507,8 +3488,7 @@ bool FunctionEmitter::EmitFunctionCall(const spvtools::opt::Instruction& inst) { for (uint32_t iarg = 1; iarg < inst.NumInOperands(); ++iarg) { params.emplace_back(MakeOperand(inst, iarg).expr); } - auto* call_expr = - create(std::move(function), std::move(params)); + auto* call_expr = create(function, std::move(params)); auto* result_type = parser_impl_.ConvertType(inst.type_id()); if (!result_type) { return Fail() << "internal error: no mapped type result of call: " @@ -3516,13 +3496,11 @@ bool FunctionEmitter::EmitFunctionCall(const spvtools::opt::Instruction& inst) { } if (result_type->IsVoid()) { - return nullptr != - AddStatementForInstruction( - create(std::move(call_expr)), inst); + return nullptr != AddStatementForInstruction( + create(call_expr), inst); } - return EmitConstDefOrWriteToHoistedVar(inst, - {result_type, std::move(call_expr)}); + return EmitConstDefOrWriteToHoistedVar(inst, {result_type, call_expr}); } TypedExpression FunctionEmitter::MakeIntrinsicCall( @@ -3537,15 +3515,14 @@ TypedExpression FunctionEmitter::MakeIntrinsicCall( for (uint32_t iarg = 0; iarg < inst.NumInOperands(); ++iarg) { params.emplace_back(MakeOperand(inst, iarg).expr); } - auto* call_expr = - create(std::move(ident), std::move(params)); + auto* call_expr = create(ident, std::move(params)); auto* result_type = parser_impl_.ConvertType(inst.type_id()); if (!result_type) { Fail() << "internal error: no mapped type result of call: " << inst.PrettyPrint(); return {}; } - return {result_type, std::move(call_expr)}; + return {result_type, call_expr}; } TypedExpression FunctionEmitter::MakeSimpleSelect( @@ -3563,10 +3540,10 @@ TypedExpression FunctionEmitter::MakeSimpleSelect( if (op_ty->IsVector() || op_ty->is_float_scalar() || op_ty->is_integer_scalar() || op_ty->IsBool()) { ast::ExpressionList params; - params.push_back(std::move(operand1.expr)); - params.push_back(std::move(operand2.expr)); + params.push_back(operand1.expr); + params.push_back(operand2.expr); // The condition goes last. - params.push_back(std::move(condition.expr)); + params.push_back(condition.expr); return {operand1.type, create( create("select"), std::move(params))}; diff --git a/src/reader/spirv/parser_impl.cc b/src/reader/spirv/parser_impl.cc index 6677bb8ef0..7cc274d485 100644 --- a/src/reader/spirv/parser_impl.cc +++ b/src/reader/spirv/parser_impl.cc @@ -851,7 +851,7 @@ ast::type::Type* ParserImpl::ConvertType( return nullptr; } if (ast_member_decoration) { - ast_member_decorations.push_back(std::move(ast_member_decoration)); + ast_member_decorations.push_back(ast_member_decoration); } } } @@ -863,7 +863,7 @@ ast::type::Type* ParserImpl::ConvertType( const auto member_name = namer_.GetMemberName(type_id, member_index); auto* ast_struct_member = create( member_name, ast_member_ty, std::move(ast_member_decorations)); - ast_members.push_back(std::move(ast_struct_member)); + ast_members.push_back(ast_struct_member); } // Now make the struct. @@ -872,7 +872,7 @@ ast::type::Type* ParserImpl::ConvertType( namer_.SuggestSanitizedName(type_id, "S"); auto ast_struct_type = std::make_unique( - namer_.GetName(type_id), std::move(ast_struct)); + namer_.GetName(type_id), ast_struct); auto* result = ctx_.type_mgr().Get(std::move(ast_struct_type)); id_to_type_[type_id] = result; @@ -991,21 +991,21 @@ bool ParserImpl::EmitScalarSpecConstants() { for (const auto& deco : GetDecorationsFor(inst.result_id())) { if ((deco.size() == 2) && (deco[0] == SpvDecorationSpecId)) { auto* cid = create(deco[1], Source{}); - spec_id_decos.push_back(std::move(cid)); + spec_id_decos.push_back(cid); break; } } if (spec_id_decos.empty()) { // Register it as a named constant, without specialization id. ast_var->set_is_const(true); - ast_var->set_constructor(std::move(ast_expr)); - ast_module_.AddGlobalVariable(std::move(ast_var)); + ast_var->set_constructor(ast_expr); + ast_module_.AddGlobalVariable(ast_var); } else { - auto* ast_deco_var = create(std::move(ast_var)); + auto* ast_deco_var = create(ast_var); ast_deco_var->set_is_const(true); - ast_deco_var->set_constructor(std::move(ast_expr)); + ast_deco_var->set_constructor(ast_expr); ast_deco_var->set_decorations(std::move(spec_id_decos)); - ast_module_.AddGlobalVariable(std::move(ast_deco_var)); + ast_module_.AddGlobalVariable(ast_deco_var); } scalar_spec_constants_.insert(inst.result_id()); } @@ -1112,7 +1112,7 @@ bool ParserImpl::EmitModuleScopeVariables() { MakeConstantExpression(var.GetSingleWordInOperand(1)).expr); } // TODO(dneto): initializers (a.k.a. constructor expression) - ast_module_.AddGlobalVariable(std::move(ast_var)); + ast_module_.AddGlobalVariable(ast_var); } // Emit gl_Position instead of gl_PerVertex @@ -1129,7 +1129,7 @@ bool ParserImpl::EmitModuleScopeVariables() { create(ast::Builtin::kPosition, Source{})); var->set_decorations(std::move(decos)); - ast_module_.AddGlobalVariable(std::move(var)); + ast_module_.AddGlobalVariable(var); } return success_; } @@ -1202,7 +1202,7 @@ ast::Variable* ParserImpl::MakeVariable(uint32_t id, } } if (!ast_decorations.empty()) { - auto* decorated_var = create(std::move(ast_var)); + auto* decorated_var = create(ast_var); decorated_var->set_decorations(std::move(ast_decorations)); ast_var = std::move(decorated_var); } @@ -1284,7 +1284,7 @@ TypedExpression ParserImpl::MakeConstantExpression(uint32_t id) { // We've already emitted a diagnostic. return {}; } - ast_components.emplace_back(std::move(ast_component.expr)); + ast_components.emplace_back(ast_component.expr); } return {original_ast_type, create(original_ast_type, @@ -1394,15 +1394,14 @@ TypedExpression ParserImpl::RectifyOperandSignedness(SpvOp op, auto* unsigned_ty = unsigned_type_for_[type]; if (unsigned_ty != nullptr) { // Conversion is required. - return {unsigned_ty, create( - unsigned_ty, std::move(expr.expr))}; + return {unsigned_ty, + create(unsigned_ty, expr.expr)}; } } else if (requires_signed) { auto* signed_ty = signed_type_for_[type]; if (signed_ty != nullptr) { // Conversion is required. - return {signed_ty, - create(signed_ty, std::move(expr.expr))}; + return {signed_ty, create(signed_ty, expr.expr)}; } } // We should not reach here. @@ -1465,8 +1464,7 @@ TypedExpression ParserImpl::RectifyForcedResultType( if ((forced_result_ty == nullptr) || (forced_result_ty == expr.type)) { return expr; } - return {expr.type, - create(expr.type, std::move(expr.expr))}; + return {expr.type, create(expr.type, expr.expr)}; } bool ParserImpl::EmitFunctions() { diff --git a/src/reader/wgsl/parser_impl.cc b/src/reader/wgsl/parser_impl.cc index 50a1764a05..40b37e599a 100644 --- a/src/reader/wgsl/parser_impl.cc +++ b/src/reader/wgsl/parser_impl.cc @@ -268,7 +268,7 @@ Expect ParserImpl::expect_global_decl() { if (!expect("variable declaration", Token::Type::kSemicolon)) return Failure::kErrored; - module_.AddGlobalVariable(std::move(gv.value)); + module_.AddGlobalVariable(gv.value); return true; } @@ -280,7 +280,7 @@ Expect ParserImpl::expect_global_decl() { if (!expect("constant declaration", Token::Type::kSemicolon)) return Failure::kErrored; - module_.AddGlobalVariable(std::move(gc.value)); + module_.AddGlobalVariable(gc.value); return true; } @@ -322,7 +322,7 @@ Expect ParserImpl::expect_global_decl() { if (func.errored) errored = true; if (func.matched) { - module_.AddFunction(std::move(func.value)); + module_.AddFunction(func.value); return true; } @@ -348,23 +348,23 @@ Maybe ParserImpl::global_variable_decl( if (!decl.matched) return Failure::kNoMatch; - auto* var = std::move(decl.value); + auto* var = decl.value; auto var_decos = cast_decorations(decos); if (var_decos.errored) return Failure::kErrored; if (var_decos.value.size() > 0) { - auto* dv = create(std::move(var)); - dv->set_decorations(std::move(var_decos.value)); - var = std::move(dv); + auto* dv = create(var); + dv->set_decorations(var_decos.value); + var = dv; } if (match(Token::Type::kEqual)) { auto expr = expect_const_expr(); if (expr.errored) return Failure::kErrored; - var->set_constructor(std::move(expr.value)); + var->set_constructor(expr.value); } return var; } @@ -392,7 +392,7 @@ Maybe ParserImpl::global_constant_decl() { if (init.errored) return Failure::kErrored; - var->set_constructor(std::move(init.value)); + var->set_constructor(init.value); return var; } @@ -1113,7 +1113,7 @@ Expect ParserImpl::expect_struct_body_decl() { if (member.errored) { errored = true; } else { - members.push_back(std::move(member.value)); + members.push_back(member.value); } } @@ -1177,8 +1177,8 @@ Maybe ParserImpl::function_decl(ast::DecorationList& decos) { if (errored) return Failure::kErrored; - f->set_body(std::move(body.value)); - return std::move(f.value); + f->set_body(body.value); + return f.value; } // function_type_decl @@ -1252,7 +1252,7 @@ Expect ParserImpl::expect_param_list() { // that it's not updatable after intially set. This is unlike C or GLSL // which treat formal parameters like local variables that can be updated. var->set_is_const(true); - ret.push_back(std::move(var)); + ret.push_back(var); if (!match(Token::Type::kComma)) break; @@ -1311,7 +1311,7 @@ Expect ParserImpl::expect_paren_rhs_stmt() { if (!expr.matched) return add_error(peek(), "unable to parse expression"); - return std::move(expr.value); + return expr.value; }); } @@ -1326,7 +1326,7 @@ Expect ParserImpl::expect_statements() { if (stmt.errored) { errored = true; } else if (stmt.matched) { - ret->append(std::move(stmt.value)); + ret->append(stmt.value); } else { break; } @@ -1371,31 +1371,31 @@ Maybe ParserImpl::statement() { if (stmt_if.errored) return Failure::kErrored; if (stmt_if.matched) - return std::move(stmt_if.value); + return stmt_if.value; auto sw = switch_stmt(); if (sw.errored) return Failure::kErrored; if (sw.matched) - return std::move(sw.value); + return sw.value; auto loop = loop_stmt(); if (loop.errored) return Failure::kErrored; if (loop.matched) - return std::move(loop.value); + return loop.value; auto stmt_for = for_stmt(); if (stmt_for.errored) return Failure::kErrored; if (stmt_for.matched) - return std::move(stmt_for.value); + return stmt_for.value; if (peek().IsBraceLeft()) { auto body = expect_body_stmt(); if (body.errored) return Failure::kErrored; - return std::move(body.value); + return body.value; } return Failure::kNoMatch; @@ -1415,37 +1415,37 @@ Maybe ParserImpl::non_block_statement() { if (ret_stmt.errored) return Failure::kErrored; if (ret_stmt.matched) - return std::move(ret_stmt.value); + return ret_stmt.value; auto func = func_call_stmt(); if (func.errored) return Failure::kErrored; if (func.matched) - return std::move(func.value); + return func.value; auto var = variable_stmt(); if (var.errored) return Failure::kErrored; if (var.matched) - return std::move(var.value); + return var.value; auto b = break_stmt(); if (b.errored) return Failure::kErrored; if (b.matched) - return std::move(b.value); + return b.value; auto cont = continue_stmt(); if (cont.errored) return Failure::kErrored; if (cont.matched) - return std::move(cont.value); + return cont.value; auto assign = assignment_stmt(); if (assign.errored) return Failure::kErrored; if (assign.matched) - return std::move(assign.value); + return assign.value; Source source; if (match(Token::Type::kDiscard, &source)) @@ -1475,7 +1475,7 @@ Maybe ParserImpl::return_stmt() { return Failure::kErrored; // TODO(bclayton): Check matched? - return create(source, std::move(expr.value)); + return create(source, expr.value); } // variable_stmt @@ -1500,9 +1500,9 @@ Maybe ParserImpl::variable_stmt() { auto* var = create(decl->source, decl->name, ast::StorageClass::kNone, decl->type); var->set_is_const(true); - var->set_constructor(std::move(constructor.value)); + var->set_constructor(constructor.value); - return create(decl->source, std::move(var)); + return create(decl->source, var); } auto var = variable_decl(); @@ -1518,11 +1518,10 @@ Maybe ParserImpl::variable_stmt() { if (!constructor.matched) return add_error(peek(), "missing constructor for variable declaration"); - var->set_constructor(std::move(constructor.value)); + var->set_constructor(constructor.value); } - return create(var->source(), - std::move(var.value)); + return create(var->source(), var.value); } // if_stmt @@ -1548,12 +1547,11 @@ Maybe ParserImpl::if_stmt() { if (el.errored) return Failure::kErrored; - auto* stmt = create(source, std::move(condition.value), - std::move(body.value)); + auto* stmt = create(source, condition.value, body.value); if (el.matched) { - elseif.value.push_back(std::move(el.value)); + elseif.value.push_back(el.value); } - stmt->set_else_statements(std::move(elseif.value)); + stmt->set_else_statements(elseif.value); return stmt; } @@ -1575,8 +1573,8 @@ Maybe ParserImpl::elseif_stmt() { if (body.errored) return Failure::kErrored; - ret.push_back(create(source, std::move(condition.value), - std::move(body.value))); + ret.push_back( + create(source, condition.value, body.value)); if (!match(Token::Type::kElseIf, &source)) break; @@ -1596,7 +1594,7 @@ Maybe ParserImpl::else_stmt() { if (body.errored) return Failure::kErrored; - return create(source, std::move(body.value)); + return create(source, body.value); } // switch_stmt @@ -1622,7 +1620,7 @@ Maybe ParserImpl::switch_stmt() { } if (!stmt.matched) break; - list.push_back(std::move(stmt.value)); + list.push_back(stmt.value); } if (errored) return Failure::kErrored; @@ -1632,8 +1630,7 @@ Maybe ParserImpl::switch_stmt() { if (body.errored) return Failure::kErrored; - return create(source, std::move(condition.value), - std::move(body.value)); + return create(source, condition.value, body.value); } // switch_body @@ -1669,7 +1666,7 @@ Maybe ParserImpl::switch_body() { if (!body.matched) return add_error(body.source, "expected case body"); - stmt->set_body(std::move(body.value)); + stmt->set_body(body.value); return stmt; } @@ -1720,7 +1717,7 @@ Maybe ParserImpl::case_body() { if (!stmt.matched) break; - ret->append(std::move(stmt.value)); + ret->append(stmt.value); } return ret; @@ -1742,17 +1739,14 @@ Maybe ParserImpl::loop_stmt() { if (continuing.errored) return Failure::kErrored; - return create(source, std::move(body.value), - std::move(continuing.value)); + return create(source, body.value, continuing.value); }); } ForHeader::ForHeader(ast::Statement* init, ast::Expression* cond, ast::Statement* cont) - : initializer(std::move(init)), - condition(std::move(cond)), - continuing(std::move(cont)) {} + : initializer(init), condition(cond), continuing(cont) {} ForHeader::~ForHeader() = default; @@ -1762,19 +1756,19 @@ Maybe ParserImpl::for_header_initializer() { if (call.errored) return Failure::kErrored; if (call.matched) - return std::move(call.value); + return call.value; auto var = variable_stmt(); if (var.errored) return Failure::kErrored; if (var.matched) - return std::move(var.value); + return var.value; auto assign = assignment_stmt(); if (assign.errored) return Failure::kErrored; if (assign.matched) - return std::move(assign.value); + return assign.value; return Failure::kNoMatch; } @@ -1785,13 +1779,13 @@ Maybe ParserImpl::for_header_continuing() { if (call_stmt.errored) return Failure::kErrored; if (call_stmt.matched) - return std::move(call_stmt.value); + return call_stmt.value; auto assign = assignment_stmt(); if (assign.errored) return Failure::kErrored; if (assign.matched) - return std::move(assign.value); + return assign.value; return Failure::kNoMatch; } @@ -1820,9 +1814,8 @@ Expect> ParserImpl::expect_for_header() { if (continuing.errored) return Failure::kErrored; - return std::make_unique(std::move(initializer.value), - std::move(condition.value), - std::move(continuing.value)); + return std::make_unique(initializer.value, condition.value, + continuing.value); } // for_statement @@ -1848,32 +1841,29 @@ Maybe ParserImpl::for_stmt() { if (header->condition != nullptr) { // !condition auto* not_condition = create( - header->condition->source(), ast::UnaryOp::kNot, - std::move(header->condition)); + header->condition->source(), ast::UnaryOp::kNot, header->condition); // { break; } auto* break_stmt = create(not_condition->source()); auto* break_body = create(not_condition->source()); - break_body->append(std::move(break_stmt)); + break_body->append(break_stmt); // if (!condition) { break; } auto* break_if_not_condition = create( - not_condition->source(), std::move(not_condition), - std::move(break_body)); - body->insert(0, std::move(break_if_not_condition)); + not_condition->source(), not_condition, break_body); + body->insert(0, break_if_not_condition); } ast::BlockStatement* continuing_body = nullptr; if (header->continuing != nullptr) { continuing_body = create(header->continuing->source()); - continuing_body->append(std::move(header->continuing)); + continuing_body->append(header->continuing); } - auto* loop = create(source, std::move(body.value), - std::move(continuing_body)); + auto* loop = create(source, body.value, continuing_body); if (header->initializer != nullptr) { auto* result = create(source); - result->append(std::move(header->initializer)); - result->append(std::move(loop)); + result->append(header->initializer); + result->append(loop); return result; } @@ -1955,15 +1945,14 @@ Maybe ParserImpl::primary_expression() { if (lit.errored) return Failure::kErrored; if (lit.matched) - return create(source, - std::move(lit.value)); + return create(source, lit.value); if (t.IsParenLeft()) { auto paren = expect_paren_rhs_stmt(); if (paren.errored) return Failure::kErrored; - return std::move(paren.value); + return paren.value; } if (match(Token::Type::kBitcast)) { @@ -1977,8 +1966,7 @@ Maybe ParserImpl::primary_expression() { if (params.errored) return Failure::kErrored; - return create(source, type.value, - std::move(params.value)); + return create(source, type.value, params.value); } if (match(Token::Type::kIdentifier)) @@ -1999,14 +1987,14 @@ Maybe ParserImpl::primary_expression() { if (params.errored) return Failure::kErrored; - return create( - source, type.value, std::move(params.value)); + return create(source, type.value, + params.value); }); if (expr.errored) return Failure::kErrored; - return std::move(expr.value); + return expr.value; } return Failure::kNoMatch; @@ -2029,8 +2017,8 @@ Maybe ParserImpl::postfix_expr(ast::Expression* prefix) { if (!expect("array accessor", Token::Type::kBracketRight)) return Failure::kErrored; - return postfix_expr(create( - source, std::move(prefix), std::move(param.value))); + return postfix_expr( + create(source, prefix, param.value)); } if (match(Token::Type::kParenLeft, &source)) { @@ -2041,14 +2029,13 @@ Maybe ParserImpl::postfix_expr(ast::Expression* prefix) { auto list = expect_argument_expression_list(); if (list.errored) return Failure::kErrored; - params = std::move(list.value); + params = list.value; } if (!expect("call expression", Token::Type::kParenRight)) return Failure::kErrored; - return postfix_expr(create(source, std::move(prefix), - std::move(params))); + return postfix_expr(create(source, prefix, params)); } if (match(Token::Type::kPeriod)) { @@ -2057,7 +2044,7 @@ Maybe ParserImpl::postfix_expr(ast::Expression* prefix) { return Failure::kErrored; return postfix_expr(create( - ident.source, std::move(prefix), + ident.source, prefix, create(ident.source, ident.value))); } @@ -2073,7 +2060,7 @@ Maybe ParserImpl::postfix_expression() { if (!prefix.matched) return Failure::kNoMatch; - return postfix_expr(std::move(prefix.value)); + return postfix_expr(prefix.value); } // argument_expression_list @@ -2086,7 +2073,7 @@ Expect ParserImpl::expect_argument_expression_list() { return add_error(peek(), "unable to parse argument expression"); ast::ExpressionList ret; - ret.push_back(std::move(arg.value)); + ret.push_back(arg.value); while (match(Token::Type::kComma)) { arg = logical_or_expression(); @@ -2096,7 +2083,7 @@ Expect ParserImpl::expect_argument_expression_list() { return add_error(peek(), "unable to parse argument expression after comma"); } - ret.push_back(std::move(arg.value)); + ret.push_back(arg.value); } return ret; } @@ -2124,7 +2111,7 @@ Maybe ParserImpl::unary_expression() { return add_error(peek(), "unable to parse right side of " + name + " expression"); - return create(source, op, std::move(expr.value)); + return create(source, op, expr.value); } return postfix_expression(); } @@ -2160,8 +2147,8 @@ Expect ParserImpl::expect_multiplicative_expr( "unable to parse right side of " + name + " expression"); } - return expect_multiplicative_expr(create( - source, op, std::move(lhs), std::move(rhs.value))); + return expect_multiplicative_expr( + create(source, op, lhs, rhs.value)); } // multiplicative_expression @@ -2173,7 +2160,7 @@ Maybe ParserImpl::multiplicative_expression() { if (!lhs.matched) return Failure::kNoMatch; - return expect_multiplicative_expr(std::move(lhs.value)); + return expect_multiplicative_expr(lhs.value); } // additive_expr @@ -2201,8 +2188,8 @@ Expect ParserImpl::expect_additive_expr( if (!rhs.matched) return add_error(peek(), "unable to parse right side of + expression"); - return expect_additive_expr(create( - source, op, std::move(lhs), std::move(rhs.value))); + return expect_additive_expr( + create(source, op, lhs, rhs.value)); } // additive_expression @@ -2214,7 +2201,7 @@ Maybe ParserImpl::additive_expression() { if (!lhs.matched) return Failure::kNoMatch; - return expect_additive_expr(std::move(lhs.value)); + return expect_additive_expr(lhs.value); } // shift_expr @@ -2249,8 +2236,8 @@ Expect ParserImpl::expect_shift_expr(ast::Expression* lhs) { return add_error(peek(), std::string("unable to parse right side of ") + name + " expression"); } - return expect_shift_expr(create( - source, op, std::move(lhs), std::move(rhs.value))); + return expect_shift_expr( + create(source, op, lhs, rhs.value)); } // namespace wgsl // shift_expression @@ -2262,7 +2249,7 @@ Maybe ParserImpl::shift_expression() { if (!lhs.matched) return Failure::kNoMatch; - return expect_shift_expr(std::move(lhs.value)); + return expect_shift_expr(lhs.value); } // relational_expr @@ -2298,8 +2285,8 @@ Expect ParserImpl::expect_relational_expr( "unable to parse right side of " + name + " expression"); } - return expect_relational_expr(create( - source, op, std::move(lhs), std::move(rhs.value))); + return expect_relational_expr( + create(source, op, lhs, rhs.value)); } // relational_expression @@ -2311,7 +2298,7 @@ Maybe ParserImpl::relational_expression() { if (!lhs.matched) return Failure::kNoMatch; - return expect_relational_expr(std::move(lhs.value)); + return expect_relational_expr(lhs.value); } // equality_expr @@ -2341,8 +2328,8 @@ Expect ParserImpl::expect_equality_expr( "unable to parse right side of " + name + " expression"); } - return expect_equality_expr(create( - source, op, std::move(lhs), std::move(rhs.value))); + return expect_equality_expr( + create(source, op, lhs, rhs.value)); } // equality_expression @@ -2354,7 +2341,7 @@ Maybe ParserImpl::equality_expression() { if (!lhs.matched) return Failure::kNoMatch; - return expect_equality_expr(std::move(lhs.value)); + return expect_equality_expr(lhs.value); } // and_expr @@ -2375,7 +2362,7 @@ Expect ParserImpl::expect_and_expr(ast::Expression* lhs) { return add_error(peek(), "unable to parse right side of & expression"); return expect_and_expr(create( - source, ast::BinaryOp::kAnd, std::move(lhs), std::move(rhs.value))); + source, ast::BinaryOp::kAnd, lhs, rhs.value)); } // and_expression @@ -2387,7 +2374,7 @@ Maybe ParserImpl::and_expression() { if (!lhs.matched) return Failure::kNoMatch; - return expect_and_expr(std::move(lhs.value)); + return expect_and_expr(lhs.value); } // exclusive_or_expr @@ -2406,7 +2393,7 @@ Expect ParserImpl::expect_exclusive_or_expr( return add_error(peek(), "unable to parse right side of ^ expression"); return expect_exclusive_or_expr(create( - source, ast::BinaryOp::kXor, std::move(lhs), std::move(rhs.value))); + source, ast::BinaryOp::kXor, lhs, rhs.value)); } // exclusive_or_expression @@ -2418,7 +2405,7 @@ Maybe ParserImpl::exclusive_or_expression() { if (!lhs.matched) return Failure::kNoMatch; - return expect_exclusive_or_expr(std::move(lhs.value)); + return expect_exclusive_or_expr(lhs.value); } // inclusive_or_expr @@ -2437,7 +2424,7 @@ Expect ParserImpl::expect_inclusive_or_expr( return add_error(peek(), "unable to parse right side of | expression"); return expect_inclusive_or_expr(create( - source, ast::BinaryOp::kOr, std::move(lhs), std::move(rhs.value))); + source, ast::BinaryOp::kOr, lhs, rhs.value)); } // inclusive_or_expression @@ -2449,7 +2436,7 @@ Maybe ParserImpl::inclusive_or_expression() { if (!lhs.matched) return Failure::kNoMatch; - return expect_inclusive_or_expr(std::move(lhs.value)); + return expect_inclusive_or_expr(lhs.value); } // logical_and_expr @@ -2470,9 +2457,8 @@ Expect ParserImpl::expect_logical_and_expr( if (!rhs.matched) return add_error(peek(), "unable to parse right side of && expression"); - return expect_logical_and_expr( - create(source, ast::BinaryOp::kLogicalAnd, - std::move(lhs), std::move(rhs.value))); + return expect_logical_and_expr(create( + source, ast::BinaryOp::kLogicalAnd, lhs, rhs.value)); } // logical_and_expression @@ -2484,7 +2470,7 @@ Maybe ParserImpl::logical_and_expression() { if (!lhs.matched) return Failure::kNoMatch; - return expect_logical_and_expr(std::move(lhs.value)); + return expect_logical_and_expr(lhs.value); } // logical_or_expr @@ -2503,7 +2489,7 @@ Expect ParserImpl::expect_logical_or_expr( return add_error(peek(), "unable to parse right side of || expression"); return expect_logical_or_expr(create( - source, ast::BinaryOp::kLogicalOr, std::move(lhs), std::move(rhs.value))); + source, ast::BinaryOp::kLogicalOr, lhs, rhs.value)); } // logical_or_expression @@ -2515,7 +2501,7 @@ Maybe ParserImpl::logical_or_expression() { if (!lhs.matched) return Failure::kNoMatch; - return expect_logical_or_expr(std::move(lhs.value)); + return expect_logical_or_expr(lhs.value); } // assignment_stmt @@ -2539,8 +2525,7 @@ Maybe ParserImpl::assignment_stmt() { if (!rhs.matched) return add_error(peek(), "unable to parse right side of assignment"); - return create(source, std::move(lhs.value), - std::move(rhs.value)); + return create(source, lhs.value, rhs.value); } // const_literal @@ -2601,12 +2586,12 @@ Expect ParserImpl::expect_const_expr_internal( auto param = expect_const_expr_internal(depth + 1); if (param.errored) return Failure::kErrored; - list.emplace_back(std::move(param.value)); + list.emplace_back(param.value); while (match(Token::Type::kComma)) { param = expect_const_expr_internal(depth + 1); if (param.errored) return Failure::kErrored; - list.emplace_back(std::move(param.value)); + list.emplace_back(param.value); } return list; }); @@ -2615,7 +2600,7 @@ Expect ParserImpl::expect_const_expr_internal( return Failure::kErrored; return create(source, type.value, - std::move(params.value)); + params.value); } auto lit = const_literal(); @@ -2624,7 +2609,7 @@ Expect ParserImpl::expect_const_expr_internal( if (!lit.matched) return add_error(peek(), "unable to parse const literal"); - return create(source, std::move(lit.value)); + return create(source, lit.value); } Maybe ParserImpl::decoration_list() { @@ -2669,7 +2654,7 @@ Maybe ParserImpl::decoration_bracketed_list(ast::DecorationList& decos) { auto deco = expect_decoration(); if (deco.errored) errored = true; - decos.emplace_back(std::move(deco.value)); + decos.emplace_back(deco.value); if (match(Token::Type::kComma)) continue; @@ -2701,7 +2686,7 @@ Expect ParserImpl::expect_decoration() { if (deco.errored) return Failure::kErrored; if (deco.matched) - return std::move(deco.value); + return deco.value; return add_error(t, "expected decoration"); } @@ -2824,7 +2809,7 @@ Expect> ParserImpl::cast_decorations(ast::DecorationList& in) { ok = false; continue; } - out.emplace_back(ast::As(std::move(deco))); + out.emplace_back(ast::As(deco)); } // clear in so that we can verify decorations were consumed with // expect_decorations_consumed() diff --git a/src/reader/wgsl/parser_impl_function_decoration_list_test.cc b/src/reader/wgsl/parser_impl_function_decoration_list_test.cc index 46b4f36f64..53dad7f9d2 100644 --- a/src/reader/wgsl/parser_impl_function_decoration_list_test.cc +++ b/src/reader/wgsl/parser_impl_function_decoration_list_test.cc @@ -30,8 +30,8 @@ TEST_F(ParserImplTest, FunctionDecorationList_Parses) { EXPECT_TRUE(decos.matched); ASSERT_EQ(decos.value.size(), 2u); - auto* deco_0 = ast::As(std::move(decos.value[0])); - auto* deco_1 = ast::As(std::move(decos.value[1])); + auto* deco_0 = ast::As(decos.value[0]); + auto* deco_1 = ast::As(decos.value[1]); ASSERT_NE(deco_0, nullptr); ASSERT_NE(deco_1, nullptr); diff --git a/src/reader/wgsl/parser_impl_function_decoration_test.cc b/src/reader/wgsl/parser_impl_function_decoration_test.cc index 75991b2afc..583a5bb835 100644 --- a/src/reader/wgsl/parser_impl_function_decoration_test.cc +++ b/src/reader/wgsl/parser_impl_function_decoration_test.cc @@ -30,7 +30,7 @@ TEST_F(ParserImplTest, FunctionDecoration_Workgroup) { EXPECT_FALSE(deco.errored); ASSERT_NE(deco.value, nullptr) << p->error(); ASSERT_FALSE(p->has_error()); - auto* func_deco = ast::As(std::move(deco.value)); + auto* func_deco = ast::As(deco.value); ASSERT_NE(func_deco, nullptr); ASSERT_TRUE(func_deco->IsWorkgroup()); @@ -50,7 +50,7 @@ TEST_F(ParserImplTest, FunctionDecoration_Workgroup_2Param) { EXPECT_FALSE(deco.errored); ASSERT_NE(deco.value, nullptr) << p->error(); ASSERT_FALSE(p->has_error()); - auto* func_deco = ast::As(std::move(deco.value)); + auto* func_deco = ast::As(deco.value); ASSERT_NE(func_deco, nullptr) << p->error(); ASSERT_TRUE(func_deco->IsWorkgroup()); @@ -70,7 +70,7 @@ TEST_F(ParserImplTest, FunctionDecoration_Workgroup_3Param) { EXPECT_FALSE(deco.errored); ASSERT_NE(deco.value, nullptr) << p->error(); ASSERT_FALSE(p->has_error()); - auto* func_deco = ast::As(std::move(deco.value)); + auto* func_deco = ast::As(deco.value); ASSERT_NE(func_deco, nullptr); ASSERT_TRUE(func_deco->IsWorkgroup()); @@ -257,7 +257,7 @@ TEST_F(ParserImplTest, FunctionDecoration_Stage) { EXPECT_FALSE(deco.errored); ASSERT_NE(deco.value, nullptr) << p->error(); ASSERT_FALSE(p->has_error()); - auto* func_deco = ast::As(std::move(deco.value)); + auto* func_deco = ast::As(deco.value); ASSERT_NE(func_deco, nullptr); ASSERT_TRUE(func_deco->IsStage()); EXPECT_EQ(func_deco->AsStage()->value(), ast::PipelineStage::kCompute); diff --git a/src/reader/wgsl/parser_impl_struct_decoration_decl_test.cc b/src/reader/wgsl/parser_impl_struct_decoration_decl_test.cc index 8c8b988593..08358f29b5 100644 --- a/src/reader/wgsl/parser_impl_struct_decoration_decl_test.cc +++ b/src/reader/wgsl/parser_impl_struct_decoration_decl_test.cc @@ -28,7 +28,7 @@ TEST_F(ParserImplTest, StructDecorationDecl_Parses) { EXPECT_FALSE(decos.errored); EXPECT_TRUE(decos.matched); ASSERT_EQ(decos.value.size(), 1u); - auto* struct_deco = ast::As(std::move(decos.value[0])); + auto* struct_deco = ast::As(decos.value[0]); EXPECT_TRUE(struct_deco->IsBlock()); } diff --git a/src/reader/wgsl/parser_impl_struct_decoration_test.cc b/src/reader/wgsl/parser_impl_struct_decoration_test.cc index ba37441ffa..b18f486914 100644 --- a/src/reader/wgsl/parser_impl_struct_decoration_test.cc +++ b/src/reader/wgsl/parser_impl_struct_decoration_test.cc @@ -43,7 +43,7 @@ TEST_P(StructDecorationTest, Parses) { EXPECT_TRUE(deco.matched); EXPECT_FALSE(deco.errored); ASSERT_NE(deco.value, nullptr); - auto* struct_deco = ast::As(std::move(deco.value)); + auto* struct_deco = ast::As(deco.value); ASSERT_NE(struct_deco, nullptr); EXPECT_EQ(struct_deco->IsBlock(), params.is_block); } diff --git a/src/reader/wgsl/parser_impl_struct_member_decoration_decl_test.cc b/src/reader/wgsl/parser_impl_struct_member_decoration_decl_test.cc index 2e696d3e44..0ef8b44a6d 100644 --- a/src/reader/wgsl/parser_impl_struct_member_decoration_decl_test.cc +++ b/src/reader/wgsl/parser_impl_struct_member_decoration_decl_test.cc @@ -48,7 +48,7 @@ TEST_F(ParserImplTest, StructMemberDecorationDecl_Single) { EXPECT_FALSE(decos.errored); EXPECT_TRUE(decos.matched); ASSERT_EQ(decos.value.size(), 1u); - auto* deco = ast::As(std::move(decos.value[0])); + auto* deco = ast::As(decos.value[0]); ASSERT_NE(deco, nullptr); EXPECT_TRUE(deco->IsOffset()); } diff --git a/src/reader/wgsl/parser_impl_struct_member_decoration_test.cc b/src/reader/wgsl/parser_impl_struct_member_decoration_test.cc index adb21db8f4..963d32a9e7 100644 --- a/src/reader/wgsl/parser_impl_struct_member_decoration_test.cc +++ b/src/reader/wgsl/parser_impl_struct_member_decoration_test.cc @@ -30,8 +30,7 @@ TEST_F(ParserImplTest, StructMemberDecoration_Offset) { ASSERT_NE(deco.value, nullptr); ASSERT_FALSE(p->has_error()); - auto* member_deco = - ast::As(std::move(deco.value)); + auto* member_deco = ast::As(deco.value); ASSERT_NE(member_deco, nullptr); ASSERT_TRUE(member_deco->IsOffset()); diff --git a/src/reader/wgsl/parser_impl_variable_decoration_list_test.cc b/src/reader/wgsl/parser_impl_variable_decoration_list_test.cc index 9f53688f20..60d9a49dcc 100644 --- a/src/reader/wgsl/parser_impl_variable_decoration_list_test.cc +++ b/src/reader/wgsl/parser_impl_variable_decoration_list_test.cc @@ -31,8 +31,8 @@ TEST_F(ParserImplTest, VariableDecorationList_Parses) { ASSERT_TRUE(decos.matched); ASSERT_EQ(decos.value.size(), 2u); - auto* deco_0 = ast::As(std::move(decos.value[0])); - auto* deco_1 = ast::As(std::move(decos.value[1])); + auto* deco_0 = ast::As(decos.value[0]); + auto* deco_1 = ast::As(decos.value[1]); ASSERT_NE(deco_0, nullptr); ASSERT_NE(deco_1, nullptr); diff --git a/src/reader/wgsl/parser_impl_variable_decoration_test.cc b/src/reader/wgsl/parser_impl_variable_decoration_test.cc index 6ac7ac3d08..e992a61618 100644 --- a/src/reader/wgsl/parser_impl_variable_decoration_test.cc +++ b/src/reader/wgsl/parser_impl_variable_decoration_test.cc @@ -31,7 +31,7 @@ TEST_F(ParserImplTest, VariableDecoration_Location) { EXPECT_TRUE(deco.matched); EXPECT_FALSE(deco.errored); ASSERT_NE(deco.value, nullptr); - auto* var_deco = ast::As(std::move(deco.value)); + auto* var_deco = ast::As(deco.value); ASSERT_NE(var_deco, nullptr); ASSERT_FALSE(p->has_error()); ASSERT_TRUE(var_deco->IsLocation()); @@ -101,7 +101,7 @@ TEST_P(BuiltinTest, VariableDecoration_Builtin) { EXPECT_TRUE(deco.matched); EXPECT_FALSE(deco.errored); ASSERT_NE(deco.value, nullptr); - auto* var_deco = ast::As(std::move(deco.value)); + auto* var_deco = ast::As(deco.value); ASSERT_FALSE(p->has_error()) << p->error(); ASSERT_NE(var_deco, nullptr); ASSERT_TRUE(var_deco->IsBuiltin()); @@ -180,7 +180,7 @@ TEST_F(ParserImplTest, VariableDecoration_Binding) { EXPECT_TRUE(deco.matched); EXPECT_FALSE(deco.errored); ASSERT_NE(deco.value, nullptr); - auto* var_deco = ast::As(std::move(deco.value)); + auto* var_deco = ast::As(deco.value); ASSERT_NE(var_deco, nullptr); ASSERT_FALSE(p->has_error()); ASSERT_TRUE(var_deco->IsBinding()); @@ -237,7 +237,7 @@ TEST_F(ParserImplTest, VariableDecoration_set) { EXPECT_TRUE(deco.matched); EXPECT_FALSE(deco.errored); ASSERT_NE(deco.value, nullptr); - auto* var_deco = ast::As(std::move(deco.value)); + auto* var_deco = ast::As(deco.value); ASSERT_FALSE(p->has_error()); ASSERT_NE(var_deco, nullptr); ASSERT_TRUE(var_deco->IsSet()); diff --git a/src/transform/bound_array_accessors_transform.cc b/src/transform/bound_array_accessors_transform.cc index cbc4bac8f2..4aebfebb32 100644 --- a/src/transform/bound_array_accessors_transform.cc +++ b/src/transform/bound_array_accessors_transform.cc @@ -244,8 +244,7 @@ bool BoundArrayAccessorsTransform::ProcessAccessExpression( cast_expr.push_back(expr->idx_expr()); ast::ExpressionList params; - params.push_back( - create(u32, std::move(cast_expr))); + params.push_back(create(u32, cast_expr)); params.push_back(create( create(u32, size - 1))); @@ -253,7 +252,7 @@ bool BoundArrayAccessorsTransform::ProcessAccessExpression( create("min"), std::move(params)); call_expr->set_result_type(u32); - expr->set_idx_expr(std::move(call_expr)); + expr->set_idx_expr(call_expr); } return true; } diff --git a/src/transform/bound_array_accessors_transform_test.cc b/src/transform/bound_array_accessors_transform_test.cc index d0613b7438..aa994ae4d5 100644 --- a/src/transform/bound_array_accessors_transform_test.cc +++ b/src/transform/bound_array_accessors_transform_test.cc @@ -54,15 +54,15 @@ class BoundArrayAccessorsTest : public testing::Test { ast::BlockStatement* SetupFunctionAndBody() { auto* block = create(); body_ = block; - auto* func = create("func", ast::VariableList{}, &void_type_, - std::move(block)); - mod_.AddFunction(std::move(func)); + auto* func = + create("func", ast::VariableList{}, &void_type_, block); + mod_.AddFunction(func); return body_; } void DeclareVariable(ast::Variable* var) { ASSERT_NE(body_, nullptr); - body_->append(create(std::move(var))); + body_->append(create(var)); } TypeDeterminer* td() { return &td_; } @@ -105,19 +105,18 @@ TEST_F(BoundArrayAccessorsTest, Ptrs_Clamp) { auto* c_var = create("c", ast::StorageClass::kFunction, &u32); c_var->set_is_const(true); - DeclareVariable(std::move(c_var)); + DeclareVariable(c_var); auto* access_idx = create("c"); - auto* access_ptr = access_idx; auto* accessor = create( - create("a"), std::move(access_idx)); + create("a"), access_idx); auto* ptr = accessor; auto* b = create("b", ast::StorageClass::kFunction, &ptr_type); - b->set_constructor(std::move(accessor)); + b->set_constructor(accessor); b->set_is_const(true); - DeclareVariable(std::move(b)); + DeclareVariable(b); ASSERT_TRUE(td()->Determine()) << td()->error(); @@ -136,7 +135,7 @@ TEST_F(BoundArrayAccessorsTest, Ptrs_Clamp) { auto* tc = idx->params()[0]->AsConstructor()->AsTypeConstructor(); EXPECT_TRUE(tc->type()->IsU32()); ASSERT_EQ(tc->values().size(), 1u); - ASSERT_EQ(tc->values()[0], access_ptr); + ASSERT_EQ(tc->values()[0], access_idx); ASSERT_TRUE(idx->params()[1]->IsConstructor()); ASSERT_TRUE(idx->params()[1]->AsConstructor()->IsScalarConstructor()); @@ -170,18 +169,17 @@ TEST_F(BoundArrayAccessorsTest, Array_Idx_Nested_Scalar) { create("i", ast::StorageClass::kFunction, &u32)); auto* b_access_idx = create("i"); - auto* b_access_ptr = b_access_idx; auto* a_access_idx = create( - create("b"), std::move(b_access_idx)); + create("b"), b_access_idx); auto* accessor = create( - create("a"), std::move(a_access_idx)); + create("a"), a_access_idx); auto* ptr = accessor; auto* b = create("c", ast::StorageClass::kFunction, &f32); - b->set_constructor(std::move(accessor)); - DeclareVariable(std::move(b)); + b->set_constructor(accessor); + DeclareVariable(b); ASSERT_TRUE(td()->Determine()) << td()->error(); @@ -214,7 +212,7 @@ TEST_F(BoundArrayAccessorsTest, Array_Idx_Nested_Scalar) { tc = sub_idx->params()[0]->AsConstructor()->AsTypeConstructor(); EXPECT_TRUE(tc->type()->IsU32()); ASSERT_EQ(tc->values().size(), 1u); - ASSERT_EQ(tc->values()[0], b_access_ptr); + ASSERT_EQ(tc->values()[0], b_access_idx); ASSERT_TRUE(sub_idx->params()[1]->IsConstructor()); ASSERT_TRUE(sub_idx->params()[1]->AsConstructor()->IsScalarConstructor()); @@ -253,8 +251,8 @@ TEST_F(BoundArrayAccessorsTest, Array_Idx_Scalar) { auto* ptr = accessor; auto* b = create("b", ast::StorageClass::kFunction, &f32); - b->set_constructor(std::move(accessor)); - DeclareVariable(std::move(b)); + b->set_constructor(accessor); + DeclareVariable(b); ASSERT_TRUE(td()->Determine()) << td()->error(); @@ -295,15 +293,14 @@ TEST_F(BoundArrayAccessorsTest, Array_Idx_Expr) { create(&u32, 2)), create( create(&u32, 3)))); - auto* access_ptr = access_idx; auto* accessor = create( - create("a"), std::move(access_idx)); + create("a"), access_idx); auto* ptr = accessor; auto* b = create("b", ast::StorageClass::kFunction, &f32); - b->set_constructor(std::move(accessor)); - DeclareVariable(std::move(b)); + b->set_constructor(accessor); + DeclareVariable(b); ASSERT_TRUE(td()->Determine()) << td()->error(); @@ -322,7 +319,7 @@ TEST_F(BoundArrayAccessorsTest, Array_Idx_Expr) { auto* tc = idx->params()[0]->AsConstructor()->AsTypeConstructor(); EXPECT_TRUE(tc->type()->IsU32()); ASSERT_EQ(tc->values().size(), 1u); - ASSERT_EQ(tc->values()[0], access_ptr); + ASSERT_EQ(tc->values()[0], access_idx); ASSERT_TRUE(idx->params()[1]->IsConstructor()); ASSERT_TRUE(idx->params()[1]->AsConstructor()->IsScalarConstructor()); @@ -355,8 +352,8 @@ TEST_F(BoundArrayAccessorsTest, Array_Idx_Negative) { auto* ptr = accessor; auto* b = create("b", ast::StorageClass::kFunction, &f32); - b->set_constructor(std::move(accessor)); - DeclareVariable(std::move(b)); + b->set_constructor(accessor); + DeclareVariable(b); ASSERT_TRUE(td()->Determine()) << td()->error(); @@ -394,8 +391,8 @@ TEST_F(BoundArrayAccessorsTest, Array_Idx_OutOfBounds) { auto* ptr = accessor; auto* b = create("b", ast::StorageClass::kFunction, &f32); - b->set_constructor(std::move(accessor)); - DeclareVariable(std::move(b)); + b->set_constructor(accessor); + DeclareVariable(b); ASSERT_TRUE(td()->Determine()) << td()->error(); @@ -433,8 +430,8 @@ TEST_F(BoundArrayAccessorsTest, Vector_Idx_Scalar) { auto* ptr = accessor; auto* b = create("b", ast::StorageClass::kFunction, &f32); - b->set_constructor(std::move(accessor)); - DeclareVariable(std::move(b)); + b->set_constructor(accessor); + DeclareVariable(b); ASSERT_TRUE(td()->Determine()) << td()->error(); @@ -475,15 +472,14 @@ TEST_F(BoundArrayAccessorsTest, Vector_Idx_Expr) { create(&u32, 2)), create( create(&u32, 3)))); - auto* access_ptr = access_idx; auto* accessor = create( - create("a"), std::move(access_idx)); + create("a"), access_idx); auto* ptr = accessor; auto* b = create("b", ast::StorageClass::kFunction, &f32); - b->set_constructor(std::move(accessor)); - DeclareVariable(std::move(b)); + b->set_constructor(accessor); + DeclareVariable(b); ASSERT_TRUE(td()->Determine()) << td()->error(); @@ -501,7 +497,7 @@ TEST_F(BoundArrayAccessorsTest, Vector_Idx_Expr) { auto* tc = idx->params()[0]->AsConstructor()->AsTypeConstructor(); EXPECT_TRUE(tc->type()->IsU32()); ASSERT_EQ(tc->values().size(), 1u); - ASSERT_EQ(tc->values()[0], access_ptr); + ASSERT_EQ(tc->values()[0], access_idx); ASSERT_TRUE(idx->params()[1]->IsConstructor()); ASSERT_TRUE(idx->params()[1]->AsConstructor()->IsScalarConstructor()); @@ -534,8 +530,8 @@ TEST_F(BoundArrayAccessorsTest, Vector_Idx_Negative) { auto* ptr = accessor; auto* b = create("b", ast::StorageClass::kFunction, &f32); - b->set_constructor(std::move(accessor)); - DeclareVariable(std::move(b)); + b->set_constructor(accessor); + DeclareVariable(b); ASSERT_TRUE(td()->Determine()) << td()->error(); @@ -573,8 +569,8 @@ TEST_F(BoundArrayAccessorsTest, Vector_Idx_OutOfBounds) { auto* ptr = accessor; auto* b = create("b", ast::StorageClass::kFunction, &f32); - b->set_constructor(std::move(accessor)); - DeclareVariable(std::move(b)); + b->set_constructor(accessor); + DeclareVariable(b); ASSERT_TRUE(td()->Determine()) << td()->error(); @@ -615,8 +611,8 @@ TEST_F(BoundArrayAccessorsTest, Matrix_Idx_Scalar) { auto* ptr = accessor; auto* b = create("b", ast::StorageClass::kFunction, &f32); - b->set_constructor(std::move(accessor)); - DeclareVariable(std::move(b)); + b->set_constructor(accessor); + DeclareVariable(b); ASSERT_TRUE(td()->Determine()) << td()->error(); @@ -670,18 +666,17 @@ TEST_F(BoundArrayAccessorsTest, Matrix_Idx_Expr_Column) { create(&u32, 2)), create( create(&u32, 3)))); - auto* access_ptr = access_idx; auto* accessor = create( create( - create("a"), std::move(access_idx)), + create("a"), access_idx), create( create(&u32, 1u))); auto* ptr = accessor; auto* b = create("b", ast::StorageClass::kFunction, &f32); - b->set_constructor(std::move(accessor)); - DeclareVariable(std::move(b)); + b->set_constructor(accessor); + DeclareVariable(b); ASSERT_TRUE(td()->Determine()) << td()->error(); @@ -703,7 +698,7 @@ TEST_F(BoundArrayAccessorsTest, Matrix_Idx_Expr_Column) { auto* tc = idx->params()[0]->AsConstructor()->AsTypeConstructor(); EXPECT_TRUE(tc->type()->IsU32()); ASSERT_EQ(tc->values().size(), 1u); - ASSERT_EQ(tc->values()[0], access_ptr); + ASSERT_EQ(tc->values()[0], access_idx); ASSERT_TRUE(idx->params()[1]->IsConstructor()); ASSERT_TRUE(idx->params()[1]->AsConstructor()->IsScalarConstructor()); @@ -749,19 +744,18 @@ TEST_F(BoundArrayAccessorsTest, Matrix_Idx_Expr_Row) { create(&u32, 2)), create( create(&u32, 3)))); - auto* access_ptr = access_idx; auto* accessor = create( create( create("a"), create( create(&u32, 1u))), - std::move(access_idx)); + access_idx); auto* ptr = accessor; auto* b = create("b", ast::StorageClass::kFunction, &f32); - b->set_constructor(std::move(accessor)); - DeclareVariable(std::move(b)); + b->set_constructor(accessor); + DeclareVariable(b); ASSERT_TRUE(td()->Determine()) << td()->error(); @@ -790,7 +784,7 @@ TEST_F(BoundArrayAccessorsTest, Matrix_Idx_Expr_Row) { auto* tc = idx->params()[0]->AsConstructor()->AsTypeConstructor(); EXPECT_TRUE(tc->type()->IsU32()); ASSERT_EQ(tc->values().size(), 1u); - ASSERT_EQ(tc->values()[0], access_ptr); + ASSERT_EQ(tc->values()[0], access_idx); ASSERT_TRUE(idx->params()[1]->IsConstructor()); ASSERT_TRUE(idx->params()[1]->AsConstructor()->IsScalarConstructor()); @@ -828,8 +822,8 @@ TEST_F(BoundArrayAccessorsTest, Matrix_Idx_Negative_Column) { auto* ptr = accessor; auto* b = create("b", ast::StorageClass::kFunction, &f32); - b->set_constructor(std::move(accessor)); - DeclareVariable(std::move(b)); + b->set_constructor(accessor); + DeclareVariable(b); ASSERT_TRUE(td()->Determine()) << td()->error(); @@ -882,8 +876,8 @@ TEST_F(BoundArrayAccessorsTest, Matrix_Idx_Negative_Row) { auto* ptr = accessor; auto* b = create("b", ast::StorageClass::kFunction, &f32); - b->set_constructor(std::move(accessor)); - DeclareVariable(std::move(b)); + b->set_constructor(accessor); + DeclareVariable(b); ASSERT_TRUE(td()->Determine()) << td()->error(); @@ -937,8 +931,8 @@ TEST_F(BoundArrayAccessorsTest, Matrix_Idx_OutOfBounds_Column) { auto* ptr = accessor; auto* b = create("b", ast::StorageClass::kFunction, &f32); - b->set_constructor(std::move(accessor)); - DeclareVariable(std::move(b)); + b->set_constructor(accessor); + DeclareVariable(b); ASSERT_TRUE(td()->Determine()) << td()->error(); @@ -992,8 +986,8 @@ TEST_F(BoundArrayAccessorsTest, Matrix_Idx_OutOfBounds_Row) { auto* ptr = accessor; auto* b = create("b", ast::StorageClass::kFunction, &f32); - b->set_constructor(std::move(accessor)); - DeclareVariable(std::move(b)); + b->set_constructor(accessor); + DeclareVariable(b); ASSERT_TRUE(td()->Determine()) << td()->error(); diff --git a/src/transform/vertex_pulling_transform.cc b/src/transform/vertex_pulling_transform.cc index f057ada1a4..7707194f65 100644 --- a/src/transform/vertex_pulling_transform.cc +++ b/src/transform/vertex_pulling_transform.cc @@ -151,7 +151,7 @@ void VertexPullingTransform::FindOrInsertVertexIndexIfUsed() { create(ast::Builtin::kVertexIdx, Source{})); var->set_decorations(std::move(decorations)); - mod_->AddGlobalVariable(std::move(var)); + mod_->AddGlobalVariable(var); } void VertexPullingTransform::FindOrInsertInstanceIndexIfUsed() { @@ -193,7 +193,7 @@ void VertexPullingTransform::FindOrInsertInstanceIndexIfUsed() { create(ast::Builtin::kInstanceIdx, Source{})); var->set_decorations(std::move(decorations)); - mod_->AddGlobalVariable(std::move(var)); + mod_->AddGlobalVariable(var); } void VertexPullingTransform::ConvertVertexInputVariablesToPrivate() { @@ -257,7 +257,7 @@ void VertexPullingTransform::AddVertexStorageBuffers() { decorations.push_back(create(pulling_set_, Source{})); var->set_decorations(std::move(decorations)); - mod_->AddGlobalVariable(std::move(var)); + mod_->AddGlobalVariable(var); } mod_->AddConstructedType(struct_type); } @@ -278,7 +278,7 @@ void VertexPullingTransform::AddVertexPullingPreamble( // |kPullingPosVarName| refers to the byte location of the current read. We // declare a variable in the shader to avoid having to reuse Expression // objects. - block->append(std::move(pos_declaration)); + block->append(pos_declaration); for (uint32_t i = 0; i < vertex_state_->vertex_buffers.size(); ++i) { const VertexBufferLayoutDescriptor& buffer_layout = @@ -302,14 +302,14 @@ void VertexPullingTransform::AddVertexPullingPreamble( auto* pos_value = create( ast::BinaryOp::kAdd, create( - ast::BinaryOp::kMultiply, std::move(index_identifier), + ast::BinaryOp::kMultiply, index_identifier, GenUint(static_cast(buffer_layout.array_stride))), GenUint(static_cast(attribute_desc.offset))); // Update position of the read auto* set_pos_expr = create( - CreatePullingPositionIdent(), std::move(pos_value)); - block->append(std::move(set_pos_expr)); + CreatePullingPositionIdent(), pos_value); + block->append(set_pos_expr); block->append(create( create(v->name()), @@ -317,7 +317,7 @@ void VertexPullingTransform::AddVertexPullingPreamble( } } - vertex_func->body()->insert(0, std::move(block)); + vertex_func->body()->insert(0, block); } ast::Expression* VertexPullingTransform::GenUint(uint32_t value) { @@ -367,22 +367,19 @@ ast::Expression* VertexPullingTransform::AccessU32(uint32_t buffer, create( create(GetVertexBufferName(buffer)), create(kStructBufferName)), - create(ast::BinaryOp::kDivide, std::move(pos), - GenUint(4))); + create(ast::BinaryOp::kDivide, pos, GenUint(4))); } ast::Expression* VertexPullingTransform::AccessI32(uint32_t buffer, ast::Expression* pos) { // as reinterprets bits - return create(GetI32Type(), - AccessU32(buffer, std::move(pos))); + return create(GetI32Type(), AccessU32(buffer, pos)); } ast::Expression* VertexPullingTransform::AccessF32(uint32_t buffer, ast::Expression* pos) { // as reinterprets bits - return create(GetF32Type(), - AccessU32(buffer, std::move(pos))); + return create(GetF32Type(), AccessU32(buffer, pos)); } ast::Expression* VertexPullingTransform::AccessPrimitive(uint32_t buffer, @@ -394,11 +391,11 @@ ast::Expression* VertexPullingTransform::AccessPrimitive(uint32_t buffer, // from the position variable. switch (format) { case VertexFormat::kU32: - return AccessU32(buffer, std::move(pos)); + return AccessU32(buffer, pos); case VertexFormat::kI32: - return AccessI32(buffer, std::move(pos)); + return AccessI32(buffer, pos); case VertexFormat::kF32: - return AccessF32(buffer, std::move(pos)); + return AccessF32(buffer, pos); default: return nullptr; } @@ -415,8 +412,7 @@ ast::Expression* VertexPullingTransform::AccessVec(uint32_t buffer, auto* cur_pos = create(ast::BinaryOp::kAdd, CreatePullingPositionIdent(), GenUint(element_stride * i)); - expr_list.push_back( - AccessPrimitive(buffer, std::move(cur_pos), base_format)); + expr_list.push_back(AccessPrimitive(buffer, cur_pos, base_format)); } return create( @@ -443,8 +439,8 @@ VertexBufferLayoutDescriptor::VertexBufferLayoutDescriptor( uint64_t in_array_stride, InputStepMode in_step_mode, std::vector in_attributes) - : array_stride(std::move(in_array_stride)), - step_mode(std::move(in_step_mode)), + : array_stride(in_array_stride), + step_mode(in_step_mode), attributes(std::move(in_attributes)) {} VertexBufferLayoutDescriptor::VertexBufferLayoutDescriptor( diff --git a/src/transform/vertex_pulling_transform_test.cc b/src/transform/vertex_pulling_transform_test.cc index 8f9b3b6ae9..f8af1329ec 100644 --- a/src/transform/vertex_pulling_transform_test.cc +++ b/src/transform/vertex_pulling_transform_test.cc @@ -47,7 +47,7 @@ class VertexPullingTransformHelper { create()); func->add_decoration( create(ast::PipelineStage::kVertex, Source{})); - mod()->AddFunction(std::move(func)); + mod()->AddFunction(func); } // Set up the transformation, after building the module @@ -58,7 +58,7 @@ class VertexPullingTransformHelper { EXPECT_TRUE(td.Determine()); transform_->SetVertexState( - std::make_unique(std::move(vertex_state))); + std::make_unique(vertex_state)); transform_->SetEntryPoint("main"); } @@ -72,8 +72,8 @@ class VertexPullingTransformHelper { ast::VariableDecorationList decorations; decorations.push_back(create(location, Source{})); - var->set_decorations(std::move(decorations)); - mod_->AddGlobalVariable(std::move(var)); + var->set_decorations(decorations); + mod_->AddGlobalVariable(var); } Context* ctx() { return &ctx_; } @@ -125,7 +125,7 @@ TEST_F(VertexPullingTransformTest, Error_EntryPointWrongStage) { create()); func->add_decoration( create(ast::PipelineStage::kFragment, Source{})); - mod()->AddFunction(std::move(func)); + mod()->AddFunction(func); InitTransform({}); EXPECT_FALSE(transform()->Run()); @@ -410,8 +410,8 @@ TEST_F(VertexPullingTransformTest, ExistingVertexIndexAndInstanceIndex) { decorations.push_back( create(ast::Builtin::kVertexIdx, Source{})); - vertex_index_var->set_decorations(std::move(decorations)); - mod()->AddGlobalVariable(std::move(vertex_index_var)); + vertex_index_var->set_decorations(decorations); + mod()->AddGlobalVariable(vertex_index_var); } { @@ -423,8 +423,8 @@ TEST_F(VertexPullingTransformTest, ExistingVertexIndexAndInstanceIndex) { decorations.push_back( create(ast::Builtin::kInstanceIdx, Source{})); - instance_index_var->set_decorations(std::move(decorations)); - mod()->AddGlobalVariable(std::move(instance_index_var)); + instance_index_var->set_decorations(decorations); + mod()->AddGlobalVariable(instance_index_var); } InitTransform( diff --git a/src/type_determiner_test.cc b/src/type_determiner_test.cc index ec0535e87c..7a251518f8 100644 --- a/src/type_determiner_test.cc +++ b/src/type_determiner_test.cc @@ -133,20 +133,17 @@ TEST_F(TypeDeterminerTest, Stmt_Assign) { auto* lhs = create( create(&i32, 2)); - auto* lhs_ptr = lhs; - auto* rhs = create( create(&f32, 2.3f)); - auto* rhs_ptr = rhs; - ast::AssignmentStatement assign(std::move(lhs), std::move(rhs)); + ast::AssignmentStatement assign(lhs, rhs); EXPECT_TRUE(td()->DetermineResultType(&assign)); - ASSERT_NE(lhs_ptr->result_type(), nullptr); - ASSERT_NE(rhs_ptr->result_type(), nullptr); + ASSERT_NE(lhs->result_type(), nullptr); + ASSERT_NE(rhs->result_type(), nullptr); - EXPECT_TRUE(lhs_ptr->result_type()->IsI32()); - EXPECT_TRUE(rhs_ptr->result_type()->IsF32()); + EXPECT_TRUE(lhs->result_type()->IsI32()); + EXPECT_TRUE(rhs->result_type()->IsF32()); } TEST_F(TypeDeterminerTest, Stmt_Case) { @@ -155,25 +152,21 @@ TEST_F(TypeDeterminerTest, Stmt_Case) { auto* lhs = create( create(&i32, 2)); - auto* lhs_ptr = lhs; - auto* rhs = create( create(&f32, 2.3f)); - auto* rhs_ptr = rhs; auto* body = create(); - body->append( - create(std::move(lhs), std::move(rhs))); + body->append(create(lhs, rhs)); ast::CaseSelectorList lit; lit.push_back(create(&i32, 3)); - ast::CaseStatement cse(std::move(lit), std::move(body)); + ast::CaseStatement cse(lit, body); EXPECT_TRUE(td()->DetermineResultType(&cse)); - ASSERT_NE(lhs_ptr->result_type(), nullptr); - ASSERT_NE(rhs_ptr->result_type(), nullptr); - EXPECT_TRUE(lhs_ptr->result_type()->IsI32()); - EXPECT_TRUE(rhs_ptr->result_type()->IsF32()); + ASSERT_NE(lhs->result_type(), nullptr); + ASSERT_NE(rhs->result_type(), nullptr); + EXPECT_TRUE(lhs->result_type()->IsI32()); + EXPECT_TRUE(rhs->result_type()->IsF32()); } TEST_F(TypeDeterminerTest, Stmt_Block) { @@ -182,21 +175,17 @@ TEST_F(TypeDeterminerTest, Stmt_Block) { auto* lhs = create( create(&i32, 2)); - auto* lhs_ptr = lhs; - auto* rhs = create( create(&f32, 2.3f)); - auto* rhs_ptr = rhs; ast::BlockStatement block; - block.append( - create(std::move(lhs), std::move(rhs))); + block.append(create(lhs, rhs)); EXPECT_TRUE(td()->DetermineResultType(&block)); - ASSERT_NE(lhs_ptr->result_type(), nullptr); - ASSERT_NE(rhs_ptr->result_type(), nullptr); - EXPECT_TRUE(lhs_ptr->result_type()->IsI32()); - EXPECT_TRUE(rhs_ptr->result_type()->IsF32()); + ASSERT_NE(lhs->result_type(), nullptr); + ASSERT_NE(rhs->result_type(), nullptr); + EXPECT_TRUE(lhs->result_type()->IsI32()); + EXPECT_TRUE(rhs->result_type()->IsF32()); } TEST_F(TypeDeterminerTest, Stmt_Else) { @@ -205,27 +194,23 @@ TEST_F(TypeDeterminerTest, Stmt_Else) { auto* lhs = create( create(&i32, 2)); - auto* lhs_ptr = lhs; - auto* rhs = create( create(&f32, 2.3f)); - auto* rhs_ptr = rhs; auto* body = create(); - body->append( - create(std::move(lhs), std::move(rhs))); + body->append(create(lhs, rhs)); ast::ElseStatement stmt(create( create(&i32, 3)), - std::move(body)); + body); EXPECT_TRUE(td()->DetermineResultType(&stmt)); ASSERT_NE(stmt.condition()->result_type(), nullptr); - ASSERT_NE(lhs_ptr->result_type(), nullptr); - ASSERT_NE(rhs_ptr->result_type(), nullptr); + ASSERT_NE(lhs->result_type(), nullptr); + ASSERT_NE(rhs->result_type(), nullptr); EXPECT_TRUE(stmt.condition()->result_type()->IsI32()); - EXPECT_TRUE(lhs_ptr->result_type()->IsI32()); - EXPECT_TRUE(rhs_ptr->result_type()->IsF32()); + EXPECT_TRUE(lhs->result_type()->IsI32()); + EXPECT_TRUE(rhs->result_type()->IsF32()); } TEST_F(TypeDeterminerTest, Stmt_If) { @@ -234,52 +219,44 @@ TEST_F(TypeDeterminerTest, Stmt_If) { auto* else_lhs = create( create(&i32, 2)); - auto* else_lhs_ptr = else_lhs; - auto* else_rhs = create( create(&f32, 2.3f)); - auto* else_rhs_ptr = else_rhs; auto* else_body = create(); - else_body->append(create(std::move(else_lhs), - std::move(else_rhs))); + else_body->append(create(else_lhs, else_rhs)); auto* else_stmt = create(create( create(&i32, 3)), - std::move(else_body)); + else_body); ast::ElseStatementList else_stmts; - else_stmts.push_back(std::move(else_stmt)); + else_stmts.push_back(else_stmt); auto* lhs = create( create(&i32, 2)); - auto* lhs_ptr = lhs; - auto* rhs = create( create(&f32, 2.3f)); - auto* rhs_ptr = rhs; auto* body = create(); - body->append( - create(std::move(lhs), std::move(rhs))); + body->append(create(lhs, rhs)); ast::IfStatement stmt(create( create(&i32, 3)), - std::move(body)); - stmt.set_else_statements(std::move(else_stmts)); + body); + stmt.set_else_statements(else_stmts); EXPECT_TRUE(td()->DetermineResultType(&stmt)); ASSERT_NE(stmt.condition()->result_type(), nullptr); - ASSERT_NE(else_lhs_ptr->result_type(), nullptr); - ASSERT_NE(else_rhs_ptr->result_type(), nullptr); - ASSERT_NE(lhs_ptr->result_type(), nullptr); - ASSERT_NE(rhs_ptr->result_type(), nullptr); + ASSERT_NE(else_lhs->result_type(), nullptr); + ASSERT_NE(else_rhs->result_type(), nullptr); + ASSERT_NE(lhs->result_type(), nullptr); + ASSERT_NE(rhs->result_type(), nullptr); EXPECT_TRUE(stmt.condition()->result_type()->IsI32()); - EXPECT_TRUE(else_lhs_ptr->result_type()->IsI32()); - EXPECT_TRUE(else_rhs_ptr->result_type()->IsF32()); - EXPECT_TRUE(lhs_ptr->result_type()->IsI32()); - EXPECT_TRUE(rhs_ptr->result_type()->IsF32()); + EXPECT_TRUE(else_lhs->result_type()->IsI32()); + EXPECT_TRUE(else_rhs->result_type()->IsF32()); + EXPECT_TRUE(lhs->result_type()->IsI32()); + EXPECT_TRUE(rhs->result_type()->IsF32()); } TEST_F(TypeDeterminerTest, Stmt_Loop) { @@ -288,39 +265,32 @@ TEST_F(TypeDeterminerTest, Stmt_Loop) { auto* body_lhs = create( create(&i32, 2)); - auto* body_lhs_ptr = body_lhs; - auto* body_rhs = create( create(&f32, 2.3f)); - auto* body_rhs_ptr = body_rhs; auto* body = create(); - body->append(create(std::move(body_lhs), - std::move(body_rhs))); + body->append(create(body_lhs, body_rhs)); auto* continuing_lhs = create( create(&i32, 2)); - auto* continuing_lhs_ptr = continuing_lhs; - auto* continuing_rhs = create( create(&f32, 2.3f)); - auto* continuing_rhs_ptr = continuing_rhs; auto* continuing = create(); - continuing->append(create( - std::move(continuing_lhs), std::move(continuing_rhs))); + continuing->append( + create(continuing_lhs, continuing_rhs)); - ast::LoopStatement stmt(std::move(body), std::move(continuing)); + ast::LoopStatement stmt(body, continuing); EXPECT_TRUE(td()->DetermineResultType(&stmt)); - ASSERT_NE(body_lhs_ptr->result_type(), nullptr); - ASSERT_NE(body_rhs_ptr->result_type(), nullptr); - ASSERT_NE(continuing_lhs_ptr->result_type(), nullptr); - ASSERT_NE(continuing_rhs_ptr->result_type(), nullptr); - EXPECT_TRUE(body_lhs_ptr->result_type()->IsI32()); - EXPECT_TRUE(body_rhs_ptr->result_type()->IsF32()); - EXPECT_TRUE(continuing_lhs_ptr->result_type()->IsI32()); - EXPECT_TRUE(continuing_rhs_ptr->result_type()->IsF32()); + ASSERT_NE(body_lhs->result_type(), nullptr); + ASSERT_NE(body_rhs->result_type(), nullptr); + ASSERT_NE(continuing_lhs->result_type(), nullptr); + ASSERT_NE(continuing_rhs->result_type(), nullptr); + EXPECT_TRUE(body_lhs->result_type()->IsI32()); + EXPECT_TRUE(body_rhs->result_type()->IsF32()); + EXPECT_TRUE(continuing_lhs->result_type()->IsI32()); + EXPECT_TRUE(continuing_rhs->result_type()->IsF32()); } TEST_F(TypeDeterminerTest, Stmt_Return) { @@ -328,13 +298,12 @@ TEST_F(TypeDeterminerTest, Stmt_Return) { auto* cond = create( create(&i32, 2)); - auto* cond_ptr = cond; - ast::ReturnStatement ret(std::move(cond)); + ast::ReturnStatement ret(cond); EXPECT_TRUE(td()->DetermineResultType(&ret)); - ASSERT_NE(cond_ptr->result_type(), nullptr); - EXPECT_TRUE(cond_ptr->result_type()->IsI32()); + ASSERT_NE(cond->result_type(), nullptr); + EXPECT_TRUE(cond->result_type()->IsI32()); } TEST_F(TypeDeterminerTest, Stmt_Return_WithoutValue) { @@ -349,56 +318,51 @@ TEST_F(TypeDeterminerTest, Stmt_Switch) { auto* lhs = create( create(&i32, 2)); - auto* lhs_ptr = lhs; - auto* rhs = create( create(&f32, 2.3f)); - auto* rhs_ptr = rhs; auto* body = create(); - body->append( - create(std::move(lhs), std::move(rhs))); + body->append(create(lhs, rhs)); ast::CaseSelectorList lit; lit.push_back(create(&i32, 3)); ast::CaseStatementList cases; - cases.push_back(create(std::move(lit), std::move(body))); + cases.push_back(create(lit, body)); ast::SwitchStatement stmt(create( create(&i32, 2)), - std::move(cases)); + cases); EXPECT_TRUE(td()->DetermineResultType(&stmt)) << td()->error(); ASSERT_NE(stmt.condition()->result_type(), nullptr); - ASSERT_NE(lhs_ptr->result_type(), nullptr); - ASSERT_NE(rhs_ptr->result_type(), nullptr); + ASSERT_NE(lhs->result_type(), nullptr); + ASSERT_NE(rhs->result_type(), nullptr); EXPECT_TRUE(stmt.condition()->result_type()->IsI32()); - EXPECT_TRUE(lhs_ptr->result_type()->IsI32()); - EXPECT_TRUE(rhs_ptr->result_type()->IsF32()); + EXPECT_TRUE(lhs->result_type()->IsI32()); + EXPECT_TRUE(rhs->result_type()->IsF32()); } TEST_F(TypeDeterminerTest, Stmt_Call) { ast::type::F32Type f32; ast::VariableList params; - auto* func = create("my_func", std::move(params), &f32, + auto* func = create("my_func", params, &f32, create()); - mod()->AddFunction(std::move(func)); + mod()->AddFunction(func); // Register the function EXPECT_TRUE(td()->Determine()); ast::ExpressionList call_params; auto* expr = create( - create("my_func"), std::move(call_params)); - auto* expr_ptr = expr; + create("my_func"), call_params); - ast::CallStatement call(std::move(expr)); + ast::CallStatement call(expr); EXPECT_TRUE(td()->DetermineResultType(&call)); - ASSERT_NE(expr_ptr->result_type(), nullptr); - EXPECT_TRUE(expr_ptr->result_type()->IsF32()); + ASSERT_NE(expr->result_type(), nullptr); + EXPECT_TRUE(expr->result_type()->IsF32()); } TEST_F(TypeDeterminerTest, Stmt_Call_undeclared) { @@ -409,20 +373,18 @@ TEST_F(TypeDeterminerTest, Stmt_Call_undeclared) { auto* call_expr = create(create( Source{Source::Location{12, 34}}, "func"), - std::move(call_params)); + call_params); ast::VariableList params0; auto* main_body = create(); - main_body->append(create(std::move(call_expr))); + main_body->append(create(call_expr)); main_body->append(create()); - auto* func_main = create("main", std::move(params0), &f32, - std::move(main_body)); - mod()->AddFunction(std::move(func_main)); + auto* func_main = create("main", params0, &f32, main_body); + mod()->AddFunction(func_main); auto* body = create(); body->append(create()); - auto* func = - create("func", std::move(params0), &f32, std::move(body)); - mod()->AddFunction(std::move(func)); + auto* func = create("func", params0, &f32, body); + mod()->AddFunction(func); EXPECT_FALSE(td()->Determine()) << td()->error(); EXPECT_EQ(td()->error(), @@ -434,13 +396,13 @@ TEST_F(TypeDeterminerTest, Stmt_VariableDecl) { auto* var = create("my_var", ast::StorageClass::kNone, &i32); var->set_constructor(create( create(&i32, 2))); - auto* init_ptr = var->constructor(); + auto* init = var->constructor(); - ast::VariableDeclStatement decl(std::move(var)); + ast::VariableDeclStatement decl(var); EXPECT_TRUE(td()->DetermineResultType(&decl)); - ASSERT_NE(init_ptr->result_type(), nullptr); - EXPECT_TRUE(init_ptr->result_type()->IsI32()); + ASSERT_NE(init->result_type(), nullptr); + EXPECT_TRUE(init->result_type()->IsI32()); } TEST_F(TypeDeterminerTest, Stmt_VariableDecl_ModuleScope) { @@ -448,13 +410,13 @@ TEST_F(TypeDeterminerTest, Stmt_VariableDecl_ModuleScope) { auto* var = create("my_var", ast::StorageClass::kNone, &i32); var->set_constructor(create( create(&i32, 2))); - auto* init_ptr = var->constructor(); + auto* init = var->constructor(); - mod()->AddGlobalVariable(std::move(var)); + mod()->AddGlobalVariable(var); EXPECT_TRUE(td()->Determine()); - ASSERT_NE(init_ptr->result_type(), nullptr); - EXPECT_TRUE(init_ptr->result_type()->IsI32()); + ASSERT_NE(init->result_type(), nullptr); + EXPECT_TRUE(init->result_type()->IsI32()); } TEST_F(TypeDeterminerTest, Expr_Error_Unknown) { @@ -474,13 +436,13 @@ TEST_F(TypeDeterminerTest, Expr_ArrayAccessor_Array) { create(&i32, 2)); auto* var = create("my_var", ast::StorageClass::kFunction, &ary); - mod()->AddGlobalVariable(std::move(var)); + mod()->AddGlobalVariable(var); // Register the global EXPECT_TRUE(td()->Determine()); ast::ArrayAccessorExpression acc(create("my_var"), - std::move(idx)); + idx); EXPECT_TRUE(td()->DetermineResultType(&acc)); ASSERT_NE(acc.result_type(), nullptr); ASSERT_TRUE(acc.result_type()->IsPointer()); @@ -499,13 +461,13 @@ TEST_F(TypeDeterminerTest, Expr_ArrayAccessor_Alias_Array) { create(&i32, 2)); auto* var = create("my_var", ast::StorageClass::kFunction, &aary); - mod()->AddGlobalVariable(std::move(var)); + mod()->AddGlobalVariable(var); // Register the global EXPECT_TRUE(td()->Determine()); ast::ArrayAccessorExpression acc(create("my_var"), - std::move(idx)); + idx); EXPECT_TRUE(td()->DetermineResultType(&acc)); ASSERT_NE(acc.result_type(), nullptr); ASSERT_TRUE(acc.result_type()->IsPointer()); @@ -524,13 +486,13 @@ TEST_F(TypeDeterminerTest, Expr_ArrayAccessor_Array_Constant) { auto* var = create("my_var", ast::StorageClass::kFunction, &ary); var->set_is_const(true); - mod()->AddGlobalVariable(std::move(var)); + mod()->AddGlobalVariable(var); // Register the global EXPECT_TRUE(td()->Determine()); ast::ArrayAccessorExpression acc(create("my_var"), - std::move(idx)); + idx); EXPECT_TRUE(td()->DetermineResultType(&acc)); ASSERT_NE(acc.result_type(), nullptr); EXPECT_TRUE(acc.result_type()->IsF32()) << acc.result_type()->type_name(); @@ -544,13 +506,13 @@ TEST_F(TypeDeterminerTest, Expr_ArrayAccessor_Matrix) { auto* idx = create( create(&i32, 2)); auto* var = create("my_var", ast::StorageClass::kNone, &mat); - mod()->AddGlobalVariable(std::move(var)); + mod()->AddGlobalVariable(var); // Register the global EXPECT_TRUE(td()->Determine()); ast::ArrayAccessorExpression acc(create("my_var"), - std::move(idx)); + idx); EXPECT_TRUE(td()->DetermineResultType(&acc)); ASSERT_NE(acc.result_type(), nullptr); ASSERT_TRUE(acc.result_type()->IsPointer()); @@ -570,15 +532,15 @@ TEST_F(TypeDeterminerTest, Expr_ArrayAccessor_Matrix_BothDimensions) { auto* idx2 = create( create(&i32, 1)); auto* var = create("my_var", ast::StorageClass::kNone, &mat); - mod()->AddGlobalVariable(std::move(var)); + mod()->AddGlobalVariable(var); // Register the global EXPECT_TRUE(td()->Determine()); ast::ArrayAccessorExpression acc( create( - create("my_var"), std::move(idx1)), - std::move(idx2)); + create("my_var"), idx1), + idx2); EXPECT_TRUE(td()->DetermineResultType(&acc)); ASSERT_NE(acc.result_type(), nullptr); @@ -596,13 +558,13 @@ TEST_F(TypeDeterminerTest, Expr_ArrayAccessor_Vector) { auto* idx = create( create(&i32, 2)); auto* var = create("my_var", ast::StorageClass::kNone, &vec); - mod()->AddGlobalVariable(std::move(var)); + mod()->AddGlobalVariable(var); // Register the global EXPECT_TRUE(td()->Determine()); ast::ArrayAccessorExpression acc(create("my_var"), - std::move(idx)); + idx); EXPECT_TRUE(td()->DetermineResultType(&acc)); ASSERT_NE(acc.result_type(), nullptr); ASSERT_TRUE(acc.result_type()->IsPointer()); @@ -628,16 +590,16 @@ TEST_F(TypeDeterminerTest, Expr_Call) { ast::type::F32Type f32; ast::VariableList params; - auto* func = create("my_func", std::move(params), &f32, + auto* func = create("my_func", params, &f32, create()); - mod()->AddFunction(std::move(func)); + mod()->AddFunction(func); // Register the function EXPECT_TRUE(td()->Determine()); ast::ExpressionList call_params; ast::CallExpression call(create("my_func"), - std::move(call_params)); + call_params); EXPECT_TRUE(td()->DetermineResultType(&call)); ASSERT_NE(call.result_type(), nullptr); EXPECT_TRUE(call.result_type()->IsF32()); @@ -647,9 +609,9 @@ TEST_F(TypeDeterminerTest, Expr_Call_WithParams) { ast::type::F32Type f32; ast::VariableList params; - auto* func = create("my_func", std::move(params), &f32, + auto* func = create("my_func", params, &f32, create()); - mod()->AddFunction(std::move(func)); + mod()->AddFunction(func); // Register the function EXPECT_TRUE(td()->Determine()); @@ -658,13 +620,13 @@ TEST_F(TypeDeterminerTest, Expr_Call_WithParams) { call_params.push_back(create( create(&f32, 2.4))); - auto* param_ptr = call_params.back(); + auto* param = call_params.back(); ast::CallExpression call(create("my_func"), - std::move(call_params)); + call_params); EXPECT_TRUE(td()->DetermineResultType(&call)); - ASSERT_NE(param_ptr->result_type(), nullptr); - EXPECT_TRUE(param_ptr->result_type()->IsF32()); + ASSERT_NE(param->result_type(), nullptr); + EXPECT_TRUE(param->result_type()->IsF32()); } TEST_F(TypeDeterminerTest, Expr_Call_Intrinsic) { @@ -678,7 +640,7 @@ TEST_F(TypeDeterminerTest, Expr_Call_Intrinsic) { create(&f32, 2.4))); ast::CallExpression call(create("round"), - std::move(call_params)); + call_params); EXPECT_TRUE(td()->DetermineResultType(&call)); ASSERT_NE(call.result_type(), nullptr); @@ -690,7 +652,7 @@ TEST_F(TypeDeterminerTest, Expr_Cast) { ast::ExpressionList params; params.push_back(create("name")); - ast::TypeConstructorExpression cast(&f32, std::move(params)); + ast::TypeConstructorExpression cast(&f32, params); ast::Variable v("name", ast::StorageClass::kPrivate, &f32); td()->RegisterVariableForTesting(&v); @@ -721,7 +683,7 @@ TEST_F(TypeDeterminerTest, Expr_Constructor_Type) { vals.push_back(create( create(&f32, 3.0f))); - ast::TypeConstructorExpression tc(&vec, std::move(vals)); + ast::TypeConstructorExpression tc(&vec, vals); EXPECT_TRUE(td()->DetermineResultType(&tc)); ASSERT_NE(tc.result_type(), nullptr); @@ -733,7 +695,7 @@ TEST_F(TypeDeterminerTest, Expr_Constructor_Type) { TEST_F(TypeDeterminerTest, Expr_Identifier_GlobalVariable) { ast::type::F32Type f32; auto* var = create("my_var", ast::StorageClass::kNone, &f32); - mod()->AddGlobalVariable(std::move(var)); + mod()->AddGlobalVariable(var); // Register the global EXPECT_TRUE(td()->Determine()); @@ -749,7 +711,7 @@ TEST_F(TypeDeterminerTest, Expr_Identifier_GlobalConstant) { ast::type::F32Type f32; auto* var = create("my_var", ast::StorageClass::kNone, &f32); var->set_is_const(true); - mod()->AddGlobalVariable(std::move(var)); + mod()->AddGlobalVariable(var); // Register the global EXPECT_TRUE(td()->Determine()); @@ -764,44 +726,42 @@ TEST_F(TypeDeterminerTest, Expr_Identifier_FunctionVariable_Const) { ast::type::F32Type f32; auto* my_var = create("my_var"); - auto* my_var_ptr = my_var; auto* var = create("my_var", ast::StorageClass::kNone, &f32); var->set_is_const(true); auto* body = create(); - body->append(create(std::move(var))); + body->append(create(var)); body->append(create( - std::move(my_var), create("my_var"))); + my_var, create("my_var"))); - ast::Function f("my_func", {}, &f32, std::move(body)); + ast::Function f("my_func", {}, &f32, body); EXPECT_TRUE(td()->DetermineFunction(&f)); - ASSERT_NE(my_var_ptr->result_type(), nullptr); - EXPECT_TRUE(my_var_ptr->result_type()->IsF32()); + ASSERT_NE(my_var->result_type(), nullptr); + EXPECT_TRUE(my_var->result_type()->IsF32()); } TEST_F(TypeDeterminerTest, Expr_Identifier_FunctionVariable) { ast::type::F32Type f32; auto* my_var = create("my_var"); - auto* my_var_ptr = my_var; auto* body = create(); body->append(create( create("my_var", ast::StorageClass::kNone, &f32))); body->append(create( - std::move(my_var), create("my_var"))); + my_var, create("my_var"))); - ast::Function f("my_func", {}, &f32, std::move(body)); + ast::Function f("my_func", {}, &f32, body); EXPECT_TRUE(td()->DetermineFunction(&f)); - ASSERT_NE(my_var_ptr->result_type(), nullptr); - EXPECT_TRUE(my_var_ptr->result_type()->IsPointer()); - EXPECT_TRUE(my_var_ptr->result_type()->AsPointer()->type()->IsF32()); + ASSERT_NE(my_var->result_type(), nullptr); + EXPECT_TRUE(my_var->result_type()->IsPointer()); + EXPECT_TRUE(my_var->result_type()->AsPointer()->type()->IsF32()); } TEST_F(TypeDeterminerTest, Expr_Identifier_Function_Ptr) { @@ -809,31 +769,30 @@ TEST_F(TypeDeterminerTest, Expr_Identifier_Function_Ptr) { ast::type::PointerType ptr(&f32, ast::StorageClass::kFunction); auto* my_var = create("my_var"); - auto* my_var_ptr = my_var; auto* body = create(); body->append(create( create("my_var", ast::StorageClass::kNone, &ptr))); body->append(create( - std::move(my_var), create("my_var"))); + my_var, create("my_var"))); - ast::Function f("my_func", {}, &f32, std::move(body)); + ast::Function f("my_func", {}, &f32, body); EXPECT_TRUE(td()->DetermineFunction(&f)); - ASSERT_NE(my_var_ptr->result_type(), nullptr); - EXPECT_TRUE(my_var_ptr->result_type()->IsPointer()); - EXPECT_TRUE(my_var_ptr->result_type()->AsPointer()->type()->IsF32()); + ASSERT_NE(my_var->result_type(), nullptr); + EXPECT_TRUE(my_var->result_type()->IsPointer()); + EXPECT_TRUE(my_var->result_type()->AsPointer()->type()->IsF32()); } TEST_F(TypeDeterminerTest, Expr_Identifier_Function) { ast::type::F32Type f32; ast::VariableList params; - auto* func = create("my_func", std::move(params), &f32, + auto* func = create("my_func", params, &f32, create()); - mod()->AddFunction(std::move(func)); + mod()->AddFunction(func); // Register the function EXPECT_TRUE(td()->Determine()); @@ -863,17 +822,11 @@ TEST_F(TypeDeterminerTest, Function_RegisterInputOutputVariables) { auto* priv_var = create("priv_var", ast::StorageClass::kPrivate, &f32); - auto* in_ptr = in_var; - auto* out_ptr = out_var; - auto* sb_ptr = sb_var; - auto* wg_ptr = wg_var; - auto* priv_ptr = priv_var; - - mod()->AddGlobalVariable(std::move(in_var)); - mod()->AddGlobalVariable(std::move(out_var)); - mod()->AddGlobalVariable(std::move(sb_var)); - mod()->AddGlobalVariable(std::move(wg_var)); - mod()->AddGlobalVariable(std::move(priv_var)); + mod()->AddGlobalVariable(in_var); + mod()->AddGlobalVariable(out_var); + mod()->AddGlobalVariable(sb_var); + mod()->AddGlobalVariable(wg_var); + mod()->AddGlobalVariable(priv_var); ast::VariableList params; auto* body = create(); @@ -889,22 +842,20 @@ TEST_F(TypeDeterminerTest, Function_RegisterInputOutputVariables) { body->append(create( create("priv_var"), create("priv_var"))); - auto* func = create("my_func", std::move(params), &f32, - std::move(body)); - auto* func_ptr = func; + auto* func = create("my_func", params, &f32, body); - mod()->AddFunction(std::move(func)); + mod()->AddFunction(func); // Register the function EXPECT_TRUE(td()->Determine()); - const auto& vars = func_ptr->referenced_module_variables(); + const auto& vars = func->referenced_module_variables(); ASSERT_EQ(vars.size(), 5u); - EXPECT_EQ(vars[0], out_ptr); - EXPECT_EQ(vars[1], in_ptr); - EXPECT_EQ(vars[2], wg_ptr); - EXPECT_EQ(vars[3], sb_ptr); - EXPECT_EQ(vars[4], priv_ptr); + EXPECT_EQ(vars[0], out_var); + EXPECT_EQ(vars[1], in_var); + EXPECT_EQ(vars[2], wg_var); + EXPECT_EQ(vars[3], sb_var); + EXPECT_EQ(vars[4], priv_var); } TEST_F(TypeDeterminerTest, Function_RegisterInputOutputVariables_SubFunction) { @@ -921,17 +872,11 @@ TEST_F(TypeDeterminerTest, Function_RegisterInputOutputVariables_SubFunction) { auto* priv_var = create("priv_var", ast::StorageClass::kPrivate, &f32); - auto* in_ptr = in_var; - auto* out_ptr = out_var; - auto* sb_ptr = sb_var; - auto* wg_ptr = wg_var; - auto* priv_ptr = priv_var; - - mod()->AddGlobalVariable(std::move(in_var)); - mod()->AddGlobalVariable(std::move(out_var)); - mod()->AddGlobalVariable(std::move(sb_var)); - mod()->AddGlobalVariable(std::move(wg_var)); - mod()->AddGlobalVariable(std::move(priv_var)); + mod()->AddGlobalVariable(in_var); + mod()->AddGlobalVariable(out_var); + mod()->AddGlobalVariable(sb_var); + mod()->AddGlobalVariable(wg_var); + mod()->AddGlobalVariable(priv_var); auto* body = create(); body->append(create( @@ -947,32 +892,29 @@ TEST_F(TypeDeterminerTest, Function_RegisterInputOutputVariables_SubFunction) { create("priv_var"), create("priv_var"))); ast::VariableList params; - auto* func = create("my_func", std::move(params), &f32, - std::move(body)); + auto* func = create("my_func", params, &f32, body); - mod()->AddFunction(std::move(func)); + mod()->AddFunction(func); body = create(); body->append(create( create("out_var"), create(create("my_func"), ast::ExpressionList{}))); - auto* func2 = - create("func", std::move(params), &f32, std::move(body)); - auto* func2_ptr = func2; + auto* func2 = create("func", params, &f32, body); - mod()->AddFunction(std::move(func2)); + mod()->AddFunction(func2); // Register the function EXPECT_TRUE(td()->Determine()); - const auto& vars = func2_ptr->referenced_module_variables(); + const auto& vars = func2->referenced_module_variables(); ASSERT_EQ(vars.size(), 5u); - EXPECT_EQ(vars[0], out_ptr); - EXPECT_EQ(vars[1], in_ptr); - EXPECT_EQ(vars[2], wg_ptr); - EXPECT_EQ(vars[3], sb_ptr); - EXPECT_EQ(vars[4], priv_ptr); + EXPECT_EQ(vars[0], out_var); + EXPECT_EQ(vars[1], in_var); + EXPECT_EQ(vars[2], wg_var); + EXPECT_EQ(vars[3], sb_var); + EXPECT_EQ(vars[4], priv_var); } TEST_F(TypeDeterminerTest, Function_NotRegisterFunctionVariable) { @@ -982,18 +924,16 @@ TEST_F(TypeDeterminerTest, Function_NotRegisterFunctionVariable) { create("in_var", ast::StorageClass::kFunction, &f32); auto* body = create(); - body->append(create(std::move(var))); + body->append(create(var)); body->append(create( create("var"), create( create(&f32, 1.f)))); ast::VariableList params; - auto* func = create("my_func", std::move(params), &f32, - std::move(body)); - auto* func_ptr = func; + auto* func = create("my_func", params, &f32, body); - mod()->AddFunction(std::move(func)); + mod()->AddFunction(func); ast::Variable v("var", ast::StorageClass::kFunction, &f32); td()->RegisterVariableForTesting(&v); @@ -1001,7 +941,7 @@ TEST_F(TypeDeterminerTest, Function_NotRegisterFunctionVariable) { // Register the function EXPECT_TRUE(td()->Determine()) << td()->error(); - EXPECT_EQ(func_ptr->referenced_module_variables().size(), 0u); + EXPECT_EQ(func->referenced_module_variables().size(), 0u); } TEST_F(TypeDeterminerTest, Expr_MemberAccessor_Struct) { @@ -1010,18 +950,16 @@ TEST_F(TypeDeterminerTest, Expr_MemberAccessor_Struct) { ast::StructMemberDecorationList decos; ast::StructMemberList members; - members.push_back( - create("first_member", &i32, std::move(decos))); - members.push_back( - create("second_member", &f32, std::move(decos))); + members.push_back(create("first_member", &i32, decos)); + members.push_back(create("second_member", &f32, decos)); - auto* strct = create(std::move(members)); + auto* strct = create(members); - ast::type::StructType st("S", std::move(strct)); + ast::type::StructType st("S", strct); auto* var = create("my_struct", ast::StorageClass::kNone, &st); - mod()->AddGlobalVariable(std::move(var)); + mod()->AddGlobalVariable(var); // Register the global EXPECT_TRUE(td()->Determine()); @@ -1029,7 +967,7 @@ TEST_F(TypeDeterminerTest, Expr_MemberAccessor_Struct) { auto* ident = create("my_struct"); auto* mem_ident = create("second_member"); - ast::MemberAccessorExpression mem(std::move(ident), std::move(mem_ident)); + ast::MemberAccessorExpression mem(ident, mem_ident); EXPECT_TRUE(td()->DetermineResultType(&mem)); ASSERT_NE(mem.result_type(), nullptr); ASSERT_TRUE(mem.result_type()->IsPointer()); @@ -1044,20 +982,18 @@ TEST_F(TypeDeterminerTest, Expr_MemberAccessor_Struct_Alias) { ast::StructMemberDecorationList decos; ast::StructMemberList members; - members.push_back( - create("first_member", &i32, std::move(decos))); - members.push_back( - create("second_member", &f32, std::move(decos))); + members.push_back(create("first_member", &i32, decos)); + members.push_back(create("second_member", &f32, decos)); - auto* strct = create(std::move(members)); + auto* strct = create(members); - auto st = std::make_unique("alias", std::move(strct)); + auto st = std::make_unique("alias", strct); ast::type::AliasType alias("alias", st.get()); auto* var = create("my_struct", ast::StorageClass::kNone, &alias); - mod()->AddGlobalVariable(std::move(var)); + mod()->AddGlobalVariable(var); // Register the global EXPECT_TRUE(td()->Determine()); @@ -1065,7 +1001,7 @@ TEST_F(TypeDeterminerTest, Expr_MemberAccessor_Struct_Alias) { auto* ident = create("my_struct"); auto* mem_ident = create("second_member"); - ast::MemberAccessorExpression mem(std::move(ident), std::move(mem_ident)); + ast::MemberAccessorExpression mem(ident, mem_ident); EXPECT_TRUE(td()->DetermineResultType(&mem)); ASSERT_NE(mem.result_type(), nullptr); ASSERT_TRUE(mem.result_type()->IsPointer()); @@ -1079,7 +1015,7 @@ TEST_F(TypeDeterminerTest, Expr_MemberAccessor_VectorSwizzle) { ast::type::VectorType vec3(&f32, 3); auto* var = create("my_vec", ast::StorageClass::kNone, &vec3); - mod()->AddGlobalVariable(std::move(var)); + mod()->AddGlobalVariable(var); // Register the global EXPECT_TRUE(td()->Determine()); @@ -1087,7 +1023,7 @@ TEST_F(TypeDeterminerTest, Expr_MemberAccessor_VectorSwizzle) { auto* ident = create("my_vec"); auto* swizzle = create("xy"); - ast::MemberAccessorExpression mem(std::move(ident), std::move(swizzle)); + ast::MemberAccessorExpression mem(ident, swizzle); EXPECT_TRUE(td()->DetermineResultType(&mem)) << td()->error(); ASSERT_NE(mem.result_type(), nullptr); ASSERT_TRUE(mem.result_type()->IsVector()); @@ -1100,7 +1036,7 @@ TEST_F(TypeDeterminerTest, Expr_MemberAccessor_VectorSwizzle_SingleElement) { ast::type::VectorType vec3(&f32, 3); auto* var = create("my_vec", ast::StorageClass::kNone, &vec3); - mod()->AddGlobalVariable(std::move(var)); + mod()->AddGlobalVariable(var); // Register the global EXPECT_TRUE(td()->Determine()); @@ -1108,7 +1044,7 @@ TEST_F(TypeDeterminerTest, Expr_MemberAccessor_VectorSwizzle_SingleElement) { auto* ident = create("my_vec"); auto* swizzle = create("x"); - ast::MemberAccessorExpression mem(std::move(ident), std::move(swizzle)); + ast::MemberAccessorExpression mem(ident, swizzle); EXPECT_TRUE(td()->DetermineResultType(&mem)) << td()->error(); ASSERT_NE(mem.result_type(), nullptr); ASSERT_TRUE(mem.result_type()->IsPointer()); @@ -1149,24 +1085,22 @@ TEST_F(TypeDeterminerTest, Expr_Accessor_MultiLevel) { ast::StructMemberDecorationList decos; ast::StructMemberList b_members; - b_members.push_back( - create("foo", &vec4, std::move(decos))); + b_members.push_back(create("foo", &vec4, decos)); - auto* strctB = create(std::move(b_members)); - ast::type::StructType stB("B", std::move(strctB)); + auto* strctB = create(b_members); + ast::type::StructType stB("B", strctB); ast::type::VectorType vecB(&stB, 3); ast::StructMemberList a_members; - a_members.push_back( - create("mem", &vecB, std::move(decos))); + a_members.push_back(create("mem", &vecB, decos)); - auto* strctA = create(std::move(a_members)); + auto* strctA = create(a_members); - ast::type::StructType stA("A", std::move(strctA)); + ast::type::StructType stA("A", strctA); auto* var = create("c", ast::StorageClass::kNone, &stA); - mod()->AddGlobalVariable(std::move(var)); + mod()->AddGlobalVariable(var); // Register the global EXPECT_TRUE(td()->Determine()); @@ -1181,11 +1115,9 @@ TEST_F(TypeDeterminerTest, Expr_Accessor_MultiLevel) { ast::MemberAccessorExpression mem( create( create( - create(std::move(ident), - std::move(mem_ident)), - std::move(idx)), - std::move(foo_ident)), - std::move(swizzle)); + create(ident, mem_ident), idx), + foo_ident), + swizzle); EXPECT_TRUE(td()->DetermineResultType(&mem)) << td()->error(); ASSERT_NE(mem.result_type(), nullptr); @@ -1201,7 +1133,7 @@ TEST_P(Expr_Binary_BitwiseTest, Scalar) { ast::type::I32Type i32; auto* var = create("val", ast::StorageClass::kNone, &i32); - mod()->AddGlobalVariable(std::move(var)); + mod()->AddGlobalVariable(var); // Register the global ASSERT_TRUE(td()->Determine()) << td()->error(); @@ -1221,7 +1153,7 @@ TEST_P(Expr_Binary_BitwiseTest, Vector) { ast::type::VectorType vec3(&i32, 3); auto* var = create("val", ast::StorageClass::kNone, &vec3); - mod()->AddGlobalVariable(std::move(var)); + mod()->AddGlobalVariable(var); // Register the global ASSERT_TRUE(td()->Determine()) << td()->error(); @@ -1255,7 +1187,7 @@ TEST_P(Expr_Binary_LogicalTest, Scalar) { auto* var = create("val", ast::StorageClass::kNone, &bool_type); - mod()->AddGlobalVariable(std::move(var)); + mod()->AddGlobalVariable(var); // Register the global ASSERT_TRUE(td()->Determine()) << td()->error(); @@ -1275,7 +1207,7 @@ TEST_P(Expr_Binary_LogicalTest, Vector) { ast::type::VectorType vec3(&bool_type, 3); auto* var = create("val", ast::StorageClass::kNone, &vec3); - mod()->AddGlobalVariable(std::move(var)); + mod()->AddGlobalVariable(var); // Register the global ASSERT_TRUE(td()->Determine()) << td()->error(); @@ -1301,7 +1233,7 @@ TEST_P(Expr_Binary_CompareTest, Scalar) { ast::type::I32Type i32; auto* var = create("val", ast::StorageClass::kNone, &i32); - mod()->AddGlobalVariable(std::move(var)); + mod()->AddGlobalVariable(var); // Register the global ASSERT_TRUE(td()->Determine()) << td()->error(); @@ -1321,7 +1253,7 @@ TEST_P(Expr_Binary_CompareTest, Vector) { ast::type::VectorType vec3(&i32, 3); auto* var = create("val", ast::StorageClass::kNone, &vec3); - mod()->AddGlobalVariable(std::move(var)); + mod()->AddGlobalVariable(var); // Register the global ASSERT_TRUE(td()->Determine()) << td()->error(); @@ -1348,7 +1280,7 @@ TEST_F(TypeDeterminerTest, Expr_Binary_Multiply_Scalar_Scalar) { ast::type::I32Type i32; auto* var = create("val", ast::StorageClass::kNone, &i32); - mod()->AddGlobalVariable(std::move(var)); + mod()->AddGlobalVariable(var); // Register the global ASSERT_TRUE(td()->Determine()) << td()->error(); @@ -1370,8 +1302,8 @@ TEST_F(TypeDeterminerTest, Expr_Binary_Multiply_Vector_Scalar) { create("scalar", ast::StorageClass::kNone, &f32); auto* vector = create("vector", ast::StorageClass::kNone, &vec3); - mod()->AddGlobalVariable(std::move(scalar)); - mod()->AddGlobalVariable(std::move(vector)); + mod()->AddGlobalVariable(scalar); + mod()->AddGlobalVariable(vector); // Register the global ASSERT_TRUE(td()->Determine()) << td()->error(); @@ -1395,8 +1327,8 @@ TEST_F(TypeDeterminerTest, Expr_Binary_Multiply_Scalar_Vector) { create("scalar", ast::StorageClass::kNone, &f32); auto* vector = create("vector", ast::StorageClass::kNone, &vec3); - mod()->AddGlobalVariable(std::move(scalar)); - mod()->AddGlobalVariable(std::move(vector)); + mod()->AddGlobalVariable(scalar); + mod()->AddGlobalVariable(vector); // Register the global ASSERT_TRUE(td()->Determine()) << td()->error(); @@ -1418,7 +1350,7 @@ TEST_F(TypeDeterminerTest, Expr_Binary_Multiply_Vector_Vector) { auto* vector = create("vector", ast::StorageClass::kNone, &vec3); - mod()->AddGlobalVariable(std::move(vector)); + mod()->AddGlobalVariable(vector); // Register the global ASSERT_TRUE(td()->Determine()) << td()->error(); @@ -1442,8 +1374,8 @@ TEST_F(TypeDeterminerTest, Expr_Binary_Multiply_Matrix_Scalar) { create("scalar", ast::StorageClass::kNone, &f32); auto* matrix = create("matrix", ast::StorageClass::kNone, &mat3x2); - mod()->AddGlobalVariable(std::move(scalar)); - mod()->AddGlobalVariable(std::move(matrix)); + mod()->AddGlobalVariable(scalar); + mod()->AddGlobalVariable(matrix); // Register the global ASSERT_TRUE(td()->Determine()) << td()->error(); @@ -1470,8 +1402,8 @@ TEST_F(TypeDeterminerTest, Expr_Binary_Multiply_Scalar_Matrix) { create("scalar", ast::StorageClass::kNone, &f32); auto* matrix = create("matrix", ast::StorageClass::kNone, &mat3x2); - mod()->AddGlobalVariable(std::move(scalar)); - mod()->AddGlobalVariable(std::move(matrix)); + mod()->AddGlobalVariable(scalar); + mod()->AddGlobalVariable(matrix); // Register the global ASSERT_TRUE(td()->Determine()) << td()->error(); @@ -1499,8 +1431,8 @@ TEST_F(TypeDeterminerTest, Expr_Binary_Multiply_Matrix_Vector) { create("vector", ast::StorageClass::kNone, &vec3); auto* matrix = create("matrix", ast::StorageClass::kNone, &mat3x2); - mod()->AddGlobalVariable(std::move(vector)); - mod()->AddGlobalVariable(std::move(matrix)); + mod()->AddGlobalVariable(vector); + mod()->AddGlobalVariable(matrix); // Register the global ASSERT_TRUE(td()->Determine()) << td()->error(); @@ -1525,8 +1457,8 @@ TEST_F(TypeDeterminerTest, Expr_Binary_Multiply_Vector_Matrix) { create("vector", ast::StorageClass::kNone, &vec3); auto* matrix = create("matrix", ast::StorageClass::kNone, &mat3x2); - mod()->AddGlobalVariable(std::move(vector)); - mod()->AddGlobalVariable(std::move(matrix)); + mod()->AddGlobalVariable(vector); + mod()->AddGlobalVariable(matrix); // Register the global ASSERT_TRUE(td()->Determine()) << td()->error(); @@ -1551,8 +1483,8 @@ TEST_F(TypeDeterminerTest, Expr_Binary_Multiply_Matrix_Matrix) { create("mat4x3", ast::StorageClass::kNone, &mat4x3); auto* matrix2 = create("mat3x4", ast::StorageClass::kNone, &mat3x4); - mod()->AddGlobalVariable(std::move(matrix1)); - mod()->AddGlobalVariable(std::move(matrix2)); + mod()->AddGlobalVariable(matrix1); + mod()->AddGlobalVariable(matrix2); // Register the global ASSERT_TRUE(td()->Determine()) << td()->error(); @@ -1578,7 +1510,7 @@ TEST_P(IntrinsicDerivativeTest, Scalar) { ast::type::F32Type f32; auto* var = create("ident", ast::StorageClass::kNone, &f32); - mod()->AddGlobalVariable(std::move(var)); + mod()->AddGlobalVariable(var); // Register the global EXPECT_TRUE(td()->Determine()); @@ -1587,7 +1519,7 @@ TEST_P(IntrinsicDerivativeTest, Scalar) { call_params.push_back(create("ident")); ast::CallExpression expr(create(name), - std::move(call_params)); + call_params); EXPECT_TRUE(td()->DetermineResultType(&expr)); ASSERT_NE(expr.result_type(), nullptr); @@ -1601,7 +1533,7 @@ TEST_P(IntrinsicDerivativeTest, Vector) { ast::type::VectorType vec4(&f32, 4); auto* var = create("ident", ast::StorageClass::kNone, &vec4); - mod()->AddGlobalVariable(std::move(var)); + mod()->AddGlobalVariable(var); // Register the global EXPECT_TRUE(td()->Determine()); @@ -1610,7 +1542,7 @@ TEST_P(IntrinsicDerivativeTest, Vector) { call_params.push_back(create("ident")); ast::CallExpression expr(create(name), - std::move(call_params)); + call_params); EXPECT_TRUE(td()->DetermineResultType(&expr)); ASSERT_NE(expr.result_type(), nullptr); @@ -1630,7 +1562,7 @@ TEST_P(IntrinsicDerivativeTest, MissingParam) { ast::ExpressionList call_params; ast::CallExpression expr(create(name), - std::move(call_params)); + call_params); EXPECT_FALSE(td()->DetermineResultType(&expr)); EXPECT_EQ(td()->error(), "incorrect number of parameters for " + name); } @@ -1643,8 +1575,8 @@ TEST_P(IntrinsicDerivativeTest, ToomManyParams) { auto* var1 = create("ident1", ast::StorageClass::kNone, &vec4); auto* var2 = create("ident2", ast::StorageClass::kNone, &vec4); - mod()->AddGlobalVariable(std::move(var1)); - mod()->AddGlobalVariable(std::move(var2)); + mod()->AddGlobalVariable(var1); + mod()->AddGlobalVariable(var2); // Register the global EXPECT_TRUE(td()->Determine()); @@ -1654,7 +1586,7 @@ TEST_P(IntrinsicDerivativeTest, ToomManyParams) { call_params.push_back(create("ident2")); ast::CallExpression expr(create(name), - std::move(call_params)); + call_params); EXPECT_FALSE(td()->DetermineResultType(&expr)); EXPECT_EQ(td()->error(), "incorrect number of parameters for " + name); } @@ -1678,13 +1610,13 @@ TEST_P(Intrinsic, Test) { ast::type::VectorType vec3(&bool_type, 3); auto* var = create("my_var", ast::StorageClass::kNone, &vec3); - mod()->AddGlobalVariable(std::move(var)); + mod()->AddGlobalVariable(var); ast::ExpressionList call_params; call_params.push_back(create("my_var")); ast::CallExpression expr(create(name), - std::move(call_params)); + call_params); // Register the variable EXPECT_TRUE(td()->Determine()); @@ -1705,13 +1637,13 @@ TEST_P(Intrinsic_FloatMethod, Vector) { ast::type::VectorType vec3(&f32, 3); auto* var = create("my_var", ast::StorageClass::kNone, &vec3); - mod()->AddGlobalVariable(std::move(var)); + mod()->AddGlobalVariable(var); ast::ExpressionList call_params; call_params.push_back(create("my_var")); ast::CallExpression expr(create(name), - std::move(call_params)); + call_params); // Register the variable EXPECT_TRUE(td()->Determine()); @@ -1729,13 +1661,13 @@ TEST_P(Intrinsic_FloatMethod, Scalar) { ast::type::F32Type f32; auto* var = create("my_var", ast::StorageClass::kNone, &f32); - mod()->AddGlobalVariable(std::move(var)); + mod()->AddGlobalVariable(var); ast::ExpressionList call_params; call_params.push_back(create("my_var")); ast::CallExpression expr(create(name), - std::move(call_params)); + call_params); // Register the variable EXPECT_TRUE(td()->Determine()); @@ -1750,11 +1682,11 @@ TEST_P(Intrinsic_FloatMethod, MissingParam) { ast::type::F32Type f32; auto* var = create("my_var", ast::StorageClass::kNone, &f32); - mod()->AddGlobalVariable(std::move(var)); + mod()->AddGlobalVariable(var); ast::ExpressionList call_params; ast::CallExpression expr(create(name), - std::move(call_params)); + call_params); // Register the variable EXPECT_TRUE(td()->Determine()); @@ -1768,14 +1700,14 @@ TEST_P(Intrinsic_FloatMethod, TooManyParams) { ast::type::F32Type f32; auto* var = create("my_var", ast::StorageClass::kNone, &f32); - mod()->AddGlobalVariable(std::move(var)); + mod()->AddGlobalVariable(var); ast::ExpressionList call_params; call_params.push_back(create("my_var")); call_params.push_back(create("my_var")); ast::CallExpression expr(create(name), - std::move(call_params)); + call_params); // Register the variable EXPECT_TRUE(td()->Determine()); @@ -1837,7 +1769,7 @@ class Intrinsic_TextureOperation ast::type::Type* type, ast::ExpressionList* call_params) { auto* var = create(name, ast::StorageClass::kNone, type); - mod()->AddGlobalVariable(std::move(var)); + mod()->AddGlobalVariable(var); call_params->push_back(create(name)); } @@ -1872,7 +1804,7 @@ TEST_P(Intrinsic_StorageTextureOperation, TextureLoadRo) { add_call_param("lod", &i32, &call_params); ast::CallExpression expr(create("textureLoad"), - std::move(call_params)); + call_params); EXPECT_TRUE(td()->Determine()); EXPECT_TRUE(td()->DetermineResultType(&expr)); @@ -1942,7 +1874,7 @@ TEST_P(Intrinsic_SampledTextureOperation, TextureLoadSampled) { add_call_param("lod", &i32, &call_params); ast::CallExpression expr(create("textureLoad"), - std::move(call_params)); + call_params); EXPECT_TRUE(td()->Determine()); EXPECT_TRUE(td()->DetermineResultType(&expr)); @@ -1978,7 +1910,7 @@ TEST_P(Intrinsic_SampledTextureOperation, TextureSample) { add_call_param("coords", coords_type.get(), &call_params); ast::CallExpression expr(create("textureSample"), - std::move(call_params)); + call_params); EXPECT_TRUE(td()->Determine()); EXPECT_TRUE(td()->DetermineResultType(&expr)); @@ -2015,8 +1947,7 @@ TEST_P(Intrinsic_SampledTextureOperation, TextureSampleLevel) { add_call_param("lod", &f32, &call_params); ast::CallExpression expr( - create("textureSampleLevel"), - std::move(call_params)); + create("textureSampleLevel"), call_params); EXPECT_TRUE(td()->Determine()); EXPECT_TRUE(td()->DetermineResultType(&expr)); @@ -2053,8 +1984,7 @@ TEST_P(Intrinsic_SampledTextureOperation, TextureSampleBias) { add_call_param("bias", &f32, &call_params); ast::CallExpression expr( - create("textureSampleBias"), - std::move(call_params)); + create("textureSampleBias"), call_params); EXPECT_TRUE(td()->Determine()); EXPECT_TRUE(td()->DetermineResultType(&expr)); @@ -2127,8 +2057,7 @@ TEST_P(Intrinsic_DepthTextureOperation, TextureSampleCompare) { add_call_param("depth_reference", &f32, &call_params); ast::CallExpression expr( - create("textureSampleCompare"), - std::move(call_params)); + create("textureSampleCompare"), call_params); EXPECT_TRUE(td()->Determine()); EXPECT_TRUE(td()->DetermineResultType(&expr)); @@ -2151,14 +2080,14 @@ TEST_F(TypeDeterminerTest, Intrinsic_Dot) { ast::type::VectorType vec3(&f32, 3); auto* var = create("my_var", ast::StorageClass::kNone, &vec3); - mod()->AddGlobalVariable(std::move(var)); + mod()->AddGlobalVariable(var); ast::ExpressionList call_params; call_params.push_back(create("my_var")); call_params.push_back(create("my_var")); ast::CallExpression expr(create("dot"), - std::move(call_params)); + call_params); // Register the variable EXPECT_TRUE(td()->Determine()); @@ -2176,8 +2105,8 @@ TEST_F(TypeDeterminerTest, Intrinsic_Select) { auto* var = create("my_var", ast::StorageClass::kNone, &vec3); auto* bool_var = create("bool_var", ast::StorageClass::kNone, &bool_vec3); - mod()->AddGlobalVariable(std::move(var)); - mod()->AddGlobalVariable(std::move(bool_var)); + mod()->AddGlobalVariable(var); + mod()->AddGlobalVariable(bool_var); ast::ExpressionList call_params; call_params.push_back(create("my_var")); @@ -2185,7 +2114,7 @@ TEST_F(TypeDeterminerTest, Intrinsic_Select) { call_params.push_back(create("bool_var")); ast::CallExpression expr(create("select"), - std::move(call_params)); + call_params); // Register the variable EXPECT_TRUE(td()->Determine()); @@ -2201,13 +2130,13 @@ TEST_F(TypeDeterminerTest, Intrinsic_Select_TooFewParams) { ast::type::VectorType vec3(&f32, 3); auto* var = create("v", ast::StorageClass::kNone, &vec3); - mod()->AddGlobalVariable(std::move(var)); + mod()->AddGlobalVariable(var); ast::ExpressionList call_params; call_params.push_back(create("v")); ast::CallExpression expr(create("select"), - std::move(call_params)); + call_params); // Register the variable EXPECT_TRUE(td()->Determine()); @@ -2221,7 +2150,7 @@ TEST_F(TypeDeterminerTest, Intrinsic_Select_TooManyParams) { ast::type::VectorType vec3(&f32, 3); auto* var = create("v", ast::StorageClass::kNone, &vec3); - mod()->AddGlobalVariable(std::move(var)); + mod()->AddGlobalVariable(var); ast::ExpressionList call_params; call_params.push_back(create("v")); @@ -2230,7 +2159,7 @@ TEST_F(TypeDeterminerTest, Intrinsic_Select_TooManyParams) { call_params.push_back(create("v")); ast::CallExpression expr(create("select"), - std::move(call_params)); + call_params); // Register the variable EXPECT_TRUE(td()->Determine()); @@ -2246,15 +2175,15 @@ TEST_F(TypeDeterminerTest, Intrinsic_OuterProduct) { auto* var1 = create("v3", ast::StorageClass::kNone, &vec3); auto* var2 = create("v2", ast::StorageClass::kNone, &vec2); - mod()->AddGlobalVariable(std::move(var1)); - mod()->AddGlobalVariable(std::move(var2)); + mod()->AddGlobalVariable(var1); + mod()->AddGlobalVariable(var2); ast::ExpressionList call_params; call_params.push_back(create("v3")); call_params.push_back(create("v2")); ast::CallExpression expr(create("outerProduct"), - std::move(call_params)); + call_params); // Register the variable EXPECT_TRUE(td()->Determine()); @@ -2275,13 +2204,13 @@ TEST_F(TypeDeterminerTest, Intrinsic_OuterProduct_TooFewParams) { ast::type::VectorType vec2(&f32, 2); auto* var2 = create("v2", ast::StorageClass::kNone, &vec2); - mod()->AddGlobalVariable(std::move(var2)); + mod()->AddGlobalVariable(var2); ast::ExpressionList call_params; call_params.push_back(create("v2")); ast::CallExpression expr(create("outerProduct"), - std::move(call_params)); + call_params); // Register the variable EXPECT_TRUE(td()->Determine()); @@ -2295,7 +2224,7 @@ TEST_F(TypeDeterminerTest, Intrinsic_OuterProduct_TooManyParams) { ast::type::VectorType vec2(&f32, 2); auto* var2 = create("v2", ast::StorageClass::kNone, &vec2); - mod()->AddGlobalVariable(std::move(var2)); + mod()->AddGlobalVariable(var2); ast::ExpressionList call_params; call_params.push_back(create("v2")); @@ -2303,7 +2232,7 @@ TEST_F(TypeDeterminerTest, Intrinsic_OuterProduct_TooManyParams) { call_params.push_back(create("v2")); ast::CallExpression expr(create("outerProduct"), - std::move(call_params)); + call_params); // Register the variable EXPECT_TRUE(td()->Determine()); @@ -2320,7 +2249,7 @@ TEST_P(UnaryOpExpressionTest, Expr_UnaryOp) { ast::type::VectorType vec4(&f32, 4); auto* var = create("ident", ast::StorageClass::kNone, &vec4); - mod()->AddGlobalVariable(std::move(var)); + mod()->AddGlobalVariable(var); // Register the global EXPECT_TRUE(td()->Determine()); @@ -2341,18 +2270,16 @@ TEST_F(TypeDeterminerTest, StorageClass_SetsIfMissing) { ast::type::I32Type i32; auto* var = create("var", ast::StorageClass::kNone, &i32); - auto* var_ptr = var; - auto* stmt = create(std::move(var)); + auto* stmt = create(var); auto* body = create(); - body->append(std::move(stmt)); - auto* func = - create("func", ast::VariableList{}, &i32, std::move(body)); + body->append(stmt); + auto* func = create("func", ast::VariableList{}, &i32, body); - mod()->AddFunction(std::move(func)); + mod()->AddFunction(func); EXPECT_TRUE(td()->Determine()) << td()->error(); - EXPECT_EQ(var_ptr->storage_class(), ast::StorageClass::kFunction); + EXPECT_EQ(var->storage_class(), ast::StorageClass::kFunction); } TEST_F(TypeDeterminerTest, StorageClass_DoesNotSetOnConst) { @@ -2360,32 +2287,29 @@ TEST_F(TypeDeterminerTest, StorageClass_DoesNotSetOnConst) { auto* var = create("var", ast::StorageClass::kNone, &i32); var->set_is_const(true); - auto* var_ptr = var; - auto* stmt = create(std::move(var)); + auto* stmt = create(var); auto* body = create(); - body->append(std::move(stmt)); - auto* func = - create("func", ast::VariableList{}, &i32, std::move(body)); + body->append(stmt); + auto* func = create("func", ast::VariableList{}, &i32, body); - mod()->AddFunction(std::move(func)); + mod()->AddFunction(func); EXPECT_TRUE(td()->Determine()) << td()->error(); - EXPECT_EQ(var_ptr->storage_class(), ast::StorageClass::kNone); + EXPECT_EQ(var->storage_class(), ast::StorageClass::kNone); } TEST_F(TypeDeterminerTest, StorageClass_NonFunctionClassError) { ast::type::I32Type i32; auto* var = create("var", ast::StorageClass::kWorkgroup, &i32); - auto* stmt = create(std::move(var)); + auto* stmt = create(var); auto* body = create(); - body->append(std::move(stmt)); - auto* func = - create("func", ast::VariableList{}, &i32, std::move(body)); + body->append(stmt); + auto* func = create("func", ast::VariableList{}, &i32, body); - mod()->AddFunction(std::move(func)); + mod()->AddFunction(func); EXPECT_FALSE(td()->Determine()); EXPECT_EQ(td()->error(), @@ -2501,12 +2425,12 @@ TEST_P(ImportData_SingleParamTest, Scalar) { create(&f32, 1.f))); auto* ident = create(param.name); - auto* ident_ptr = ident; - ast::CallExpression call(std::move(ident), std::move(params)); + + ast::CallExpression call(ident, params); EXPECT_TRUE(td()->DetermineResultType(&call)) << td()->error(); - ASSERT_NE(ident_ptr->result_type(), nullptr); - EXPECT_TRUE(ident_ptr->result_type()->is_float_scalar()); + ASSERT_NE(ident->result_type(), nullptr); + EXPECT_TRUE(ident->result_type()->is_float_scalar()); } TEST_P(ImportData_SingleParamTest, Vector) { @@ -2524,17 +2448,16 @@ TEST_P(ImportData_SingleParamTest, Vector) { create(&f32, 3.0f))); ast::ExpressionList params; - params.push_back( - create(&vec, std::move(vals))); + params.push_back(create(&vec, vals)); auto* ident = create(param.name); - auto* ident_ptr = ident; - ast::CallExpression call(std::move(ident), std::move(params)); + + ast::CallExpression call(ident, params); EXPECT_TRUE(td()->DetermineResultType(&call)) << td()->error(); - ASSERT_NE(ident_ptr->result_type(), nullptr); - EXPECT_TRUE(ident_ptr->result_type()->is_float_vector()); - EXPECT_EQ(ident_ptr->result_type()->AsVector()->size(), 3u); + ASSERT_NE(ident->result_type(), nullptr); + EXPECT_TRUE(ident->result_type()->is_float_vector()); + EXPECT_EQ(ident->result_type()->AsVector()->size(), 3u); } TEST_P(ImportData_SingleParamTest, Error_Integer) { @@ -2547,7 +2470,7 @@ TEST_P(ImportData_SingleParamTest, Error_Integer) { create(&i32, 1))); auto* ident = create(param.name); - ast::CallExpression call(std::move(ident), std::move(params)); + ast::CallExpression call(ident, params); EXPECT_FALSE(td()->DetermineResultType(&call)); EXPECT_EQ(td()->error(), @@ -2561,7 +2484,7 @@ TEST_P(ImportData_SingleParamTest, Error_NoParams) { ast::ExpressionList params; auto* ident = create(param.name); - ast::CallExpression call(std::move(ident), std::move(params)); + ast::CallExpression call(ident, params); EXPECT_FALSE(td()->DetermineResultType(&call)); EXPECT_EQ(td()->error(), std::string("incorrect number of parameters for ") + @@ -2581,7 +2504,7 @@ TEST_P(ImportData_SingleParamTest, Error_MultipleParams) { create(&f32, 1.f))); auto* ident = create(param.name); - ast::CallExpression call(std::move(ident), std::move(params)); + ast::CallExpression call(ident, params); EXPECT_FALSE(td()->DetermineResultType(&call)); EXPECT_EQ(td()->error(), std::string("incorrect number of parameters for ") + @@ -2626,12 +2549,12 @@ TEST_P(ImportData_SingleParam_FloatOrInt_Test, Float_Scalar) { create(&f32, 1.f))); auto* ident = create(param.name); - auto* ident_ptr = ident; - ast::CallExpression call(std::move(ident), std::move(params)); + + ast::CallExpression call(ident, params); EXPECT_TRUE(td()->DetermineResultType(&call)) << td()->error(); - ASSERT_NE(ident_ptr->result_type(), nullptr); - EXPECT_TRUE(ident_ptr->result_type()->is_float_scalar()); + ASSERT_NE(ident->result_type(), nullptr); + EXPECT_TRUE(ident->result_type()->is_float_scalar()); } TEST_P(ImportData_SingleParam_FloatOrInt_Test, Float_Vector) { @@ -2649,17 +2572,16 @@ TEST_P(ImportData_SingleParam_FloatOrInt_Test, Float_Vector) { create(&f32, 3.0f))); ast::ExpressionList params; - params.push_back( - create(&vec, std::move(vals))); + params.push_back(create(&vec, vals)); auto* ident = create(param.name); - auto* ident_ptr = ident; - ast::CallExpression call(std::move(ident), std::move(params)); + + ast::CallExpression call(ident, params); EXPECT_TRUE(td()->DetermineResultType(&call)) << td()->error(); - ASSERT_NE(ident_ptr->result_type(), nullptr); - EXPECT_TRUE(ident_ptr->result_type()->is_float_vector()); - EXPECT_EQ(ident_ptr->result_type()->AsVector()->size(), 3u); + ASSERT_NE(ident->result_type(), nullptr); + EXPECT_TRUE(ident->result_type()->is_float_vector()); + EXPECT_EQ(ident->result_type()->AsVector()->size(), 3u); } TEST_P(ImportData_SingleParam_FloatOrInt_Test, Sint_Scalar) { @@ -2672,12 +2594,12 @@ TEST_P(ImportData_SingleParam_FloatOrInt_Test, Sint_Scalar) { create(&i32, -11))); auto* ident = create(param.name); - auto* ident_ptr = ident; - ast::CallExpression call(std::move(ident), std::move(params)); + + ast::CallExpression call(ident, params); EXPECT_TRUE(td()->DetermineResultType(&call)) << td()->error(); - ASSERT_NE(ident_ptr->result_type(), nullptr); - EXPECT_TRUE(ident_ptr->result_type()->IsI32()); + ASSERT_NE(ident->result_type(), nullptr); + EXPECT_TRUE(ident->result_type()->IsI32()); } TEST_P(ImportData_SingleParam_FloatOrInt_Test, Sint_Vector) { @@ -2695,17 +2617,16 @@ TEST_P(ImportData_SingleParam_FloatOrInt_Test, Sint_Vector) { create(&i32, 3))); ast::ExpressionList params; - params.push_back( - create(&vec, std::move(vals))); + params.push_back(create(&vec, vals)); auto* ident = create(param.name); - auto* ident_ptr = ident; - ast::CallExpression call(std::move(ident), std::move(params)); + + ast::CallExpression call(ident, params); EXPECT_TRUE(td()->DetermineResultType(&call)) << td()->error(); - ASSERT_NE(ident_ptr->result_type(), nullptr); - EXPECT_TRUE(ident_ptr->result_type()->is_signed_integer_vector()); - EXPECT_EQ(ident_ptr->result_type()->AsVector()->size(), 3u); + ASSERT_NE(ident->result_type(), nullptr); + EXPECT_TRUE(ident->result_type()->is_signed_integer_vector()); + EXPECT_EQ(ident->result_type()->AsVector()->size(), 3u); } TEST_P(ImportData_SingleParam_FloatOrInt_Test, Uint_Scalar) { @@ -2718,12 +2639,12 @@ TEST_P(ImportData_SingleParam_FloatOrInt_Test, Uint_Scalar) { create(&u32, 1))); auto* ident = create(param.name); - auto* ident_ptr = ident; - ast::CallExpression call(std::move(ident), std::move(params)); + + ast::CallExpression call(ident, params); EXPECT_TRUE(td()->DetermineResultType(&call)) << td()->error(); - ASSERT_NE(ident_ptr->result_type(), nullptr); - EXPECT_TRUE(ident_ptr->result_type()->IsU32()); + ASSERT_NE(ident->result_type(), nullptr); + EXPECT_TRUE(ident->result_type()->IsU32()); } TEST_P(ImportData_SingleParam_FloatOrInt_Test, Uint_Vector) { @@ -2741,17 +2662,16 @@ TEST_P(ImportData_SingleParam_FloatOrInt_Test, Uint_Vector) { create(&u32, 3.0f))); ast::ExpressionList params; - params.push_back( - create(&vec, std::move(vals))); + params.push_back(create(&vec, vals)); auto* ident = create(param.name); - auto* ident_ptr = ident; - ast::CallExpression call(std::move(ident), std::move(params)); + + ast::CallExpression call(ident, params); EXPECT_TRUE(td()->DetermineResultType(&call)) << td()->error(); - ASSERT_NE(ident_ptr->result_type(), nullptr); - EXPECT_TRUE(ident_ptr->result_type()->is_unsigned_integer_vector()); - EXPECT_EQ(ident_ptr->result_type()->AsVector()->size(), 3u); + ASSERT_NE(ident->result_type(), nullptr); + EXPECT_TRUE(ident->result_type()->is_unsigned_integer_vector()); + EXPECT_EQ(ident->result_type()->AsVector()->size(), 3u); } TEST_P(ImportData_SingleParam_FloatOrInt_Test, Error_Bool) { @@ -2764,7 +2684,7 @@ TEST_P(ImportData_SingleParam_FloatOrInt_Test, Error_Bool) { create(&bool_type, false))); auto* ident = create(param.name); - ast::CallExpression call(std::move(ident), std::move(params)); + ast::CallExpression call(ident, params); EXPECT_FALSE(td()->DetermineResultType(&call)); EXPECT_EQ(td()->error(), @@ -2778,7 +2698,7 @@ TEST_P(ImportData_SingleParam_FloatOrInt_Test, Error_NoParams) { ast::ExpressionList params; auto* ident = create(param.name); - ast::CallExpression call(std::move(ident), std::move(params)); + ast::CallExpression call(ident, params); EXPECT_FALSE(td()->DetermineResultType(&call)); EXPECT_EQ(td()->error(), std::string("incorrect number of parameters for ") + @@ -2798,7 +2718,7 @@ TEST_P(ImportData_SingleParam_FloatOrInt_Test, Error_MultipleParams) { create(&f32, 1.f))); auto* ident = create(param.name); - ast::CallExpression call(std::move(ident), std::move(params)); + ast::CallExpression call(ident, params); EXPECT_FALSE(td()->DetermineResultType(&call)); EXPECT_EQ(td()->error(), std::string("incorrect number of parameters for ") + @@ -2820,12 +2740,12 @@ TEST_F(TypeDeterminerTest, ImportData_Length_Scalar) { ASSERT_TRUE(td()->DetermineResultType(params)) << td()->error(); auto* ident = create("length"); - auto* ident_ptr = ident; - ast::CallExpression call(std::move(ident), std::move(params)); + + ast::CallExpression call(ident, params); EXPECT_TRUE(td()->DetermineResultType(&call)) << td()->error(); - ASSERT_NE(ident_ptr->result_type(), nullptr); - EXPECT_TRUE(ident_ptr->result_type()->is_float_scalar()); + ASSERT_NE(ident->result_type(), nullptr); + EXPECT_TRUE(ident->result_type()->is_float_scalar()); } TEST_F(TypeDeterminerTest, ImportData_Length_FloatVector) { @@ -2841,16 +2761,15 @@ TEST_F(TypeDeterminerTest, ImportData_Length_FloatVector) { create(&f32, 3.0f))); ast::ExpressionList params; - params.push_back( - create(&vec, std::move(vals))); + params.push_back(create(&vec, vals)); auto* ident = create("length"); - auto* ident_ptr = ident; - ast::CallExpression call(std::move(ident), std::move(params)); + + ast::CallExpression call(ident, params); EXPECT_TRUE(td()->DetermineResultType(&call)) << td()->error(); - ASSERT_NE(ident_ptr->result_type(), nullptr); - EXPECT_TRUE(ident_ptr->result_type()->is_float_scalar()); + ASSERT_NE(ident->result_type(), nullptr); + EXPECT_TRUE(ident->result_type()->is_float_scalar()); } TEST_F(TypeDeterminerTest, ImportData_Length_Error_Integer) { @@ -2861,7 +2780,7 @@ TEST_F(TypeDeterminerTest, ImportData_Length_Error_Integer) { create(&i32, 1))); auto* ident = create("length"); - ast::CallExpression call(std::move(ident), std::move(params)); + ast::CallExpression call(ident, params); EXPECT_FALSE(td()->DetermineResultType(&call)); EXPECT_EQ(td()->error(), @@ -2873,7 +2792,7 @@ TEST_F(TypeDeterminerTest, ImportData_Length_Error_NoParams) { ast::ExpressionList params; auto* ident = create("length"); - ast::CallExpression call(std::move(ident), std::move(params)); + ast::CallExpression call(ident, params); EXPECT_FALSE(td()->DetermineResultType(&call)); EXPECT_EQ(td()->error(), @@ -2891,7 +2810,7 @@ TEST_F(TypeDeterminerTest, ImportData_Length_Error_MultipleParams) { create(&f32, 1.f))); auto* ident = create("length"); - ast::CallExpression call(std::move(ident), std::move(params)); + ast::CallExpression call(ident, params); EXPECT_FALSE(td()->DetermineResultType(&call)); EXPECT_EQ(td()->error(), @@ -2911,12 +2830,12 @@ TEST_P(ImportData_TwoParamTest, Scalar) { create(&f32, 1.f))); auto* ident = create(param.name); - auto* ident_ptr = ident; - ast::CallExpression call(std::move(ident), std::move(params)); + + ast::CallExpression call(ident, params); EXPECT_TRUE(td()->DetermineResultType(&call)) << td()->error(); - ASSERT_NE(ident_ptr->result_type(), nullptr); - EXPECT_TRUE(ident_ptr->result_type()->is_float_scalar()); + ASSERT_NE(ident->result_type(), nullptr); + EXPECT_TRUE(ident->result_type()->is_float_scalar()); } TEST_P(ImportData_TwoParamTest, Vector) { @@ -2942,19 +2861,17 @@ TEST_P(ImportData_TwoParamTest, Vector) { create(&f32, 3.0f))); ast::ExpressionList params; - params.push_back( - create(&vec, std::move(vals_1))); - params.push_back( - create(&vec, std::move(vals_2))); + params.push_back(create(&vec, vals_1)); + params.push_back(create(&vec, vals_2)); auto* ident = create(param.name); - auto* ident_ptr = ident; - ast::CallExpression call(std::move(ident), std::move(params)); + + ast::CallExpression call(ident, params); EXPECT_TRUE(td()->DetermineResultType(&call)) << td()->error(); - ASSERT_NE(ident_ptr->result_type(), nullptr); - EXPECT_TRUE(ident_ptr->result_type()->is_float_vector()); - EXPECT_EQ(ident_ptr->result_type()->AsVector()->size(), 3u); + ASSERT_NE(ident->result_type(), nullptr); + EXPECT_TRUE(ident->result_type()->is_float_vector()); + EXPECT_EQ(ident->result_type()->AsVector()->size(), 3u); } TEST_P(ImportData_TwoParamTest, Error_Integer) { @@ -2969,7 +2886,7 @@ TEST_P(ImportData_TwoParamTest, Error_Integer) { create(&i32, 2))); auto* ident = create(param.name); - ast::CallExpression call(std::move(ident), std::move(params)); + ast::CallExpression call(ident, params); EXPECT_FALSE(td()->DetermineResultType(&call)); EXPECT_EQ(td()->error(), @@ -2983,7 +2900,7 @@ TEST_P(ImportData_TwoParamTest, Error_NoParams) { ast::ExpressionList params; auto* ident = create(param.name); - ast::CallExpression call(std::move(ident), std::move(params)); + ast::CallExpression call(ident, params); EXPECT_FALSE(td()->DetermineResultType(&call)); EXPECT_EQ(td()->error(), std::string("incorrect number of parameters for ") + @@ -2999,7 +2916,7 @@ TEST_P(ImportData_TwoParamTest, Error_OneParam) { create(&f32, 1.f))); auto* ident = create(param.name); - ast::CallExpression call(std::move(ident), std::move(params)); + ast::CallExpression call(ident, params); EXPECT_FALSE(td()->DetermineResultType(&call)); EXPECT_EQ(td()->error(), std::string("incorrect number of parameters for ") + @@ -3028,13 +2945,11 @@ TEST_P(ImportData_TwoParamTest, Error_MismatchedParamCount) { create(&f32, 3.0f))); ast::ExpressionList params; - params.push_back( - create(&vec2, std::move(vals_1))); - params.push_back( - create(&vec3, std::move(vals_2))); + params.push_back(create(&vec2, vals_1)); + params.push_back(create(&vec3, vals_2)); auto* ident = create(param.name); - ast::CallExpression call(std::move(ident), std::move(params)); + ast::CallExpression call(ident, params); EXPECT_FALSE(td()->DetermineResultType(&call)); EXPECT_EQ(td()->error(), @@ -3058,11 +2973,10 @@ TEST_P(ImportData_TwoParamTest, Error_MismatchedParamType) { ast::ExpressionList params; params.push_back(create( create(&f32, 1.0f))); - params.push_back( - create(&vec, std::move(vals))); + params.push_back(create(&vec, vals)); auto* ident = create(param.name); - ast::CallExpression call(std::move(ident), std::move(params)); + ast::CallExpression call(ident, params); EXPECT_FALSE(td()->DetermineResultType(&call)); EXPECT_EQ(td()->error(), @@ -3082,7 +2996,7 @@ TEST_P(ImportData_TwoParamTest, Error_TooManyParams) { create(&f32, 1.f))); auto* ident = create(param.name); - ast::CallExpression call(std::move(ident), std::move(params)); + ast::CallExpression call(ident, params); EXPECT_FALSE(td()->DetermineResultType(&call)); EXPECT_EQ(td()->error(), std::string("incorrect number of parameters for ") + @@ -3107,12 +3021,12 @@ TEST_F(TypeDeterminerTest, ImportData_Distance_Scalar) { create(&f32, 1.f))); auto* ident = create("distance"); - auto* ident_ptr = ident; - ast::CallExpression call(std::move(ident), std::move(params)); + + ast::CallExpression call(ident, params); EXPECT_TRUE(td()->DetermineResultType(&call)) << td()->error(); - ASSERT_NE(ident_ptr->result_type(), nullptr); - EXPECT_TRUE(ident_ptr->result_type()->is_float_scalar()); + ASSERT_NE(ident->result_type(), nullptr); + EXPECT_TRUE(ident->result_type()->is_float_scalar()); } TEST_F(TypeDeterminerTest, ImportData_Distance_Vector) { @@ -3136,18 +3050,16 @@ TEST_F(TypeDeterminerTest, ImportData_Distance_Vector) { create(&f32, 3.0f))); ast::ExpressionList params; - params.push_back( - create(&vec, std::move(vals_1))); - params.push_back( - create(&vec, std::move(vals_2))); + params.push_back(create(&vec, vals_1)); + params.push_back(create(&vec, vals_2)); auto* ident = create("distance"); - auto* ident_ptr = ident; - ast::CallExpression call(std::move(ident), std::move(params)); + + ast::CallExpression call(ident, params); EXPECT_TRUE(td()->DetermineResultType(&call)) << td()->error(); - ASSERT_NE(ident_ptr->result_type(), nullptr); - EXPECT_TRUE(ident_ptr->result_type()->IsF32()); + ASSERT_NE(ident->result_type(), nullptr); + EXPECT_TRUE(ident->result_type()->IsF32()); } TEST_F(TypeDeterminerTest, ImportData_Distance_Error_Integer) { @@ -3160,7 +3072,7 @@ TEST_F(TypeDeterminerTest, ImportData_Distance_Error_Integer) { create(&i32, 2))); auto* ident = create("distance"); - ast::CallExpression call(std::move(ident), std::move(params)); + ast::CallExpression call(ident, params); EXPECT_FALSE(td()->DetermineResultType(&call)); EXPECT_EQ(td()->error(), @@ -3172,7 +3084,7 @@ TEST_F(TypeDeterminerTest, ImportData_Distance_Error_NoParams) { ast::ExpressionList params; auto* ident = create("distance"); - ast::CallExpression call(std::move(ident), std::move(params)); + ast::CallExpression call(ident, params); EXPECT_FALSE(td()->DetermineResultType(&call)); EXPECT_EQ(td()->error(), @@ -3186,7 +3098,7 @@ TEST_F(TypeDeterminerTest, ImportData_Distance_Error_OneParam) { create(&f32, 1.f))); auto* ident = create("distance"); - ast::CallExpression call(std::move(ident), std::move(params)); + ast::CallExpression call(ident, params); EXPECT_FALSE(td()->DetermineResultType(&call)); EXPECT_EQ(td()->error(), @@ -3213,13 +3125,11 @@ TEST_F(TypeDeterminerTest, ImportData_Distance_Error_MismatchedParamCount) { create(&f32, 3.0f))); ast::ExpressionList params; - params.push_back( - create(&vec2, std::move(vals_1))); - params.push_back( - create(&vec3, std::move(vals_2))); + params.push_back(create(&vec2, vals_1)); + params.push_back(create(&vec3, vals_2)); auto* ident = create("distance"); - ast::CallExpression call(std::move(ident), std::move(params)); + ast::CallExpression call(ident, params); EXPECT_FALSE(td()->DetermineResultType(&call)); EXPECT_EQ(td()->error(), "mismatched parameter types for distance"); @@ -3240,11 +3150,10 @@ TEST_F(TypeDeterminerTest, ImportData_Distance_Error_MismatchedParamType) { ast::ExpressionList params; params.push_back(create( create(&f32, 1.0f))); - params.push_back( - create(&vec, std::move(vals))); + params.push_back(create(&vec, vals)); auto* ident = create("distance"); - ast::CallExpression call(std::move(ident), std::move(params)); + ast::CallExpression call(ident, params); EXPECT_FALSE(td()->DetermineResultType(&call)); EXPECT_EQ(td()->error(), "mismatched parameter types for distance"); @@ -3261,7 +3170,7 @@ TEST_F(TypeDeterminerTest, ImportData_Distance_Error_TooManyParams) { create(&f32, 1.f))); auto* ident = create("distance"); - ast::CallExpression call(std::move(ident), std::move(params)); + ast::CallExpression call(ident, params); EXPECT_FALSE(td()->DetermineResultType(&call)); EXPECT_EQ(td()->error(), @@ -3289,19 +3198,17 @@ TEST_F(TypeDeterminerTest, ImportData_Cross) { create(&f32, 3.0f))); ast::ExpressionList params; - params.push_back( - create(&vec, std::move(vals_1))); - params.push_back( - create(&vec, std::move(vals_2))); + params.push_back(create(&vec, vals_1)); + params.push_back(create(&vec, vals_2)); auto* ident = create("cross"); - auto* ident_ptr = ident; - ast::CallExpression call(std::move(ident), std::move(params)); + + ast::CallExpression call(ident, params); EXPECT_TRUE(td()->DetermineResultType(&call)) << td()->error(); - ASSERT_NE(ident_ptr->result_type(), nullptr); - EXPECT_TRUE(ident_ptr->result_type()->is_float_vector()); - EXPECT_EQ(ident_ptr->result_type()->AsVector()->size(), 3u); + ASSERT_NE(ident->result_type(), nullptr); + EXPECT_TRUE(ident->result_type()->is_float_vector()); + EXPECT_EQ(ident->result_type()->AsVector()->size(), 3u); } TEST_F(TypeDeterminerTest, ImportData_Cross_Error_Scalar) { @@ -3314,7 +3221,7 @@ TEST_F(TypeDeterminerTest, ImportData_Cross_Error_Scalar) { create(&f32, 1.0f))); auto* ident = create("cross"); - ast::CallExpression call(std::move(ident), std::move(params)); + ast::CallExpression call(ident, params); EXPECT_FALSE(td()->DetermineResultType(&call)); EXPECT_EQ(td()->error(), @@ -3342,13 +3249,11 @@ TEST_F(TypeDeterminerTest, ImportData_Cross_Error_IntType) { create(&i32, 3))); ast::ExpressionList params; - params.push_back( - create(&vec, std::move(vals_1))); - params.push_back( - create(&vec, std::move(vals_2))); + params.push_back(create(&vec, vals_1)); + params.push_back(create(&vec, vals_2)); auto* ident = create("cross"); - ast::CallExpression call(std::move(ident), std::move(params)); + ast::CallExpression call(ident, params); EXPECT_FALSE(td()->DetermineResultType(&call)); EXPECT_EQ(td()->error(), @@ -3358,7 +3263,7 @@ TEST_F(TypeDeterminerTest, ImportData_Cross_Error_IntType) { TEST_F(TypeDeterminerTest, ImportData_Cross_Error_MissingParams) { ast::ExpressionList params; auto* ident = create("cross"); - ast::CallExpression call(std::move(ident), std::move(params)); + ast::CallExpression call(ident, params); EXPECT_FALSE(td()->DetermineResultType(&call)); EXPECT_EQ(td()->error(), @@ -3378,11 +3283,10 @@ TEST_F(TypeDeterminerTest, ImportData_Cross_Error_TooFewParams) { create(&f32, 3.0f))); ast::ExpressionList params; - params.push_back( - create(&vec, std::move(vals_1))); + params.push_back(create(&vec, vals_1)); auto* ident = create("cross"); - ast::CallExpression call(std::move(ident), std::move(params)); + ast::CallExpression call(ident, params); EXPECT_FALSE(td()->DetermineResultType(&call)); EXPECT_EQ(td()->error(), @@ -3418,15 +3322,12 @@ TEST_F(TypeDeterminerTest, ImportData_Cross_Error_TooManyParams) { create(&f32, 3.0f))); ast::ExpressionList params; - params.push_back( - create(&vec, std::move(vals_1))); - params.push_back( - create(&vec, std::move(vals_2))); - params.push_back( - create(&vec, std::move(vals_3))); + params.push_back(create(&vec, vals_1)); + params.push_back(create(&vec, vals_2)); + params.push_back(create(&vec, vals_3)); auto* ident = create("cross"); - ast::CallExpression call(std::move(ident), std::move(params)); + ast::CallExpression call(ident, params); EXPECT_FALSE(td()->DetermineResultType(&call)); EXPECT_EQ(td()->error(), @@ -3448,12 +3349,12 @@ TEST_P(ImportData_ThreeParamTest, Scalar) { create(&f32, 1.f))); auto* ident = create(param.name); - auto* ident_ptr = ident; - ast::CallExpression call(std::move(ident), std::move(params)); + + ast::CallExpression call(ident, params); EXPECT_TRUE(td()->DetermineResultType(&call)) << td()->error(); - ASSERT_NE(ident_ptr->result_type(), nullptr); - EXPECT_TRUE(ident_ptr->result_type()->is_float_scalar()); + ASSERT_NE(ident->result_type(), nullptr); + EXPECT_TRUE(ident->result_type()->is_float_scalar()); } TEST_P(ImportData_ThreeParamTest, Vector) { @@ -3487,21 +3388,18 @@ TEST_P(ImportData_ThreeParamTest, Vector) { create(&f32, 3.0f))); ast::ExpressionList params; - params.push_back( - create(&vec, std::move(vals_1))); - params.push_back( - create(&vec, std::move(vals_2))); - params.push_back( - create(&vec, std::move(vals_3))); + params.push_back(create(&vec, vals_1)); + params.push_back(create(&vec, vals_2)); + params.push_back(create(&vec, vals_3)); auto* ident = create(param.name); - auto* ident_ptr = ident; - ast::CallExpression call(std::move(ident), std::move(params)); + + ast::CallExpression call(ident, params); EXPECT_TRUE(td()->DetermineResultType(&call)) << td()->error(); - ASSERT_NE(ident_ptr->result_type(), nullptr); - EXPECT_TRUE(ident_ptr->result_type()->is_float_vector()); - EXPECT_EQ(ident_ptr->result_type()->AsVector()->size(), 3u); + ASSERT_NE(ident->result_type(), nullptr); + EXPECT_TRUE(ident->result_type()->is_float_vector()); + EXPECT_EQ(ident->result_type()->AsVector()->size(), 3u); } TEST_P(ImportData_ThreeParamTest, Error_Integer) { @@ -3518,7 +3416,7 @@ TEST_P(ImportData_ThreeParamTest, Error_Integer) { create(&i32, 3))); auto* ident = create(param.name); - ast::CallExpression call(std::move(ident), std::move(params)); + ast::CallExpression call(ident, params); EXPECT_FALSE(td()->DetermineResultType(&call)); EXPECT_EQ(td()->error(), @@ -3532,7 +3430,7 @@ TEST_P(ImportData_ThreeParamTest, Error_NoParams) { ast::ExpressionList params; auto* ident = create(param.name); - ast::CallExpression call(std::move(ident), std::move(params)); + ast::CallExpression call(ident, params); EXPECT_FALSE(td()->DetermineResultType(&call)); EXPECT_EQ(td()->error(), std::string("incorrect number of parameters for ") + @@ -3548,7 +3446,7 @@ TEST_P(ImportData_ThreeParamTest, Error_OneParam) { create(&f32, 1.f))); auto* ident = create(param.name); - ast::CallExpression call(std::move(ident), std::move(params)); + ast::CallExpression call(ident, params); EXPECT_FALSE(td()->DetermineResultType(&call)); EXPECT_EQ(td()->error(), std::string("incorrect number of parameters for ") + @@ -3566,7 +3464,7 @@ TEST_P(ImportData_ThreeParamTest, Error_TwoParams) { create(&f32, 1.f))); auto* ident = create(param.name); - ast::CallExpression call(std::move(ident), std::move(params)); + ast::CallExpression call(ident, params); EXPECT_FALSE(td()->DetermineResultType(&call)); EXPECT_EQ(td()->error(), std::string("incorrect number of parameters for ") + @@ -3603,15 +3501,12 @@ TEST_P(ImportData_ThreeParamTest, Error_MismatchedParamCount) { create(&f32, 3.0f))); ast::ExpressionList params; - params.push_back( - create(&vec2, std::move(vals_1))); - params.push_back( - create(&vec3, std::move(vals_2))); - params.push_back( - create(&vec3, std::move(vals_3))); + params.push_back(create(&vec2, vals_1)); + params.push_back(create(&vec3, vals_2)); + params.push_back(create(&vec3, vals_3)); auto* ident = create(param.name); - ast::CallExpression call(std::move(ident), std::move(params)); + ast::CallExpression call(ident, params); EXPECT_FALSE(td()->DetermineResultType(&call)); EXPECT_EQ(td()->error(), @@ -3637,11 +3532,10 @@ TEST_P(ImportData_ThreeParamTest, Error_MismatchedParamType) { create(&f32, 1.0f))); params.push_back(create( create(&f32, 1.0f))); - params.push_back( - create(&vec, std::move(vals))); + params.push_back(create(&vec, vals)); auto* ident = create(param.name); - ast::CallExpression call(std::move(ident), std::move(params)); + ast::CallExpression call(ident, params); EXPECT_FALSE(td()->DetermineResultType(&call)); EXPECT_EQ(td()->error(), @@ -3663,7 +3557,7 @@ TEST_P(ImportData_ThreeParamTest, Error_TooManyParams) { create(&f32, 1.f))); auto* ident = create(param.name); - ast::CallExpression call(std::move(ident), std::move(params)); + ast::CallExpression call(ident, params); EXPECT_FALSE(td()->DetermineResultType(&call)); EXPECT_EQ(td()->error(), std::string("incorrect number of parameters for ") + @@ -3695,12 +3589,12 @@ TEST_P(ImportData_ThreeParam_FloatOrInt_Test, Float_Scalar) { create(&f32, 1.f))); auto* ident = create(param.name); - auto* ident_ptr = ident; - ast::CallExpression call(std::move(ident), std::move(params)); + + ast::CallExpression call(ident, params); EXPECT_TRUE(td()->DetermineResultType(&call)) << td()->error(); - ASSERT_NE(ident_ptr->result_type(), nullptr); - EXPECT_TRUE(ident_ptr->result_type()->is_float_scalar()); + ASSERT_NE(ident->result_type(), nullptr); + EXPECT_TRUE(ident->result_type()->is_float_scalar()); } TEST_P(ImportData_ThreeParam_FloatOrInt_Test, Float_Vector) { @@ -3734,21 +3628,18 @@ TEST_P(ImportData_ThreeParam_FloatOrInt_Test, Float_Vector) { create(&f32, 3.0f))); ast::ExpressionList params; - params.push_back( - create(&vec, std::move(vals_1))); - params.push_back( - create(&vec, std::move(vals_2))); - params.push_back( - create(&vec, std::move(vals_3))); + params.push_back(create(&vec, vals_1)); + params.push_back(create(&vec, vals_2)); + params.push_back(create(&vec, vals_3)); auto* ident = create(param.name); - auto* ident_ptr = ident; - ast::CallExpression call(std::move(ident), std::move(params)); + + ast::CallExpression call(ident, params); EXPECT_TRUE(td()->DetermineResultType(&call)) << td()->error(); - ASSERT_NE(ident_ptr->result_type(), nullptr); - EXPECT_TRUE(ident_ptr->result_type()->is_float_vector()); - EXPECT_EQ(ident_ptr->result_type()->AsVector()->size(), 3u); + ASSERT_NE(ident->result_type(), nullptr); + EXPECT_TRUE(ident->result_type()->is_float_vector()); + EXPECT_EQ(ident->result_type()->AsVector()->size(), 3u); } TEST_P(ImportData_ThreeParam_FloatOrInt_Test, Sint_Scalar) { @@ -3765,12 +3656,12 @@ TEST_P(ImportData_ThreeParam_FloatOrInt_Test, Sint_Scalar) { create(&i32, 1))); auto* ident = create(param.name); - auto* ident_ptr = ident; - ast::CallExpression call(std::move(ident), std::move(params)); + + ast::CallExpression call(ident, params); EXPECT_TRUE(td()->DetermineResultType(&call)) << td()->error(); - ASSERT_NE(ident_ptr->result_type(), nullptr); - EXPECT_TRUE(ident_ptr->result_type()->IsI32()); + ASSERT_NE(ident->result_type(), nullptr); + EXPECT_TRUE(ident->result_type()->IsI32()); } TEST_P(ImportData_ThreeParam_FloatOrInt_Test, Sint_Vector) { @@ -3804,21 +3695,18 @@ TEST_P(ImportData_ThreeParam_FloatOrInt_Test, Sint_Vector) { create(&i32, 3))); ast::ExpressionList params; - params.push_back( - create(&vec, std::move(vals_1))); - params.push_back( - create(&vec, std::move(vals_2))); - params.push_back( - create(&vec, std::move(vals_3))); + params.push_back(create(&vec, vals_1)); + params.push_back(create(&vec, vals_2)); + params.push_back(create(&vec, vals_3)); auto* ident = create(param.name); - auto* ident_ptr = ident; - ast::CallExpression call(std::move(ident), std::move(params)); + + ast::CallExpression call(ident, params); EXPECT_TRUE(td()->DetermineResultType(&call)) << td()->error(); - ASSERT_NE(ident_ptr->result_type(), nullptr); - EXPECT_TRUE(ident_ptr->result_type()->is_signed_integer_vector()); - EXPECT_EQ(ident_ptr->result_type()->AsVector()->size(), 3u); + ASSERT_NE(ident->result_type(), nullptr); + EXPECT_TRUE(ident->result_type()->is_signed_integer_vector()); + EXPECT_EQ(ident->result_type()->AsVector()->size(), 3u); } TEST_P(ImportData_ThreeParam_FloatOrInt_Test, Uint_Scalar) { @@ -3835,12 +3723,12 @@ TEST_P(ImportData_ThreeParam_FloatOrInt_Test, Uint_Scalar) { create(&u32, 1))); auto* ident = create(param.name); - auto* ident_ptr = ident; - ast::CallExpression call(std::move(ident), std::move(params)); + + ast::CallExpression call(ident, params); EXPECT_TRUE(td()->DetermineResultType(&call)) << td()->error(); - ASSERT_NE(ident_ptr->result_type(), nullptr); - EXPECT_TRUE(ident_ptr->result_type()->IsU32()); + ASSERT_NE(ident->result_type(), nullptr); + EXPECT_TRUE(ident->result_type()->IsU32()); } TEST_P(ImportData_ThreeParam_FloatOrInt_Test, Uint_Vector) { @@ -3874,21 +3762,18 @@ TEST_P(ImportData_ThreeParam_FloatOrInt_Test, Uint_Vector) { create(&u32, 3))); ast::ExpressionList params; - params.push_back( - create(&vec, std::move(vals_1))); - params.push_back( - create(&vec, std::move(vals_2))); - params.push_back( - create(&vec, std::move(vals_3))); + params.push_back(create(&vec, vals_1)); + params.push_back(create(&vec, vals_2)); + params.push_back(create(&vec, vals_3)); auto* ident = create(param.name); - auto* ident_ptr = ident; - ast::CallExpression call(std::move(ident), std::move(params)); + + ast::CallExpression call(ident, params); EXPECT_TRUE(td()->DetermineResultType(&call)) << td()->error(); - ASSERT_NE(ident_ptr->result_type(), nullptr); - EXPECT_TRUE(ident_ptr->result_type()->is_unsigned_integer_vector()); - EXPECT_EQ(ident_ptr->result_type()->AsVector()->size(), 3u); + ASSERT_NE(ident->result_type(), nullptr); + EXPECT_TRUE(ident->result_type()->is_unsigned_integer_vector()); + EXPECT_EQ(ident->result_type()->AsVector()->size(), 3u); } TEST_P(ImportData_ThreeParam_FloatOrInt_Test, Error_Bool) { @@ -3905,7 +3790,7 @@ TEST_P(ImportData_ThreeParam_FloatOrInt_Test, Error_Bool) { create(&bool_type, true))); auto* ident = create(param.name); - ast::CallExpression call(std::move(ident), std::move(params)); + ast::CallExpression call(ident, params); EXPECT_FALSE(td()->DetermineResultType(&call)); EXPECT_EQ(td()->error(), @@ -3919,7 +3804,7 @@ TEST_P(ImportData_ThreeParam_FloatOrInt_Test, Error_NoParams) { ast::ExpressionList params; auto* ident = create(param.name); - ast::CallExpression call(std::move(ident), std::move(params)); + ast::CallExpression call(ident, params); EXPECT_FALSE(td()->DetermineResultType(&call)); EXPECT_EQ(td()->error(), std::string("incorrect number of parameters for ") + @@ -3935,7 +3820,7 @@ TEST_P(ImportData_ThreeParam_FloatOrInt_Test, Error_OneParam) { create(&f32, 1.f))); auto* ident = create(param.name); - ast::CallExpression call(std::move(ident), std::move(params)); + ast::CallExpression call(ident, params); EXPECT_FALSE(td()->DetermineResultType(&call)); EXPECT_EQ(td()->error(), std::string("incorrect number of parameters for ") + @@ -3953,7 +3838,7 @@ TEST_P(ImportData_ThreeParam_FloatOrInt_Test, Error_TwoParams) { create(&f32, 1.f))); auto* ident = create(param.name); - ast::CallExpression call(std::move(ident), std::move(params)); + ast::CallExpression call(ident, params); EXPECT_FALSE(td()->DetermineResultType(&call)); EXPECT_EQ(td()->error(), std::string("incorrect number of parameters for ") + @@ -3990,15 +3875,12 @@ TEST_P(ImportData_ThreeParam_FloatOrInt_Test, Error_MismatchedParamCount) { create(&f32, 3.0f))); ast::ExpressionList params; - params.push_back( - create(&vec2, std::move(vals_1))); - params.push_back( - create(&vec3, std::move(vals_2))); - params.push_back( - create(&vec3, std::move(vals_3))); + params.push_back(create(&vec2, vals_1)); + params.push_back(create(&vec3, vals_2)); + params.push_back(create(&vec3, vals_3)); auto* ident = create(param.name); - ast::CallExpression call(std::move(ident), std::move(params)); + ast::CallExpression call(ident, params); EXPECT_FALSE(td()->DetermineResultType(&call)); EXPECT_EQ(td()->error(), @@ -4024,11 +3906,10 @@ TEST_P(ImportData_ThreeParam_FloatOrInt_Test, Error_MismatchedParamType) { create(&f32, 1.0f))); params.push_back(create( create(&f32, 1.0f))); - params.push_back( - create(&vec, std::move(vals))); + params.push_back(create(&vec, vals)); auto* ident = create(param.name); - ast::CallExpression call(std::move(ident), std::move(params)); + ast::CallExpression call(ident, params); EXPECT_FALSE(td()->DetermineResultType(&call)); EXPECT_EQ(td()->error(), @@ -4050,7 +3931,7 @@ TEST_P(ImportData_ThreeParam_FloatOrInt_Test, Error_TooManyParams) { create(&f32, 1.f))); auto* ident = create(param.name); - ast::CallExpression call(std::move(ident), std::move(params)); + ast::CallExpression call(ident, params); EXPECT_FALSE(td()->DetermineResultType(&call)); EXPECT_EQ(td()->error(), std::string("incorrect number of parameters for ") + @@ -4074,12 +3955,12 @@ TEST_P(ImportData_Int_SingleParamTest, Scalar) { create(&i32, 1))); auto* ident = create(param.name); - auto* ident_ptr = ident; - ast::CallExpression call(std::move(ident), std::move(params)); + + ast::CallExpression call(ident, params); EXPECT_TRUE(td()->DetermineResultType(&call)) << td()->error(); - ASSERT_NE(ident_ptr->result_type(), nullptr); - EXPECT_TRUE(ident_ptr->result_type()->is_integer_scalar()); + ASSERT_NE(ident->result_type(), nullptr); + EXPECT_TRUE(ident->result_type()->is_integer_scalar()); } TEST_P(ImportData_Int_SingleParamTest, Vector) { @@ -4097,17 +3978,16 @@ TEST_P(ImportData_Int_SingleParamTest, Vector) { create(&i32, 3))); ast::ExpressionList params; - params.push_back( - create(&vec, std::move(vals))); + params.push_back(create(&vec, vals)); auto* ident = create(param.name); - auto* ident_ptr = ident; - ast::CallExpression call(std::move(ident), std::move(params)); + + ast::CallExpression call(ident, params); EXPECT_TRUE(td()->DetermineResultType(&call)) << td()->error(); - ASSERT_NE(ident_ptr->result_type(), nullptr); - EXPECT_TRUE(ident_ptr->result_type()->is_signed_integer_vector()); - EXPECT_EQ(ident_ptr->result_type()->AsVector()->size(), 3u); + ASSERT_NE(ident->result_type(), nullptr); + EXPECT_TRUE(ident->result_type()->is_signed_integer_vector()); + EXPECT_EQ(ident->result_type()->AsVector()->size(), 3u); } TEST_P(ImportData_Int_SingleParamTest, Error_Float) { @@ -4120,7 +4000,7 @@ TEST_P(ImportData_Int_SingleParamTest, Error_Float) { create(&f32, 1.f))); auto* ident = create(param.name); - ast::CallExpression call(std::move(ident), std::move(params)); + ast::CallExpression call(ident, params); EXPECT_FALSE(td()->DetermineResultType(&call)); EXPECT_EQ(td()->error(), @@ -4134,7 +4014,7 @@ TEST_P(ImportData_Int_SingleParamTest, Error_NoParams) { ast::ExpressionList params; auto* ident = create(param.name); - ast::CallExpression call(std::move(ident), std::move(params)); + ast::CallExpression call(ident, params); EXPECT_FALSE(td()->DetermineResultType(&call)); EXPECT_EQ(td()->error(), std::string("incorrect number of parameters for ") + @@ -4154,7 +4034,7 @@ TEST_P(ImportData_Int_SingleParamTest, Error_MultipleParams) { create(&i32, 1))); auto* ident = create(param.name); - ast::CallExpression call(std::move(ident), std::move(params)); + ast::CallExpression call(ident, params); EXPECT_FALSE(td()->DetermineResultType(&call)); EXPECT_EQ(td()->error(), std::string("incorrect number of parameters for ") + @@ -4182,12 +4062,12 @@ TEST_P(ImportData_FloatOrInt_TwoParamTest, Scalar_Signed) { create(&i32, 1))); auto* ident = create(param.name); - auto* ident_ptr = ident; - ast::CallExpression call(std::move(ident), std::move(params)); + + ast::CallExpression call(ident, params); EXPECT_TRUE(td()->DetermineResultType(&call)) << td()->error(); - ASSERT_NE(ident_ptr->result_type(), nullptr); - EXPECT_TRUE(ident_ptr->result_type()->IsI32()); + ASSERT_NE(ident->result_type(), nullptr); + EXPECT_TRUE(ident->result_type()->IsI32()); } TEST_P(ImportData_FloatOrInt_TwoParamTest, Scalar_Unsigned) { @@ -4202,12 +4082,12 @@ TEST_P(ImportData_FloatOrInt_TwoParamTest, Scalar_Unsigned) { create(&u32, 1))); auto* ident = create(param.name); - auto* ident_ptr = ident; - ast::CallExpression call(std::move(ident), std::move(params)); + + ast::CallExpression call(ident, params); EXPECT_TRUE(td()->DetermineResultType(&call)) << td()->error(); - ASSERT_NE(ident_ptr->result_type(), nullptr); - EXPECT_TRUE(ident_ptr->result_type()->IsU32()); + ASSERT_NE(ident->result_type(), nullptr); + EXPECT_TRUE(ident->result_type()->IsU32()); } TEST_P(ImportData_FloatOrInt_TwoParamTest, Scalar_Float) { @@ -4222,12 +4102,12 @@ TEST_P(ImportData_FloatOrInt_TwoParamTest, Scalar_Float) { create(&f32, 1))); auto* ident = create(param.name); - auto* ident_ptr = ident; - ast::CallExpression call(std::move(ident), std::move(params)); + + ast::CallExpression call(ident, params); EXPECT_TRUE(td()->DetermineResultType(&call)) << td()->error(); - ASSERT_NE(ident_ptr->result_type(), nullptr); - EXPECT_TRUE(ident_ptr->result_type()->IsF32()); + ASSERT_NE(ident->result_type(), nullptr); + EXPECT_TRUE(ident->result_type()->IsF32()); } TEST_P(ImportData_FloatOrInt_TwoParamTest, Vector_Signed) { @@ -4253,19 +4133,17 @@ TEST_P(ImportData_FloatOrInt_TwoParamTest, Vector_Signed) { create(&i32, 3))); ast::ExpressionList params; - params.push_back( - create(&vec, std::move(vals_1))); - params.push_back( - create(&vec, std::move(vals_2))); + params.push_back(create(&vec, vals_1)); + params.push_back(create(&vec, vals_2)); auto* ident = create(param.name); - auto* ident_ptr = ident; - ast::CallExpression call(std::move(ident), std::move(params)); + + ast::CallExpression call(ident, params); EXPECT_TRUE(td()->DetermineResultType(&call)) << td()->error(); - ASSERT_NE(ident_ptr->result_type(), nullptr); - EXPECT_TRUE(ident_ptr->result_type()->is_signed_integer_vector()); - EXPECT_EQ(ident_ptr->result_type()->AsVector()->size(), 3u); + ASSERT_NE(ident->result_type(), nullptr); + EXPECT_TRUE(ident->result_type()->is_signed_integer_vector()); + EXPECT_EQ(ident->result_type()->AsVector()->size(), 3u); } TEST_P(ImportData_FloatOrInt_TwoParamTest, Vector_Unsigned) { @@ -4291,19 +4169,17 @@ TEST_P(ImportData_FloatOrInt_TwoParamTest, Vector_Unsigned) { create(&u32, 3))); ast::ExpressionList params; - params.push_back( - create(&vec, std::move(vals_1))); - params.push_back( - create(&vec, std::move(vals_2))); + params.push_back(create(&vec, vals_1)); + params.push_back(create(&vec, vals_2)); auto* ident = create(param.name); - auto* ident_ptr = ident; - ast::CallExpression call(std::move(ident), std::move(params)); + + ast::CallExpression call(ident, params); EXPECT_TRUE(td()->DetermineResultType(&call)) << td()->error(); - ASSERT_NE(ident_ptr->result_type(), nullptr); - EXPECT_TRUE(ident_ptr->result_type()->is_unsigned_integer_vector()); - EXPECT_EQ(ident_ptr->result_type()->AsVector()->size(), 3u); + ASSERT_NE(ident->result_type(), nullptr); + EXPECT_TRUE(ident->result_type()->is_unsigned_integer_vector()); + EXPECT_EQ(ident->result_type()->AsVector()->size(), 3u); } TEST_P(ImportData_FloatOrInt_TwoParamTest, Vector_Float) { @@ -4329,19 +4205,17 @@ TEST_P(ImportData_FloatOrInt_TwoParamTest, Vector_Float) { create(&f32, 3))); ast::ExpressionList params; - params.push_back( - create(&vec, std::move(vals_1))); - params.push_back( - create(&vec, std::move(vals_2))); + params.push_back(create(&vec, vals_1)); + params.push_back(create(&vec, vals_2)); auto* ident = create(param.name); - auto* ident_ptr = ident; - ast::CallExpression call(std::move(ident), std::move(params)); + + ast::CallExpression call(ident, params); EXPECT_TRUE(td()->DetermineResultType(&call)) << td()->error(); - ASSERT_NE(ident_ptr->result_type(), nullptr); - EXPECT_TRUE(ident_ptr->result_type()->is_float_vector()); - EXPECT_EQ(ident_ptr->result_type()->AsVector()->size(), 3u); + ASSERT_NE(ident->result_type(), nullptr); + EXPECT_TRUE(ident->result_type()->is_float_vector()); + EXPECT_EQ(ident->result_type()->AsVector()->size(), 3u); } TEST_P(ImportData_FloatOrInt_TwoParamTest, Error_Bool) { @@ -4356,7 +4230,7 @@ TEST_P(ImportData_FloatOrInt_TwoParamTest, Error_Bool) { create(&bool_type, false))); auto* ident = create(param.name); - ast::CallExpression call(std::move(ident), std::move(params)); + ast::CallExpression call(ident, params); EXPECT_FALSE(td()->DetermineResultType(&call)); EXPECT_EQ(td()->error(), @@ -4370,7 +4244,7 @@ TEST_P(ImportData_FloatOrInt_TwoParamTest, Error_NoParams) { ast::ExpressionList params; auto* ident = create(param.name); - ast::CallExpression call(std::move(ident), std::move(params)); + ast::CallExpression call(ident, params); EXPECT_FALSE(td()->DetermineResultType(&call)); EXPECT_EQ(td()->error(), std::string("incorrect number of parameters for ") + @@ -4386,7 +4260,7 @@ TEST_P(ImportData_FloatOrInt_TwoParamTest, Error_OneParam) { create(&i32, 1))); auto* ident = create(param.name); - ast::CallExpression call(std::move(ident), std::move(params)); + ast::CallExpression call(ident, params); EXPECT_FALSE(td()->DetermineResultType(&call)); EXPECT_EQ(td()->error(), std::string("incorrect number of parameters for ") + @@ -4415,13 +4289,11 @@ TEST_P(ImportData_FloatOrInt_TwoParamTest, Error_MismatchedParamCount) { create(&i32, 3))); ast::ExpressionList params; - params.push_back( - create(&vec2, std::move(vals_1))); - params.push_back( - create(&vec3, std::move(vals_2))); + params.push_back(create(&vec2, vals_1)); + params.push_back(create(&vec3, vals_2)); auto* ident = create(param.name); - ast::CallExpression call(std::move(ident), std::move(params)); + ast::CallExpression call(ident, params); EXPECT_FALSE(td()->DetermineResultType(&call)); EXPECT_EQ(td()->error(), @@ -4445,11 +4317,10 @@ TEST_P(ImportData_FloatOrInt_TwoParamTest, Error_MismatchedParamType) { ast::ExpressionList params; params.push_back(create( create(&i32, 1))); - params.push_back( - create(&vec, std::move(vals))); + params.push_back(create(&vec, vals)); auto* ident = create(param.name); - ast::CallExpression call(std::move(ident), std::move(params)); + ast::CallExpression call(ident, params); EXPECT_FALSE(td()->DetermineResultType(&call)); EXPECT_EQ(td()->error(), @@ -4469,7 +4340,7 @@ TEST_P(ImportData_FloatOrInt_TwoParamTest, Error_TooManyParams) { create(&i32, 1))); auto* ident = create(param.name); - ast::CallExpression call(std::move(ident), std::move(params)); + ast::CallExpression call(ident, params); EXPECT_FALSE(td()->DetermineResultType(&call)); EXPECT_EQ(td()->error(), std::string("incorrect number of parameters for ") + @@ -4487,7 +4358,7 @@ TEST_F(TypeDeterminerTest, ImportData_GLSL_Determinant) { ast::type::MatrixType mat(&f32, 3, 3); auto* var = create("var", ast::StorageClass::kFunction, &mat); - mod()->AddGlobalVariable(std::move(var)); + mod()->AddGlobalVariable(var); // Register the global ASSERT_TRUE(td()->Determine()) << td()->error(); @@ -4496,12 +4367,12 @@ TEST_F(TypeDeterminerTest, ImportData_GLSL_Determinant) { params.push_back(create("var")); auto* ident = create("determinant"); - auto* ident_ptr = ident; - ast::CallExpression call(std::move(ident), std::move(params)); + + ast::CallExpression call(ident, params); EXPECT_TRUE(td()->DetermineResultType(&call)) << td()->error(); - ASSERT_NE(ident_ptr->result_type(), nullptr); - EXPECT_TRUE(ident_ptr->result_type()->IsF32()); + ASSERT_NE(ident->result_type(), nullptr); + EXPECT_TRUE(ident->result_type()->IsF32()); } using ImportData_Matrix_OneParam_Test = @@ -4512,7 +4383,7 @@ TEST_P(ImportData_Matrix_OneParam_Test, Error_Float) { ast::type::F32Type f32; auto* var = create("var", ast::StorageClass::kFunction, &f32); - mod()->AddGlobalVariable(std::move(var)); + mod()->AddGlobalVariable(var); // Register the global ASSERT_TRUE(td()->Determine()) << td()->error(); @@ -4521,7 +4392,7 @@ TEST_P(ImportData_Matrix_OneParam_Test, Error_Float) { params.push_back(create("var")); auto* ident = create(param.name); - ast::CallExpression call(std::move(ident), std::move(params)); + ast::CallExpression call(ident, params); EXPECT_FALSE(td()->DetermineResultType(&call)); EXPECT_EQ(td()->error(), std::string("incorrect type for ") + param.name + @@ -4534,7 +4405,7 @@ TEST_P(ImportData_Matrix_OneParam_Test, NoParams) { ast::ExpressionList params; auto* ident = create(param.name); - ast::CallExpression call(std::move(ident), std::move(params)); + ast::CallExpression call(ident, params); EXPECT_FALSE(td()->DetermineResultType(&call)); EXPECT_EQ(td()->error(), std::string("incorrect number of parameters for ") + @@ -4548,7 +4419,7 @@ TEST_P(ImportData_Matrix_OneParam_Test, TooManyParams) { ast::type::MatrixType mat(&f32, 3, 3); auto* var = create("var", ast::StorageClass::kFunction, &mat); - mod()->AddGlobalVariable(std::move(var)); + mod()->AddGlobalVariable(var); // Register the global ASSERT_TRUE(td()->Determine()) << td()->error(); @@ -4558,7 +4429,7 @@ TEST_P(ImportData_Matrix_OneParam_Test, TooManyParams) { params.push_back(create("var")); auto* ident = create(param.name); - ast::CallExpression call(std::move(ident), std::move(params)); + ast::CallExpression call(ident, params); EXPECT_FALSE(td()->DetermineResultType(&call)); EXPECT_EQ(td()->error(), std::string("incorrect number of parameters for ") + @@ -4586,27 +4457,21 @@ TEST_F(TypeDeterminerTest, Function_EntryPoints_StageDecoration) { ast::VariableList params; auto* body = create(); - auto* func_b = - create("b", std::move(params), &f32, std::move(body)); - auto* func_b_ptr = func_b; + auto* func_b = create("b", params, &f32, body); body = create(); body->append(create( create("second"), create(create("b"), ast::ExpressionList{}))); - auto* func_c = - create("c", std::move(params), &f32, std::move(body)); - auto* func_c_ptr = func_c; + auto* func_c = create("c", params, &f32, body); body = create(); body->append(create( create("first"), create(create("c"), ast::ExpressionList{}))); - auto* func_a = - create("a", std::move(params), &f32, std::move(body)); - auto* func_a_ptr = func_a; + auto* func_a = create("a", params, &f32, body); body = create(); body->append(create( @@ -4617,28 +4482,24 @@ TEST_F(TypeDeterminerTest, Function_EntryPoints_StageDecoration) { create("call_b"), create(create("b"), ast::ExpressionList{}))); - auto* ep_1 = - create("ep_1", std::move(params), &f32, std::move(body)); + auto* ep_1 = create("ep_1", params, &f32, body); ep_1->add_decoration( create(ast::PipelineStage::kVertex, Source{})); - auto* ep_1_ptr = ep_1; body = create(); body->append(create( create("call_c"), create(create("c"), ast::ExpressionList{}))); - auto* ep_2 = - create("ep_2", std::move(params), &f32, std::move(body)); + auto* ep_2 = create("ep_2", params, &f32, body); ep_2->add_decoration( create(ast::PipelineStage::kVertex, Source{})); - auto* ep_2_ptr = ep_2; - mod()->AddFunction(std::move(func_b)); - mod()->AddFunction(std::move(func_c)); - mod()->AddFunction(std::move(func_a)); - mod()->AddFunction(std::move(ep_1)); - mod()->AddFunction(std::move(ep_2)); + mod()->AddFunction(func_b); + mod()->AddFunction(func_c); + mod()->AddFunction(func_a); + mod()->AddFunction(ep_1); + mod()->AddFunction(ep_2); mod()->AddGlobalVariable( create("first", ast::StorageClass::kPrivate, &f32)); @@ -4654,22 +4515,22 @@ TEST_F(TypeDeterminerTest, Function_EntryPoints_StageDecoration) { // Register the functions and calculate the callers ASSERT_TRUE(td()->Determine()) << td()->error(); - const auto& b_eps = func_b_ptr->ancestor_entry_points(); + const auto& b_eps = func_b->ancestor_entry_points(); ASSERT_EQ(2u, b_eps.size()); EXPECT_EQ("ep_1", b_eps[0]); EXPECT_EQ("ep_2", b_eps[1]); - const auto& a_eps = func_a_ptr->ancestor_entry_points(); + const auto& a_eps = func_a->ancestor_entry_points(); ASSERT_EQ(1u, a_eps.size()); EXPECT_EQ("ep_1", a_eps[0]); - const auto& c_eps = func_c_ptr->ancestor_entry_points(); + const auto& c_eps = func_c->ancestor_entry_points(); ASSERT_EQ(2u, c_eps.size()); EXPECT_EQ("ep_1", c_eps[0]); EXPECT_EQ("ep_2", c_eps[1]); - EXPECT_TRUE(ep_1_ptr->ancestor_entry_points().empty()); - EXPECT_TRUE(ep_2_ptr->ancestor_entry_points().empty()); + EXPECT_TRUE(ep_1->ancestor_entry_points().empty()); + EXPECT_TRUE(ep_2->ancestor_entry_points().empty()); } } // namespace diff --git a/src/validator/validator_control_block_test.cc b/src/validator/validator_control_block_test.cc index 5f8eb86473..21f7a29d0c 100644 --- a/src/validator/validator_control_block_test.cc +++ b/src/validator/validator_control_block_test.cc @@ -52,12 +52,11 @@ TEST_F(ValidateControlBlockTest, SwitchSelectorExpressionNoneIntegerType_Fail) { ast::CaseSelectorList default_csl; auto* block_default = create(); ast::CaseStatementList body; - body.push_back(create(std::move(default_csl), - std::move(block_default))); + body.push_back(create(default_csl, block_default)); auto* block = create(); - block->append(create(std::move(var))); - block->append(create(std::move(cond), std::move(body))); + block->append(create(var)); + block->append(create(cond, body)); EXPECT_TRUE(td()->DetermineStatements(block)) << td()->error(); EXPECT_FALSE(v()->ValidateStatements(block)); @@ -80,13 +79,13 @@ TEST_F(ValidateControlBlockTest, SwitchWithoutDefault_Fail) { ast::CaseSelectorList csl; csl.push_back(create(&i32, 1)); ast::CaseStatementList body; - body.push_back(create(std::move(csl), - create())); + body.push_back( + create(csl, create())); auto* block = create(); - block->append(create(std::move(var))); + block->append(create(var)); block->append(create(Source{Source::Location{12, 34}}, - std::move(cond), std::move(body))); + cond, body)); EXPECT_TRUE(td()->DetermineStatements(block)) << td()->error(); EXPECT_FALSE(v()->ValidateStatements(block)); @@ -112,25 +111,23 @@ TEST_F(ValidateControlBlockTest, SwitchWithTwoDefault_Fail) { ast::CaseSelectorList default_csl_1; auto* block_default_1 = create(); - switch_body.push_back(create(std::move(default_csl_1), - std::move(block_default_1))); + switch_body.push_back( + create(default_csl_1, block_default_1)); ast::CaseSelectorList csl_case_1; csl_case_1.push_back(create(&i32, 1)); auto* block_case_1 = create(); - switch_body.push_back(create(std::move(csl_case_1), - std::move(block_case_1))); + switch_body.push_back(create(csl_case_1, block_case_1)); ast::CaseSelectorList default_csl_2; auto* block_default_2 = create(); - switch_body.push_back(create(std::move(default_csl_2), - std::move(block_default_2))); + switch_body.push_back( + create(default_csl_2, block_default_2)); auto* block = create(); - block->append(create(std::move(var))); + block->append(create(var)); block->append(create(Source{Source::Location{12, 34}}, - std::move(cond), - std::move(switch_body))); + cond, switch_body)); EXPECT_TRUE(td()->DetermineStatements(block)) << td()->error(); EXPECT_FALSE(v()->ValidateStatements(block)); @@ -158,18 +155,15 @@ TEST_F(ValidateControlBlockTest, ast::CaseSelectorList csl; csl.push_back(create(&u32, 1)); switch_body.push_back(create( - Source{Source::Location{12, 34}}, std::move(csl), - create())); + Source{Source::Location{12, 34}}, csl, create())); ast::CaseSelectorList default_csl; auto* block_default = create(); - switch_body.push_back(create(std::move(default_csl), - std::move(block_default))); + switch_body.push_back(create(default_csl, block_default)); auto* block = create(); - block->append(create(std::move(var))); - block->append( - create(std::move(cond), std::move(switch_body))); + block->append(create(var)); + block->append(create(cond, switch_body)); EXPECT_TRUE(td()->DetermineStatements(block)) << td()->error(); EXPECT_FALSE(v()->ValidateStatements(block)); @@ -197,18 +191,15 @@ TEST_F(ValidateControlBlockTest, ast::CaseSelectorList csl; csl.push_back(create(&i32, -1)); switch_body.push_back(create( - Source{Source::Location{12, 34}}, std::move(csl), - create())); + Source{Source::Location{12, 34}}, csl, create())); ast::CaseSelectorList default_csl; auto* block_default = create(); - switch_body.push_back(create(std::move(default_csl), - std::move(block_default))); + switch_body.push_back(create(default_csl, block_default)); auto* block = create(); - block->append(create(std::move(var))); - block->append( - create(std::move(cond), std::move(switch_body))); + block->append(create(var)); + block->append(create(cond, switch_body)); EXPECT_TRUE(td()->DetermineStatements(block)) << td()->error(); EXPECT_FALSE(v()->ValidateStatements(block)); @@ -234,25 +225,22 @@ TEST_F(ValidateControlBlockTest, NonUniqueCaseSelectorValueUint_Fail) { ast::CaseSelectorList csl_1; csl_1.push_back(create(&u32, 0)); - switch_body.push_back(create( - std::move(csl_1), create())); + switch_body.push_back( + create(csl_1, create())); ast::CaseSelectorList csl_2; csl_2.push_back(create(&u32, 2)); csl_2.push_back(create(&u32, 2)); switch_body.push_back(create( - Source{Source::Location{12, 34}}, std::move(csl_2), - create())); + Source{Source::Location{12, 34}}, csl_2, create())); ast::CaseSelectorList default_csl; auto* block_default = create(); - switch_body.push_back(create(std::move(default_csl), - std::move(block_default))); + switch_body.push_back(create(default_csl, block_default)); auto* block = create(); - block->append(create(std::move(var))); - block->append( - create(std::move(cond), std::move(switch_body))); + block->append(create(var)); + block->append(create(cond, switch_body)); EXPECT_TRUE(td()->DetermineStatements(block)) << td()->error(); EXPECT_FALSE(v()->ValidateStatements(block)); @@ -278,8 +266,8 @@ TEST_F(ValidateControlBlockTest, NonUniqueCaseSelectorValueSint_Fail) { ast::CaseSelectorList csl_1; csl_1.push_back(create(&i32, 10)); - switch_body.push_back(create( - std::move(csl_1), create())); + switch_body.push_back( + create(csl_1, create())); ast::CaseSelectorList csl_2; csl_2.push_back(create(&i32, 0)); @@ -287,18 +275,15 @@ TEST_F(ValidateControlBlockTest, NonUniqueCaseSelectorValueSint_Fail) { csl_2.push_back(create(&i32, 2)); csl_2.push_back(create(&i32, 10)); switch_body.push_back(create( - Source{Source::Location{12, 34}}, std::move(csl_2), - create())); + Source{Source::Location{12, 34}}, csl_2, create())); ast::CaseSelectorList default_csl; auto* block_default = create(); - switch_body.push_back(create(std::move(default_csl), - std::move(block_default))); + switch_body.push_back(create(default_csl, block_default)); auto* block = create(); - block->append(create(std::move(var))); - block->append( - create(std::move(cond), std::move(switch_body))); + block->append(create(var)); + block->append(create(cond, switch_body)); EXPECT_TRUE(td()->DetermineStatements(block)) << td()->error(); EXPECT_FALSE(v()->ValidateStatements(block)); @@ -323,12 +308,11 @@ TEST_F(ValidateControlBlockTest, LastClauseLastStatementIsFallthrough_Fail) { block_default->append( create(Source{Source::Location{12, 34}})); ast::CaseStatementList body; - body.push_back(create(std::move(default_csl), - std::move(block_default))); + body.push_back(create(default_csl, block_default)); auto* block = create(); - block->append(create(std::move(var))); - block->append(create(std::move(cond), std::move(body))); + block->append(create(var)); + block->append(create(cond, body)); EXPECT_TRUE(td()->DetermineStatements(block)) << td()->error(); EXPECT_FALSE(v()->ValidateStatements(block)); @@ -353,17 +337,15 @@ TEST_F(ValidateControlBlockTest, SwitchCase_Pass) { auto* block_default = create(); ast::CaseStatementList body; body.push_back(create(Source{Source::Location{12, 34}}, - std::move(default_csl), - std::move(block_default))); + default_csl, block_default)); ast::CaseSelectorList case_csl; case_csl.push_back(create(&i32, 5)); auto* block_case = create(); - body.push_back( - create(std::move(case_csl), std::move(block_case))); + body.push_back(create(case_csl, block_case)); auto* block = create(); - block->append(create(std::move(var))); - block->append(create(std::move(cond), std::move(body))); + block->append(create(var)); + block->append(create(cond, body)); EXPECT_TRUE(td()->DetermineStatements(block)) << td()->error(); EXPECT_TRUE(v()->ValidateStatements(block)) << v()->error(); @@ -388,12 +370,11 @@ TEST_F(ValidateControlBlockTest, SwitchCaseAlias_Pass) { auto* block_default = create(); ast::CaseStatementList body; body.push_back(create(Source{Source::Location{12, 34}}, - std::move(default_csl), - std::move(block_default))); + default_csl, block_default)); auto* block = create(); - block->append(create(std::move(var))); - block->append(create(std::move(cond), std::move(body))); + block->append(create(var)); + block->append(create(cond, body)); mod()->AddConstructedType(&my_int); diff --git a/src/validator/validator_function_test.cc b/src/validator/validator_function_test.cc index 7c431a0d01..6271fe3850 100644 --- a/src/validator/validator_function_test.cc +++ b/src/validator/validator_function_test.cc @@ -46,13 +46,12 @@ TEST_F(ValidateFunctionTest, VoidFunctionEndWithoutReturnStatement_Pass) { ast::VariableList params; ast::type::VoidType void_type; auto* body = create(); - body->append(create(std::move(var))); - auto* func = - create(Source{Source::Location{12, 34}}, "func", - std::move(params), &void_type, std::move(body)); + body->append(create(var)); + auto* func = create(Source{Source::Location{12, 34}}, "func", + params, &void_type, body); func->add_decoration( create(ast::PipelineStage::kVertex, Source{})); - mod()->AddFunction(std::move(func)); + mod()->AddFunction(func); EXPECT_TRUE(td()->Determine()) << td()->error(); EXPECT_TRUE(v()->Validate(mod())); @@ -64,12 +63,12 @@ TEST_F(ValidateFunctionTest, // fn func -> void {} ast::type::VoidType void_type; ast::VariableList params; - auto* func = create(Source{Source::Location{12, 34}}, "func", - std::move(params), &void_type, - create()); + auto* func = + create(Source{Source::Location{12, 34}}, "func", params, + &void_type, create()); func->add_decoration( create(ast::PipelineStage::kVertex, Source{})); - mod()->AddFunction(std::move(func)); + mod()->AddFunction(func); EXPECT_TRUE(td()->Determine()) << td()->error(); EXPECT_TRUE(v()->Validate(mod())); @@ -86,10 +85,10 @@ TEST_F(ValidateFunctionTest, FunctionEndWithoutReturnStatement_Fail) { ast::VariableList params; ast::type::VoidType void_type; auto* body = create(); - body->append(create(std::move(var))); + body->append(create(var)); auto* func = create(Source{Source::Location{12, 34}}, "func", - std::move(params), &i32, std::move(body)); - mod()->AddFunction(std::move(func)); + params, &i32, body); + mod()->AddFunction(func); EXPECT_TRUE(td()->Determine()) << td()->error(); EXPECT_FALSE(v()->Validate(mod())); @@ -103,10 +102,10 @@ TEST_F(ValidateFunctionTest, FunctionEndWithoutReturnStatementEmptyBody_Fail) { ast::type::VoidType void_type; ast::type::I32Type i32; ast::VariableList params; - auto* func = create(Source{Source::Location{12, 34}}, "func", - std::move(params), &i32, - create()); - mod()->AddFunction(std::move(func)); + auto* func = + create(Source{Source::Location{12, 34}}, "func", params, + &i32, create()); + mod()->AddFunction(func); EXPECT_TRUE(td()->Determine()) << td()->error(); EXPECT_FALSE(v()->Validate(mod())); @@ -123,11 +122,10 @@ TEST_F(ValidateFunctionTest, FunctionTypeMustMatchReturnStatementType_Pass) { auto* body = create(); body->append(create()); - auto* func = create("func", std::move(params), &void_type, - std::move(body)); + auto* func = create("func", params, &void_type, body); func->add_decoration( create(ast::PipelineStage::kVertex, Source{})); - mod()->AddFunction(std::move(func)); + mod()->AddFunction(func); EXPECT_TRUE(td()->DetermineFunctions(mod()->functions())) << td()->error(); EXPECT_TRUE(v()->ValidateFunctions(mod()->functions())) << v()->error(); @@ -143,10 +141,9 @@ TEST_F(ValidateFunctionTest, FunctionTypeMustMatchReturnStatementType_fail) { create(&i32, 2)); body->append(create(Source{Source::Location{12, 34}}, - std::move(return_expr))); - auto* func = create("func", std::move(params), &void_type, - std::move(body)); - mod()->AddFunction(std::move(func)); + return_expr)); + auto* func = create("func", params, &void_type, body); + mod()->AddFunction(func); EXPECT_TRUE(td()->Determine()) << td()->error(); EXPECT_FALSE(v()->Validate(mod())); @@ -166,10 +163,9 @@ TEST_F(ValidateFunctionTest, FunctionTypeMustMatchReturnStatementTypeF32_fail) { create(&i32, 2)); body->append(create(Source{Source::Location{12, 34}}, - std::move(return_expr))); - auto* func = - create("func", std::move(params), &f32, std::move(body)); - mod()->AddFunction(std::move(func)); + return_expr)); + auto* func = create("func", params, &f32, body); + mod()->AddFunction(func); EXPECT_TRUE(td()->Determine()) << td()->error(); EXPECT_FALSE(v()->Validate(mod())); @@ -190,22 +186,20 @@ TEST_F(ValidateFunctionTest, FunctionNamesMustBeUnique_fail) { auto* return_expr = create( create(&i32, 2)); - body->append(create(std::move(return_expr))); - auto* func = - create("func", std::move(params), &i32, std::move(body)); + body->append(create(return_expr)); + auto* func = create("func", params, &i32, body); ast::VariableList params_copy; auto* body_copy = create(); auto* return_expr_copy = create( create(&i32, 2)); - body_copy->append(create(std::move(return_expr_copy))); - auto* func_copy = - create(Source{Source::Location{12, 34}}, "func", - std::move(params_copy), &i32, std::move(body_copy)); + body_copy->append(create(return_expr_copy)); + auto* func_copy = create(Source{Source::Location{12, 34}}, + "func", params_copy, &i32, body_copy); - mod()->AddFunction(std::move(func)); - mod()->AddFunction(std::move(func_copy)); + mod()->AddFunction(func); + mod()->AddFunction(func_copy); EXPECT_TRUE(td()->Determine()) << td()->error(); EXPECT_FALSE(v()->Validate(mod())); @@ -220,14 +214,13 @@ TEST_F(ValidateFunctionTest, RecursionIsNotAllowed_Fail) { ast::ExpressionList call_params; auto* call_expr = create( Source{Source::Location{12, 34}}, - create("func"), std::move(call_params)); + create("func"), call_params); ast::VariableList params0; auto* body0 = create(); - body0->append(create(std::move(call_expr))); + body0->append(create(call_expr)); body0->append(create()); - auto* func0 = - create("func", std::move(params0), &f32, std::move(body0)); - mod()->AddFunction(std::move(func0)); + auto* func0 = create("func", params0, &f32, body0); + mod()->AddFunction(func0); EXPECT_TRUE(td()->Determine()) << td()->error(); EXPECT_FALSE(v()->Validate(mod())) << v()->error(); @@ -241,18 +234,17 @@ TEST_F(ValidateFunctionTest, RecursionIsNotAllowedExpr_Fail) { ast::ExpressionList call_params; auto* call_expr = create( Source{Source::Location{12, 34}}, - create("func"), std::move(call_params)); - var->set_constructor(std::move(call_expr)); + create("func"), call_params); + var->set_constructor(call_expr); ast::VariableList params0; auto* body0 = create(); - body0->append(create(std::move(var))); + body0->append(create(var)); auto* return_expr = create( create(&i32, 2)); - body0->append(create(std::move(return_expr))); - auto* func0 = - create("func", std::move(params0), &i32, std::move(body0)); - mod()->AddFunction(std::move(func0)); + body0->append(create(return_expr)); + auto* func0 = create("func", params0, &i32, body0); + mod()->AddFunction(func0); EXPECT_TRUE(td()->Determine()) << td()->error(); EXPECT_FALSE(v()->Validate(mod())) << v()->error(); @@ -268,14 +260,13 @@ TEST_F(ValidateFunctionTest, Function_WithPipelineStage_NotVoid_Fail) { create(&i32, 0)); auto* body = create(); - body->append(create(std::move(return_expr))); - auto* func = - create(Source{Source::Location{12, 34}}, "vtx_main", - std::move(params), &i32, std::move(body)); + body->append(create(return_expr)); + auto* func = create(Source{Source::Location{12, 34}}, + "vtx_main", params, &i32, body); func->add_decoration( create(ast::PipelineStage::kVertex, Source{})); - mod()->AddFunction(std::move(func)); + mod()->AddFunction(func); EXPECT_TRUE(td()->Determine()) << td()->error(); EXPECT_FALSE(v()->Validate(mod())); EXPECT_EQ(v()->error(), @@ -291,13 +282,12 @@ TEST_F(ValidateFunctionTest, Function_WithPipelineStage_WithParams_Fail) { params.push_back(create("a", ast::StorageClass::kNone, &i32)); auto* body = create(); body->append(create()); - auto* func = - create(Source{Source::Location{12, 34}}, "vtx_func", - std::move(params), &void_type, std::move(body)); + auto* func = create(Source{Source::Location{12, 34}}, + "vtx_func", params, &void_type, body); func->add_decoration( create(ast::PipelineStage::kVertex, Source{})); - mod()->AddFunction(std::move(func)); + mod()->AddFunction(func); EXPECT_TRUE(td()->Determine()) << td()->error(); EXPECT_FALSE(v()->Validate(mod())); EXPECT_EQ(v()->error(), @@ -313,14 +303,13 @@ TEST_F(ValidateFunctionTest, PipelineStage_MustBeUnique_Fail) { ast::VariableList params; auto* body = create(); body->append(create()); - auto* func = - create(Source{Source::Location{12, 34}}, "main", - std::move(params), &void_type, std::move(body)); + auto* func = create(Source{Source::Location{12, 34}}, "main", + params, &void_type, body); func->add_decoration( create(ast::PipelineStage::kVertex, Source{})); func->add_decoration( create(ast::PipelineStage::kFragment, Source{})); - mod()->AddFunction(std::move(func)); + mod()->AddFunction(func); EXPECT_TRUE(td()->Determine()) << td()->error(); EXPECT_FALSE(v()->Validate(mod())); EXPECT_EQ( @@ -335,11 +324,10 @@ TEST_F(ValidateFunctionTest, OnePipelineStageFunctionMustBePresent_Pass) { ast::VariableList params; auto* body = create(); body->append(create()); - auto* func = create("vtx_func", std::move(params), &void_type, - std::move(body)); + auto* func = create("vtx_func", params, &void_type, body); func->add_decoration( create(ast::PipelineStage::kVertex, Source{})); - mod()->AddFunction(std::move(func)); + mod()->AddFunction(func); EXPECT_TRUE(td()->Determine()) << td()->error(); EXPECT_TRUE(v()->Validate(mod())) << v()->error(); @@ -351,9 +339,8 @@ TEST_F(ValidateFunctionTest, OnePipelineStageFunctionMustBePresent_Fail) { ast::VariableList params; auto* body = create(); body->append(create()); - auto* func = create("vtx_func", std::move(params), &void_type, - std::move(body)); - mod()->AddFunction(std::move(func)); + auto* func = create("vtx_func", params, &void_type, body); + mod()->AddFunction(func); EXPECT_TRUE(td()->Determine()) << td()->error(); EXPECT_FALSE(v()->Validate(mod())); diff --git a/src/validator/validator_impl.cc b/src/validator/validator_impl.cc index 9edaf501e6..eccdde60c8 100644 --- a/src/validator/validator_impl.cc +++ b/src/validator/validator_impl.cc @@ -271,21 +271,19 @@ bool ValidatorImpl::ValidateSwitch(const ast::SwitchStatement* s) { } for (auto* selector : case_stmt->selectors()) { - auto* selector_ptr = selector; - if (cond_type != selector_ptr->type()) { + if (cond_type != selector->type()) { set_error(case_stmt->source(), "v-0026: the case selector values must have the same " "type as the selector expression."); return false; } - auto v = static_cast(selector_ptr->type()->IsU32() - ? selector_ptr->AsUint()->value() - : selector_ptr->AsSint()->value()); + auto v = static_cast(selector->type()->IsU32() + ? selector->AsUint()->value() + : selector->AsSint()->value()); if (selector_set.count(v)) { - auto v_str = selector_ptr->type()->IsU32() - ? selector_ptr->AsUint()->to_str() - : selector_ptr->AsSint()->to_str(); + auto v_str = selector->type()->IsU32() ? selector->AsUint()->to_str() + : selector->AsSint()->to_str(); set_error(case_stmt->source(), "v-0027: a literal value must not appear more than once in " "the case selectors for a switch statement: '" + diff --git a/src/validator/validator_test.cc b/src/validator/validator_test.cc index 6b0b688167..8b80ab3456 100644 --- a/src/validator/validator_test.cc +++ b/src/validator/validator_test.cc @@ -67,8 +67,7 @@ TEST_F(ValidatorTest, DISABLED_AssignToScalar_Fail) { auto* lhs = create( create(&i32, 1)); auto* rhs = create("my_var"); - ast::AssignmentStatement assign(Source{Source::Location{12, 34}}, - std::move(lhs), std::move(rhs)); + ast::AssignmentStatement assign(Source{Source::Location{12, 34}}, lhs, rhs); // TODO(sarahM0): Invalidate assignment to scalar. ASSERT_TRUE(v()->has_error()); @@ -85,7 +84,7 @@ TEST_F(ValidatorTest, UsingUndefinedVariable_Fail) { auto* rhs = create( create(&i32, 2)); auto* assign = create( - Source{Source::Location{12, 34}}, std::move(lhs), std::move(rhs)); + Source{Source::Location{12, 34}}, lhs, rhs); EXPECT_FALSE(td()->DetermineResultType(assign)); EXPECT_EQ(td()->error(), @@ -105,7 +104,7 @@ TEST_F(ValidatorTest, UsingUndefinedVariableInBlockStatement_Fail) { auto* body = create(); body->append(create( - Source{Source::Location{12, 34}}, std::move(lhs), std::move(rhs))); + Source{Source::Location{12, 34}}, lhs, rhs)); EXPECT_FALSE(td()->DetermineStatements(body)); EXPECT_EQ(td()->error(), @@ -121,17 +120,14 @@ TEST_F(ValidatorTest, AssignCompatibleTypes_Pass) { create(&i32, 2))); auto* lhs = create("a"); - auto* lhs_ptr = lhs; auto* rhs = create( create(&i32, 2)); - auto* rhs_ptr = rhs; - ast::AssignmentStatement assign(Source{Source::Location{12, 34}}, - std::move(lhs), std::move(rhs)); + ast::AssignmentStatement assign(Source{Source::Location{12, 34}}, lhs, rhs); td()->RegisterVariableForTesting(var); EXPECT_TRUE(td()->DetermineResultType(&assign)) << td()->error(); - ASSERT_NE(lhs_ptr->result_type(), nullptr); - ASSERT_NE(rhs_ptr->result_type(), nullptr); + ASSERT_NE(lhs->result_type(), nullptr); + ASSERT_NE(rhs->result_type(), nullptr); EXPECT_TRUE(v()->ValidateResultTypes(&assign)); } @@ -147,17 +143,14 @@ TEST_F(ValidatorTest, AssignIncompatibleTypes_Fail) { var->set_constructor(create( create(&i32, 2))); auto* lhs = create("a"); - auto* lhs_ptr = lhs; auto* rhs = create( create(&f32, 2.3f)); - auto* rhs_ptr = rhs; - ast::AssignmentStatement assign(Source{Source::Location{12, 34}}, - std::move(lhs), std::move(rhs)); + ast::AssignmentStatement assign(Source{Source::Location{12, 34}}, lhs, rhs); td()->RegisterVariableForTesting(var); EXPECT_TRUE(td()->DetermineResultType(&assign)) << td()->error(); - ASSERT_NE(lhs_ptr->result_type(), nullptr); - ASSERT_NE(rhs_ptr->result_type(), nullptr); + ASSERT_NE(lhs->result_type(), nullptr); + ASSERT_NE(rhs->result_type(), nullptr); EXPECT_FALSE(v()->ValidateResultTypes(&assign)); ASSERT_TRUE(v()->has_error()); @@ -177,19 +170,17 @@ TEST_F(ValidatorTest, AssignCompatibleTypesInBlockStatement_Pass) { create(&i32, 2))); auto* lhs = create("a"); - auto* lhs_ptr = lhs; auto* rhs = create( create(&i32, 2)); - auto* rhs_ptr = rhs; auto* body = create(); - body->append(create(std::move(var))); + body->append(create(var)); body->append(create( - Source{Source::Location{12, 34}}, std::move(lhs), std::move(rhs))); + Source{Source::Location{12, 34}}, lhs, rhs)); EXPECT_TRUE(td()->DetermineStatements(body)) << td()->error(); - ASSERT_NE(lhs_ptr->result_type(), nullptr); - ASSERT_NE(rhs_ptr->result_type(), nullptr); + ASSERT_NE(lhs->result_type(), nullptr); + ASSERT_NE(rhs->result_type(), nullptr); EXPECT_TRUE(v()->ValidateStatements(body)) << v()->error(); } @@ -206,19 +197,17 @@ TEST_F(ValidatorTest, AssignIncompatibleTypesInBlockStatement_Fail) { var->set_constructor(create( create(&i32, 2))); auto* lhs = create("a"); - auto* lhs_ptr = lhs; auto* rhs = create( create(&f32, 2.3f)); - auto* rhs_ptr = rhs; ast::BlockStatement block; - block.append(create(std::move(var))); + block.append(create(var)); block.append(create( - Source{Source::Location{12, 34}}, std::move(lhs), std::move(rhs))); + Source{Source::Location{12, 34}}, lhs, rhs)); EXPECT_TRUE(td()->DetermineStatements(&block)) << td()->error(); - ASSERT_NE(lhs_ptr->result_type(), nullptr); - ASSERT_NE(rhs_ptr->result_type(), nullptr); + ASSERT_NE(lhs->result_type(), nullptr); + ASSERT_NE(rhs->result_type(), nullptr); EXPECT_FALSE(v()->ValidateStatements(&block)); ASSERT_TRUE(v()->has_error()); @@ -233,7 +222,7 @@ TEST_F(ValidatorTest, GlobalVariableWithStorageClass_Pass) { auto* global_var = create(Source{Source::Location{12, 34}}, "global_var", ast::StorageClass::kInput, &f32); - mod()->AddGlobalVariable(std::move(global_var)); + mod()->AddGlobalVariable(global_var); EXPECT_TRUE(v()->ValidateGlobalVariables(mod()->global_variables())) << v()->error(); } @@ -244,7 +233,7 @@ TEST_F(ValidatorTest, GlobalVariableNoStorageClass_Fail) { auto* global_var = create(Source{Source::Location{12, 34}}, "global_var", ast::StorageClass::kNone, &f32); - mod()->AddGlobalVariable(std::move(global_var)); + mod()->AddGlobalVariable(global_var); EXPECT_TRUE(td()->Determine()) << td()->error(); EXPECT_FALSE(v()->Validate(mod())); EXPECT_EQ(v()->error(), @@ -258,7 +247,7 @@ TEST_F(ValidatorTest, GlobalConstantWithStorageClass_Fail) { ast::StorageClass::kInput, &f32); global_var->set_is_const(true); - mod()->AddGlobalVariable(std::move(global_var)); + mod()->AddGlobalVariable(global_var); EXPECT_TRUE(td()->Determine()) << td()->error(); EXPECT_FALSE(v()->Validate(mod())); EXPECT_EQ( @@ -274,7 +263,7 @@ TEST_F(ValidatorTest, GlobalConstNoStorageClass_Pass) { ast::StorageClass::kNone, &f32); global_var->set_is_const(true); - mod()->AddGlobalVariable(std::move(global_var)); + mod()->AddGlobalVariable(global_var); EXPECT_TRUE(td()->Determine()) << td()->error(); EXPECT_FALSE(v()->Validate(mod())) << v()->error(); } @@ -289,7 +278,7 @@ TEST_F(ValidatorTest, UsingUndefinedVariableGlobalVariable_Fail) { create("global_var", ast::StorageClass::kPrivate, &f32); global_var->set_constructor(create( create(&f32, 2.1))); - mod()->AddGlobalVariable(std::move(global_var)); + mod()->AddGlobalVariable(global_var); auto* lhs = create( Source{Source::Location{12, 34}}, "not_global_var"); @@ -299,11 +288,10 @@ TEST_F(ValidatorTest, UsingUndefinedVariableGlobalVariable_Fail) { ast::VariableList params; auto* body = create(); body->append(create( - Source{Source::Location{12, 34}}, std::move(lhs), std::move(rhs))); + Source{Source::Location{12, 34}}, lhs, rhs)); - auto* func = create("my_func", std::move(params), &f32, - std::move(body)); - mod()->AddFunction(std::move(func)); + auto* func = create("my_func", params, &f32, body); + mod()->AddFunction(func); EXPECT_FALSE(v()->Validate(mod())); EXPECT_EQ(v()->error(), "12:34: v-0006: 'not_global_var' is not declared"); @@ -322,7 +310,7 @@ TEST_F(ValidatorTest, UsingUndefinedVariableGlobalVariable_Pass) { create("global_var", ast::StorageClass::kPrivate, &f32); global_var->set_constructor(create( create(&f32, 2.1))); - mod()->AddGlobalVariable(std::move(global_var)); + mod()->AddGlobalVariable(global_var); auto* lhs = create("global_var"); auto* rhs = create( @@ -332,13 +320,12 @@ TEST_F(ValidatorTest, UsingUndefinedVariableGlobalVariable_Pass) { auto* body = create(); body->append(create( - Source{Source::Location{12, 34}}, std::move(lhs), std::move(rhs))); + Source{Source::Location{12, 34}}, lhs, rhs)); body->append(create()); - auto* func = create("my_func", std::move(params), &void_type, - std::move(body)); + auto* func = create("my_func", params, &void_type, body); func->add_decoration( create(ast::PipelineStage::kVertex, Source{})); - mod()->AddFunction(std::move(func)); + mod()->AddFunction(func); EXPECT_TRUE(td()->Determine()) << td()->error(); EXPECT_TRUE(v()->Validate(mod())) << v()->error(); @@ -358,24 +345,21 @@ TEST_F(ValidatorTest, UsingUndefinedVariableInnerScope_Fail) { auto* cond = create( create(&bool_type, true)); auto* body = create(); - body->append(create(std::move(var))); + body->append(create(var)); auto* lhs = create(Source{Source::Location{12, 34}}, "a"); - auto* lhs_ptr = lhs; auto* rhs = create( create(&f32, 3.14f)); - auto* rhs_ptr = rhs; auto* outer_body = create(); - outer_body->append( - create(std::move(cond), std::move(body))); + outer_body->append(create(cond, body)); outer_body->append(create( - Source{Source::Location{12, 34}}, std::move(lhs), std::move(rhs))); + Source{Source::Location{12, 34}}, lhs, rhs)); EXPECT_TRUE(td()->DetermineStatements(outer_body)) << td()->error(); - ASSERT_NE(lhs_ptr->result_type(), nullptr); - ASSERT_NE(rhs_ptr->result_type(), nullptr); + ASSERT_NE(lhs->result_type(), nullptr); + ASSERT_NE(rhs->result_type(), nullptr); EXPECT_FALSE(v()->ValidateStatements(outer_body)); EXPECT_EQ(v()->error(), "12:34: v-0006: 'a' is not declared"); } @@ -392,24 +376,22 @@ TEST_F(ValidatorTest, UsingUndefinedVariableOuterScope_Pass) { auto* lhs = create(Source{Source::Location{12, 34}}, "a"); - auto* lhs_ptr = lhs; auto* rhs = create( create(&f32, 3.14f)); - auto* rhs_ptr = rhs; + ast::type::BoolType bool_type; auto* cond = create( create(&bool_type, true)); auto* body = create(); body->append(create( - Source{Source::Location{12, 34}}, std::move(lhs), std::move(rhs))); + Source{Source::Location{12, 34}}, lhs, rhs)); auto* outer_body = create(); - outer_body->append(create(std::move(var))); - outer_body->append( - create(std::move(cond), std::move(body))); + outer_body->append(create(var)); + outer_body->append(create(cond, body)); EXPECT_TRUE(td()->DetermineStatements(outer_body)) << td()->error(); - ASSERT_NE(lhs_ptr->result_type(), nullptr); - ASSERT_NE(rhs_ptr->result_type(), nullptr); + ASSERT_NE(lhs->result_type(), nullptr); + ASSERT_NE(rhs->result_type(), nullptr); EXPECT_TRUE(v()->ValidateStatements(outer_body)) << v()->error(); } @@ -422,14 +404,14 @@ TEST_F(ValidatorTest, GlobalVariableUnique_Pass) { create("global_var0", ast::StorageClass::kPrivate, &f32); var0->set_constructor(create( create(&f32, 0.1))); - mod()->AddGlobalVariable(std::move(var0)); + mod()->AddGlobalVariable(var0); auto* var1 = create(Source{Source::Location{12, 34}}, "global_var1", ast::StorageClass::kPrivate, &f32); var1->set_constructor(create( create(&i32, 0))); - mod()->AddGlobalVariable(std::move(var1)); + mod()->AddGlobalVariable(var1); EXPECT_TRUE(v()->ValidateGlobalVariables(mod()->global_variables())) << v()->error(); @@ -444,14 +426,14 @@ TEST_F(ValidatorTest, GlobalVariableNotUnique_Fail) { create("global_var", ast::StorageClass::kPrivate, &f32); var0->set_constructor(create( create(&f32, 0.1))); - mod()->AddGlobalVariable(std::move(var0)); + mod()->AddGlobalVariable(var0); auto* var1 = create(Source{Source::Location{12, 34}}, "global_var", ast::StorageClass::kPrivate, &f32); var1->set_constructor(create( create(&i32, 0))); - mod()->AddGlobalVariable(std::move(var1)); + mod()->AddGlobalVariable(var1); EXPECT_FALSE(v()->ValidateGlobalVariables(mod()->global_variables())); EXPECT_EQ(v()->error(), @@ -470,19 +452,17 @@ TEST_F(ValidatorTest, AssignToConstant_Fail) { var->set_is_const(true); auto* lhs = create("a"); - auto* lhs_ptr = lhs; auto* rhs = create( create(&i32, 2)); - auto* rhs_ptr = rhs; auto* body = create(); - body->append(create(std::move(var))); + body->append(create(var)); body->append(create( - Source{Source::Location{12, 34}}, std::move(lhs), std::move(rhs))); + Source{Source::Location{12, 34}}, lhs, rhs)); EXPECT_TRUE(td()->DetermineStatements(body)) << td()->error(); - ASSERT_NE(lhs_ptr->result_type(), nullptr); - ASSERT_NE(rhs_ptr->result_type(), nullptr); + ASSERT_NE(lhs->result_type(), nullptr); + ASSERT_NE(rhs->result_type(), nullptr); EXPECT_FALSE(v()->ValidateStatements(body)); EXPECT_EQ(v()->error(), "12:34: v-0021: cannot re-assign a constant: 'a'"); @@ -501,7 +481,7 @@ TEST_F(ValidatorTest, GlobalVariableFunctionVariableNotUnique_Fail) { create("a", ast::StorageClass::kPrivate, &f32); global_var->set_constructor(create( create(&f32, 2.1))); - mod()->AddGlobalVariable(std::move(global_var)); + mod()->AddGlobalVariable(global_var); auto* var = create("a", ast::StorageClass::kNone, &f32); var->set_constructor(create( @@ -509,14 +489,13 @@ TEST_F(ValidatorTest, GlobalVariableFunctionVariableNotUnique_Fail) { ast::VariableList params; auto* body = create(); body->append(create( - Source{Source::Location{12, 34}}, std::move(var))); - auto* func = create("my_func", std::move(params), &void_type, - std::move(body)); - auto* func_ptr = func; - mod()->AddFunction(std::move(func)); + Source{Source::Location{12, 34}}, var)); + auto* func = create("my_func", params, &void_type, body); + + mod()->AddFunction(func); EXPECT_TRUE(td()->Determine()) << td()->error(); - EXPECT_TRUE(td()->DetermineFunction(func_ptr)) << td()->error(); + EXPECT_TRUE(td()->DetermineFunction(func)) << td()->error(); EXPECT_FALSE(v()->Validate(mod())) << v()->error(); EXPECT_EQ(v()->error(), "12:34: v-0013: redeclared identifier 'a'"); } @@ -540,16 +519,15 @@ TEST_F(ValidatorTest, RedeclaredIndentifier_Fail) { ast::VariableList params; auto* body = create(); - body->append(create(std::move(var))); + body->append(create(var)); body->append(create( - Source{Source::Location{12, 34}}, std::move(var_a_float))); - auto* func = create("my_func", std::move(params), &void_type, - std::move(body)); - auto* func_ptr = func; - mod()->AddFunction(std::move(func)); + Source{Source::Location{12, 34}}, var_a_float)); + auto* func = create("my_func", params, &void_type, body); + + mod()->AddFunction(func); EXPECT_TRUE(td()->Determine()) << td()->error(); - EXPECT_TRUE(td()->DetermineFunction(func_ptr)) << td()->error(); + EXPECT_TRUE(td()->DetermineFunction(func)) << td()->error(); EXPECT_FALSE(v()->Validate(mod())); EXPECT_EQ(v()->error(), "12:34: v-0014: redeclared identifier 'a'"); } @@ -568,7 +546,7 @@ TEST_F(ValidatorTest, RedeclaredIdentifierInnerScope_Pass) { auto* cond = create( create(&bool_type, true)); auto* body = create(); - body->append(create(std::move(var))); + body->append(create(var)); auto* var_a_float = create("a", ast::StorageClass::kNone, &f32); @@ -576,10 +554,9 @@ TEST_F(ValidatorTest, RedeclaredIdentifierInnerScope_Pass) { create(&f32, 3.14))); auto* outer_body = create(); - outer_body->append( - create(std::move(cond), std::move(body))); + outer_body->append(create(cond, body)); outer_body->append(create( - Source{Source::Location{12, 34}}, std::move(var_a_float))); + Source{Source::Location{12, 34}}, var_a_float)); EXPECT_TRUE(td()->DetermineStatements(outer_body)) << td()->error(); EXPECT_TRUE(v()->ValidateStatements(outer_body)) << v()->error(); @@ -607,13 +584,11 @@ TEST_F(ValidatorTest, DISABLED_RedeclaredIdentifierInnerScope_False) { create(&bool_type, true)); auto* body = create(); body->append(create( - Source{Source::Location{12, 34}}, std::move(var))); + Source{Source::Location{12, 34}}, var)); auto* outer_body = create(); - outer_body->append( - create(std::move(var_a_float))); - outer_body->append( - create(std::move(cond), std::move(body))); + outer_body->append(create(var_a_float)); + outer_body->append(create(cond, body)); EXPECT_TRUE(td()->DetermineStatements(outer_body)) << td()->error(); EXPECT_FALSE(v()->ValidateStatements(outer_body)); @@ -636,23 +611,21 @@ TEST_F(ValidatorTest, RedeclaredIdentifierDifferentFunctions_Pass) { ast::VariableList params0; auto* body0 = create(); body0->append(create( - Source{Source::Location{12, 34}}, std::move(var0))); + Source{Source::Location{12, 34}}, var0)); body0->append(create()); - auto* func0 = create("func0", std::move(params0), &void_type, - std::move(body0)); + auto* func0 = create("func0", params0, &void_type, body0); ast::VariableList params1; auto* body1 = create(); body1->append(create( - Source{Source::Location{13, 34}}, std::move(var1))); + Source{Source::Location{13, 34}}, var1)); body1->append(create()); - auto* func1 = create("func1", std::move(params1), &void_type, - std::move(body1)); + auto* func1 = create("func1", params1, &void_type, body1); func1->add_decoration( create(ast::PipelineStage::kVertex, Source{})); - mod()->AddFunction(std::move(func0)); - mod()->AddFunction(std::move(func1)); + mod()->AddFunction(func0); + mod()->AddFunction(func1); EXPECT_TRUE(td()->Determine()) << td()->error(); EXPECT_TRUE(v()->Validate(mod())) << v()->error(); @@ -668,19 +641,17 @@ TEST_F(ValidatorTest, VariableDeclNoConstructor_Pass) { td()->RegisterVariableForTesting(var); auto* lhs = create("a"); - auto* lhs_ptr = lhs; auto* rhs = create( create(&i32, 2)); - auto* rhs_ptr = rhs; auto* body = create(); - body->append(create(std::move(var))); + body->append(create(var)); body->append(create( - Source{Source::Location{12, 34}}, std::move(lhs), std::move(rhs))); + Source{Source::Location{12, 34}}, lhs, rhs)); EXPECT_TRUE(td()->DetermineStatements(body)) << td()->error(); - ASSERT_NE(lhs_ptr->result_type(), nullptr); - ASSERT_NE(rhs_ptr->result_type(), nullptr); + ASSERT_NE(lhs->result_type(), nullptr); + ASSERT_NE(rhs->result_type(), nullptr); EXPECT_TRUE(v()->ValidateStatements(body)) << v()->error(); } diff --git a/src/writer/hlsl/generator_impl_alias_type_test.cc b/src/writer/hlsl/generator_impl_alias_type_test.cc index da36b1f83f..4dbe93a425 100644 --- a/src/writer/hlsl/generator_impl_alias_type_test.cc +++ b/src/writer/hlsl/generator_impl_alias_type_test.cc @@ -50,18 +50,16 @@ TEST_F(HlslGeneratorImplTest_AliasType, EmitAliasType_Struct) { ast::type::I32Type i32; ast::type::F32Type f32; - ast::StructMemberList members; - members.push_back( - create("a", &f32, ast::StructMemberDecorationList{})); - - ast::StructMemberDecorationList b_deco; - b_deco.push_back(create(4, Source{})); - members.push_back(create("b", &i32, std::move(b_deco))); - auto* str = create(); - str->set_members(std::move(members)); + str->set_members({ + create("a", &f32, ast::StructMemberDecorationList{}), + create( + "b", &i32, + ast::StructMemberDecorationList{ + create(4, Source{})}), + }); - ast::type::StructType s("A", std::move(str)); + ast::type::StructType s("A", str); ast::type::AliasType alias("B", &s); ASSERT_TRUE(gen.EmitConstructedType(out, &alias)) << gen.error(); diff --git a/src/writer/hlsl/generator_impl_array_accessor_test.cc b/src/writer/hlsl/generator_impl_array_accessor_test.cc index a3e6e599a1..b803f8b846 100644 --- a/src/writer/hlsl/generator_impl_array_accessor_test.cc +++ b/src/writer/hlsl/generator_impl_array_accessor_test.cc @@ -32,10 +32,10 @@ using HlslGeneratorImplTest_Expression = TestHelper; TEST_F(HlslGeneratorImplTest_Expression, EmitExpression_ArrayAccessor) { ast::type::I32Type i32; auto* lit = create(&i32, 5); - auto* idx = create(std::move(lit)); + auto* idx = create(lit); auto* ary = create("ary"); - ast::ArrayAccessorExpression expr(std::move(ary), std::move(idx)); + ast::ArrayAccessorExpression expr(ary, idx); ASSERT_TRUE(gen.EmitExpression(pre, out, &expr)) << gen.error(); EXPECT_EQ(result(), "ary[5]"); @@ -45,7 +45,7 @@ TEST_F(HlslGeneratorImplTest_Expression, EmitArrayAccessor) { auto* ary = create("ary"); auto* idx = create("idx"); - ast::ArrayAccessorExpression expr(std::move(ary), std::move(idx)); + ast::ArrayAccessorExpression expr(ary, idx); ASSERT_TRUE(gen.EmitExpression(pre, out, &expr)) << gen.error(); EXPECT_EQ(result(), "ary[idx]"); diff --git a/src/writer/hlsl/generator_impl_assign_test.cc b/src/writer/hlsl/generator_impl_assign_test.cc index bb13cc0d56..a34d9ac6a0 100644 --- a/src/writer/hlsl/generator_impl_assign_test.cc +++ b/src/writer/hlsl/generator_impl_assign_test.cc @@ -30,7 +30,7 @@ using HlslGeneratorImplTest_Assign = TestHelper; TEST_F(HlslGeneratorImplTest_Assign, Emit_Assign) { auto* lhs = create("lhs"); auto* rhs = create("rhs"); - ast::AssignmentStatement assign(std::move(lhs), std::move(rhs)); + ast::AssignmentStatement assign(lhs, rhs); gen.increment_indent(); diff --git a/src/writer/hlsl/generator_impl_binary_test.cc b/src/writer/hlsl/generator_impl_binary_test.cc index ca333ca83a..23d76c585f 100644 --- a/src/writer/hlsl/generator_impl_binary_test.cc +++ b/src/writer/hlsl/generator_impl_binary_test.cc @@ -57,7 +57,7 @@ TEST_P(HlslBinaryTest, Emit) { auto* left = create("left"); auto* right = create("right"); - ast::BinaryExpression expr(params.op, std::move(left), std::move(right)); + ast::BinaryExpression expr(params.op, left, right); ASSERT_TRUE(gen.EmitExpression(pre, out, &expr)) << gen.error(); EXPECT_EQ(result(), params.result); @@ -87,8 +87,7 @@ TEST_F(HlslGeneratorImplTest_Binary, Logical_And) { auto* left = create("left"); auto* right = create("right"); - ast::BinaryExpression expr(ast::BinaryOp::kLogicalAnd, std::move(left), - std::move(right)); + ast::BinaryExpression expr(ast::BinaryOp::kLogicalAnd, left, right); ASSERT_TRUE(gen.EmitExpression(pre, out, &expr)) << gen.error(); EXPECT_EQ(result(), "(_tint_tmp)"); @@ -108,10 +107,8 @@ TEST_F(HlslGeneratorImplTest_Binary, Logical_Multi) { ast::BinaryExpression expr( ast::BinaryOp::kLogicalOr, - create(ast::BinaryOp::kLogicalAnd, std::move(a), - std::move(b)), - create(ast::BinaryOp::kLogicalOr, std::move(c), - std::move(d))); + create(ast::BinaryOp::kLogicalAnd, a, b), + create(ast::BinaryOp::kLogicalOr, c, d)); ASSERT_TRUE(gen.EmitExpression(pre, out, &expr)) << gen.error(); EXPECT_EQ(result(), "(_tint_tmp_0)"); @@ -134,8 +131,7 @@ TEST_F(HlslGeneratorImplTest_Binary, Logical_Or) { auto* left = create("left"); auto* right = create("right"); - ast::BinaryExpression expr(ast::BinaryOp::kLogicalOr, std::move(left), - std::move(right)); + ast::BinaryExpression expr(ast::BinaryOp::kLogicalOr, left, right); ASSERT_TRUE(gen.EmitExpression(pre, out, &expr)) << gen.error(); EXPECT_EQ(result(), "(_tint_tmp)"); @@ -161,7 +157,7 @@ TEST_F(HlslGeneratorImplTest_Binary, If_WithLogical) { body->append( create(create( create(&i32, 3)))); - auto* else_stmt = create(std::move(body)); + auto* else_stmt = create(body); body = create(); body->append( @@ -171,11 +167,11 @@ TEST_F(HlslGeneratorImplTest_Binary, If_WithLogical) { create(ast::BinaryOp::kLogicalOr, create("b"), create("c")), - std::move(body)); + body); ast::ElseStatementList else_stmts; - else_stmts.push_back(std::move(else_if_stmt)); - else_stmts.push_back(std::move(else_stmt)); + else_stmts.push_back(else_if_stmt); + else_stmts.push_back(else_stmt); body = create(); body->append( @@ -186,8 +182,8 @@ TEST_F(HlslGeneratorImplTest_Binary, If_WithLogical) { create(ast::BinaryOp::kLogicalAnd, create("a"), create("b")), - std::move(body)); - expr.set_else_statements(std::move(else_stmts)); + body); + expr.set_else_statements(else_stmts); ASSERT_TRUE(gen.EmitStatement(out, &expr)) << gen.error(); EXPECT_EQ(result(), R"(bool _tint_tmp = a; @@ -218,9 +214,7 @@ TEST_F(HlslGeneratorImplTest_Binary, Return_WithLogical) { ast::ReturnStatement expr(create( ast::BinaryOp::kLogicalOr, - create(ast::BinaryOp::kLogicalAnd, std::move(a), - std::move(b)), - std::move(c))); + create(ast::BinaryOp::kLogicalAnd, a, b), c)); ASSERT_TRUE(gen.EmitStatement(out, &expr)) << gen.error(); EXPECT_EQ(result(), R"(bool _tint_tmp = a; @@ -243,12 +237,10 @@ TEST_F(HlslGeneratorImplTest_Binary, Assign_WithLogical) { auto* d = create("d"); ast::AssignmentStatement expr( - std::move(a), + a, create( ast::BinaryOp::kLogicalAnd, - create(ast::BinaryOp::kLogicalOr, std::move(b), - std::move(c)), - std::move(d))); + create(ast::BinaryOp::kLogicalOr, b, c), d)); ASSERT_TRUE(gen.EmitStatement(out, &expr)) << gen.error(); EXPECT_EQ(result(), R"(bool _tint_tmp = b; @@ -275,11 +267,9 @@ TEST_F(HlslGeneratorImplTest_Binary, Decl_WithLogical) { create("a", ast::StorageClass::kFunction, &bool_type); var->set_constructor(create( ast::BinaryOp::kLogicalOr, - create(ast::BinaryOp::kLogicalAnd, std::move(b), - std::move(c)), - std::move(d))); + create(ast::BinaryOp::kLogicalAnd, b, c), d)); - ast::VariableDeclStatement expr(std::move(var)); + ast::VariableDeclStatement expr(var); ASSERT_TRUE(gen.EmitStatement(out, &expr)) << gen.error(); EXPECT_EQ(result(), R"(bool _tint_tmp = b; @@ -302,11 +292,10 @@ TEST_F(HlslGeneratorImplTest_Binary, Bitcast_WithLogical) { auto* b = create("b"); auto* c = create("c"); - ast::BitcastExpression expr( - &i32, create( - ast::BinaryOp::kLogicalAnd, std::move(a), - create(ast::BinaryOp::kLogicalOr, - std::move(b), std::move(c)))); + ast::BitcastExpression expr(&i32, create( + ast::BinaryOp::kLogicalAnd, a, + create( + ast::BinaryOp::kLogicalOr, b, c))); ASSERT_TRUE(gen.EmitExpression(pre, out, &expr)) << gen.error(); EXPECT_EQ(pre_result(), R"(bool _tint_tmp = a; @@ -328,7 +317,7 @@ TEST_F(HlslGeneratorImplTest_Binary, Call_WithLogical) { auto* func = create("foo", ast::VariableList{}, &void_type, create()); - mod.AddFunction(std::move(func)); + mod.AddFunction(func); ast::ExpressionList params; params.push_back(create( @@ -347,7 +336,7 @@ TEST_F(HlslGeneratorImplTest_Binary, Call_WithLogical) { create("d")))); ast::CallStatement expr(create( - create("foo"), std::move(params))); + create("foo"), params)); ASSERT_TRUE(gen.EmitStatement(out, &expr)) << gen.error(); EXPECT_EQ(result(), R"(bool _tint_tmp = a; diff --git a/src/writer/hlsl/generator_impl_bitcast_test.cc b/src/writer/hlsl/generator_impl_bitcast_test.cc index d9b431c872..1fa7d2e698 100644 --- a/src/writer/hlsl/generator_impl_bitcast_test.cc +++ b/src/writer/hlsl/generator_impl_bitcast_test.cc @@ -32,7 +32,7 @@ using HlslGeneratorImplTest_Bitcast = TestHelper; TEST_F(HlslGeneratorImplTest_Bitcast, EmitExpression_Bitcast_Float) { ast::type::F32Type f32; auto* id = create("id"); - ast::BitcastExpression bitcast(&f32, std::move(id)); + ast::BitcastExpression bitcast(&f32, id); ASSERT_TRUE(gen.EmitExpression(pre, out, &bitcast)) << gen.error(); EXPECT_EQ(result(), "asfloat(id)"); @@ -41,7 +41,7 @@ TEST_F(HlslGeneratorImplTest_Bitcast, EmitExpression_Bitcast_Float) { TEST_F(HlslGeneratorImplTest_Bitcast, EmitExpression_Bitcast_Int) { ast::type::I32Type i32; auto* id = create("id"); - ast::BitcastExpression bitcast(&i32, std::move(id)); + ast::BitcastExpression bitcast(&i32, id); ASSERT_TRUE(gen.EmitExpression(pre, out, &bitcast)) << gen.error(); EXPECT_EQ(result(), "asint(id)"); @@ -50,7 +50,7 @@ TEST_F(HlslGeneratorImplTest_Bitcast, EmitExpression_Bitcast_Int) { TEST_F(HlslGeneratorImplTest_Bitcast, EmitExpression_Bitcast_Uint) { ast::type::U32Type u32; auto* id = create("id"); - ast::BitcastExpression bitcast(&u32, std::move(id)); + ast::BitcastExpression bitcast(&u32, id); ASSERT_TRUE(gen.EmitExpression(pre, out, &bitcast)) << gen.error(); EXPECT_EQ(result(), "asuint(id)"); diff --git a/src/writer/hlsl/generator_impl_call_test.cc b/src/writer/hlsl/generator_impl_call_test.cc index 8f816a7929..39f20ed8b8 100644 --- a/src/writer/hlsl/generator_impl_call_test.cc +++ b/src/writer/hlsl/generator_impl_call_test.cc @@ -33,11 +33,11 @@ TEST_F(HlslGeneratorImplTest_Call, EmitExpression_Call_WithoutParams) { ast::type::VoidType void_type; auto* id = create("my_func"); - ast::CallExpression call(std::move(id), {}); + ast::CallExpression call(id, {}); auto* func = create("my_func", ast::VariableList{}, &void_type, create()); - mod.AddFunction(std::move(func)); + mod.AddFunction(func); ASSERT_TRUE(gen.EmitExpression(pre, out, &call)) << gen.error(); EXPECT_EQ(result(), "my_func()"); @@ -50,11 +50,11 @@ TEST_F(HlslGeneratorImplTest_Call, EmitExpression_Call_WithParams) { ast::ExpressionList params; params.push_back(create("param1")); params.push_back(create("param2")); - ast::CallExpression call(std::move(id), std::move(params)); + ast::CallExpression call(id, params); auto* func = create("my_func", ast::VariableList{}, &void_type, create()); - mod.AddFunction(std::move(func)); + mod.AddFunction(func); ASSERT_TRUE(gen.EmitExpression(pre, out, &call)) << gen.error(); EXPECT_EQ(result(), "my_func(param1, param2)"); @@ -67,12 +67,11 @@ TEST_F(HlslGeneratorImplTest_Call, EmitStatement_Call) { ast::ExpressionList params; params.push_back(create("param1")); params.push_back(create("param2")); - ast::CallStatement call( - create(std::move(id), std::move(params))); + ast::CallStatement call(create(id, params)); auto* func = create("my_func", ast::VariableList{}, &void_type, create()); - mod.AddFunction(std::move(func)); + mod.AddFunction(func); gen.increment_indent(); ASSERT_TRUE(gen.EmitStatement(out, &call)) << gen.error(); EXPECT_EQ(result(), " my_func(param1, param2);\n"); diff --git a/src/writer/hlsl/generator_impl_case_test.cc b/src/writer/hlsl/generator_impl_case_test.cc index a63a570db9..efff3e9031 100644 --- a/src/writer/hlsl/generator_impl_case_test.cc +++ b/src/writer/hlsl/generator_impl_case_test.cc @@ -38,7 +38,7 @@ TEST_F(HlslGeneratorImplTest_Case, Emit_Case) { ast::CaseSelectorList lit; lit.push_back(create(&i32, 5)); - ast::CaseStatement c(std::move(lit), std::move(body)); + ast::CaseStatement c(lit, body); gen.increment_indent(); @@ -54,7 +54,7 @@ TEST_F(HlslGeneratorImplTest_Case, Emit_Case_BreaksByDefault) { ast::CaseSelectorList lit; lit.push_back(create(&i32, 5)); - ast::CaseStatement c(std::move(lit), create()); + ast::CaseStatement c(lit, create()); gen.increment_indent(); @@ -73,7 +73,7 @@ TEST_F(HlslGeneratorImplTest_Case, Emit_Case_WithFallthrough) { ast::CaseSelectorList lit; lit.push_back(create(&i32, 5)); - ast::CaseStatement c(std::move(lit), std::move(body)); + ast::CaseStatement c(lit, body); gen.increment_indent(); @@ -93,7 +93,7 @@ TEST_F(HlslGeneratorImplTest_Case, Emit_Case_MultipleSelectors) { ast::CaseSelectorList lit; lit.push_back(create(&i32, 5)); lit.push_back(create(&i32, 6)); - ast::CaseStatement c(std::move(lit), std::move(body)); + ast::CaseStatement c(lit, body); gen.increment_indent(); @@ -108,7 +108,7 @@ TEST_F(HlslGeneratorImplTest_Case, Emit_Case_MultipleSelectors) { TEST_F(HlslGeneratorImplTest_Case, Emit_Case_Default) { auto* body = create(); body->append(create()); - ast::CaseStatement c(std::move(body)); + ast::CaseStatement c(body); gen.increment_indent(); diff --git a/src/writer/hlsl/generator_impl_cast_test.cc b/src/writer/hlsl/generator_impl_cast_test.cc index 6052494df2..f2fbcde3e4 100644 --- a/src/writer/hlsl/generator_impl_cast_test.cc +++ b/src/writer/hlsl/generator_impl_cast_test.cc @@ -34,7 +34,7 @@ TEST_F(HlslGeneratorImplTest_Cast, EmitExpression_Cast_Scalar) { ast::ExpressionList params; params.push_back(create("id")); - ast::TypeConstructorExpression cast(&f32, std::move(params)); + ast::TypeConstructorExpression cast(&f32, params); ASSERT_TRUE(gen.EmitExpression(pre, out, &cast)) << gen.error(); EXPECT_EQ(result(), "float(id)"); @@ -47,7 +47,7 @@ TEST_F(HlslGeneratorImplTest_Cast, EmitExpression_Cast_Vector) { ast::ExpressionList params; params.push_back(create("id")); - ast::TypeConstructorExpression cast(&vec3, std::move(params)); + ast::TypeConstructorExpression cast(&vec3, params); ASSERT_TRUE(gen.EmitExpression(pre, out, &cast)) << gen.error(); EXPECT_EQ(result(), "vector(id)"); diff --git a/src/writer/hlsl/generator_impl_constructor_test.cc b/src/writer/hlsl/generator_impl_constructor_test.cc index 02f307bc3e..c0512e55ac 100644 --- a/src/writer/hlsl/generator_impl_constructor_test.cc +++ b/src/writer/hlsl/generator_impl_constructor_test.cc @@ -38,7 +38,7 @@ using HlslGeneratorImplTest_Constructor = TestHelper; TEST_F(HlslGeneratorImplTest_Constructor, EmitConstructor_Bool) { ast::type::BoolType bool_type; auto* lit = create(&bool_type, false); - ast::ScalarConstructorExpression expr(std::move(lit)); + ast::ScalarConstructorExpression expr(lit); ASSERT_TRUE(gen.EmitConstructor(pre, out, &expr)) << gen.error(); EXPECT_EQ(result(), "false"); @@ -47,7 +47,7 @@ TEST_F(HlslGeneratorImplTest_Constructor, EmitConstructor_Bool) { TEST_F(HlslGeneratorImplTest_Constructor, EmitConstructor_Int) { ast::type::I32Type i32; auto* lit = create(&i32, -12345); - ast::ScalarConstructorExpression expr(std::move(lit)); + ast::ScalarConstructorExpression expr(lit); ASSERT_TRUE(gen.EmitConstructor(pre, out, &expr)) << gen.error(); EXPECT_EQ(result(), "-12345"); @@ -56,7 +56,7 @@ TEST_F(HlslGeneratorImplTest_Constructor, EmitConstructor_Int) { TEST_F(HlslGeneratorImplTest_Constructor, EmitConstructor_UInt) { ast::type::U32Type u32; auto* lit = create(&u32, 56779); - ast::ScalarConstructorExpression expr(std::move(lit)); + ast::ScalarConstructorExpression expr(lit); ASSERT_TRUE(gen.EmitConstructor(pre, out, &expr)) << gen.error(); EXPECT_EQ(result(), "56779u"); @@ -67,7 +67,7 @@ TEST_F(HlslGeneratorImplTest_Constructor, EmitConstructor_Float) { // Use a number close to 1<<30 but whose decimal representation ends in 0. auto* lit = create(&f32, static_cast((1 << 30) - 4)); - ast::ScalarConstructorExpression expr(std::move(lit)); + ast::ScalarConstructorExpression expr(lit); ASSERT_TRUE(gen.EmitConstructor(pre, out, &expr)) << gen.error(); EXPECT_EQ(result(), "1.07374182e+09f"); @@ -78,9 +78,9 @@ TEST_F(HlslGeneratorImplTest_Constructor, EmitConstructor_Type_Float) { auto* lit = create(&f32, -1.2e-5); ast::ExpressionList values; - values.push_back(create(std::move(lit))); + values.push_back(create(lit)); - ast::TypeConstructorExpression expr(&f32, std::move(values)); + ast::TypeConstructorExpression expr(&f32, values); ASSERT_TRUE(gen.EmitConstructor(pre, out, &expr)) << gen.error(); EXPECT_EQ(result(), "float(-1.20000004e-05f)"); @@ -91,9 +91,9 @@ TEST_F(HlslGeneratorImplTest_Constructor, EmitConstructor_Type_Bool) { auto* lit = create(&b, true); ast::ExpressionList values; - values.push_back(create(std::move(lit))); + values.push_back(create(lit)); - ast::TypeConstructorExpression expr(&b, std::move(values)); + ast::TypeConstructorExpression expr(&b, values); ASSERT_TRUE(gen.EmitConstructor(pre, out, &expr)) << gen.error(); EXPECT_EQ(result(), "bool(true)"); @@ -104,9 +104,9 @@ TEST_F(HlslGeneratorImplTest_Constructor, EmitConstructor_Type_Int) { auto* lit = create(&i32, -12345); ast::ExpressionList values; - values.push_back(create(std::move(lit))); + values.push_back(create(lit)); - ast::TypeConstructorExpression expr(&i32, std::move(values)); + ast::TypeConstructorExpression expr(&i32, values); ASSERT_TRUE(gen.EmitConstructor(pre, out, &expr)) << gen.error(); EXPECT_EQ(result(), "int(-12345)"); @@ -117,9 +117,9 @@ TEST_F(HlslGeneratorImplTest_Constructor, EmitConstructor_Type_Uint) { auto* lit = create(&u32, 12345); ast::ExpressionList values; - values.push_back(create(std::move(lit))); + values.push_back(create(lit)); - ast::TypeConstructorExpression expr(&u32, std::move(values)); + ast::TypeConstructorExpression expr(&u32, values); ASSERT_TRUE(gen.EmitConstructor(pre, out, &expr)) << gen.error(); EXPECT_EQ(result(), "uint(12345u)"); @@ -133,11 +133,11 @@ TEST_F(HlslGeneratorImplTest_Constructor, EmitConstructor_Type_Vec) { auto* lit2 = create(&f32, 2.f); auto* lit3 = create(&f32, 3.f); ast::ExpressionList values; - values.push_back(create(std::move(lit1))); - values.push_back(create(std::move(lit2))); - values.push_back(create(std::move(lit3))); + values.push_back(create(lit1)); + values.push_back(create(lit2)); + values.push_back(create(lit3)); - ast::TypeConstructorExpression expr(&vec, std::move(values)); + ast::TypeConstructorExpression expr(&vec, values); ASSERT_TRUE(gen.EmitConstructor(pre, out, &expr)) << gen.error(); EXPECT_EQ(result(), @@ -149,7 +149,7 @@ TEST_F(HlslGeneratorImplTest_Constructor, EmitConstructor_Type_Vec_Empty) { ast::type::VectorType vec(&f32, 3); ast::ExpressionList values; - ast::TypeConstructorExpression expr(&vec, std::move(values)); + ast::TypeConstructorExpression expr(&vec, values); ASSERT_TRUE(gen.EmitConstructor(pre, out, &expr)) << gen.error(); EXPECT_EQ(result(), "vector(0.0f)"); @@ -174,15 +174,14 @@ TEST_F(HlslGeneratorImplTest_Constructor, EmitConstructor_Type_Mat) { create(&f32, static_cast(3 + (i * 2))); ast::ExpressionList values; - values.push_back(create(std::move(lit1))); - values.push_back(create(std::move(lit2))); - values.push_back(create(std::move(lit3))); + values.push_back(create(lit1)); + values.push_back(create(lit2)); + values.push_back(create(lit3)); - mat_values.push_back( - create(&vec, std::move(values))); + mat_values.push_back(create(&vec, values)); } - ast::TypeConstructorExpression expr(&mat, std::move(mat_values)); + ast::TypeConstructorExpression expr(&mat, mat_values); ASSERT_TRUE(gen.EmitConstructor(pre, out, &expr)) << gen.error(); @@ -210,15 +209,14 @@ TEST_F(HlslGeneratorImplTest_Constructor, EmitConstructor_Type_Array) { create(&f32, static_cast(3 + (i * 3))); ast::ExpressionList values; - values.push_back(create(std::move(lit1))); - values.push_back(create(std::move(lit2))); - values.push_back(create(std::move(lit3))); + values.push_back(create(lit1)); + values.push_back(create(lit2)); + values.push_back(create(lit3)); - ary_values.push_back( - create(&vec, std::move(values))); + ary_values.push_back(create(&vec, values)); } - ast::TypeConstructorExpression expr(&ary, std::move(ary_values)); + ast::TypeConstructorExpression expr(&ary, ary_values); ASSERT_TRUE(gen.EmitConstructor(pre, out, &expr)) << gen.error(); EXPECT_EQ(result(), diff --git a/src/writer/hlsl/generator_impl_function_entry_point_data_test.cc b/src/writer/hlsl/generator_impl_function_entry_point_data_test.cc index 8c0419a2d5..9215ccac96 100644 --- a/src/writer/hlsl/generator_impl_function_entry_point_data_test.cc +++ b/src/writer/hlsl/generator_impl_function_entry_point_data_test.cc @@ -55,21 +55,17 @@ TEST_F(HlslGeneratorImplTest_EntryPoint, auto* foo_var = create( create("foo", ast::StorageClass::kInput, &f32)); - - ast::VariableDecorationList decos; - decos.push_back(create(0, Source{})); - foo_var->set_decorations(std::move(decos)); + foo_var->set_decorations({create(0, Source{})}); auto* bar_var = create( create("bar", ast::StorageClass::kInput, &i32)); - decos.push_back(create(1, Source{})); - bar_var->set_decorations(std::move(decos)); + bar_var->set_decorations({create(1, Source{})}); td.RegisterVariableForTesting(foo_var); td.RegisterVariableForTesting(bar_var); - mod.AddGlobalVariable(std::move(foo_var)); - mod.AddGlobalVariable(std::move(bar_var)); + mod.AddGlobalVariable(foo_var); + mod.AddGlobalVariable(bar_var); ast::VariableList params; auto* body = create(); @@ -80,18 +76,16 @@ TEST_F(HlslGeneratorImplTest_EntryPoint, create("bar"), create("bar"))); - auto* func = create("vtx_main", std::move(params), &f32, - std::move(body)); + auto* func = create("vtx_main", params, &f32, body); func->add_decoration( create(ast::PipelineStage::kVertex, Source{})); - auto* func_ptr = func; - mod.AddFunction(std::move(func)); + mod.AddFunction(func); std::unordered_set globals; ASSERT_TRUE(td.Determine()) << td.error(); - ASSERT_TRUE(gen.EmitEntryPointData(out, func_ptr, globals)) << gen.error(); + ASSERT_TRUE(gen.EmitEntryPointData(out, func, globals)) << gen.error(); EXPECT_EQ(result(), R"(struct vtx_main_in { float foo : TEXCOORD0; int bar : TEXCOORD1; @@ -115,21 +109,17 @@ TEST_F(HlslGeneratorImplTest_EntryPoint, auto* foo_var = create( create("foo", ast::StorageClass::kOutput, &f32)); - - ast::VariableDecorationList decos; - decos.push_back(create(0, Source{})); - foo_var->set_decorations(std::move(decos)); + foo_var->set_decorations({create(0, Source{})}); auto* bar_var = create( create("bar", ast::StorageClass::kOutput, &i32)); - decos.push_back(create(1, Source{})); - bar_var->set_decorations(std::move(decos)); + bar_var->set_decorations({create(1, Source{})}); td.RegisterVariableForTesting(foo_var); td.RegisterVariableForTesting(bar_var); - mod.AddGlobalVariable(std::move(foo_var)); - mod.AddGlobalVariable(std::move(bar_var)); + mod.AddGlobalVariable(foo_var); + mod.AddGlobalVariable(bar_var); ast::VariableList params; @@ -141,18 +131,16 @@ TEST_F(HlslGeneratorImplTest_EntryPoint, create("bar"), create("bar"))); - auto* func = create("vtx_main", std::move(params), &f32, - std::move(body)); + auto* func = create("vtx_main", params, &f32, body); func->add_decoration( create(ast::PipelineStage::kVertex, Source{})); - auto* func_ptr = func; - mod.AddFunction(std::move(func)); + mod.AddFunction(func); std::unordered_set globals; ASSERT_TRUE(td.Determine()) << td.error(); - ASSERT_TRUE(gen.EmitEntryPointData(out, func_ptr, globals)) << gen.error(); + ASSERT_TRUE(gen.EmitEntryPointData(out, func, globals)) << gen.error(); EXPECT_EQ(result(), R"(struct vtx_main_out { float foo : TEXCOORD0; int bar : TEXCOORD1; @@ -176,21 +164,17 @@ TEST_F(HlslGeneratorImplTest_EntryPoint, auto* foo_var = create( create("foo", ast::StorageClass::kInput, &f32)); - - ast::VariableDecorationList decos; - decos.push_back(create(0, Source{})); - foo_var->set_decorations(std::move(decos)); + foo_var->set_decorations({create(0, Source{})}); auto* bar_var = create( create("bar", ast::StorageClass::kInput, &i32)); - decos.push_back(create(1, Source{})); - bar_var->set_decorations(std::move(decos)); + bar_var->set_decorations({create(1, Source{})}); td.RegisterVariableForTesting(foo_var); td.RegisterVariableForTesting(bar_var); - mod.AddGlobalVariable(std::move(foo_var)); - mod.AddGlobalVariable(std::move(bar_var)); + mod.AddGlobalVariable(foo_var); + mod.AddGlobalVariable(bar_var); ast::VariableList params; @@ -202,18 +186,16 @@ TEST_F(HlslGeneratorImplTest_EntryPoint, create("bar"), create("bar"))); - auto* func = - create("main", std::move(params), &f32, std::move(body)); + auto* func = create("main", params, &f32, body); func->add_decoration( create(ast::PipelineStage::kVertex, Source{})); - auto* func_ptr = func; - mod.AddFunction(std::move(func)); + mod.AddFunction(func); std::unordered_set globals; ASSERT_TRUE(td.Determine()) << td.error(); - ASSERT_TRUE(gen.EmitEntryPointData(out, func_ptr, globals)) << gen.error(); + ASSERT_TRUE(gen.EmitEntryPointData(out, func, globals)) << gen.error(); EXPECT_EQ(result(), R"(struct main_in { float foo : TEXCOORD0; int bar : TEXCOORD1; @@ -237,21 +219,17 @@ TEST_F(HlslGeneratorImplTest_EntryPoint, auto* foo_var = create( create("foo", ast::StorageClass::kOutput, &f32)); - - ast::VariableDecorationList decos; - decos.push_back(create(0, Source{})); - foo_var->set_decorations(std::move(decos)); + foo_var->set_decorations({create(0, Source{})}); auto* bar_var = create( create("bar", ast::StorageClass::kOutput, &i32)); - decos.push_back(create(1, Source{})); - bar_var->set_decorations(std::move(decos)); + bar_var->set_decorations({create(1, Source{})}); td.RegisterVariableForTesting(foo_var); td.RegisterVariableForTesting(bar_var); - mod.AddGlobalVariable(std::move(foo_var)); - mod.AddGlobalVariable(std::move(bar_var)); + mod.AddGlobalVariable(foo_var); + mod.AddGlobalVariable(bar_var); ast::VariableList params; auto* body = create(); @@ -262,18 +240,16 @@ TEST_F(HlslGeneratorImplTest_EntryPoint, create("bar"), create("bar"))); - auto* func = - create("main", std::move(params), &f32, std::move(body)); + auto* func = create("main", params, &f32, body); func->add_decoration( create(ast::PipelineStage::kFragment, Source{})); - auto* func_ptr = func; - mod.AddFunction(std::move(func)); + mod.AddFunction(func); std::unordered_set globals; ASSERT_TRUE(td.Determine()) << td.error(); - ASSERT_TRUE(gen.EmitEntryPointData(out, func_ptr, globals)) << gen.error(); + ASSERT_TRUE(gen.EmitEntryPointData(out, func, globals)) << gen.error(); EXPECT_EQ(result(), R"(struct main_out { float foo : SV_Target0; int bar : SV_Target1; @@ -297,18 +273,18 @@ TEST_F(HlslGeneratorImplTest_EntryPoint, ast::VariableDecorationList decos; decos.push_back(create(0, Source{})); - foo_var->set_decorations(std::move(decos)); + foo_var->set_decorations(decos); auto* bar_var = create( create("bar", ast::StorageClass::kInput, &i32)); decos.push_back(create(1, Source{})); - bar_var->set_decorations(std::move(decos)); + bar_var->set_decorations(decos); td.RegisterVariableForTesting(foo_var); td.RegisterVariableForTesting(bar_var); - mod.AddGlobalVariable(std::move(foo_var)); - mod.AddGlobalVariable(std::move(bar_var)); + mod.AddGlobalVariable(foo_var); + mod.AddGlobalVariable(bar_var); ast::VariableList params; auto* body = create(); @@ -319,18 +295,16 @@ TEST_F(HlslGeneratorImplTest_EntryPoint, create("bar"), create("bar"))); - auto* func = - create("main", std::move(params), &f32, std::move(body)); + auto* func = create("main", params, &f32, body); func->add_decoration( create(ast::PipelineStage::kCompute, Source{})); - auto* func_ptr = func; - mod.AddFunction(std::move(func)); + mod.AddFunction(func); std::unordered_set globals; ASSERT_TRUE(td.Determine()) << td.error(); - ASSERT_FALSE(gen.EmitEntryPointData(out, func_ptr, globals)) << gen.error(); + ASSERT_FALSE(gen.EmitEntryPointData(out, func, globals)) << gen.error(); EXPECT_EQ(gen.error(), R"(invalid location variable for pipeline stage)"); } @@ -349,18 +323,18 @@ TEST_F(HlslGeneratorImplTest_EntryPoint, ast::VariableDecorationList decos; decos.push_back(create(0, Source{})); - foo_var->set_decorations(std::move(decos)); + foo_var->set_decorations(decos); auto* bar_var = create( create("bar", ast::StorageClass::kOutput, &i32)); decos.push_back(create(1, Source{})); - bar_var->set_decorations(std::move(decos)); + bar_var->set_decorations(decos); td.RegisterVariableForTesting(foo_var); td.RegisterVariableForTesting(bar_var); - mod.AddGlobalVariable(std::move(foo_var)); - mod.AddGlobalVariable(std::move(bar_var)); + mod.AddGlobalVariable(foo_var); + mod.AddGlobalVariable(bar_var); ast::VariableList params; auto* body = create(); @@ -371,18 +345,16 @@ TEST_F(HlslGeneratorImplTest_EntryPoint, create("bar"), create("bar"))); - auto* func = - create("main", std::move(params), &f32, std::move(body)); + auto* func = create("main", params, &f32, body); func->add_decoration( create(ast::PipelineStage::kCompute, Source{})); - auto* func_ptr = func; - mod.AddFunction(std::move(func)); + mod.AddFunction(func); std::unordered_set globals; ASSERT_TRUE(td.Determine()) << td.error(); - ASSERT_FALSE(gen.EmitEntryPointData(out, func_ptr, globals)) << gen.error(); + ASSERT_FALSE(gen.EmitEntryPointData(out, func, globals)) << gen.error(); EXPECT_EQ(gen.error(), R"(invalid location variable for pipeline stage)"); } @@ -405,23 +377,19 @@ TEST_F(HlslGeneratorImplTest_EntryPoint, auto* coord_var = create( create("coord", ast::StorageClass::kInput, &vec4)); - - ast::VariableDecorationList decos; - decos.push_back( - create(ast::Builtin::kFragCoord, Source{})); - coord_var->set_decorations(std::move(decos)); + coord_var->set_decorations( + {create(ast::Builtin::kFragCoord, Source{})}); auto* depth_var = create( create("depth", ast::StorageClass::kOutput, &f32)); - decos.push_back( - create(ast::Builtin::kFragDepth, Source{})); - depth_var->set_decorations(std::move(decos)); + depth_var->set_decorations( + {create(ast::Builtin::kFragDepth, Source{})}); td.RegisterVariableForTesting(coord_var); td.RegisterVariableForTesting(depth_var); - mod.AddGlobalVariable(std::move(coord_var)); - mod.AddGlobalVariable(std::move(depth_var)); + mod.AddGlobalVariable(coord_var); + mod.AddGlobalVariable(depth_var); ast::VariableList params; auto* body = create(); @@ -431,18 +399,16 @@ TEST_F(HlslGeneratorImplTest_EntryPoint, create("coord"), create("x")))); - auto* func = create("main", std::move(params), &void_type, - std::move(body)); + auto* func = create("main", params, &void_type, body); func->add_decoration( create(ast::PipelineStage::kFragment, Source{})); - auto* func_ptr = func; - mod.AddFunction(std::move(func)); + mod.AddFunction(func); std::unordered_set globals; ASSERT_TRUE(td.Determine()) << td.error(); - ASSERT_TRUE(gen.EmitEntryPointData(out, func_ptr, globals)) << gen.error(); + ASSERT_TRUE(gen.EmitEntryPointData(out, func, globals)) << gen.error(); EXPECT_EQ(result(), R"(struct main_in { vector coord : SV_Position; }; diff --git a/src/writer/hlsl/generator_impl_function_test.cc b/src/writer/hlsl/generator_impl_function_test.cc index d987ff3ae2..9d84e94253 100644 --- a/src/writer/hlsl/generator_impl_function_test.cc +++ b/src/writer/hlsl/generator_impl_function_test.cc @@ -59,10 +59,10 @@ TEST_F(HlslGeneratorImplTest_Function, Emit_Function) { auto* body = create(); body->append(create()); - auto* func = create("my_func", ast::VariableList{}, &void_type, - std::move(body)); + auto* func = + create("my_func", ast::VariableList{}, &void_type, body); - mod.AddFunction(std::move(func)); + mod.AddFunction(func); gen.increment_indent(); ASSERT_TRUE(gen.Generate(out)) << gen.error(); @@ -79,9 +79,9 @@ TEST_F(HlslGeneratorImplTest_Function, Emit_Function_Name_Collision) { auto* body = create(); body->append(create()); auto* func = create("GeometryShader", ast::VariableList{}, - &void_type, std::move(body)); + &void_type, body); - mod.AddFunction(std::move(func)); + mod.AddFunction(func); gen.increment_indent(); ASSERT_TRUE(gen.Generate(out)) << gen.error(); @@ -104,10 +104,9 @@ TEST_F(HlslGeneratorImplTest_Function, Emit_Function_WithParams) { auto* body = create(); body->append(create()); - auto* func = create("my_func", std::move(params), &void_type, - std::move(body)); + auto* func = create("my_func", params, &void_type, body); - mod.AddFunction(std::move(func)); + mod.AddFunction(func); gen.increment_indent(); ASSERT_TRUE(gen.Generate(out)) << gen.error(); @@ -125,21 +124,17 @@ TEST_F(HlslGeneratorImplTest_Function, auto* foo_var = create( create("foo", ast::StorageClass::kInput, &f32)); - - ast::VariableDecorationList decos; - decos.push_back(create(0, Source{})); - foo_var->set_decorations(std::move(decos)); + foo_var->set_decorations({create(0, Source{})}); auto* bar_var = create( create("bar", ast::StorageClass::kOutput, &f32)); - decos.push_back(create(1, Source{})); - bar_var->set_decorations(std::move(decos)); + bar_var->set_decorations({create(1, Source{})}); td.RegisterVariableForTesting(foo_var); td.RegisterVariableForTesting(bar_var); - mod.AddGlobalVariable(std::move(foo_var)); - mod.AddGlobalVariable(std::move(bar_var)); + mod.AddGlobalVariable(foo_var); + mod.AddGlobalVariable(bar_var); ast::VariableList params; auto* body = create(); @@ -147,12 +142,11 @@ TEST_F(HlslGeneratorImplTest_Function, create("bar"), create("foo"))); body->append(create()); - auto* func = create("frag_main", std::move(params), &void_type, - std::move(body)); + auto* func = create("frag_main", params, &void_type, body); func->add_decoration( create(ast::PipelineStage::kFragment, Source{})); - mod.AddFunction(std::move(func)); + mod.AddFunction(func); ASSERT_TRUE(td.Determine()) << td.error(); ASSERT_TRUE(gen.Generate(out)) << gen.error(); @@ -182,22 +176,19 @@ TEST_F(HlslGeneratorImplTest_Function, auto* coord_var = create( create("coord", ast::StorageClass::kInput, &vec4)); - ast::VariableDecorationList decos; - decos.push_back( - create(ast::Builtin::kFragCoord, Source{})); - coord_var->set_decorations(std::move(decos)); + coord_var->set_decorations( + {create(ast::Builtin::kFragCoord, Source{})}); auto* depth_var = create( create("depth", ast::StorageClass::kOutput, &f32)); - decos.push_back( - create(ast::Builtin::kFragDepth, Source{})); - depth_var->set_decorations(std::move(decos)); + depth_var->set_decorations( + {create(ast::Builtin::kFragDepth, Source{})}); td.RegisterVariableForTesting(coord_var); td.RegisterVariableForTesting(depth_var); - mod.AddGlobalVariable(std::move(coord_var)); - mod.AddGlobalVariable(std::move(depth_var)); + mod.AddGlobalVariable(coord_var); + mod.AddGlobalVariable(depth_var); ast::VariableList params; auto* body = create(); @@ -207,12 +198,11 @@ TEST_F(HlslGeneratorImplTest_Function, create("coord"), create("x")))); body->append(create()); - auto* func = create("frag_main", std::move(params), &void_type, - std::move(body)); + auto* func = create("frag_main", params, &void_type, body); func->add_decoration( create(ast::PipelineStage::kFragment, Source{})); - mod.AddFunction(std::move(func)); + mod.AddFunction(func); ASSERT_TRUE(td.Determine()) << td.error(); ASSERT_TRUE(gen.Generate(out)) << gen.error(); @@ -245,10 +235,10 @@ TEST_F(HlslGeneratorImplTest_Function, ast::VariableDecorationList decos; decos.push_back(create(0, Source{})); decos.push_back(create(1, Source{})); - coord_var->set_decorations(std::move(decos)); + coord_var->set_decorations(decos); td.RegisterVariableForTesting(coord_var); - mod.AddGlobalVariable(std::move(coord_var)); + mod.AddGlobalVariable(coord_var); ast::VariableList params; auto* var = create("v", ast::StorageClass::kFunction, &f32); @@ -257,14 +247,13 @@ TEST_F(HlslGeneratorImplTest_Function, create("x"))); auto* body = create(); - body->append(create(std::move(var))); + body->append(create(var)); body->append(create()); - auto* func = create("frag_main", std::move(params), &void_type, - std::move(body)); + auto* func = create("frag_main", params, &void_type, body); func->add_decoration( create(ast::PipelineStage::kFragment, Source{})); - mod.AddFunction(std::move(func)); + mod.AddFunction(func); ASSERT_TRUE(td.Determine()) << td.error(); ASSERT_TRUE(gen.Generate(out)) << gen.error(); @@ -291,9 +280,9 @@ TEST_F(HlslGeneratorImplTest_Function, "coord", &vec4, ast::StructMemberDecorationList{})); auto* str = create(); - str->set_members(std::move(members)); + str->set_members(members); - ast::type::StructType s("Uniforms", std::move(str)); + ast::type::StructType s("Uniforms", str); auto* coord_var = create( create("uniforms", ast::StorageClass::kUniform, &s)); @@ -303,10 +292,10 @@ TEST_F(HlslGeneratorImplTest_Function, ast::VariableDecorationList decos; decos.push_back(create(0, Source{})); decos.push_back(create(1, Source{})); - coord_var->set_decorations(std::move(decos)); + coord_var->set_decorations(decos); td.RegisterVariableForTesting(coord_var); - mod.AddGlobalVariable(std::move(coord_var)); + mod.AddGlobalVariable(coord_var); ast::VariableList params; auto* var = create("v", ast::StorageClass::kFunction, &f32); @@ -317,14 +306,13 @@ TEST_F(HlslGeneratorImplTest_Function, create("x"))); auto* body = create(); - body->append(create(std::move(var))); + body->append(create(var)); body->append(create()); - auto* func = create("frag_main", std::move(params), &void_type, - std::move(body)); + auto* func = create("frag_main", params, &void_type, body); func->add_decoration( create(ast::PipelineStage::kFragment, Source{})); - mod.AddFunction(std::move(func)); + mod.AddFunction(func); ASSERT_TRUE(td.Determine()) << td.error(); ASSERT_TRUE(gen.Generate(out)) << gen.error(); @@ -351,16 +339,16 @@ TEST_F(HlslGeneratorImplTest_Function, ast::StructMemberList members; ast::StructMemberDecorationList a_deco; a_deco.push_back(create(0, Source{})); - members.push_back(create("a", &i32, std::move(a_deco))); + members.push_back(create("a", &i32, a_deco)); ast::StructMemberDecorationList b_deco; b_deco.push_back(create(4, Source{})); - members.push_back(create("b", &f32, std::move(b_deco))); + members.push_back(create("b", &f32, b_deco)); auto* str = create(); - str->set_members(std::move(members)); + str->set_members(members); - ast::type::StructType s("Data", std::move(str)); + ast::type::StructType s("Data", str); ast::type::AccessControlType ac(ast::AccessControl::kReadWrite, &s); auto* coord_var = create( @@ -369,10 +357,10 @@ TEST_F(HlslGeneratorImplTest_Function, ast::VariableDecorationList decos; decos.push_back(create(0, Source{})); decos.push_back(create(1, Source{})); - coord_var->set_decorations(std::move(decos)); + coord_var->set_decorations(decos); td.RegisterVariableForTesting(coord_var); - mod.AddGlobalVariable(std::move(coord_var)); + mod.AddGlobalVariable(coord_var); ast::VariableList params; auto* var = create("v", ast::StorageClass::kFunction, &f32); @@ -381,14 +369,13 @@ TEST_F(HlslGeneratorImplTest_Function, create("b"))); auto* body = create(); - body->append(create(std::move(var))); + body->append(create(var)); body->append(create()); - auto* func = create("frag_main", std::move(params), &void_type, - std::move(body)); + auto* func = create("frag_main", params, &void_type, body); func->add_decoration( create(ast::PipelineStage::kFragment, Source{})); - mod.AddFunction(std::move(func)); + mod.AddFunction(func); ASSERT_TRUE(td.Determine()) << td.error(); ASSERT_TRUE(gen.Generate(out)) << gen.error(); @@ -411,16 +398,16 @@ TEST_F(HlslGeneratorImplTest_Function, ast::StructMemberList members; ast::StructMemberDecorationList a_deco; a_deco.push_back(create(0, Source{})); - members.push_back(create("a", &i32, std::move(a_deco))); + members.push_back(create("a", &i32, a_deco)); ast::StructMemberDecorationList b_deco; b_deco.push_back(create(4, Source{})); - members.push_back(create("b", &f32, std::move(b_deco))); + members.push_back(create("b", &f32, b_deco)); auto* str = create(); - str->set_members(std::move(members)); + str->set_members(members); - ast::type::StructType s("Data", std::move(str)); + ast::type::StructType s("Data", str); ast::type::AccessControlType ac(ast::AccessControl::kReadOnly, &s); auto* coord_var = create( @@ -429,10 +416,10 @@ TEST_F(HlslGeneratorImplTest_Function, ast::VariableDecorationList decos; decos.push_back(create(0, Source{})); decos.push_back(create(1, Source{})); - coord_var->set_decorations(std::move(decos)); + coord_var->set_decorations(decos); td.RegisterVariableForTesting(coord_var); - mod.AddGlobalVariable(std::move(coord_var)); + mod.AddGlobalVariable(coord_var); ast::VariableList params; auto* var = create("v", ast::StorageClass::kFunction, &f32); @@ -441,14 +428,13 @@ TEST_F(HlslGeneratorImplTest_Function, create("b"))); auto* body = create(); - body->append(create(std::move(var))); + body->append(create(var)); body->append(create()); - auto* func = create("frag_main", std::move(params), &void_type, - std::move(body)); + auto* func = create("frag_main", params, &void_type, body); func->add_decoration( create(ast::PipelineStage::kFragment, Source{})); - mod.AddFunction(std::move(func)); + mod.AddFunction(func); ASSERT_TRUE(td.Determine()) << td.error(); ASSERT_TRUE(gen.Generate(out)) << gen.error(); @@ -471,16 +457,16 @@ TEST_F(HlslGeneratorImplTest_Function, ast::StructMemberList members; ast::StructMemberDecorationList a_deco; a_deco.push_back(create(0, Source{})); - members.push_back(create("a", &i32, std::move(a_deco))); + members.push_back(create("a", &i32, a_deco)); ast::StructMemberDecorationList b_deco; b_deco.push_back(create(4, Source{})); - members.push_back(create("b", &f32, std::move(b_deco))); + members.push_back(create("b", &f32, b_deco)); auto* str = create(); - str->set_members(std::move(members)); + str->set_members(members); - ast::type::StructType s("Data", std::move(str)); + ast::type::StructType s("Data", str); ast::type::AccessControlType ac(ast::AccessControl::kReadWrite, &s); auto* coord_var = create( @@ -489,11 +475,11 @@ TEST_F(HlslGeneratorImplTest_Function, ast::VariableDecorationList decos; decos.push_back(create(0, Source{})); decos.push_back(create(1, Source{})); - coord_var->set_decorations(std::move(decos)); + coord_var->set_decorations(decos); td.RegisterVariableForTesting(coord_var); - mod.AddGlobalVariable(std::move(coord_var)); + mod.AddGlobalVariable(coord_var); ast::VariableList params; auto* assign = create( @@ -504,14 +490,13 @@ TEST_F(HlslGeneratorImplTest_Function, create(&f32, 2.0f))); auto* body = create(); - body->append(std::move(assign)); + body->append(assign); body->append(create()); - auto* func = create("frag_main", std::move(params), &void_type, - std::move(body)); + auto* func = create("frag_main", params, &void_type, body); func->add_decoration( create(ast::PipelineStage::kFragment, Source{})); - mod.AddFunction(std::move(func)); + mod.AddFunction(func); ASSERT_TRUE(td.Determine()) << td.error(); ASSERT_TRUE(gen.Generate(out)) << gen.error(); @@ -533,28 +518,23 @@ TEST_F( auto* foo_var = create( create("foo", ast::StorageClass::kInput, &f32)); - - ast::VariableDecorationList decos; - decos.push_back(create(0, Source{})); - foo_var->set_decorations(std::move(decos)); + foo_var->set_decorations({create(0, Source{})}); auto* bar_var = create( create("bar", ast::StorageClass::kOutput, &f32)); - decos.push_back(create(1, Source{})); - bar_var->set_decorations(std::move(decos)); + bar_var->set_decorations({create(1, Source{})}); auto* val_var = create( create("val", ast::StorageClass::kOutput, &f32)); - decos.push_back(create(0, Source{})); - val_var->set_decorations(std::move(decos)); + val_var->set_decorations({create(0, Source{})}); td.RegisterVariableForTesting(foo_var); td.RegisterVariableForTesting(bar_var); td.RegisterVariableForTesting(val_var); - mod.AddGlobalVariable(std::move(foo_var)); - mod.AddGlobalVariable(std::move(bar_var)); - mod.AddGlobalVariable(std::move(val_var)); + mod.AddGlobalVariable(foo_var); + mod.AddGlobalVariable(bar_var); + mod.AddGlobalVariable(val_var); ast::VariableList params; params.push_back( @@ -569,10 +549,9 @@ TEST_F( create("param"))); body->append( create(create("foo"))); - auto* sub_func = create("sub_func", std::move(params), &f32, - std::move(body)); + auto* sub_func = create("sub_func", params, &f32, body); - mod.AddFunction(std::move(sub_func)); + mod.AddFunction(sub_func); ast::ExpressionList expr; expr.push_back(create( @@ -582,14 +561,13 @@ TEST_F( body->append(create( create("bar"), create(create("sub_func"), - std::move(expr)))); + expr))); body->append(create()); - auto* func_1 = create("ep_1", std::move(params), &void_type, - std::move(body)); + auto* func_1 = create("ep_1", params, &void_type, body); func_1->add_decoration( create(ast::PipelineStage::kFragment, Source{})); - mod.AddFunction(std::move(func_1)); + mod.AddFunction(func_1); ASSERT_TRUE(td.Determine()) << td.error(); ASSERT_TRUE(gen.Generate(out)) << gen.error(); @@ -629,11 +607,11 @@ TEST_F(HlslGeneratorImplTest_Function, ast::VariableDecorationList decos; decos.push_back( create(ast::Builtin::kFragDepth, Source{})); - depth_var->set_decorations(std::move(decos)); + depth_var->set_decorations(decos); td.RegisterVariableForTesting(depth_var); - mod.AddGlobalVariable(std::move(depth_var)); + mod.AddGlobalVariable(depth_var); ast::VariableList params; params.push_back( @@ -642,10 +620,9 @@ TEST_F(HlslGeneratorImplTest_Function, auto* body = create(); body->append( create(create("param"))); - auto* sub_func = create("sub_func", std::move(params), &f32, - std::move(body)); + auto* sub_func = create("sub_func", params, &f32, body); - mod.AddFunction(std::move(sub_func)); + mod.AddFunction(sub_func); ast::ExpressionList expr; expr.push_back(create( @@ -655,14 +632,13 @@ TEST_F(HlslGeneratorImplTest_Function, body->append(create( create("depth"), create(create("sub_func"), - std::move(expr)))); + expr))); body->append(create()); - auto* func_1 = create("ep_1", std::move(params), &void_type, - std::move(body)); + auto* func_1 = create("ep_1", params, &void_type, body); func_1->add_decoration( create(ast::PipelineStage::kFragment, Source{})); - mod.AddFunction(std::move(func_1)); + mod.AddFunction(func_1); ASSERT_TRUE(td.Determine()) << td.error(); ASSERT_TRUE(gen.Generate(out)) << gen.error(); @@ -692,23 +668,19 @@ TEST_F( auto* coord_var = create( create("coord", ast::StorageClass::kInput, &vec4)); - - ast::VariableDecorationList decos; - decos.push_back( - create(ast::Builtin::kFragCoord, Source{})); - coord_var->set_decorations(std::move(decos)); + coord_var->set_decorations( + {create(ast::Builtin::kFragCoord, Source{})}); auto* depth_var = create( create("depth", ast::StorageClass::kOutput, &f32)); - decos.push_back( - create(ast::Builtin::kFragDepth, Source{})); - depth_var->set_decorations(std::move(decos)); + depth_var->set_decorations( + {create(ast::Builtin::kFragDepth, Source{})}); td.RegisterVariableForTesting(coord_var); td.RegisterVariableForTesting(depth_var); - mod.AddGlobalVariable(std::move(coord_var)); - mod.AddGlobalVariable(std::move(depth_var)); + mod.AddGlobalVariable(coord_var); + mod.AddGlobalVariable(depth_var); ast::VariableList params; params.push_back( @@ -722,10 +694,9 @@ TEST_F( create("x")))); body->append( create(create("param"))); - auto* sub_func = create("sub_func", std::move(params), &f32, - std::move(body)); + auto* sub_func = create("sub_func", params, &f32, body); - mod.AddFunction(std::move(sub_func)); + mod.AddFunction(sub_func); ast::ExpressionList expr; expr.push_back(create( @@ -735,14 +706,13 @@ TEST_F( body->append(create( create("depth"), create(create("sub_func"), - std::move(expr)))); + expr))); body->append(create()); - auto* func_1 = create("ep_1", std::move(params), &void_type, - std::move(body)); + auto* func_1 = create("ep_1", params, &void_type, body); func_1->add_decoration( create(ast::PipelineStage::kFragment, Source{})); - mod.AddFunction(std::move(func_1)); + mod.AddFunction(func_1); ASSERT_TRUE(td.Determine()) << td.error(); ASSERT_TRUE(gen.Generate(out)) << gen.error(); @@ -780,11 +750,11 @@ TEST_F(HlslGeneratorImplTest_Function, ast::VariableDecorationList decos; decos.push_back(create(0, Source{})); decos.push_back(create(1, Source{})); - coord_var->set_decorations(std::move(decos)); + coord_var->set_decorations(decos); td.RegisterVariableForTesting(coord_var); - mod.AddGlobalVariable(std::move(coord_var)); + mod.AddGlobalVariable(coord_var); ast::VariableList params; params.push_back( @@ -795,10 +765,9 @@ TEST_F(HlslGeneratorImplTest_Function, create(create( create("coord"), create("x")))); - auto* sub_func = create("sub_func", std::move(params), &f32, - std::move(body)); + auto* sub_func = create("sub_func", params, &f32, body); - mod.AddFunction(std::move(sub_func)); + mod.AddFunction(sub_func); ast::ExpressionList expr; expr.push_back(create( @@ -806,17 +775,16 @@ TEST_F(HlslGeneratorImplTest_Function, auto* var = create("v", ast::StorageClass::kFunction, &f32); var->set_constructor(create( - create("sub_func"), std::move(expr))); + create("sub_func"), expr)); body = create(); - body->append(create(std::move(var))); + body->append(create(var)); body->append(create()); - auto* func = create("frag_main", std::move(params), &void_type, - std::move(body)); + auto* func = create("frag_main", params, &void_type, body); func->add_decoration( create(ast::PipelineStage::kFragment, Source{})); - mod.AddFunction(std::move(func)); + mod.AddFunction(func); ASSERT_TRUE(td.Determine()) << td.error(); ASSERT_TRUE(gen.Generate(out)) << gen.error(); @@ -848,11 +816,11 @@ TEST_F(HlslGeneratorImplTest_Function, ast::VariableDecorationList decos; decos.push_back(create(0, Source{})); decos.push_back(create(1, Source{})); - coord_var->set_decorations(std::move(decos)); + coord_var->set_decorations(decos); td.RegisterVariableForTesting(coord_var); - mod.AddGlobalVariable(std::move(coord_var)); + mod.AddGlobalVariable(coord_var); ast::VariableList params; params.push_back( @@ -863,10 +831,9 @@ TEST_F(HlslGeneratorImplTest_Function, create(create( create("coord"), create("x")))); - auto* sub_func = create("sub_func", std::move(params), &f32, - std::move(body)); + auto* sub_func = create("sub_func", params, &f32, body); - mod.AddFunction(std::move(sub_func)); + mod.AddFunction(sub_func); ast::ExpressionList expr; expr.push_back(create( @@ -874,17 +841,16 @@ TEST_F(HlslGeneratorImplTest_Function, auto* var = create("v", ast::StorageClass::kFunction, &f32); var->set_constructor(create( - create("sub_func"), std::move(expr))); + create("sub_func"), expr)); body = create(); - body->append(create(std::move(var))); + body->append(create(var)); body->append(create()); - auto* func = create("frag_main", std::move(params), &void_type, - std::move(body)); + auto* func = create("frag_main", params, &void_type, body); func->add_decoration( create(ast::PipelineStage::kFragment, Source{})); - mod.AddFunction(std::move(func)); + mod.AddFunction(func); ASSERT_TRUE(td.Determine()) << td.error(); ASSERT_TRUE(gen.Generate(out)) << gen.error(); @@ -912,10 +878,10 @@ TEST_F(HlslGeneratorImplTest_Function, create("bar", ast::StorageClass::kOutput, &f32)); ast::VariableDecorationList decos; decos.push_back(create(1, Source{})); - bar_var->set_decorations(std::move(decos)); + bar_var->set_decorations(decos); td.RegisterVariableForTesting(bar_var); - mod.AddGlobalVariable(std::move(bar_var)); + mod.AddGlobalVariable(bar_var); ast::VariableList params; auto* body = create(); @@ -933,15 +899,14 @@ TEST_F(HlslGeneratorImplTest_Function, create(&i32, 1)), create( create(&i32, 1))), - std::move(list))); + list)); body->append(create()); - auto* func_1 = create("ep_1", std::move(params), &void_type, - std::move(body)); + auto* func_1 = create("ep_1", params, &void_type, body); func_1->add_decoration( create(ast::PipelineStage::kFragment, Source{})); - mod.AddFunction(std::move(func_1)); + mod.AddFunction(func_1); ASSERT_TRUE(td.Determine()) << td.error(); ASSERT_TRUE(gen.Generate(out)) << gen.error(); @@ -970,7 +935,7 @@ TEST_F(HlslGeneratorImplTest_Function, func->add_decoration( create(ast::PipelineStage::kFragment, Source{})); - mod.AddFunction(std::move(func)); + mod.AddFunction(func); ASSERT_TRUE(gen.Generate(out)) << gen.error(); EXPECT_EQ(result(), R"(void GeometryShader_tint_0() { @@ -986,12 +951,11 @@ TEST_F(HlslGeneratorImplTest_Function, ast::VariableList params; auto* body = create(); body->append(create()); - auto* func = create("main", std::move(params), &void_type, - std::move(body)); + auto* func = create("main", params, &void_type, body); func->add_decoration( create(ast::PipelineStage::kCompute, Source{})); - mod.AddFunction(std::move(func)); + mod.AddFunction(func); ASSERT_TRUE(td.Determine()) << td.error(); ASSERT_TRUE(gen.Generate(out)) << gen.error(); @@ -1010,13 +974,12 @@ TEST_F(HlslGeneratorImplTest_Function, ast::VariableList params; auto* body = create(); body->append(create()); - auto* func = create("main", std::move(params), &void_type, - std::move(body)); + auto* func = create("main", params, &void_type, body); func->add_decoration( create(ast::PipelineStage::kCompute, Source{})); func->add_decoration(create(2u, 4u, 6u, Source{})); - mod.AddFunction(std::move(func)); + mod.AddFunction(func); ASSERT_TRUE(td.Determine()) << td.error(); ASSERT_TRUE(gen.Generate(out)) << gen.error(); @@ -1039,10 +1002,9 @@ TEST_F(HlslGeneratorImplTest_Function, Emit_Function_WithArrayParams) { auto* body = create(); body->append(create()); - auto* func = create("my_func", std::move(params), &void_type, - std::move(body)); + auto* func = create("my_func", params, &void_type, body); - mod.AddFunction(std::move(func)); + mod.AddFunction(func); gen.increment_indent(); ASSERT_TRUE(gen.Generate(out)) << gen.error(); @@ -1077,14 +1039,14 @@ TEST_F(HlslGeneratorImplTest_Function, ast::StructMemberList members; ast::StructMemberDecorationList a_deco; a_deco.push_back(create(0, Source{})); - members.push_back(create("d", &f32, std::move(a_deco))); + members.push_back(create("d", &f32, a_deco)); ast::StructDecorationList s_decos; s_decos.push_back(create(Source{})); - auto* str = create(std::move(s_decos), std::move(members)); + auto* str = create(s_decos, members); - ast::type::StructType s("Data", std::move(str)); + ast::type::StructType s("Data", str); ast::type::AccessControlType ac(ast::AccessControl::kReadWrite, &s); auto* data_var = create( @@ -1093,11 +1055,11 @@ TEST_F(HlslGeneratorImplTest_Function, ast::VariableDecorationList decos; decos.push_back(create(0, Source{})); decos.push_back(create(0, Source{})); - data_var->set_decorations(std::move(decos)); + data_var->set_decorations(decos); mod.AddConstructedType(&s); td.RegisterVariableForTesting(data_var); - mod.AddGlobalVariable(std::move(data_var)); + mod.AddGlobalVariable(data_var); { ast::VariableList params; @@ -1107,14 +1069,13 @@ TEST_F(HlslGeneratorImplTest_Function, create("d"))); auto* body = create(); - body->append(create(std::move(var))); + body->append(create(var)); body->append(create()); - auto* func = create("a", std::move(params), &void_type, - std::move(body)); + auto* func = create("a", params, &void_type, body); func->add_decoration( create(ast::PipelineStage::kCompute, Source{})); - mod.AddFunction(std::move(func)); + mod.AddFunction(func); } { @@ -1125,14 +1086,13 @@ TEST_F(HlslGeneratorImplTest_Function, create("d"))); auto* body = create(); - body->append(create(std::move(var))); + body->append(create(var)); body->append(create()); - auto* func = create("b", std::move(params), &void_type, - std::move(body)); + auto* func = create("b", params, &void_type, body); func->add_decoration( create(ast::PipelineStage::kCompute, Source{})); - mod.AddFunction(std::move(func)); + mod.AddFunction(func); } ASSERT_TRUE(td.Determine()) << td.error(); diff --git a/src/writer/hlsl/generator_impl_if_test.cc b/src/writer/hlsl/generator_impl_if_test.cc index e494c8dba3..6e9bd7a362 100644 --- a/src/writer/hlsl/generator_impl_if_test.cc +++ b/src/writer/hlsl/generator_impl_if_test.cc @@ -31,7 +31,7 @@ TEST_F(HlslGeneratorImplTest_If, Emit_If) { auto* body = create(); body->append(create()); - ast::IfStatement i(std::move(cond), std::move(body)); + ast::IfStatement i(cond, body); gen.increment_indent(); ASSERT_TRUE(gen.EmitStatement(out, &i)) << gen.error(); @@ -47,15 +47,14 @@ TEST_F(HlslGeneratorImplTest_If, Emit_IfWithElseIf) { else_body->append(create()); ast::ElseStatementList elses; - elses.push_back( - create(std::move(else_cond), std::move(else_body))); + elses.push_back(create(else_cond, else_body)); auto* cond = create("cond"); auto* body = create(); body->append(create()); - ast::IfStatement i(std::move(cond), std::move(body)); - i.set_else_statements(std::move(elses)); + ast::IfStatement i(cond, body); + i.set_else_statements(elses); gen.increment_indent(); @@ -75,14 +74,14 @@ TEST_F(HlslGeneratorImplTest_If, Emit_IfWithElse) { else_body->append(create()); ast::ElseStatementList elses; - elses.push_back(create(std::move(else_body))); + elses.push_back(create(else_body)); auto* cond = create("cond"); auto* body = create(); body->append(create()); - ast::IfStatement i(std::move(cond), std::move(body)); - i.set_else_statements(std::move(elses)); + ast::IfStatement i(cond, body); + i.set_else_statements(elses); gen.increment_indent(); @@ -105,16 +104,15 @@ TEST_F(HlslGeneratorImplTest_If, Emit_IfWithMultiple) { else_body_2->append(create()); ast::ElseStatementList elses; - elses.push_back( - create(std::move(else_cond), std::move(else_body))); - elses.push_back(create(std::move(else_body_2))); + elses.push_back(create(else_cond, else_body)); + elses.push_back(create(else_body_2)); auto* cond = create("cond"); auto* body = create(); body->append(create()); - ast::IfStatement i(std::move(cond), std::move(body)); - i.set_else_statements(std::move(elses)); + ast::IfStatement i(cond, body); + i.set_else_statements(elses); gen.increment_indent(); diff --git a/src/writer/hlsl/generator_impl_import_test.cc b/src/writer/hlsl/generator_impl_import_test.cc index aa6f7d51ad..bfb5a85e6f 100644 --- a/src/writer/hlsl/generator_impl_import_test.cc +++ b/src/writer/hlsl/generator_impl_import_test.cc @@ -58,7 +58,7 @@ TEST_P(HlslImportData_SingleParamTest, FloatScalar) { create(&f32, 1.f))); auto* ident = create(param.name); - ast::CallExpression expr(std::move(ident), std::move(params)); + ast::CallExpression expr(ident, params); ASSERT_TRUE(td.DetermineResultType(&expr)) << td.error(); ASSERT_TRUE(gen.EmitCall(pre, out, &expr)) << gen.error(); @@ -103,7 +103,7 @@ TEST_P(HlslImportData_SingleIntParamTest, IntScalar) { create(&i32, 1))); ast::CallExpression expr(create(param.name), - std::move(params)); + params); ASSERT_TRUE(td.DetermineResultType(&expr)) << td.error(); ASSERT_TRUE(gen.EmitCall(pre, out, &expr)) << gen.error(); @@ -126,7 +126,7 @@ TEST_P(HlslImportData_DualParamTest, FloatScalar) { create(&f32, 2.f))); ast::CallExpression expr(create(param.name), - std::move(params)); + params); ASSERT_TRUE(td.DetermineResultType(&expr)) << td.error(); ASSERT_TRUE(gen.EmitCall(pre, out, &expr)) << gen.error(); @@ -150,29 +150,29 @@ TEST_P(HlslImportData_DualParam_VectorTest, FloatVector) { ast::type::F32Type f32; ast::type::VectorType vec(&f32, 3); - ast::ExpressionList type_params; - type_params.push_back(create( - create(&f32, 1.f))); - type_params.push_back(create( - create(&f32, 2.f))); - type_params.push_back(create( - create(&f32, 3.f))); - ast::ExpressionList params; - params.push_back( - create(&vec, std::move(type_params))); + params.push_back(create( + &vec, ast::ExpressionList{ + create( + create(&f32, 1.f)), + create( + create(&f32, 2.f)), + create( + create(&f32, 3.f)), + })); - type_params.push_back(create( - create(&f32, 4.f))); - type_params.push_back(create( - create(&f32, 5.f))); - type_params.push_back(create( - create(&f32, 6.f))); - params.push_back( - create(&vec, std::move(type_params))); + params.push_back(create( + &vec, ast::ExpressionList{ + create( + create(&f32, 4.f)), + create( + create(&f32, 5.f)), + create( + create(&f32, 6.f)), + })); ast::CallExpression expr(create(param.name), - std::move(params)); + params); ASSERT_TRUE(td.DetermineResultType(&expr)) << td.error(); ASSERT_TRUE(gen.EmitCall(pre, out, &expr)) << gen.error(); @@ -198,7 +198,7 @@ TEST_P(HlslImportData_DualParam_Int_Test, IntScalar) { create(&i32, 2))); ast::CallExpression expr(create(param.name), - std::move(params)); + params); ASSERT_TRUE(td.DetermineResultType(&expr)) << td.error(); ASSERT_TRUE(gen.EmitCall(pre, out, &expr)) << gen.error(); @@ -224,7 +224,7 @@ TEST_P(HlslImportData_TripleParamTest, FloatScalar) { create(&f32, 3.f))); ast::CallExpression expr(create(param.name), - std::move(params)); + params); ASSERT_TRUE(td.DetermineResultType(&expr)) << td.error(); ASSERT_TRUE(gen.EmitCall(pre, out, &expr)) << gen.error(); @@ -258,7 +258,7 @@ TEST_P(HlslImportData_TripleParam_Int_Test, IntScalar) { create(&i32, 3))); ast::CallExpression expr(create(param.name), - std::move(params)); + params); ASSERT_TRUE(td.DetermineResultType(&expr)) << td.error(); ASSERT_TRUE(gen.EmitCall(pre, out, &expr)) << gen.error(); @@ -278,9 +278,9 @@ TEST_F(HlslGeneratorImplTest_Import, HlslImportData_Determinant) { params.push_back(create("var")); ast::CallExpression expr(create("determinant"), - std::move(params)); + params); - mod.AddGlobalVariable(std::move(var)); + mod.AddGlobalVariable(var); // Register the global ASSERT_TRUE(td.Determine()) << td.error(); diff --git a/src/writer/hlsl/generator_impl_intrinsic_test.cc b/src/writer/hlsl/generator_impl_intrinsic_test.cc index 38aebb3de0..b47a1e3b9a 100644 --- a/src/writer/hlsl/generator_impl_intrinsic_test.cc +++ b/src/writer/hlsl/generator_impl_intrinsic_test.cc @@ -84,13 +84,13 @@ TEST_F(HlslGeneratorImplTest_Intrinsic, DISABLED_Intrinsic_OuterProduct) { params.push_back(create("b")); ast::CallExpression call(create("outer_product"), - std::move(params)); + params); td.RegisterVariableForTesting(a); td.RegisterVariableForTesting(b); - mod.AddGlobalVariable(std::move(a)); - mod.AddGlobalVariable(std::move(b)); + mod.AddGlobalVariable(a); + mod.AddGlobalVariable(b); ASSERT_TRUE(td.Determine()) << td.error(); ASSERT_TRUE(td.DetermineResultType(&call)) << td.error(); @@ -112,8 +112,7 @@ TEST_F(HlslGeneratorImplTest_Intrinsic, Intrinsic_Call) { params.push_back(create("param1")); params.push_back(create("param2")); - ast::CallExpression call(create("dot"), - std::move(params)); + ast::CallExpression call(create("dot"), params); ast::Variable v1("param1", ast::StorageClass::kFunction, &vec); ast::Variable v2("param2", ast::StorageClass::kFunction, &vec); diff --git a/src/writer/hlsl/generator_impl_loop_test.cc b/src/writer/hlsl/generator_impl_loop_test.cc index 05579dfebf..71bdd2020a 100644 --- a/src/writer/hlsl/generator_impl_loop_test.cc +++ b/src/writer/hlsl/generator_impl_loop_test.cc @@ -37,7 +37,7 @@ TEST_F(HlslGeneratorImplTest_Loop, Emit_Loop) { auto* body = create(); body->append(create()); - ast::LoopStatement l(std::move(body), {}); + ast::LoopStatement l(body, {}); gen.increment_indent(); ASSERT_TRUE(gen.EmitStatement(out, &l)) << gen.error(); @@ -54,7 +54,7 @@ TEST_F(HlslGeneratorImplTest_Loop, Emit_LoopWithContinuing) { auto* continuing = create(); continuing->append(create()); - ast::LoopStatement l(std::move(body), std::move(continuing)); + ast::LoopStatement l(body, continuing); gen.increment_indent(); ASSERT_TRUE(gen.EmitStatement(out, &l)) << gen.error(); @@ -81,20 +81,18 @@ TEST_F(HlslGeneratorImplTest_Loop, Emit_LoopNestedWithContinuing) { auto* continuing = create(); continuing->append(create()); - auto* inner = - create(std::move(body), std::move(continuing)); + auto* inner = create(body, continuing); body = create(); - body->append(std::move(inner)); + body->append(inner); auto* lhs = create("lhs"); auto* rhs = create("rhs"); continuing = create(); - continuing->append( - create(std::move(lhs), std::move(rhs))); + continuing->append(create(lhs, rhs)); - ast::LoopStatement outer(std::move(body), std::move(continuing)); + ast::LoopStatement outer(body, continuing); gen.increment_indent(); ASSERT_TRUE(gen.EmitStatement(out, &outer)) << gen.error(); @@ -151,7 +149,7 @@ TEST_F(HlslGeneratorImplTest_Loop, Emit_LoopWithVarUsedInContinuing) { create(&f32, 2.4))); auto* body = create(); - body->append(create(std::move(var))); + body->append(create(var)); body->append(create( create("other", ast::StorageClass::kFunction, &f32))); @@ -159,10 +157,9 @@ TEST_F(HlslGeneratorImplTest_Loop, Emit_LoopWithVarUsedInContinuing) { auto* rhs = create("rhs"); auto* continuing = create(); - continuing->append( - create(std::move(lhs), std::move(rhs))); + continuing->append(create(lhs, rhs)); - ast::LoopStatement outer(std::move(body), std::move(continuing)); + ast::LoopStatement outer(body, continuing); gen.increment_indent(); ASSERT_TRUE(gen.EmitStatement(out, &outer)) << gen.error(); diff --git a/src/writer/hlsl/generator_impl_member_accessor_test.cc b/src/writer/hlsl/generator_impl_member_accessor_test.cc index 74ea63faf2..7005f7e0fa 100644 --- a/src/writer/hlsl/generator_impl_member_accessor_test.cc +++ b/src/writer/hlsl/generator_impl_member_accessor_test.cc @@ -52,12 +52,12 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor, EmitExpression_MemberAccessor) { ast::StructMemberList members; ast::StructMemberDecorationList deco; deco.push_back(create(0, Source{})); - members.push_back(create("mem", &f32, std::move(deco))); + members.push_back(create("mem", &f32, deco)); auto* strct = create(); - strct->set_members(std::move(members)); + strct->set_members(members); - ast::type::StructType s("Str", std::move(strct)); + ast::type::StructType s("Str", strct); auto* str_var = create( create("str", ast::StorageClass::kPrivate, &s)); @@ -65,11 +65,11 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor, EmitExpression_MemberAccessor) { auto* str = create("str"); auto* mem = create("mem"); - ast::MemberAccessorExpression expr(std::move(str), std::move(mem)); + ast::MemberAccessorExpression expr(str, mem); td.RegisterVariableForTesting(str_var); gen.register_global(str_var); - mod.AddGlobalVariable(std::move(str_var)); + mod.AddGlobalVariable(str_var); ASSERT_TRUE(td.DetermineResultType(&expr)) << td.error(); ASSERT_TRUE(gen.EmitExpression(pre, out, &expr)) << gen.error(); @@ -92,16 +92,16 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor, ast::StructMemberList members; ast::StructMemberDecorationList a_deco; a_deco.push_back(create(0, Source{})); - members.push_back(create("a", &i32, std::move(a_deco))); + members.push_back(create("a", &i32, a_deco)); ast::StructMemberDecorationList b_deco; b_deco.push_back(create(4, Source{})); - members.push_back(create("b", &f32, std::move(b_deco))); + members.push_back(create("b", &f32, b_deco)); auto* str = create(); - str->set_members(std::move(members)); + str->set_members(members); - ast::type::StructType s("Data", std::move(str)); + ast::type::StructType s("Data", str); auto* coord_var = create( create("data", ast::StorageClass::kStorageBuffer, &s)); @@ -111,7 +111,7 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor, td.RegisterVariableForTesting(coord_var); gen.register_global(coord_var); - mod.AddGlobalVariable(std::move(coord_var)); + mod.AddGlobalVariable(coord_var); ASSERT_TRUE(td.Determine()) << td.error(); ASSERT_TRUE(td.DetermineResultType(&expr)); @@ -136,16 +136,16 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor, ast::StructMemberList members; ast::StructMemberDecorationList a_deco; a_deco.push_back(create(0, Source{})); - members.push_back(create("a", &i32, std::move(a_deco))); + members.push_back(create("a", &i32, a_deco)); ast::StructMemberDecorationList b_deco; b_deco.push_back(create(4, Source{})); - members.push_back(create("b", &f32, std::move(b_deco))); + members.push_back(create("b", &f32, b_deco)); auto* str = create(); - str->set_members(std::move(members)); + str->set_members(members); - ast::type::StructType s("Data", std::move(str)); + ast::type::StructType s("Data", str); auto* coord_var = create( create("data", ast::StorageClass::kStorageBuffer, &s)); @@ -155,7 +155,7 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor, td.RegisterVariableForTesting(coord_var); gen.register_global(coord_var); - mod.AddGlobalVariable(std::move(coord_var)); + mod.AddGlobalVariable(coord_var); ASSERT_TRUE(td.Determine()) << td.error(); ASSERT_TRUE(td.DetermineResultType(&expr)); @@ -180,19 +180,19 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor, ast::type::I32Type i32; ast::type::MatrixType mat(&f32, 3, 2); - ast::StructMemberList members; - ast::StructMemberDecorationList a_deco; - a_deco.push_back(create(0, Source{})); - members.push_back(create("z", &i32, std::move(a_deco))); - - ast::StructMemberDecorationList b_deco; - b_deco.push_back(create(4, Source{})); - members.push_back(create("a", &mat, std::move(b_deco))); - auto* str = create(); - str->set_members(std::move(members)); + str->set_members({ + create( + "z", &i32, + ast::StructMemberDecorationList{ + create(0, Source{})}), + create( + "a", &mat, + ast::StructMemberDecorationList{ + create(4, Source{})}), + }); - ast::type::StructType s("Data", std::move(str)); + ast::type::StructType s("Data", str); auto* b_var = create("b", ast::StorageClass::kPrivate, &mat); @@ -204,14 +204,14 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor, create("a")); auto* rhs = create("b"); - ast::AssignmentStatement assign(std::move(lhs), std::move(rhs)); + ast::AssignmentStatement assign(lhs, rhs); td.RegisterVariableForTesting(coord_var); td.RegisterVariableForTesting(b_var); gen.register_global(coord_var); gen.register_global(b_var); - mod.AddGlobalVariable(std::move(coord_var)); - mod.AddGlobalVariable(std::move(b_var)); + mod.AddGlobalVariable(coord_var); + mod.AddGlobalVariable(b_var); ASSERT_TRUE(td.Determine()) << td.error(); ASSERT_TRUE(td.DetermineResultType(&assign)); @@ -243,16 +243,16 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor, ast::StructMemberList members; ast::StructMemberDecorationList a_deco; a_deco.push_back(create(0, Source{})); - members.push_back(create("z", &i32, std::move(a_deco))); + members.push_back(create("z", &i32, a_deco)); ast::StructMemberDecorationList b_deco; b_deco.push_back(create(4, Source{})); - members.push_back(create("a", &mat, std::move(b_deco))); + members.push_back(create("a", &mat, b_deco)); auto* str = create(); - str->set_members(std::move(members)); + str->set_members(members); - ast::type::StructType s("Data", std::move(str)); + ast::type::StructType s("Data", str); auto* coord_var = create( create("data", ast::StorageClass::kStorageBuffer, &s)); @@ -263,11 +263,11 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor, auto* rhs = create(&mat, ast::ExpressionList{}); - ast::AssignmentStatement assign(std::move(lhs), std::move(rhs)); + ast::AssignmentStatement assign(lhs, rhs); td.RegisterVariableForTesting(coord_var); gen.register_global(coord_var); - mod.AddGlobalVariable(std::move(coord_var)); + mod.AddGlobalVariable(coord_var); ASSERT_TRUE(td.Determine()) << td.error(); ASSERT_TRUE(td.DetermineResultType(&assign)); @@ -299,16 +299,16 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor, ast::StructMemberList members; ast::StructMemberDecorationList a_deco; a_deco.push_back(create(0, Source{})); - members.push_back(create("z", &i32, std::move(a_deco))); + members.push_back(create("z", &i32, a_deco)); ast::StructMemberDecorationList b_deco; b_deco.push_back(create(4, Source{})); - members.push_back(create("a", &mat, std::move(b_deco))); + members.push_back(create("a", &mat, b_deco)); auto* str = create(); - str->set_members(std::move(members)); + str->set_members(members); - ast::type::StructType s("Data", std::move(str)); + ast::type::StructType s("Data", str); auto* coord_var = create( create("data", ast::StorageClass::kStorageBuffer, &s)); @@ -318,7 +318,7 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor, td.RegisterVariableForTesting(coord_var); gen.register_global(coord_var); - mod.AddGlobalVariable(std::move(coord_var)); + mod.AddGlobalVariable(coord_var); ASSERT_TRUE(td.Determine()) << td.error(); ASSERT_TRUE(td.DetermineResultType(&expr)); @@ -350,16 +350,16 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor, ast::StructMemberList members; ast::StructMemberDecorationList a_deco; a_deco.push_back(create(0, Source{})); - members.push_back(create("z", &i32, std::move(a_deco))); + members.push_back(create("z", &i32, a_deco)); ast::StructMemberDecorationList b_deco; b_deco.push_back(create(4, Source{})); - members.push_back(create("a", &mat, std::move(b_deco))); + members.push_back(create("a", &mat, b_deco)); auto* str = create(); - str->set_members(std::move(members)); + str->set_members(members); - ast::type::StructType s("Data", std::move(str)); + ast::type::StructType s("Data", str); auto* coord_var = create( create("data", ast::StorageClass::kStorageBuffer, &s)); @@ -369,7 +369,7 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor, td.RegisterVariableForTesting(coord_var); gen.register_global(coord_var); - mod.AddGlobalVariable(std::move(coord_var)); + mod.AddGlobalVariable(coord_var); ASSERT_TRUE(td.Determine()) << td.error(); ASSERT_TRUE(td.DetermineResultType(&expr)); @@ -398,12 +398,12 @@ TEST_F( ast::StructMemberList members; ast::StructMemberDecorationList deco; deco.push_back(create(0, Source{})); - members.push_back(create("a", &mat, std::move(deco))); + members.push_back(create("a", &mat, deco)); auto* str = create(); - str->set_members(std::move(members)); + str->set_members(members); - ast::type::StructType s("Data", std::move(str)); + ast::type::StructType s("Data", str); auto* coord_var = create( create("data", ast::StorageClass::kStorageBuffer, &s)); @@ -413,7 +413,7 @@ TEST_F( td.RegisterVariableForTesting(coord_var); gen.register_global(coord_var); - mod.AddGlobalVariable(std::move(coord_var)); + mod.AddGlobalVariable(coord_var); ASSERT_TRUE(td.Determine()) << td.error(); ASSERT_TRUE(td.DetermineResultType(&expr)); @@ -441,16 +441,16 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor, ast::StructMemberList members; ast::StructMemberDecorationList a_deco; a_deco.push_back(create(0, Source{})); - members.push_back(create("z", &i32, std::move(a_deco))); + members.push_back(create("z", &i32, a_deco)); ast::StructMemberDecorationList b_deco; b_deco.push_back(create(16, Source{})); - members.push_back(create("a", &mat, std::move(b_deco))); + members.push_back(create("a", &mat, b_deco)); auto* str = create(); - str->set_members(std::move(members)); + str->set_members(members); - ast::type::StructType s("Data", std::move(str)); + ast::type::StructType s("Data", str); auto* coord_var = create( create("data", ast::StorageClass::kStorageBuffer, &s)); @@ -467,7 +467,7 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor, td.RegisterVariableForTesting(coord_var); gen.register_global(coord_var); - mod.AddGlobalVariable(std::move(coord_var)); + mod.AddGlobalVariable(coord_var); ASSERT_TRUE(td.Determine()) << td.error(); ASSERT_TRUE(td.DetermineResultType(&expr)); @@ -488,19 +488,17 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor, ast::type::F32Type f32; ast::type::I32Type i32; ast::type::ArrayType ary(&i32, 5); - ast::ArrayDecorationList decos; - decos.push_back(create(4, Source{})); - ary.set_decorations(std::move(decos)); + ary.set_decorations({create(4, Source{})}); ast::StructMemberList members; ast::StructMemberDecorationList a_deco; a_deco.push_back(create(0, Source{})); - members.push_back(create("a", &ary, std::move(a_deco))); + members.push_back(create("a", &ary, a_deco)); auto* str = create(); - str->set_members(std::move(members)); + str->set_members(members); - ast::type::StructType s("Data", std::move(str)); + ast::type::StructType s("Data", str); auto* coord_var = create( create("data", ast::StorageClass::kStorageBuffer, &s)); @@ -514,7 +512,7 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor, td.RegisterVariableForTesting(coord_var); gen.register_global(coord_var); - mod.AddGlobalVariable(std::move(coord_var)); + mod.AddGlobalVariable(coord_var); ASSERT_TRUE(td.Determine()) << td.error(); ASSERT_TRUE(td.DetermineResultType(&expr)) << td.error(); @@ -535,19 +533,17 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor, ast::type::F32Type f32; ast::type::I32Type i32; ast::type::ArrayType ary(&i32, 5); - ast::ArrayDecorationList decos; - decos.push_back(create(4, Source{})); - ary.set_decorations(std::move(decos)); + ary.set_decorations({create(4, Source{})}); ast::StructMemberList members; ast::StructMemberDecorationList a_deco; a_deco.push_back(create(0, Source{})); - members.push_back(create("a", &ary, std::move(a_deco))); + members.push_back(create("a", &ary, a_deco)); auto* str = create(); - str->set_members(std::move(members)); + str->set_members(members); - ast::type::StructType s("Data", std::move(str)); + ast::type::StructType s("Data", str); auto* coord_var = create( create("data", ast::StorageClass::kStorageBuffer, &s)); @@ -569,7 +565,7 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor, td.RegisterVariableForTesting(coord_var); gen.register_global(coord_var); - mod.AddGlobalVariable(std::move(coord_var)); + mod.AddGlobalVariable(coord_var); ASSERT_TRUE(td.Determine()) << td.error(); ASSERT_TRUE(td.DetermineResultType(&expr)) << td.error(); @@ -595,23 +591,23 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor, ast::StructMemberList members; ast::StructMemberDecorationList a_deco; a_deco.push_back(create(0, Source{})); - members.push_back(create("a", &i32, std::move(a_deco))); + members.push_back(create("a", &i32, a_deco)); ast::StructMemberDecorationList b_deco; b_deco.push_back(create(4, Source{})); - members.push_back(create("b", &f32, std::move(b_deco))); + members.push_back(create("b", &f32, b_deco)); auto* str = create(); - str->set_members(std::move(members)); + str->set_members(members); - ast::type::StructType s("Data", std::move(str)); + ast::type::StructType s("Data", str); auto* coord_var = create( create("data", ast::StorageClass::kStorageBuffer, &s)); td.RegisterVariableForTesting(coord_var); gen.register_global(coord_var); - mod.AddGlobalVariable(std::move(coord_var)); + mod.AddGlobalVariable(coord_var); ASSERT_TRUE(td.Determine()) << td.error(); @@ -620,7 +616,7 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor, create("b")); auto* rhs = create( create(&f32, 2.0f)); - ast::AssignmentStatement assign(std::move(lhs), std::move(rhs)); + ast::AssignmentStatement assign(lhs, rhs); ASSERT_TRUE(td.DetermineResultType(&assign)); ASSERT_TRUE(gen.EmitStatement(out, &assign)) << gen.error(); @@ -641,26 +637,24 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor, ast::type::F32Type f32; ast::type::I32Type i32; ast::type::ArrayType ary(&i32, 5); - ast::ArrayDecorationList decos; - decos.push_back(create(4, Source{})); - ary.set_decorations(std::move(decos)); + ary.set_decorations({create(4, Source{})}); ast::StructMemberList members; ast::StructMemberDecorationList a_deco; a_deco.push_back(create(0, Source{})); - members.push_back(create("a", &ary, std::move(a_deco))); + members.push_back(create("a", &ary, a_deco)); auto* str = create(); - str->set_members(std::move(members)); + str->set_members(members); - ast::type::StructType s("Data", std::move(str)); + ast::type::StructType s("Data", str); auto* coord_var = create( create("data", ast::StorageClass::kStorageBuffer, &s)); td.RegisterVariableForTesting(coord_var); gen.register_global(coord_var); - mod.AddGlobalVariable(std::move(coord_var)); + mod.AddGlobalVariable(coord_var); ASSERT_TRUE(td.Determine()) << td.error(); @@ -672,7 +666,7 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor, create(&i32, 2))); auto* rhs = create( create(&i32, 2)); - ast::AssignmentStatement assign(std::move(lhs), std::move(rhs)); + ast::AssignmentStatement assign(lhs, rhs); ASSERT_TRUE(td.DetermineResultType(&assign)) << td.error(); ASSERT_TRUE(gen.EmitStatement(out, &assign)) << gen.error(); @@ -697,23 +691,23 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor, ast::StructMemberList members; ast::StructMemberDecorationList a_deco; a_deco.push_back(create(0, Source{})); - members.push_back(create("a", &i32, std::move(a_deco))); + members.push_back(create("a", &i32, a_deco)); ast::StructMemberDecorationList b_deco; b_deco.push_back(create(4, Source{})); - members.push_back(create("b", &f32, std::move(b_deco))); + members.push_back(create("b", &f32, b_deco)); auto* str = create(); - str->set_members(std::move(members)); + str->set_members(members); - ast::type::StructType s("Data", std::move(str)); + ast::type::StructType s("Data", str); auto* coord_var = create( create("data", ast::StorageClass::kStorageBuffer, &s)); td.RegisterVariableForTesting(coord_var); gen.register_global(coord_var); - mod.AddGlobalVariable(std::move(coord_var)); + mod.AddGlobalVariable(coord_var); ASSERT_TRUE(td.Determine()) << td.error(); @@ -722,7 +716,7 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor, create("a")); auto* rhs = create( create(&i32, 2)); - ast::AssignmentStatement assign(std::move(lhs), std::move(rhs)); + ast::AssignmentStatement assign(lhs, rhs); ASSERT_TRUE(td.DetermineResultType(&assign)); ASSERT_TRUE(gen.EmitStatement(out, &assign)) << gen.error(); @@ -749,23 +743,23 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor, ast::StructMemberList members; ast::StructMemberDecorationList a_deco; a_deco.push_back(create(0, Source{})); - members.push_back(create("a", &ivec3, std::move(a_deco))); + members.push_back(create("a", &ivec3, a_deco)); ast::StructMemberDecorationList b_deco; b_deco.push_back(create(16, Source{})); - members.push_back(create("b", &fvec3, std::move(b_deco))); + members.push_back(create("b", &fvec3, b_deco)); auto* str = create(); - str->set_members(std::move(members)); + str->set_members(members); - ast::type::StructType s("Data", std::move(str)); + ast::type::StructType s("Data", str); auto* coord_var = create( create("data", ast::StorageClass::kStorageBuffer, &s)); td.RegisterVariableForTesting(coord_var); gen.register_global(coord_var); - mod.AddGlobalVariable(std::move(coord_var)); + mod.AddGlobalVariable(coord_var); ASSERT_TRUE(td.Determine()) << td.error(); @@ -796,23 +790,23 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor, ast::StructMemberList members; ast::StructMemberDecorationList a_deco; a_deco.push_back(create(0, Source{})); - members.push_back(create("a", &ivec3, std::move(a_deco))); + members.push_back(create("a", &ivec3, a_deco)); ast::StructMemberDecorationList b_deco; b_deco.push_back(create(16, Source{})); - members.push_back(create("b", &fvec3, std::move(b_deco))); + members.push_back(create("b", &fvec3, b_deco)); auto* str = create(); - str->set_members(std::move(members)); + str->set_members(members); - ast::type::StructType s("Data", std::move(str)); + ast::type::StructType s("Data", str); auto* coord_var = create( create("data", ast::StorageClass::kStorageBuffer, &s)); td.RegisterVariableForTesting(coord_var); gen.register_global(coord_var); - mod.AddGlobalVariable(std::move(coord_var)); + mod.AddGlobalVariable(coord_var); ASSERT_TRUE(td.Determine()) << td.error(); @@ -820,16 +814,16 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor, auto* lit2 = create(&f32, 2.f); auto* lit3 = create(&f32, 3.f); ast::ExpressionList values; - values.push_back(create(std::move(lit1))); - values.push_back(create(std::move(lit2))); - values.push_back(create(std::move(lit3))); + values.push_back(create(lit1)); + values.push_back(create(lit2)); + values.push_back(create(lit3)); auto* lhs = create( create("data"), create("b")); - auto* rhs = create(&fvec3, std::move(values)); + auto* rhs = create(&fvec3, values); - ast::AssignmentStatement assign(std::move(lhs), std::move(rhs)); + ast::AssignmentStatement assign(lhs, rhs); ASSERT_TRUE(td.DetermineResultType(&assign)); ASSERT_TRUE(gen.EmitStatement(out, &assign)) << gen.error(); @@ -859,38 +853,39 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor, ast::type::VectorType ivec3(&i32, 3); ast::type::VectorType fvec3(&f32, 3); - ast::StructMemberList members; - ast::StructMemberDecorationList deco; - deco.push_back(create(0, Source{})); - members.push_back(create("a", &ivec3, std::move(deco))); - - deco.push_back(create(16, Source{})); - members.push_back(create("b", &fvec3, std::move(deco))); - auto* data_str = create(); - data_str->set_members(std::move(members)); + data_str->set_members({ + create( + "a", &ivec3, + ast::StructMemberDecorationList{ + create(0, Source{})}), + create( + "b", &fvec3, + ast::StructMemberDecorationList{ + create(16, Source{})}), + }); - ast::type::StructType data("Data", std::move(data_str)); + ast::type::StructType data("Data", data_str); ast::type::ArrayType ary(&data, 4); - ast::ArrayDecorationList decos; - decos.push_back(create(32, Source{})); - ary.set_decorations(std::move(decos)); - - deco.push_back(create(0, Source{})); - members.push_back(create("c", &ary, std::move(deco))); + ary.set_decorations({create(32, Source{})}); auto* pre_str = create(); - pre_str->set_members(std::move(members)); + pre_str->set_members({ + create( + "c", &ary, + ast::StructMemberDecorationList{ + create(0, Source{})}), + }); - ast::type::StructType pre_struct("Pre", std::move(pre_str)); + ast::type::StructType pre_struct("Pre", pre_str); auto* coord_var = create(create( "data", ast::StorageClass::kStorageBuffer, &pre_struct)); td.RegisterVariableForTesting(coord_var); gen.register_global(coord_var); - mod.AddGlobalVariable(std::move(coord_var)); + mod.AddGlobalVariable(coord_var); ASSERT_TRUE(td.Determine()) << td.error(); @@ -930,36 +925,38 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor, ast::StructMemberList members; ast::StructMemberDecorationList deco; - deco.push_back(create(0, Source{})); - members.push_back(create("a", &ivec3, std::move(deco))); - - deco.push_back(create(16, Source{})); - members.push_back(create("b", &fvec3, std::move(deco))); auto* data_str = create(); - data_str->set_members(std::move(members)); + data_str->set_members({ + create( + "a", &ivec3, + ast::StructMemberDecorationList{ + create(0, Source{})}), + create( + "b", &fvec3, + ast::StructMemberDecorationList{ + create(16, Source{})}), + }); - ast::type::StructType data("Data", std::move(data_str)); + ast::type::StructType data("Data", data_str); ast::type::ArrayType ary(&data, 4); - ast::ArrayDecorationList decos; - decos.push_back(create(32, Source{})); - ary.set_decorations(std::move(decos)); - - deco.push_back(create(0, Source{})); - members.push_back(create("c", &ary, std::move(deco))); + ary.set_decorations({create(32, Source{})}); auto* pre_str = create(); - pre_str->set_members(std::move(members)); + pre_str->set_members({create( + "c", &ary, + ast::StructMemberDecorationList{ + create(0, Source{})})}); - ast::type::StructType pre_struct("Pre", std::move(pre_str)); + ast::type::StructType pre_struct("Pre", pre_str); auto* coord_var = create(create( "data", ast::StorageClass::kStorageBuffer, &pre_struct)); td.RegisterVariableForTesting(coord_var); gen.register_global(coord_var); - mod.AddGlobalVariable(std::move(coord_var)); + mod.AddGlobalVariable(coord_var); ASSERT_TRUE(td.Determine()) << td.error(); @@ -1000,38 +997,37 @@ TEST_F( ast::type::VectorType ivec3(&i32, 3); ast::type::VectorType fvec3(&f32, 3); - ast::StructMemberList members; - ast::StructMemberDecorationList deco; - deco.push_back(create(0, Source{})); - members.push_back(create("a", &ivec3, std::move(deco))); - - deco.push_back(create(16, Source{})); - members.push_back(create("b", &fvec3, std::move(deco))); - auto* data_str = create(); - data_str->set_members(std::move(members)); + data_str->set_members({ + create( + "a", &ivec3, + ast::StructMemberDecorationList{ + create(0, Source{})}), + create( + "b", &fvec3, + ast::StructMemberDecorationList{ + create(16, Source{})}), + }); - ast::type::StructType data("Data", std::move(data_str)); + ast::type::StructType data("Data", data_str); ast::type::ArrayType ary(&data, 4); - ast::ArrayDecorationList decos; - decos.push_back(create(32, Source{})); - ary.set_decorations(std::move(decos)); - - deco.push_back(create(0, Source{})); - members.push_back(create("c", &ary, std::move(deco))); + ary.set_decorations({create(32, Source{})}); auto* pre_str = create(); - pre_str->set_members(std::move(members)); + pre_str->set_members({create( + "c", &ary, + ast::StructMemberDecorationList{ + create(0, Source{})})}); - ast::type::StructType pre_struct("Pre", std::move(pre_str)); + ast::type::StructType pre_struct("Pre", pre_str); auto* coord_var = create(create( "data", ast::StorageClass::kStorageBuffer, &pre_struct)); td.RegisterVariableForTesting(coord_var); gen.register_global(coord_var); - mod.AddGlobalVariable(std::move(coord_var)); + mod.AddGlobalVariable(coord_var); ASSERT_TRUE(td.Determine()) << td.error(); @@ -1071,38 +1067,37 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor, ast::type::VectorType ivec3(&i32, 3); ast::type::VectorType fvec3(&f32, 3); - ast::StructMemberList members; - ast::StructMemberDecorationList deco; - deco.push_back(create(0, Source{})); - members.push_back(create("a", &ivec3, std::move(deco))); - - deco.push_back(create(16, Source{})); - members.push_back(create("b", &fvec3, std::move(deco))); - auto* data_str = create(); - data_str->set_members(std::move(members)); + data_str->set_members({ + create( + "a", &ivec3, + ast::StructMemberDecorationList{ + create(0, Source{})}), + create( + "b", &fvec3, + ast::StructMemberDecorationList{ + create(16, Source{})}), + }); - ast::type::StructType data("Data", std::move(data_str)); + ast::type::StructType data("Data", data_str); ast::type::ArrayType ary(&data, 4); - ast::ArrayDecorationList decos; - decos.push_back(create(32, Source{})); - ary.set_decorations(std::move(decos)); - - deco.push_back(create(0, Source{})); - members.push_back(create("c", &ary, std::move(deco))); + ary.set_decorations({create(32, Source{})}); auto* pre_str = create(); - pre_str->set_members(std::move(members)); + pre_str->set_members({create( + "c", &ary, + ast::StructMemberDecorationList{ + create(0, Source{})})}); - ast::type::StructType pre_struct("Pre", std::move(pre_str)); + ast::type::StructType pre_struct("Pre", pre_str); auto* coord_var = create(create( "data", ast::StorageClass::kStorageBuffer, &pre_struct)); td.RegisterVariableForTesting(coord_var); gen.register_global(coord_var); - mod.AddGlobalVariable(std::move(coord_var)); + mod.AddGlobalVariable(coord_var); ASSERT_TRUE(td.Determine()) << td.error(); @@ -1143,38 +1138,37 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor, ast::type::VectorType ivec3(&i32, 3); ast::type::VectorType fvec3(&f32, 3); - ast::StructMemberList members; - ast::StructMemberDecorationList deco; - deco.push_back(create(0, Source{})); - members.push_back(create("a", &ivec3, std::move(deco))); - - deco.push_back(create(16, Source{})); - members.push_back(create("b", &fvec3, std::move(deco))); - auto* data_str = create(); - data_str->set_members(std::move(members)); + data_str->set_members({ + create( + "a", &ivec3, + ast::StructMemberDecorationList{ + create(0, Source{})}), + create( + "b", &fvec3, + ast::StructMemberDecorationList{ + create(16, Source{})}), + }); - ast::type::StructType data("Data", std::move(data_str)); + ast::type::StructType data("Data", data_str); ast::type::ArrayType ary(&data, 4); - ast::ArrayDecorationList decos; - decos.push_back(create(32, Source{})); - ary.set_decorations(std::move(decos)); - - deco.push_back(create(0, Source{})); - members.push_back(create("c", &ary, std::move(deco))); + ary.set_decorations({create(32, Source{})}); auto* pre_str = create(); - pre_str->set_members(std::move(members)); + pre_str->set_members({create( + "c", &ary, + ast::StructMemberDecorationList{ + create(0, Source{})})}); - ast::type::StructType pre_struct("Pre", std::move(pre_str)); + ast::type::StructType pre_struct("Pre", pre_str); auto* coord_var = create(create( "data", ast::StorageClass::kStorageBuffer, &pre_struct)); td.RegisterVariableForTesting(coord_var); gen.register_global(coord_var); - mod.AddGlobalVariable(std::move(coord_var)); + mod.AddGlobalVariable(coord_var); ASSERT_TRUE(td.Determine()) << td.error(); @@ -1191,13 +1185,13 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor, auto* lit2 = create(&f32, 2.f); auto* lit3 = create(&f32, 3.f); ast::ExpressionList values; - values.push_back(create(std::move(lit1))); - values.push_back(create(std::move(lit2))); - values.push_back(create(std::move(lit3))); + values.push_back(create(lit1)); + values.push_back(create(lit2)); + values.push_back(create(lit3)); - auto* rhs = create(&fvec3, std::move(values)); + auto* rhs = create(&fvec3, values); - ast::AssignmentStatement assign(std::move(lhs), std::move(rhs)); + ast::AssignmentStatement assign(lhs, rhs); ASSERT_TRUE(td.DetermineResultType(&assign)); ASSERT_TRUE(gen.EmitStatement(out, &assign)) << gen.error(); @@ -1227,38 +1221,37 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor, ast::type::VectorType ivec3(&i32, 3); ast::type::VectorType fvec3(&f32, 3); - ast::StructMemberList members; - ast::StructMemberDecorationList deco; - deco.push_back(create(0, Source{})); - members.push_back(create("a", &ivec3, std::move(deco))); - - deco.push_back(create(16, Source{})); - members.push_back(create("b", &fvec3, std::move(deco))); - auto* data_str = create(); - data_str->set_members(std::move(members)); + data_str->set_members({ + create( + "a", &ivec3, + ast::StructMemberDecorationList{ + create(0, Source{})}), + create( + "b", &fvec3, + ast::StructMemberDecorationList{ + create(16, Source{})}), + }); - ast::type::StructType data("Data", std::move(data_str)); + ast::type::StructType data("Data", data_str); ast::type::ArrayType ary(&data, 4); - ast::ArrayDecorationList decos; - decos.push_back(create(32, Source{})); - ary.set_decorations(std::move(decos)); - - deco.push_back(create(0, Source{})); - members.push_back(create("c", &ary, std::move(deco))); + ary.set_decorations({create(32, Source{})}); auto* pre_str = create(); - pre_str->set_members(std::move(members)); + pre_str->set_members({create( + "c", &ary, + ast::StructMemberDecorationList{ + create(0, Source{})})}); - ast::type::StructType pre_struct("Pre", std::move(pre_str)); + ast::type::StructType pre_struct("Pre", pre_str); auto* coord_var = create(create( "data", ast::StorageClass::kStorageBuffer, &pre_struct)); td.RegisterVariableForTesting(coord_var); gen.register_global(coord_var); - mod.AddGlobalVariable(std::move(coord_var)); + mod.AddGlobalVariable(coord_var); ASSERT_TRUE(td.Determine()) << td.error(); @@ -1276,7 +1269,7 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor, auto* rhs = create( create(&i32, 1.f)); - ast::AssignmentStatement assign(std::move(lhs), std::move(rhs)); + ast::AssignmentStatement assign(lhs, rhs); ASSERT_TRUE(td.DetermineResultType(&assign)); ASSERT_TRUE(gen.EmitStatement(out, &assign)) << gen.error(); diff --git a/src/writer/hlsl/generator_impl_module_constant_test.cc b/src/writer/hlsl/generator_impl_module_constant_test.cc index 98e900ffbc..3b78a97c92 100644 --- a/src/writer/hlsl/generator_impl_module_constant_test.cc +++ b/src/writer/hlsl/generator_impl_module_constant_test.cc @@ -47,8 +47,7 @@ TEST_F(HlslGeneratorImplTest_ModuleConstant, Emit_ModuleConstant) { auto* var = create("pos", ast::StorageClass::kNone, &ary); var->set_is_const(true); - var->set_constructor( - create(&ary, std::move(exprs))); + var->set_constructor(create(&ary, exprs)); ASSERT_TRUE(gen.EmitProgramConstVariable(out, var)) << gen.error(); EXPECT_EQ( @@ -64,7 +63,7 @@ TEST_F(HlslGeneratorImplTest_ModuleConstant, Emit_SpecConstant) { auto* var = create( create("pos", ast::StorageClass::kNone, &f32)); - var->set_decorations(std::move(decos)); + var->set_decorations(decos); var->set_is_const(true); var->set_constructor(create( create(&f32, 3.0f))); @@ -86,7 +85,7 @@ TEST_F(HlslGeneratorImplTest_ModuleConstant, Emit_SpecConstant_NoConstructor) { auto* var = create( create("pos", ast::StorageClass::kNone, &f32)); - var->set_decorations(std::move(decos)); + var->set_decorations(decos); var->set_is_const(true); ASSERT_TRUE(gen.EmitProgramConstVariable(out, var)) << gen.error(); diff --git a/src/writer/hlsl/generator_impl_return_test.cc b/src/writer/hlsl/generator_impl_return_test.cc index 75473b0b20..4744be82d7 100644 --- a/src/writer/hlsl/generator_impl_return_test.cc +++ b/src/writer/hlsl/generator_impl_return_test.cc @@ -37,7 +37,7 @@ TEST_F(HlslGeneratorImplTest_Return, Emit_Return) { TEST_F(HlslGeneratorImplTest_Return, Emit_ReturnWithValue) { auto* expr = create("expr"); - ast::ReturnStatement r(std::move(expr)); + ast::ReturnStatement r(expr); gen.increment_indent(); ASSERT_TRUE(gen.EmitStatement(out, &r)) << gen.error(); diff --git a/src/writer/hlsl/generator_impl_switch_test.cc b/src/writer/hlsl/generator_impl_switch_test.cc index 41049398fe..ab33821e76 100644 --- a/src/writer/hlsl/generator_impl_switch_test.cc +++ b/src/writer/hlsl/generator_impl_switch_test.cc @@ -33,7 +33,7 @@ using HlslGeneratorImplTest_Switch = TestHelper; TEST_F(HlslGeneratorImplTest_Switch, Emit_Switch) { auto* def_body = create(); def_body->append(create()); - auto* def = create(std::move(def_body)); + auto* def = create(def_body); ast::type::I32Type i32; ast::CaseSelectorList case_val; @@ -42,15 +42,14 @@ TEST_F(HlslGeneratorImplTest_Switch, Emit_Switch) { auto* case_body = create(); case_body->append(create()); - auto* case_stmt = - create(std::move(case_val), std::move(case_body)); + auto* case_stmt = create(case_val, case_body); ast::CaseStatementList body; - body.push_back(std::move(case_stmt)); - body.push_back(std::move(def)); + body.push_back(case_stmt); + body.push_back(def); auto* cond = create("cond"); - ast::SwitchStatement s(std::move(cond), std::move(body)); + ast::SwitchStatement s(cond, body); gen.increment_indent(); ASSERT_TRUE(gen.EmitStatement(out, &s)) << gen.error(); diff --git a/src/writer/hlsl/generator_impl_test.cc b/src/writer/hlsl/generator_impl_test.cc index 7f11b76194..f2854aaea1 100644 --- a/src/writer/hlsl/generator_impl_test.cc +++ b/src/writer/hlsl/generator_impl_test.cc @@ -31,7 +31,7 @@ TEST_F(HlslGeneratorImplTest, Generate) { ast::type::VoidType void_type; auto* func = create("my_func", ast::VariableList{}, &void_type, create()); - mod.AddFunction(std::move(func)); + mod.AddFunction(func); ASSERT_TRUE(gen.Generate(out)) << gen.error(); EXPECT_EQ(result(), R"(void my_func() { diff --git a/src/writer/hlsl/generator_impl_type_test.cc b/src/writer/hlsl/generator_impl_type_test.cc index b507f6bd63..a4ee48b937 100644 --- a/src/writer/hlsl/generator_impl_type_test.cc +++ b/src/writer/hlsl/generator_impl_type_test.cc @@ -179,12 +179,12 @@ TEST_F(HlslGeneratorImplTest_Type, EmitType_StructDecl) { ast::StructMemberDecorationList b_deco; b_deco.push_back(create(4, Source{})); - members.push_back(create("b", &f32, std::move(b_deco))); + members.push_back(create("b", &f32, b_deco)); auto* str = create(); - str->set_members(std::move(members)); + str->set_members(members); - ast::type::StructType s("S", std::move(str)); + ast::type::StructType s("S", str); ASSERT_TRUE(gen.EmitStructType(out, &s, "S")) << gen.error(); EXPECT_EQ(result(), R"(struct S { @@ -204,12 +204,12 @@ TEST_F(HlslGeneratorImplTest_Type, EmitType_Struct) { ast::StructMemberDecorationList b_deco; b_deco.push_back(create(4, Source{})); - members.push_back(create("b", &f32, std::move(b_deco))); + members.push_back(create("b", &f32, b_deco)); auto* str = create(); - str->set_members(std::move(members)); + str->set_members(members); - ast::type::StructType s("S", std::move(str)); + ast::type::StructType s("S", str); ASSERT_TRUE(gen.EmitType(out, &s, "")) << gen.error(); EXPECT_EQ(result(), "S"); @@ -223,18 +223,18 @@ TEST_F(HlslGeneratorImplTest_Type, DISABLED_EmitType_Struct_InjectPadding) { decos.push_back(create(4, Source{})); ast::StructMemberList members; - members.push_back(create("a", &i32, std::move(decos))); + members.push_back(create("a", &i32, decos)); decos.push_back(create(32, Source{})); - members.push_back(create("b", &f32, std::move(decos))); + members.push_back(create("b", &f32, decos)); decos.push_back(create(128, Source{})); - members.push_back(create("c", &f32, std::move(decos))); + members.push_back(create("c", &f32, decos)); auto* str = create(); - str->set_members(std::move(members)); + str->set_members(members); - ast::type::StructType s("S", std::move(str)); + ast::type::StructType s("S", str); ASSERT_TRUE(gen.EmitType(out, &s, "")) << gen.error(); EXPECT_EQ(result(), R"(struct { @@ -256,13 +256,12 @@ TEST_F(HlslGeneratorImplTest_Type, EmitType_Struct_NameCollision) { "double", &i32, ast::StructMemberDecorationList{})); ast::StructMemberDecorationList b_deco; - members.push_back( - create("float", &f32, std::move(b_deco))); + members.push_back(create("float", &f32, b_deco)); auto* str = create(); - str->set_members(std::move(members)); + str->set_members(members); - ast::type::StructType s("S", std::move(str)); + ast::type::StructType s("S", str); ASSERT_TRUE(gen.EmitStructType(out, &s, "S")) << gen.error(); EXPECT_EQ(result(), R"(struct S { @@ -283,14 +282,14 @@ TEST_F(HlslGeneratorImplTest_Type, DISABLED_EmitType_Struct_WithDecoration) { ast::StructMemberDecorationList b_deco; b_deco.push_back(create(4, Source{})); - members.push_back(create("b", &f32, std::move(b_deco))); + members.push_back(create("b", &f32, b_deco)); ast::StructDecorationList decos; decos.push_back(create(Source{})); - auto* str = create(std::move(decos), std::move(members)); + auto* str = create(decos, members); - ast::type::StructType s("S", std::move(str)); + ast::type::StructType s("S", str); ASSERT_TRUE(gen.EmitStructType(out, &s, "B")) << gen.error(); EXPECT_EQ(result(), R"(struct B { diff --git a/src/writer/hlsl/generator_impl_unary_op_test.cc b/src/writer/hlsl/generator_impl_unary_op_test.cc index 30b25d0c3d..7b9ed5fb7d 100644 --- a/src/writer/hlsl/generator_impl_unary_op_test.cc +++ b/src/writer/hlsl/generator_impl_unary_op_test.cc @@ -38,7 +38,7 @@ TEST_P(HlslUnaryOpTest, Emit) { auto params = GetParam(); auto* expr = create("expr"); - ast::UnaryOpExpression op(params.op, std::move(expr)); + ast::UnaryOpExpression op(params.op, expr); ASSERT_TRUE(gen.EmitExpression(pre, out, &op)) << gen.error(); EXPECT_EQ(result(), std::string(params.name) + "(expr)"); diff --git a/src/writer/hlsl/generator_impl_variable_decl_statement_test.cc b/src/writer/hlsl/generator_impl_variable_decl_statement_test.cc index f48ea87776..813cdaa58e 100644 --- a/src/writer/hlsl/generator_impl_variable_decl_statement_test.cc +++ b/src/writer/hlsl/generator_impl_variable_decl_statement_test.cc @@ -36,7 +36,7 @@ TEST_F(HlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement) { ast::type::F32Type f32; auto* var = create("a", ast::StorageClass::kNone, &f32); - ast::VariableDeclStatement stmt(std::move(var)); + ast::VariableDeclStatement stmt(var); gen.increment_indent(); ASSERT_TRUE(gen.EmitStatement(out, &stmt)) << gen.error(); @@ -48,7 +48,7 @@ TEST_F(HlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Const) { auto* var = create("a", ast::StorageClass::kNone, &f32); var->set_is_const(true); - ast::VariableDeclStatement stmt(std::move(var)); + ast::VariableDeclStatement stmt(var); gen.increment_indent(); ASSERT_TRUE(gen.EmitStatement(out, &stmt)) << gen.error(); @@ -61,7 +61,7 @@ TEST_F(HlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Array) { auto* var = create("a", ast::StorageClass::kNone, &ary); - ast::VariableDeclStatement stmt(std::move(var)); + ast::VariableDeclStatement stmt(var); gen.increment_indent(); ASSERT_TRUE(gen.EmitStatement(out, &stmt)) << gen.error(); @@ -73,7 +73,7 @@ TEST_F(HlslGeneratorImplTest_VariableDecl, ast::type::F32Type f32; auto* var = create("a", ast::StorageClass::kFunction, &f32); - ast::VariableDeclStatement stmt(std::move(var)); + ast::VariableDeclStatement stmt(var); gen.increment_indent(); ASSERT_TRUE(gen.EmitStatement(out, &stmt)) << gen.error(); @@ -84,7 +84,7 @@ TEST_F(HlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Private) { ast::type::F32Type f32; auto* var = create("a", ast::StorageClass::kPrivate, &f32); - ast::VariableDeclStatement stmt(std::move(var)); + ast::VariableDeclStatement stmt(var); gen.increment_indent(); ASSERT_TRUE(gen.EmitStatement(out, &stmt)) << gen.error(); @@ -97,9 +97,9 @@ TEST_F(HlslGeneratorImplTest_VariableDecl, ast::type::F32Type f32; auto* var = create("a", ast::StorageClass::kNone, &f32); - var->set_constructor(std::move(ident)); + var->set_constructor(ident); - ast::VariableDeclStatement stmt(std::move(var)); + ast::VariableDeclStatement stmt(var); ASSERT_TRUE(gen.EmitStatement(out, &stmt)) << gen.error(); EXPECT_EQ(result(), R"(float a = initializer; )"); @@ -111,13 +111,12 @@ TEST_F(HlslGeneratorImplTest_VariableDecl, ast::type::VectorType vec(&f32, 3); ast::ExpressionList values; - auto* zero_vec = - create(&vec, std::move(values)); + auto* zero_vec = create(&vec, values); auto* var = create("a", ast::StorageClass::kNone, &vec); - var->set_constructor(std::move(zero_vec)); + var->set_constructor(zero_vec); - ast::VariableDeclStatement stmt(std::move(var)); + ast::VariableDeclStatement stmt(var); ASSERT_TRUE(gen.EmitStatement(out, &stmt)) << gen.error(); EXPECT_EQ(result(), R"(vector a = vector(0.0f); )"); @@ -129,13 +128,12 @@ TEST_F(HlslGeneratorImplTest_VariableDecl, ast::type::MatrixType mat(&f32, 3, 2); ast::ExpressionList values; - auto* zero_mat = - create(&mat, std::move(values)); + auto* zero_mat = create(&mat, values); auto* var = create("a", ast::StorageClass::kNone, &mat); - var->set_constructor(std::move(zero_mat)); + var->set_constructor(zero_mat); - ast::VariableDeclStatement stmt(std::move(var)); + ast::VariableDeclStatement stmt(var); ASSERT_TRUE(gen.EmitStatement(out, &stmt)) << gen.error(); EXPECT_EQ( result(), diff --git a/src/writer/msl/generator_impl_alias_type_test.cc b/src/writer/msl/generator_impl_alias_type_test.cc index e7b5eff1b8..beebfc08a0 100644 --- a/src/writer/msl/generator_impl_alias_type_test.cc +++ b/src/writer/msl/generator_impl_alias_type_test.cc @@ -59,12 +59,12 @@ TEST_F(MslGeneratorImplTest, EmitConstructedType_Struct) { ast::StructMemberDecorationList b_deco; b_deco.push_back(create(4, Source{})); - members.push_back(create("b", &i32, std::move(b_deco))); + members.push_back(create("b", &i32, b_deco)); auto* str = create(); - str->set_members(std::move(members)); + str->set_members(members); - ast::type::StructType s("a", std::move(str)); + ast::type::StructType s("a", str); ASSERT_TRUE(gen.EmitConstructedType(&s)) << gen.error(); EXPECT_EQ(gen.result(), R"(struct a { @@ -84,12 +84,12 @@ TEST_F(MslGeneratorImplTest, EmitConstructedType_AliasStructIdent) { ast::StructMemberDecorationList b_deco; b_deco.push_back(create(4, Source{})); - members.push_back(create("b", &i32, std::move(b_deco))); + members.push_back(create("b", &i32, b_deco)); auto* str = create(); - str->set_members(std::move(members)); + str->set_members(members); - ast::type::StructType s("b", std::move(str)); + ast::type::StructType s("b", str); ast::type::AliasType alias("a", &s); ASSERT_TRUE(gen.EmitConstructedType(&alias)) << gen.error(); diff --git a/src/writer/msl/generator_impl_array_accessor_test.cc b/src/writer/msl/generator_impl_array_accessor_test.cc index b9e47e9f36..ee85cb9745 100644 --- a/src/writer/msl/generator_impl_array_accessor_test.cc +++ b/src/writer/msl/generator_impl_array_accessor_test.cc @@ -34,10 +34,10 @@ using MslGeneratorImplTest = TestHelper; TEST_F(MslGeneratorImplTest, EmitExpression_ArrayAccessor) { ast::type::I32Type i32; auto* lit = create(&i32, 5); - auto* idx = create(std::move(lit)); + auto* idx = create(lit); auto* ary = create("ary"); - ast::ArrayAccessorExpression expr(std::move(ary), std::move(idx)); + ast::ArrayAccessorExpression expr(ary, idx); ASSERT_TRUE(gen.EmitExpression(&expr)) << gen.error(); EXPECT_EQ(gen.result(), "ary[5]"); @@ -47,7 +47,7 @@ TEST_F(MslGeneratorImplTest, EmitArrayAccessor) { auto* ary = create("ary"); auto* idx = create("idx"); - ast::ArrayAccessorExpression expr(std::move(ary), std::move(idx)); + ast::ArrayAccessorExpression expr(ary, idx); ASSERT_TRUE(gen.EmitArrayAccessor(&expr)) << gen.error(); EXPECT_EQ(gen.result(), "ary[idx]"); diff --git a/src/writer/msl/generator_impl_assign_test.cc b/src/writer/msl/generator_impl_assign_test.cc index 00ed1fba32..eb673fecf4 100644 --- a/src/writer/msl/generator_impl_assign_test.cc +++ b/src/writer/msl/generator_impl_assign_test.cc @@ -32,7 +32,7 @@ using MslGeneratorImplTest = TestHelper; TEST_F(MslGeneratorImplTest, Emit_Assign) { auto* lhs = create("lhs"); auto* rhs = create("rhs"); - ast::AssignmentStatement assign(std::move(lhs), std::move(rhs)); + ast::AssignmentStatement assign(lhs, rhs); gen.increment_indent(); diff --git a/src/writer/msl/generator_impl_binary_test.cc b/src/writer/msl/generator_impl_binary_test.cc index ac234e8a11..62e48ade14 100644 --- a/src/writer/msl/generator_impl_binary_test.cc +++ b/src/writer/msl/generator_impl_binary_test.cc @@ -41,7 +41,7 @@ TEST_P(MslBinaryTest, Emit) { auto* left = create("left"); auto* right = create("right"); - ast::BinaryExpression expr(params.op, std::move(left), std::move(right)); + ast::BinaryExpression expr(params.op, left, right); ASSERT_TRUE(gen.EmitExpression(&expr)) << gen.error(); EXPECT_EQ(gen.result(), params.result); diff --git a/src/writer/msl/generator_impl_bitcast_test.cc b/src/writer/msl/generator_impl_bitcast_test.cc index 776311e40c..82fdcabd24 100644 --- a/src/writer/msl/generator_impl_bitcast_test.cc +++ b/src/writer/msl/generator_impl_bitcast_test.cc @@ -32,7 +32,7 @@ using MslGeneratorImplTest = TestHelper; TEST_F(MslGeneratorImplTest, EmitExpression_Bitcast) { ast::type::F32Type f32; auto* id = create("id"); - ast::BitcastExpression bitcast(&f32, std::move(id)); + ast::BitcastExpression bitcast(&f32, id); ASSERT_TRUE(gen.EmitExpression(&bitcast)) << gen.error(); EXPECT_EQ(gen.result(), "as_type(id)"); diff --git a/src/writer/msl/generator_impl_call_test.cc b/src/writer/msl/generator_impl_call_test.cc index dee21a981b..2a369389aa 100644 --- a/src/writer/msl/generator_impl_call_test.cc +++ b/src/writer/msl/generator_impl_call_test.cc @@ -35,11 +35,11 @@ TEST_F(MslGeneratorImplTest, EmitExpression_Call_WithoutParams) { ast::type::VoidType void_type; auto* id = create("my_func"); - ast::CallExpression call(std::move(id), {}); + ast::CallExpression call(id, {}); auto* func = create("my_func", ast::VariableList{}, &void_type, create()); - mod.AddFunction(std::move(func)); + mod.AddFunction(func); ASSERT_TRUE(gen.EmitExpression(&call)) << gen.error(); EXPECT_EQ(gen.result(), "my_func()"); @@ -52,11 +52,11 @@ TEST_F(MslGeneratorImplTest, EmitExpression_Call_WithParams) { ast::ExpressionList params; params.push_back(create("param1")); params.push_back(create("param2")); - ast::CallExpression call(std::move(id), std::move(params)); + ast::CallExpression call(id, params); auto* func = create("my_func", ast::VariableList{}, &void_type, create()); - mod.AddFunction(std::move(func)); + mod.AddFunction(func); ASSERT_TRUE(gen.EmitExpression(&call)) << gen.error(); EXPECT_EQ(gen.result(), "my_func(param1, param2)"); @@ -69,12 +69,11 @@ TEST_F(MslGeneratorImplTest, EmitStatement_Call) { ast::ExpressionList params; params.push_back(create("param1")); params.push_back(create("param2")); - ast::CallStatement call( - create(std::move(id), std::move(params))); + ast::CallStatement call(create(id, params)); auto* func = create("my_func", ast::VariableList{}, &void_type, create()); - mod.AddFunction(std::move(func)); + mod.AddFunction(func); gen.increment_indent(); ASSERT_TRUE(gen.EmitStatement(&call)) << gen.error(); diff --git a/src/writer/msl/generator_impl_case_test.cc b/src/writer/msl/generator_impl_case_test.cc index 7419f16d94..72d07a91ac 100644 --- a/src/writer/msl/generator_impl_case_test.cc +++ b/src/writer/msl/generator_impl_case_test.cc @@ -40,7 +40,7 @@ TEST_F(MslGeneratorImplTest, Emit_Case) { ast::CaseSelectorList lit; lit.push_back(create(&i32, 5)); - ast::CaseStatement c(std::move(lit), std::move(body)); + ast::CaseStatement c(lit, body); gen.increment_indent(); @@ -56,7 +56,7 @@ TEST_F(MslGeneratorImplTest, Emit_Case_BreaksByDefault) { ast::CaseSelectorList lit; lit.push_back(create(&i32, 5)); - ast::CaseStatement c(std::move(lit), create()); + ast::CaseStatement c(lit, create()); gen.increment_indent(); @@ -75,7 +75,7 @@ TEST_F(MslGeneratorImplTest, Emit_Case_WithFallthrough) { ast::CaseSelectorList lit; lit.push_back(create(&i32, 5)); - ast::CaseStatement c(std::move(lit), std::move(body)); + ast::CaseStatement c(lit, body); gen.increment_indent(); @@ -95,7 +95,7 @@ TEST_F(MslGeneratorImplTest, Emit_Case_MultipleSelectors) { ast::CaseSelectorList lit; lit.push_back(create(&i32, 5)); lit.push_back(create(&i32, 6)); - ast::CaseStatement c(std::move(lit), std::move(body)); + ast::CaseStatement c(lit, body); gen.increment_indent(); @@ -110,7 +110,7 @@ TEST_F(MslGeneratorImplTest, Emit_Case_MultipleSelectors) { TEST_F(MslGeneratorImplTest, Emit_Case_Default) { auto* body = create(); body->append(create()); - ast::CaseStatement c(std::move(body)); + ast::CaseStatement c(body); gen.increment_indent(); diff --git a/src/writer/msl/generator_impl_cast_test.cc b/src/writer/msl/generator_impl_cast_test.cc index eefa7a33f1..05b4fed444 100644 --- a/src/writer/msl/generator_impl_cast_test.cc +++ b/src/writer/msl/generator_impl_cast_test.cc @@ -36,7 +36,7 @@ TEST_F(MslGeneratorImplTest, EmitExpression_Cast_Scalar) { ast::ExpressionList params; params.push_back(create("id")); - ast::TypeConstructorExpression cast(&f32, std::move(params)); + ast::TypeConstructorExpression cast(&f32, params); ASSERT_TRUE(gen.EmitExpression(&cast)) << gen.error(); EXPECT_EQ(gen.result(), "float(id)"); @@ -49,7 +49,7 @@ TEST_F(MslGeneratorImplTest, EmitExpression_Cast_Vector) { ast::ExpressionList params; params.push_back(create("id")); - ast::TypeConstructorExpression cast(&vec3, std::move(params)); + ast::TypeConstructorExpression cast(&vec3, params); ASSERT_TRUE(gen.EmitExpression(&cast)) << gen.error(); EXPECT_EQ(gen.result(), "float3(id)"); diff --git a/src/writer/msl/generator_impl_constructor_test.cc b/src/writer/msl/generator_impl_constructor_test.cc index 41a8b75b93..27c8ec12c2 100644 --- a/src/writer/msl/generator_impl_constructor_test.cc +++ b/src/writer/msl/generator_impl_constructor_test.cc @@ -40,7 +40,7 @@ using MslGeneratorImplTest = TestHelper; TEST_F(MslGeneratorImplTest, EmitConstructor_Bool) { ast::type::BoolType bool_type; auto* lit = create(&bool_type, false); - ast::ScalarConstructorExpression expr(std::move(lit)); + ast::ScalarConstructorExpression expr(lit); ASSERT_TRUE(gen.EmitConstructor(&expr)) << gen.error(); EXPECT_EQ(gen.result(), "false"); @@ -49,7 +49,7 @@ TEST_F(MslGeneratorImplTest, EmitConstructor_Bool) { TEST_F(MslGeneratorImplTest, EmitConstructor_Int) { ast::type::I32Type i32; auto* lit = create(&i32, -12345); - ast::ScalarConstructorExpression expr(std::move(lit)); + ast::ScalarConstructorExpression expr(lit); ASSERT_TRUE(gen.EmitConstructor(&expr)) << gen.error(); EXPECT_EQ(gen.result(), "-12345"); @@ -58,7 +58,7 @@ TEST_F(MslGeneratorImplTest, EmitConstructor_Int) { TEST_F(MslGeneratorImplTest, EmitConstructor_UInt) { ast::type::U32Type u32; auto* lit = create(&u32, 56779); - ast::ScalarConstructorExpression expr(std::move(lit)); + ast::ScalarConstructorExpression expr(lit); ASSERT_TRUE(gen.EmitConstructor(&expr)) << gen.error(); EXPECT_EQ(gen.result(), "56779u"); @@ -69,7 +69,7 @@ TEST_F(MslGeneratorImplTest, EmitConstructor_Float) { // Use a number close to 1<<30 but whose decimal representation ends in 0. auto* lit = create(&f32, static_cast((1 << 30) - 4)); - ast::ScalarConstructorExpression expr(std::move(lit)); + ast::ScalarConstructorExpression expr(lit); ASSERT_TRUE(gen.EmitConstructor(&expr)) << gen.error(); EXPECT_EQ(gen.result(), "1.07374182e+09f"); @@ -80,9 +80,9 @@ TEST_F(MslGeneratorImplTest, EmitConstructor_Type_Float) { auto* lit = create(&f32, -1.2e-5); ast::ExpressionList values; - values.push_back(create(std::move(lit))); + values.push_back(create(lit)); - ast::TypeConstructorExpression expr(&f32, std::move(values)); + ast::TypeConstructorExpression expr(&f32, values); ASSERT_TRUE(gen.EmitConstructor(&expr)) << gen.error(); EXPECT_EQ(gen.result(), "float(-1.20000004e-05f)"); @@ -93,9 +93,9 @@ TEST_F(MslGeneratorImplTest, EmitConstructor_Type_Bool) { auto* lit = create(&b, true); ast::ExpressionList values; - values.push_back(create(std::move(lit))); + values.push_back(create(lit)); - ast::TypeConstructorExpression expr(&b, std::move(values)); + ast::TypeConstructorExpression expr(&b, values); ASSERT_TRUE(gen.EmitConstructor(&expr)) << gen.error(); EXPECT_EQ(gen.result(), "bool(true)"); @@ -106,9 +106,9 @@ TEST_F(MslGeneratorImplTest, EmitConstructor_Type_Int) { auto* lit = create(&i32, -12345); ast::ExpressionList values; - values.push_back(create(std::move(lit))); + values.push_back(create(lit)); - ast::TypeConstructorExpression expr(&i32, std::move(values)); + ast::TypeConstructorExpression expr(&i32, values); ASSERT_TRUE(gen.EmitConstructor(&expr)) << gen.error(); EXPECT_EQ(gen.result(), "int(-12345)"); @@ -119,9 +119,9 @@ TEST_F(MslGeneratorImplTest, EmitConstructor_Type_Uint) { auto* lit = create(&u32, 12345); ast::ExpressionList values; - values.push_back(create(std::move(lit))); + values.push_back(create(lit)); - ast::TypeConstructorExpression expr(&u32, std::move(values)); + ast::TypeConstructorExpression expr(&u32, values); ASSERT_TRUE(gen.EmitConstructor(&expr)) << gen.error(); EXPECT_EQ(gen.result(), "uint(12345u)"); @@ -135,11 +135,11 @@ TEST_F(MslGeneratorImplTest, EmitConstructor_Type_Vec) { auto* lit2 = create(&f32, 2.f); auto* lit3 = create(&f32, 3.f); ast::ExpressionList values; - values.push_back(create(std::move(lit1))); - values.push_back(create(std::move(lit2))); - values.push_back(create(std::move(lit3))); + values.push_back(create(lit1)); + values.push_back(create(lit2)); + values.push_back(create(lit3)); - ast::TypeConstructorExpression expr(&vec, std::move(values)); + ast::TypeConstructorExpression expr(&vec, values); ASSERT_TRUE(gen.EmitConstructor(&expr)) << gen.error(); EXPECT_EQ(gen.result(), "float3(1.00000000f, 2.00000000f, 3.00000000f)"); @@ -150,7 +150,7 @@ TEST_F(MslGeneratorImplTest, EmitConstructor_Type_Vec_Empty) { ast::type::VectorType vec(&f32, 3); ast::ExpressionList values; - ast::TypeConstructorExpression expr(&vec, std::move(values)); + ast::TypeConstructorExpression expr(&vec, values); ASSERT_TRUE(gen.EmitConstructor(&expr)) << gen.error(); EXPECT_EQ(gen.result(), "float3(0.0f)"); @@ -175,15 +175,14 @@ TEST_F(MslGeneratorImplTest, EmitConstructor_Type_Mat) { create(&f32, static_cast(3 + (i * 2))); ast::ExpressionList values; - values.push_back(create(std::move(lit1))); - values.push_back(create(std::move(lit2))); - values.push_back(create(std::move(lit3))); + values.push_back(create(lit1)); + values.push_back(create(lit2)); + values.push_back(create(lit3)); - mat_values.push_back( - create(&vec, std::move(values))); + mat_values.push_back(create(&vec, values)); } - ast::TypeConstructorExpression expr(&mat, std::move(mat_values)); + ast::TypeConstructorExpression expr(&mat, mat_values); ASSERT_TRUE(gen.EmitConstructor(&expr)) << gen.error(); // A matrix of type T with n columns and m rows can also be constructed from @@ -210,15 +209,14 @@ TEST_F(MslGeneratorImplTest, EmitConstructor_Type_Array) { create(&f32, static_cast(3 + (i * 3))); ast::ExpressionList values; - values.push_back(create(std::move(lit1))); - values.push_back(create(std::move(lit2))); - values.push_back(create(std::move(lit3))); + values.push_back(create(lit1)); + values.push_back(create(lit2)); + values.push_back(create(lit3)); - ary_values.push_back( - create(&vec, std::move(values))); + ary_values.push_back(create(&vec, values)); } - ast::TypeConstructorExpression expr(&ary, std::move(ary_values)); + ast::TypeConstructorExpression expr(&ary, ary_values); ASSERT_TRUE(gen.EmitConstructor(&expr)) << gen.error(); EXPECT_EQ(gen.result(), std::string("{") + diff --git a/src/writer/msl/generator_impl_function_entry_point_data_test.cc b/src/writer/msl/generator_impl_function_entry_point_data_test.cc index 36526979d4..492ffc8998 100644 --- a/src/writer/msl/generator_impl_function_entry_point_data_test.cc +++ b/src/writer/msl/generator_impl_function_entry_point_data_test.cc @@ -54,21 +54,17 @@ TEST_F(MslGeneratorImplTest, Emit_Function_EntryPointData_Vertex_Input) { auto* foo_var = create( create("foo", ast::StorageClass::kInput, &f32)); - - ast::VariableDecorationList decos; - decos.push_back(create(0, Source{})); - foo_var->set_decorations(std::move(decos)); + foo_var->set_decorations({create(0, Source{})}); auto* bar_var = create( create("bar", ast::StorageClass::kInput, &i32)); - decos.push_back(create(1, Source{})); - bar_var->set_decorations(std::move(decos)); + bar_var->set_decorations({create(1, Source{})}); td.RegisterVariableForTesting(foo_var); td.RegisterVariableForTesting(bar_var); - mod.AddGlobalVariable(std::move(foo_var)); - mod.AddGlobalVariable(std::move(bar_var)); + mod.AddGlobalVariable(foo_var); + mod.AddGlobalVariable(bar_var); ast::VariableList params; auto* body = create(); @@ -79,17 +75,15 @@ TEST_F(MslGeneratorImplTest, Emit_Function_EntryPointData_Vertex_Input) { create("bar"), create("bar"))); - auto* func = create("vtx_main", std::move(params), &f32, - std::move(body)); + auto* func = create("vtx_main", params, &f32, body); func->add_decoration( create(ast::PipelineStage::kVertex, Source{})); - auto* func_ptr = func; - mod.AddFunction(std::move(func)); + mod.AddFunction(func); ASSERT_TRUE(td.Determine()) << td.error(); - ASSERT_TRUE(gen.EmitEntryPointData(func_ptr)) << gen.error(); + ASSERT_TRUE(gen.EmitEntryPointData(func)) << gen.error(); EXPECT_EQ(gen.result(), R"(struct vtx_main_in { float foo [[attribute(0)]]; int bar [[attribute(1)]]; @@ -112,21 +106,17 @@ TEST_F(MslGeneratorImplTest, Emit_Function_EntryPointData_Vertex_Output) { auto* foo_var = create( create("foo", ast::StorageClass::kOutput, &f32)); - - ast::VariableDecorationList decos; - decos.push_back(create(0, Source{})); - foo_var->set_decorations(std::move(decos)); + foo_var->set_decorations({create(0, Source{})}); auto* bar_var = create( create("bar", ast::StorageClass::kOutput, &i32)); - decos.push_back(create(1, Source{})); - bar_var->set_decorations(std::move(decos)); + bar_var->set_decorations({create(1, Source{})}); td.RegisterVariableForTesting(foo_var); td.RegisterVariableForTesting(bar_var); - mod.AddGlobalVariable(std::move(foo_var)); - mod.AddGlobalVariable(std::move(bar_var)); + mod.AddGlobalVariable(foo_var); + mod.AddGlobalVariable(bar_var); ast::VariableList params; auto* body = create(); @@ -137,17 +127,15 @@ TEST_F(MslGeneratorImplTest, Emit_Function_EntryPointData_Vertex_Output) { create("bar"), create("bar"))); - auto* func = create("vtx_main", std::move(params), &f32, - std::move(body)); + auto* func = create("vtx_main", params, &f32, body); func->add_decoration( create(ast::PipelineStage::kVertex, Source{})); - auto* func_ptr = func; - mod.AddFunction(std::move(func)); + mod.AddFunction(func); ASSERT_TRUE(td.Determine()) << td.error(); - ASSERT_TRUE(gen.EmitEntryPointData(func_ptr)) << gen.error(); + ASSERT_TRUE(gen.EmitEntryPointData(func)) << gen.error(); EXPECT_EQ(gen.result(), R"(struct vtx_main_out { float foo [[user(locn0)]]; int bar [[user(locn1)]]; @@ -170,21 +158,17 @@ TEST_F(MslGeneratorImplTest, Emit_Function_EntryPointData_Fragment_Input) { auto* foo_var = create( create("foo", ast::StorageClass::kInput, &f32)); - - ast::VariableDecorationList decos; - decos.push_back(create(0, Source{})); - foo_var->set_decorations(std::move(decos)); + foo_var->set_decorations({create(0, Source{})}); auto* bar_var = create( create("bar", ast::StorageClass::kInput, &i32)); - decos.push_back(create(1, Source{})); - bar_var->set_decorations(std::move(decos)); + bar_var->set_decorations({create(1, Source{})}); td.RegisterVariableForTesting(foo_var); td.RegisterVariableForTesting(bar_var); - mod.AddGlobalVariable(std::move(foo_var)); - mod.AddGlobalVariable(std::move(bar_var)); + mod.AddGlobalVariable(foo_var); + mod.AddGlobalVariable(bar_var); ast::VariableList params; auto* body = create(); @@ -194,17 +178,15 @@ TEST_F(MslGeneratorImplTest, Emit_Function_EntryPointData_Fragment_Input) { body->append(create( create("bar"), create("bar"))); - auto* func = - create("main", std::move(params), &f32, std::move(body)); + auto* func = create("main", params, &f32, body); func->add_decoration( create(ast::PipelineStage::kFragment, Source{})); - auto* func_ptr = func; - mod.AddFunction(std::move(func)); + mod.AddFunction(func); ASSERT_TRUE(td.Determine()) << td.error(); - ASSERT_TRUE(gen.EmitEntryPointData(func_ptr)) << gen.error(); + ASSERT_TRUE(gen.EmitEntryPointData(func)) << gen.error(); EXPECT_EQ(gen.result(), R"(struct main_in { float foo [[user(locn0)]]; int bar [[user(locn1)]]; @@ -227,21 +209,17 @@ TEST_F(MslGeneratorImplTest, Emit_Function_EntryPointData_Fragment_Output) { auto* foo_var = create( create("foo", ast::StorageClass::kOutput, &f32)); - - ast::VariableDecorationList decos; - decos.push_back(create(0, Source{})); - foo_var->set_decorations(std::move(decos)); + foo_var->set_decorations({create(0, Source{})}); auto* bar_var = create( create("bar", ast::StorageClass::kOutput, &i32)); - decos.push_back(create(1, Source{})); - bar_var->set_decorations(std::move(decos)); + bar_var->set_decorations({create(1, Source{})}); td.RegisterVariableForTesting(foo_var); td.RegisterVariableForTesting(bar_var); - mod.AddGlobalVariable(std::move(foo_var)); - mod.AddGlobalVariable(std::move(bar_var)); + mod.AddGlobalVariable(foo_var); + mod.AddGlobalVariable(bar_var); ast::VariableList params; auto* body = create(); @@ -252,17 +230,15 @@ TEST_F(MslGeneratorImplTest, Emit_Function_EntryPointData_Fragment_Output) { create("bar"), create("bar"))); - auto* func = - create("main", std::move(params), &f32, std::move(body)); + auto* func = create("main", params, &f32, body); func->add_decoration( create(ast::PipelineStage::kFragment, Source{})); - auto* func_ptr = func; - mod.AddFunction(std::move(func)); + mod.AddFunction(func); ASSERT_TRUE(td.Determine()) << td.error(); - ASSERT_TRUE(gen.EmitEntryPointData(func_ptr)) << gen.error(); + ASSERT_TRUE(gen.EmitEntryPointData(func)) << gen.error(); EXPECT_EQ(gen.result(), R"(struct main_out { float foo [[color(0)]]; int bar [[color(1)]]; @@ -285,18 +261,18 @@ TEST_F(MslGeneratorImplTest, Emit_Function_EntryPointData_Compute_Input) { ast::VariableDecorationList decos; decos.push_back(create(0, Source{})); - foo_var->set_decorations(std::move(decos)); + foo_var->set_decorations(decos); auto* bar_var = create( create("bar", ast::StorageClass::kInput, &i32)); decos.push_back(create(1, Source{})); - bar_var->set_decorations(std::move(decos)); + bar_var->set_decorations(decos); td.RegisterVariableForTesting(foo_var); td.RegisterVariableForTesting(bar_var); - mod.AddGlobalVariable(std::move(foo_var)); - mod.AddGlobalVariable(std::move(bar_var)); + mod.AddGlobalVariable(foo_var); + mod.AddGlobalVariable(bar_var); ast::VariableList params; auto* body = create(); @@ -307,17 +283,15 @@ TEST_F(MslGeneratorImplTest, Emit_Function_EntryPointData_Compute_Input) { create("bar"), create("bar"))); - auto* func = - create("main", std::move(params), &f32, std::move(body)); + auto* func = create("main", params, &f32, body); func->add_decoration( create(ast::PipelineStage::kCompute, Source{})); - auto* func_ptr = func; - mod.AddFunction(std::move(func)); + mod.AddFunction(func); ASSERT_TRUE(td.Determine()) << td.error(); - ASSERT_FALSE(gen.EmitEntryPointData(func_ptr)) << gen.error(); + ASSERT_FALSE(gen.EmitEntryPointData(func)) << gen.error(); EXPECT_EQ(gen.error(), R"(invalid location variable for pipeline stage)"); } @@ -335,18 +309,18 @@ TEST_F(MslGeneratorImplTest, Emit_Function_EntryPointData_Compute_Output) { ast::VariableDecorationList decos; decos.push_back(create(0, Source{})); - foo_var->set_decorations(std::move(decos)); + foo_var->set_decorations(decos); auto* bar_var = create( create("bar", ast::StorageClass::kOutput, &i32)); decos.push_back(create(1, Source{})); - bar_var->set_decorations(std::move(decos)); + bar_var->set_decorations(decos); td.RegisterVariableForTesting(foo_var); td.RegisterVariableForTesting(bar_var); - mod.AddGlobalVariable(std::move(foo_var)); - mod.AddGlobalVariable(std::move(bar_var)); + mod.AddGlobalVariable(foo_var); + mod.AddGlobalVariable(bar_var); ast::VariableList params; auto* body = create(); @@ -357,17 +331,15 @@ TEST_F(MslGeneratorImplTest, Emit_Function_EntryPointData_Compute_Output) { create("bar"), create("bar"))); - auto* func = - create("main", std::move(params), &f32, std::move(body)); + auto* func = create("main", params, &f32, body); func->add_decoration( create(ast::PipelineStage::kCompute, Source{})); - auto* func_ptr = func; - mod.AddFunction(std::move(func)); + mod.AddFunction(func); ASSERT_TRUE(td.Determine()) << td.error(); - ASSERT_FALSE(gen.EmitEntryPointData(func_ptr)) << gen.error(); + ASSERT_FALSE(gen.EmitEntryPointData(func)) << gen.error(); EXPECT_EQ(gen.error(), R"(invalid location variable for pipeline stage)"); } @@ -388,23 +360,19 @@ TEST_F(MslGeneratorImplTest, Emit_Function_EntryPointData_Builtins) { auto* coord_var = create( create("coord", ast::StorageClass::kInput, &vec4)); - - ast::VariableDecorationList decos; - decos.push_back( - create(ast::Builtin::kFragCoord, Source{})); - coord_var->set_decorations(std::move(decos)); + coord_var->set_decorations( + {create(ast::Builtin::kFragCoord, Source{})}); auto* depth_var = create( create("depth", ast::StorageClass::kOutput, &f32)); - decos.push_back( - create(ast::Builtin::kFragDepth, Source{})); - depth_var->set_decorations(std::move(decos)); + depth_var->set_decorations( + {create(ast::Builtin::kFragDepth, Source{})}); td.RegisterVariableForTesting(coord_var); td.RegisterVariableForTesting(depth_var); - mod.AddGlobalVariable(std::move(coord_var)); - mod.AddGlobalVariable(std::move(depth_var)); + mod.AddGlobalVariable(coord_var); + mod.AddGlobalVariable(depth_var); ast::VariableList params; @@ -415,17 +383,15 @@ TEST_F(MslGeneratorImplTest, Emit_Function_EntryPointData_Builtins) { create("coord"), create("x")))); - auto* func = create("main", std::move(params), &void_type, - std::move(body)); + auto* func = create("main", params, &void_type, body); func->add_decoration( create(ast::PipelineStage::kFragment, Source{})); - auto* func_ptr = func; - mod.AddFunction(std::move(func)); + mod.AddFunction(func); ASSERT_TRUE(td.Determine()) << td.error(); - ASSERT_TRUE(gen.EmitEntryPointData(func_ptr)) << gen.error(); + ASSERT_TRUE(gen.EmitEntryPointData(func)) << gen.error(); EXPECT_EQ(gen.result(), R"(struct main_out { float depth [[depth(any)]]; }; diff --git a/src/writer/msl/generator_impl_function_test.cc b/src/writer/msl/generator_impl_function_test.cc index 7a2ae425b0..5828ee2788 100644 --- a/src/writer/msl/generator_impl_function_test.cc +++ b/src/writer/msl/generator_impl_function_test.cc @@ -62,10 +62,10 @@ TEST_F(MslGeneratorImplTest, Emit_Function) { auto* body = create(); body->append(create()); - auto* func = create("my_func", ast::VariableList{}, &void_type, - std::move(body)); + auto* func = + create("my_func", ast::VariableList{}, &void_type, body); - mod.AddFunction(std::move(func)); + mod.AddFunction(func); gen.increment_indent(); ASSERT_TRUE(gen.Generate()) << gen.error(); @@ -83,10 +83,10 @@ TEST_F(MslGeneratorImplTest, Emit_Function_Name_Collision) { auto* body = create(); body->append(create()); - auto* func = create("main", ast::VariableList{}, &void_type, - std::move(body)); + auto* func = + create("main", ast::VariableList{}, &void_type, body); - mod.AddFunction(std::move(func)); + mod.AddFunction(func); gen.increment_indent(); ASSERT_TRUE(gen.Generate()) << gen.error(); @@ -111,10 +111,9 @@ TEST_F(MslGeneratorImplTest, Emit_Function_WithParams) { auto* body = create(); body->append(create()); - auto* func = create("my_func", std::move(params), &void_type, - std::move(body)); + auto* func = create("my_func", params, &void_type, body); - mod.AddFunction(std::move(func)); + mod.AddFunction(func); gen.increment_indent(); ASSERT_TRUE(gen.Generate()) << gen.error(); @@ -133,21 +132,17 @@ TEST_F(MslGeneratorImplTest, Emit_FunctionDecoration_EntryPoint_WithInOutVars) { auto* foo_var = create( create("foo", ast::StorageClass::kInput, &f32)); - - ast::VariableDecorationList decos; - decos.push_back(create(0, Source{})); - foo_var->set_decorations(std::move(decos)); + foo_var->set_decorations({create(0, Source{})}); auto* bar_var = create( create("bar", ast::StorageClass::kOutput, &f32)); - decos.push_back(create(1, Source{})); - bar_var->set_decorations(std::move(decos)); + bar_var->set_decorations({create(1, Source{})}); td.RegisterVariableForTesting(foo_var); td.RegisterVariableForTesting(bar_var); - mod.AddGlobalVariable(std::move(foo_var)); - mod.AddGlobalVariable(std::move(bar_var)); + mod.AddGlobalVariable(foo_var); + mod.AddGlobalVariable(bar_var); ast::VariableList params; auto* body = create(); @@ -156,12 +151,11 @@ TEST_F(MslGeneratorImplTest, Emit_FunctionDecoration_EntryPoint_WithInOutVars) { create("foo"))); body->append(create()); - auto* func = create("frag_main", std::move(params), &void_type, - std::move(body)); + auto* func = create("frag_main", params, &void_type, body); func->add_decoration( create(ast::PipelineStage::kFragment, Source{})); - mod.AddFunction(std::move(func)); + mod.AddFunction(func); ASSERT_TRUE(td.Determine()) << td.error(); @@ -193,23 +187,19 @@ TEST_F(MslGeneratorImplTest, auto* coord_var = create( create("coord", ast::StorageClass::kInput, &vec4)); - - ast::VariableDecorationList decos; - decos.push_back( - create(ast::Builtin::kFragCoord, Source{})); - coord_var->set_decorations(std::move(decos)); + coord_var->set_decorations( + {create(ast::Builtin::kFragCoord, Source{})}); auto* depth_var = create( create("depth", ast::StorageClass::kOutput, &f32)); - decos.push_back( - create(ast::Builtin::kFragDepth, Source{})); - depth_var->set_decorations(std::move(decos)); + depth_var->set_decorations( + {create(ast::Builtin::kFragDepth, Source{})}); td.RegisterVariableForTesting(coord_var); td.RegisterVariableForTesting(depth_var); - mod.AddGlobalVariable(std::move(coord_var)); - mod.AddGlobalVariable(std::move(depth_var)); + mod.AddGlobalVariable(coord_var); + mod.AddGlobalVariable(depth_var); ast::VariableList params; auto* body = create(); @@ -220,12 +210,11 @@ TEST_F(MslGeneratorImplTest, create("x")))); body->append(create()); - auto* func = create("frag_main", std::move(params), &void_type, - std::move(body)); + auto* func = create("frag_main", params, &void_type, body); func->add_decoration( create(ast::PipelineStage::kFragment, Source{})); - mod.AddFunction(std::move(func)); + mod.AddFunction(func); ASSERT_TRUE(td.Determine()) << td.error(); @@ -256,11 +245,11 @@ TEST_F(MslGeneratorImplTest, Emit_FunctionDecoration_EntryPoint_With_Uniform) { ast::VariableDecorationList decos; decos.push_back(create(0, Source{})); decos.push_back(create(1, Source{})); - coord_var->set_decorations(std::move(decos)); + coord_var->set_decorations(decos); td.RegisterVariableForTesting(coord_var); - mod.AddGlobalVariable(std::move(coord_var)); + mod.AddGlobalVariable(coord_var); ast::VariableList params; auto* var = create("v", ast::StorageClass::kFunction, &f32); @@ -269,15 +258,14 @@ TEST_F(MslGeneratorImplTest, Emit_FunctionDecoration_EntryPoint_With_Uniform) { create("x"))); auto* body = create(); - body->append(create(std::move(var))); + body->append(create(var)); body->append(create()); - auto* func = create("frag_main", std::move(params), &void_type, - std::move(body)); + auto* func = create("frag_main", params, &void_type, body); func->add_decoration( create(ast::PipelineStage::kFragment, Source{})); - mod.AddFunction(std::move(func)); + mod.AddFunction(func); ASSERT_TRUE(td.Determine()) << td.error(); @@ -301,16 +289,16 @@ TEST_F(MslGeneratorImplTest, ast::StructMemberList members; ast::StructMemberDecorationList a_deco; a_deco.push_back(create(0, Source{})); - members.push_back(create("a", &i32, std::move(a_deco))); + members.push_back(create("a", &i32, a_deco)); ast::StructMemberDecorationList b_deco; b_deco.push_back(create(4, Source{})); - members.push_back(create("b", &f32, std::move(b_deco))); + members.push_back(create("b", &f32, b_deco)); auto* str = create(); - str->set_members(std::move(members)); + str->set_members(members); - ast::type::StructType s("Data", std::move(str)); + ast::type::StructType s("Data", str); ast::type::AccessControlType ac(ast::AccessControl::kReadWrite, &s); mod.AddConstructedType(&s); @@ -321,11 +309,11 @@ TEST_F(MslGeneratorImplTest, ast::VariableDecorationList decos; decos.push_back(create(0, Source{})); decos.push_back(create(1, Source{})); - coord_var->set_decorations(std::move(decos)); + coord_var->set_decorations(decos); td.RegisterVariableForTesting(coord_var); - mod.AddGlobalVariable(std::move(coord_var)); + mod.AddGlobalVariable(coord_var); ast::VariableList params; auto* var = create("v", ast::StorageClass::kFunction, &f32); @@ -334,15 +322,14 @@ TEST_F(MslGeneratorImplTest, create("b"))); auto* body = create(); - body->append(create(std::move(var))); + body->append(create(var)); body->append(create()); - auto* func = create("frag_main", std::move(params), &void_type, - std::move(body)); + auto* func = create("frag_main", params, &void_type, body); func->add_decoration( create(ast::PipelineStage::kFragment, Source{})); - mod.AddFunction(std::move(func)); + mod.AddFunction(func); ASSERT_TRUE(td.Determine()) << td.error(); ASSERT_TRUE(gen.Generate()) << gen.error(); @@ -370,16 +357,16 @@ TEST_F(MslGeneratorImplTest, ast::StructMemberList members; ast::StructMemberDecorationList a_deco; a_deco.push_back(create(0, Source{})); - members.push_back(create("a", &i32, std::move(a_deco))); + members.push_back(create("a", &i32, a_deco)); ast::StructMemberDecorationList b_deco; b_deco.push_back(create(4, Source{})); - members.push_back(create("b", &f32, std::move(b_deco))); + members.push_back(create("b", &f32, b_deco)); auto* str = create(); - str->set_members(std::move(members)); + str->set_members(members); - ast::type::StructType s("Data", std::move(str)); + ast::type::StructType s("Data", str); ast::type::AccessControlType ac(ast::AccessControl::kReadOnly, &s); mod.AddConstructedType(&s); @@ -390,11 +377,11 @@ TEST_F(MslGeneratorImplTest, ast::VariableDecorationList decos; decos.push_back(create(0, Source{})); decos.push_back(create(1, Source{})); - coord_var->set_decorations(std::move(decos)); + coord_var->set_decorations(decos); td.RegisterVariableForTesting(coord_var); - mod.AddGlobalVariable(std::move(coord_var)); + mod.AddGlobalVariable(coord_var); ast::VariableList params; @@ -404,15 +391,14 @@ TEST_F(MslGeneratorImplTest, create("b"))); auto* body = create(); - body->append(create(std::move(var))); + body->append(create(var)); body->append(create()); - auto* func = create("frag_main", std::move(params), &void_type, - std::move(body)); + auto* func = create("frag_main", params, &void_type, body); func->add_decoration( create(ast::PipelineStage::kFragment, Source{})); - mod.AddFunction(std::move(func)); + mod.AddFunction(func); ASSERT_TRUE(td.Determine()) << td.error(); @@ -440,28 +426,23 @@ TEST_F( auto* foo_var = create( create("foo", ast::StorageClass::kInput, &f32)); - - ast::VariableDecorationList decos; - decos.push_back(create(0, Source{})); - foo_var->set_decorations(std::move(decos)); + foo_var->set_decorations({create(0, Source{})}); auto* bar_var = create( create("bar", ast::StorageClass::kOutput, &f32)); - decos.push_back(create(1, Source{})); - bar_var->set_decorations(std::move(decos)); + bar_var->set_decorations({create(1, Source{})}); auto* val_var = create( create("val", ast::StorageClass::kOutput, &f32)); - decos.push_back(create(0, Source{})); - val_var->set_decorations(std::move(decos)); + val_var->set_decorations({create(0, Source{})}); td.RegisterVariableForTesting(foo_var); td.RegisterVariableForTesting(bar_var); td.RegisterVariableForTesting(val_var); - mod.AddGlobalVariable(std::move(foo_var)); - mod.AddGlobalVariable(std::move(bar_var)); - mod.AddGlobalVariable(std::move(val_var)); + mod.AddGlobalVariable(foo_var); + mod.AddGlobalVariable(bar_var); + mod.AddGlobalVariable(val_var); ast::VariableList params; params.push_back( @@ -476,10 +457,9 @@ TEST_F( create("param"))); body->append( create(create("foo"))); - auto* sub_func = create("sub_func", std::move(params), &f32, - std::move(body)); + auto* sub_func = create("sub_func", params, &f32, body); - mod.AddFunction(std::move(sub_func)); + mod.AddFunction(sub_func); ast::ExpressionList expr; expr.push_back(create( @@ -489,14 +469,13 @@ TEST_F( body->append(create( create("bar"), create(create("sub_func"), - std::move(expr)))); + expr))); body->append(create()); - auto* func_1 = create("ep_1", std::move(params), &void_type, - std::move(body)); + auto* func_1 = create("ep_1", params, &void_type, body); func_1->add_decoration( create(ast::PipelineStage::kFragment, Source{})); - mod.AddFunction(std::move(func_1)); + mod.AddFunction(func_1); ASSERT_TRUE(td.Determine()) << td.error(); @@ -539,11 +518,11 @@ TEST_F(MslGeneratorImplTest, ast::VariableDecorationList decos; decos.push_back( create(ast::Builtin::kFragDepth, Source{})); - depth_var->set_decorations(std::move(decos)); + depth_var->set_decorations(decos); td.RegisterVariableForTesting(depth_var); - mod.AddGlobalVariable(std::move(depth_var)); + mod.AddGlobalVariable(depth_var); ast::VariableList params; params.push_back( @@ -552,10 +531,9 @@ TEST_F(MslGeneratorImplTest, auto* body = create(); body->append( create(create("param"))); - auto* sub_func = create("sub_func", std::move(params), &f32, - std::move(body)); + auto* sub_func = create("sub_func", params, &f32, body); - mod.AddFunction(std::move(sub_func)); + mod.AddFunction(sub_func); ast::ExpressionList expr; expr.push_back(create( @@ -565,15 +543,14 @@ TEST_F(MslGeneratorImplTest, body->append(create( create("depth"), create(create("sub_func"), - std::move(expr)))); + expr))); body->append(create()); - auto* func_1 = create("ep_1", std::move(params), &void_type, - std::move(body)); + auto* func_1 = create("ep_1", params, &void_type, body); func_1->add_decoration( create(ast::PipelineStage::kFragment, Source{})); - mod.AddFunction(std::move(func_1)); + mod.AddFunction(func_1); ASSERT_TRUE(td.Determine()) << td.error(); @@ -606,23 +583,19 @@ TEST_F( auto* coord_var = create( create("coord", ast::StorageClass::kInput, &vec4)); - - ast::VariableDecorationList decos; - decos.push_back( - create(ast::Builtin::kFragCoord, Source{})); - coord_var->set_decorations(std::move(decos)); + coord_var->set_decorations( + {create(ast::Builtin::kFragCoord, Source{})}); auto* depth_var = create( create("depth", ast::StorageClass::kOutput, &f32)); - decos.push_back( - create(ast::Builtin::kFragDepth, Source{})); - depth_var->set_decorations(std::move(decos)); + depth_var->set_decorations( + {create(ast::Builtin::kFragDepth, Source{})}); td.RegisterVariableForTesting(coord_var); td.RegisterVariableForTesting(depth_var); - mod.AddGlobalVariable(std::move(coord_var)); - mod.AddGlobalVariable(std::move(depth_var)); + mod.AddGlobalVariable(coord_var); + mod.AddGlobalVariable(depth_var); ast::VariableList params; params.push_back( @@ -636,10 +609,9 @@ TEST_F( create("x")))); body->append( create(create("param"))); - auto* sub_func = create("sub_func", std::move(params), &f32, - std::move(body)); + auto* sub_func = create("sub_func", params, &f32, body); - mod.AddFunction(std::move(sub_func)); + mod.AddFunction(sub_func); ast::ExpressionList expr; expr.push_back(create( @@ -649,14 +621,13 @@ TEST_F( body->append(create( create("depth"), create(create("sub_func"), - std::move(expr)))); + expr))); body->append(create()); - auto* func_1 = create("ep_1", std::move(params), &void_type, - std::move(body)); + auto* func_1 = create("ep_1", params, &void_type, body); func_1->add_decoration( create(ast::PipelineStage::kFragment, Source{})); - mod.AddFunction(std::move(func_1)); + mod.AddFunction(func_1); ASSERT_TRUE(td.Determine()) << td.error(); ASSERT_TRUE(gen.Generate()) << gen.error(); @@ -692,11 +663,11 @@ TEST_F(MslGeneratorImplTest, ast::VariableDecorationList decos; decos.push_back(create(0, Source{})); decos.push_back(create(1, Source{})); - coord_var->set_decorations(std::move(decos)); + coord_var->set_decorations(decos); td.RegisterVariableForTesting(coord_var); - mod.AddGlobalVariable(std::move(coord_var)); + mod.AddGlobalVariable(coord_var); ast::VariableList params; params.push_back( @@ -707,10 +678,9 @@ TEST_F(MslGeneratorImplTest, create(create( create("coord"), create("x")))); - auto* sub_func = create("sub_func", std::move(params), &f32, - std::move(body)); + auto* sub_func = create("sub_func", params, &f32, body); - mod.AddFunction(std::move(sub_func)); + mod.AddFunction(sub_func); ast::ExpressionList expr; expr.push_back(create( @@ -718,18 +688,17 @@ TEST_F(MslGeneratorImplTest, auto* var = create("v", ast::StorageClass::kFunction, &f32); var->set_constructor(create( - create("sub_func"), std::move(expr))); + create("sub_func"), expr)); body = create(); - body->append(create(std::move(var))); + body->append(create(var)); body->append(create()); - auto* func = create("frag_main", std::move(params), &void_type, - std::move(body)); + auto* func = create("frag_main", params, &void_type, body); func->add_decoration( create(ast::PipelineStage::kFragment, Source{})); - mod.AddFunction(std::move(func)); + mod.AddFunction(func); ASSERT_TRUE(td.Determine()) << td.error(); ASSERT_TRUE(gen.Generate()) << gen.error(); @@ -756,16 +725,16 @@ TEST_F(MslGeneratorImplTest, ast::StructMemberList members; ast::StructMemberDecorationList a_deco; a_deco.push_back(create(0, Source{})); - members.push_back(create("a", &i32, std::move(a_deco))); + members.push_back(create("a", &i32, a_deco)); ast::StructMemberDecorationList b_deco; b_deco.push_back(create(4, Source{})); - members.push_back(create("b", &f32, std::move(b_deco))); + members.push_back(create("b", &f32, b_deco)); auto* str = create(); - str->set_members(std::move(members)); + str->set_members(members); - ast::type::StructType s("Data", std::move(str)); + ast::type::StructType s("Data", str); ast::type::AccessControlType ac(ast::AccessControl::kReadWrite, &s); mod.AddConstructedType(&s); @@ -776,10 +745,10 @@ TEST_F(MslGeneratorImplTest, ast::VariableDecorationList decos; decos.push_back(create(0, Source{})); decos.push_back(create(1, Source{})); - coord_var->set_decorations(std::move(decos)); + coord_var->set_decorations(decos); td.RegisterVariableForTesting(coord_var); - mod.AddGlobalVariable(std::move(coord_var)); + mod.AddGlobalVariable(coord_var); ast::VariableList params; params.push_back( @@ -790,10 +759,9 @@ TEST_F(MslGeneratorImplTest, create(create( create("coord"), create("b")))); - auto* sub_func = create("sub_func", std::move(params), &f32, - std::move(body)); + auto* sub_func = create("sub_func", params, &f32, body); - mod.AddFunction(std::move(sub_func)); + mod.AddFunction(sub_func); ast::ExpressionList expr; expr.push_back(create( @@ -801,18 +769,17 @@ TEST_F(MslGeneratorImplTest, auto* var = create("v", ast::StorageClass::kFunction, &f32); var->set_constructor(create( - create("sub_func"), std::move(expr))); + create("sub_func"), expr)); body = create(); - body->append(create(std::move(var))); + body->append(create(var)); body->append(create()); - auto* func = create("frag_main", std::move(params), &void_type, - std::move(body)); + auto* func = create("frag_main", params, &void_type, body); func->add_decoration( create(ast::PipelineStage::kFragment, Source{})); - mod.AddFunction(std::move(func)); + mod.AddFunction(func); ASSERT_TRUE(td.Determine()) << td.error(); @@ -845,16 +812,16 @@ TEST_F(MslGeneratorImplTest, ast::StructMemberList members; ast::StructMemberDecorationList a_deco; a_deco.push_back(create(0, Source{})); - members.push_back(create("a", &i32, std::move(a_deco))); + members.push_back(create("a", &i32, a_deco)); ast::StructMemberDecorationList b_deco; b_deco.push_back(create(4, Source{})); - members.push_back(create("b", &f32, std::move(b_deco))); + members.push_back(create("b", &f32, b_deco)); auto* str = create(); - str->set_members(std::move(members)); + str->set_members(members); - ast::type::StructType s("Data", std::move(str)); + ast::type::StructType s("Data", str); ast::type::AccessControlType ac(ast::AccessControl::kReadOnly, &s); mod.AddConstructedType(&s); @@ -865,10 +832,10 @@ TEST_F(MslGeneratorImplTest, ast::VariableDecorationList decos; decos.push_back(create(0, Source{})); decos.push_back(create(1, Source{})); - coord_var->set_decorations(std::move(decos)); + coord_var->set_decorations(decos); td.RegisterVariableForTesting(coord_var); - mod.AddGlobalVariable(std::move(coord_var)); + mod.AddGlobalVariable(coord_var); ast::VariableList params; params.push_back( @@ -879,10 +846,9 @@ TEST_F(MslGeneratorImplTest, create(create( create("coord"), create("b")))); - auto* sub_func = create("sub_func", std::move(params), &f32, - std::move(body)); + auto* sub_func = create("sub_func", params, &f32, body); - mod.AddFunction(std::move(sub_func)); + mod.AddFunction(sub_func); ast::ExpressionList expr; expr.push_back(create( @@ -890,18 +856,17 @@ TEST_F(MslGeneratorImplTest, auto* var = create("v", ast::StorageClass::kFunction, &f32); var->set_constructor(create( - create("sub_func"), std::move(expr))); + create("sub_func"), expr)); body = create(); - body->append(create(std::move(var))); + body->append(create(var)); body->append(create()); - auto* func = create("frag_main", std::move(params), &void_type, - std::move(body)); + auto* func = create("frag_main", params, &void_type, body); func->add_decoration( create(ast::PipelineStage::kFragment, Source{})); - mod.AddFunction(std::move(func)); + mod.AddFunction(func); ASSERT_TRUE(td.Determine()) << td.error(); @@ -935,10 +900,10 @@ TEST_F(MslGeneratorImplTest, create("bar", ast::StorageClass::kOutput, &f32)); ast::VariableDecorationList decos; decos.push_back(create(1, Source{})); - bar_var->set_decorations(std::move(decos)); + bar_var->set_decorations(decos); td.RegisterVariableForTesting(bar_var); - mod.AddGlobalVariable(std::move(bar_var)); + mod.AddGlobalVariable(bar_var); ast::VariableList params; auto* body = create(); @@ -956,16 +921,15 @@ TEST_F(MslGeneratorImplTest, create(&i32, 1)), create( create(&i32, 1))), - std::move(list))); + list)); body->append(create()); - auto* func_1 = create("ep_1", std::move(params), &void_type, - std::move(body)); + auto* func_1 = create("ep_1", params, &void_type, body); func_1->add_decoration( create(ast::PipelineStage::kFragment, Source{})); - mod.AddFunction(std::move(func_1)); + mod.AddFunction(func_1); ASSERT_TRUE(td.Determine()) << td.error(); ASSERT_TRUE(gen.Generate()) << gen.error(); @@ -996,7 +960,7 @@ TEST_F(MslGeneratorImplTest, func->add_decoration( create(ast::PipelineStage::kCompute, Source{})); - mod.AddFunction(std::move(func)); + mod.AddFunction(func); ASSERT_TRUE(gen.Generate()) << gen.error(); EXPECT_EQ(gen.result(), R"(#include @@ -1018,10 +982,9 @@ TEST_F(MslGeneratorImplTest, Emit_Function_WithArrayParams) { auto* body = create(); body->append(create()); - auto* func = create("my_func", std::move(params), &void_type, - std::move(body)); + auto* func = create("my_func", params, &void_type, body); - mod.AddFunction(std::move(func)); + mod.AddFunction(func); gen.increment_indent(); @@ -1059,14 +1022,14 @@ TEST_F(MslGeneratorImplTest, ast::StructMemberList members; ast::StructMemberDecorationList a_deco; a_deco.push_back(create(0, Source{})); - members.push_back(create("d", &f32, std::move(a_deco))); + members.push_back(create("d", &f32, a_deco)); ast::StructDecorationList s_decos; s_decos.push_back(create(Source{})); - auto* str = create(std::move(s_decos), std::move(members)); + auto* str = create(s_decos, members); - ast::type::StructType s("Data", std::move(str)); + ast::type::StructType s("Data", str); ast::type::AccessControlType ac(ast::AccessControl::kReadWrite, &s); auto* data_var = create( @@ -1075,12 +1038,12 @@ TEST_F(MslGeneratorImplTest, ast::VariableDecorationList decos; decos.push_back(create(0, Source{})); decos.push_back(create(0, Source{})); - data_var->set_decorations(std::move(decos)); + data_var->set_decorations(decos); mod.AddConstructedType(&s); td.RegisterVariableForTesting(data_var); - mod.AddGlobalVariable(std::move(data_var)); + mod.AddGlobalVariable(data_var); { ast::VariableList params; @@ -1090,15 +1053,14 @@ TEST_F(MslGeneratorImplTest, create("d"))); auto* body = create(); - body->append(create(std::move(var))); + body->append(create(var)); body->append(create()); - auto* func = create("a", std::move(params), &void_type, - std::move(body)); + auto* func = create("a", params, &void_type, body); func->add_decoration( create(ast::PipelineStage::kCompute, Source{})); - mod.AddFunction(std::move(func)); + mod.AddFunction(func); } { @@ -1109,15 +1071,14 @@ TEST_F(MslGeneratorImplTest, create("d"))); auto* body = create(); - body->append(create(std::move(var))); + body->append(create(var)); body->append(create()); - auto* func = create("b", std::move(params), &void_type, - std::move(body)); + auto* func = create("b", params, &void_type, body); func->add_decoration( create(ast::PipelineStage::kCompute, Source{})); - mod.AddFunction(std::move(func)); + mod.AddFunction(func); } ASSERT_TRUE(td.Determine()) << td.error(); diff --git a/src/writer/msl/generator_impl_if_test.cc b/src/writer/msl/generator_impl_if_test.cc index eec75df3e4..71428a83c2 100644 --- a/src/writer/msl/generator_impl_if_test.cc +++ b/src/writer/msl/generator_impl_if_test.cc @@ -33,7 +33,7 @@ TEST_F(MslGeneratorImplTest, Emit_If) { auto* body = create(); body->append(create()); - ast::IfStatement i(std::move(cond), std::move(body)); + ast::IfStatement i(cond, body); gen.increment_indent(); @@ -50,15 +50,14 @@ TEST_F(MslGeneratorImplTest, Emit_IfWithElseIf) { else_body->append(create()); ast::ElseStatementList elses; - elses.push_back( - create(std::move(else_cond), std::move(else_body))); + elses.push_back(create(else_cond, else_body)); auto* cond = create("cond"); auto* body = create(); body->append(create()); - ast::IfStatement i(std::move(cond), std::move(body)); - i.set_else_statements(std::move(elses)); + ast::IfStatement i(cond, body); + i.set_else_statements(elses); gen.increment_indent(); @@ -76,14 +75,14 @@ TEST_F(MslGeneratorImplTest, Emit_IfWithElse) { else_body->append(create()); ast::ElseStatementList elses; - elses.push_back(create(std::move(else_body))); + elses.push_back(create(else_body)); auto* cond = create("cond"); auto* body = create(); body->append(create()); - ast::IfStatement i(std::move(cond), std::move(body)); - i.set_else_statements(std::move(elses)); + ast::IfStatement i(cond, body); + i.set_else_statements(elses); gen.increment_indent(); @@ -106,16 +105,15 @@ TEST_F(MslGeneratorImplTest, Emit_IfWithMultiple) { else_body_2->append(create()); ast::ElseStatementList elses; - elses.push_back( - create(std::move(else_cond), std::move(else_body))); - elses.push_back(create(std::move(else_body_2))); + elses.push_back(create(else_cond, else_body)); + elses.push_back(create(else_body_2)); auto* cond = create("cond"); auto* body = create(); body->append(create()); - ast::IfStatement i(std::move(cond), std::move(body)); - i.set_else_statements(std::move(elses)); + ast::IfStatement i(cond, body); + i.set_else_statements(elses); gen.increment_indent(); diff --git a/src/writer/msl/generator_impl_import_test.cc b/src/writer/msl/generator_impl_import_test.cc index 3920f50241..9d3b71a41e 100644 --- a/src/writer/msl/generator_impl_import_test.cc +++ b/src/writer/msl/generator_impl_import_test.cc @@ -59,14 +59,13 @@ TEST_P(MslImportData_SingleParamTest, FloatScalar) { create(&f32, 1.f))); auto* ident = create(param.name); - auto* ident_ptr = ident; - ast::CallExpression call(std::move(ident), std::move(params)); + ast::CallExpression call(ident, params); // The call type determination will set the intrinsic data for the ident ASSERT_TRUE(td.DetermineResultType(&call)) << td.error(); - ASSERT_EQ(gen.generate_builtin_name(ident_ptr), + ASSERT_EQ(gen.generate_builtin_name(ident), std::string("metal::") + param.msl_name); } INSTANTIATE_TEST_SUITE_P(MslGeneratorImplTest, @@ -102,8 +101,7 @@ TEST_F(MslGeneratorImplTest, MslImportData_SingleParamTest_IntScalar) { params.push_back(create( create(&i32, 1))); - ast::CallExpression expr(create("abs"), - std::move(params)); + ast::CallExpression expr(create("abs"), params); ASSERT_TRUE(td.DetermineResultType(&expr)) << td.error(); @@ -124,7 +122,7 @@ TEST_P(MslImportData_DualParamTest, FloatScalar) { create(&f32, 2.f))); ast::CallExpression expr(create(param.name), - std::move(params)); + params); ASSERT_TRUE(td.DetermineResultType(&expr)) << td.error(); ASSERT_TRUE(gen.EmitCall(&expr)) << gen.error(); @@ -149,28 +147,30 @@ TEST_P(MslImportData_DualParam_VectorTest, FloatVector) { ast::type::VectorType vec(&f32, 3); ast::ExpressionList type_params; - type_params.push_back(create( - create(&f32, 1.f))); - type_params.push_back(create( - create(&f32, 2.f))); - type_params.push_back(create( - create(&f32, 3.f))); ast::ExpressionList params; - params.push_back( - create(&vec, std::move(type_params))); + params.push_back(create( + &vec, ast::ExpressionList{ + create( + create(&f32, 1.f)), + create( + create(&f32, 2.f)), + create( + create(&f32, 3.f)), + })); - type_params.push_back(create( - create(&f32, 4.f))); - type_params.push_back(create( - create(&f32, 5.f))); - type_params.push_back(create( - create(&f32, 6.f))); - params.push_back( - create(&vec, std::move(type_params))); + params.push_back(create( + &vec, ast::ExpressionList{ + create( + create(&f32, 4.f)), + create( + create(&f32, 5.f)), + create( + create(&f32, 6.f)), + })); ast::CallExpression expr(create(param.name), - std::move(params)); + params); ASSERT_TRUE(td.DetermineResultType(&expr)) << td.error(); ASSERT_TRUE(gen.EmitCall(&expr)) << gen.error(); @@ -195,7 +195,7 @@ TEST_P(MslImportData_DualParam_Int_Test, IntScalar) { create(&i32, 2))); ast::CallExpression expr(create(param.name), - std::move(params)); + params); ASSERT_TRUE(td.DetermineResultType(&expr)) << td.error(); ASSERT_TRUE(gen.EmitCall(&expr)) << gen.error(); @@ -221,7 +221,7 @@ TEST_P(MslImportData_TripleParamTest, FloatScalar) { create(&f32, 3.f))); ast::CallExpression expr(create(param.name), - std::move(params)); + params); ASSERT_TRUE(td.DetermineResultType(&expr)) << td.error(); ASSERT_TRUE(gen.EmitCall(&expr)) << gen.error(); @@ -252,7 +252,7 @@ TEST_P(MslImportData_TripleParam_Int_Test, IntScalar) { create(&i32, 3))); ast::CallExpression expr(create(param.name), - std::move(params)); + params); ASSERT_TRUE(td.DetermineResultType(&expr)) << td.error(); ASSERT_TRUE(gen.EmitCall(&expr)) << gen.error(); @@ -274,9 +274,9 @@ TEST_F(MslGeneratorImplTest, MslImportData_Determinant) { params.push_back(create("var")); ast::CallExpression expr(create("determinant"), - std::move(params)); + params); - mod.AddGlobalVariable(std::move(var)); + mod.AddGlobalVariable(var); // Register the global ASSERT_TRUE(td.Determine()) << td.error(); diff --git a/src/writer/msl/generator_impl_intrinsic_test.cc b/src/writer/msl/generator_impl_intrinsic_test.cc index 5821b5b130..2bd7dbe730 100644 --- a/src/writer/msl/generator_impl_intrinsic_test.cc +++ b/src/writer/msl/generator_impl_intrinsic_test.cc @@ -79,13 +79,13 @@ TEST_F(MslGeneratorImplTest, DISABLED_Intrinsic_OuterProduct) { params.push_back(create("b")); ast::CallExpression call(create("outer_product"), - std::move(params)); + params); td.RegisterVariableForTesting(a); td.RegisterVariableForTesting(b); - mod.AddGlobalVariable(std::move(a)); - mod.AddGlobalVariable(std::move(b)); + mod.AddGlobalVariable(a); + mod.AddGlobalVariable(b); ASSERT_TRUE(td.Determine()) << td.error(); ASSERT_TRUE(td.DetermineResultType(&call)) << td.error(); @@ -107,8 +107,7 @@ TEST_F(MslGeneratorImplTest, Intrinsic_Call) { params.push_back(create("param1")); params.push_back(create("param2")); - ast::CallExpression call(create("dot"), - std::move(params)); + ast::CallExpression call(create("dot"), params); ast::Variable v1("param1", ast::StorageClass::kFunction, &vec); ast::Variable v2("param2", ast::StorageClass::kFunction, &vec); diff --git a/src/writer/msl/generator_impl_loop_test.cc b/src/writer/msl/generator_impl_loop_test.cc index faabd7bb80..800b51b9a6 100644 --- a/src/writer/msl/generator_impl_loop_test.cc +++ b/src/writer/msl/generator_impl_loop_test.cc @@ -39,7 +39,7 @@ TEST_F(MslGeneratorImplTest, Emit_Loop) { auto* body = create(); body->append(create()); - ast::LoopStatement l(std::move(body), {}); + ast::LoopStatement l(body, {}); gen.increment_indent(); @@ -57,7 +57,7 @@ TEST_F(MslGeneratorImplTest, Emit_LoopWithContinuing) { auto* continuing = create(); continuing->append(create()); - ast::LoopStatement l(std::move(body), std::move(continuing)); + ast::LoopStatement l(body, continuing); gen.increment_indent(); @@ -85,20 +85,18 @@ TEST_F(MslGeneratorImplTest, Emit_LoopNestedWithContinuing) { auto* continuing = create(); continuing->append(create()); - auto* inner = - create(std::move(body), std::move(continuing)); + auto* inner = create(body, continuing); body = create(); - body->append(std::move(inner)); + body->append(inner); auto* lhs = create("lhs"); auto* rhs = create("rhs"); continuing = create(); - continuing->append( - create(std::move(lhs), std::move(rhs))); + continuing->append(create(lhs, rhs)); - ast::LoopStatement outer(std::move(body), std::move(continuing)); + ast::LoopStatement outer(body, continuing); gen.increment_indent(); @@ -156,7 +154,7 @@ TEST_F(MslGeneratorImplTest, Emit_LoopWithVarUsedInContinuing) { create(&f32, 2.4))); auto* body = create(); - body->append(create(std::move(var))); + body->append(create(var)); body->append(create( create("other", ast::StorageClass::kFunction, &f32))); @@ -164,12 +162,11 @@ TEST_F(MslGeneratorImplTest, Emit_LoopWithVarUsedInContinuing) { auto* rhs = create("rhs"); auto* continuing = create(); - continuing->append( - create(std::move(lhs), std::move(rhs))); + continuing->append(create(lhs, rhs)); gen.increment_indent(); - ast::LoopStatement outer(std::move(body), std::move(continuing)); + ast::LoopStatement outer(body, continuing); ASSERT_TRUE(gen.EmitStatement(&outer)) << gen.error(); EXPECT_EQ(gen.result(), R"( { diff --git a/src/writer/msl/generator_impl_member_accessor_test.cc b/src/writer/msl/generator_impl_member_accessor_test.cc index d0d1dc9a37..7672a01cf9 100644 --- a/src/writer/msl/generator_impl_member_accessor_test.cc +++ b/src/writer/msl/generator_impl_member_accessor_test.cc @@ -32,7 +32,7 @@ TEST_F(MslGeneratorImplTest, EmitExpression_MemberAccessor) { auto* str = create("str"); auto* mem = create("mem"); - ast::MemberAccessorExpression expr(std::move(str), std::move(mem)); + ast::MemberAccessorExpression expr(str, mem); ASSERT_TRUE(gen.EmitExpression(&expr)) << gen.error(); EXPECT_EQ(gen.result(), "str.mem"); diff --git a/src/writer/msl/generator_impl_module_constant_test.cc b/src/writer/msl/generator_impl_module_constant_test.cc index b0b392ef45..1612537c64 100644 --- a/src/writer/msl/generator_impl_module_constant_test.cc +++ b/src/writer/msl/generator_impl_module_constant_test.cc @@ -49,8 +49,7 @@ TEST_F(MslGeneratorImplTest, Emit_ModuleConstant) { auto* var = create("pos", ast::StorageClass::kNone, &ary); var->set_is_const(true); - var->set_constructor( - create(&ary, std::move(exprs))); + var->set_constructor(create(&ary, exprs)); ASSERT_TRUE(gen.EmitProgramConstVariable(var)) << gen.error(); EXPECT_EQ( @@ -66,7 +65,7 @@ TEST_F(MslGeneratorImplTest, Emit_SpecConstant) { auto* var = create( create("pos", ast::StorageClass::kNone, &f32)); - var->set_decorations(std::move(decos)); + var->set_decorations(decos); var->set_is_const(true); var->set_constructor(create( create(&f32, 3.0f))); diff --git a/src/writer/msl/generator_impl_return_test.cc b/src/writer/msl/generator_impl_return_test.cc index 651440dfaa..408a51ccd9 100644 --- a/src/writer/msl/generator_impl_return_test.cc +++ b/src/writer/msl/generator_impl_return_test.cc @@ -40,7 +40,7 @@ TEST_F(MslGeneratorImplTest, Emit_Return) { TEST_F(MslGeneratorImplTest, Emit_ReturnWithValue) { auto* expr = create("expr"); - ast::ReturnStatement r(std::move(expr)); + ast::ReturnStatement r(expr); gen.increment_indent(); diff --git a/src/writer/msl/generator_impl_switch_test.cc b/src/writer/msl/generator_impl_switch_test.cc index 7511f62463..25546b77db 100644 --- a/src/writer/msl/generator_impl_switch_test.cc +++ b/src/writer/msl/generator_impl_switch_test.cc @@ -35,7 +35,7 @@ using MslGeneratorImplTest = TestHelper; TEST_F(MslGeneratorImplTest, Emit_Switch) { auto* def_body = create(); def_body->append(create()); - auto* def = create(std::move(def_body)); + auto* def = create(def_body); ast::type::I32Type i32; ast::CaseSelectorList case_val; @@ -44,15 +44,14 @@ TEST_F(MslGeneratorImplTest, Emit_Switch) { auto* case_body = create(); case_body->append(create()); - auto* case_stmt = - create(std::move(case_val), std::move(case_body)); + auto* case_stmt = create(case_val, case_body); ast::CaseStatementList body; - body.push_back(std::move(case_stmt)); - body.push_back(std::move(def)); + body.push_back(case_stmt); + body.push_back(def); auto* cond = create("cond"); - ast::SwitchStatement s(std::move(cond), std::move(body)); + ast::SwitchStatement s(cond, body); gen.increment_indent(); diff --git a/src/writer/msl/generator_impl_test.cc b/src/writer/msl/generator_impl_test.cc index d974ec9dfa..e97b033341 100644 --- a/src/writer/msl/generator_impl_test.cc +++ b/src/writer/msl/generator_impl_test.cc @@ -54,7 +54,7 @@ TEST_F(MslGeneratorImplTest, Generate) { create()); func->add_decoration( create(ast::PipelineStage::kCompute, Source{})); - mod.AddFunction(std::move(func)); + mod.AddFunction(func); ASSERT_TRUE(gen.Generate()) << gen.error(); EXPECT_EQ(gen.result(), R"(#include @@ -160,18 +160,18 @@ TEST_F(MslGeneratorImplTest, calculate_alignment_size_struct) { decos.push_back(create(4, Source{})); ast::StructMemberList members; - members.push_back(create("a", &i32, std::move(decos))); + members.push_back(create("a", &i32, decos)); decos.push_back(create(32, Source{})); - members.push_back(create("b", &f32, std::move(decos))); + members.push_back(create("b", &f32, decos)); decos.push_back(create(128, Source{})); - members.push_back(create("c", &f32, std::move(decos))); + members.push_back(create("c", &f32, decos)); auto* str = create(); - str->set_members(std::move(members)); + str->set_members(members); - ast::type::StructType s("S", std::move(str)); + ast::type::StructType s("S", str); EXPECT_EQ(132u, gen.calculate_alignment_size(&s)); } @@ -185,32 +185,32 @@ TEST_F(MslGeneratorImplTest, calculate_alignment_size_struct_of_struct) { decos.push_back(create(0, Source{})); ast::StructMemberList members; - members.push_back(create("a", &i32, std::move(decos))); + members.push_back(create("a", &i32, decos)); decos.push_back(create(16, Source{})); - members.push_back(create("b", &fvec, std::move(decos))); + members.push_back(create("b", &fvec, decos)); decos.push_back(create(32, Source{})); - members.push_back(create("c", &f32, std::move(decos))); + members.push_back(create("c", &f32, decos)); auto* inner_str = create(); - inner_str->set_members(std::move(members)); + inner_str->set_members(members); - ast::type::StructType inner_s("Inner", std::move(inner_str)); + ast::type::StructType inner_s("Inner", inner_str); decos.push_back(create(0, Source{})); - members.push_back(create("d", &f32, std::move(decos))); + members.push_back(create("d", &f32, decos)); decos.push_back(create(32, Source{})); - members.push_back(create("e", &inner_s, std::move(decos))); + members.push_back(create("e", &inner_s, decos)); decos.push_back(create(64, Source{})); - members.push_back(create("f", &f32, std::move(decos))); + members.push_back(create("f", &f32, decos)); auto* outer_str = create(); - outer_str->set_members(std::move(members)); + outer_str->set_members(members); - ast::type::StructType outer_s("Outer", std::move(outer_str)); + ast::type::StructType outer_s("Outer", outer_str); EXPECT_EQ(80u, gen.calculate_alignment_size(&outer_s)); } diff --git a/src/writer/msl/generator_impl_type_test.cc b/src/writer/msl/generator_impl_type_test.cc index 1716edad0e..49f0399c53 100644 --- a/src/writer/msl/generator_impl_type_test.cc +++ b/src/writer/msl/generator_impl_type_test.cc @@ -181,12 +181,12 @@ TEST_F(MslGeneratorImplTest, EmitType_Struct) { ast::StructMemberDecorationList b_deco; b_deco.push_back(create(4, Source{})); - members.push_back(create("b", &f32, std::move(b_deco))); + members.push_back(create("b", &f32, b_deco)); auto* str = create(); - str->set_members(std::move(members)); + str->set_members(members); - ast::type::StructType s("S", std::move(str)); + ast::type::StructType s("S", str); ASSERT_TRUE(gen.EmitType(&s, "")) << gen.error(); EXPECT_EQ(gen.result(), "S"); @@ -202,12 +202,12 @@ TEST_F(MslGeneratorImplTest, EmitType_StructDecl) { ast::StructMemberDecorationList b_deco; b_deco.push_back(create(4, Source{})); - members.push_back(create("b", &f32, std::move(b_deco))); + members.push_back(create("b", &f32, b_deco)); auto* str = create(); - str->set_members(std::move(members)); + str->set_members(members); - ast::type::StructType s("S", std::move(str)); + ast::type::StructType s("S", str); ASSERT_TRUE(gen.EmitStructType(&s)) << gen.error(); EXPECT_EQ(gen.result(), R"(struct S { @@ -221,22 +221,23 @@ TEST_F(MslGeneratorImplTest, EmitType_Struct_InjectPadding) { ast::type::I32Type i32; ast::type::F32Type f32; - ast::StructMemberDecorationList decos; - decos.push_back(create(4, Source{})); - - ast::StructMemberList members; - members.push_back(create("a", &i32, std::move(decos))); - - decos.push_back(create(32, Source{})); - members.push_back(create("b", &f32, std::move(decos))); - - decos.push_back(create(128, Source{})); - members.push_back(create("c", &f32, std::move(decos))); - auto* str = create(); - str->set_members(std::move(members)); + str->set_members({ + create( + "a", &i32, + ast::StructMemberDecorationList{ + create(4, Source{})}), + create( + "b", &f32, + ast::StructMemberDecorationList{ + create(32, Source{})}), + create( + "c", &f32, + ast::StructMemberDecorationList{ + create(128, Source{})}), + }); - ast::type::StructType s("S", std::move(str)); + ast::type::StructType s("S", str); ASSERT_TRUE(gen.EmitStructType(&s)) << gen.error(); EXPECT_EQ(gen.result(), R"(struct S { @@ -259,13 +260,12 @@ TEST_F(MslGeneratorImplTest, EmitType_Struct_NameCollision) { "main", &i32, ast::StructMemberDecorationList{})); ast::StructMemberDecorationList b_deco; - members.push_back( - create("float", &f32, std::move(b_deco))); + members.push_back(create("float", &f32, b_deco)); auto* str = create(); - str->set_members(std::move(members)); + str->set_members(members); - ast::type::StructType s("S", std::move(str)); + ast::type::StructType s("S", str); ASSERT_TRUE(gen.EmitStructType(&s)) << gen.error(); EXPECT_EQ(gen.result(), R"(struct S { @@ -286,13 +286,13 @@ TEST_F(MslGeneratorImplTest, DISABLED_EmitType_Struct_WithDecoration) { ast::StructMemberDecorationList b_deco; b_deco.push_back(create(4, Source{})); - members.push_back(create("b", &f32, std::move(b_deco))); + members.push_back(create("b", &f32, b_deco)); ast::StructDecorationList decos; decos.push_back(create(Source{})); - auto* str = create(std::move(decos), std::move(members)); + auto* str = create(decos, members); - ast::type::StructType s("S", std::move(str)); + ast::type::StructType s("S", str); ASSERT_TRUE(gen.EmitType(&s, "")) << gen.error(); EXPECT_EQ(gen.result(), R"(struct { diff --git a/src/writer/msl/generator_impl_unary_op_test.cc b/src/writer/msl/generator_impl_unary_op_test.cc index ec7836236d..a676558c56 100644 --- a/src/writer/msl/generator_impl_unary_op_test.cc +++ b/src/writer/msl/generator_impl_unary_op_test.cc @@ -40,7 +40,7 @@ TEST_P(MslUnaryOpTest, Emit) { auto params = GetParam(); auto* expr = create("expr"); - ast::UnaryOpExpression op(params.op, std::move(expr)); + ast::UnaryOpExpression op(params.op, expr); ASSERT_TRUE(gen.EmitExpression(&op)) << gen.error(); EXPECT_EQ(gen.result(), std::string(params.name) + "(expr)"); diff --git a/src/writer/msl/generator_impl_variable_decl_statement_test.cc b/src/writer/msl/generator_impl_variable_decl_statement_test.cc index 2681ae2dd7..f0ec7a0e51 100644 --- a/src/writer/msl/generator_impl_variable_decl_statement_test.cc +++ b/src/writer/msl/generator_impl_variable_decl_statement_test.cc @@ -44,7 +44,7 @@ TEST_F(MslGeneratorImplTest, Emit_VariableDeclStatement) { ast::type::F32Type f32; auto* var = create("a", ast::StorageClass::kNone, &f32); - ast::VariableDeclStatement stmt(std::move(var)); + ast::VariableDeclStatement stmt(var); gen.increment_indent(); @@ -57,7 +57,7 @@ TEST_F(MslGeneratorImplTest, Emit_VariableDeclStatement_Const) { auto* var = create("a", ast::StorageClass::kNone, &f32); var->set_is_const(true); - ast::VariableDeclStatement stmt(std::move(var)); + ast::VariableDeclStatement stmt(var); gen.increment_indent(); @@ -71,7 +71,7 @@ TEST_F(MslGeneratorImplTest, Emit_VariableDeclStatement_Array) { auto* var = create("a", ast::StorageClass::kNone, &ary); - ast::VariableDeclStatement stmt(std::move(var)); + ast::VariableDeclStatement stmt(var); gen.increment_indent(); @@ -88,16 +88,16 @@ TEST_F(MslGeneratorImplTest, Emit_VariableDeclStatement_Struct) { ast::StructMemberDecorationList b_deco; b_deco.push_back(create(4, Source{})); - members.push_back(create("b", &f32, std::move(b_deco))); + members.push_back(create("b", &f32, b_deco)); auto* str = create(); - str->set_members(std::move(members)); + str->set_members(members); - ast::type::StructType s("S", std::move(str)); + ast::type::StructType s("S", str); auto* var = create("a", ast::StorageClass::kNone, &s); - ast::VariableDeclStatement stmt(std::move(var)); + ast::VariableDeclStatement stmt(var); gen.increment_indent(); @@ -112,7 +112,7 @@ TEST_F(MslGeneratorImplTest, Emit_VariableDeclStatement_Vector) { auto* var = create("a", ast::StorageClass::kFunction, &vec); - ast::VariableDeclStatement stmt(std::move(var)); + ast::VariableDeclStatement stmt(var); gen.increment_indent(); @@ -125,7 +125,7 @@ TEST_F(MslGeneratorImplTest, Emit_VariableDeclStatement_Matrix) { ast::type::MatrixType mat(&f32, 2, 3); auto* var = create("a", ast::StorageClass::kFunction, &mat); - ast::VariableDeclStatement stmt(std::move(var)); + ast::VariableDeclStatement stmt(var); gen.increment_indent(); @@ -137,7 +137,7 @@ TEST_F(MslGeneratorImplTest, Emit_VariableDeclStatement_Private) { ast::type::F32Type f32; auto* var = create("a", ast::StorageClass::kPrivate, &f32); - ast::VariableDeclStatement stmt(std::move(var)); + ast::VariableDeclStatement stmt(var); gen.increment_indent(); @@ -150,9 +150,9 @@ TEST_F(MslGeneratorImplTest, Emit_VariableDeclStatement_Initializer_Private) { ast::type::F32Type f32; auto* var = create("a", ast::StorageClass::kNone, &f32); - var->set_constructor(std::move(ident)); + var->set_constructor(ident); - ast::VariableDeclStatement stmt(std::move(var)); + ast::VariableDeclStatement stmt(var); ASSERT_TRUE(gen.EmitStatement(&stmt)) << gen.error(); EXPECT_EQ(gen.result(), R"(float a = initializer; @@ -164,13 +164,12 @@ TEST_F(MslGeneratorImplTest, Emit_VariableDeclStatement_Initializer_ZeroVec) { ast::type::VectorType vec(&f32, 3); ast::ExpressionList values; - auto* zero_vec = - create(&vec, std::move(values)); + auto* zero_vec = create(&vec, values); auto* var = create("a", ast::StorageClass::kNone, &vec); - var->set_constructor(std::move(zero_vec)); + var->set_constructor(zero_vec); - ast::VariableDeclStatement stmt(std::move(var)); + ast::VariableDeclStatement stmt(var); ASSERT_TRUE(gen.EmitStatement(&stmt)) << gen.error(); EXPECT_EQ(gen.result(), R"(float3 a = float3(0.0f); diff --git a/src/writer/spirv/builder_accessor_expression_test.cc b/src/writer/spirv/builder_accessor_expression_test.cc index 705c66c5ba..15c5987ebb 100644 --- a/src/writer/spirv/builder_accessor_expression_test.cc +++ b/src/writer/spirv/builder_accessor_expression_test.cc @@ -60,7 +60,7 @@ TEST_F(BuilderTest, ArrayAccessor) { auto* idx_expr = create( create(&i32, 1)); - ast::ArrayAccessorExpression expr(std::move(ary), std::move(idx_expr)); + ast::ArrayAccessorExpression expr(ary, idx_expr); td.RegisterVariableForTesting(&var); ASSERT_TRUE(td.DetermineResultType(&expr)) << td.error(); @@ -101,7 +101,7 @@ TEST_F(BuilderTest, Accessor_Array_LoadIndex) { auto* ary = create("ary"); auto* idx_expr = create("idx"); - ast::ArrayAccessorExpression expr(std::move(ary), std::move(idx_expr)); + ast::ArrayAccessorExpression expr(ary, idx_expr); td.RegisterVariableForTesting(&var); td.RegisterVariableForTesting(&idx); @@ -145,7 +145,7 @@ TEST_F(BuilderTest, ArrayAccessor_Dynamic) { auto* ary = create("ary"); ast::ArrayAccessorExpression expr( - std::move(ary), + ary, create(ast::BinaryOp::kAdd, create( create(&i32, 1)), @@ -284,11 +284,11 @@ TEST_F(BuilderTest, MemberAccessor) { ast::StructMemberDecorationList decos; ast::StructMemberList members; - members.push_back(create("a", &f32, std::move(decos))); - members.push_back(create("b", &f32, std::move(decos))); + members.push_back(create("a", &f32, decos)); + members.push_back(create("b", &f32, decos)); - auto* s = create(std::move(members)); - ast::type::StructType s_type("my_struct", std::move(s)); + auto* s = create(members); + ast::type::StructType s_type("my_struct", s); ast::Variable var("ident", ast::StorageClass::kFunction, &s_type); @@ -333,20 +333,17 @@ TEST_F(BuilderTest, MemberAccessor_Nested) { // ident.inner.a ast::StructMemberDecorationList decos; ast::StructMemberList inner_members; - inner_members.push_back( - create("a", &f32, std::move(decos))); - inner_members.push_back( - create("b", &f32, std::move(decos))); + inner_members.push_back(create("a", &f32, decos)); + inner_members.push_back(create("b", &f32, decos)); - ast::type::StructType inner_struct( - "Inner", create(std::move(inner_members))); + ast::type::StructType inner_struct("Inner", + create(inner_members)); ast::StructMemberList outer_members; outer_members.push_back( - create("inner", &inner_struct, std::move(decos))); + create("inner", &inner_struct, decos)); - ast::type::StructType s_type("my_struct", - create(std::move(outer_members))); + ast::type::StructType s_type("my_struct", create(outer_members)); ast::Variable var("ident", ast::StorageClass::kFunction, &s_type); @@ -396,22 +393,18 @@ TEST_F(BuilderTest, MemberAccessor_Nested_WithAlias) { // ident.inner.a ast::StructMemberDecorationList decos; ast::StructMemberList inner_members; - inner_members.push_back( - create("a", &f32, std::move(decos))); - inner_members.push_back( - create("b", &f32, std::move(decos))); + inner_members.push_back(create("a", &f32, decos)); + inner_members.push_back(create("b", &f32, decos)); - ast::type::StructType inner_struct( - "Inner", create(std::move(inner_members))); + ast::type::StructType inner_struct("Inner", + create(inner_members)); ast::type::AliasType alias("Inner", &inner_struct); ast::StructMemberList outer_members; - outer_members.push_back( - create("inner", &alias, std::move(decos))); + outer_members.push_back(create("inner", &alias, decos)); - ast::type::StructType s_type("Outer", - create(std::move(outer_members))); + ast::type::StructType s_type("Outer", create(outer_members)); ast::Variable var("ident", ast::StorageClass::kFunction, &s_type); @@ -461,20 +454,17 @@ TEST_F(BuilderTest, MemberAccessor_Nested_Assignment_LHS) { ast::StructMemberDecorationList decos; ast::StructMemberList inner_members; - inner_members.push_back( - create("a", &f32, std::move(decos))); - inner_members.push_back( - create("b", &f32, std::move(decos))); + inner_members.push_back(create("a", &f32, decos)); + inner_members.push_back(create("b", &f32, decos)); - ast::type::StructType inner_struct( - "Inner", create(std::move(inner_members))); + ast::type::StructType inner_struct("Inner", + create(inner_members)); ast::StructMemberList outer_members; outer_members.push_back( - create("inner", &inner_struct, std::move(decos))); + create("inner", &inner_struct, decos)); - ast::type::StructType s_type("my_struct", - create(std::move(outer_members))); + ast::type::StructType s_type("my_struct", create(outer_members)); ast::Variable var("ident", ast::StorageClass::kFunction, &s_type); @@ -487,7 +477,7 @@ TEST_F(BuilderTest, MemberAccessor_Nested_Assignment_LHS) { auto* rhs = create( create(&f32, 2.f)); - ast::AssignmentStatement expr(std::move(lhs), std::move(rhs)); + ast::AssignmentStatement expr(lhs, rhs); td.RegisterVariableForTesting(&var); ASSERT_TRUE(td.DetermineResultType(&expr)) << td.error(); @@ -531,20 +521,17 @@ TEST_F(BuilderTest, MemberAccessor_Nested_Assignment_RHS) { ast::StructMemberDecorationList decos; ast::StructMemberList inner_members; - inner_members.push_back( - create("a", &f32, std::move(decos))); - inner_members.push_back( - create("b", &f32, std::move(decos))); + inner_members.push_back(create("a", &f32, decos)); + inner_members.push_back(create("b", &f32, decos)); - ast::type::StructType inner_struct( - "Inner", create(std::move(inner_members))); + ast::type::StructType inner_struct("Inner", + create(inner_members)); ast::StructMemberList outer_members; outer_members.push_back( - create("inner", &inner_struct, std::move(decos))); + create("inner", &inner_struct, decos)); - ast::type::StructType s_type("my_struct", - create(std::move(outer_members))); + ast::type::StructType s_type("my_struct", create(outer_members)); ast::Variable var("ident", ast::StorageClass::kFunction, &s_type); ast::Variable store("store", ast::StorageClass::kFunction, &f32); @@ -557,7 +544,7 @@ TEST_F(BuilderTest, MemberAccessor_Nested_Assignment_RHS) { create("inner")), create("a")); - ast::AssignmentStatement expr(std::move(lhs), std::move(rhs)); + ast::AssignmentStatement expr(lhs, rhs); td.RegisterVariableForTesting(&var); td.RegisterVariableForTesting(&store); @@ -793,22 +780,20 @@ TEST_F(BuilderTest, Accessor_Mixed_ArrayAndMember) { // index[0].foo[2].bar.baz.yx ast::StructMemberDecorationList decos; - ast::StructMemberList members; - members.push_back(create("baz", &vec3, std::move(decos))); - auto* s = create(std::move(members)); - ast::type::StructType c_type("C", std::move(s)); - members.push_back( - create("bar", &c_type, std::move(decos))); - s = create(std::move(members)); - ast::type::StructType b_type("B", std::move(s)); + auto* s = create( + ast::StructMemberList{create("baz", &vec3, decos)}); + ast::type::StructType c_type("C", s); + + s = create( + ast::StructMemberList{create("bar", &c_type, decos)}); + ast::type::StructType b_type("B", s); ast::type::ArrayType b_ary_type(&b_type, 3); - members.push_back( - create("foo", &b_ary_type, std::move(decos))); - s = create(std::move(members)); - ast::type::StructType a_type("A", std::move(s)); + s = create(ast::StructMemberList{ + create("foo", &b_ary_type, decos)}); + ast::type::StructType a_type("A", s); ast::type::ArrayType a_ary_type(&a_type, 2); @@ -880,33 +865,33 @@ TEST_F(BuilderTest, Accessor_Array_Of_Vec) { ast::type::ArrayType arr(&vec, 3); ast::ExpressionList ary_params; + ary_params.push_back(create( + &vec, ast::ExpressionList{ + create( + create(&f32, 0.0)), + create( + create(&f32, 0.5)), + })); - ast::ExpressionList vec_params; - vec_params.push_back(create( - create(&f32, 0.0))); - vec_params.push_back(create( - create(&f32, 0.5))); - ary_params.push_back( - create(&vec, std::move(vec_params))); + ary_params.push_back(create( + &vec, ast::ExpressionList{ + create( + create(&f32, -0.5)), + create( + create(&f32, -0.5)), + })); - vec_params.push_back(create( - create(&f32, -0.5))); - vec_params.push_back(create( - create(&f32, -0.5))); - ary_params.push_back( - create(&vec, std::move(vec_params))); - - vec_params.push_back(create( - create(&f32, 0.5))); - vec_params.push_back(create( - create(&f32, -0.5))); - ary_params.push_back( - create(&vec, std::move(vec_params))); + ary_params.push_back(create( + &vec, ast::ExpressionList{ + create( + create(&f32, 0.5)), + create( + create(&f32, -0.5)), + })); ast::Variable var("pos", ast::StorageClass::kPrivate, &arr); var.set_is_const(true); - var.set_constructor( - create(&arr, std::move(ary_params))); + var.set_constructor(create(&arr, ary_params)); ast::ArrayAccessorExpression expr(create("pos"), create( diff --git a/src/writer/spirv/builder_assign_test.cc b/src/writer/spirv/builder_assign_test.cc index 7d6022456a..b2a574e96a 100644 --- a/src/writer/spirv/builder_assign_test.cc +++ b/src/writer/spirv/builder_assign_test.cc @@ -51,7 +51,7 @@ TEST_F(BuilderTest, Assign_Var) { auto* val = create( create(&f32, 1.0f)); - ast::AssignmentStatement assign(std::move(ident), std::move(val)); + ast::AssignmentStatement assign(ident, val); td.RegisterVariableForTesting(&v); @@ -83,9 +83,9 @@ TEST_F(BuilderTest, Assign_Var_ZeroConstructor) { auto* ident = create("var"); ast::ExpressionList vals; - auto* val = create(&vec, std::move(vals)); + auto* val = create(&vec, vals); - ast::AssignmentStatement assign(std::move(ident), std::move(val)); + ast::AssignmentStatement assign(ident, val); td.RegisterVariableForTesting(&v); @@ -114,23 +114,25 @@ TEST_F(BuilderTest, Assign_Var_Complex_ConstructorWithExtract) { ast::type::VectorType vec3(&f32, 3); ast::type::VectorType vec2(&f32, 2); - ast::ExpressionList vals; - vals.push_back(create( - create(&f32, 1.0f))); - vals.push_back(create( - create(&f32, 2.0f))); - auto* first = create(&vec2, std::move(vals)); + auto* first = create( + &vec2, ast::ExpressionList{ + create( + create(&f32, 1.0f)), + create( + create(&f32, 2.0f)), + }); - vals.push_back(std::move(first)); - vals.push_back(create( - create(&f32, 3.0f))); - - auto* init = create(&vec3, std::move(vals)); + auto* init = create( + &vec3, ast::ExpressionList{ + first, + create( + create(&f32, 3.0f)), + }); ast::Variable v("var", ast::StorageClass::kOutput, &vec3); ast::AssignmentStatement assign(create("var"), - std::move(init)); + init); td.RegisterVariableForTesting(&v); ASSERT_TRUE(td.DetermineResultType(&assign)) << td.error(); @@ -173,12 +175,12 @@ TEST_F(BuilderTest, Assign_Var_Complex_Constructor) { vals.push_back(create( create(&f32, 3.0f))); - auto* init = create(&vec3, std::move(vals)); + auto* init = create(&vec3, vals); ast::Variable v("var", ast::StorageClass::kOutput, &vec3); ast::AssignmentStatement assign(create("var"), - std::move(init)); + init); td.RegisterVariableForTesting(&v); ASSERT_TRUE(td.DetermineResultType(&assign)) << td.error(); @@ -216,11 +218,11 @@ TEST_F(BuilderTest, Assign_StructMember) { ast::StructMemberDecorationList decos; ast::StructMemberList members; - members.push_back(create("a", &f32, std::move(decos))); - members.push_back(create("b", &f32, std::move(decos))); + members.push_back(create("a", &f32, decos)); + members.push_back(create("b", &f32, decos)); - auto* s = create(std::move(members)); - ast::type::StructType s_type("my_struct", std::move(s)); + auto* s = create(members); + ast::type::StructType s_type("my_struct", s); ast::Variable v("ident", ast::StorageClass::kFunction, &s_type); @@ -231,7 +233,7 @@ TEST_F(BuilderTest, Assign_StructMember) { auto* val = create( create(&f32, 4.0f)); - ast::AssignmentStatement assign(std::move(ident), std::move(val)); + ast::AssignmentStatement assign(ident, val); td.RegisterVariableForTesting(&v); @@ -276,9 +278,9 @@ TEST_F(BuilderTest, Assign_Vector) { vals.push_back(create( create(&f32, 3.0f))); - auto* val = create(&vec3, std::move(vals)); + auto* val = create(&vec3, vals); - ast::AssignmentStatement assign(std::move(ident), std::move(val)); + ast::AssignmentStatement assign(ident, val); td.RegisterVariableForTesting(&v); @@ -319,7 +321,7 @@ TEST_F(BuilderTest, Assign_Vector_MemberByName) { auto* val = create( create(&f32, 1.0f)); - ast::AssignmentStatement assign(std::move(ident), std::move(val)); + ast::AssignmentStatement assign(ident, val); td.RegisterVariableForTesting(&v); @@ -365,7 +367,7 @@ TEST_F(BuilderTest, Assign_Vector_MemberByIndex) { auto* val = create( create(&f32, 1.0f)); - ast::AssignmentStatement assign(std::move(ident), std::move(val)); + ast::AssignmentStatement assign(ident, val); td.RegisterVariableForTesting(&v); diff --git a/src/writer/spirv/builder_binary_expression_test.cc b/src/writer/spirv/builder_binary_expression_test.cc index 7a1f4737ab..1b9c555d22 100644 --- a/src/writer/spirv/builder_binary_expression_test.cc +++ b/src/writer/spirv/builder_binary_expression_test.cc @@ -62,7 +62,7 @@ TEST_P(BinaryArithSignedIntegerTest, Scalar) { auto* rhs = create( create(&i32, 4)); - ast::BinaryExpression expr(param.op, std::move(lhs), std::move(rhs)); + ast::BinaryExpression expr(param.op, lhs, rhs); ASSERT_TRUE(td.DetermineResultType(&expr)) << td.error(); @@ -82,24 +82,27 @@ TEST_P(BinaryArithSignedIntegerTest, Vector) { ast::type::I32Type i32; ast::type::VectorType vec3(&i32, 3); - ast::ExpressionList vals; - vals.push_back(create( - create(&i32, 1))); - vals.push_back(create( - create(&i32, 1))); - vals.push_back(create( - create(&i32, 1))); - auto* lhs = create(&vec3, std::move(vals)); + auto* lhs = create( + &vec3, ast::ExpressionList{ + create( + create(&i32, 1)), + create( + create(&i32, 1)), + create( + create(&i32, 1)), + }); - vals.push_back(create( - create(&i32, 1))); - vals.push_back(create( - create(&i32, 1))); - vals.push_back(create( - create(&i32, 1))); - auto* rhs = create(&vec3, std::move(vals)); + auto* rhs = create( + &vec3, ast::ExpressionList{ + create( + create(&i32, 1)), + create( + create(&i32, 1)), + create( + create(&i32, 1)), + }); - ast::BinaryExpression expr(param.op, std::move(lhs), std::move(rhs)); + ast::BinaryExpression expr(param.op, lhs, rhs); ASSERT_TRUE(td.DetermineResultType(&expr)) << td.error(); @@ -124,7 +127,7 @@ TEST_P(BinaryArithSignedIntegerTest, Scalar_Loads) { auto* lhs = create("param"); auto* rhs = create("param"); - ast::BinaryExpression expr(param.op, std::move(lhs), std::move(rhs)); + ast::BinaryExpression expr(param.op, lhs, rhs); td.RegisterVariableForTesting(&var); EXPECT_TRUE(td.DetermineResultType(&expr)) << td.error(); @@ -174,7 +177,7 @@ TEST_P(BinaryArithUnsignedIntegerTest, Scalar) { auto* rhs = create( create(&u32, 4)); - ast::BinaryExpression expr(param.op, std::move(lhs), std::move(rhs)); + ast::BinaryExpression expr(param.op, lhs, rhs); ASSERT_TRUE(td.DetermineResultType(&expr)) << td.error(); @@ -194,24 +197,27 @@ TEST_P(BinaryArithUnsignedIntegerTest, Vector) { ast::type::U32Type u32; ast::type::VectorType vec3(&u32, 3); - ast::ExpressionList vals; - vals.push_back(create( - create(&u32, 1))); - vals.push_back(create( - create(&u32, 1))); - vals.push_back(create( - create(&u32, 1))); - auto* lhs = create(&vec3, std::move(vals)); + auto* lhs = create( + &vec3, ast::ExpressionList{ + create( + create(&u32, 1)), + create( + create(&u32, 1)), + create( + create(&u32, 1)), + }); - vals.push_back(create( - create(&u32, 1))); - vals.push_back(create( - create(&u32, 1))); - vals.push_back(create( - create(&u32, 1))); - auto* rhs = create(&vec3, std::move(vals)); + auto* rhs = create( + &vec3, ast::ExpressionList{ + create( + create(&u32, 1)), + create( + create(&u32, 1)), + create( + create(&u32, 1)), + }); - ast::BinaryExpression expr(param.op, std::move(lhs), std::move(rhs)); + ast::BinaryExpression expr(param.op, lhs, rhs); ASSERT_TRUE(td.DetermineResultType(&expr)) << td.error(); @@ -252,7 +258,7 @@ TEST_P(BinaryArithFloatTest, Scalar) { auto* rhs = create( create(&f32, 4.5f)); - ast::BinaryExpression expr(param.op, std::move(lhs), std::move(rhs)); + ast::BinaryExpression expr(param.op, lhs, rhs); ASSERT_TRUE(td.DetermineResultType(&expr)) << td.error(); b.push_function(Function{}); @@ -272,24 +278,27 @@ TEST_P(BinaryArithFloatTest, Vector) { ast::type::F32Type f32; ast::type::VectorType vec3(&f32, 3); - ast::ExpressionList vals; - vals.push_back(create( - create(&f32, 1.f))); - vals.push_back(create( - create(&f32, 1.f))); - vals.push_back(create( - create(&f32, 1.f))); - auto* lhs = create(&vec3, std::move(vals)); + auto* lhs = create( + &vec3, ast::ExpressionList{ + create( + create(&f32, 1.f)), + create( + create(&f32, 1.f)), + create( + create(&f32, 1.f)), + }); - vals.push_back(create( - create(&f32, 1.f))); - vals.push_back(create( - create(&f32, 1.f))); - vals.push_back(create( - create(&f32, 1.f))); - auto* rhs = create(&vec3, std::move(vals)); + auto* rhs = create( + &vec3, ast::ExpressionList{ + create( + create(&f32, 1.f)), + create( + create(&f32, 1.f)), + create( + create(&f32, 1.f)), + }); - ast::BinaryExpression expr(param.op, std::move(lhs), std::move(rhs)); + ast::BinaryExpression expr(param.op, lhs, rhs); ASSERT_TRUE(td.DetermineResultType(&expr)) << td.error(); @@ -324,7 +333,7 @@ TEST_P(BinaryCompareUnsignedIntegerTest, Scalar) { auto* rhs = create( create(&u32, 4)); - ast::BinaryExpression expr(param.op, std::move(lhs), std::move(rhs)); + ast::BinaryExpression expr(param.op, lhs, rhs); ASSERT_TRUE(td.DetermineResultType(&expr)) << td.error(); @@ -346,24 +355,27 @@ TEST_P(BinaryCompareUnsignedIntegerTest, Vector) { ast::type::U32Type u32; ast::type::VectorType vec3(&u32, 3); - ast::ExpressionList vals; - vals.push_back(create( - create(&u32, 1))); - vals.push_back(create( - create(&u32, 1))); - vals.push_back(create( - create(&u32, 1))); - auto* lhs = create(&vec3, std::move(vals)); + auto* lhs = create( + &vec3, ast::ExpressionList{ + create( + create(&u32, 1)), + create( + create(&u32, 1)), + create( + create(&u32, 1)), + }); - vals.push_back(create( - create(&u32, 1))); - vals.push_back(create( - create(&u32, 1))); - vals.push_back(create( - create(&u32, 1))); - auto* rhs = create(&vec3, std::move(vals)); + auto* rhs = create( + &vec3, ast::ExpressionList{ + create( + create(&u32, 1)), + create( + create(&u32, 1)), + create( + create(&u32, 1)), + }); - ast::BinaryExpression expr(param.op, std::move(lhs), std::move(rhs)); + ast::BinaryExpression expr(param.op, lhs, rhs); ASSERT_TRUE(td.DetermineResultType(&expr)) << td.error(); @@ -402,7 +414,7 @@ TEST_P(BinaryCompareSignedIntegerTest, Scalar) { auto* rhs = create( create(&i32, 4)); - ast::BinaryExpression expr(param.op, std::move(lhs), std::move(rhs)); + ast::BinaryExpression expr(param.op, lhs, rhs); ASSERT_TRUE(td.DetermineResultType(&expr)) << td.error(); @@ -424,24 +436,27 @@ TEST_P(BinaryCompareSignedIntegerTest, Vector) { ast::type::I32Type i32; ast::type::VectorType vec3(&i32, 3); - ast::ExpressionList vals; - vals.push_back(create( - create(&i32, 1))); - vals.push_back(create( - create(&i32, 1))); - vals.push_back(create( - create(&i32, 1))); - auto* lhs = create(&vec3, std::move(vals)); + auto* lhs = create( + &vec3, ast::ExpressionList{ + create( + create(&i32, 1)), + create( + create(&i32, 1)), + create( + create(&i32, 1)), + }); - vals.push_back(create( - create(&i32, 1))); - vals.push_back(create( - create(&i32, 1))); - vals.push_back(create( - create(&i32, 1))); - auto* rhs = create(&vec3, std::move(vals)); + auto* rhs = create( + &vec3, ast::ExpressionList{ + create( + create(&i32, 1)), + create( + create(&i32, 1)), + create( + create(&i32, 1)), + }); - ast::BinaryExpression expr(param.op, std::move(lhs), std::move(rhs)); + ast::BinaryExpression expr(param.op, lhs, rhs); ASSERT_TRUE(td.DetermineResultType(&expr)) << td.error(); @@ -480,7 +495,7 @@ TEST_P(BinaryCompareFloatTest, Scalar) { auto* rhs = create( create(&f32, 4.5f)); - ast::BinaryExpression expr(param.op, std::move(lhs), std::move(rhs)); + ast::BinaryExpression expr(param.op, lhs, rhs); ASSERT_TRUE(td.DetermineResultType(&expr)) << td.error(); @@ -502,24 +517,27 @@ TEST_P(BinaryCompareFloatTest, Vector) { ast::type::F32Type f32; ast::type::VectorType vec3(&f32, 3); - ast::ExpressionList vals; - vals.push_back(create( - create(&f32, 1.f))); - vals.push_back(create( - create(&f32, 1.f))); - vals.push_back(create( - create(&f32, 1.f))); - auto* lhs = create(&vec3, std::move(vals)); + auto* lhs = create( + &vec3, ast::ExpressionList{ + create( + create(&f32, 1.f)), + create( + create(&f32, 1.f)), + create( + create(&f32, 1.f)), + }); - vals.push_back(create( - create(&f32, 1.f))); - vals.push_back(create( - create(&f32, 1.f))); - vals.push_back(create( - create(&f32, 1.f))); - auto* rhs = create(&vec3, std::move(vals)); + auto* rhs = create( + &vec3, ast::ExpressionList{ + create( + create(&f32, 1.f)), + create( + create(&f32, 1.f)), + create( + create(&f32, 1.f)), + }); - ast::BinaryExpression expr(param.op, std::move(lhs), std::move(rhs)); + ast::BinaryExpression expr(param.op, lhs, rhs); ASSERT_TRUE(td.DetermineResultType(&expr)) << td.error(); @@ -551,20 +569,20 @@ TEST_F(BuilderTest, Binary_Multiply_VectorScalar) { ast::type::F32Type f32; ast::type::VectorType vec3(&f32, 3); - ast::ExpressionList vals; - vals.push_back(create( - create(&f32, 1.f))); - vals.push_back(create( - create(&f32, 1.f))); - vals.push_back(create( - create(&f32, 1.f))); - auto* lhs = create(&vec3, std::move(vals)); + auto* lhs = create( + &vec3, ast::ExpressionList{ + create( + create(&f32, 1.f)), + create( + create(&f32, 1.f)), + create( + create(&f32, 1.f)), + }); auto* rhs = create( create(&f32, 1.f)); - ast::BinaryExpression expr(ast::BinaryOp::kMultiply, std::move(lhs), - std::move(rhs)); + ast::BinaryExpression expr(ast::BinaryOp::kMultiply, lhs, rhs); ASSERT_TRUE(td.DetermineResultType(&expr)) << td.error(); @@ -594,10 +612,9 @@ TEST_F(BuilderTest, Binary_Multiply_ScalarVector) { create(&f32, 1.f))); vals.push_back(create( create(&f32, 1.f))); - auto* rhs = create(&vec3, std::move(vals)); + auto* rhs = create(&vec3, vals); - ast::BinaryExpression expr(ast::BinaryOp::kMultiply, std::move(lhs), - std::move(rhs)); + ast::BinaryExpression expr(ast::BinaryOp::kMultiply, lhs, rhs); ASSERT_TRUE(td.DetermineResultType(&expr)) << td.error(); @@ -624,8 +641,7 @@ TEST_F(BuilderTest, Binary_Multiply_MatrixScalar) { td.RegisterVariableForTesting(var); - ast::BinaryExpression expr(ast::BinaryOp::kMultiply, std::move(lhs), - std::move(rhs)); + ast::BinaryExpression expr(ast::BinaryOp::kMultiply, lhs, rhs); ASSERT_TRUE(td.DetermineResultType(&expr)) << td.error(); @@ -657,8 +673,7 @@ TEST_F(BuilderTest, Binary_Multiply_ScalarMatrix) { td.RegisterVariableForTesting(var); - ast::BinaryExpression expr(ast::BinaryOp::kMultiply, std::move(lhs), - std::move(rhs)); + ast::BinaryExpression expr(ast::BinaryOp::kMultiply, lhs, rhs); ASSERT_TRUE(td.DetermineResultType(&expr)) << td.error(); @@ -694,12 +709,11 @@ TEST_F(BuilderTest, Binary_Multiply_MatrixVector) { create(&f32, 1.f))); vals.push_back(create( create(&f32, 1.f))); - auto* rhs = create(&vec3, std::move(vals)); + auto* rhs = create(&vec3, vals); td.RegisterVariableForTesting(var); - ast::BinaryExpression expr(ast::BinaryOp::kMultiply, std::move(lhs), - std::move(rhs)); + ast::BinaryExpression expr(ast::BinaryOp::kMultiply, lhs, rhs); ASSERT_TRUE(td.DetermineResultType(&expr)) << td.error(); @@ -735,14 +749,13 @@ TEST_F(BuilderTest, Binary_Multiply_VectorMatrix) { create(&f32, 1.f))); vals.push_back(create( create(&f32, 1.f))); - auto* lhs = create(&vec3, std::move(vals)); + auto* lhs = create(&vec3, vals); auto* rhs = create("mat"); td.RegisterVariableForTesting(var); - ast::BinaryExpression expr(ast::BinaryOp::kMultiply, std::move(lhs), - std::move(rhs)); + ast::BinaryExpression expr(ast::BinaryOp::kMultiply, lhs, rhs); ASSERT_TRUE(td.DetermineResultType(&expr)) << td.error(); @@ -775,8 +788,7 @@ TEST_F(BuilderTest, Binary_Multiply_MatrixMatrix) { td.RegisterVariableForTesting(var); - ast::BinaryExpression expr(ast::BinaryOp::kMultiply, std::move(lhs), - std::move(rhs)); + ast::BinaryExpression expr(ast::BinaryOp::kMultiply, lhs, rhs); ASSERT_TRUE(td.DetermineResultType(&expr)) << td.error(); @@ -814,8 +826,7 @@ TEST_F(BuilderTest, Binary_LogicalAnd) { create( create(&i32, 4))); - ast::BinaryExpression expr(ast::BinaryOp::kLogicalAnd, std::move(lhs), - std::move(rhs)); + ast::BinaryExpression expr(ast::BinaryOp::kLogicalAnd, lhs, rhs); ASSERT_TRUE(td.DetermineResultType(&expr)) << td.error(); @@ -861,8 +872,7 @@ TEST_F(BuilderTest, Binary_LogicalAnd_WithLoads) { td.RegisterVariableForTesting(a_var); td.RegisterVariableForTesting(b_var); - ast::BinaryExpression expr(ast::BinaryOp::kLogicalAnd, std::move(lhs), - std::move(rhs)); + ast::BinaryExpression expr(ast::BinaryOp::kLogicalAnd, lhs, rhs); ASSERT_TRUE(td.DetermineResultType(&expr)) << td.error(); @@ -910,8 +920,7 @@ TEST_F(BuilderTest, Binary_LogicalOr) { create( create(&i32, 4))); - ast::BinaryExpression expr(ast::BinaryOp::kLogicalOr, std::move(lhs), - std::move(rhs)); + ast::BinaryExpression expr(ast::BinaryOp::kLogicalOr, lhs, rhs); ASSERT_TRUE(td.DetermineResultType(&expr)) << td.error(); @@ -957,8 +966,7 @@ TEST_F(BuilderTest, Binary_LogicalOr_WithLoads) { td.RegisterVariableForTesting(a_var); td.RegisterVariableForTesting(b_var); - ast::BinaryExpression expr(ast::BinaryOp::kLogicalOr, std::move(lhs), - std::move(rhs)); + ast::BinaryExpression expr(ast::BinaryOp::kLogicalOr, lhs, rhs); ASSERT_TRUE(td.DetermineResultType(&expr)) << td.error(); diff --git a/src/writer/spirv/builder_block_test.cc b/src/writer/spirv/builder_block_test.cc index 8e5d888973..362536ac5c 100644 --- a/src/writer/spirv/builder_block_test.cc +++ b/src/writer/spirv/builder_block_test.cc @@ -57,7 +57,7 @@ TEST_F(BuilderTest, Block) { create( create(&f32, 2.0f)))); - outer.append(std::move(inner)); + outer.append(inner); outer.append(create( create("var"), create( diff --git a/src/writer/spirv/builder_call_test.cc b/src/writer/spirv/builder_call_test.cc index fcd1cd6e02..1ca5c0e88f 100644 --- a/src/writer/spirv/builder_call_test.cc +++ b/src/writer/spirv/builder_call_test.cc @@ -53,7 +53,7 @@ TEST_F(BuilderTest, Expression_Call) { body->append(create(create( ast::BinaryOp::kAdd, create("a"), create("b")))); - ast::Function a_func("a_func", std::move(func_params), &f32, std::move(body)); + ast::Function a_func("a_func", func_params, &f32, body); ast::Function func("main", {}, &void_type, create()); @@ -64,7 +64,7 @@ TEST_F(BuilderTest, Expression_Call) { create(&f32, 1.f))); ast::CallExpression expr(create("a_func"), - std::move(call_params)); + call_params); ASSERT_TRUE(td.DetermineFunction(&func)) << td.error(); ASSERT_TRUE(td.DetermineFunction(&a_func)) << td.error(); @@ -114,8 +114,7 @@ TEST_F(BuilderTest, Statement_Call) { ast::BinaryOp::kAdd, create("a"), create("b")))); - ast::Function a_func("a_func", std::move(func_params), &void_type, - std::move(body)); + ast::Function a_func("a_func", func_params, &void_type, body); ast::Function func("main", {}, &void_type, create()); @@ -126,7 +125,7 @@ TEST_F(BuilderTest, Statement_Call) { create(&f32, 1.f))); ast::CallStatement expr(create( - create("a_func"), std::move(call_params))); + create("a_func"), call_params)); ASSERT_TRUE(td.DetermineFunction(&func)) << td.error(); ASSERT_TRUE(td.DetermineFunction(&a_func)) << td.error(); diff --git a/src/writer/spirv/builder_constructor_expression_test.cc b/src/writer/spirv/builder_constructor_expression_test.cc index 783d8dd544..8af8ad502f 100644 --- a/src/writer/spirv/builder_constructor_expression_test.cc +++ b/src/writer/spirv/builder_constructor_expression_test.cc @@ -53,7 +53,7 @@ using BuilderTest = TestHelper; TEST_F(BuilderTest, Constructor_Const) { ast::type::F32Type f32; auto* fl = create(&f32, 42.2f); - ast::ScalarConstructorExpression c(std::move(fl)); + ast::ScalarConstructorExpression c(fl); EXPECT_EQ(b.GenerateConstructorExpression(nullptr, &c, true), 2u); ASSERT_FALSE(b.has_error()) << b.error(); @@ -75,7 +75,7 @@ TEST_F(BuilderTest, Constructor_Type) { vals.push_back(create( create(&f32, 3.0f))); - ast::TypeConstructorExpression t(&vec, std::move(vals)); + ast::TypeConstructorExpression t(&vec, vals); EXPECT_TRUE(td.DetermineResultType(&t)) << td.error(); @@ -100,15 +100,13 @@ TEST_F(BuilderTest, Constructor_Type_WithCasts) { create(&i32, 1))); ast::ExpressionList vals; - vals.push_back( - create(&f32, std::move(type_vals))); + vals.push_back(create(&f32, type_vals)); type_vals.push_back(create( create(&i32, 1))); - vals.push_back( - create(&f32, std::move(type_vals))); + vals.push_back(create(&f32, type_vals)); - ast::TypeConstructorExpression t(&vec, std::move(vals)); + ast::TypeConstructorExpression t(&vec, vals); EXPECT_TRUE(td.DetermineResultType(&t)) << td.error(); @@ -142,7 +140,7 @@ TEST_F(BuilderTest, Constructor_Type_WithAlias) { params.push_back(create( create(&f32, 2.3))); - ast::TypeConstructorExpression cast(&alias, std::move(params)); + ast::TypeConstructorExpression cast(&alias, params); ASSERT_TRUE(td.DetermineResultType(&cast)) << td.error(); @@ -170,7 +168,7 @@ TEST_F(BuilderTest, Constructor_Type_IdentifierExpression_Param) { create(&f32, 1.0f))); vals.push_back(create("ident")); - ast::TypeConstructorExpression t(&vec, std::move(vals)); + ast::TypeConstructorExpression t(&vec, vals); td.RegisterVariableForTesting(var); EXPECT_TRUE(td.DetermineResultType(&t)) << td.error(); @@ -208,7 +206,7 @@ TEST_F(BuilderTest, Constructor_Vector_Bitcast_Params) { vals.push_back(create( create(&i32, 1))); - ast::TypeConstructorExpression t(&vec, std::move(vals)); + ast::TypeConstructorExpression t(&vec, vals); EXPECT_TRUE(td.DetermineResultType(&t)) << td.error(); @@ -243,9 +241,9 @@ TEST_F(BuilderTest, Constructor_Type_NonConst_Value_Fails) { ast::ExpressionList vals; vals.push_back(create( create(&f32, 1.0f))); - vals.push_back(std::move(rel)); + vals.push_back(rel); - ast::TypeConstructorExpression t(&vec, std::move(vals)); + ast::TypeConstructorExpression t(&vec, vals); EXPECT_TRUE(td.DetermineResultType(&t)) << td.error(); @@ -261,7 +259,7 @@ TEST_F(BuilderTest, Constructor_Type_Bool_With_Bool) { vals.push_back(create( create(&bool_type, true))); - ast::TypeConstructorExpression t(&bool_type, std::move(vals)); + ast::TypeConstructorExpression t(&bool_type, vals); ASSERT_TRUE(td.DetermineResultType(&t)) << td.error(); @@ -285,7 +283,7 @@ TEST_F(BuilderTest, Constructor_Type_I32_With_I32) { params.push_back(create( create(&i32, 2))); - ast::TypeConstructorExpression cast(&i32, std::move(params)); + ast::TypeConstructorExpression cast(&i32, params); ASSERT_TRUE(td.DetermineResultType(&cast)) << td.error(); @@ -307,7 +305,7 @@ TEST_F(BuilderTest, Constructor_Type_U32_With_U32) { params.push_back(create( create(&u32, 2))); - ast::TypeConstructorExpression cast(&u32, std::move(params)); + ast::TypeConstructorExpression cast(&u32, params); ASSERT_TRUE(td.DetermineResultType(&cast)) << td.error(); @@ -329,7 +327,7 @@ TEST_F(BuilderTest, Constructor_Type_F32_With_F32) { params.push_back(create( create(&f32, 2.0))); - ast::TypeConstructorExpression cast(&f32, std::move(params)); + ast::TypeConstructorExpression cast(&f32, params); ASSERT_TRUE(td.DetermineResultType(&cast)) << td.error(); @@ -354,7 +352,7 @@ TEST_F(BuilderTest, Constructor_Type_Vec2_With_F32_F32) { params.push_back(create( create(&f32, 2.0))); - ast::TypeConstructorExpression cast(&vec, std::move(params)); + ast::TypeConstructorExpression cast(&vec, params); ASSERT_TRUE(td.DetermineResultType(&cast)) << td.error(); @@ -380,7 +378,7 @@ TEST_F(BuilderTest, Constructor_Type_Vec3_With_F32_F32_F32) { params.push_back(create( create(&f32, 2.0))); - ast::TypeConstructorExpression cast(&vec, std::move(params)); + ast::TypeConstructorExpression cast(&vec, params); ASSERT_TRUE(td.DetermineResultType(&cast)) << td.error(); @@ -408,10 +406,9 @@ TEST_F(BuilderTest, Constructor_Type_Vec3_With_F32_Vec2) { ast::ExpressionList params; params.push_back(create( create(&f32, 2.0))); - params.push_back( - create(&vec2, std::move(vec_params))); + params.push_back(create(&vec2, vec_params)); - ast::TypeConstructorExpression cast(&vec3, std::move(params)); + ast::TypeConstructorExpression cast(&vec3, params); ASSERT_TRUE(td.DetermineResultType(&cast)) << td.error(); @@ -443,12 +440,11 @@ TEST_F(BuilderTest, Constructor_Type_Vec3_With_Vec2_F32) { create(&f32, 2.0))); ast::ExpressionList params; - params.push_back( - create(&vec2, std::move(vec_params))); + params.push_back(create(&vec2, vec_params)); params.push_back(create( create(&f32, 2.0))); - ast::TypeConstructorExpression cast(&vec3, std::move(params)); + ast::TypeConstructorExpression cast(&vec3, params); ASSERT_TRUE(td.DetermineResultType(&cast)) << td.error(); @@ -482,7 +478,7 @@ TEST_F(BuilderTest, Constructor_Type_Vec4_With_F32_F32_F32_F32) { params.push_back(create( create(&f32, 2.0))); - ast::TypeConstructorExpression cast(&vec, std::move(params)); + ast::TypeConstructorExpression cast(&vec, params); ASSERT_TRUE(td.DetermineResultType(&cast)) << td.error(); @@ -512,10 +508,9 @@ TEST_F(BuilderTest, Constructor_Type_Vec4_With_F32_F32_Vec2) { create(&f32, 2.0))); params.push_back(create( create(&f32, 2.0))); - params.push_back( - create(&vec2, std::move(vec_params))); + params.push_back(create(&vec2, vec_params)); - ast::TypeConstructorExpression cast(&vec4, std::move(params)); + ast::TypeConstructorExpression cast(&vec4, params); ASSERT_TRUE(td.DetermineResultType(&cast)) << td.error(); @@ -549,12 +544,11 @@ TEST_F(BuilderTest, Constructor_Type_Vec4_With_F32_Vec2_F32) { ast::ExpressionList params; params.push_back(create( create(&f32, 2.0))); - params.push_back( - create(&vec2, std::move(vec_params))); + params.push_back(create(&vec2, vec_params)); params.push_back(create( create(&f32, 2.0))); - ast::TypeConstructorExpression cast(&vec4, std::move(params)); + ast::TypeConstructorExpression cast(&vec4, params); ASSERT_TRUE(td.DetermineResultType(&cast)) << td.error(); @@ -586,14 +580,13 @@ TEST_F(BuilderTest, Constructor_Type_Vec4_With_Vec2_F32_F32) { create(&f32, 2.0))); ast::ExpressionList params; - params.push_back( - create(&vec2, std::move(vec_params))); + params.push_back(create(&vec2, vec_params)); params.push_back(create( create(&f32, 2.0))); params.push_back(create( create(&f32, 2.0))); - ast::TypeConstructorExpression cast(&vec4, std::move(params)); + ast::TypeConstructorExpression cast(&vec4, params); ASSERT_TRUE(td.DetermineResultType(&cast)) << td.error(); @@ -631,12 +624,10 @@ TEST_F(BuilderTest, Constructor_Type_Vec4_With_Vec2_Vec2) { create(&f32, 2.0))); ast::ExpressionList params; - params.push_back( - create(&vec2, std::move(vec_params))); - params.push_back( - create(&vec2, std::move(vec2_params))); + params.push_back(create(&vec2, vec_params)); + params.push_back(create(&vec2, vec2_params)); - ast::TypeConstructorExpression cast(&vec4, std::move(params)); + ast::TypeConstructorExpression cast(&vec4, params); ASSERT_TRUE(td.DetermineResultType(&cast)) << td.error(); @@ -674,10 +665,9 @@ TEST_F(BuilderTest, Constructor_Type_Vec4_With_F32_Vec3) { ast::ExpressionList params; params.push_back(create( create(&f32, 2.0))); - params.push_back( - create(&vec3, std::move(vec_params))); + params.push_back(create(&vec3, vec_params)); - ast::TypeConstructorExpression cast(&vec4, std::move(params)); + ast::TypeConstructorExpression cast(&vec4, params); ASSERT_TRUE(td.DetermineResultType(&cast)) << td.error(); @@ -712,12 +702,11 @@ TEST_F(BuilderTest, Constructor_Type_Vec4_With_Vec3_F32) { create(&f32, 2.0))); ast::ExpressionList params; - params.push_back( - create(&vec3, std::move(vec_params))); + params.push_back(create(&vec3, vec_params)); params.push_back(create( create(&f32, 2.0))); - ast::TypeConstructorExpression cast(&vec4, std::move(params)); + ast::TypeConstructorExpression cast(&vec4, params); ASSERT_TRUE(td.DetermineResultType(&cast)) << td.error(); @@ -752,10 +741,9 @@ TEST_F(BuilderTest, Constructor_Type_ModuleScope_Vec3_With_F32_Vec2) { ast::ExpressionList params; params.push_back(create( create(&f32, 2.0))); - params.push_back( - create(&vec2, std::move(vec_params))); + params.push_back(create(&vec2, vec_params)); - ast::TypeConstructorExpression cast(&vec3, std::move(params)); + ast::TypeConstructorExpression cast(&vec3, params); ASSERT_TRUE(td.DetermineResultType(&cast)) << td.error(); @@ -788,12 +776,11 @@ TEST_F(BuilderTest, Constructor_Type_ModuleScope_Vec3_With_Vec2_F32) { create(&f32, 2.0))); ast::ExpressionList params; - params.push_back( - create(&vec2, std::move(vec_params))); + params.push_back(create(&vec2, vec_params)); params.push_back(create( create(&f32, 2.0))); - ast::TypeConstructorExpression cast(&vec3, std::move(params)); + ast::TypeConstructorExpression cast(&vec3, params); ASSERT_TRUE(td.DetermineResultType(&cast)) << td.error(); @@ -830,10 +817,9 @@ TEST_F(BuilderTest, Constructor_Type_ModuleScope_Vec4_With_F32_F32_Vec2) { create(&f32, 2.0))); params.push_back(create( create(&f32, 2.0))); - params.push_back( - create(&vec2, std::move(vec_params))); + params.push_back(create(&vec2, vec_params)); - ast::TypeConstructorExpression cast(&vec4, std::move(params)); + ast::TypeConstructorExpression cast(&vec4, params); ASSERT_TRUE(td.DetermineResultType(&cast)) << td.error(); @@ -868,12 +854,11 @@ TEST_F(BuilderTest, Constructor_Type_ModuleScope_Vec4_With_F32_Vec2_F32) { ast::ExpressionList params; params.push_back(create( create(&f32, 2.0))); - params.push_back( - create(&vec2, std::move(vec_params))); + params.push_back(create(&vec2, vec_params)); params.push_back(create( create(&f32, 2.0))); - ast::TypeConstructorExpression cast(&vec4, std::move(params)); + ast::TypeConstructorExpression cast(&vec4, params); ASSERT_TRUE(td.DetermineResultType(&cast)) << td.error(); @@ -906,14 +891,13 @@ TEST_F(BuilderTest, Constructor_Type_ModuleScope_Vec4_With_Vec2_F32_F32) { create(&f32, 2.0))); ast::ExpressionList params; - params.push_back( - create(&vec2, std::move(vec_params))); + params.push_back(create(&vec2, vec_params)); params.push_back(create( create(&f32, 2.0))); params.push_back(create( create(&f32, 2.0))); - ast::TypeConstructorExpression cast(&vec4, std::move(params)); + ast::TypeConstructorExpression cast(&vec4, params); ASSERT_TRUE(td.DetermineResultType(&cast)) << td.error(); @@ -952,12 +936,10 @@ TEST_F(BuilderTest, Constructor_Type_ModuleScope_Vec4_With_Vec2_Vec2) { create(&f32, 2.0))); ast::ExpressionList params; - params.push_back( - create(&vec2, std::move(vec_params))); - params.push_back( - create(&vec2, std::move(vec2_params))); + params.push_back(create(&vec2, vec_params)); + params.push_back(create(&vec2, vec2_params)); - ast::TypeConstructorExpression cast(&vec4, std::move(params)); + ast::TypeConstructorExpression cast(&vec4, params); ASSERT_TRUE(td.DetermineResultType(&cast)) << td.error(); @@ -996,10 +978,9 @@ TEST_F(BuilderTest, Constructor_Type_ModuleScope_Vec4_With_F32_Vec3) { ast::ExpressionList params; params.push_back(create( create(&f32, 2.0))); - params.push_back( - create(&vec3, std::move(vec_params))); + params.push_back(create(&vec3, vec_params)); - ast::TypeConstructorExpression cast(&vec4, std::move(params)); + ast::TypeConstructorExpression cast(&vec4, params); ASSERT_TRUE(td.DetermineResultType(&cast)) << td.error(); @@ -1036,12 +1017,11 @@ TEST_F(BuilderTest, Constructor_Type_ModuleScope_Vec4_With_Vec3_F32) { create(&f32, 2.0))); ast::ExpressionList params; - params.push_back( - create(&vec3, std::move(vec_params))); + params.push_back(create(&vec3, vec_params)); params.push_back(create( create(&f32, 2.0))); - ast::TypeConstructorExpression cast(&vec4, std::move(params)); + ast::TypeConstructorExpression cast(&vec4, params); ASSERT_TRUE(td.DetermineResultType(&cast)) << td.error(); @@ -1082,12 +1062,10 @@ TEST_F(BuilderTest, Constructor_Type_Mat2x2_With_Vec2_Vec2) { create(&f32, 2.0))); ast::ExpressionList params; - params.push_back( - create(&vec, std::move(vec_params))); - params.push_back( - create(&vec, std::move(vec2_params))); + params.push_back(create(&vec, vec_params)); + params.push_back(create(&vec, vec2_params)); - ast::TypeConstructorExpression cast(&mat, std::move(params)); + ast::TypeConstructorExpression cast(&mat, params); ASSERT_TRUE(td.DetermineResultType(&cast)) << td.error(); @@ -1127,14 +1105,11 @@ TEST_F(BuilderTest, Constructor_Type_Mat3x2_With_Vec2_Vec2_Vec2) { create(&f32, 2.0))); ast::ExpressionList params; - params.push_back( - create(&vec, std::move(vec_params))); - params.push_back( - create(&vec, std::move(vec2_params))); - params.push_back( - create(&vec, std::move(vec3_params))); + params.push_back(create(&vec, vec_params)); + params.push_back(create(&vec, vec2_params)); + params.push_back(create(&vec, vec3_params)); - ast::TypeConstructorExpression cast(&mat, std::move(params)); + ast::TypeConstructorExpression cast(&mat, params); ASSERT_TRUE(td.DetermineResultType(&cast)) << td.error(); @@ -1180,16 +1155,12 @@ TEST_F(BuilderTest, Constructor_Type_Mat4x2_With_Vec2_Vec2_Vec2_Vec2) { create(&f32, 2.0))); ast::ExpressionList params; - params.push_back( - create(&vec, std::move(vec_params))); - params.push_back( - create(&vec, std::move(vec2_params))); - params.push_back( - create(&vec, std::move(vec3_params))); - params.push_back( - create(&vec, std::move(vec4_params))); + params.push_back(create(&vec, vec_params)); + params.push_back(create(&vec, vec2_params)); + params.push_back(create(&vec, vec3_params)); + params.push_back(create(&vec, vec4_params)); - ast::TypeConstructorExpression cast(&mat, std::move(params)); + ast::TypeConstructorExpression cast(&mat, params); ASSERT_TRUE(td.DetermineResultType(&cast)) << td.error(); @@ -1227,12 +1198,10 @@ TEST_F(BuilderTest, Constructor_Type_Mat2x3_With_Vec3_Vec3) { create(&f32, 2.0))); ast::ExpressionList params; - params.push_back( - create(&vec, std::move(vec_params))); - params.push_back( - create(&vec, std::move(vec2_params))); + params.push_back(create(&vec, vec_params)); + params.push_back(create(&vec, vec2_params)); - ast::TypeConstructorExpression cast(&mat, std::move(params)); + ast::TypeConstructorExpression cast(&mat, params); ASSERT_TRUE(td.DetermineResultType(&cast)) << td.error(); @@ -1278,14 +1247,11 @@ TEST_F(BuilderTest, Constructor_Type_Mat3x3_With_Vec3_Vec3_Vec3) { create(&f32, 2.0))); ast::ExpressionList params; - params.push_back( - create(&vec, std::move(vec_params))); - params.push_back( - create(&vec, std::move(vec2_params))); - params.push_back( - create(&vec, std::move(vec3_params))); + params.push_back(create(&vec, vec_params)); + params.push_back(create(&vec, vec2_params)); + params.push_back(create(&vec, vec3_params)); - ast::TypeConstructorExpression cast(&mat, std::move(params)); + ast::TypeConstructorExpression cast(&mat, params); ASSERT_TRUE(td.DetermineResultType(&cast)) << td.error(); @@ -1339,16 +1305,12 @@ TEST_F(BuilderTest, Constructor_Type_Mat4x3_With_Vec3_Vec3_Vec3_Vec3) { create(&f32, 2.0))); ast::ExpressionList params; - params.push_back( - create(&vec, std::move(vec_params))); - params.push_back( - create(&vec, std::move(vec2_params))); - params.push_back( - create(&vec, std::move(vec3_params))); - params.push_back( - create(&vec, std::move(vec4_params))); + params.push_back(create(&vec, vec_params)); + params.push_back(create(&vec, vec2_params)); + params.push_back(create(&vec, vec3_params)); + params.push_back(create(&vec, vec4_params)); - ast::TypeConstructorExpression cast(&mat, std::move(params)); + ast::TypeConstructorExpression cast(&mat, params); ASSERT_TRUE(td.DetermineResultType(&cast)) << td.error(); @@ -1390,12 +1352,10 @@ TEST_F(BuilderTest, Constructor_Type_Mat2x4_With_Vec4_Vec4) { create(&f32, 2.0))); ast::ExpressionList params; - params.push_back( - create(&vec, std::move(vec_params))); - params.push_back( - create(&vec, std::move(vec2_params))); + params.push_back(create(&vec, vec_params)); + params.push_back(create(&vec, vec2_params)); - ast::TypeConstructorExpression cast(&mat, std::move(params)); + ast::TypeConstructorExpression cast(&mat, params); ASSERT_TRUE(td.DetermineResultType(&cast)) << td.error(); @@ -1447,14 +1407,11 @@ TEST_F(BuilderTest, Constructor_Type_Mat3x4_With_Vec4_Vec4_Vec4) { create(&f32, 2.0))); ast::ExpressionList params; - params.push_back( - create(&vec, std::move(vec_params))); - params.push_back( - create(&vec, std::move(vec2_params))); - params.push_back( - create(&vec, std::move(vec3_params))); + params.push_back(create(&vec, vec_params)); + params.push_back(create(&vec, vec2_params)); + params.push_back(create(&vec, vec3_params)); - ast::TypeConstructorExpression cast(&mat, std::move(params)); + ast::TypeConstructorExpression cast(&mat, params); ASSERT_TRUE(td.DetermineResultType(&cast)) << td.error(); @@ -1516,16 +1473,12 @@ TEST_F(BuilderTest, Constructor_Type_Mat4x4_With_Vec4_Vec4_Vec4_Vec4) { create(&f32, 2.0))); ast::ExpressionList params; - params.push_back( - create(&vec, std::move(vec_params))); - params.push_back( - create(&vec, std::move(vec2_params))); - params.push_back( - create(&vec, std::move(vec3_params))); - params.push_back( - create(&vec, std::move(vec4_params))); + params.push_back(create(&vec, vec_params)); + params.push_back(create(&vec, vec2_params)); + params.push_back(create(&vec, vec3_params)); + params.push_back(create(&vec, vec4_params)); - ast::TypeConstructorExpression cast(&mat, std::move(params)); + ast::TypeConstructorExpression cast(&mat, params); ASSERT_TRUE(td.DetermineResultType(&cast)) << td.error(); @@ -1557,7 +1510,7 @@ TEST_F(BuilderTest, Constructor_Type_Array_5_F32) { params.push_back(create( create(&f32, 2.0))); - ast::TypeConstructorExpression cast(&ary, std::move(params)); + ast::TypeConstructorExpression cast(&ary, params); ASSERT_TRUE(td.DetermineResultType(&cast)) << td.error(); @@ -1595,12 +1548,10 @@ TEST_F(BuilderTest, Constructor_Type_Array_2_Vec3) { create(&f32, 2.0))); ast::ExpressionList params; - params.push_back( - create(&vec, std::move(vec_params))); - params.push_back( - create(&vec, std::move(vec2_params))); + params.push_back(create(&vec, vec_params)); + params.push_back(create(&vec, vec2_params)); - ast::TypeConstructorExpression cast(&ary, std::move(params)); + ast::TypeConstructorExpression cast(&ary, params); ASSERT_TRUE(td.DetermineResultType(&cast)) << td.error(); @@ -1624,11 +1575,11 @@ TEST_F(BuilderTest, Constructor_Type_Struct) { ast::StructMemberDecorationList decos; ast::StructMemberList members; - members.push_back(create("a", &f32, std::move(decos))); - members.push_back(create("b", &vec, std::move(decos))); + members.push_back(create("a", &f32, decos)); + members.push_back(create("b", &vec, decos)); - auto* s = create(std::move(members)); - ast::type::StructType s_type("my_struct", std::move(s)); + auto* s = create(members); + ast::type::StructType s_type("my_struct", s); ast::ExpressionList vec_vals; vec_vals.push_back(create( @@ -1641,10 +1592,9 @@ TEST_F(BuilderTest, Constructor_Type_Struct) { ast::ExpressionList vals; vals.push_back(create( create(&f32, 2))); - vals.push_back( - create(&vec, std::move(vec_vals))); + vals.push_back(create(&vec, vec_vals)); - ast::TypeConstructorExpression t(&s_type, std::move(vals)); + ast::TypeConstructorExpression t(&s_type, vals); EXPECT_TRUE(td.DetermineResultType(&t)) << td.error(); @@ -1666,7 +1616,7 @@ TEST_F(BuilderTest, Constructor_Type_ZeroInit_F32) { ast::type::F32Type f32; ast::ExpressionList vals; - ast::TypeConstructorExpression t(&f32, std::move(vals)); + ast::TypeConstructorExpression t(&f32, vals); EXPECT_TRUE(td.DetermineResultType(&t)) << td.error(); @@ -1684,7 +1634,7 @@ TEST_F(BuilderTest, Constructor_Type_ZeroInit_I32) { ast::type::I32Type i32; ast::ExpressionList vals; - ast::TypeConstructorExpression t(&i32, std::move(vals)); + ast::TypeConstructorExpression t(&i32, vals); EXPECT_TRUE(td.DetermineResultType(&t)) << td.error(); @@ -1702,7 +1652,7 @@ TEST_F(BuilderTest, Constructor_Type_ZeroInit_U32) { ast::type::U32Type u32; ast::ExpressionList vals; - ast::TypeConstructorExpression t(&u32, std::move(vals)); + ast::TypeConstructorExpression t(&u32, vals); EXPECT_TRUE(td.DetermineResultType(&t)) << td.error(); @@ -1720,7 +1670,7 @@ TEST_F(BuilderTest, Constructor_Type_ZeroInit_Bool) { ast::type::BoolType bool_type; ast::ExpressionList vals; - ast::TypeConstructorExpression t(&bool_type, std::move(vals)); + ast::TypeConstructorExpression t(&bool_type, vals); EXPECT_TRUE(td.DetermineResultType(&t)) << td.error(); @@ -1739,7 +1689,7 @@ TEST_F(BuilderTest, Constructor_Type_ZeroInit_Vector) { ast::type::VectorType vec(&i32, 2); ast::ExpressionList vals; - ast::TypeConstructorExpression t(&vec, std::move(vals)); + ast::TypeConstructorExpression t(&vec, vals); EXPECT_TRUE(td.DetermineResultType(&t)) << td.error(); @@ -1759,7 +1709,7 @@ TEST_F(BuilderTest, Constructor_Type_ZeroInit_Matrix) { ast::type::MatrixType mat(&f32, 2, 4); ast::ExpressionList vals; - ast::TypeConstructorExpression t(&mat, std::move(vals)); + ast::TypeConstructorExpression t(&mat, vals); EXPECT_TRUE(td.DetermineResultType(&t)) << td.error(); @@ -1780,7 +1730,7 @@ TEST_F(BuilderTest, Constructor_Type_ZeroInit_Array) { ast::type::ArrayType ary(&i32, 2); ast::ExpressionList vals; - ast::TypeConstructorExpression t(&ary, std::move(vals)); + ast::TypeConstructorExpression t(&ary, vals); EXPECT_TRUE(td.DetermineResultType(&t)) << td.error(); @@ -1802,13 +1752,13 @@ TEST_F(BuilderTest, Constructor_Type_ZeroInit_Struct) { ast::StructMemberDecorationList decos; ast::StructMemberList members; - members.push_back(create("a", &f32, std::move(decos))); + members.push_back(create("a", &f32, decos)); - auto* s = create(std::move(members)); - ast::type::StructType s_type("my_struct", std::move(s)); + auto* s = create(members); + ast::type::StructType s_type("my_struct", s); ast::ExpressionList vals; - ast::TypeConstructorExpression t(&s_type, std::move(vals)); + ast::TypeConstructorExpression t(&s_type, vals); EXPECT_TRUE(td.DetermineResultType(&t)) << td.error(); @@ -1831,7 +1781,7 @@ TEST_F(BuilderTest, Constructor_Type_Convert_U32_To_I32) { params.push_back(create( create(&u32, 2))); - ast::TypeConstructorExpression cast(&i32, std::move(params)); + ast::TypeConstructorExpression cast(&i32, params); ASSERT_TRUE(td.DetermineResultType(&cast)) << td.error(); @@ -1855,7 +1805,7 @@ TEST_F(BuilderTest, Constructor_Type_Convert_I32_To_U32) { params.push_back(create( create(&i32, 2))); - ast::TypeConstructorExpression cast(&u32, std::move(params)); + ast::TypeConstructorExpression cast(&u32, params); ASSERT_TRUE(td.DetermineResultType(&cast)) << td.error(); @@ -1879,7 +1829,7 @@ TEST_F(BuilderTest, Constructor_Type_Convert_F32_To_I32) { params.push_back(create( create(&f32, 2.4))); - ast::TypeConstructorExpression cast(&i32, std::move(params)); + ast::TypeConstructorExpression cast(&i32, params); ASSERT_TRUE(td.DetermineResultType(&cast)) << td.error(); @@ -1903,7 +1853,7 @@ TEST_F(BuilderTest, Constructor_Type_Convert_F32_To_U32) { params.push_back(create( create(&f32, 2.4))); - ast::TypeConstructorExpression cast(&u32, std::move(params)); + ast::TypeConstructorExpression cast(&u32, params); ASSERT_TRUE(td.DetermineResultType(&cast)) << td.error(); @@ -1927,7 +1877,7 @@ TEST_F(BuilderTest, Constructor_Type_Convert_I32_To_F32) { params.push_back(create( create(&i32, 2))); - ast::TypeConstructorExpression cast(&f32, std::move(params)); + ast::TypeConstructorExpression cast(&f32, params); ASSERT_TRUE(td.DetermineResultType(&cast)) << td.error(); @@ -1951,7 +1901,7 @@ TEST_F(BuilderTest, Constructor_Type_Convert_U32_To_F32) { params.push_back(create( create(&u32, 2))); - ast::TypeConstructorExpression cast(&f32, std::move(params)); + ast::TypeConstructorExpression cast(&f32, params); ASSERT_TRUE(td.DetermineResultType(&cast)) << td.error(); @@ -1978,7 +1928,7 @@ TEST_F(BuilderTest, Constructor_Type_Convert_Vectors_U32_to_I32) { ast::ExpressionList params; params.push_back(create("i")); - ast::TypeConstructorExpression cast(&ivec3, std::move(params)); + ast::TypeConstructorExpression cast(&ivec3, params); td.RegisterVariableForTesting(var); ASSERT_TRUE(td.DetermineResultType(&cast)) << td.error(); @@ -2012,7 +1962,7 @@ TEST_F(BuilderTest, Constructor_Type_Convert_Vectors_F32_to_I32) { ast::ExpressionList params; params.push_back(create("i")); - ast::TypeConstructorExpression cast(&ivec3, std::move(params)); + ast::TypeConstructorExpression cast(&ivec3, params); td.RegisterVariableForTesting(var); ASSERT_TRUE(td.DetermineResultType(&cast)) << td.error(); @@ -2046,7 +1996,7 @@ TEST_F(BuilderTest, Constructor_Type_Convert_Vectors_I32_to_U32) { ast::ExpressionList params; params.push_back(create("i")); - ast::TypeConstructorExpression cast(&uvec3, std::move(params)); + ast::TypeConstructorExpression cast(&uvec3, params); td.RegisterVariableForTesting(var); ASSERT_TRUE(td.DetermineResultType(&cast)) << td.error(); @@ -2080,7 +2030,7 @@ TEST_F(BuilderTest, Constructor_Type_Convert_Vectors_F32_to_U32) { ast::ExpressionList params; params.push_back(create("i")); - ast::TypeConstructorExpression cast(&uvec3, std::move(params)); + ast::TypeConstructorExpression cast(&uvec3, params); td.RegisterVariableForTesting(var); ASSERT_TRUE(td.DetermineResultType(&cast)) << td.error(); @@ -2114,7 +2064,7 @@ TEST_F(BuilderTest, Constructor_Type_Convert_Vectors_I32_to_F32) { ast::ExpressionList params; params.push_back(create("i")); - ast::TypeConstructorExpression cast(&fvec3, std::move(params)); + ast::TypeConstructorExpression cast(&fvec3, params); td.RegisterVariableForTesting(var); ASSERT_TRUE(td.DetermineResultType(&cast)) << td.error(); @@ -2148,7 +2098,7 @@ TEST_F(BuilderTest, Constructor_Type_Convert_Vectors_U32_to_F32) { ast::ExpressionList params; params.push_back(create("i")); - ast::TypeConstructorExpression cast(&fvec3, std::move(params)); + ast::TypeConstructorExpression cast(&fvec3, params); td.RegisterVariableForTesting(var); ASSERT_TRUE(td.DetermineResultType(&cast)) << td.error(); @@ -2183,7 +2133,7 @@ TEST_F(BuilderTest, IsConstructorConst_GlobalVectorWithAllConstConstructors) { create(&f32, 2.f))); params.push_back(create( create(&f32, 3.f))); - ast::TypeConstructorExpression t(&vec, std::move(params)); + ast::TypeConstructorExpression t(&vec, params); ASSERT_TRUE(td.DetermineResultType(&t)) << td.error(); @@ -2200,7 +2150,7 @@ TEST_F(BuilderTest, IsConstructorConst_GlobalVector_WithIdent) { params.push_back(create("a")); params.push_back(create("b")); params.push_back(create("c")); - ast::TypeConstructorExpression t(&vec, std::move(params)); + ast::TypeConstructorExpression t(&vec, params); ast::Variable var_a("a", ast::StorageClass::kPrivate, &f32); ast::Variable var_b("b", ast::StorageClass::kPrivate, &f32); @@ -2230,7 +2180,7 @@ TEST_F(BuilderTest, IsConstructorConst_GlobalArrayWithAllConstConstructors) { create(&f32, 2.f))); params.push_back(create( create(&f32, 3.f))); - auto* first = create(&vec, std::move(params)); + auto* first = create(&vec, params); params.push_back(create( create(&f32, 1.f))); @@ -2238,13 +2188,12 @@ TEST_F(BuilderTest, IsConstructorConst_GlobalArrayWithAllConstConstructors) { create(&f32, 2.f))); params.push_back(create( create(&f32, 3.f))); - auto* second = - create(&vec, std::move(params)); + auto* second = create(&vec, params); ast::ExpressionList ary_params; - ary_params.push_back(std::move(first)); - ary_params.push_back(std::move(second)); - ast::TypeConstructorExpression t(&ary, std::move(ary_params)); + ary_params.push_back(first); + ary_params.push_back(second); + ast::TypeConstructorExpression t(&ary, ary_params); ASSERT_TRUE(td.DetermineResultType(&t)) << td.error(); @@ -2263,15 +2212,13 @@ TEST_F(BuilderTest, ast::ExpressionList params; params.push_back(create( create(&f32, 1.0))); - vec_params.push_back( - create(&f32, std::move(params))); + vec_params.push_back(create(&f32, params)); params.push_back(create( create(&f32, 2.0))); - vec_params.push_back( - create(&f32, std::move(params))); + vec_params.push_back(create(&f32, params)); - ast::TypeConstructorExpression t(&vec, std::move(vec_params)); + ast::TypeConstructorExpression t(&vec, vec_params); ASSERT_TRUE(td.DetermineResultType(&t)) << td.error(); @@ -2290,15 +2237,13 @@ TEST_F(BuilderTest, IsConstructorConst_GlobalWithTypeCastConstructor) { ast::ExpressionList params; params.push_back(create( create(&i32, 1))); - vec_params.push_back( - create(&f32, std::move(params))); + vec_params.push_back(create(&f32, params)); params.push_back(create( create(&i32, 2))); - vec_params.push_back( - create(&f32, std::move(params))); + vec_params.push_back(create(&f32, params)); - ast::TypeConstructorExpression t(&vec, std::move(vec_params)); + ast::TypeConstructorExpression t(&vec, vec_params); ASSERT_TRUE(td.DetermineResultType(&t)) << td.error(); @@ -2318,7 +2263,7 @@ TEST_F(BuilderTest, IsConstructorConst_VectorWithAllConstConstructors) { create(&f32, 2.f))); params.push_back(create( create(&f32, 3.f))); - ast::TypeConstructorExpression t(&vec, std::move(params)); + ast::TypeConstructorExpression t(&vec, params); ASSERT_TRUE(td.DetermineResultType(&t)) << td.error(); @@ -2335,7 +2280,7 @@ TEST_F(BuilderTest, IsConstructorConst_Vector_WithIdent) { params.push_back(create("a")); params.push_back(create("b")); params.push_back(create("c")); - ast::TypeConstructorExpression t(&vec, std::move(params)); + ast::TypeConstructorExpression t(&vec, params); ast::Variable var_a("a", ast::StorageClass::kPrivate, &f32); ast::Variable var_b("b", ast::StorageClass::kPrivate, &f32); @@ -2364,7 +2309,7 @@ TEST_F(BuilderTest, IsConstructorConst_ArrayWithAllConstConstructors) { create(&f32, 2.f))); params.push_back(create( create(&f32, 3.f))); - auto* first = create(&vec, std::move(params)); + auto* first = create(&vec, params); params.push_back(create( create(&f32, 1.f))); @@ -2372,13 +2317,12 @@ TEST_F(BuilderTest, IsConstructorConst_ArrayWithAllConstConstructors) { create(&f32, 2.f))); params.push_back(create( create(&f32, 3.f))); - auto* second = - create(&vec, std::move(params)); + auto* second = create(&vec, params); ast::ExpressionList ary_params; - ary_params.push_back(std::move(first)); - ary_params.push_back(std::move(second)); - ast::TypeConstructorExpression t(&ary, std::move(ary_params)); + ary_params.push_back(first); + ary_params.push_back(second); + ast::TypeConstructorExpression t(&ary, ary_params); ASSERT_TRUE(td.DetermineResultType(&t)) << td.error(); @@ -2397,15 +2341,13 @@ TEST_F(BuilderTest, IsConstructorConst_VectorWith_TypeCastConstConstructors) { ast::ExpressionList params; params.push_back(create( create(&i32, 1))); - vec_params.push_back( - create(&f32, std::move(params))); + vec_params.push_back(create(&f32, params)); params.push_back(create( create(&i32, 2))); - vec_params.push_back( - create(&f32, std::move(params))); + vec_params.push_back(create(&f32, params)); - ast::TypeConstructorExpression t(&vec, std::move(vec_params)); + ast::TypeConstructorExpression t(&vec, vec_params); ASSERT_TRUE(td.DetermineResultType(&t)) << td.error(); @@ -2424,15 +2366,13 @@ TEST_F(BuilderTest, IsConstructorConst_WithTypeCastConstructor) { ast::ExpressionList params; params.push_back(create( create(&i32, 1))); - vec_params.push_back( - create(&f32, std::move(params))); + vec_params.push_back(create(&f32, params)); params.push_back(create( create(&i32, 2))); - vec_params.push_back( - create(&f32, std::move(params))); + vec_params.push_back(create(&f32, params)); - ast::TypeConstructorExpression t(&vec, std::move(vec_params)); + ast::TypeConstructorExpression t(&vec, vec_params); ASSERT_TRUE(td.DetermineResultType(&t)) << td.error(); @@ -2451,7 +2391,7 @@ TEST_F(BuilderTest, IsConstructorConst_BitCastScalars) { vals.push_back(create( create(&i32, 1))); - ast::TypeConstructorExpression t(&vec, std::move(vals)); + ast::TypeConstructorExpression t(&vec, vals); ASSERT_TRUE(td.DetermineResultType(&t)) << td.error(); @@ -2465,11 +2405,11 @@ TEST_F(BuilderTest, IsConstructorConst_Struct) { ast::StructMemberDecorationList decos; ast::StructMemberList members; - members.push_back(create("a", &f32, std::move(decos))); - members.push_back(create("b", &vec, std::move(decos))); + members.push_back(create("a", &f32, decos)); + members.push_back(create("b", &vec, decos)); - auto* s = create(std::move(members)); - ast::type::StructType s_type("my_struct", std::move(s)); + auto* s = create(members); + ast::type::StructType s_type("my_struct", s); ast::ExpressionList vec_vals; vec_vals.push_back(create( @@ -2482,10 +2422,9 @@ TEST_F(BuilderTest, IsConstructorConst_Struct) { ast::ExpressionList vals; vals.push_back(create( create(&f32, 2))); - vals.push_back( - create(&vec, std::move(vec_vals))); + vals.push_back(create(&vec, vec_vals)); - ast::TypeConstructorExpression t(&s_type, std::move(vals)); + ast::TypeConstructorExpression t(&s_type, vals); ASSERT_TRUE(td.DetermineResultType(&t)) << td.error(); @@ -2499,11 +2438,11 @@ TEST_F(BuilderTest, IsConstructorConst_Struct_WithIdentSubExpression) { ast::StructMemberDecorationList decos; ast::StructMemberList members; - members.push_back(create("a", &f32, std::move(decos))); - members.push_back(create("b", &vec, std::move(decos))); + members.push_back(create("a", &f32, decos)); + members.push_back(create("b", &vec, decos)); - auto* s = create(std::move(members)); - ast::type::StructType s_type("my_struct", std::move(s)); + auto* s = create(members); + ast::type::StructType s_type("my_struct", s); ast::ExpressionList vec_vals; vec_vals.push_back(create( @@ -2515,10 +2454,9 @@ TEST_F(BuilderTest, IsConstructorConst_Struct_WithIdentSubExpression) { ast::ExpressionList vals; vals.push_back(create( create(&f32, 2))); - vals.push_back( - create(&vec, std::move(vec_vals))); + vals.push_back(create(&vec, vec_vals)); - ast::TypeConstructorExpression t(&s_type, std::move(vals)); + ast::TypeConstructorExpression t(&s_type, vals); ast::Variable var_a("a", ast::StorageClass::kPrivate, &f32); ast::Variable var_b("b", ast::StorageClass::kPrivate, &f32); diff --git a/src/writer/spirv/builder_function_decoration_test.cc b/src/writer/spirv/builder_function_decoration_test.cc index 716e620523..a68f7804ca 100644 --- a/src/writer/spirv/builder_function_decoration_test.cc +++ b/src/writer/spirv/builder_function_decoration_test.cc @@ -105,9 +105,9 @@ TEST_F(BuilderTest, FunctionDecoration_Stage_WithUnusedInterfaceIds) { EXPECT_TRUE(b.GenerateGlobalVariable(v_out)) << b.error(); EXPECT_TRUE(b.GenerateGlobalVariable(v_wg)) << b.error(); - mod.AddGlobalVariable(std::move(v_in)); - mod.AddGlobalVariable(std::move(v_out)); - mod.AddGlobalVariable(std::move(v_wg)); + mod.AddGlobalVariable(v_in); + mod.AddGlobalVariable(v_out); + mod.AddGlobalVariable(v_wg); ASSERT_TRUE(b.GenerateFunction(&func)) << b.error(); EXPECT_EQ(DumpInstructions(b.debug()), R"(OpName %1 "tint_6d795f696e" @@ -150,7 +150,7 @@ TEST_F(BuilderTest, FunctionDecoration_Stage_WithUsedInterfaceIds) { body->append(create( create("my_out"), create("my_in"))); - func.set_body(std::move(body)); + func.set_body(body); auto* v_in = create("my_in", ast::StorageClass::kInput, &f32); auto* v_out = @@ -168,9 +168,9 @@ TEST_F(BuilderTest, FunctionDecoration_Stage_WithUsedInterfaceIds) { EXPECT_TRUE(b.GenerateGlobalVariable(v_out)) << b.error(); EXPECT_TRUE(b.GenerateGlobalVariable(v_wg)) << b.error(); - mod.AddGlobalVariable(std::move(v_in)); - mod.AddGlobalVariable(std::move(v_out)); - mod.AddGlobalVariable(std::move(v_wg)); + mod.AddGlobalVariable(v_in); + mod.AddGlobalVariable(v_out); + mod.AddGlobalVariable(v_wg); ASSERT_TRUE(b.GenerateFunction(&func)) << b.error(); EXPECT_EQ(DumpInstructions(b.debug()), R"(OpName %1 "tint_6d795f696e" diff --git a/src/writer/spirv/builder_function_test.cc b/src/writer/spirv/builder_function_test.cc index 7ff46769f8..528ee18d88 100644 --- a/src/writer/spirv/builder_function_test.cc +++ b/src/writer/spirv/builder_function_test.cc @@ -71,15 +71,15 @@ TEST_F(BuilderTest, Function_WithParams) { ast::VariableList params; auto* var_a = create("a", ast::StorageClass::kFunction, &f32); var_a->set_is_const(true); - params.push_back(std::move(var_a)); + params.push_back(var_a); auto* var_b = create("b", ast::StorageClass::kFunction, &i32); var_b->set_is_const(true); - params.push_back(std::move(var_b)); + params.push_back(var_b); auto* body = create(); body->append( create(create("a"))); - ast::Function func("a_func", std::move(params), &f32, std::move(body)); + ast::Function func("a_func", params, &f32, body); td.RegisterVariableForTesting(func.params()[0]); td.RegisterVariableForTesting(func.params()[1]); @@ -107,7 +107,7 @@ TEST_F(BuilderTest, Function_WithBody) { auto* body = create(); body->append(create()); - ast::Function func("a_func", {}, &void_type, std::move(body)); + ast::Function func("a_func", {}, &void_type, body); ASSERT_TRUE(b.GenerateFunction(&func)); EXPECT_EQ(DumpBuilder(b), R"(OpName %3 "tint_615f66756e63" @@ -165,14 +165,14 @@ TEST_F(BuilderTest, Emit_Multiple_EntryPoint_With_Same_ModuleVar) { ast::StructMemberList members; ast::StructMemberDecorationList a_deco; a_deco.push_back(create(0, Source{})); - members.push_back(create("d", &f32, std::move(a_deco))); + members.push_back(create("d", &f32, a_deco)); ast::StructDecorationList s_decos; s_decos.push_back(create(Source{})); - auto* str = create(std::move(s_decos), std::move(members)); + auto* str = create(s_decos, members); - ast::type::StructType s("Data", std::move(str)); + ast::type::StructType s("Data", str); ast::type::AccessControlType ac(ast::AccessControl::kReadWrite, &s); auto* data_var = create( @@ -181,12 +181,12 @@ TEST_F(BuilderTest, Emit_Multiple_EntryPoint_With_Same_ModuleVar) { ast::VariableDecorationList decos; decos.push_back(create(0, Source{})); decos.push_back(create(0, Source{})); - data_var->set_decorations(std::move(decos)); + data_var->set_decorations(decos); mod.AddConstructedType(&s); td.RegisterVariableForTesting(data_var); - mod.AddGlobalVariable(std::move(data_var)); + mod.AddGlobalVariable(data_var); { ast::VariableList params; @@ -196,15 +196,14 @@ TEST_F(BuilderTest, Emit_Multiple_EntryPoint_With_Same_ModuleVar) { create("d"))); auto* body = create(); - body->append(create(std::move(var))); + body->append(create(var)); body->append(create()); - auto* func = create("a", std::move(params), &void_type, - std::move(body)); + auto* func = create("a", params, &void_type, body); func->add_decoration( create(ast::PipelineStage::kCompute, Source{})); - mod.AddFunction(std::move(func)); + mod.AddFunction(func); } { @@ -215,15 +214,14 @@ TEST_F(BuilderTest, Emit_Multiple_EntryPoint_With_Same_ModuleVar) { create("d"))); auto* body = create(); - body->append(create(std::move(var))); + body->append(create(var)); body->append(create()); - auto* func = create("b", std::move(params), &void_type, - std::move(body)); + auto* func = create("b", params, &void_type, body); func->add_decoration( create(ast::PipelineStage::kCompute, Source{})); - mod.AddFunction(std::move(func)); + mod.AddFunction(func); } ASSERT_TRUE(td.Determine()) << td.error(); diff --git a/src/writer/spirv/builder_function_variable_test.cc b/src/writer/spirv/builder_function_variable_test.cc index 4b5beefc82..dbbdb79d72 100644 --- a/src/writer/spirv/builder_function_variable_test.cc +++ b/src/writer/spirv/builder_function_variable_test.cc @@ -77,12 +77,12 @@ TEST_F(BuilderTest, FunctionVar_WithConstantConstructor) { vals.push_back(create( create(&f32, 3.0f))); - auto* init = create(&vec, std::move(vals)); + auto* init = create(&vec, vals); EXPECT_TRUE(td.DetermineResultType(init)) << td.error(); ast::Variable v("var", ast::StorageClass::kOutput, &f32); - v.set_constructor(std::move(init)); + v.set_constructor(init); td.RegisterVariableForTesting(&v); @@ -121,14 +121,14 @@ TEST_F(BuilderTest, FunctionVar_WithNonConstantConstructor) { ast::ExpressionList vals; vals.push_back(create( create(&f32, 1.0f))); - vals.push_back(std::move(rel)); + vals.push_back(rel); - auto* init = create(&vec, std::move(vals)); + auto* init = create(&vec, vals); EXPECT_TRUE(td.DetermineResultType(init)) << td.error(); ast::Variable v("var", ast::StorageClass::kFunction, &vec); - v.set_constructor(std::move(init)); + v.set_constructor(init); td.RegisterVariableForTesting(&v); b.push_function(Function{}); @@ -166,7 +166,7 @@ TEST_F(BuilderTest, FunctionVar_WithNonConstantConstructorLoadedFromVar) { ASSERT_TRUE(td.DetermineResultType(init)) << td.error(); ast::Variable v("v", ast::StorageClass::kFunction, &f32); - v.set_constructor(std::move(init)); + v.set_constructor(init); td.RegisterVariableForTesting(&v); ast::Variable v2("v2", ast::StorageClass::kFunction, &f32); @@ -211,7 +211,7 @@ TEST_F(BuilderTest, FunctionVar_ConstWithVarInitializer) { EXPECT_TRUE(td.DetermineResultType(init)) << td.error(); ast::Variable v("v", ast::StorageClass::kFunction, &f32); - v.set_constructor(std::move(init)); + v.set_constructor(init); td.RegisterVariableForTesting(&v); ast::Variable v2("v2", ast::StorageClass::kFunction, &f32); @@ -254,12 +254,12 @@ TEST_F(BuilderTest, FunctionVar_Const) { vals.push_back(create( create(&f32, 3.0f))); - auto* init = create(&vec, std::move(vals)); + auto* init = create(&vec, vals); EXPECT_TRUE(td.DetermineResultType(init)) << td.error(); ast::Variable v("var", ast::StorageClass::kOutput, &f32); - v.set_constructor(std::move(init)); + v.set_constructor(init); v.set_is_const(true); td.RegisterVariableForTesting(&v); diff --git a/src/writer/spirv/builder_global_variable_test.cc b/src/writer/spirv/builder_global_variable_test.cc index 332af1d3dd..97ed8ffb69 100644 --- a/src/writer/spirv/builder_global_variable_test.cc +++ b/src/writer/spirv/builder_global_variable_test.cc @@ -104,12 +104,12 @@ TEST_F(BuilderTest, GlobalVar_WithConstructor) { vals.push_back(create( create(&f32, 3.0f))); - auto* init = create(&vec, std::move(vals)); + auto* init = create(&vec, vals); EXPECT_TRUE(td.DetermineResultType(init)) << td.error(); ast::Variable v("var", ast::StorageClass::kOutput, &f32); - v.set_constructor(std::move(init)); + v.set_constructor(init); td.RegisterVariableForTesting(&v); EXPECT_TRUE(b.GenerateGlobalVariable(&v)) << b.error(); @@ -139,12 +139,12 @@ TEST_F(BuilderTest, GlobalVar_Const) { vals.push_back(create( create(&f32, 3.0f))); - auto* init = create(&vec, std::move(vals)); + auto* init = create(&vec, vals); EXPECT_TRUE(td.DetermineResultType(init)) << td.error(); ast::Variable v("var", ast::StorageClass::kOutput, &f32); - v.set_constructor(std::move(init)); + v.set_constructor(init); v.set_is_const(true); td.RegisterVariableForTesting(&v); @@ -172,12 +172,12 @@ TEST_F(BuilderTest, GlobalVar_Complex_Constructor) { create(&f32, 2.0f))); vals.push_back(create( create(&f32, 3.0f))); - auto* init = create(&vec3, std::move(vals)); + auto* init = create(&vec3, vals); EXPECT_TRUE(td.DetermineResultType(init)) << td.error(); ast::Variable v("var", ast::StorageClass::kOutput, &f32); - v.set_constructor(std::move(init)); + v.set_constructor(init); v.set_is_const(true); td.RegisterVariableForTesting(&v); @@ -198,23 +198,25 @@ TEST_F(BuilderTest, GlobalVar_Complex_ConstructorWithExtract) { ast::type::VectorType vec3(&f32, 3); ast::type::VectorType vec2(&f32, 2); - ast::ExpressionList vals; - vals.push_back(create( - create(&f32, 1.0f))); - vals.push_back(create( - create(&f32, 2.0f))); - auto* first = create(&vec2, std::move(vals)); + auto* first = create( + &vec2, ast::ExpressionList{ + create( + create(&f32, 1.0f)), + create( + create(&f32, 2.0f)), + }); - vals.push_back(std::move(first)); - vals.push_back(create( - create(&f32, 3.0f))); - - auto* init = create(&vec3, std::move(vals)); + auto* init = create( + &vec3, ast::ExpressionList{ + first, + create( + create(&f32, 3.0f)), + }); EXPECT_TRUE(td.DetermineResultType(init)) << td.error(); ast::Variable v("var", ast::StorageClass::kOutput, &f32); - v.set_constructor(std::move(init)); + v.set_constructor(init); v.set_is_const(true); td.RegisterVariableForTesting(&v); @@ -243,8 +245,8 @@ TEST_F(BuilderTest, GlobalVar_WithLocation) { ast::VariableDecorationList decos; decos.push_back(create(5, Source{})); - ast::DecoratedVariable dv(std::move(v)); - dv.set_decorations(std::move(decos)); + ast::DecoratedVariable dv(v); + dv.set_decorations(decos); EXPECT_TRUE(b.GenerateGlobalVariable(&dv)) << b.error(); EXPECT_EQ(DumpInstructions(b.debug()), R"(OpName %1 "tint_766172" @@ -265,8 +267,8 @@ TEST_F(BuilderTest, GlobalVar_WithBindingAndSet) { decos.push_back(create(2, Source{})); decos.push_back(create(3, Source{})); - ast::DecoratedVariable dv(std::move(v)); - dv.set_decorations(std::move(decos)); + ast::DecoratedVariable dv(v); + dv.set_decorations(decos); EXPECT_TRUE(b.GenerateGlobalVariable(&dv)) << b.error(); EXPECT_EQ(DumpInstructions(b.debug()), R"(OpName %1 "tint_766172" @@ -288,8 +290,8 @@ TEST_F(BuilderTest, GlobalVar_WithBuiltin) { decos.push_back( create(ast::Builtin::kPosition, Source{})); - ast::DecoratedVariable dv(std::move(v)); - dv.set_decorations(std::move(decos)); + ast::DecoratedVariable dv(v); + dv.set_decorations(decos); EXPECT_TRUE(b.GenerateGlobalVariable(&dv)) << b.error(); EXPECT_EQ(DumpInstructions(b.debug()), R"(OpName %1 "tint_766172" @@ -311,7 +313,7 @@ TEST_F(BuilderTest, GlobalVar_ConstantId_Bool) { ast::DecoratedVariable v( create("var", ast::StorageClass::kNone, &bool_type)); - v.set_decorations(std::move(decos)); + v.set_decorations(decos); v.set_constructor(create( create(&bool_type, true))); @@ -335,7 +337,7 @@ TEST_F(BuilderTest, GlobalVar_ConstantId_Bool_NoConstructor) { ast::DecoratedVariable v( create("var", ast::StorageClass::kNone, &bool_type)); - v.set_decorations(std::move(decos)); + v.set_decorations(decos); EXPECT_TRUE(b.GenerateGlobalVariable(&v)) << b.error(); EXPECT_EQ(DumpInstructions(b.debug()), R"(OpName %1 "tint_766172" @@ -357,7 +359,7 @@ TEST_F(BuilderTest, GlobalVar_ConstantId_Scalar) { ast::DecoratedVariable v( create("var", ast::StorageClass::kNone, &f32)); - v.set_decorations(std::move(decos)); + v.set_decorations(decos); v.set_constructor(create( create(&f32, 2.0))); @@ -381,7 +383,7 @@ TEST_F(BuilderTest, GlobalVar_ConstantId_Scalar_F32_NoConstructor) { ast::DecoratedVariable v( create("var", ast::StorageClass::kNone, &f32)); - v.set_decorations(std::move(decos)); + v.set_decorations(decos); EXPECT_TRUE(b.GenerateGlobalVariable(&v)) << b.error(); EXPECT_EQ(DumpInstructions(b.debug()), R"(OpName %1 "tint_766172" @@ -403,7 +405,7 @@ TEST_F(BuilderTest, GlobalVar_ConstantId_Scalar_I32_NoConstructor) { ast::DecoratedVariable v( create("var", ast::StorageClass::kNone, &i32)); - v.set_decorations(std::move(decos)); + v.set_decorations(decos); EXPECT_TRUE(b.GenerateGlobalVariable(&v)) << b.error(); EXPECT_EQ(DumpInstructions(b.debug()), R"(OpName %1 "tint_766172" @@ -425,7 +427,7 @@ TEST_F(BuilderTest, GlobalVar_ConstantId_Scalar_U32_NoConstructor) { ast::DecoratedVariable v( create("var", ast::StorageClass::kNone, &u32)); - v.set_decorations(std::move(decos)); + v.set_decorations(decos); EXPECT_TRUE(b.GenerateGlobalVariable(&v)) << b.error(); EXPECT_EQ(DumpInstructions(b.debug()), R"(OpName %1 "tint_766172" @@ -483,10 +485,10 @@ TEST_F(BuilderTest, GlobalVar_DeclReadOnly) { ast::StructMemberDecorationList decos; ast::StructMemberList members; - members.push_back(create("a", &i32, std::move(decos))); - members.push_back(create("b", &i32, std::move(decos))); + members.push_back(create("a", &i32, decos)); + members.push_back(create("b", &i32, decos)); - ast::type::StructType A("A", create(std::move(members))); + ast::type::StructType A("A", create(members)); ast::type::AccessControlType ac{ast::AccessControl::kReadOnly, &A}; ast::Variable var("b", ast::StorageClass::kStorageBuffer, &ac); @@ -519,9 +521,9 @@ TEST_F(BuilderTest, GlobalVar_TypeAliasDeclReadOnly) { ast::StructMemberDecorationList decos; ast::StructMemberList members; - members.push_back(create("a", &i32, std::move(decos))); + members.push_back(create("a", &i32, decos)); - ast::type::StructType A("A", create(std::move(members))); + ast::type::StructType A("A", create(members)); ast::type::AliasType B("B", &A); ast::type::AccessControlType ac{ast::AccessControl::kReadOnly, &B}; @@ -553,9 +555,9 @@ TEST_F(BuilderTest, GlobalVar_TypeAliasAssignReadOnly) { ast::StructMemberDecorationList decos; ast::StructMemberList members; - members.push_back(create("a", &i32, std::move(decos))); + members.push_back(create("a", &i32, decos)); - ast::type::StructType A("A", create(std::move(members))); + ast::type::StructType A("A", create(members)); ast::type::AccessControlType ac{ast::AccessControl::kReadOnly, &A}; ast::type::AliasType B("B", &ac); @@ -587,9 +589,9 @@ TEST_F(BuilderTest, GlobalVar_TwoVarDeclReadOnly) { ast::StructMemberDecorationList decos; ast::StructMemberList members; - members.push_back(create("a", &i32, std::move(decos))); + members.push_back(create("a", &i32, decos)); - ast::type::StructType A("A", create(std::move(members))); + ast::type::StructType A("A", create(members)); ast::type::AccessControlType read{ast::AccessControl::kReadOnly, &A}; ast::type::AccessControlType rw{ast::AccessControl::kReadWrite, &A}; diff --git a/src/writer/spirv/builder_ident_expression_test.cc b/src/writer/spirv/builder_ident_expression_test.cc index 056a44e8c2..40cd860ecd 100644 --- a/src/writer/spirv/builder_ident_expression_test.cc +++ b/src/writer/spirv/builder_ident_expression_test.cc @@ -50,12 +50,12 @@ TEST_F(BuilderTest, IdentifierExpression_GlobalConst) { vals.push_back(create( create(&f32, 3.0f))); - auto* init = create(&vec, std::move(vals)); + auto* init = create(&vec, vals); EXPECT_TRUE(td.DetermineResultType(init)) << td.error(); ast::Variable v("var", ast::StorageClass::kOutput, &f32); - v.set_constructor(std::move(init)); + v.set_constructor(init); v.set_is_const(true); td.RegisterVariableForTesting(&v); @@ -109,12 +109,12 @@ TEST_F(BuilderTest, IdentifierExpression_FunctionConst) { vals.push_back(create( create(&f32, 3.0f))); - auto* init = create(&vec, std::move(vals)); + auto* init = create(&vec, vals); EXPECT_TRUE(td.DetermineResultType(init)) << td.error(); ast::Variable v("var", ast::StorageClass::kOutput, &f32); - v.set_constructor(std::move(init)); + v.set_constructor(init); v.set_is_const(true); td.RegisterVariableForTesting(&v); @@ -168,8 +168,7 @@ TEST_F(BuilderTest, IdentifierExpression_Load) { auto* lhs = create("var"); auto* rhs = create("var"); - ast::BinaryExpression expr(ast::BinaryOp::kAdd, std::move(lhs), - std::move(rhs)); + ast::BinaryExpression expr(ast::BinaryOp::kAdd, lhs, rhs); ASSERT_TRUE(td.DetermineResultType(&expr)) << td.error(); @@ -202,8 +201,7 @@ TEST_F(BuilderTest, IdentifierExpression_NoLoadConst) { auto* lhs = create("var"); auto* rhs = create("var"); - ast::BinaryExpression expr(ast::BinaryOp::kAdd, std::move(lhs), - std::move(rhs)); + ast::BinaryExpression expr(ast::BinaryOp::kAdd, lhs, rhs); ASSERT_TRUE(td.DetermineResultType(&expr)) << td.error(); diff --git a/src/writer/spirv/builder_if_test.cc b/src/writer/spirv/builder_if_test.cc index 75f56f09ec..e2303ca102 100644 --- a/src/writer/spirv/builder_if_test.cc +++ b/src/writer/spirv/builder_if_test.cc @@ -49,7 +49,7 @@ TEST_F(BuilderTest, If_Empty) { auto* cond = create( create(&bool_type, true)); - ast::IfStatement expr(std::move(cond), create()); + ast::IfStatement expr(cond, create()); ASSERT_TRUE(td.DetermineResultType(&expr)) << td.error(); @@ -86,7 +86,7 @@ TEST_F(BuilderTest, If_WithStatements) { auto* cond = create( create(&bool_type, true)); - ast::IfStatement expr(std::move(cond), std::move(body)); + ast::IfStatement expr(cond, body); td.RegisterVariableForTesting(var); ASSERT_TRUE(td.DetermineResultType(&expr)) << td.error(); @@ -137,13 +137,13 @@ TEST_F(BuilderTest, If_WithElse) { create(&i32, 3)))); ast::ElseStatementList else_stmts; - else_stmts.push_back(create(std::move(else_body))); + else_stmts.push_back(create(else_body)); auto* cond = create( create(&bool_type, true)); - ast::IfStatement expr(std::move(cond), std::move(body)); - expr.set_else_statements(std::move(else_stmts)); + ast::IfStatement expr(cond, body); + expr.set_else_statements(else_stmts); td.RegisterVariableForTesting(var); @@ -202,14 +202,13 @@ TEST_F(BuilderTest, If_WithElseIf) { create(&bool_type, true)); ast::ElseStatementList else_stmts; - else_stmts.push_back( - create(std::move(else_cond), std::move(else_body))); + else_stmts.push_back(create(else_cond, else_body)); auto* cond = create( create(&bool_type, true)); - ast::IfStatement expr(std::move(cond), std::move(body)); - expr.set_else_statements(std::move(else_stmts)); + ast::IfStatement expr(cond, body); + expr.set_else_statements(else_stmts); td.RegisterVariableForTesting(var); @@ -288,17 +287,17 @@ TEST_F(BuilderTest, If_WithMultiple) { create(&bool_type, false)); ast::ElseStatementList else_stmts; - else_stmts.push_back(create(std::move(elseif_1_cond), - std::move(elseif_1_body))); - else_stmts.push_back(create(std::move(elseif_2_cond), - std::move(elseif_2_body))); - else_stmts.push_back(create(std::move(else_body))); + else_stmts.push_back( + create(elseif_1_cond, elseif_1_body)); + else_stmts.push_back( + create(elseif_2_cond, elseif_2_body)); + else_stmts.push_back(create(else_body)); auto* cond = create( create(&bool_type, true)); - ast::IfStatement expr(std::move(cond), std::move(body)); - expr.set_else_statements(std::move(else_stmts)); + ast::IfStatement expr(cond, body); + expr.set_else_statements(else_stmts); td.RegisterVariableForTesting(var); @@ -362,12 +361,12 @@ TEST_F(BuilderTest, If_WithBreak) { auto* if_body = create(); if_body->append(create()); - auto* if_stmt = create(std::move(cond), std::move(if_body)); + auto* if_stmt = create(cond, if_body); auto* loop_body = create(); - loop_body->append(std::move(if_stmt)); + loop_body->append(if_stmt); - ast::LoopStatement expr(std::move(loop_body), create()); + ast::LoopStatement expr(loop_body, create()); ASSERT_TRUE(td.DetermineResultType(&expr)) << td.error(); @@ -410,16 +409,15 @@ TEST_F(BuilderTest, If_WithElseBreak) { else_body->append(create()); ast::ElseStatementList else_stmts; - else_stmts.push_back(create(std::move(else_body))); + else_stmts.push_back(create(else_body)); - auto* if_stmt = - create(std::move(cond), create()); - if_stmt->set_else_statements(std::move(else_stmts)); + auto* if_stmt = create(cond, create()); + if_stmt->set_else_statements(else_stmts); auto* loop_body = create(); - loop_body->append(std::move(if_stmt)); + loop_body->append(if_stmt); - ast::LoopStatement expr(std::move(loop_body), create()); + ast::LoopStatement expr(loop_body, create()); ASSERT_TRUE(td.DetermineResultType(&expr)) << td.error(); @@ -462,12 +460,12 @@ TEST_F(BuilderTest, If_WithContinue) { auto* if_body = create(); if_body->append(create()); - auto* if_stmt = create(std::move(cond), std::move(if_body)); + auto* if_stmt = create(cond, if_body); auto* loop_body = create(); - loop_body->append(std::move(if_stmt)); + loop_body->append(if_stmt); - ast::LoopStatement expr(std::move(loop_body), create()); + ast::LoopStatement expr(loop_body, create()); ASSERT_TRUE(td.DetermineResultType(&expr)) << td.error(); @@ -510,16 +508,15 @@ TEST_F(BuilderTest, If_WithElseContinue) { else_body->append(create()); ast::ElseStatementList else_stmts; - else_stmts.push_back(create(std::move(else_body))); + else_stmts.push_back(create(else_body)); - auto* if_stmt = - create(std::move(cond), create()); - if_stmt->set_else_statements(std::move(else_stmts)); + auto* if_stmt = create(cond, create()); + if_stmt->set_else_statements(else_stmts); auto* loop_body = create(); - loop_body->append(std::move(if_stmt)); + loop_body->append(if_stmt); - ast::LoopStatement expr(std::move(loop_body), create()); + ast::LoopStatement expr(loop_body, create()); ASSERT_TRUE(td.DetermineResultType(&expr)) << td.error(); @@ -560,7 +557,7 @@ TEST_F(BuilderTest, If_WithReturn) { auto* if_body = create(); if_body->append(create()); - ast::IfStatement expr(std::move(cond), std::move(if_body)); + ast::IfStatement expr(cond, if_body); ASSERT_TRUE(td.DetermineResultType(&expr)) << td.error(); @@ -590,9 +587,9 @@ TEST_F(BuilderTest, If_WithReturnValue) { create(&bool_type, false)); auto* if_body = create(); - if_body->append(create(std::move(cond2))); + if_body->append(create(cond2)); - ast::IfStatement expr(std::move(cond), std::move(if_body)); + ast::IfStatement expr(cond, if_body); ASSERT_TRUE(td.DetermineResultType(&expr)) << td.error(); diff --git a/src/writer/spirv/builder_intrinsic_test.cc b/src/writer/spirv/builder_intrinsic_test.cc index c8fff571e1..695bd85a45 100644 --- a/src/writer/spirv/builder_intrinsic_test.cc +++ b/src/writer/spirv/builder_intrinsic_test.cc @@ -1706,10 +1706,10 @@ TEST_F(IntrinsicBuilderTest, Call_ArrayLength) { ast::StructMemberDecorationList decos; ast::StructMemberList members; - members.push_back(create("a", &ary, std::move(decos))); + members.push_back(create("a", &ary, decos)); - auto* s = create(std::move(members)); - ast::type::StructType s_type("my_struct", std::move(s)); + auto* s = create(members); + ast::type::StructType s_type("my_struct", s); auto* var = make_var("b", ast::StorageClass::kPrivate, &s_type); @@ -1746,11 +1746,11 @@ TEST_F(IntrinsicBuilderTest, Call_ArrayLength_OtherMembersInStruct) { ast::StructMemberDecorationList decos; ast::StructMemberList members; - members.push_back(create("z", f32(), std::move(decos))); - members.push_back(create("a", &ary, std::move(decos))); + members.push_back(create("z", f32(), decos)); + members.push_back(create("a", &ary, decos)); - auto* s = create(std::move(members)); - ast::type::StructType s_type("my_struct", std::move(s)); + auto* s = create(members); + ast::type::StructType s_type("my_struct", s); auto* var = make_var("b", ast::StorageClass::kPrivate, &s_type); auto expr = call_expr("arrayLength", create( @@ -1788,11 +1788,11 @@ TEST_F(IntrinsicBuilderTest, DISABLED_Call_ArrayLength_Ptr) { ast::StructMemberDecorationList decos; ast::StructMemberList members; - members.push_back(create("z", f32(), std::move(decos))); - members.push_back(create("a", &ary, std::move(decos))); + members.push_back(create("z", f32(), decos)); + members.push_back(create("a", &ary, decos)); - auto* s = create(std::move(members)); - ast::type::StructType s_type("my_struct", std::move(s)); + auto* s = create(members); + ast::type::StructType s_type("my_struct", s); auto* var = make_var("b", ast::StorageClass::kPrivate, &s_type); diff --git a/src/writer/spirv/builder_loop_test.cc b/src/writer/spirv/builder_loop_test.cc index 319163ea9b..ecfe48ab9b 100644 --- a/src/writer/spirv/builder_loop_test.cc +++ b/src/writer/spirv/builder_loop_test.cc @@ -74,7 +74,7 @@ TEST_F(BuilderTest, Loop_WithoutContinuing) { create( create(&i32, 2)))); - ast::LoopStatement expr(std::move(body), create()); + ast::LoopStatement expr(body, create()); td.RegisterVariableForTesting(var); ASSERT_TRUE(td.DetermineResultType(&expr)) << td.error(); @@ -125,7 +125,7 @@ TEST_F(BuilderTest, Loop_WithContinuing) { create(create("v"), create( create(&i32, 3)))); - ast::LoopStatement expr(std::move(body), std::move(continuing)); + ast::LoopStatement expr(body, continuing); td.RegisterVariableForTesting(var); ASSERT_TRUE(td.DetermineResultType(&expr)) << td.error(); @@ -163,7 +163,7 @@ TEST_F(BuilderTest, Loop_WithContinue) { auto* body = create(); body->append(create()); - ast::LoopStatement expr(std::move(body), create()); + ast::LoopStatement expr(body, create()); ASSERT_TRUE(td.DetermineResultType(&expr)) << td.error(); @@ -190,7 +190,7 @@ TEST_F(BuilderTest, Loop_WithBreak) { auto* body = create(); body->append(create()); - ast::LoopStatement expr(std::move(body), create()); + ast::LoopStatement expr(body, create()); ASSERT_TRUE(td.DetermineResultType(&expr)) << td.error(); diff --git a/src/writer/spirv/builder_return_test.cc b/src/writer/spirv/builder_return_test.cc index 5c0dbb350e..738a12a3f0 100644 --- a/src/writer/spirv/builder_return_test.cc +++ b/src/writer/spirv/builder_return_test.cc @@ -58,9 +58,9 @@ TEST_F(BuilderTest, Return_WithValue) { vals.push_back(create( create(&f32, 3.0f))); - auto* val = create(&vec, std::move(vals)); + auto* val = create(&vec, vals); - ast::ReturnStatement ret(std::move(val)); + ast::ReturnStatement ret(val); EXPECT_TRUE(td.DetermineResultType(&ret)) << td.error(); diff --git a/src/writer/spirv/builder_switch_test.cc b/src/writer/spirv/builder_switch_test.cc index 1dfb4669b4..2738b28189 100644 --- a/src/writer/spirv/builder_switch_test.cc +++ b/src/writer/spirv/builder_switch_test.cc @@ -48,7 +48,7 @@ TEST_F(BuilderTest, Switch_Empty) { auto* cond = create( create(&i32, 1)); - ast::SwitchStatement expr(std::move(cond), ast::CaseStatementList{}); + ast::SwitchStatement expr(cond, ast::CaseStatementList{}); ASSERT_TRUE(td.DetermineResultType(&expr)) << td.error(); @@ -99,13 +99,10 @@ TEST_F(BuilderTest, Switch_WithCase) { selector_2.push_back(create(&i32, 2)); ast::CaseStatementList cases; - cases.push_back(create(std::move(selector_1), - std::move(case_1_body))); - cases.push_back(create(std::move(selector_2), - std::move(case_2_body))); + cases.push_back(create(selector_1, case_1_body)); + cases.push_back(create(selector_2, case_2_body)); - ast::SwitchStatement expr(create("a"), - std::move(cases)); + ast::SwitchStatement expr(create("a"), cases); td.RegisterVariableForTesting(v); td.RegisterVariableForTesting(a); @@ -166,10 +163,9 @@ TEST_F(BuilderTest, Switch_WithDefault) { create(&i32, 1)))); ast::CaseStatementList cases; - cases.push_back(create(std::move(default_body))); + cases.push_back(create(default_body)); - ast::SwitchStatement expr(create("a"), - std::move(cases)); + ast::SwitchStatement expr(create("a"), cases); td.RegisterVariableForTesting(v); td.RegisterVariableForTesting(a); @@ -247,14 +243,11 @@ TEST_F(BuilderTest, Switch_WithCaseAndDefault) { selector_2.push_back(create(&i32, 3)); ast::CaseStatementList cases; - cases.push_back(create(std::move(selector_1), - std::move(case_1_body))); - cases.push_back(create(std::move(selector_2), - std::move(case_2_body))); - cases.push_back(create(std::move(default_body))); + cases.push_back(create(selector_1, case_1_body)); + cases.push_back(create(selector_2, case_2_body)); + cases.push_back(create(default_body)); - ast::SwitchStatement expr(create("a"), - std::move(cases)); + ast::SwitchStatement expr(create("a"), cases); td.RegisterVariableForTesting(v); td.RegisterVariableForTesting(a); @@ -341,14 +334,11 @@ TEST_F(BuilderTest, Switch_CaseWithFallthrough) { selector_2.push_back(create(&i32, 2)); ast::CaseStatementList cases; - cases.push_back(create(std::move(selector_1), - std::move(case_1_body))); - cases.push_back(create(std::move(selector_2), - std::move(case_2_body))); - cases.push_back(create(std::move(default_body))); + cases.push_back(create(selector_1, case_1_body)); + cases.push_back(create(selector_2, case_2_body)); + cases.push_back(create(default_body)); - ast::SwitchStatement expr(create("a"), - std::move(cases)); + ast::SwitchStatement expr(create("a"), cases); td.RegisterVariableForTesting(v); td.RegisterVariableForTesting(a); @@ -416,11 +406,9 @@ TEST_F(BuilderTest, Switch_CaseFallthroughLastStatement) { selector_1.push_back(create(&i32, 1)); ast::CaseStatementList cases; - cases.push_back(create(std::move(selector_1), - std::move(case_1_body))); + cases.push_back(create(selector_1, case_1_body)); - ast::SwitchStatement expr(create("a"), - std::move(cases)); + ast::SwitchStatement expr(create("a"), cases); td.RegisterVariableForTesting(v); td.RegisterVariableForTesting(a); @@ -458,7 +446,7 @@ TEST_F(BuilderTest, Switch_WithNestedBreak) { case_1_body->append( create(create( create(&bool_type, true)), - std::move(if_body))); + if_body)); case_1_body->append( create(create("v"), @@ -469,11 +457,9 @@ TEST_F(BuilderTest, Switch_WithNestedBreak) { selector_1.push_back(create(&i32, 1)); ast::CaseStatementList cases; - cases.push_back(create(std::move(selector_1), - std::move(case_1_body))); + cases.push_back(create(selector_1, case_1_body)); - ast::SwitchStatement expr(create("a"), - std::move(cases)); + ast::SwitchStatement expr(create("a"), cases); td.RegisterVariableForTesting(v); td.RegisterVariableForTesting(a); diff --git a/src/writer/spirv/builder_type_test.cc b/src/writer/spirv/builder_type_test.cc index 44ab42939c..01109a488a 100644 --- a/src/writer/spirv/builder_type_test.cc +++ b/src/writer/spirv/builder_type_test.cc @@ -127,7 +127,7 @@ TEST_F(BuilderTest_Type, GenerateArray_WithStride) { decos.push_back(create(16u, Source{})); ast::type::ArrayType ary(&i32, 4); - ary.set_decorations(std::move(decos)); + ary.set_decorations(decos); auto id = b.GenerateTypeIfNeeded(&ary); ASSERT_FALSE(b.has_error()) << b.error(); @@ -280,7 +280,7 @@ TEST_F(BuilderTest_Type, ReturnsGeneratedPtr) { TEST_F(BuilderTest_Type, GenerateStruct_Empty) { auto* s = create(); - ast::type::StructType s_type("S", std::move(s)); + ast::type::StructType s_type("S", s); auto id = b.GenerateTypeIfNeeded(&s_type); ASSERT_FALSE(b.has_error()) << b.error(); @@ -298,10 +298,10 @@ TEST_F(BuilderTest_Type, GenerateStruct) { ast::StructMemberDecorationList decos; ast::StructMemberList members; - members.push_back(create("a", &f32, std::move(decos))); + members.push_back(create("a", &f32, decos)); - auto* s = create(std::move(members)); - ast::type::StructType s_type("my_struct", std::move(s)); + auto* s = create(members); + ast::type::StructType s_type("my_struct", s); auto id = b.GenerateTypeIfNeeded(&s_type); ASSERT_FALSE(b.has_error()) << b.error(); @@ -320,13 +320,13 @@ TEST_F(BuilderTest_Type, GenerateStruct_Decorated) { ast::StructMemberDecorationList decos; ast::StructMemberList members; - members.push_back(create("a", &f32, std::move(decos))); + members.push_back(create("a", &f32, decos)); ast::StructDecorationList struct_decos; struct_decos.push_back(create(Source{})); - auto* s = create(std::move(struct_decos), std::move(members)); - ast::type::StructType s_type("my_struct", std::move(s)); + auto* s = create(struct_decos, members); + ast::type::StructType s_type("my_struct", s); auto id = b.GenerateTypeIfNeeded(&s_type); ASSERT_FALSE(b.has_error()) << b.error(); @@ -351,11 +351,11 @@ TEST_F(BuilderTest_Type, GenerateStruct_DecoratedMembers) { b_decos.push_back(create(8, Source{})); ast::StructMemberList members; - members.push_back(create("a", &f32, std::move(a_decos))); - members.push_back(create("b", &f32, std::move(b_decos))); + members.push_back(create("a", &f32, a_decos)); + members.push_back(create("b", &f32, b_decos)); - auto* s = create(std::move(members)); - ast::type::StructType s_type("S", std::move(s)); + auto* s = create(members); + ast::type::StructType s_type("S", s); auto id = b.GenerateTypeIfNeeded(&s_type); ASSERT_FALSE(b.has_error()) << b.error(); @@ -384,15 +384,12 @@ TEST_F(BuilderTest_Type, GenerateStruct_NonLayout_Matrix) { ast::StructMemberDecorationList empty_b; ast::StructMemberDecorationList empty_c; ast::StructMemberList members; - members.push_back( - create("a", &glsl_mat2x2, std::move(empty_a))); - members.push_back( - create("b", &glsl_mat2x3, std::move(empty_b))); - members.push_back( - create("c", &glsl_mat4x4, std::move(empty_c))); + members.push_back(create("a", &glsl_mat2x2, empty_a)); + members.push_back(create("b", &glsl_mat2x3, empty_b)); + members.push_back(create("c", &glsl_mat4x4, empty_c)); - auto* s = create(std::move(members)); - ast::type::StructType s_type("S", std::move(s)); + auto* s = create(members); + ast::type::StructType s_type("S", s); auto id = b.GenerateTypeIfNeeded(&s_type); ASSERT_FALSE(b.has_error()) << b.error(); @@ -430,15 +427,12 @@ TEST_F(BuilderTest_Type, GenerateStruct_DecoratedMembers_LayoutMatrix) { c_decos.push_back(create(48, Source{})); ast::StructMemberList members; - members.push_back( - create("a", &glsl_mat2x2, std::move(a_decos))); - members.push_back( - create("b", &glsl_mat2x3, std::move(b_decos))); - members.push_back( - create("c", &glsl_mat4x4, std::move(c_decos))); + members.push_back(create("a", &glsl_mat2x2, a_decos)); + members.push_back(create("b", &glsl_mat2x3, b_decos)); + members.push_back(create("c", &glsl_mat4x4, c_decos)); - auto* s = create(std::move(members)); - ast::type::StructType s_type("S", std::move(s)); + auto* s = create(members); + ast::type::StructType s_type("S", s); auto id = b.GenerateTypeIfNeeded(&s_type); ASSERT_FALSE(b.has_error()) << b.error(); @@ -494,15 +488,12 @@ TEST_F(BuilderTest_Type, GenerateStruct_DecoratedMembers_LayoutArraysOfMatrix) { c_decos.push_back(create(48, Source{})); ast::StructMemberList members; - members.push_back( - create("a", &glsl_mat2x2, std::move(a_decos))); - members.push_back( - create("b", &glsl_mat2x3, std::move(b_decos))); - members.push_back( - create("c", &glsl_mat4x4, std::move(c_decos))); + members.push_back(create("a", &glsl_mat2x2, a_decos)); + members.push_back(create("b", &glsl_mat2x3, b_decos)); + members.push_back(create("c", &glsl_mat4x4, c_decos)); - auto* s = create(std::move(members)); - ast::type::StructType s_type("S", std::move(s)); + auto* s = create(members); + ast::type::StructType s_type("S", s); auto id = b.GenerateTypeIfNeeded(&s_type); ASSERT_FALSE(b.has_error()) << b.error(); diff --git a/src/writer/wgsl/generator_impl_alias_type_test.cc b/src/writer/wgsl/generator_impl_alias_type_test.cc index 73f0a720f5..ce1249ed1f 100644 --- a/src/writer/wgsl/generator_impl_alias_type_test.cc +++ b/src/writer/wgsl/generator_impl_alias_type_test.cc @@ -49,12 +49,12 @@ TEST_F(WgslGeneratorImplTest, EmitConstructedType_Struct) { ast::StructMemberDecorationList b_deco; b_deco.push_back(create(4, Source{})); - members.push_back(create("b", &i32, std::move(b_deco))); + members.push_back(create("b", &i32, b_deco)); auto* str = create(); - str->set_members(std::move(members)); + str->set_members(members); - ast::type::StructType s("A", std::move(str)); + ast::type::StructType s("A", str); ast::type::AliasType alias("B", &s); ASSERT_TRUE(gen.EmitConstructedType(&s)) << gen.error(); @@ -78,12 +78,12 @@ TEST_F(WgslGeneratorImplTest, EmitAliasType_ToStruct) { ast::StructMemberDecorationList b_deco; b_deco.push_back(create(4, Source{})); - members.push_back(create("b", &i32, std::move(b_deco))); + members.push_back(create("b", &i32, b_deco)); auto* str = create(); - str->set_members(std::move(members)); + str->set_members(members); - ast::type::StructType s("A", std::move(str)); + ast::type::StructType s("A", str); ast::type::AliasType alias("B", &s); ASSERT_TRUE(gen.EmitConstructedType(&alias)) << gen.error(); diff --git a/src/writer/wgsl/generator_impl_array_accessor_test.cc b/src/writer/wgsl/generator_impl_array_accessor_test.cc index 3b8fa384cb..e1876120f1 100644 --- a/src/writer/wgsl/generator_impl_array_accessor_test.cc +++ b/src/writer/wgsl/generator_impl_array_accessor_test.cc @@ -33,10 +33,10 @@ using WgslGeneratorImplTest = TestHelper; TEST_F(WgslGeneratorImplTest, EmitExpression_ArrayAccessor) { ast::type::I32Type i32; auto* lit = create(&i32, 5); - auto* idx = create(std::move(lit)); + auto* idx = create(lit); auto* ary = create("ary"); - ast::ArrayAccessorExpression expr(std::move(ary), std::move(idx)); + ast::ArrayAccessorExpression expr(ary, idx); ASSERT_TRUE(gen.EmitExpression(&expr)) << gen.error(); EXPECT_EQ(gen.result(), "ary[5]"); @@ -46,7 +46,7 @@ TEST_F(WgslGeneratorImplTest, EmitArrayAccessor) { auto* ary = create("ary"); auto* idx = create("idx"); - ast::ArrayAccessorExpression expr(std::move(ary), std::move(idx)); + ast::ArrayAccessorExpression expr(ary, idx); ASSERT_TRUE(gen.EmitArrayAccessor(&expr)) << gen.error(); EXPECT_EQ(gen.result(), "ary[idx]"); diff --git a/src/writer/wgsl/generator_impl_assign_test.cc b/src/writer/wgsl/generator_impl_assign_test.cc index 36e8650a64..9679c6b508 100644 --- a/src/writer/wgsl/generator_impl_assign_test.cc +++ b/src/writer/wgsl/generator_impl_assign_test.cc @@ -31,7 +31,7 @@ using WgslGeneratorImplTest = TestHelper; TEST_F(WgslGeneratorImplTest, Emit_Assign) { auto* lhs = create("lhs"); auto* rhs = create("rhs"); - ast::AssignmentStatement assign(std::move(lhs), std::move(rhs)); + ast::AssignmentStatement assign(lhs, rhs); gen.increment_indent(); diff --git a/src/writer/wgsl/generator_impl_binary_test.cc b/src/writer/wgsl/generator_impl_binary_test.cc index d210f735da..825668f9a3 100644 --- a/src/writer/wgsl/generator_impl_binary_test.cc +++ b/src/writer/wgsl/generator_impl_binary_test.cc @@ -40,7 +40,7 @@ TEST_P(WgslBinaryTest, Emit) { auto* left = create("left"); auto* right = create("right"); - ast::BinaryExpression expr(params.op, std::move(left), std::move(right)); + ast::BinaryExpression expr(params.op, left, right); ASSERT_TRUE(gen.EmitExpression(&expr)) << gen.error(); EXPECT_EQ(gen.result(), params.result); diff --git a/src/writer/wgsl/generator_impl_bitcast_test.cc b/src/writer/wgsl/generator_impl_bitcast_test.cc index c6452aec81..83ba9e68cc 100644 --- a/src/writer/wgsl/generator_impl_bitcast_test.cc +++ b/src/writer/wgsl/generator_impl_bitcast_test.cc @@ -31,7 +31,7 @@ using WgslGeneratorImplTest = TestHelper; TEST_F(WgslGeneratorImplTest, EmitExpression_Bitcast) { ast::type::F32Type f32; auto* id = create("id"); - ast::BitcastExpression bitcast(&f32, std::move(id)); + ast::BitcastExpression bitcast(&f32, id); ASSERT_TRUE(gen.EmitExpression(&bitcast)) << gen.error(); EXPECT_EQ(gen.result(), "bitcast(id)"); diff --git a/src/writer/wgsl/generator_impl_call_test.cc b/src/writer/wgsl/generator_impl_call_test.cc index aa0c7cb116..8afc062b27 100644 --- a/src/writer/wgsl/generator_impl_call_test.cc +++ b/src/writer/wgsl/generator_impl_call_test.cc @@ -30,7 +30,7 @@ using WgslGeneratorImplTest = TestHelper; TEST_F(WgslGeneratorImplTest, EmitExpression_Call_WithoutParams) { auto* id = create("my_func"); - ast::CallExpression call(std::move(id), {}); + ast::CallExpression call(id, {}); ASSERT_TRUE(gen.EmitExpression(&call)) << gen.error(); EXPECT_EQ(gen.result(), "my_func()"); @@ -41,7 +41,7 @@ TEST_F(WgslGeneratorImplTest, EmitExpression_Call_WithParams) { ast::ExpressionList params; params.push_back(create("param1")); params.push_back(create("param2")); - ast::CallExpression call(std::move(id), std::move(params)); + ast::CallExpression call(id, params); ASSERT_TRUE(gen.EmitExpression(&call)) << gen.error(); EXPECT_EQ(gen.result(), "my_func(param1, param2)"); @@ -53,8 +53,7 @@ TEST_F(WgslGeneratorImplTest, EmitStatement_Call) { params.push_back(create("param1")); params.push_back(create("param2")); - ast::CallStatement call( - create(std::move(id), std::move(params))); + ast::CallStatement call(create(id, params)); gen.increment_indent(); ASSERT_TRUE(gen.EmitStatement(&call)) << gen.error(); diff --git a/src/writer/wgsl/generator_impl_case_test.cc b/src/writer/wgsl/generator_impl_case_test.cc index 1246465a93..5b5fc05517 100644 --- a/src/writer/wgsl/generator_impl_case_test.cc +++ b/src/writer/wgsl/generator_impl_case_test.cc @@ -38,7 +38,7 @@ TEST_F(WgslGeneratorImplTest, Emit_Case) { ast::CaseSelectorList lit; lit.push_back(create(&i32, 5)); - ast::CaseStatement c(std::move(lit), std::move(body)); + ast::CaseStatement c(lit, body); gen.increment_indent(); @@ -58,7 +58,7 @@ TEST_F(WgslGeneratorImplTest, Emit_Case_MultipleSelectors) { ast::CaseSelectorList lit; lit.push_back(create(&i32, 5)); lit.push_back(create(&i32, 6)); - ast::CaseStatement c(std::move(lit), std::move(body)); + ast::CaseStatement c(lit, body); gen.increment_indent(); @@ -72,7 +72,7 @@ TEST_F(WgslGeneratorImplTest, Emit_Case_MultipleSelectors) { TEST_F(WgslGeneratorImplTest, Emit_Case_Default) { auto* body = create(); body->append(create()); - ast::CaseStatement c(std::move(body)); + ast::CaseStatement c(body); gen.increment_indent(); diff --git a/src/writer/wgsl/generator_impl_cast_test.cc b/src/writer/wgsl/generator_impl_cast_test.cc index 5d64f4666f..c2a86dc248 100644 --- a/src/writer/wgsl/generator_impl_cast_test.cc +++ b/src/writer/wgsl/generator_impl_cast_test.cc @@ -34,7 +34,7 @@ TEST_F(WgslGeneratorImplTest, EmitExpression_Cast) { ast::ExpressionList params; params.push_back(create("id")); - ast::TypeConstructorExpression cast(&f32, std::move(params)); + ast::TypeConstructorExpression cast(&f32, params); ASSERT_TRUE(gen.EmitExpression(&cast)) << gen.error(); EXPECT_EQ(gen.result(), "f32(id)"); diff --git a/src/writer/wgsl/generator_impl_constructor_test.cc b/src/writer/wgsl/generator_impl_constructor_test.cc index 70e78e39b8..53ac451bf8 100644 --- a/src/writer/wgsl/generator_impl_constructor_test.cc +++ b/src/writer/wgsl/generator_impl_constructor_test.cc @@ -38,7 +38,7 @@ using WgslGeneratorImplTest = TestHelper; TEST_F(WgslGeneratorImplTest, EmitConstructor_Bool) { ast::type::BoolType bool_type; auto* lit = create(&bool_type, false); - ast::ScalarConstructorExpression expr(std::move(lit)); + ast::ScalarConstructorExpression expr(lit); ASSERT_TRUE(gen.EmitConstructor(&expr)) << gen.error(); EXPECT_EQ(gen.result(), "false"); @@ -47,7 +47,7 @@ TEST_F(WgslGeneratorImplTest, EmitConstructor_Bool) { TEST_F(WgslGeneratorImplTest, EmitConstructor_Int) { ast::type::I32Type i32; auto* lit = create(&i32, -12345); - ast::ScalarConstructorExpression expr(std::move(lit)); + ast::ScalarConstructorExpression expr(lit); ASSERT_TRUE(gen.EmitConstructor(&expr)) << gen.error(); EXPECT_EQ(gen.result(), "-12345"); @@ -56,7 +56,7 @@ TEST_F(WgslGeneratorImplTest, EmitConstructor_Int) { TEST_F(WgslGeneratorImplTest, EmitConstructor_UInt) { ast::type::U32Type u32; auto* lit = create(&u32, 56779); - ast::ScalarConstructorExpression expr(std::move(lit)); + ast::ScalarConstructorExpression expr(lit); ASSERT_TRUE(gen.EmitConstructor(&expr)) << gen.error(); EXPECT_EQ(gen.result(), "56779u"); @@ -67,7 +67,7 @@ TEST_F(WgslGeneratorImplTest, EmitConstructor_Float) { // Use a number close to 1<<30 but whose decimal representation ends in 0. auto* lit = create(&f32, static_cast((1 << 30) - 4)); - ast::ScalarConstructorExpression expr(std::move(lit)); + ast::ScalarConstructorExpression expr(lit); ASSERT_TRUE(gen.EmitConstructor(&expr)) << gen.error(); EXPECT_EQ(gen.result(), "1.07374182e+09"); @@ -78,9 +78,9 @@ TEST_F(WgslGeneratorImplTest, EmitConstructor_Type_Float) { auto* lit = create(&f32, -1.2e-5); ast::ExpressionList values; - values.push_back(create(std::move(lit))); + values.push_back(create(lit)); - ast::TypeConstructorExpression expr(&f32, std::move(values)); + ast::TypeConstructorExpression expr(&f32, values); ASSERT_TRUE(gen.EmitConstructor(&expr)) << gen.error(); EXPECT_EQ(gen.result(), "f32(-1.20000004e-05)"); @@ -91,9 +91,9 @@ TEST_F(WgslGeneratorImplTest, EmitConstructor_Type_Bool) { auto* lit = create(&b, true); ast::ExpressionList values; - values.push_back(create(std::move(lit))); + values.push_back(create(lit)); - ast::TypeConstructorExpression expr(&b, std::move(values)); + ast::TypeConstructorExpression expr(&b, values); ASSERT_TRUE(gen.EmitConstructor(&expr)) << gen.error(); EXPECT_EQ(gen.result(), "bool(true)"); @@ -104,9 +104,9 @@ TEST_F(WgslGeneratorImplTest, EmitConstructor_Type_Int) { auto* lit = create(&i32, -12345); ast::ExpressionList values; - values.push_back(create(std::move(lit))); + values.push_back(create(lit)); - ast::TypeConstructorExpression expr(&i32, std::move(values)); + ast::TypeConstructorExpression expr(&i32, values); ASSERT_TRUE(gen.EmitConstructor(&expr)) << gen.error(); EXPECT_EQ(gen.result(), "i32(-12345)"); @@ -117,9 +117,9 @@ TEST_F(WgslGeneratorImplTest, EmitConstructor_Type_Uint) { auto* lit = create(&u32, 12345); ast::ExpressionList values; - values.push_back(create(std::move(lit))); + values.push_back(create(lit)); - ast::TypeConstructorExpression expr(&u32, std::move(values)); + ast::TypeConstructorExpression expr(&u32, values); ASSERT_TRUE(gen.EmitConstructor(&expr)) << gen.error(); EXPECT_EQ(gen.result(), "u32(12345u)"); @@ -133,11 +133,11 @@ TEST_F(WgslGeneratorImplTest, EmitConstructor_Type_Vec) { auto* lit2 = create(&f32, 2.f); auto* lit3 = create(&f32, 3.f); ast::ExpressionList values; - values.push_back(create(std::move(lit1))); - values.push_back(create(std::move(lit2))); - values.push_back(create(std::move(lit3))); + values.push_back(create(lit1)); + values.push_back(create(lit2)); + values.push_back(create(lit3)); - ast::TypeConstructorExpression expr(&vec, std::move(values)); + ast::TypeConstructorExpression expr(&vec, values); ASSERT_TRUE(gen.EmitConstructor(&expr)) << gen.error(); EXPECT_EQ(gen.result(), "vec3(1.00000000, 2.00000000, 3.00000000)"); @@ -158,14 +158,13 @@ TEST_F(WgslGeneratorImplTest, EmitConstructor_Type_Mat) { create(&f32, static_cast(2 + (i * 2))); ast::ExpressionList values; - values.push_back(create(std::move(lit1))); - values.push_back(create(std::move(lit2))); + values.push_back(create(lit1)); + values.push_back(create(lit2)); - mat_values.push_back( - create(&vec, std::move(values))); + mat_values.push_back(create(&vec, values)); } - ast::TypeConstructorExpression expr(&mat, std::move(mat_values)); + ast::TypeConstructorExpression expr(&mat, mat_values); ASSERT_TRUE(gen.EmitConstructor(&expr)) << gen.error(); EXPECT_EQ(gen.result(), @@ -190,15 +189,14 @@ TEST_F(WgslGeneratorImplTest, EmitConstructor_Type_Array) { create(&f32, static_cast(3 + (i * 3))); ast::ExpressionList values; - values.push_back(create(std::move(lit1))); - values.push_back(create(std::move(lit2))); - values.push_back(create(std::move(lit3))); + values.push_back(create(lit1)); + values.push_back(create(lit2)); + values.push_back(create(lit3)); - ary_values.push_back( - create(&vec, std::move(values))); + ary_values.push_back(create(&vec, values)); } - ast::TypeConstructorExpression expr(&ary, std::move(ary_values)); + ast::TypeConstructorExpression expr(&ary, ary_values); ASSERT_TRUE(gen.EmitConstructor(&expr)) << gen.error(); EXPECT_EQ(gen.result(), diff --git a/src/writer/wgsl/generator_impl_function_test.cc b/src/writer/wgsl/generator_impl_function_test.cc index c05e2df0c5..6923099992 100644 --- a/src/writer/wgsl/generator_impl_function_test.cc +++ b/src/writer/wgsl/generator_impl_function_test.cc @@ -48,7 +48,7 @@ TEST_F(WgslGeneratorImplTest, Emit_Function) { body->append(create()); ast::type::VoidType void_type; - ast::Function func("my_func", {}, &void_type, std::move(body)); + ast::Function func("my_func", {}, &void_type, body); gen.increment_indent(); @@ -72,7 +72,7 @@ TEST_F(WgslGeneratorImplTest, Emit_Function_WithParams) { params.push_back(create("b", ast::StorageClass::kNone, &i32)); ast::type::VoidType void_type; - ast::Function func("my_func", std::move(params), &void_type, std::move(body)); + ast::Function func("my_func", params, &void_type, body); gen.increment_indent(); @@ -90,7 +90,7 @@ TEST_F(WgslGeneratorImplTest, Emit_Function_WithDecoration_WorkgroupSize) { body->append(create()); ast::type::VoidType void_type; - ast::Function func("my_func", {}, &void_type, std::move(body)); + ast::Function func("my_func", {}, &void_type, body); func.add_decoration(create(2u, 4u, 6u, Source{})); gen.increment_indent(); @@ -110,7 +110,7 @@ TEST_F(WgslGeneratorImplTest, Emit_Function_WithDecoration_Stage) { body->append(create()); ast::type::VoidType void_type; - ast::Function func("my_func", {}, &void_type, std::move(body)); + ast::Function func("my_func", {}, &void_type, body); func.add_decoration( create(ast::PipelineStage::kFragment, Source{})); @@ -131,7 +131,7 @@ TEST_F(WgslGeneratorImplTest, Emit_Function_WithDecoration_Multiple) { body->append(create()); ast::type::VoidType void_type; - ast::Function func("my_func", {}, &void_type, std::move(body)); + ast::Function func("my_func", {}, &void_type, body); func.add_decoration( create(ast::PipelineStage::kFragment, Source{})); func.add_decoration(create(2u, 4u, 6u, Source{})); @@ -172,14 +172,14 @@ TEST_F(WgslGeneratorImplTest, ast::StructMemberList members; ast::StructMemberDecorationList a_deco; a_deco.push_back(create(0, Source{})); - members.push_back(create("d", &f32, std::move(a_deco))); + members.push_back(create("d", &f32, a_deco)); ast::StructDecorationList s_decos; s_decos.push_back(create(Source{})); - auto* str = create(std::move(s_decos), std::move(members)); + auto* str = create(s_decos, members); - ast::type::StructType s("Data", std::move(str)); + ast::type::StructType s("Data", str); ast::type::AccessControlType ac(ast::AccessControl::kReadWrite, &s); auto* data_var = create( @@ -188,12 +188,12 @@ TEST_F(WgslGeneratorImplTest, ast::VariableDecorationList decos; decos.push_back(create(0, Source{})); decos.push_back(create(0, Source{})); - data_var->set_decorations(std::move(decos)); + data_var->set_decorations(decos); mod.AddConstructedType(&s); td.RegisterVariableForTesting(data_var); - mod.AddGlobalVariable(std::move(data_var)); + mod.AddGlobalVariable(data_var); { ast::VariableList params; @@ -203,15 +203,14 @@ TEST_F(WgslGeneratorImplTest, create("d"))); auto* body = create(); - body->append(create(std::move(var))); + body->append(create(var)); body->append(create()); - auto* func = create("a", std::move(params), &void_type, - std::move(body)); + auto* func = create("a", params, &void_type, body); func->add_decoration( create(ast::PipelineStage::kCompute, Source{})); - mod.AddFunction(std::move(func)); + mod.AddFunction(func); } { @@ -222,15 +221,14 @@ TEST_F(WgslGeneratorImplTest, create("d"))); auto* body = create(); - body->append(create(std::move(var))); + body->append(create(var)); body->append(create()); - auto* func = create("b", std::move(params), &void_type, - std::move(body)); + auto* func = create("b", params, &void_type, body); func->add_decoration( create(ast::PipelineStage::kCompute, Source{})); - mod.AddFunction(std::move(func)); + mod.AddFunction(func); } ASSERT_TRUE(td.Determine()) << td.error(); diff --git a/src/writer/wgsl/generator_impl_if_test.cc b/src/writer/wgsl/generator_impl_if_test.cc index 3094210ace..b0c68b826f 100644 --- a/src/writer/wgsl/generator_impl_if_test.cc +++ b/src/writer/wgsl/generator_impl_if_test.cc @@ -32,7 +32,7 @@ TEST_F(WgslGeneratorImplTest, Emit_If) { auto* body = create(); body->append(create()); - ast::IfStatement i(std::move(cond), std::move(body)); + ast::IfStatement i(cond, body); gen.increment_indent(); @@ -49,15 +49,14 @@ TEST_F(WgslGeneratorImplTest, Emit_IfWithElseIf) { else_body->append(create()); ast::ElseStatementList elses; - elses.push_back( - create(std::move(else_cond), std::move(else_body))); + elses.push_back(create(else_cond, else_body)); auto* cond = create("cond"); auto* body = create(); body->append(create()); - ast::IfStatement i(std::move(cond), std::move(body)); - i.set_else_statements(std::move(elses)); + ast::IfStatement i(cond, body); + i.set_else_statements(elses); gen.increment_indent(); @@ -75,14 +74,14 @@ TEST_F(WgslGeneratorImplTest, Emit_IfWithElse) { else_body->append(create()); ast::ElseStatementList elses; - elses.push_back(create(std::move(else_body))); + elses.push_back(create(else_body)); auto* cond = create("cond"); auto* body = create(); body->append(create()); - ast::IfStatement i(std::move(cond), std::move(body)); - i.set_else_statements(std::move(elses)); + ast::IfStatement i(cond, body); + i.set_else_statements(elses); gen.increment_indent(); @@ -105,16 +104,15 @@ TEST_F(WgslGeneratorImplTest, Emit_IfWithMultiple) { else_body_2->append(create()); ast::ElseStatementList elses; - elses.push_back( - create(std::move(else_cond), std::move(else_body))); - elses.push_back(create(std::move(else_body_2))); + elses.push_back(create(else_cond, else_body)); + elses.push_back(create(else_body_2)); auto* cond = create("cond"); auto* body = create(); body->append(create()); - ast::IfStatement i(std::move(cond), std::move(body)); - i.set_else_statements(std::move(elses)); + ast::IfStatement i(cond, body); + i.set_else_statements(elses); gen.increment_indent(); diff --git a/src/writer/wgsl/generator_impl_loop_test.cc b/src/writer/wgsl/generator_impl_loop_test.cc index 2bcc6149e8..41c399d9dc 100644 --- a/src/writer/wgsl/generator_impl_loop_test.cc +++ b/src/writer/wgsl/generator_impl_loop_test.cc @@ -30,7 +30,7 @@ using WgslGeneratorImplTest = TestHelper; TEST_F(WgslGeneratorImplTest, Emit_Loop) { auto* body = create(); body->append(create()); - ast::LoopStatement l(std::move(body), {}); + ast::LoopStatement l(body, {}); gen.increment_indent(); @@ -48,7 +48,7 @@ TEST_F(WgslGeneratorImplTest, Emit_LoopWithContinuing) { auto* continuing = create(); continuing->append(create()); - ast::LoopStatement l(std::move(body), std::move(continuing)); + ast::LoopStatement l(body, continuing); gen.increment_indent(); diff --git a/src/writer/wgsl/generator_impl_member_accessor_test.cc b/src/writer/wgsl/generator_impl_member_accessor_test.cc index c939a028ec..8ff995ea3a 100644 --- a/src/writer/wgsl/generator_impl_member_accessor_test.cc +++ b/src/writer/wgsl/generator_impl_member_accessor_test.cc @@ -31,7 +31,7 @@ TEST_F(WgslGeneratorImplTest, EmitExpression_MemberAccessor) { auto* str = create("str"); auto* mem = create("mem"); - ast::MemberAccessorExpression expr(std::move(str), std::move(mem)); + ast::MemberAccessorExpression expr(str, mem); ASSERT_TRUE(gen.EmitExpression(&expr)) << gen.error(); EXPECT_EQ(gen.result(), "str.mem"); diff --git a/src/writer/wgsl/generator_impl_return_test.cc b/src/writer/wgsl/generator_impl_return_test.cc index 91f9e8bb51..51b1e78cba 100644 --- a/src/writer/wgsl/generator_impl_return_test.cc +++ b/src/writer/wgsl/generator_impl_return_test.cc @@ -39,7 +39,7 @@ TEST_F(WgslGeneratorImplTest, Emit_Return) { TEST_F(WgslGeneratorImplTest, Emit_ReturnWithValue) { auto* expr = create("expr"); - ast::ReturnStatement r(std::move(expr)); + ast::ReturnStatement r(expr); gen.increment_indent(); diff --git a/src/writer/wgsl/generator_impl_switch_test.cc b/src/writer/wgsl/generator_impl_switch_test.cc index 1072d675ab..06904eee03 100644 --- a/src/writer/wgsl/generator_impl_switch_test.cc +++ b/src/writer/wgsl/generator_impl_switch_test.cc @@ -34,7 +34,7 @@ using WgslGeneratorImplTest = TestHelper; TEST_F(WgslGeneratorImplTest, Emit_Switch) { auto* def_body = create(); def_body->append(create()); - auto* def = create(std::move(def_body)); + auto* def = create(def_body); ast::type::I32Type i32; ast::CaseSelectorList case_val; @@ -43,15 +43,14 @@ TEST_F(WgslGeneratorImplTest, Emit_Switch) { auto* case_body = create(); case_body->append(create()); - auto* case_stmt = - create(std::move(case_val), std::move(case_body)); + auto* case_stmt = create(case_val, case_body); ast::CaseStatementList body; - body.push_back(std::move(case_stmt)); - body.push_back(std::move(def)); + body.push_back(case_stmt); + body.push_back(def); auto* cond = create("cond"); - ast::SwitchStatement s(std::move(cond), std::move(body)); + ast::SwitchStatement s(cond, body); gen.increment_indent(); diff --git a/src/writer/wgsl/generator_impl_type_test.cc b/src/writer/wgsl/generator_impl_type_test.cc index 48fbf4fa19..6cc49aaffc 100644 --- a/src/writer/wgsl/generator_impl_type_test.cc +++ b/src/writer/wgsl/generator_impl_type_test.cc @@ -67,7 +67,7 @@ TEST_F(WgslGeneratorImplTest, EmitType_Array_Decoration) { decos.push_back(create(16u, Source{})); ast::type::ArrayType a(&b, 4); - a.set_decorations(std::move(decos)); + a.set_decorations(decos); ASSERT_TRUE(gen.EmitType(&a)) << gen.error(); EXPECT_EQ(gen.result(), "[[stride(16)]] array"); @@ -80,7 +80,7 @@ TEST_F(WgslGeneratorImplTest, EmitType_Array_MultipleDecorations) { decos.push_back(create(32u, Source{})); ast::type::ArrayType a(&b, 4); - a.set_decorations(std::move(decos)); + a.set_decorations(decos); ASSERT_TRUE(gen.EmitType(&a)) << gen.error(); EXPECT_EQ(gen.result(), "[[stride(16)]] [[stride(32)]] array"); @@ -141,12 +141,12 @@ TEST_F(WgslGeneratorImplTest, EmitType_Struct) { ast::StructMemberDecorationList b_deco; b_deco.push_back(create(4, Source{})); - members.push_back(create("b", &f32, std::move(b_deco))); + members.push_back(create("b", &f32, b_deco)); auto* str = create(); - str->set_members(std::move(members)); + str->set_members(members); - ast::type::StructType s("S", std::move(str)); + ast::type::StructType s("S", str); ASSERT_TRUE(gen.EmitType(&s)) << gen.error(); EXPECT_EQ(gen.result(), "S"); @@ -162,12 +162,12 @@ TEST_F(WgslGeneratorImplTest, EmitType_StructDecl) { ast::StructMemberDecorationList b_deco; b_deco.push_back(create(4, Source{})); - members.push_back(create("b", &f32, std::move(b_deco))); + members.push_back(create("b", &f32, b_deco)); auto* str = create(); - str->set_members(std::move(members)); + str->set_members(members); - ast::type::StructType s("S", std::move(str)); + ast::type::StructType s("S", str); ASSERT_TRUE(gen.EmitStructType(&s)) << gen.error(); EXPECT_EQ(gen.result(), R"(struct S { @@ -188,14 +188,14 @@ TEST_F(WgslGeneratorImplTest, EmitType_Struct_WithDecoration) { ast::StructMemberDecorationList b_deco; b_deco.push_back(create(4, Source{})); - members.push_back(create("b", &f32, std::move(b_deco))); + members.push_back(create("b", &f32, b_deco)); ast::StructDecorationList decos; decos.push_back(create(Source{})); - auto* str = create(std::move(decos), std::move(members)); + auto* str = create(decos, members); - ast::type::StructType s("S", std::move(str)); + ast::type::StructType s("S", str); ASSERT_TRUE(gen.EmitStructType(&s)) << gen.error(); EXPECT_EQ(gen.result(), R"([[block]] diff --git a/src/writer/wgsl/generator_impl_unary_op_test.cc b/src/writer/wgsl/generator_impl_unary_op_test.cc index bebe74bdc5..518be49088 100644 --- a/src/writer/wgsl/generator_impl_unary_op_test.cc +++ b/src/writer/wgsl/generator_impl_unary_op_test.cc @@ -39,7 +39,7 @@ TEST_P(WgslUnaryOpTest, Emit) { auto params = GetParam(); auto* expr = create("expr"); - ast::UnaryOpExpression op(params.op, std::move(expr)); + ast::UnaryOpExpression op(params.op, expr); ASSERT_TRUE(gen.EmitExpression(&op)) << gen.error(); EXPECT_EQ(gen.result(), std::string(params.name) + "(expr)"); diff --git a/src/writer/wgsl/generator_impl_variable_decl_statement_test.cc b/src/writer/wgsl/generator_impl_variable_decl_statement_test.cc index 1db4355280..7d19a1ed2e 100644 --- a/src/writer/wgsl/generator_impl_variable_decl_statement_test.cc +++ b/src/writer/wgsl/generator_impl_variable_decl_statement_test.cc @@ -34,7 +34,7 @@ TEST_F(WgslGeneratorImplTest, Emit_VariableDeclStatement) { ast::type::F32Type f32; auto* var = create("a", ast::StorageClass::kNone, &f32); - ast::VariableDeclStatement stmt(std::move(var)); + ast::VariableDeclStatement stmt(var); gen.increment_indent(); @@ -49,7 +49,7 @@ TEST_F(WgslGeneratorImplTest, Emit_VariableDeclStatement_Function) { ast::type::F32Type f32; auto* var = create("a", ast::StorageClass::kFunction, &f32); - ast::VariableDeclStatement stmt(std::move(var)); + ast::VariableDeclStatement stmt(var); gen.increment_indent(); @@ -61,7 +61,7 @@ TEST_F(WgslGeneratorImplTest, Emit_VariableDeclStatement_Private) { ast::type::F32Type f32; auto* var = create("a", ast::StorageClass::kPrivate, &f32); - ast::VariableDeclStatement stmt(std::move(var)); + ast::VariableDeclStatement stmt(var); gen.increment_indent(); diff --git a/src/writer/wgsl/generator_impl_variable_test.cc b/src/writer/wgsl/generator_impl_variable_test.cc index 529bf05e4d..23b9adf7ca 100644 --- a/src/writer/wgsl/generator_impl_variable_test.cc +++ b/src/writer/wgsl/generator_impl_variable_test.cc @@ -60,7 +60,7 @@ TEST_F(WgslGeneratorImplTest, EmitVariable_Decorated) { ast::DecoratedVariable dv; dv.set_name("a"); dv.set_type(&f32); - dv.set_decorations(std::move(decos)); + dv.set_decorations(decos); ASSERT_TRUE(gen.EmitVariable(&dv)) << gen.error(); EXPECT_EQ(gen.result(), R"([[location(2)]] var a : f32; @@ -81,7 +81,7 @@ TEST_F(WgslGeneratorImplTest, EmitVariable_Decorated_Multiple) { ast::DecoratedVariable dv; dv.set_name("a"); dv.set_type(&f32); - dv.set_decorations(std::move(decos)); + dv.set_decorations(decos); ASSERT_TRUE(gen.EmitVariable(&dv)) << gen.error(); EXPECT_EQ( @@ -95,7 +95,7 @@ TEST_F(WgslGeneratorImplTest, EmitVariable_Constructor) { ast::type::F32Type f32; ast::Variable v("a", ast::StorageClass::kNone, &f32); - v.set_constructor(std::move(ident)); + v.set_constructor(ident); ASSERT_TRUE(gen.EmitVariable(&v)) << gen.error(); EXPECT_EQ(gen.result(), R"(var a : f32 = initializer; @@ -107,7 +107,7 @@ TEST_F(WgslGeneratorImplTest, EmitVariable_Const) { ast::type::F32Type f32; ast::Variable v("a", ast::StorageClass::kNone, &f32); - v.set_constructor(std::move(ident)); + v.set_constructor(ident); v.set_is_const(true); ASSERT_TRUE(gen.EmitVariable(&v)) << gen.error();