Big cleanup now that AST nodes are raw pointers
Remove all redundant std::move()s. I've also removed calls to
std::move() in tests, even if they act as an optimization. This is for
two reasons:
(a) Performance is not important for testing, and this helps with
readability.
(b) A whole bunch tests were relying on std::move() clearing vectors so
they can be repopulated and used again. This is undefined behavior:
> Objects of types defined in the C++ standard library may be moved from
> (12.8). Move operations may be explicitly specified or implicitly
> generated. Unless otherwise specified, such moved-from objects shall
> be placed in a valid but unspecified state.
All of these UB cases have been fixed.
Removed all duplicate variables left over from:
`auto* foo_ptr = foo.get()`
which became:
`auto* foo_ptr = foo`
Bug: tint:322
Change-Id: Ibd08a2379671382320fd4d8da296ccc6a378b8af
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/32900
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
diff --git a/src/ast/array_accessor_expression_test.cc b/src/ast/array_accessor_expression_test.cc
index d24bb4d..92b38fa 100644
--- a/src/ast/array_accessor_expression_test.cc
+++ b/src/ast/array_accessor_expression_test.cc
@@ -27,19 +27,16 @@
auto* ary = create<IdentifierExpression>("ary");
auto* idx = create<IdentifierExpression>("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<IdentifierExpression>("ary");
auto* idx = create<IdentifierExpression>("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 @@
auto* ary = create<IdentifierExpression>("ary");
auto* idx = create<IdentifierExpression>("idx");
- ArrayAccessorExpression exp(std::move(ary), std::move(idx));
+ ArrayAccessorExpression exp(ary, idx);
EXPECT_TRUE(exp.IsValid());
}
@@ -62,7 +59,7 @@
auto* idx = create<IdentifierExpression>("idx");
ArrayAccessorExpression exp;
- exp.set_idx_expr(std::move(idx));
+ exp.set_idx_expr(idx);
EXPECT_FALSE(exp.IsValid());
}
@@ -70,21 +67,21 @@
auto* ary = create<IdentifierExpression>("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<IdentifierExpression>("");
auto* idx = create<IdentifierExpression>("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<IdentifierExpression>("ary");
auto* idx = create<IdentifierExpression>("");
- ArrayAccessorExpression exp(std::move(ary), std::move(idx));
+ ArrayAccessorExpression exp(ary, idx);
EXPECT_FALSE(exp.IsValid());
}
@@ -92,7 +89,7 @@
auto* ary = create<IdentifierExpression>("ary");
auto* idx = create<IdentifierExpression>("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 6be673e..fa01c7e 100644
--- a/src/ast/assignment_statement_test.cc
+++ b/src/ast/assignment_statement_test.cc
@@ -27,20 +27,16 @@
auto* lhs = create<ast::IdentifierExpression>("lhs");
auto* rhs = create<ast::IdentifierExpression>("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<ast::IdentifierExpression>("lhs");
auto* rhs = create<ast::IdentifierExpression>("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 @@
auto* lhs = create<ast::IdentifierExpression>("lhs");
auto* rhs = create<ast::IdentifierExpression>("rhs");
- AssignmentStatement stmt(std::move(lhs), std::move(rhs));
+ AssignmentStatement stmt(lhs, rhs);
EXPECT_TRUE(stmt.IsAssign());
}
@@ -58,7 +54,7 @@
auto* lhs = create<ast::IdentifierExpression>("lhs");
auto* rhs = create<ast::IdentifierExpression>("rhs");
- AssignmentStatement stmt(std::move(lhs), std::move(rhs));
+ AssignmentStatement stmt(lhs, rhs);
EXPECT_TRUE(stmt.IsValid());
}
@@ -66,7 +62,7 @@
auto* rhs = create<ast::IdentifierExpression>("rhs");
AssignmentStatement stmt;
- stmt.set_rhs(std::move(rhs));
+ stmt.set_rhs(rhs);
EXPECT_FALSE(stmt.IsValid());
}
@@ -74,21 +70,21 @@
auto* lhs = create<ast::IdentifierExpression>("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<ast::IdentifierExpression>("");
auto* rhs = create<ast::IdentifierExpression>("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<ast::IdentifierExpression>("lhs");
auto* rhs = create<ast::IdentifierExpression>("");
- AssignmentStatement stmt(std::move(lhs), std::move(rhs));
+ AssignmentStatement stmt(lhs, rhs);
EXPECT_FALSE(stmt.IsValid());
}
@@ -96,7 +92,7 @@
auto* lhs = create<ast::IdentifierExpression>("lhs");
auto* rhs = create<ast::IdentifierExpression>("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 5648bb2..7727cbd 100644
--- a/src/ast/binary_expression_test.cc
+++ b/src/ast/binary_expression_test.cc
@@ -29,12 +29,9 @@
auto* lhs = create<IdentifierExpression>("lhs");
auto* rhs = create<IdentifierExpression>("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 @@
auto* lhs = create<IdentifierExpression>("lhs");
auto* rhs = create<IdentifierExpression>("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 @@
auto* lhs = create<IdentifierExpression>("lhs");
auto* rhs = create<IdentifierExpression>("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 @@
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 @@
auto* lhs = create<IdentifierExpression>("");
auto* rhs = create<IdentifierExpression>("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 @@
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 @@
auto* lhs = create<IdentifierExpression>("lhs");
auto* rhs = create<IdentifierExpression>("");
- BinaryExpression r(BinaryOp::kEqual, std::move(lhs), std::move(rhs));
+ BinaryExpression r(BinaryOp::kEqual, lhs, rhs);
EXPECT_FALSE(r.IsValid());
}
@@ -100,7 +97,7 @@
auto* lhs = create<IdentifierExpression>("lhs");
auto* rhs = create<IdentifierExpression>("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 @@
auto* lhs = create<IdentifierExpression>("lhs");
auto* rhs = create<IdentifierExpression>("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 64565d4..3f02451 100644
--- a/src/ast/bitcast_expression_test.cc
+++ b/src/ast/bitcast_expression_test.cc
@@ -28,18 +28,16 @@
type::F32Type f32;
auto* expr = create<IdentifierExpression>("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<IdentifierExpression>("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 @@
type::F32Type f32;
auto* expr = create<IdentifierExpression>("expr");
- BitcastExpression exp(&f32, std::move(expr));
+ BitcastExpression exp(&f32, expr);
EXPECT_TRUE(exp.IsValid());
}
@@ -62,7 +60,7 @@
auto* expr = create<IdentifierExpression>("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_InvalidExpr) {
type::F32Type f32;
auto* expr = create<IdentifierExpression>("");
- BitcastExpression e(&f32, std::move(expr));
+ BitcastExpression e(&f32, expr);
EXPECT_FALSE(e.IsValid());
}
@@ -85,7 +83,7 @@
type::F32Type f32;
auto* expr = create<IdentifierExpression>("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 010b7d4..1c25885 100644
--- a/src/ast/block_statement_test.cc
+++ b/src/ast/block_statement_test.cc
@@ -32,7 +32,7 @@
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 @@
auto* s1 = create<DiscardStatement>();
auto* s2 = create<DiscardStatement>();
auto* s3 = create<DiscardStatement>();
- 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 885bc87..e736cb7 100644
--- a/src/ast/call_expression_test.cc
+++ b/src/ast/call_expression_test.cc
@@ -29,22 +29,18 @@
params.push_back(create<IdentifierExpression>("param1"));
params.push_back(create<IdentifierExpression>("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<IdentifierExpression>("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, IsCall) {
auto* func = create<IdentifierExpression>("func");
- CallExpression stmt(std::move(func), {});
+ CallExpression stmt(func, {});
EXPECT_TRUE(stmt.IsCall());
}
TEST_F(CallExpressionTest, IsValid) {
auto* func = create<IdentifierExpression>("func");
- CallExpression stmt(std::move(func), {});
+ CallExpression stmt(func, {});
EXPECT_TRUE(stmt.IsValid());
}
@@ -74,7 +70,7 @@
params.push_back(nullptr);
params.push_back(create<IdentifierExpression>("param2"));
- CallExpression stmt(std::move(func), std::move(params));
+ CallExpression stmt(func, params);
EXPECT_FALSE(stmt.IsValid());
}
@@ -83,7 +79,7 @@
ExpressionList params;
params.push_back(create<IdentifierExpression>("param1"));
- CallExpression stmt(std::move(func), std::move(params));
+ CallExpression stmt(func, params);
EXPECT_FALSE(stmt.IsValid());
}
@@ -92,13 +88,13 @@
ExpressionList params;
params.push_back(create<IdentifierExpression>(""));
- CallExpression stmt(std::move(func), std::move(params));
+ CallExpression stmt(func, params);
EXPECT_FALSE(stmt.IsValid());
}
TEST_F(CallExpressionTest, ToStr_NoParams) {
auto* func = create<IdentifierExpression>("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 @@
params.push_back(create<IdentifierExpression>("param1"));
params.push_back(create<IdentifierExpression>("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 4201fce..363918d 100644
--- a/src/ast/call_statement_test.cc
+++ b/src/ast/call_statement_test.cc
@@ -27,10 +27,9 @@
TEST_F(CallStatementTest, Creation) {
auto* expr = create<ast::CallExpression>(
create<ast::IdentifierExpression>("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 bc87b85..30c298e 100644
--- a/src/ast/case_statement_test.cc
+++ b/src/ast/case_statement_test.cc
@@ -32,38 +32,36 @@
ast::type::I32Type i32;
CaseSelectorList b;
- b.push_back(create<SintLiteral>(&i32, 2));
+ auto* selector = create<SintLiteral>(&i32, 2);
+ b.push_back(selector);
auto* body = create<BlockStatement>();
- body->append(create<DiscardStatement>());
+ auto* discard = create<DiscardStatement>();
+ 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<UintLiteral>(&u32, 2));
+ auto* selector = create<SintLiteral>(&u32, 2);
+ b.push_back(selector);
auto* body = create<BlockStatement>();
- body->append(create<DiscardStatement>());
+ auto* discard = create<DiscardStatement>();
+ 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 @@
auto* body = create<BlockStatement>();
body->append(create<DiscardStatement>());
- 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 @@
body->append(create<DiscardStatement>());
CaseStatement c(create<ast::BlockStatement>());
- c.set_body(std::move(body));
+ c.set_body(body);
EXPECT_TRUE(c.IsDefault());
}
@@ -96,7 +93,7 @@
b.push_back(create<SintLiteral>(&i32, 2));
CaseStatement c(create<ast::BlockStatement>());
- c.set_selectors(std::move(b));
+ c.set_selectors(b);
EXPECT_FALSE(c.IsDefault());
}
@@ -119,7 +116,7 @@
body->append(create<DiscardStatement>());
body->append(nullptr);
- CaseStatement c(std::move(b), std::move(body));
+ CaseStatement c(b, body);
EXPECT_FALSE(c.IsValid());
}
@@ -131,7 +128,7 @@
auto* body = create<BlockStatement>();
body->append(create<IfStatement>(nullptr, create<ast::BlockStatement>()));
- CaseStatement c({std::move(b)}, std::move(body));
+ CaseStatement c({b}, body);
EXPECT_FALSE(c.IsValid());
}
@@ -142,7 +139,7 @@
auto* body = create<BlockStatement>();
body->append(create<DiscardStatement>());
- CaseStatement c({std::move(b)}, std::move(body));
+ CaseStatement c({b}, body);
std::ostringstream out;
c.to_str(out, 2);
@@ -159,7 +156,7 @@
auto* body = create<BlockStatement>();
body->append(create<DiscardStatement>());
- CaseStatement c({std::move(b)}, std::move(body));
+ CaseStatement c({b}, body);
std::ostringstream out;
c.to_str(out, 2);
@@ -178,7 +175,7 @@
auto* body = create<BlockStatement>();
body->append(create<DiscardStatement>());
- 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_WithoutSelectors) {
auto* body = create<BlockStatement>();
body->append(create<DiscardStatement>());
- 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 70f1ab7..f133a13 100644
--- a/src/ast/decorated_variable_test.cc
+++ b/src/ast/decorated_variable_test.cc
@@ -35,7 +35,7 @@
TEST_F(DecoratedVariableTest, Creation) {
type::I32Type t;
auto* var = create<Variable>("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 @@
Source s{Source::Range{Source::Location{27, 4}, Source::Location{27, 5}}};
type::F32Type t;
auto* var = create<Variable>(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, NoDecorations) {
type::I32Type t;
auto* var = create<Variable>("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, WithDecorations) {
type::F32Type t;
auto* var = create<Variable>("my_var", StorageClass::kFunction, &t);
- DecoratedVariable dv(std::move(var));
+ DecoratedVariable dv(var);
VariableDecorationList decos;
decos.push_back(create<LocationDecoration>(1, Source{}));
decos.push_back(create<BuiltinDecoration>(ast::Builtin::kPosition, Source{}));
decos.push_back(create<ConstantIdDecoration>(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, ConstantId) {
type::F32Type t;
auto* var = create<Variable>("my_var", StorageClass::kFunction, &t);
- DecoratedVariable dv(std::move(var));
+ DecoratedVariable dv(var);
VariableDecorationList decos;
decos.push_back(create<ConstantIdDecoration>(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, IsValid) {
type::I32Type t;
auto* var = create<Variable>("my_var", StorageClass::kNone, &t);
- DecoratedVariable dv(std::move(var));
+ DecoratedVariable dv(var);
EXPECT_TRUE(dv.IsValid());
}
@@ -114,14 +114,14 @@
TEST_F(DecoratedVariableTest, to_str) {
type::F32Type t;
auto* var = create<Variable>("my_var", StorageClass::kFunction, &t);
- DecoratedVariable dv(std::move(var));
+ DecoratedVariable dv(var);
dv.set_constructor(create<IdentifierExpression>("expr"));
VariableDecorationList decos;
decos.push_back(create<BindingDecoration>(2, Source{}));
decos.push_back(create<SetDecoration>(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 b52cbec..948a94b 100644
--- a/src/ast/else_statement_test.cc
+++ b/src/ast/else_statement_test.cc
@@ -34,13 +34,12 @@
auto* body = create<BlockStatement>();
body->append(create<DiscardStatement>());
- 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 @@
ast::type::BoolType bool_type;
auto* cond = create<ScalarConstructorExpression>(
create<BoolLiteral>(&bool_type, true));
- ElseStatement e(std::move(cond), create<BlockStatement>());
+ ElseStatement e(cond, create<BlockStatement>());
EXPECT_TRUE(e.HasCondition());
}
@@ -77,7 +76,7 @@
auto* body = create<BlockStatement>();
body->append(create<DiscardStatement>());
- ElseStatement e(std::move(body));
+ ElseStatement e(body);
EXPECT_TRUE(e.IsValid());
}
@@ -86,13 +85,13 @@
body->append(create<DiscardStatement>());
body->append(nullptr);
- ElseStatement e(std::move(body));
+ ElseStatement e(body);
EXPECT_FALSE(e.IsValid());
}
TEST_F(ElseStatementTest, IsValid_InvalidCondition) {
auto* cond = create<ScalarConstructorExpression>();
- ElseStatement e(std::move(cond), create<BlockStatement>());
+ ElseStatement e(cond, create<BlockStatement>());
EXPECT_FALSE(e.IsValid());
}
@@ -100,7 +99,7 @@
auto* body = create<BlockStatement>();
body->append(create<IfStatement>(nullptr, create<ast::BlockStatement>()));
- ElseStatement e(std::move(body));
+ ElseStatement e(body);
EXPECT_FALSE(e.IsValid());
}
@@ -111,7 +110,7 @@
auto* body = create<BlockStatement>();
body->append(create<DiscardStatement>());
- 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 @@
auto* body = create<BlockStatement>();
body->append(create<DiscardStatement>());
- 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 5ba7e18..a305c96 100644
--- a/src/ast/function_test.cc
+++ b/src/ast/function_test.cc
@@ -38,14 +38,13 @@
VariableList params;
params.push_back(create<Variable>("var", StorageClass::kNone, &i32));
- auto* var_ptr = params[0];
+ auto* var = params[0];
- Function f("func", std::move(params), &void_type,
- create<ast::BlockStatement>());
+ Function f("func", params, &void_type, create<ast::BlockStatement>());
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 @@
VariableList params;
params.push_back(create<Variable>("var", StorageClass::kNone, &i32));
- Function f(Source{Source::Location{20, 2}}, "func", std::move(params),
- &void_type, create<ast::BlockStatement>());
+ Function f(Source{Source::Location{20, 2}}, "func", params, &void_type,
+ create<ast::BlockStatement>());
auto src = f.source();
EXPECT_EQ(src.range.begin.line, 20u);
EXPECT_EQ(src.range.begin.column, 2u);
@@ -86,28 +85,23 @@
type::VoidType void_type;
type::I32Type i32;
- VariableDecorationList decos;
DecoratedVariable loc1(
create<ast::Variable>("loc1", StorageClass::kInput, &i32));
- decos.push_back(create<ast::LocationDecoration>(0, Source{}));
- loc1.set_decorations(std::move(decos));
+ loc1.set_decorations({create<ast::LocationDecoration>(0, Source{})});
DecoratedVariable loc2(
create<ast::Variable>("loc2", StorageClass::kInput, &i32));
- decos.push_back(create<ast::LocationDecoration>(1, Source{}));
- loc2.set_decorations(std::move(decos));
+ loc2.set_decorations({create<ast::LocationDecoration>(1, Source{})});
DecoratedVariable builtin1(
create<ast::Variable>("builtin1", StorageClass::kInput, &i32));
- decos.push_back(
- create<ast::BuiltinDecoration>(ast::Builtin::kPosition, Source{}));
- builtin1.set_decorations(std::move(decos));
+ builtin1.set_decorations(
+ {create<ast::BuiltinDecoration>(ast::Builtin::kPosition, Source{})});
DecoratedVariable builtin2(
create<ast::Variable>("builtin2", StorageClass::kInput, &i32));
- decos.push_back(
- create<ast::BuiltinDecoration>(ast::Builtin::kFragDepth, Source{}));
- builtin2.set_decorations(std::move(decos));
+ builtin2.set_decorations(
+ {create<ast::BuiltinDecoration>(ast::Builtin::kFragDepth, Source{})});
Function f("func", VariableList{}, &void_type, create<ast::BlockStatement>());
@@ -129,28 +123,23 @@
type::VoidType void_type;
type::I32Type i32;
- VariableDecorationList decos;
DecoratedVariable loc1(
create<ast::Variable>("loc1", StorageClass::kInput, &i32));
- decos.push_back(create<ast::LocationDecoration>(0, Source{}));
- loc1.set_decorations(std::move(decos));
+ loc1.set_decorations({create<ast::LocationDecoration>(0, Source{})});
DecoratedVariable loc2(
create<ast::Variable>("loc2", StorageClass::kInput, &i32));
- decos.push_back(create<ast::LocationDecoration>(1, Source{}));
- loc2.set_decorations(std::move(decos));
+ loc2.set_decorations({create<ast::LocationDecoration>(1, Source{})});
DecoratedVariable builtin1(
create<ast::Variable>("builtin1", StorageClass::kInput, &i32));
- decos.push_back(
- create<ast::BuiltinDecoration>(ast::Builtin::kPosition, Source{}));
- builtin1.set_decorations(std::move(decos));
+ builtin1.set_decorations(
+ {create<ast::BuiltinDecoration>(ast::Builtin::kPosition, Source{})});
DecoratedVariable builtin2(
create<ast::Variable>("builtin2", StorageClass::kInput, &i32));
- decos.push_back(
- create<ast::BuiltinDecoration>(ast::Builtin::kFragDepth, Source{}));
- builtin2.set_decorations(std::move(decos));
+ builtin2.set_decorations(
+ {create<ast::BuiltinDecoration>(ast::Builtin::kFragDepth, Source{})});
Function f("func", VariableList{}, &void_type, create<ast::BlockStatement>());
@@ -191,9 +180,8 @@
auto* block = create<ast::BlockStatement>();
block->append(create<DiscardStatement>());
- Function f("func", std::move(params), &void_type,
- create<ast::BlockStatement>());
- f.set_body(std::move(block));
+ Function f("func", params, &void_type, create<ast::BlockStatement>());
+ f.set_body(block);
EXPECT_TRUE(f.IsValid());
}
@@ -204,7 +192,7 @@
VariableList params;
params.push_back(create<Variable>("var", StorageClass::kNone, &i32));
- Function f("", std::move(params), &void_type, create<ast::BlockStatement>());
+ Function f("", params, &void_type, create<ast::BlockStatement>());
EXPECT_FALSE(f.IsValid());
}
@@ -214,7 +202,7 @@
VariableList params;
params.push_back(create<Variable>("var", StorageClass::kNone, &i32));
- Function f("func", std::move(params), nullptr, create<ast::BlockStatement>());
+ Function f("func", params, nullptr, create<ast::BlockStatement>());
EXPECT_FALSE(f.IsValid());
}
@@ -226,8 +214,7 @@
params.push_back(create<Variable>("var", StorageClass::kNone, &i32));
params.push_back(nullptr);
- Function f("func", std::move(params), &void_type,
- create<ast::BlockStatement>());
+ Function f("func", params, &void_type, create<ast::BlockStatement>());
EXPECT_FALSE(f.IsValid());
}
@@ -237,8 +224,7 @@
VariableList params;
params.push_back(create<Variable>("var", StorageClass::kNone, nullptr));
- Function f("func", std::move(params), &void_type,
- create<ast::BlockStatement>());
+ Function f("func", params, &void_type, create<ast::BlockStatement>());
EXPECT_FALSE(f.IsValid());
}
@@ -253,9 +239,8 @@
block->append(create<DiscardStatement>());
block->append(nullptr);
- Function f("func", std::move(params), &void_type,
- create<ast::BlockStatement>());
- f.set_body(std::move(block));
+ Function f("func", params, &void_type, create<ast::BlockStatement>());
+ f.set_body(block);
EXPECT_FALSE(f.IsValid());
}
@@ -270,9 +255,8 @@
block->append(create<DiscardStatement>());
block->append(nullptr);
- Function f("func", std::move(params), &void_type,
- create<ast::BlockStatement>());
- f.set_body(std::move(block));
+ Function f("func", params, &void_type, create<ast::BlockStatement>());
+ f.set_body(block);
EXPECT_FALSE(f.IsValid());
}
@@ -284,7 +268,7 @@
block->append(create<DiscardStatement>());
Function f("func", {}, &void_type, create<ast::BlockStatement>());
- f.set_body(std::move(block));
+ f.set_body(block);
std::ostringstream out;
f.to_str(out, 2);
@@ -304,7 +288,7 @@
block->append(create<DiscardStatement>());
Function f("func", {}, &void_type, create<ast::BlockStatement>());
- f.set_body(std::move(block));
+ f.set_body(block);
f.add_decoration(create<WorkgroupDecoration>(2, 4, 6, Source{}));
std::ostringstream out;
@@ -328,9 +312,8 @@
auto* block = create<ast::BlockStatement>();
block->append(create<DiscardStatement>());
- Function f("func", std::move(params), &void_type,
- create<ast::BlockStatement>());
- f.set_body(std::move(block));
+ Function f("func", params, &void_type, create<ast::BlockStatement>());
+ f.set_body(block);
std::ostringstream out;
f.to_str(out, 2);
@@ -364,8 +347,7 @@
params.push_back(create<Variable>("var1", StorageClass::kNone, &i32));
params.push_back(create<Variable>("var2", StorageClass::kNone, &f32));
- Function f("func", std::move(params), &void_type,
- create<ast::BlockStatement>());
+ Function f("func", params, &void_type, create<ast::BlockStatement>());
EXPECT_EQ(f.type_name(), "__func__void__i32__f32");
}
@@ -375,13 +357,11 @@
VariableList params;
auto* body = create<ast::BlockStatement>();
auto* stmt = create<DiscardStatement>();
- auto* stmt_ptr = stmt;
- body->append(std::move(stmt));
- Function f("func", std::move(params), &void_type,
- create<ast::BlockStatement>());
- f.set_body(std::move(body));
+ body->append(stmt);
+ Function f("func", params, &void_type, create<ast::BlockStatement>());
+ 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 @@
VariableList params;
auto* body = create<ast::BlockStatement>();
- Function f("func", std::move(params), &void_type,
- create<ast::BlockStatement>());
- f.set_body(std::move(body));
+ Function f("func", params, &void_type, create<ast::BlockStatement>());
+ 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 a37afe3..5c6d04d 100644
--- a/src/ast/if_statement_test.cc
+++ b/src/ast/if_statement_test.cc
@@ -27,15 +27,13 @@
TEST_F(IfStatementTest, Creation) {
auto* cond = create<IdentifierExpression>("cond");
auto* body = create<BlockStatement>();
- body->append(create<DiscardStatement>());
+ auto* discard = create<DiscardStatement>();
+ 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 @@
auto* body = create<BlockStatement>();
body->append(create<DiscardStatement>());
- 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 @@
auto* body = create<BlockStatement>();
body->append(create<DiscardStatement>());
- IfStatement stmt(std::move(cond), std::move(body));
+ IfStatement stmt(cond, body);
EXPECT_TRUE(stmt.IsValid());
}
@@ -74,8 +71,8 @@
else_stmts[0]->set_condition(create<IdentifierExpression>("Ident"));
else_stmts.push_back(create<ElseStatement>(create<BlockStatement>()));
- 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 @@
auto* body = create<BlockStatement>();
body->append(create<DiscardStatement>());
- IfStatement stmt(nullptr, std::move(body));
+ IfStatement stmt(nullptr, body);
EXPECT_FALSE(stmt.IsValid());
}
@@ -92,7 +89,7 @@
auto* body = create<BlockStatement>();
body->append(create<DiscardStatement>());
- IfStatement stmt(std::move(cond), std::move(body));
+ IfStatement stmt(cond, body);
EXPECT_FALSE(stmt.IsValid());
}
@@ -102,7 +99,7 @@
body->append(create<DiscardStatement>());
body->append(nullptr);
- IfStatement stmt(std::move(cond), std::move(body));
+ IfStatement stmt(cond, body);
EXPECT_FALSE(stmt.IsValid());
}
@@ -112,7 +109,7 @@
body->append(create<DiscardStatement>());
body->append(create<IfStatement>(nullptr, create<BlockStatement>()));
- IfStatement stmt(std::move(cond), std::move(body));
+ IfStatement stmt(cond, body);
EXPECT_FALSE(stmt.IsValid());
}
@@ -127,8 +124,8 @@
else_stmts.push_back(create<ElseStatement>(create<BlockStatement>()));
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 @@
else_stmts.push_back(create<ElseStatement>(create<BlockStatement>()));
else_stmts[0]->set_condition(create<IdentifierExpression>(""));
- 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 @@
else_stmts.push_back(create<ElseStatement>(create<BlockStatement>()));
else_stmts.push_back(create<ElseStatement>(create<BlockStatement>()));
- 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 @@
else_stmts.push_back(create<ElseStatement>(create<BlockStatement>()));
else_stmts[1]->set_condition(create<IdentifierExpression>("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 @@
auto* body = create<BlockStatement>();
body->append(create<DiscardStatement>());
- IfStatement stmt(std::move(cond), std::move(body));
+ IfStatement stmt(cond, body);
std::ostringstream out;
stmt.to_str(out, 2);
@@ -210,12 +207,12 @@
ElseStatementList else_stmts;
else_stmts.push_back(create<ElseStatement>(create<BlockStatement>()));
else_stmts[0]->set_condition(create<IdentifierExpression>("ident"));
- else_stmts[0]->set_body(std::move(else_if_body));
+ else_stmts[0]->set_body(else_if_body);
else_stmts.push_back(create<ElseStatement>(create<BlockStatement>()));
- 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 e8ce319..6e242e3 100644
--- a/src/ast/loop_statement_test.cc
+++ b/src/ast/loop_statement_test.cc
@@ -30,17 +30,16 @@
TEST_F(LoopStatementTest, Creation) {
auto* body = create<BlockStatement>();
body->append(create<DiscardStatement>());
- auto* b_ptr = body->last();
+ auto* b = body->last();
auto* continuing = create<BlockStatement>();
continuing->append(create<DiscardStatement>());
- 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 @@
auto* continuing = create<BlockStatement>();
continuing->append(create<DiscardStatement>());
- 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 @@
auto* body = create<BlockStatement>();
body->append(create<DiscardStatement>());
- LoopStatement l(std::move(body), {});
+ LoopStatement l(body, {});
EXPECT_FALSE(l.has_continuing());
}
@@ -77,7 +75,7 @@
auto* continuing = create<BlockStatement>();
continuing->append(create<DiscardStatement>());
- LoopStatement l(std::move(body), std::move(continuing));
+ LoopStatement l(body, continuing);
EXPECT_TRUE(l.has_continuing());
}
@@ -88,7 +86,7 @@
auto* continuing = create<BlockStatement>();
continuing->append(create<DiscardStatement>());
- LoopStatement l(std::move(body), std::move(continuing));
+ LoopStatement l(body, continuing);
EXPECT_TRUE(l.IsValid());
}
@@ -96,7 +94,7 @@
auto* body = create<BlockStatement>();
body->append(create<DiscardStatement>());
- LoopStatement l(std::move(body), create<BlockStatement>());
+ LoopStatement l(body, create<BlockStatement>());
EXPECT_TRUE(l.IsValid());
}
@@ -113,7 +111,7 @@
auto* continuing = create<BlockStatement>();
continuing->append(create<DiscardStatement>());
- LoopStatement l(std::move(body), std::move(continuing));
+ LoopStatement l(body, continuing);
EXPECT_FALSE(l.IsValid());
}
@@ -125,7 +123,7 @@
auto* continuing = create<BlockStatement>();
continuing->append(create<DiscardStatement>());
- LoopStatement l(std::move(body), std::move(continuing));
+ LoopStatement l(body, continuing);
EXPECT_FALSE(l.IsValid());
}
@@ -137,7 +135,7 @@
continuing->append(create<DiscardStatement>());
continuing->append(nullptr);
- LoopStatement l(std::move(body), std::move(continuing));
+ LoopStatement l(body, continuing);
EXPECT_FALSE(l.IsValid());
}
@@ -149,7 +147,7 @@
continuing->append(create<DiscardStatement>());
continuing->append(create<IfStatement>(nullptr, create<BlockStatement>()));
- LoopStatement l(std::move(body), std::move(continuing));
+ LoopStatement l(body, continuing);
EXPECT_FALSE(l.IsValid());
}
@@ -157,7 +155,7 @@
auto* body = create<BlockStatement>();
body->append(create<DiscardStatement>());
- 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 @@
auto* continuing = create<BlockStatement>();
continuing->append(create<DiscardStatement>());
- 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 78c06ff..756f65f 100644
--- a/src/ast/member_accessor_expression_test.cc
+++ b/src/ast/member_accessor_expression_test.cc
@@ -29,20 +29,16 @@
auto* str = create<IdentifierExpression>("structure");
auto* mem = create<IdentifierExpression>("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<IdentifierExpression>("structure");
auto* mem = create<IdentifierExpression>("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 @@
auto* str = create<IdentifierExpression>("structure");
auto* mem = create<IdentifierExpression>("member");
- MemberAccessorExpression stmt(std::move(str), std::move(mem));
+ MemberAccessorExpression stmt(str, mem);
EXPECT_TRUE(stmt.IsValid());
}
@@ -65,7 +61,7 @@
auto* mem = create<IdentifierExpression>("member");
MemberAccessorExpression stmt;
- stmt.set_member(std::move(mem));
+ stmt.set_member(mem);
EXPECT_FALSE(stmt.IsValid());
}
@@ -73,7 +69,7 @@
auto* str = create<IdentifierExpression>("");
auto* mem = create<IdentifierExpression>("member");
- MemberAccessorExpression stmt(std::move(str), std::move(mem));
+ MemberAccessorExpression stmt(str, mem);
EXPECT_FALSE(stmt.IsValid());
}
@@ -81,7 +77,7 @@
auto* str = create<IdentifierExpression>("structure");
MemberAccessorExpression stmt;
- stmt.set_structure(std::move(str));
+ stmt.set_structure(str);
EXPECT_FALSE(stmt.IsValid());
}
@@ -89,7 +85,7 @@
auto* str = create<IdentifierExpression>("structure");
auto* mem = create<IdentifierExpression>("");
- MemberAccessorExpression stmt(std::move(str), std::move(mem));
+ MemberAccessorExpression stmt(str, mem);
EXPECT_FALSE(stmt.IsValid());
}
@@ -97,7 +93,7 @@
auto* str = create<IdentifierExpression>("structure");
auto* mem = create<IdentifierExpression>("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 5a55874..f52f9d6 100644
--- a/src/ast/module_test.cc
+++ b/src/ast/module_test.cc
@@ -49,10 +49,9 @@
Module m;
auto* func = create<Function>("main", VariableList{}, &f32,
- create<ast::BlockStatement>());
- auto* func_ptr = func;
- m.AddFunction(std::move(func));
- EXPECT_EQ(func_ptr, m.FindFunctionByName("main"));
+ create<ast::BlockStatement>());
+ m.AddFunction(func);
+ EXPECT_EQ(func, m.FindFunctionByName("main"));
}
TEST_F(ModuleTest, LookupFunctionMissing) {
@@ -70,7 +69,7 @@
auto* var = create<Variable>("var", StorageClass::kInput, &f32);
Module m;
- m.AddGlobalVariable(std::move(var));
+ m.AddGlobalVariable(var);
EXPECT_TRUE(m.IsValid());
}
@@ -84,7 +83,7 @@
auto* var = create<Variable>("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_Function) {
type::F32Type f32;
auto* func = create<Function>("main", VariableList(), &f32,
- create<ast::BlockStatement>());
+ create<ast::BlockStatement>());
Module m;
- m.AddFunction(std::move(func));
+ m.AddFunction(func);
EXPECT_TRUE(m.IsValid());
}
@@ -143,7 +142,7 @@
auto* func = create<Function>();
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 e883177..42261c4 100644
--- a/src/ast/return_statement_test.cc
+++ b/src/ast/return_statement_test.cc
@@ -27,10 +27,9 @@
TEST_F(ReturnStatementTest, Creation) {
auto* expr = create<IdentifierExpression>("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_WithValue) {
auto* expr = create<IdentifierExpression>("expr");
- ReturnStatement r(std::move(expr));
+ ReturnStatement r(expr);
EXPECT_TRUE(r.has_value());
}
@@ -63,19 +62,19 @@
TEST_F(ReturnStatementTest, IsValid_WithValue) {
auto* expr = create<IdentifierExpression>("expr");
- ReturnStatement r(std::move(expr));
+ ReturnStatement r(expr);
EXPECT_TRUE(r.IsValid());
}
TEST_F(ReturnStatementTest, IsValid_InvalidValue) {
auto* expr = create<IdentifierExpression>("");
- ReturnStatement r(std::move(expr));
+ ReturnStatement r(expr);
EXPECT_FALSE(r.IsValid());
}
TEST_F(ReturnStatementTest, ToStr_WithValue) {
auto* expr = create<IdentifierExpression>("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 b1525c0..61f1bd2 100644
--- a/src/ast/scalar_constructor_expression_test.cc
+++ b/src/ast/scalar_constructor_expression_test.cc
@@ -27,15 +27,14 @@
TEST_F(ScalarConstructorExpressionTest, Creation) {
ast::type::BoolType bool_type;
auto* b = create<BoolLiteral>(&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<BoolLiteral>(&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, IsValid) {
ast::type::BoolType bool_type;
auto* b = create<BoolLiteral>(&bool_type, true);
- ScalarConstructorExpression c(std::move(b));
+ ScalarConstructorExpression c(b);
EXPECT_TRUE(c.IsValid());
}
@@ -56,7 +55,7 @@
TEST_F(ScalarConstructorExpressionTest, ToStr) {
ast::type::BoolType bool_type;
auto* b = create<BoolLiteral>(&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 4981a2c..a7fe388 100644
--- a/src/ast/struct_member_test.cc
+++ b/src/ast/struct_member_test.cc
@@ -32,7 +32,7 @@
StructMemberDecorationList decorations;
decorations.emplace_back(create<StructMemberOffsetDecoration>(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 @@
decorations.emplace_back(create<StructMemberOffsetDecoration>(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 @@
StructMemberDecorationList decorations;
decorations.emplace_back(create<StructMemberOffsetDecoration>(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 66dcd20..49427cf 100644
--- a/src/ast/switch_statement_test.cc
+++ b/src/ast/switch_statement_test.cc
@@ -36,22 +36,19 @@
auto* ident = create<IdentifierExpression>("ident");
CaseStatementList body;
- body.push_back(
- create<CaseStatement>(std::move(lit), create<ast::BlockStatement>()));
+ auto* case_stmt = create<CaseStatement>(lit, create<ast::BlockStatement>());
+ 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<IdentifierExpression>("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 @@
auto* ident = create<IdentifierExpression>("ident");
CaseStatementList body;
- body.push_back(
- create<CaseStatement>(std::move(lit), create<ast::BlockStatement>()));
+ body.push_back(create<CaseStatement>(lit, create<ast::BlockStatement>()));
- SwitchStatement stmt(std::move(ident), std::move(body));
+ SwitchStatement stmt(ident, body);
EXPECT_TRUE(stmt.IsValid());
}
@@ -85,11 +81,10 @@
lit.push_back(create<SintLiteral>(&i32, 2));
CaseStatementList body;
- body.push_back(
- create<CaseStatement>(std::move(lit), create<ast::BlockStatement>()));
+ body.push_back(create<CaseStatement>(lit, create<ast::BlockStatement>()));
SwitchStatement stmt;
- stmt.set_body(std::move(body));
+ stmt.set_body(body);
EXPECT_FALSE(stmt.IsValid());
}
@@ -101,10 +96,9 @@
auto* ident = create<IdentifierExpression>("");
CaseStatementList body;
- body.push_back(
- create<CaseStatement>(std::move(lit), create<ast::BlockStatement>()));
+ body.push_back(create<CaseStatement>(lit, create<ast::BlockStatement>()));
- SwitchStatement stmt(std::move(ident), std::move(body));
+ SwitchStatement stmt(ident, body);
EXPECT_FALSE(stmt.IsValid());
}
@@ -116,11 +110,10 @@
auto* ident = create<IdentifierExpression>("ident");
CaseStatementList body;
- body.push_back(
- create<CaseStatement>(std::move(lit), create<ast::BlockStatement>()));
+ body.push_back(create<CaseStatement>(lit, create<ast::BlockStatement>()));
body.push_back(nullptr);
- SwitchStatement stmt(std::move(ident), std::move(body));
+ SwitchStatement stmt(ident, body);
EXPECT_FALSE(stmt.IsValid());
}
@@ -131,17 +124,16 @@
case_body->append(nullptr);
CaseStatementList body;
- body.push_back(
- create<CaseStatement>(CaseSelectorList{}, std::move(case_body)));
+ body.push_back(create<CaseStatement>(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<IdentifierExpression>("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 @@
auto* ident = create<IdentifierExpression>("ident");
CaseStatementList body;
- body.push_back(
- create<CaseStatement>(std::move(lit), create<ast::BlockStatement>()));
+ body.push_back(create<CaseStatement>(lit, create<ast::BlockStatement>()));
- 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 748114b..ba63f63 100644
--- a/src/ast/type/access_control_type_test.cc
+++ b/src/ast/type/access_control_type_test.cc
@@ -103,7 +103,7 @@
ArrayType array(&u32, 4);
ArrayDecorationList decos;
decos.push_back(create<StrideDecoration>(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 @@
ArrayType array(&u32);
ArrayDecorationList decos;
decos.push_back(create<StrideDecoration>(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 @@
StructMemberDecorationList deco;
deco.push_back(create<StructMemberOffsetDecoration>(0, Source{}));
- members.push_back(create<StructMember>("foo", &u32, std::move(deco)));
+ members.push_back(create<StructMember>("foo", &u32, deco));
deco = StructMemberDecorationList();
deco.push_back(create<StructMemberOffsetDecoration>(4, Source{}));
- members.push_back(create<StructMember>("bar", &u32, std::move(deco)));
+ members.push_back(create<StructMember>("bar", &u32, deco));
ast::StructDecorationList decos;
- auto* str = create<ast::Struct>(std::move(decos), std::move(members));
- StructType struct_type("struct_type", std::move(str));
+ auto* str = create<ast::Struct>(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 @@
ArrayType array(&u32, 4);
ArrayDecorationList decos;
decos.push_back(create<StrideDecoration>(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 @@
ArrayType array(&u32);
ArrayDecorationList decos;
decos.push_back(create<StrideDecoration>(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 @@
{
StructMemberDecorationList deco;
deco.push_back(create<StructMemberOffsetDecoration>(0, Source{}));
- members.push_back(create<StructMember>("foo", &u32, std::move(deco)));
+ members.push_back(create<StructMember>("foo", &u32, deco));
}
{
StructMemberDecorationList deco;
deco.push_back(create<StructMemberOffsetDecoration>(4, Source{}));
- members.push_back(create<StructMember>("bar", &u32, std::move(deco)));
+ members.push_back(create<StructMember>("bar", &u32, deco));
}
ast::StructDecorationList decos;
- auto* str = create<ast::Struct>(std::move(decos), std::move(members));
- StructType struct_type("struct_type", std::move(str));
+ auto* str = create<ast::Struct>(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 ae62a0f..729a12b 100644
--- a/src/ast/type/alias_type_test.cc
+++ b/src/ast/type/alias_type_test.cc
@@ -166,7 +166,7 @@
ArrayType array(&u32, 4);
ArrayDecorationList decos;
decos.push_back(create<StrideDecoration>(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 @@
ArrayType array(&u32);
ArrayDecorationList decos;
decos.push_back(create<StrideDecoration>(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 @@
{
StructMemberDecorationList deco;
deco.push_back(create<StructMemberOffsetDecoration>(0, Source{}));
- members.push_back(create<StructMember>("foo", &u32, std::move(deco)));
+ members.push_back(create<StructMember>("foo", &u32, deco));
}
{
StructMemberDecorationList deco;
deco.push_back(create<StructMemberOffsetDecoration>(4, Source{}));
- members.push_back(create<StructMember>("bar", &u32, std::move(deco)));
+ members.push_back(create<StructMember>("bar", &u32, deco));
}
ast::StructDecorationList decos;
- auto* str = create<ast::Struct>(std::move(decos), std::move(members));
- StructType struct_type("struct_type", std::move(str));
+ auto* str = create<ast::Struct>(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 @@
ArrayType array(&u32, 4);
ArrayDecorationList decos;
decos.push_back(create<StrideDecoration>(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 @@
ArrayType array(&u32);
ArrayDecorationList decos;
decos.push_back(create<StrideDecoration>(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 @@
{
StructMemberDecorationList deco;
deco.push_back(create<StructMemberOffsetDecoration>(0, Source{}));
- members.push_back(create<StructMember>("foo", &u32, std::move(deco)));
+ members.push_back(create<StructMember>("foo", &u32, deco));
}
{
StructMemberDecorationList deco;
deco.push_back(create<StructMemberOffsetDecoration>(4, Source{}));
- members.push_back(create<StructMember>("bar", &u32, std::move(deco)));
+ members.push_back(create<StructMember>("bar", &u32, deco));
}
ast::StructDecorationList decos;
- auto* str = create<ast::Struct>(std::move(decos), std::move(members));
- StructType struct_type("struct_type", std::move(str));
+ auto* str = create<ast::Struct>(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 a0f745c..447d6b8 100644
--- a/src/ast/type/array_type_test.cc
+++ b/src/ast/type/array_type_test.cc
@@ -84,7 +84,7 @@
decos.push_back(create<StrideDecoration>(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 @@
decos.push_back(create<StrideDecoration>(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 @@
decos.push_back(create<StrideDecoration>(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 @@
decos.push_back(create<StrideDecoration>(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 @@
decos.push_back(create<StrideDecoration>(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 44d0ccc..88bf368 100644
--- a/src/ast/type/struct_type_test.cc
+++ b/src/ast/type/struct_type_test.cc
@@ -36,13 +36,13 @@
TEST_F(StructTypeTest, Creation) {
auto* impl = create<Struct>();
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<Struct>();
- 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, TypeName) {
auto* impl = create<Struct>();
- StructType s{"my_struct", std::move(impl)};
+ StructType s{"my_struct", impl};
EXPECT_EQ(s.type_name(), "__struct_my_struct");
}
@@ -71,17 +71,17 @@
{
StructMemberDecorationList deco;
deco.push_back(create<StructMemberOffsetDecoration>(0, Source{}));
- members.push_back(create<StructMember>("foo", &u32, std::move(deco)));
+ members.push_back(create<StructMember>("foo", &u32, deco));
}
{
StructMemberDecorationList deco;
deco.push_back(create<StructMemberOffsetDecoration>(4, Source{}));
- members.push_back(create<StructMember>("bar", &u32, std::move(deco)));
+ members.push_back(create<StructMember>("bar", &u32, deco));
}
ast::StructDecorationList decos;
- auto* str = create<ast::Struct>(std::move(decos), std::move(members));
- StructType struct_type("struct_type", std::move(str));
+ auto* str = create<ast::Struct>(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 @@
{
ArrayDecorationList decos;
decos.push_back(create<StrideDecoration>(4, Source{}));
- arr.set_decorations(std::move(decos));
+ arr.set_decorations(decos);
}
StructMemberList members;
{
StructMemberDecorationList deco;
deco.push_back(create<StructMemberOffsetDecoration>(0, Source{}));
- members.push_back(create<StructMember>("foo", &u32, std::move(deco)));
+ members.push_back(create<StructMember>("foo", &u32, deco));
}
{
StructMemberDecorationList deco;
deco.push_back(create<StructMemberOffsetDecoration>(4, Source{}));
- members.push_back(create<StructMember>("bar", &u32, std::move(deco)));
+ members.push_back(create<StructMember>("bar", &u32, deco));
}
{
StructMemberDecorationList deco;
deco.push_back(create<StructMemberOffsetDecoration>(8, Source{}));
- members.push_back(create<StructMember>("bar", &arr, std::move(deco)));
+ members.push_back(create<StructMember>("bar", &arr, deco));
}
ast::StructDecorationList decos;
- auto* str = create<ast::Struct>(std::move(decos), std::move(members));
- StructType struct_type("struct_type", std::move(str));
+ auto* str = create<ast::Struct>(decos, members);
+ StructType struct_type("struct_type", str);
EXPECT_EQ(32u,
struct_type.MinBufferBindingSize(MemoryLayout::kUniformBuffer));
EXPECT_EQ(24u,
@@ -128,29 +128,29 @@
{
ArrayDecorationList decos;
decos.push_back(create<StrideDecoration>(4, Source{}));
- arr.set_decorations(std::move(decos));
+ arr.set_decorations(decos);
}
StructMemberList members;
{
StructMemberDecorationList deco;
deco.push_back(create<StructMemberOffsetDecoration>(0, Source{}));
- members.push_back(create<StructMember>("foo", &u32, std::move(deco)));
+ members.push_back(create<StructMember>("foo", &u32, deco));
}
{
StructMemberDecorationList deco;
deco.push_back(create<StructMemberOffsetDecoration>(4, Source{}));
- members.push_back(create<StructMember>("bar", &u32, std::move(deco)));
+ members.push_back(create<StructMember>("bar", &u32, deco));
}
{
StructMemberDecorationList deco;
deco.push_back(create<StructMemberOffsetDecoration>(8, Source{}));
- members.push_back(create<StructMember>("bar", &u32, std::move(deco)));
+ members.push_back(create<StructMember>("bar", &u32, deco));
}
ast::StructDecorationList decos;
- auto* str = create<ast::Struct>(std::move(decos), std::move(members));
- StructType struct_type("struct_type", std::move(str));
+ auto* str = create<ast::Struct>(decos, members);
+ StructType struct_type("struct_type", str);
EXPECT_EQ(12u,
struct_type.MinBufferBindingSize(MemoryLayout::kStorageBuffer));
}
@@ -163,12 +163,12 @@
{
StructMemberDecorationList deco;
deco.push_back(create<StructMemberOffsetDecoration>(0, Source{}));
- members.push_back(create<StructMember>("foo", &vec2, std::move(deco)));
+ members.push_back(create<StructMember>("foo", &vec2, deco));
}
ast::StructDecorationList decos;
- auto* str = create<ast::Struct>(std::move(decos), std::move(members));
- StructType struct_type("struct_type", std::move(str));
+ auto* str = create<ast::Struct>(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 @@
{
StructMemberDecorationList deco;
deco.push_back(create<StructMemberOffsetDecoration>(0, Source{}));
- members.push_back(create<StructMember>("foo", &vec3, std::move(deco)));
+ members.push_back(create<StructMember>("foo", &vec3, deco));
}
ast::StructDecorationList decos;
- auto* str = create<ast::Struct>(std::move(decos), std::move(members));
- StructType struct_type("struct_type", std::move(str));
+ auto* str = create<ast::Struct>(decos, members);
+ StructType struct_type("struct_type", str);
EXPECT_EQ(16u,
struct_type.MinBufferBindingSize(MemoryLayout::kUniformBuffer));
EXPECT_EQ(16u,
@@ -202,12 +202,12 @@
{
StructMemberDecorationList deco;
deco.push_back(create<StructMemberOffsetDecoration>(0, Source{}));
- members.push_back(create<StructMember>("foo", &vec4, std::move(deco)));
+ members.push_back(create<StructMember>("foo", &vec4, deco));
}
ast::StructDecorationList decos;
- auto* str = create<ast::Struct>(std::move(decos), std::move(members));
- StructType struct_type("struct_type", std::move(str));
+ auto* str = create<ast::Struct>(decos, members);
+ StructType struct_type("struct_type", str);
EXPECT_EQ(16u,
struct_type.MinBufferBindingSize(MemoryLayout::kUniformBuffer));
EXPECT_EQ(16u,
@@ -221,17 +221,17 @@
{
StructMemberDecorationList deco;
deco.push_back(create<StructMemberOffsetDecoration>(0, Source{}));
- members.push_back(create<StructMember>("foo", &u32, std::move(deco)));
+ members.push_back(create<StructMember>("foo", &u32, deco));
}
{
StructMemberDecorationList deco;
deco.push_back(create<StructMemberOffsetDecoration>(4, Source{}));
- members.push_back(create<StructMember>("bar", &u32, std::move(deco)));
+ members.push_back(create<StructMember>("bar", &u32, deco));
}
ast::StructDecorationList decos;
- auto* str = create<ast::Struct>(std::move(decos), std::move(members));
- StructType struct_type("struct_type", std::move(str));
+ auto* str = create<ast::Struct>(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 @@
{
ArrayDecorationList decos;
decos.push_back(create<StrideDecoration>(4, Source{}));
- arr.set_decorations(std::move(decos));
+ arr.set_decorations(decos);
}
StructMemberList members;
{
StructMemberDecorationList deco;
deco.push_back(create<StructMemberOffsetDecoration>(0, Source{}));
- members.push_back(create<StructMember>("foo", &u32, std::move(deco)));
+ members.push_back(create<StructMember>("foo", &u32, deco));
}
{
StructMemberDecorationList deco;
deco.push_back(create<StructMemberOffsetDecoration>(4, Source{}));
- members.push_back(create<StructMember>("bar", &u32, std::move(deco)));
+ members.push_back(create<StructMember>("bar", &u32, deco));
}
{
StructMemberDecorationList deco;
deco.push_back(create<StructMemberOffsetDecoration>(8, Source{}));
- members.push_back(create<StructMember>("bar", &arr, std::move(deco)));
+ members.push_back(create<StructMember>("bar", &arr, deco));
}
ast::StructDecorationList decos;
- auto* str = create<ast::Struct>(std::move(decos), std::move(members));
- StructType struct_type("struct_type", std::move(str));
+ auto* str = create<ast::Struct>(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 @@
{
ArrayDecorationList decos;
decos.push_back(create<StrideDecoration>(4, Source{}));
- arr.set_decorations(std::move(decos));
+ arr.set_decorations(decos);
}
StructMemberList members;
{
StructMemberDecorationList deco;
deco.push_back(create<StructMemberOffsetDecoration>(0, Source{}));
- members.push_back(create<StructMember>("foo", &u32, std::move(deco)));
+ members.push_back(create<StructMember>("foo", &u32, deco));
}
{
StructMemberDecorationList deco;
deco.push_back(create<StructMemberOffsetDecoration>(4, Source{}));
- members.push_back(create<StructMember>("bar", &u32, std::move(deco)));
+ members.push_back(create<StructMember>("bar", &u32, deco));
}
{
StructMemberDecorationList deco;
deco.push_back(create<StructMemberOffsetDecoration>(8, Source{}));
- members.push_back(create<StructMember>("bar", &u32, std::move(deco)));
+ members.push_back(create<StructMember>("bar", &u32, deco));
}
ast::StructDecorationList decos;
- auto* str = create<ast::Struct>(std::move(decos), std::move(members));
- StructType struct_type("struct_type", std::move(str));
+ auto* str = create<ast::Struct>(decos, members);
+ StructType struct_type("struct_type", str);
EXPECT_EQ(4u, struct_type.BaseAlignment(MemoryLayout::kStorageBuffer));
}
@@ -309,12 +309,12 @@
{
StructMemberDecorationList deco;
deco.push_back(create<StructMemberOffsetDecoration>(0, Source{}));
- members.push_back(create<StructMember>("foo", &vec2, std::move(deco)));
+ members.push_back(create<StructMember>("foo", &vec2, deco));
}
ast::StructDecorationList decos;
- auto* str = create<ast::Struct>(std::move(decos), std::move(members));
- StructType struct_type("struct_type", std::move(str));
+ auto* str = create<ast::Struct>(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 @@
{
StructMemberDecorationList deco;
deco.push_back(create<StructMemberOffsetDecoration>(0, Source{}));
- members.push_back(create<StructMember>("foo", &vec3, std::move(deco)));
+ members.push_back(create<StructMember>("foo", &vec3, deco));
}
ast::StructDecorationList decos;
- auto* str = create<ast::Struct>(std::move(decos), std::move(members));
- StructType struct_type("struct_type", std::move(str));
+ auto* str = create<ast::Struct>(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 @@
{
StructMemberDecorationList deco;
deco.push_back(create<StructMemberOffsetDecoration>(0, Source{}));
- members.push_back(create<StructMember>("foo", &vec4, std::move(deco)));
+ members.push_back(create<StructMember>("foo", &vec4, deco));
}
ast::StructDecorationList decos;
- auto* str = create<ast::Struct>(std::move(decos), std::move(members));
- StructType struct_type("struct_type", std::move(str));
+ auto* str = create<ast::Struct>(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 18914f0..c576fed 100644
--- a/src/ast/type_constructor_expression_test.cc
+++ b/src/ast/type_constructor_expression_test.cc
@@ -33,12 +33,11 @@
type::F32Type f32;
ExpressionList expr;
expr.push_back(create<IdentifierExpression>("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 @@
ExpressionList expr;
expr.push_back(create<IdentifierExpression>("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 @@
ExpressionList expr;
expr.push_back(create<IdentifierExpression>("expr"));
- TypeConstructorExpression t(&f32, std::move(expr));
+ TypeConstructorExpression t(&f32, expr);
EXPECT_TRUE(t.IsValid());
}
@@ -71,7 +69,7 @@
type::F32Type f32;
ExpressionList expr;
- TypeConstructorExpression t(&f32, std::move(expr));
+ TypeConstructorExpression t(&f32, expr);
EXPECT_TRUE(t.IsValid());
}
@@ -80,7 +78,7 @@
expr.push_back(create<IdentifierExpression>("expr"));
TypeConstructorExpression t;
- t.set_values(std::move(expr));
+ t.set_values(expr);
EXPECT_FALSE(t.IsValid());
}
@@ -90,7 +88,7 @@
expr.push_back(create<IdentifierExpression>("expr"));
expr.push_back(nullptr);
- TypeConstructorExpression t(&f32, std::move(expr));
+ TypeConstructorExpression t(&f32, expr);
EXPECT_FALSE(t.IsValid());
}
@@ -99,7 +97,7 @@
ExpressionList expr;
expr.push_back(create<IdentifierExpression>(""));
- TypeConstructorExpression t(&f32, std::move(expr));
+ TypeConstructorExpression t(&f32, expr);
EXPECT_FALSE(t.IsValid());
}
@@ -111,7 +109,7 @@
expr.push_back(create<IdentifierExpression>("expr_2"));
expr.push_back(create<IdentifierExpression>("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 9192139..f474ea9 100644
--- a/src/ast/unary_op_expression_test.cc
+++ b/src/ast/unary_op_expression_test.cc
@@ -27,17 +27,15 @@
TEST_F(UnaryOpExpressionTest, Creation) {
auto* ident = create<IdentifierExpression>("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<IdentifierExpression>("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, IsValid) {
auto* ident = create<IdentifierExpression>("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_InvalidExpression) {
auto* ident = create<IdentifierExpression>("");
- UnaryOpExpression u(UnaryOp::kNot, std::move(ident));
+ UnaryOpExpression u(UnaryOp::kNot, ident);
EXPECT_FALSE(u.IsValid());
}
TEST_F(UnaryOpExpressionTest, ToStr) {
auto* ident = create<IdentifierExpression>("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 9ab2c3b..8e96e12 100644
--- a/src/ast/variable_decl_statement_test.cc
+++ b/src/ast/variable_decl_statement_test.cc
@@ -27,17 +27,16 @@
TEST_F(VariableDeclStatementTest, Creation) {
type::F32Type f32;
auto* var = create<Variable>("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<Variable>("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, IsValid) {
type::F32Type f32;
auto* var = create<Variable>("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<Variable>("", StorageClass::kNone, &f32);
- VariableDeclStatement stmt(std::move(var));
+ VariableDeclStatement stmt(var);
EXPECT_FALSE(stmt.IsValid());
}
@@ -71,7 +70,7 @@
type::F32Type f32;
auto* var = create<Variable>("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 dd78493..9875ec4 100644
--- a/src/inspector/inspector.cc
+++ b/src/inspector/inspector.cc
@@ -199,7 +199,7 @@
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 @@
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 @@
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 @@
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 @@
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 50a9380..4487192 100644
--- a/src/inspector/inspector_test.cc
+++ b/src/inspector/inspector_test.cc
@@ -81,8 +81,7 @@
ast::Function* MakeEmptyBodyFunction(std::string name) {
auto* body = create<ast::BlockStatement>();
body->append(create<ast::ReturnStatement>());
- return create<ast::Function>(name, ast::VariableList(), void_type(),
- std::move(body));
+ return create<ast::Function>(name, ast::VariableList(), void_type(), body);
}
/// Generates a function that calls another
@@ -93,12 +92,12 @@
std::string callee) {
auto* body = create<ast::BlockStatement>();
auto* ident_expr = create<ast::IdentifierExpression>(callee);
- auto* call_expr = create<ast::CallExpression>(std::move(ident_expr),
- ast::ExpressionList());
- body->append(create<ast::CallStatement>(std::move(call_expr)));
+ auto* call_expr =
+ create<ast::CallExpression>(ident_expr, ast::ExpressionList());
+ body->append(create<ast::CallStatement>(call_expr));
body->append(create<ast::ReturnStatement>());
return create<ast::Function>(caller, ast::VariableList(), void_type(),
- std::move(body));
+ body);
}
/// Add In/Out variables to the global variables
@@ -113,8 +112,8 @@
create<ast::Variable>(in, ast::StorageClass::kInput, u32_type());
auto* out_var =
create<ast::Variable>(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 @@
create<ast::IdentifierExpression>(in)));
}
body->append(create<ast::ReturnStatement>());
- return create<ast::Function>(name, ast::VariableList(), void_type(),
- std::move(body));
+ return create<ast::Function>(name, ast::VariableList(), void_type(), body);
}
/// Generates a function that references in/out variables and calls another
@@ -159,12 +157,12 @@
create<ast::IdentifierExpression>(in)));
}
auto* ident_expr = create<ast::IdentifierExpression>(callee);
- auto* call_expr = create<ast::CallExpression>(std::move(ident_expr),
- ast::ExpressionList());
- body->append(create<ast::CallStatement>(std::move(call_expr)));
+ auto* call_expr =
+ create<ast::CallExpression>(ident_expr, ast::ExpressionList());
+ body->append(create<ast::CallStatement>(call_expr));
body->append(create<ast::ReturnStatement>());
return create<ast::Function>(caller, ast::VariableList(), void_type(),
- std::move(body));
+ body);
}
/// Add a Constant ID to the global variables.
@@ -183,12 +181,12 @@
dvar->set_is_const(true);
ast::VariableDecorationList decos;
decos.push_back(create<ast::ConstantIdDecoration>(id, Source{}));
- dvar->set_decorations(std::move(decos));
+ dvar->set_decorations(decos);
if (val) {
dvar->set_constructor(
create<ast::ScalarConstructorExpression>(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 @@
create<ast::StructMemberOffsetDecoration>(offset, Source{}));
members.push_back(create<ast::StructMember>(
- StructMemberName(members.size(), type), type, std::move(deco)));
+ StructMemberName(members.size(), type), type, deco));
}
ast::StructDecorationList decos;
@@ -269,9 +267,9 @@
decos.push_back(create<ast::StructBlockDecoration>(Source{}));
}
- auto* str = create<ast::Struct>(std::move(decos), std::move(members));
+ auto* str = create<ast::Struct>(decos, members);
- return std::make_unique<ast::type::StructType>(name, std::move(str));
+ return std::make_unique<ast::type::StructType>(name, str);
}
/// Generates types appropriate for using in an uniform buffer
@@ -345,9 +343,9 @@
decorations.push_back(create<ast::BindingDecoration>(binding, Source{}));
decorations.push_back(create<ast::SetDecoration>(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 @@
body->append(create<ast::ReturnStatement>());
return create<ast::Function>(func_name, ast::VariableList(), void_type(),
- std::move(body));
+ body);
}
/// Adds a regular sampler variable to the module
@@ -514,23 +512,21 @@
auto* call_result = create<ast::Variable>(
"sampler_result", ast::StorageClass::kFunction, vec_type(base_type, 4));
- body->append(create<ast::VariableDeclStatement>(std::move(call_result)));
+ body->append(create<ast::VariableDeclStatement>(call_result));
ast::ExpressionList call_params;
call_params.push_back(create<ast::IdentifierExpression>(texture_name));
call_params.push_back(create<ast::IdentifierExpression>(sampler_name));
call_params.push_back(create<ast::IdentifierExpression>(coords_name));
auto* call_expr = create<ast::CallExpression>(
- create<ast::IdentifierExpression>("textureSample"),
- std::move(call_params));
+ create<ast::IdentifierExpression>("textureSample"), call_params);
body->append(create<ast::AssignmentStatement>(
- create<ast::IdentifierExpression>("sampler_result"),
- std::move(call_expr)));
+ create<ast::IdentifierExpression>("sampler_result"), call_expr));
body->append(create<ast::ReturnStatement>());
return create<ast::Function>(func_name, ast::VariableList(), void_type(),
- std::move(body));
+ body);
}
/// Generates a function that references a specific comparison sampler
@@ -554,7 +550,7 @@
auto* call_result = create<ast::Variable>(
"sampler_result", ast::StorageClass::kFunction, base_type);
- body->append(create<ast::VariableDeclStatement>(std::move(call_result)));
+ body->append(create<ast::VariableDeclStatement>(call_result));
ast::ExpressionList call_params;
call_params.push_back(create<ast::IdentifierExpression>(texture_name));
@@ -562,16 +558,14 @@
call_params.push_back(create<ast::IdentifierExpression>(coords_name));
call_params.push_back(create<ast::IdentifierExpression>(depth_name));
auto* call_expr = create<ast::CallExpression>(
- create<ast::IdentifierExpression>("textureSampleCompare"),
- std::move(call_params));
+ create<ast::IdentifierExpression>("textureSampleCompare"), call_params);
body->append(create<ast::AssignmentStatement>(
- create<ast::IdentifierExpression>("sampler_result"),
- std::move(call_expr)));
+ create<ast::IdentifierExpression>("sampler_result"), call_expr));
body->append(create<ast::ReturnStatement>());
return create<ast::Function>(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 @@
std::make_unique<ast::type::ArrayType>(u32_type(), count);
ast::ArrayDecorationList decos;
decos.push_back(create<ast::StrideDecoration>(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 @@
auto* foo = MakeEmptyBodyFunction("foo");
foo->add_decoration(
create<ast::StageDecoration>(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 @@
auto* foo = MakeEmptyBodyFunction("foo");
foo->add_decoration(
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}));
- mod()->AddFunction(std::move(foo));
+ mod()->AddFunction(foo);
auto* bar = MakeEmptyBodyFunction("bar");
bar->add_decoration(
create<ast::StageDecoration>(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, MixFunctionsAndEntryPoints) {
auto* func = MakeEmptyBodyFunction("func");
- mod()->AddFunction(std::move(func));
+ mod()->AddFunction(func);
auto* foo = MakeCallerBodyFunction("foo", "func");
foo->add_decoration(
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}));
- mod()->AddFunction(std::move(foo));
+ mod()->AddFunction(foo);
auto* bar = MakeCallerBodyFunction("bar", "func");
bar->add_decoration(
create<ast::StageDecoration>(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 @@
auto* foo = MakeCallerBodyFunction("foo", "func");
foo->add_decoration(
create<ast::StageDecoration>(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 @@
foo->add_decoration(
create<ast::StageDecoration>(ast::PipelineStage::kCompute, Source{}));
foo->add_decoration(create<ast::WorkgroupDecoration>(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, NoInOutVariables) {
auto* func = MakeEmptyBodyFunction("func");
- mod()->AddFunction(std::move(func));
+ mod()->AddFunction(func);
auto* foo = MakeCallerBodyFunction("foo", "func");
foo->add_decoration(
create<ast::StageDecoration>(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 @@
auto* foo = MakeInOutVariableBodyFunction("foo", {{"in_var", "out_var"}});
foo->add_decoration(
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}));
- mod()->AddFunction(std::move(foo));
+ mod()->AddFunction(foo);
ASSERT_TRUE(td()->Determine()) << td()->error();
@@ -863,12 +857,12 @@
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::StageDecoration>(ast::PipelineStage::kVertex, Source{}));
- mod()->AddFunction(std::move(foo));
+ mod()->AddFunction(foo);
ASSERT_TRUE(td()->Determine()) << td()->error();
@@ -887,13 +881,13 @@
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::StageDecoration>(ast::PipelineStage::kVertex, Source{}));
- mod()->AddFunction(std::move(foo));
+ mod()->AddFunction(foo);
ASSERT_TRUE(td()->Determine()) << td()->error();
@@ -915,7 +909,7 @@
"foo", {{"in_var", "out_var"}, {"in2_var", "out2_var"}});
foo->add_decoration(
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}));
- mod()->AddFunction(std::move(foo));
+ mod()->AddFunction(foo);
ASSERT_TRUE(td()->Determine()) << td()->error();
@@ -937,12 +931,12 @@
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::StageDecoration>(ast::PipelineStage::kVertex, Source{}));
- mod()->AddFunction(std::move(foo));
+ mod()->AddFunction(foo);
ASSERT_TRUE(td()->Determine()) << td()->error();
@@ -965,12 +959,12 @@
auto* foo = MakeInOutVariableBodyFunction("foo", {{"in_var", "out2_var"}});
foo->add_decoration(
create<ast::StageDecoration>(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::StageDecoration>(ast::PipelineStage::kCompute, Source{}));
- mod()->AddFunction(std::move(bar));
+ mod()->AddFunction(bar);
ASSERT_TRUE(td()->Determine()) << td()->error();
@@ -998,18 +992,18 @@
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::StageDecoration>(ast::PipelineStage::kVertex, Source{}));
- mod()->AddFunction(std::move(foo));
+ mod()->AddFunction(foo);
auto* bar = MakeCallerBodyFunction("bar", "func");
bar->add_decoration(
create<ast::StageDecoration>(ast::PipelineStage::kCompute, Source{}));
- mod()->AddFunction(std::move(bar));
+ mod()->AddFunction(bar);
ASSERT_TRUE(td()->Determine()) << td()->error();
@@ -1061,7 +1055,7 @@
auto* foo = MakeEmptyBodyFunction("foo");
foo->add_decoration(
create<ast::StageDecoration>(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 @@
auto* foo = MakeEmptyBodyFunction("foo");
foo->add_decoration(
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}));
- mod()->AddFunction(std::move(foo));
+ mod()->AddFunction(foo);
auto* bar = MakeEmptyBodyFunction("bar");
bar->add_decoration(
create<ast::StageDecoration>(ast::PipelineStage::kCompute, Source{}));
- mod()->AddFunction(std::move(bar));
+ mod()->AddFunction(bar);
{
auto result = inspector()->GetRemappedNameForEntryPoint("foo");
@@ -1199,12 +1193,12 @@
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::StageDecoration>(ast::PipelineStage::kVertex, Source{}));
- mod()->AddFunction(std::move(ep_func));
+ mod()->AddFunction(ep_func);
ASSERT_TRUE(td()->Determine()) << td()->error();
@@ -1218,26 +1212,24 @@
ast::StructMemberDecorationList deco;
deco.push_back(create<ast::StructMemberOffsetDecoration>(0, Source{}));
- members.push_back(
- create<ast::StructMember>(StructMemberName(members.size(), i32_type()),
- i32_type(), std::move(deco)));
+ members.push_back(create<ast::StructMember>(
+ StructMemberName(members.size(), i32_type()), i32_type(), deco));
ast::StructDecorationList decos;
- auto* str = create<ast::Struct>(std::move(decos), std::move(members));
- auto foo_type =
- std::make_unique<ast::type::StructType>("foo_type", std::move(str));
+ auto* str = create<ast::Struct>(decos, members);
+ auto foo_type = std::make_unique<ast::type::StructType>("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::StageDecoration>(ast::PipelineStage::kVertex, Source{}));
- mod()->AddFunction(std::move(ep_func));
+ mod()->AddFunction(ep_func);
ASSERT_TRUE(td()->Determine()) << td()->error();
@@ -1255,12 +1247,12 @@
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::StageDecoration>(ast::PipelineStage::kVertex, Source{}));
- mod()->AddFunction(std::move(ep_func));
+ mod()->AddFunction(ep_func);
ASSERT_TRUE(td()->Determine()) << td()->error();
@@ -1282,12 +1274,12 @@
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::StageDecoration>(ast::PipelineStage::kVertex, Source{}));
- mod()->AddFunction(std::move(ep_func));
+ mod()->AddFunction(ep_func);
ASSERT_TRUE(td()->Determine()) << td()->error();
@@ -1314,7 +1306,7 @@
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 @@
auto AddFuncCall = [&](ast::BlockStatement* body, const std::string& callee) {
auto* ident_expr = create<ast::IdentifierExpression>(callee);
- auto* call_expr = create<ast::CallExpression>(std::move(ident_expr),
- ast::ExpressionList());
- body->append(create<ast::CallStatement>(std::move(call_expr)));
+ auto* call_expr =
+ create<ast::CallExpression>(ident_expr, ast::ExpressionList());
+ body->append(create<ast::CallStatement>(call_expr));
};
auto* body = create<ast::BlockStatement>();
@@ -1333,12 +1325,12 @@
AddFuncCall(body, "ub_baz_func");
body->append(create<ast::ReturnStatement>());
- ast::Function* func = create<ast::Function>("ep_func", ast::VariableList(),
- void_type(), std::move(body));
+ ast::Function* func =
+ create<ast::Function>("ep_func", ast::VariableList(), void_type(), body);
func->add_decoration(
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}));
- mod()->AddFunction(std::move(func));
+ mod()->AddFunction(func);
ASSERT_TRUE(td()->Determine()) << td()->error();
@@ -1368,12 +1360,12 @@
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::StageDecoration>(ast::PipelineStage::kVertex, Source{}));
- mod()->AddFunction(std::move(ep_func));
+ mod()->AddFunction(ep_func);
ASSERT_TRUE(td()->Determine()) << td()->error();
@@ -1395,12 +1387,12 @@
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::StageDecoration>(ast::PipelineStage::kVertex, Source{}));
- mod()->AddFunction(std::move(ep_func));
+ mod()->AddFunction(ep_func);
ASSERT_TRUE(td()->Determine()) << td()->error();
@@ -1422,12 +1414,12 @@
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::StageDecoration>(ast::PipelineStage::kVertex, Source{}));
- mod()->AddFunction(std::move(ep_func));
+ mod()->AddFunction(ep_func);
ASSERT_TRUE(td()->Determine()) << td()->error();
@@ -1454,7 +1446,7 @@
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 @@
auto AddFuncCall = [&](ast::BlockStatement* body, const std::string& callee) {
auto* ident_expr = create<ast::IdentifierExpression>(callee);
- auto* call_expr = create<ast::CallExpression>(std::move(ident_expr),
- ast::ExpressionList());
- body->append(create<ast::CallStatement>(std::move(call_expr)));
+ auto* call_expr =
+ create<ast::CallExpression>(ident_expr, ast::ExpressionList());
+ body->append(create<ast::CallStatement>(call_expr));
};
auto* body = create<ast::BlockStatement>();
@@ -1473,12 +1465,12 @@
AddFuncCall(body, "sb_baz_func");
body->append(create<ast::ReturnStatement>());
- ast::Function* func = create<ast::Function>("ep_func", ast::VariableList(),
- void_type(), std::move(body));
+ ast::Function* func =
+ create<ast::Function>("ep_func", ast::VariableList(), void_type(), body);
func->add_decoration(
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}));
- mod()->AddFunction(std::move(func));
+ mod()->AddFunction(func);
ASSERT_TRUE(td()->Determine()) << td()->error();
@@ -1508,12 +1500,12 @@
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::StageDecoration>(ast::PipelineStage::kVertex, Source{}));
- mod()->AddFunction(std::move(ep_func));
+ mod()->AddFunction(ep_func);
ASSERT_TRUE(td()->Determine()) << td()->error();
@@ -1535,12 +1527,12 @@
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::StageDecoration>(ast::PipelineStage::kVertex, Source{}));
- mod()->AddFunction(std::move(ep_func));
+ mod()->AddFunction(ep_func);
ASSERT_TRUE(td()->Determine()) << td()->error();
@@ -1562,12 +1554,12 @@
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::StageDecoration>(ast::PipelineStage::kVertex, Source{}));
- mod()->AddFunction(std::move(ep_func));
+ mod()->AddFunction(ep_func);
ASSERT_TRUE(td()->Determine()) << td()->error();
@@ -1585,12 +1577,12 @@
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::StageDecoration>(ast::PipelineStage::kVertex, Source{}));
- mod()->AddFunction(std::move(ep_func));
+ mod()->AddFunction(ep_func);
ASSERT_TRUE(td()->Determine()) << td()->error();
@@ -1619,7 +1611,7 @@
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 @@
auto AddFuncCall = [&](ast::BlockStatement* body, const std::string& callee) {
auto* ident_expr = create<ast::IdentifierExpression>(callee);
- auto* call_expr = create<ast::CallExpression>(std::move(ident_expr),
- ast::ExpressionList());
- body->append(create<ast::CallStatement>(std::move(call_expr)));
+ auto* call_expr =
+ create<ast::CallExpression>(ident_expr, ast::ExpressionList());
+ body->append(create<ast::CallStatement>(call_expr));
};
auto* body = create<ast::BlockStatement>();
@@ -1638,12 +1630,12 @@
AddFuncCall(body, "sb_baz_func");
body->append(create<ast::ReturnStatement>());
- ast::Function* func = create<ast::Function>("ep_func", ast::VariableList(),
- void_type(), std::move(body));
+ ast::Function* func =
+ create<ast::Function>("ep_func", ast::VariableList(), void_type(), body);
func->add_decoration(
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}));
- mod()->AddFunction(std::move(func));
+ mod()->AddFunction(func);
ASSERT_TRUE(td()->Determine()) << td()->error();
@@ -1674,12 +1666,12 @@
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::StageDecoration>(ast::PipelineStage::kVertex, Source{}));
- mod()->AddFunction(std::move(ep_func));
+ mod()->AddFunction(ep_func);
ASSERT_TRUE(td()->Determine()) << td()->error();
@@ -1703,12 +1695,12 @@
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::StageDecoration>(ast::PipelineStage::kVertex, Source{}));
- mod()->AddFunction(std::move(ep_func));
+ mod()->AddFunction(ep_func);
ASSERT_TRUE(td()->Determine()) << td()->error();
@@ -1731,12 +1723,12 @@
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::StageDecoration>(ast::PipelineStage::kVertex, Source{}));
- mod()->AddFunction(std::move(ep_func));
+ mod()->AddFunction(ep_func);
ASSERT_TRUE(td()->Determine()) << td()->error();
@@ -1757,7 +1749,7 @@
"ep", "foo_texture", "foo_sampler", "foo_coords", f32_type());
func->add_decoration(
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}));
- mod()->AddFunction(std::move(func));
+ mod()->AddFunction(func);
ASSERT_TRUE(td()->Determine()) << td()->error();
@@ -1773,7 +1765,7 @@
auto* func = MakeEmptyBodyFunction("ep_func");
func->add_decoration(
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}));
- mod()->AddFunction(std::move(func));
+ mod()->AddFunction(func);
ASSERT_TRUE(td()->Determine()) << td()->error();
@@ -1792,12 +1784,12 @@
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::StageDecoration>(ast::PipelineStage::kVertex, Source{}));
- mod()->AddFunction(std::move(ep_func));
+ mod()->AddFunction(ep_func);
ASSERT_TRUE(td()->Determine()) << td()->error();
@@ -1820,7 +1812,7 @@
"ep", "foo_texture", "foo_sampler", "foo_coords", f32_type());
func->add_decoration(
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}));
- mod()->AddFunction(std::move(func));
+ mod()->AddFunction(func);
ASSERT_TRUE(td()->Determine()) << td()->error();
@@ -1841,7 +1833,7 @@
f32_type());
func->add_decoration(
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}));
- mod()->AddFunction(std::move(func));
+ mod()->AddFunction(func);
ASSERT_TRUE(td()->Determine()) << td()->error();
@@ -1864,7 +1856,7 @@
f32_type());
func->add_decoration(
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}));
- mod()->AddFunction(std::move(func));
+ mod()->AddFunction(func);
ASSERT_TRUE(td()->Determine()) << td()->error();
@@ -1880,7 +1872,7 @@
auto* func = MakeEmptyBodyFunction("ep_func");
func->add_decoration(
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}));
- mod()->AddFunction(std::move(func));
+ mod()->AddFunction(func);
ASSERT_TRUE(td()->Determine()) << td()->error();
@@ -1901,12 +1893,12 @@
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::StageDecoration>(ast::PipelineStage::kVertex, Source{}));
- mod()->AddFunction(std::move(ep_func));
+ mod()->AddFunction(ep_func);
ASSERT_TRUE(td()->Determine()) << td()->error();
@@ -1931,7 +1923,7 @@
f32_type());
func->add_decoration(
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}));
- mod()->AddFunction(std::move(func));
+ mod()->AddFunction(func);
ASSERT_TRUE(td()->Determine()) << td()->error();
@@ -1950,7 +1942,7 @@
"ep", "foo_texture", "foo_sampler", "foo_coords", f32_type());
func->add_decoration(
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}));
- mod()->AddFunction(std::move(func));
+ mod()->AddFunction(func);
ASSERT_TRUE(td()->Determine()) << td()->error();
@@ -1964,7 +1956,7 @@
auto* foo = MakeEmptyBodyFunction("foo");
foo->add_decoration(
create<ast::StageDecoration>(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 @@
GetBaseType(GetParam().sampled_kind));
func->add_decoration(
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}));
- mod()->AddFunction(std::move(func));
+ mod()->AddFunction(func);
ASSERT_TRUE(td()->Determine()) << td()->error();
@@ -2093,7 +2085,7 @@
auto* foo = MakeEmptyBodyFunction("foo");
foo->add_decoration(
create<ast::StageDecoration>(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 @@
GetBaseType(GetParam().sampled_kind));
func->add_decoration(
create<ast::StageDecoration>(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 ebdca70..51010cb 100644
--- a/src/reader/spirv/function.cc
+++ b/src/reader/spirv/function.cc
@@ -517,11 +517,10 @@
auto* cond = create<ast::IdentifierExpression>(guard_name);
auto* body = create<ast::BlockStatement>();
auto* const guard_stmt =
- AddStatement(create<ast::IfStatement>(std::move(cond), std::move(body)))
- ->AsIf();
+ AddStatement(create<ast::IfStatement>(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 @@
auto* cond = MakeTrue();
auto* body = create<ast::BlockStatement>();
auto* const guard_stmt =
- AddStatement(create<ast::IfStatement>(std::move(cond), std::move(body)))
- ->AsIf();
+ AddStatement(create<ast::IfStatement>(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 @@
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::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 @@
"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 @@
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 @@
create<ast::StageDecoration>(ep_info_->stage, Source{}));
}
- ast_module_.AddFunction(std::move(ast_fn));
+ ast_module_.AddFunction(ast_fn);
return success();
}
@@ -1704,8 +1702,8 @@
parser_impl_.MakeConstantExpression(inst.GetSingleWordInOperand(1))
.expr);
}
- auto* var_decl_stmt = create<ast::VariableDeclStatement>(std::move(var));
- AddStatementForInstruction(std::move(var_decl_stmt), inst);
+ auto* var_decl_stmt = create<ast::VariableDeclStatement>(var);
+ AddStatementForInstruction(var_decl_stmt, inst);
// Save this as an already-named value.
identifier_values_.insert(inst.result_id());
}
@@ -1972,8 +1970,8 @@
auto* guard_var = create<ast::Variable>(
guard_name, ast::StorageClass::kFunction, parser_impl_.BoolType());
guard_var->set_constructor(MakeTrue());
- auto* guard_decl = create<ast::VariableDeclStatement>(std::move(guard_var));
- AddStatement(std::move(guard_decl));
+ auto* guard_decl = create<ast::VariableDeclStatement>(guard_var);
+ AddStatement(guard_decl);
}
const auto condition_id =
@@ -1981,8 +1979,7 @@
auto* cond = MakeExpression(condition_id).expr;
auto* body = create<ast::BlockStatement>();
auto* const if_stmt =
- AddStatement(create<ast::IfStatement>(std::move(cond), std::move(body)))
- ->AsIf();
+ AddStatement(create<ast::IfStatement>(cond, body))->AsIf();
// Generate the code for the condition.
@@ -2029,7 +2026,7 @@
// 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 @@
// statments stack, without an elseif condition.
ast::ElseStatementList else_stmts;
else_stmts.emplace_back(
- create<ast::ElseStatement>(nullptr, std::move(s->statements_)));
- if_stmt->set_else_statements(std::move(else_stmts));
+ create<ast::ElseStatement>(nullptr, s->statements_));
+ if_stmt->set_else_statements(else_stmts);
}
});
};
@@ -2099,7 +2096,7 @@
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 @@
create<ast::SintLiteral>(selector.type, value32));
}
}
- clause->set_selectors(std::move(selectors));
+ clause->set_selectors(selectors);
}
// Where does this clause end?
@@ -2185,7 +2182,7 @@
: 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 @@
// Generate a default clause with a just fallthrough.
auto* stmts = create<ast::BlockStatement>();
stmts->append(create<ast::FallthroughStatement>());
- auto* case_stmt = create<ast::CaseStatement>(std::move(stmts));
- cases->emplace_back(std::move(case_stmt));
+ auto* case_stmt = create<ast::CaseStatement>(stmts);
+ cases->emplace_back(case_stmt);
}
if (i == 0) {
@@ -2216,7 +2213,7 @@
->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 @@
"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 @@
return true;
case SpvOpReturnValue: {
auto value = MakeExpression(terminator.GetSingleWordInOperand(0));
- AddStatement(create<ast::ReturnStatement>(std::move(value.expr)));
+ AddStatement(create<ast::ReturnStatement>(value.expr));
}
return true;
case SpvOpKill:
@@ -2296,11 +2292,11 @@
// 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 @@
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 @@
if ((then_stmt == nullptr) && (else_stmt == nullptr)) {
return nullptr;
}
- auto* if_stmt = create<ast::IfStatement>(std::move(condition),
- create<ast::BlockStatement>());
+ auto* if_stmt =
+ create<ast::IfStatement>(condition, create<ast::BlockStatement>());
if (then_stmt != nullptr) {
auto* stmts = create<ast::BlockStatement>();
- 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<ast::BlockStatement>();
- stmts->append(std::move(else_stmt));
+ stmts->append(else_stmt);
ast::ElseStatementList else_stmts;
- else_stmts.emplace_back(
- create<ast::ElseStatement>(nullptr, std::move(stmts)));
- if_stmt->set_else_statements(std::move(else_stmts));
+ else_stmts.emplace_back(create<ast::ElseStatement>(nullptr, stmts));
+ if_stmt->set_else_statements(else_stmts);
}
return if_stmt;
}
@@ -2466,11 +2460,9 @@
<< 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<ast::FallthroughStatement>());
@@ -2513,7 +2505,7 @@
auto* var =
create<ast::Variable>(phi_var_name, ast::StorageClass::kFunction,
parser_impl_.ConvertType(def_inst->type_id()));
- AddStatement(create<ast::VariableDeclStatement>(std::move(var)));
+ AddStatement(create<ast::VariableDeclStatement>(var));
}
// Emit regular statements.
@@ -2544,7 +2536,7 @@
const auto var_name = GetDefInfo(assignment.phi_id)->phi_var;
auto expr = MakeExpression(assignment.value);
AddStatement(create<ast::AssignmentStatement>(
- create<ast::IdentifierExpression>(var_name), std::move(expr.expr)));
+ create<ast::IdentifierExpression>(var_name), expr.expr));
}
}
@@ -2563,10 +2555,10 @@
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<ast::VariableDeclStatement>(std::move(ast_const)), inst);
+ AddStatementForInstruction(create<ast::VariableDeclStatement>(ast_const),
+ inst);
// Save this as an already-named value.
identifier_values_.insert(inst.result_id());
return success();
@@ -2582,11 +2574,11 @@
AddStatementForInstruction(
create<ast::AssignmentStatement>(
create<ast::IdentifierExpression>(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 @@
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 @@
// TODO(dneto): Order of evaluation?
auto lhs = MakeExpression(ptr_id);
auto rhs = MakeExpression(value_id);
- AddStatementForInstruction(create<ast::AssignmentStatement>(
- std::move(lhs.expr), std::move(rhs.expr)),
- inst);
+ AddStatementForInstruction(
+ create<ast::AssignmentStatement>(lhs.expr, rhs.expr), inst);
return success();
}
case SpvOpLoad: {
@@ -2658,7 +2647,7 @@
// 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 @@
// 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<ast::IdentifierExpression>(def_info->phi_var)};
- return EmitConstDefOrWriteToHoistedVar(inst, std::move(expr));
+ return EmitConstDefOrWriteToHoistedVar(inst, expr);
}
case SpvOpFunctionCall:
return EmitFunctionCall(inst);
@@ -2706,21 +2695,18 @@
if (binary_op != ast::BinaryOp::kNone) {
auto arg0 = MakeOperand(inst, 0);
auto arg1 = MakeOperand(inst, 1);
- auto* binary_expr = create<ast::BinaryExpression>(
- 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<ast::BinaryExpression>(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<ast::UnaryOpExpression>(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<ast::UnaryOpExpression>(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 @@
if (negated_op != ast::BinaryOp::kNone) {
auto arg0 = MakeOperand(inst, 0);
auto arg1 = MakeOperand(inst, 1);
- auto* binary_expr = create<ast::BinaryExpression>(
- negated_op, std::move(arg0.expr), std::move(arg1.expr));
- auto* negated_expr = create<ast::UnaryOpExpression>(ast::UnaryOp::kNot,
- std::move(binary_expr));
- return {ast_type, std::move(negated_expr)};
+ auto* binary_expr =
+ create<ast::BinaryExpression>(negated_op, arg0.expr, arg1.expr);
+ auto* negated_expr =
+ create<ast::UnaryOpExpression>(ast::UnaryOp::kNot, binary_expr);
+ return {ast_type, negated_expr};
}
if (opcode == SpvOpExtInst) {
@@ -2836,9 +2822,8 @@
operands.emplace_back(MakeOperand(inst, iarg).expr);
}
auto* ast_type = parser_impl_.ConvertType(inst.type_id());
- auto* call =
- create<ast::CallExpression>(std::move(func), std::move(operands));
- return {ast_type, std::move(call)};
+ auto* call = create<ast::CallExpression>(func, std::move(operands));
+ return {ast_type, call};
}
TypedExpression FunctionEmitter::MakeAccessChain(
@@ -2956,13 +2941,12 @@
}
auto* letter_index =
create<ast::IdentifierExpression>(swizzles[index_const_val]);
- next_expr = create<ast::MemberAccessorExpression>(
- std::move(current_expr.expr), std::move(letter_index));
+ next_expr = create<ast::MemberAccessorExpression>(current_expr.expr,
+ letter_index);
} else {
// Non-constant index. Use array syntax
next_expr = create<ast::ArrayAccessorExpression>(
- 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 @@
case SpvOpTypeMatrix:
// Use array syntax.
next_expr = create<ast::ArrayAccessorExpression>(
- 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<ast::ArrayAccessorExpression>(
- 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<ast::ArrayAccessorExpression>(
- 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 @@
auto* member_access = create<ast::IdentifierExpression>(
namer_.GetMemberName(pointee_type_id, uint32_t(index_const_val)));
- next_expr = create<ast::MemberAccessorExpression>(
- std::move(current_expr.expr), std::move(member_access));
+ next_expr = create<ast::MemberAccessorExpression>(current_expr.expr,
+ member_access);
pointee_type_id = pointee_type_inst->GetSingleWordInOperand(
static_cast<uint32_t>(index_const_val));
break;
@@ -3021,7 +3002,7 @@
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 @@
}
auto* letter_index =
create<ast::IdentifierExpression>(swizzles[index_val]);
- next_expr = create<ast::MemberAccessorExpression>(
- std::move(current_expr.expr), std::move(letter_index));
+ next_expr = create<ast::MemberAccessorExpression>(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 @@
<< ((sizeof(swizzles) / sizeof(swizzles[0])) - 1);
}
// Use array syntax.
- next_expr = create<ast::ArrayAccessorExpression>(
- std::move(current_expr.expr), make_index(index_val));
+ next_expr = create<ast::ArrayAccessorExpression>(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 @@
// 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<ast::ArrayAccessorExpression>(
- std::move(current_expr.expr), make_index(index_val));
+ next_expr = create<ast::ArrayAccessorExpression>(current_expr.expr,
+ make_index(index_val));
current_type_id = current_type_inst->GetSingleWordInOperand(0);
break;
case SpvOpTypeRuntimeArray:
@@ -3129,8 +3110,8 @@
auto* member_access = create<ast::IdentifierExpression>(
namer_.GetMemberName(current_type_id, uint32_t(index_val)));
- next_expr = create<ast::MemberAccessorExpression>(
- std::move(current_expr.expr), std::move(member_access));
+ next_expr = create<ast::MemberAccessorExpression>(current_expr.expr,
+ member_access);
current_type_id = current_type_inst->GetSingleWordInOperand(index_val);
break;
}
@@ -3139,8 +3120,8 @@
<< 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 @@
return {};
}
}
- return {result_type, create<ast::TypeConstructorExpression>(
- result_type, std::move(values))};
+ return {result_type,
+ create<ast::TypeConstructorExpression>(result_type, values)};
}
bool FunctionEmitter::RegisterLocallyDefinedValues() {
@@ -3487,15 +3468,15 @@
}
ast::ExpressionList params;
- params.push_back(std::move(arg_expr.expr));
+ params.push_back(arg_expr.expr);
TypedExpression result{expr_type, create<ast::TypeConstructorExpression>(
expr_type, std::move(params))};
if (requested_type == expr_type) {
return result;
}
- return {requested_type, create<ast::BitcastExpression>(
- requested_type, std::move(result.expr))};
+ return {requested_type,
+ create<ast::BitcastExpression>(requested_type, result.expr)};
}
bool FunctionEmitter::EmitFunctionCall(const spvtools::opt::Instruction& inst) {
@@ -3507,8 +3488,7 @@
for (uint32_t iarg = 1; iarg < inst.NumInOperands(); ++iarg) {
params.emplace_back(MakeOperand(inst, iarg).expr);
}
- auto* call_expr =
- create<ast::CallExpression>(std::move(function), std::move(params));
+ auto* call_expr = create<ast::CallExpression>(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 @@
}
if (result_type->IsVoid()) {
- return nullptr !=
- AddStatementForInstruction(
- create<ast::CallStatement>(std::move(call_expr)), inst);
+ return nullptr != AddStatementForInstruction(
+ create<ast::CallStatement>(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 @@
for (uint32_t iarg = 0; iarg < inst.NumInOperands(); ++iarg) {
params.emplace_back(MakeOperand(inst, iarg).expr);
}
- auto* call_expr =
- create<ast::CallExpression>(std::move(ident), std::move(params));
+ auto* call_expr = create<ast::CallExpression>(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 @@
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<ast::CallExpression>(
create<ast::IdentifierExpression>("select"),
std::move(params))};
diff --git a/src/reader/spirv/parser_impl.cc b/src/reader/spirv/parser_impl.cc
index 6677bb8..7cc274d 100644
--- a/src/reader/spirv/parser_impl.cc
+++ b/src/reader/spirv/parser_impl.cc
@@ -851,7 +851,7 @@
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 @@
const auto member_name = namer_.GetMemberName(type_id, member_index);
auto* ast_struct_member = create<ast::StructMember>(
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 @@
namer_.SuggestSanitizedName(type_id, "S");
auto ast_struct_type = std::make_unique<ast::type::StructType>(
- 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 @@
for (const auto& deco : GetDecorationsFor(inst.result_id())) {
if ((deco.size() == 2) && (deco[0] == SpvDecorationSpecId)) {
auto* cid = create<ast::ConstantIdDecoration>(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<ast::DecoratedVariable>(std::move(ast_var));
+ auto* ast_deco_var = create<ast::DecoratedVariable>(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 @@
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 @@
create<ast::BuiltinDecoration>(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 @@
}
}
if (!ast_decorations.empty()) {
- auto* decorated_var = create<ast::DecoratedVariable>(std::move(ast_var));
+ auto* decorated_var = create<ast::DecoratedVariable>(ast_var);
decorated_var->set_decorations(std::move(ast_decorations));
ast_var = std::move(decorated_var);
}
@@ -1284,7 +1284,7 @@
// 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<ast::TypeConstructorExpression>(original_ast_type,
@@ -1394,15 +1394,14 @@
auto* unsigned_ty = unsigned_type_for_[type];
if (unsigned_ty != nullptr) {
// Conversion is required.
- return {unsigned_ty, create<ast::BitcastExpression>(
- unsigned_ty, std::move(expr.expr))};
+ return {unsigned_ty,
+ create<ast::BitcastExpression>(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<ast::BitcastExpression>(signed_ty, std::move(expr.expr))};
+ return {signed_ty, create<ast::BitcastExpression>(signed_ty, expr.expr)};
}
}
// We should not reach here.
@@ -1465,8 +1464,7 @@
if ((forced_result_ty == nullptr) || (forced_result_ty == expr.type)) {
return expr;
}
- return {expr.type,
- create<ast::BitcastExpression>(expr.type, std::move(expr.expr))};
+ return {expr.type, create<ast::BitcastExpression>(expr.type, expr.expr)};
}
bool ParserImpl::EmitFunctions() {
diff --git a/src/reader/wgsl/parser_impl.cc b/src/reader/wgsl/parser_impl.cc
index 50a1764..40b37e5 100644
--- a/src/reader/wgsl/parser_impl.cc
+++ b/src/reader/wgsl/parser_impl.cc
@@ -268,7 +268,7 @@
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 @@
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 @@
if (func.errored)
errored = true;
if (func.matched) {
- module_.AddFunction(std::move(func.value));
+ module_.AddFunction(func.value);
return true;
}
@@ -348,23 +348,23 @@
if (!decl.matched)
return Failure::kNoMatch;
- auto* var = std::move(decl.value);
+ auto* var = decl.value;
auto var_decos = cast_decorations<ast::VariableDecoration>(decos);
if (var_decos.errored)
return Failure::kErrored;
if (var_decos.value.size() > 0) {
- auto* dv = create<ast::DecoratedVariable>(std::move(var));
- dv->set_decorations(std::move(var_decos.value));
- var = std::move(dv);
+ auto* dv = create<ast::DecoratedVariable>(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 @@
if (init.errored)
return Failure::kErrored;
- var->set_constructor(std::move(init.value));
+ var->set_constructor(init.value);
return var;
}
@@ -1113,7 +1113,7 @@
if (member.errored) {
errored = true;
} else {
- members.push_back(std::move(member.value));
+ members.push_back(member.value);
}
}
@@ -1177,8 +1177,8 @@
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 @@
// 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 @@
if (!expr.matched)
return add_error(peek(), "unable to parse expression");
- return std::move(expr.value);
+ return expr.value;
});
}
@@ -1326,7 +1326,7 @@
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 @@
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 @@
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 @@
return Failure::kErrored;
// TODO(bclayton): Check matched?
- return create<ast::ReturnStatement>(source, std::move(expr.value));
+ return create<ast::ReturnStatement>(source, expr.value);
}
// variable_stmt
@@ -1500,9 +1500,9 @@
auto* var = create<ast::Variable>(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<ast::VariableDeclStatement>(decl->source, std::move(var));
+ return create<ast::VariableDeclStatement>(decl->source, var);
}
auto var = variable_decl();
@@ -1518,11 +1518,10 @@
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<ast::VariableDeclStatement>(var->source(),
- std::move(var.value));
+ return create<ast::VariableDeclStatement>(var->source(), var.value);
}
// if_stmt
@@ -1548,12 +1547,11 @@
if (el.errored)
return Failure::kErrored;
- auto* stmt = create<ast::IfStatement>(source, std::move(condition.value),
- std::move(body.value));
+ auto* stmt = create<ast::IfStatement>(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 @@
if (body.errored)
return Failure::kErrored;
- ret.push_back(create<ast::ElseStatement>(source, std::move(condition.value),
- std::move(body.value)));
+ ret.push_back(
+ create<ast::ElseStatement>(source, condition.value, body.value));
if (!match(Token::Type::kElseIf, &source))
break;
@@ -1596,7 +1594,7 @@
if (body.errored)
return Failure::kErrored;
- return create<ast::ElseStatement>(source, std::move(body.value));
+ return create<ast::ElseStatement>(source, body.value);
}
// switch_stmt
@@ -1622,7 +1620,7 @@
}
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 @@
if (body.errored)
return Failure::kErrored;
- return create<ast::SwitchStatement>(source, std::move(condition.value),
- std::move(body.value));
+ return create<ast::SwitchStatement>(source, condition.value, body.value);
}
// switch_body
@@ -1669,7 +1666,7 @@
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 @@
if (!stmt.matched)
break;
- ret->append(std::move(stmt.value));
+ ret->append(stmt.value);
}
return ret;
@@ -1742,17 +1739,14 @@
if (continuing.errored)
return Failure::kErrored;
- return create<ast::LoopStatement>(source, std::move(body.value),
- std::move(continuing.value));
+ return create<ast::LoopStatement>(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 @@
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 @@
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 @@
if (continuing.errored)
return Failure::kErrored;
- return std::make_unique<ForHeader>(std::move(initializer.value),
- std::move(condition.value),
- std::move(continuing.value));
+ return std::make_unique<ForHeader>(initializer.value, condition.value,
+ continuing.value);
}
// for_statement
@@ -1848,32 +1841,29 @@
if (header->condition != nullptr) {
// !condition
auto* not_condition = create<ast::UnaryOpExpression>(
- header->condition->source(), ast::UnaryOp::kNot,
- std::move(header->condition));
+ header->condition->source(), ast::UnaryOp::kNot, header->condition);
// { break; }
auto* break_stmt = create<ast::BreakStatement>(not_condition->source());
auto* break_body = create<ast::BlockStatement>(not_condition->source());
- break_body->append(std::move(break_stmt));
+ break_body->append(break_stmt);
// if (!condition) { break; }
auto* break_if_not_condition = create<ast::IfStatement>(
- 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<ast::BlockStatement>(header->continuing->source());
- continuing_body->append(std::move(header->continuing));
+ continuing_body->append(header->continuing);
}
- auto* loop = create<ast::LoopStatement>(source, std::move(body.value),
- std::move(continuing_body));
+ auto* loop = create<ast::LoopStatement>(source, body.value, continuing_body);
if (header->initializer != nullptr) {
auto* result = create<ast::BlockStatement>(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 @@
if (lit.errored)
return Failure::kErrored;
if (lit.matched)
- return create<ast::ScalarConstructorExpression>(source,
- std::move(lit.value));
+ return create<ast::ScalarConstructorExpression>(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 @@
if (params.errored)
return Failure::kErrored;
- return create<ast::BitcastExpression>(source, type.value,
- std::move(params.value));
+ return create<ast::BitcastExpression>(source, type.value, params.value);
}
if (match(Token::Type::kIdentifier))
@@ -1999,14 +1987,14 @@
if (params.errored)
return Failure::kErrored;
- return create<ast::TypeConstructorExpression>(
- source, type.value, std::move(params.value));
+ return create<ast::TypeConstructorExpression>(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 @@
if (!expect("array accessor", Token::Type::kBracketRight))
return Failure::kErrored;
- return postfix_expr(create<ast::ArrayAccessorExpression>(
- source, std::move(prefix), std::move(param.value)));
+ return postfix_expr(
+ create<ast::ArrayAccessorExpression>(source, prefix, param.value));
}
if (match(Token::Type::kParenLeft, &source)) {
@@ -2041,14 +2029,13 @@
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<ast::CallExpression>(source, std::move(prefix),
- std::move(params)));
+ return postfix_expr(create<ast::CallExpression>(source, prefix, params));
}
if (match(Token::Type::kPeriod)) {
@@ -2057,7 +2044,7 @@
return Failure::kErrored;
return postfix_expr(create<ast::MemberAccessorExpression>(
- ident.source, std::move(prefix),
+ ident.source, prefix,
create<ast::IdentifierExpression>(ident.source, ident.value)));
}
@@ -2073,7 +2060,7 @@
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 @@
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 @@
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 @@
return add_error(peek(),
"unable to parse right side of " + name + " expression");
- return create<ast::UnaryOpExpression>(source, op, std::move(expr.value));
+ return create<ast::UnaryOpExpression>(source, op, expr.value);
}
return postfix_expression();
}
@@ -2160,8 +2147,8 @@
"unable to parse right side of " + name + " expression");
}
- return expect_multiplicative_expr(create<ast::BinaryExpression>(
- source, op, std::move(lhs), std::move(rhs.value)));
+ return expect_multiplicative_expr(
+ create<ast::BinaryExpression>(source, op, lhs, rhs.value));
}
// multiplicative_expression
@@ -2173,7 +2160,7 @@
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 @@
if (!rhs.matched)
return add_error(peek(), "unable to parse right side of + expression");
- return expect_additive_expr(create<ast::BinaryExpression>(
- source, op, std::move(lhs), std::move(rhs.value)));
+ return expect_additive_expr(
+ create<ast::BinaryExpression>(source, op, lhs, rhs.value));
}
// additive_expression
@@ -2214,7 +2201,7 @@
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 @@
return add_error(peek(), std::string("unable to parse right side of ") +
name + " expression");
}
- return expect_shift_expr(create<ast::BinaryExpression>(
- source, op, std::move(lhs), std::move(rhs.value)));
+ return expect_shift_expr(
+ create<ast::BinaryExpression>(source, op, lhs, rhs.value));
} // namespace wgsl
// shift_expression
@@ -2262,7 +2249,7 @@
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 @@
"unable to parse right side of " + name + " expression");
}
- return expect_relational_expr(create<ast::BinaryExpression>(
- source, op, std::move(lhs), std::move(rhs.value)));
+ return expect_relational_expr(
+ create<ast::BinaryExpression>(source, op, lhs, rhs.value));
}
// relational_expression
@@ -2311,7 +2298,7 @@
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 @@
"unable to parse right side of " + name + " expression");
}
- return expect_equality_expr(create<ast::BinaryExpression>(
- source, op, std::move(lhs), std::move(rhs.value)));
+ return expect_equality_expr(
+ create<ast::BinaryExpression>(source, op, lhs, rhs.value));
}
// equality_expression
@@ -2354,7 +2341,7 @@
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 @@
return add_error(peek(), "unable to parse right side of & expression");
return expect_and_expr(create<ast::BinaryExpression>(
- source, ast::BinaryOp::kAnd, std::move(lhs), std::move(rhs.value)));
+ source, ast::BinaryOp::kAnd, lhs, rhs.value));
}
// and_expression
@@ -2387,7 +2374,7 @@
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 @@
return add_error(peek(), "unable to parse right side of ^ expression");
return expect_exclusive_or_expr(create<ast::BinaryExpression>(
- 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 @@
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 @@
return add_error(peek(), "unable to parse right side of | expression");
return expect_inclusive_or_expr(create<ast::BinaryExpression>(
- 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 @@
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 @@
if (!rhs.matched)
return add_error(peek(), "unable to parse right side of && expression");
- return expect_logical_and_expr(
- create<ast::BinaryExpression>(source, ast::BinaryOp::kLogicalAnd,
- std::move(lhs), std::move(rhs.value)));
+ return expect_logical_and_expr(create<ast::BinaryExpression>(
+ source, ast::BinaryOp::kLogicalAnd, lhs, rhs.value));
}
// logical_and_expression
@@ -2484,7 +2470,7 @@
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 @@
return add_error(peek(), "unable to parse right side of || expression");
return expect_logical_or_expr(create<ast::BinaryExpression>(
- 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 @@
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 @@
if (!rhs.matched)
return add_error(peek(), "unable to parse right side of assignment");
- return create<ast::AssignmentStatement>(source, std::move(lhs.value),
- std::move(rhs.value));
+ return create<ast::AssignmentStatement>(source, lhs.value, rhs.value);
}
// const_literal
@@ -2601,12 +2586,12 @@
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 @@
return Failure::kErrored;
return create<ast::TypeConstructorExpression>(source, type.value,
- std::move(params.value));
+ params.value);
}
auto lit = const_literal();
@@ -2624,7 +2609,7 @@
if (!lit.matched)
return add_error(peek(), "unable to parse const literal");
- return create<ast::ScalarConstructorExpression>(source, std::move(lit.value));
+ return create<ast::ScalarConstructorExpression>(source, lit.value);
}
Maybe<ast::DecorationList> ParserImpl::decoration_list() {
@@ -2669,7 +2654,7 @@
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 @@
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 @@
ok = false;
continue;
}
- out.emplace_back(ast::As<T>(std::move(deco)));
+ out.emplace_back(ast::As<T>(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 46b4f36..53dad7f 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 @@
EXPECT_TRUE(decos.matched);
ASSERT_EQ(decos.value.size(), 2u);
- auto* deco_0 = ast::As<ast::FunctionDecoration>(std::move(decos.value[0]));
- auto* deco_1 = ast::As<ast::FunctionDecoration>(std::move(decos.value[1]));
+ auto* deco_0 = ast::As<ast::FunctionDecoration>(decos.value[0]);
+ auto* deco_1 = ast::As<ast::FunctionDecoration>(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 75991b2..583a5bb 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 @@
EXPECT_FALSE(deco.errored);
ASSERT_NE(deco.value, nullptr) << p->error();
ASSERT_FALSE(p->has_error());
- auto* func_deco = ast::As<ast::FunctionDecoration>(std::move(deco.value));
+ auto* func_deco = ast::As<ast::FunctionDecoration>(deco.value);
ASSERT_NE(func_deco, nullptr);
ASSERT_TRUE(func_deco->IsWorkgroup());
@@ -50,7 +50,7 @@
EXPECT_FALSE(deco.errored);
ASSERT_NE(deco.value, nullptr) << p->error();
ASSERT_FALSE(p->has_error());
- auto* func_deco = ast::As<ast::FunctionDecoration>(std::move(deco.value));
+ auto* func_deco = ast::As<ast::FunctionDecoration>(deco.value);
ASSERT_NE(func_deco, nullptr) << p->error();
ASSERT_TRUE(func_deco->IsWorkgroup());
@@ -70,7 +70,7 @@
EXPECT_FALSE(deco.errored);
ASSERT_NE(deco.value, nullptr) << p->error();
ASSERT_FALSE(p->has_error());
- auto* func_deco = ast::As<ast::FunctionDecoration>(std::move(deco.value));
+ auto* func_deco = ast::As<ast::FunctionDecoration>(deco.value);
ASSERT_NE(func_deco, nullptr);
ASSERT_TRUE(func_deco->IsWorkgroup());
@@ -257,7 +257,7 @@
EXPECT_FALSE(deco.errored);
ASSERT_NE(deco.value, nullptr) << p->error();
ASSERT_FALSE(p->has_error());
- auto* func_deco = ast::As<ast::FunctionDecoration>(std::move(deco.value));
+ auto* func_deco = ast::As<ast::FunctionDecoration>(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 8c8b988..08358f2 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 @@
EXPECT_FALSE(decos.errored);
EXPECT_TRUE(decos.matched);
ASSERT_EQ(decos.value.size(), 1u);
- auto* struct_deco = ast::As<ast::StructDecoration>(std::move(decos.value[0]));
+ auto* struct_deco = ast::As<ast::StructDecoration>(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 ba37441..b18f486 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 @@
EXPECT_TRUE(deco.matched);
EXPECT_FALSE(deco.errored);
ASSERT_NE(deco.value, nullptr);
- auto* struct_deco = ast::As<ast::StructDecoration>(std::move(deco.value));
+ auto* struct_deco = ast::As<ast::StructDecoration>(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 2e696d3..0ef8b44 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 @@
EXPECT_FALSE(decos.errored);
EXPECT_TRUE(decos.matched);
ASSERT_EQ(decos.value.size(), 1u);
- auto* deco = ast::As<ast::StructMemberDecoration>(std::move(decos.value[0]));
+ auto* deco = ast::As<ast::StructMemberDecoration>(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 adb21db..963d32a 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 @@
ASSERT_NE(deco.value, nullptr);
ASSERT_FALSE(p->has_error());
- auto* member_deco =
- ast::As<ast::StructMemberDecoration>(std::move(deco.value));
+ auto* member_deco = ast::As<ast::StructMemberDecoration>(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 9f53688..60d9a49 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 @@
ASSERT_TRUE(decos.matched);
ASSERT_EQ(decos.value.size(), 2u);
- auto* deco_0 = ast::As<ast::VariableDecoration>(std::move(decos.value[0]));
- auto* deco_1 = ast::As<ast::VariableDecoration>(std::move(decos.value[1]));
+ auto* deco_0 = ast::As<ast::VariableDecoration>(decos.value[0]);
+ auto* deco_1 = ast::As<ast::VariableDecoration>(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 6ac7ac3..e992a61 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 @@
EXPECT_TRUE(deco.matched);
EXPECT_FALSE(deco.errored);
ASSERT_NE(deco.value, nullptr);
- auto* var_deco = ast::As<ast::VariableDecoration>(std::move(deco.value));
+ auto* var_deco = ast::As<ast::VariableDecoration>(deco.value);
ASSERT_NE(var_deco, nullptr);
ASSERT_FALSE(p->has_error());
ASSERT_TRUE(var_deco->IsLocation());
@@ -101,7 +101,7 @@
EXPECT_TRUE(deco.matched);
EXPECT_FALSE(deco.errored);
ASSERT_NE(deco.value, nullptr);
- auto* var_deco = ast::As<ast::VariableDecoration>(std::move(deco.value));
+ auto* var_deco = ast::As<ast::VariableDecoration>(deco.value);
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_NE(var_deco, nullptr);
ASSERT_TRUE(var_deco->IsBuiltin());
@@ -180,7 +180,7 @@
EXPECT_TRUE(deco.matched);
EXPECT_FALSE(deco.errored);
ASSERT_NE(deco.value, nullptr);
- auto* var_deco = ast::As<ast::VariableDecoration>(std::move(deco.value));
+ auto* var_deco = ast::As<ast::VariableDecoration>(deco.value);
ASSERT_NE(var_deco, nullptr);
ASSERT_FALSE(p->has_error());
ASSERT_TRUE(var_deco->IsBinding());
@@ -237,7 +237,7 @@
EXPECT_TRUE(deco.matched);
EXPECT_FALSE(deco.errored);
ASSERT_NE(deco.value, nullptr);
- auto* var_deco = ast::As<ast::VariableDecoration>(std::move(deco.value));
+ auto* var_deco = ast::As<ast::VariableDecoration>(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 cbc4bac..4aebfeb 100644
--- a/src/transform/bound_array_accessors_transform.cc
+++ b/src/transform/bound_array_accessors_transform.cc
@@ -244,8 +244,7 @@
cast_expr.push_back(expr->idx_expr());
ast::ExpressionList params;
- params.push_back(
- create<ast::TypeConstructorExpression>(u32, std::move(cast_expr)));
+ params.push_back(create<ast::TypeConstructorExpression>(u32, cast_expr));
params.push_back(create<ast::ScalarConstructorExpression>(
create<ast::UintLiteral>(u32, size - 1)));
@@ -253,7 +252,7 @@
create<ast::IdentifierExpression>("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 d0613b7..aa994ae 100644
--- a/src/transform/bound_array_accessors_transform_test.cc
+++ b/src/transform/bound_array_accessors_transform_test.cc
@@ -54,15 +54,15 @@
ast::BlockStatement* SetupFunctionAndBody() {
auto* block = create<ast::BlockStatement>();
body_ = block;
- auto* func = create<ast::Function>("func", ast::VariableList{}, &void_type_,
- std::move(block));
- mod_.AddFunction(std::move(func));
+ auto* func =
+ create<ast::Function>("func", ast::VariableList{}, &void_type_, block);
+ mod_.AddFunction(func);
return body_;
}
void DeclareVariable(ast::Variable* var) {
ASSERT_NE(body_, nullptr);
- body_->append(create<ast::VariableDeclStatement>(std::move(var)));
+ body_->append(create<ast::VariableDeclStatement>(var));
}
TypeDeterminer* td() { return &td_; }
@@ -105,19 +105,18 @@
auto* c_var = create<ast::Variable>("c", ast::StorageClass::kFunction, &u32);
c_var->set_is_const(true);
- DeclareVariable(std::move(c_var));
+ DeclareVariable(c_var);
auto* access_idx = create<ast::IdentifierExpression>("c");
- auto* access_ptr = access_idx;
auto* accessor = create<ast::ArrayAccessorExpression>(
- create<ast::IdentifierExpression>("a"), std::move(access_idx));
+ create<ast::IdentifierExpression>("a"), access_idx);
auto* ptr = accessor;
auto* b = create<ast::Variable>("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 @@
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 @@
create<ast::Variable>("i", ast::StorageClass::kFunction, &u32));
auto* b_access_idx = create<ast::IdentifierExpression>("i");
- auto* b_access_ptr = b_access_idx;
auto* a_access_idx = create<ast::ArrayAccessorExpression>(
- create<ast::IdentifierExpression>("b"), std::move(b_access_idx));
+ create<ast::IdentifierExpression>("b"), b_access_idx);
auto* accessor = create<ast::ArrayAccessorExpression>(
- create<ast::IdentifierExpression>("a"), std::move(a_access_idx));
+ create<ast::IdentifierExpression>("a"), a_access_idx);
auto* ptr = accessor;
auto* b = create<ast::Variable>("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 @@
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 @@
auto* ptr = accessor;
auto* b = create<ast::Variable>("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 @@
create<ast::UintLiteral>(&u32, 2)),
create<ast::ScalarConstructorExpression>(
create<ast::UintLiteral>(&u32, 3))));
- auto* access_ptr = access_idx;
auto* accessor = create<ast::ArrayAccessorExpression>(
- create<ast::IdentifierExpression>("a"), std::move(access_idx));
+ create<ast::IdentifierExpression>("a"), access_idx);
auto* ptr = accessor;
auto* b = create<ast::Variable>("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 @@
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 @@
auto* ptr = accessor;
auto* b = create<ast::Variable>("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 @@
auto* ptr = accessor;
auto* b = create<ast::Variable>("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 @@
auto* ptr = accessor;
auto* b = create<ast::Variable>("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 @@
create<ast::UintLiteral>(&u32, 2)),
create<ast::ScalarConstructorExpression>(
create<ast::UintLiteral>(&u32, 3))));
- auto* access_ptr = access_idx;
auto* accessor = create<ast::ArrayAccessorExpression>(
- create<ast::IdentifierExpression>("a"), std::move(access_idx));
+ create<ast::IdentifierExpression>("a"), access_idx);
auto* ptr = accessor;
auto* b = create<ast::Variable>("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 @@
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 @@
auto* ptr = accessor;
auto* b = create<ast::Variable>("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 @@
auto* ptr = accessor;
auto* b = create<ast::Variable>("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 @@
auto* ptr = accessor;
auto* b = create<ast::Variable>("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 @@
create<ast::UintLiteral>(&u32, 2)),
create<ast::ScalarConstructorExpression>(
create<ast::UintLiteral>(&u32, 3))));
- auto* access_ptr = access_idx;
auto* accessor = create<ast::ArrayAccessorExpression>(
create<ast::ArrayAccessorExpression>(
- create<ast::IdentifierExpression>("a"), std::move(access_idx)),
+ create<ast::IdentifierExpression>("a"), access_idx),
create<ast::ScalarConstructorExpression>(
create<ast::UintLiteral>(&u32, 1u)));
auto* ptr = accessor;
auto* b = create<ast::Variable>("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 @@
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 @@
create<ast::UintLiteral>(&u32, 2)),
create<ast::ScalarConstructorExpression>(
create<ast::UintLiteral>(&u32, 3))));
- auto* access_ptr = access_idx;
auto* accessor = create<ast::ArrayAccessorExpression>(
create<ast::ArrayAccessorExpression>(
create<ast::IdentifierExpression>("a"),
create<ast::ScalarConstructorExpression>(
create<ast::UintLiteral>(&u32, 1u))),
- std::move(access_idx));
+ access_idx);
auto* ptr = accessor;
auto* b = create<ast::Variable>("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 @@
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 @@
auto* ptr = accessor;
auto* b = create<ast::Variable>("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 @@
auto* ptr = accessor;
auto* b = create<ast::Variable>("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 @@
auto* ptr = accessor;
auto* b = create<ast::Variable>("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 @@
auto* ptr = accessor;
auto* b = create<ast::Variable>("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 f057ada..7707194 100644
--- a/src/transform/vertex_pulling_transform.cc
+++ b/src/transform/vertex_pulling_transform.cc
@@ -151,7 +151,7 @@
create<ast::BuiltinDecoration>(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 @@
create<ast::BuiltinDecoration>(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 @@
decorations.push_back(create<ast::SetDecoration>(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 @@
// |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 @@
auto* pos_value = create<ast::BinaryExpression>(
ast::BinaryOp::kAdd,
create<ast::BinaryExpression>(
- ast::BinaryOp::kMultiply, std::move(index_identifier),
+ ast::BinaryOp::kMultiply, index_identifier,
GenUint(static_cast<uint32_t>(buffer_layout.array_stride))),
GenUint(static_cast<uint32_t>(attribute_desc.offset)));
// Update position of the read
auto* set_pos_expr = create<ast::AssignmentStatement>(
- CreatePullingPositionIdent(), std::move(pos_value));
- block->append(std::move(set_pos_expr));
+ CreatePullingPositionIdent(), pos_value);
+ block->append(set_pos_expr);
block->append(create<ast::AssignmentStatement>(
create<ast::IdentifierExpression>(v->name()),
@@ -317,7 +317,7 @@
}
}
- 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 @@
create<ast::MemberAccessorExpression>(
create<ast::IdentifierExpression>(GetVertexBufferName(buffer)),
create<ast::IdentifierExpression>(kStructBufferName)),
- create<ast::BinaryExpression>(ast::BinaryOp::kDivide, std::move(pos),
- GenUint(4)));
+ create<ast::BinaryExpression>(ast::BinaryOp::kDivide, pos, GenUint(4)));
}
ast::Expression* VertexPullingTransform::AccessI32(uint32_t buffer,
ast::Expression* pos) {
// as<T> reinterprets bits
- return create<ast::BitcastExpression>(GetI32Type(),
- AccessU32(buffer, std::move(pos)));
+ return create<ast::BitcastExpression>(GetI32Type(), AccessU32(buffer, pos));
}
ast::Expression* VertexPullingTransform::AccessF32(uint32_t buffer,
ast::Expression* pos) {
// as<T> reinterprets bits
- return create<ast::BitcastExpression>(GetF32Type(),
- AccessU32(buffer, std::move(pos)));
+ return create<ast::BitcastExpression>(GetF32Type(), AccessU32(buffer, pos));
}
ast::Expression* VertexPullingTransform::AccessPrimitive(uint32_t buffer,
@@ -394,11 +391,11 @@
// 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 @@
auto* cur_pos = create<ast::BinaryExpression>(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<ast::TypeConstructorExpression>(
@@ -443,8 +439,8 @@
uint64_t in_array_stride,
InputStepMode in_step_mode,
std::vector<VertexAttributeDescriptor> 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 8f9b3b6..f8af132 100644
--- a/src/transform/vertex_pulling_transform_test.cc
+++ b/src/transform/vertex_pulling_transform_test.cc
@@ -47,7 +47,7 @@
create<ast::BlockStatement>());
func->add_decoration(
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}));
- mod()->AddFunction(std::move(func));
+ mod()->AddFunction(func);
}
// Set up the transformation, after building the module
@@ -58,7 +58,7 @@
EXPECT_TRUE(td.Determine());
transform_->SetVertexState(
- std::make_unique<VertexStateDescriptor>(std::move(vertex_state)));
+ std::make_unique<VertexStateDescriptor>(vertex_state));
transform_->SetEntryPoint("main");
}
@@ -72,8 +72,8 @@
ast::VariableDecorationList decorations;
decorations.push_back(create<ast::LocationDecoration>(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 @@
create<ast::BlockStatement>());
func->add_decoration(
create<ast::StageDecoration>(ast::PipelineStage::kFragment, Source{}));
- mod()->AddFunction(std::move(func));
+ mod()->AddFunction(func);
InitTransform({});
EXPECT_FALSE(transform()->Run());
@@ -410,8 +410,8 @@
decorations.push_back(
create<ast::BuiltinDecoration>(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 @@
decorations.push_back(
create<ast::BuiltinDecoration>(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 ec0535e..7a25151 100644
--- a/src/type_determiner_test.cc
+++ b/src/type_determiner_test.cc
@@ -133,20 +133,17 @@
auto* lhs = create<ast::ScalarConstructorExpression>(
create<ast::SintLiteral>(&i32, 2));
- auto* lhs_ptr = lhs;
-
auto* rhs = create<ast::ScalarConstructorExpression>(
create<ast::FloatLiteral>(&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 @@
auto* lhs = create<ast::ScalarConstructorExpression>(
create<ast::SintLiteral>(&i32, 2));
- auto* lhs_ptr = lhs;
-
auto* rhs = create<ast::ScalarConstructorExpression>(
create<ast::FloatLiteral>(&f32, 2.3f));
- auto* rhs_ptr = rhs;
auto* body = create<ast::BlockStatement>();
- body->append(
- create<ast::AssignmentStatement>(std::move(lhs), std::move(rhs)));
+ body->append(create<ast::AssignmentStatement>(lhs, rhs));
ast::CaseSelectorList lit;
lit.push_back(create<ast::SintLiteral>(&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 @@
auto* lhs = create<ast::ScalarConstructorExpression>(
create<ast::SintLiteral>(&i32, 2));
- auto* lhs_ptr = lhs;
-
auto* rhs = create<ast::ScalarConstructorExpression>(
create<ast::FloatLiteral>(&f32, 2.3f));
- auto* rhs_ptr = rhs;
ast::BlockStatement block;
- block.append(
- create<ast::AssignmentStatement>(std::move(lhs), std::move(rhs)));
+ block.append(create<ast::AssignmentStatement>(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 @@
auto* lhs = create<ast::ScalarConstructorExpression>(
create<ast::SintLiteral>(&i32, 2));
- auto* lhs_ptr = lhs;
-
auto* rhs = create<ast::ScalarConstructorExpression>(
create<ast::FloatLiteral>(&f32, 2.3f));
- auto* rhs_ptr = rhs;
auto* body = create<ast::BlockStatement>();
- body->append(
- create<ast::AssignmentStatement>(std::move(lhs), std::move(rhs)));
+ body->append(create<ast::AssignmentStatement>(lhs, rhs));
ast::ElseStatement stmt(create<ast::ScalarConstructorExpression>(
create<ast::SintLiteral>(&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 @@
auto* else_lhs = create<ast::ScalarConstructorExpression>(
create<ast::SintLiteral>(&i32, 2));
- auto* else_lhs_ptr = else_lhs;
-
auto* else_rhs = create<ast::ScalarConstructorExpression>(
create<ast::FloatLiteral>(&f32, 2.3f));
- auto* else_rhs_ptr = else_rhs;
auto* else_body = create<ast::BlockStatement>();
- else_body->append(create<ast::AssignmentStatement>(std::move(else_lhs),
- std::move(else_rhs)));
+ else_body->append(create<ast::AssignmentStatement>(else_lhs, else_rhs));
auto* else_stmt =
create<ast::ElseStatement>(create<ast::ScalarConstructorExpression>(
create<ast::SintLiteral>(&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<ast::ScalarConstructorExpression>(
create<ast::SintLiteral>(&i32, 2));
- auto* lhs_ptr = lhs;
-
auto* rhs = create<ast::ScalarConstructorExpression>(
create<ast::FloatLiteral>(&f32, 2.3f));
- auto* rhs_ptr = rhs;
auto* body = create<ast::BlockStatement>();
- body->append(
- create<ast::AssignmentStatement>(std::move(lhs), std::move(rhs)));
+ body->append(create<ast::AssignmentStatement>(lhs, rhs));
ast::IfStatement stmt(create<ast::ScalarConstructorExpression>(
create<ast::SintLiteral>(&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 @@
auto* body_lhs = create<ast::ScalarConstructorExpression>(
create<ast::SintLiteral>(&i32, 2));
- auto* body_lhs_ptr = body_lhs;
-
auto* body_rhs = create<ast::ScalarConstructorExpression>(
create<ast::FloatLiteral>(&f32, 2.3f));
- auto* body_rhs_ptr = body_rhs;
auto* body = create<ast::BlockStatement>();
- body->append(create<ast::AssignmentStatement>(std::move(body_lhs),
- std::move(body_rhs)));
+ body->append(create<ast::AssignmentStatement>(body_lhs, body_rhs));
auto* continuing_lhs = create<ast::ScalarConstructorExpression>(
create<ast::SintLiteral>(&i32, 2));
- auto* continuing_lhs_ptr = continuing_lhs;
-
auto* continuing_rhs = create<ast::ScalarConstructorExpression>(
create<ast::FloatLiteral>(&f32, 2.3f));
- auto* continuing_rhs_ptr = continuing_rhs;
auto* continuing = create<ast::BlockStatement>();
- continuing->append(create<ast::AssignmentStatement>(
- std::move(continuing_lhs), std::move(continuing_rhs)));
+ continuing->append(
+ create<ast::AssignmentStatement>(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 @@
auto* cond = create<ast::ScalarConstructorExpression>(
create<ast::SintLiteral>(&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 @@
auto* lhs = create<ast::ScalarConstructorExpression>(
create<ast::SintLiteral>(&i32, 2));
- auto* lhs_ptr = lhs;
-
auto* rhs = create<ast::ScalarConstructorExpression>(
create<ast::FloatLiteral>(&f32, 2.3f));
- auto* rhs_ptr = rhs;
auto* body = create<ast::BlockStatement>();
- body->append(
- create<ast::AssignmentStatement>(std::move(lhs), std::move(rhs)));
+ body->append(create<ast::AssignmentStatement>(lhs, rhs));
ast::CaseSelectorList lit;
lit.push_back(create<ast::SintLiteral>(&i32, 3));
ast::CaseStatementList cases;
- cases.push_back(create<ast::CaseStatement>(std::move(lit), std::move(body)));
+ cases.push_back(create<ast::CaseStatement>(lit, body));
ast::SwitchStatement stmt(create<ast::ScalarConstructorExpression>(
create<ast::SintLiteral>(&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<ast::Function>("my_func", std::move(params), &f32,
+ auto* func = create<ast::Function>("my_func", params, &f32,
create<ast::BlockStatement>());
- mod()->AddFunction(std::move(func));
+ mod()->AddFunction(func);
// Register the function
EXPECT_TRUE(td()->Determine());
ast::ExpressionList call_params;
auto* expr = create<ast::CallExpression>(
- create<ast::IdentifierExpression>("my_func"), std::move(call_params));
- auto* expr_ptr = expr;
+ create<ast::IdentifierExpression>("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 @@
auto* call_expr =
create<ast::CallExpression>(create<ast::IdentifierExpression>(
Source{Source::Location{12, 34}}, "func"),
- std::move(call_params));
+ call_params);
ast::VariableList params0;
auto* main_body = create<ast::BlockStatement>();
- main_body->append(create<ast::CallStatement>(std::move(call_expr)));
+ main_body->append(create<ast::CallStatement>(call_expr));
main_body->append(create<ast::ReturnStatement>());
- auto* func_main = create<ast::Function>("main", std::move(params0), &f32,
- std::move(main_body));
- mod()->AddFunction(std::move(func_main));
+ auto* func_main = create<ast::Function>("main", params0, &f32, main_body);
+ mod()->AddFunction(func_main);
auto* body = create<ast::BlockStatement>();
body->append(create<ast::ReturnStatement>());
- auto* func =
- create<ast::Function>("func", std::move(params0), &f32, std::move(body));
- mod()->AddFunction(std::move(func));
+ auto* func = create<ast::Function>("func", params0, &f32, body);
+ mod()->AddFunction(func);
EXPECT_FALSE(td()->Determine()) << td()->error();
EXPECT_EQ(td()->error(),
@@ -434,13 +396,13 @@
auto* var = create<ast::Variable>("my_var", ast::StorageClass::kNone, &i32);
var->set_constructor(create<ast::ScalarConstructorExpression>(
create<ast::SintLiteral>(&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 @@
auto* var = create<ast::Variable>("my_var", ast::StorageClass::kNone, &i32);
var->set_constructor(create<ast::ScalarConstructorExpression>(
create<ast::SintLiteral>(&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 @@
create<ast::SintLiteral>(&i32, 2));
auto* var =
create<ast::Variable>("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<ast::IdentifierExpression>("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 @@
create<ast::SintLiteral>(&i32, 2));
auto* var =
create<ast::Variable>("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<ast::IdentifierExpression>("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 @@
auto* var =
create<ast::Variable>("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<ast::IdentifierExpression>("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 @@
auto* idx = create<ast::ScalarConstructorExpression>(
create<ast::SintLiteral>(&i32, 2));
auto* var = create<ast::Variable>("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<ast::IdentifierExpression>("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 @@
auto* idx2 = create<ast::ScalarConstructorExpression>(
create<ast::SintLiteral>(&i32, 1));
auto* var = create<ast::Variable>("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<ast::ArrayAccessorExpression>(
- create<ast::IdentifierExpression>("my_var"), std::move(idx1)),
- std::move(idx2));
+ create<ast::IdentifierExpression>("my_var"), idx1),
+ idx2);
EXPECT_TRUE(td()->DetermineResultType(&acc));
ASSERT_NE(acc.result_type(), nullptr);
@@ -596,13 +558,13 @@
auto* idx = create<ast::ScalarConstructorExpression>(
create<ast::SintLiteral>(&i32, 2));
auto* var = create<ast::Variable>("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<ast::IdentifierExpression>("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 @@
ast::type::F32Type f32;
ast::VariableList params;
- auto* func = create<ast::Function>("my_func", std::move(params), &f32,
+ auto* func = create<ast::Function>("my_func", params, &f32,
create<ast::BlockStatement>());
- mod()->AddFunction(std::move(func));
+ mod()->AddFunction(func);
// Register the function
EXPECT_TRUE(td()->Determine());
ast::ExpressionList call_params;
ast::CallExpression call(create<ast::IdentifierExpression>("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 @@
ast::type::F32Type f32;
ast::VariableList params;
- auto* func = create<ast::Function>("my_func", std::move(params), &f32,
+ auto* func = create<ast::Function>("my_func", params, &f32,
create<ast::BlockStatement>());
- mod()->AddFunction(std::move(func));
+ mod()->AddFunction(func);
// Register the function
EXPECT_TRUE(td()->Determine());
@@ -658,13 +620,13 @@
call_params.push_back(create<ast::ScalarConstructorExpression>(
create<ast::FloatLiteral>(&f32, 2.4)));
- auto* param_ptr = call_params.back();
+ auto* param = call_params.back();
ast::CallExpression call(create<ast::IdentifierExpression>("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 @@
create<ast::FloatLiteral>(&f32, 2.4)));
ast::CallExpression call(create<ast::IdentifierExpression>("round"),
- std::move(call_params));
+ call_params);
EXPECT_TRUE(td()->DetermineResultType(&call));
ASSERT_NE(call.result_type(), nullptr);
@@ -690,7 +652,7 @@
ast::ExpressionList params;
params.push_back(create<ast::IdentifierExpression>("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 @@
vals.push_back(create<ast::ScalarConstructorExpression>(
create<ast::FloatLiteral>(&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_Identifier_GlobalVariable) {
ast::type::F32Type f32;
auto* var = create<ast::Variable>("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 @@
ast::type::F32Type f32;
auto* var = create<ast::Variable>("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 @@
ast::type::F32Type f32;
auto* my_var = create<ast::IdentifierExpression>("my_var");
- auto* my_var_ptr = my_var;
auto* var = create<ast::Variable>("my_var", ast::StorageClass::kNone, &f32);
var->set_is_const(true);
auto* body = create<ast::BlockStatement>();
- body->append(create<ast::VariableDeclStatement>(std::move(var)));
+ body->append(create<ast::VariableDeclStatement>(var));
body->append(create<ast::AssignmentStatement>(
- std::move(my_var), create<ast::IdentifierExpression>("my_var")));
+ my_var, create<ast::IdentifierExpression>("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<ast::IdentifierExpression>("my_var");
- auto* my_var_ptr = my_var;
auto* body = create<ast::BlockStatement>();
body->append(create<ast::VariableDeclStatement>(
create<ast::Variable>("my_var", ast::StorageClass::kNone, &f32)));
body->append(create<ast::AssignmentStatement>(
- std::move(my_var), create<ast::IdentifierExpression>("my_var")));
+ my_var, create<ast::IdentifierExpression>("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 @@
ast::type::PointerType ptr(&f32, ast::StorageClass::kFunction);
auto* my_var = create<ast::IdentifierExpression>("my_var");
- auto* my_var_ptr = my_var;
auto* body = create<ast::BlockStatement>();
body->append(create<ast::VariableDeclStatement>(
create<ast::Variable>("my_var", ast::StorageClass::kNone, &ptr)));
body->append(create<ast::AssignmentStatement>(
- std::move(my_var), create<ast::IdentifierExpression>("my_var")));
+ my_var, create<ast::IdentifierExpression>("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<ast::Function>("my_func", std::move(params), &f32,
+ auto* func = create<ast::Function>("my_func", params, &f32,
create<ast::BlockStatement>());
- mod()->AddFunction(std::move(func));
+ mod()->AddFunction(func);
// Register the function
EXPECT_TRUE(td()->Determine());
@@ -863,17 +822,11 @@
auto* priv_var =
create<ast::Variable>("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<ast::BlockStatement>();
@@ -889,22 +842,20 @@
body->append(create<ast::AssignmentStatement>(
create<ast::IdentifierExpression>("priv_var"),
create<ast::IdentifierExpression>("priv_var")));
- auto* func = create<ast::Function>("my_func", std::move(params), &f32,
- std::move(body));
- auto* func_ptr = func;
+ auto* func = create<ast::Function>("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 @@
auto* priv_var =
create<ast::Variable>("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<ast::BlockStatement>();
body->append(create<ast::AssignmentStatement>(
@@ -947,32 +892,29 @@
create<ast::IdentifierExpression>("priv_var"),
create<ast::IdentifierExpression>("priv_var")));
ast::VariableList params;
- auto* func = create<ast::Function>("my_func", std::move(params), &f32,
- std::move(body));
+ auto* func = create<ast::Function>("my_func", params, &f32, body);
- mod()->AddFunction(std::move(func));
+ mod()->AddFunction(func);
body = create<ast::BlockStatement>();
body->append(create<ast::AssignmentStatement>(
create<ast::IdentifierExpression>("out_var"),
create<ast::CallExpression>(create<ast::IdentifierExpression>("my_func"),
ast::ExpressionList{})));
- auto* func2 =
- create<ast::Function>("func", std::move(params), &f32, std::move(body));
- auto* func2_ptr = func2;
+ auto* func2 = create<ast::Function>("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 @@
create<ast::Variable>("in_var", ast::StorageClass::kFunction, &f32);
auto* body = create<ast::BlockStatement>();
- body->append(create<ast::VariableDeclStatement>(std::move(var)));
+ body->append(create<ast::VariableDeclStatement>(var));
body->append(create<ast::AssignmentStatement>(
create<ast::IdentifierExpression>("var"),
create<ast::ScalarConstructorExpression>(
create<ast::FloatLiteral>(&f32, 1.f))));
ast::VariableList params;
- auto* func = create<ast::Function>("my_func", std::move(params), &f32,
- std::move(body));
- auto* func_ptr = func;
+ auto* func = create<ast::Function>("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 @@
// 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 @@
ast::StructMemberDecorationList decos;
ast::StructMemberList members;
- members.push_back(
- create<ast::StructMember>("first_member", &i32, std::move(decos)));
- members.push_back(
- create<ast::StructMember>("second_member", &f32, std::move(decos)));
+ members.push_back(create<ast::StructMember>("first_member", &i32, decos));
+ members.push_back(create<ast::StructMember>("second_member", &f32, decos));
- auto* strct = create<ast::Struct>(std::move(members));
+ auto* strct = create<ast::Struct>(members);
- ast::type::StructType st("S", std::move(strct));
+ ast::type::StructType st("S", strct);
auto* var = create<ast::Variable>("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 @@
auto* ident = create<ast::IdentifierExpression>("my_struct");
auto* mem_ident = create<ast::IdentifierExpression>("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 @@
ast::StructMemberDecorationList decos;
ast::StructMemberList members;
- members.push_back(
- create<ast::StructMember>("first_member", &i32, std::move(decos)));
- members.push_back(
- create<ast::StructMember>("second_member", &f32, std::move(decos)));
+ members.push_back(create<ast::StructMember>("first_member", &i32, decos));
+ members.push_back(create<ast::StructMember>("second_member", &f32, decos));
- auto* strct = create<ast::Struct>(std::move(members));
+ auto* strct = create<ast::Struct>(members);
- auto st = std::make_unique<ast::type::StructType>("alias", std::move(strct));
+ auto st = std::make_unique<ast::type::StructType>("alias", strct);
ast::type::AliasType alias("alias", st.get());
auto* var =
create<ast::Variable>("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 @@
auto* ident = create<ast::IdentifierExpression>("my_struct");
auto* mem_ident = create<ast::IdentifierExpression>("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 @@
ast::type::VectorType vec3(&f32, 3);
auto* var = create<ast::Variable>("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 @@
auto* ident = create<ast::IdentifierExpression>("my_vec");
auto* swizzle = create<ast::IdentifierExpression>("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 @@
ast::type::VectorType vec3(&f32, 3);
auto* var = create<ast::Variable>("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 @@
auto* ident = create<ast::IdentifierExpression>("my_vec");
auto* swizzle = create<ast::IdentifierExpression>("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 @@
ast::StructMemberDecorationList decos;
ast::StructMemberList b_members;
- b_members.push_back(
- create<ast::StructMember>("foo", &vec4, std::move(decos)));
+ b_members.push_back(create<ast::StructMember>("foo", &vec4, decos));
- auto* strctB = create<ast::Struct>(std::move(b_members));
- ast::type::StructType stB("B", std::move(strctB));
+ auto* strctB = create<ast::Struct>(b_members);
+ ast::type::StructType stB("B", strctB);
ast::type::VectorType vecB(&stB, 3);
ast::StructMemberList a_members;
- a_members.push_back(
- create<ast::StructMember>("mem", &vecB, std::move(decos)));
+ a_members.push_back(create<ast::StructMember>("mem", &vecB, decos));
- auto* strctA = create<ast::Struct>(std::move(a_members));
+ auto* strctA = create<ast::Struct>(a_members);
- ast::type::StructType stA("A", std::move(strctA));
+ ast::type::StructType stA("A", strctA);
auto* var = create<ast::Variable>("c", ast::StorageClass::kNone, &stA);
- mod()->AddGlobalVariable(std::move(var));
+ mod()->AddGlobalVariable(var);
// Register the global
EXPECT_TRUE(td()->Determine());
@@ -1181,11 +1115,9 @@
ast::MemberAccessorExpression mem(
create<ast::MemberAccessorExpression>(
create<ast::ArrayAccessorExpression>(
- create<ast::MemberAccessorExpression>(std::move(ident),
- std::move(mem_ident)),
- std::move(idx)),
- std::move(foo_ident)),
- std::move(swizzle));
+ create<ast::MemberAccessorExpression>(ident, mem_ident), idx),
+ foo_ident),
+ swizzle);
EXPECT_TRUE(td()->DetermineResultType(&mem)) << td()->error();
ASSERT_NE(mem.result_type(), nullptr);
@@ -1201,7 +1133,7 @@
ast::type::I32Type i32;
auto* var = create<ast::Variable>("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 @@
ast::type::VectorType vec3(&i32, 3);
auto* var = create<ast::Variable>("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 @@
auto* var =
create<ast::Variable>("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 @@
ast::type::VectorType vec3(&bool_type, 3);
auto* var = create<ast::Variable>("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 @@
ast::type::I32Type i32;
auto* var = create<ast::Variable>("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 @@
ast::type::VectorType vec3(&i32, 3);
auto* var = create<ast::Variable>("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 @@
ast::type::I32Type i32;
auto* var = create<ast::Variable>("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 @@
create<ast::Variable>("scalar", ast::StorageClass::kNone, &f32);
auto* vector =
create<ast::Variable>("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 @@
create<ast::Variable>("scalar", ast::StorageClass::kNone, &f32);
auto* vector =
create<ast::Variable>("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 @@
auto* vector =
create<ast::Variable>("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 @@
create<ast::Variable>("scalar", ast::StorageClass::kNone, &f32);
auto* matrix =
create<ast::Variable>("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 @@
create<ast::Variable>("scalar", ast::StorageClass::kNone, &f32);
auto* matrix =
create<ast::Variable>("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 @@
create<ast::Variable>("vector", ast::StorageClass::kNone, &vec3);
auto* matrix =
create<ast::Variable>("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 @@
create<ast::Variable>("vector", ast::StorageClass::kNone, &vec3);
auto* matrix =
create<ast::Variable>("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 @@
create<ast::Variable>("mat4x3", ast::StorageClass::kNone, &mat4x3);
auto* matrix2 =
create<ast::Variable>("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 @@
ast::type::F32Type f32;
auto* var = create<ast::Variable>("ident", ast::StorageClass::kNone, &f32);
- mod()->AddGlobalVariable(std::move(var));
+ mod()->AddGlobalVariable(var);
// Register the global
EXPECT_TRUE(td()->Determine());
@@ -1587,7 +1519,7 @@
call_params.push_back(create<ast::IdentifierExpression>("ident"));
ast::CallExpression expr(create<ast::IdentifierExpression>(name),
- std::move(call_params));
+ call_params);
EXPECT_TRUE(td()->DetermineResultType(&expr));
ASSERT_NE(expr.result_type(), nullptr);
@@ -1601,7 +1533,7 @@
ast::type::VectorType vec4(&f32, 4);
auto* var = create<ast::Variable>("ident", ast::StorageClass::kNone, &vec4);
- mod()->AddGlobalVariable(std::move(var));
+ mod()->AddGlobalVariable(var);
// Register the global
EXPECT_TRUE(td()->Determine());
@@ -1610,7 +1542,7 @@
call_params.push_back(create<ast::IdentifierExpression>("ident"));
ast::CallExpression expr(create<ast::IdentifierExpression>(name),
- std::move(call_params));
+ call_params);
EXPECT_TRUE(td()->DetermineResultType(&expr));
ASSERT_NE(expr.result_type(), nullptr);
@@ -1630,7 +1562,7 @@
ast::ExpressionList call_params;
ast::CallExpression expr(create<ast::IdentifierExpression>(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 @@
auto* var1 = create<ast::Variable>("ident1", ast::StorageClass::kNone, &vec4);
auto* var2 = create<ast::Variable>("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 @@
call_params.push_back(create<ast::IdentifierExpression>("ident2"));
ast::CallExpression expr(create<ast::IdentifierExpression>(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 @@
ast::type::VectorType vec3(&bool_type, 3);
auto* var = create<ast::Variable>("my_var", ast::StorageClass::kNone, &vec3);
- mod()->AddGlobalVariable(std::move(var));
+ mod()->AddGlobalVariable(var);
ast::ExpressionList call_params;
call_params.push_back(create<ast::IdentifierExpression>("my_var"));
ast::CallExpression expr(create<ast::IdentifierExpression>(name),
- std::move(call_params));
+ call_params);
// Register the variable
EXPECT_TRUE(td()->Determine());
@@ -1705,13 +1637,13 @@
ast::type::VectorType vec3(&f32, 3);
auto* var = create<ast::Variable>("my_var", ast::StorageClass::kNone, &vec3);
- mod()->AddGlobalVariable(std::move(var));
+ mod()->AddGlobalVariable(var);
ast::ExpressionList call_params;
call_params.push_back(create<ast::IdentifierExpression>("my_var"));
ast::CallExpression expr(create<ast::IdentifierExpression>(name),
- std::move(call_params));
+ call_params);
// Register the variable
EXPECT_TRUE(td()->Determine());
@@ -1729,13 +1661,13 @@
ast::type::F32Type f32;
auto* var = create<ast::Variable>("my_var", ast::StorageClass::kNone, &f32);
- mod()->AddGlobalVariable(std::move(var));
+ mod()->AddGlobalVariable(var);
ast::ExpressionList call_params;
call_params.push_back(create<ast::IdentifierExpression>("my_var"));
ast::CallExpression expr(create<ast::IdentifierExpression>(name),
- std::move(call_params));
+ call_params);
// Register the variable
EXPECT_TRUE(td()->Determine());
@@ -1750,11 +1682,11 @@
ast::type::F32Type f32;
auto* var = create<ast::Variable>("my_var", ast::StorageClass::kNone, &f32);
- mod()->AddGlobalVariable(std::move(var));
+ mod()->AddGlobalVariable(var);
ast::ExpressionList call_params;
ast::CallExpression expr(create<ast::IdentifierExpression>(name),
- std::move(call_params));
+ call_params);
// Register the variable
EXPECT_TRUE(td()->Determine());
@@ -1768,14 +1700,14 @@
ast::type::F32Type f32;
auto* var = create<ast::Variable>("my_var", ast::StorageClass::kNone, &f32);
- mod()->AddGlobalVariable(std::move(var));
+ mod()->AddGlobalVariable(var);
ast::ExpressionList call_params;
call_params.push_back(create<ast::IdentifierExpression>("my_var"));
call_params.push_back(create<ast::IdentifierExpression>("my_var"));
ast::CallExpression expr(create<ast::IdentifierExpression>(name),
- std::move(call_params));
+ call_params);
// Register the variable
EXPECT_TRUE(td()->Determine());
@@ -1837,7 +1769,7 @@
ast::type::Type* type,
ast::ExpressionList* call_params) {
auto* var = create<ast::Variable>(name, ast::StorageClass::kNone, type);
- mod()->AddGlobalVariable(std::move(var));
+ mod()->AddGlobalVariable(var);
call_params->push_back(create<ast::IdentifierExpression>(name));
}
@@ -1872,7 +1804,7 @@
add_call_param("lod", &i32, &call_params);
ast::CallExpression expr(create<ast::IdentifierExpression>("textureLoad"),
- std::move(call_params));
+ call_params);
EXPECT_TRUE(td()->Determine());
EXPECT_TRUE(td()->DetermineResultType(&expr));
@@ -1942,7 +1874,7 @@
add_call_param("lod", &i32, &call_params);
ast::CallExpression expr(create<ast::IdentifierExpression>("textureLoad"),
- std::move(call_params));
+ call_params);
EXPECT_TRUE(td()->Determine());
EXPECT_TRUE(td()->DetermineResultType(&expr));
@@ -1978,7 +1910,7 @@
add_call_param("coords", coords_type.get(), &call_params);
ast::CallExpression expr(create<ast::IdentifierExpression>("textureSample"),
- std::move(call_params));
+ call_params);
EXPECT_TRUE(td()->Determine());
EXPECT_TRUE(td()->DetermineResultType(&expr));
@@ -2015,8 +1947,7 @@
add_call_param("lod", &f32, &call_params);
ast::CallExpression expr(
- create<ast::IdentifierExpression>("textureSampleLevel"),
- std::move(call_params));
+ create<ast::IdentifierExpression>("textureSampleLevel"), call_params);
EXPECT_TRUE(td()->Determine());
EXPECT_TRUE(td()->DetermineResultType(&expr));
@@ -2053,8 +1984,7 @@
add_call_param("bias", &f32, &call_params);
ast::CallExpression expr(
- create<ast::IdentifierExpression>("textureSampleBias"),
- std::move(call_params));
+ create<ast::IdentifierExpression>("textureSampleBias"), call_params);
EXPECT_TRUE(td()->Determine());
EXPECT_TRUE(td()->DetermineResultType(&expr));
@@ -2127,8 +2057,7 @@
add_call_param("depth_reference", &f32, &call_params);
ast::CallExpression expr(
- create<ast::IdentifierExpression>("textureSampleCompare"),
- std::move(call_params));
+ create<ast::IdentifierExpression>("textureSampleCompare"), call_params);
EXPECT_TRUE(td()->Determine());
EXPECT_TRUE(td()->DetermineResultType(&expr));
@@ -2151,14 +2080,14 @@
ast::type::VectorType vec3(&f32, 3);
auto* var = create<ast::Variable>("my_var", ast::StorageClass::kNone, &vec3);
- mod()->AddGlobalVariable(std::move(var));
+ mod()->AddGlobalVariable(var);
ast::ExpressionList call_params;
call_params.push_back(create<ast::IdentifierExpression>("my_var"));
call_params.push_back(create<ast::IdentifierExpression>("my_var"));
ast::CallExpression expr(create<ast::IdentifierExpression>("dot"),
- std::move(call_params));
+ call_params);
// Register the variable
EXPECT_TRUE(td()->Determine());
@@ -2176,8 +2105,8 @@
auto* var = create<ast::Variable>("my_var", ast::StorageClass::kNone, &vec3);
auto* bool_var =
create<ast::Variable>("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<ast::IdentifierExpression>("my_var"));
@@ -2185,7 +2114,7 @@
call_params.push_back(create<ast::IdentifierExpression>("bool_var"));
ast::CallExpression expr(create<ast::IdentifierExpression>("select"),
- std::move(call_params));
+ call_params);
// Register the variable
EXPECT_TRUE(td()->Determine());
@@ -2201,13 +2130,13 @@
ast::type::VectorType vec3(&f32, 3);
auto* var = create<ast::Variable>("v", ast::StorageClass::kNone, &vec3);
- mod()->AddGlobalVariable(std::move(var));
+ mod()->AddGlobalVariable(var);
ast::ExpressionList call_params;
call_params.push_back(create<ast::IdentifierExpression>("v"));
ast::CallExpression expr(create<ast::IdentifierExpression>("select"),
- std::move(call_params));
+ call_params);
// Register the variable
EXPECT_TRUE(td()->Determine());
@@ -2221,7 +2150,7 @@
ast::type::VectorType vec3(&f32, 3);
auto* var = create<ast::Variable>("v", ast::StorageClass::kNone, &vec3);
- mod()->AddGlobalVariable(std::move(var));
+ mod()->AddGlobalVariable(var);
ast::ExpressionList call_params;
call_params.push_back(create<ast::IdentifierExpression>("v"));
@@ -2230,7 +2159,7 @@
call_params.push_back(create<ast::IdentifierExpression>("v"));
ast::CallExpression expr(create<ast::IdentifierExpression>("select"),
- std::move(call_params));
+ call_params);
// Register the variable
EXPECT_TRUE(td()->Determine());
@@ -2246,15 +2175,15 @@
auto* var1 = create<ast::Variable>("v3", ast::StorageClass::kNone, &vec3);
auto* var2 = create<ast::Variable>("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<ast::IdentifierExpression>("v3"));
call_params.push_back(create<ast::IdentifierExpression>("v2"));
ast::CallExpression expr(create<ast::IdentifierExpression>("outerProduct"),
- std::move(call_params));
+ call_params);
// Register the variable
EXPECT_TRUE(td()->Determine());
@@ -2275,13 +2204,13 @@
ast::type::VectorType vec2(&f32, 2);
auto* var2 = create<ast::Variable>("v2", ast::StorageClass::kNone, &vec2);
- mod()->AddGlobalVariable(std::move(var2));
+ mod()->AddGlobalVariable(var2);
ast::ExpressionList call_params;
call_params.push_back(create<ast::IdentifierExpression>("v2"));
ast::CallExpression expr(create<ast::IdentifierExpression>("outerProduct"),
- std::move(call_params));
+ call_params);
// Register the variable
EXPECT_TRUE(td()->Determine());
@@ -2295,7 +2224,7 @@
ast::type::VectorType vec2(&f32, 2);
auto* var2 = create<ast::Variable>("v2", ast::StorageClass::kNone, &vec2);
- mod()->AddGlobalVariable(std::move(var2));
+ mod()->AddGlobalVariable(var2);
ast::ExpressionList call_params;
call_params.push_back(create<ast::IdentifierExpression>("v2"));
@@ -2303,7 +2232,7 @@
call_params.push_back(create<ast::IdentifierExpression>("v2"));
ast::CallExpression expr(create<ast::IdentifierExpression>("outerProduct"),
- std::move(call_params));
+ call_params);
// Register the variable
EXPECT_TRUE(td()->Determine());
@@ -2320,7 +2249,7 @@
ast::type::VectorType vec4(&f32, 4);
auto* var = create<ast::Variable>("ident", ast::StorageClass::kNone, &vec4);
- mod()->AddGlobalVariable(std::move(var));
+ mod()->AddGlobalVariable(var);
// Register the global
EXPECT_TRUE(td()->Determine());
@@ -2341,18 +2270,16 @@
ast::type::I32Type i32;
auto* var = create<ast::Variable>("var", ast::StorageClass::kNone, &i32);
- auto* var_ptr = var;
- auto* stmt = create<ast::VariableDeclStatement>(std::move(var));
+ auto* stmt = create<ast::VariableDeclStatement>(var);
auto* body = create<ast::BlockStatement>();
- body->append(std::move(stmt));
- auto* func =
- create<ast::Function>("func", ast::VariableList{}, &i32, std::move(body));
+ body->append(stmt);
+ auto* func = create<ast::Function>("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 @@
auto* var = create<ast::Variable>("var", ast::StorageClass::kNone, &i32);
var->set_is_const(true);
- auto* var_ptr = var;
- auto* stmt = create<ast::VariableDeclStatement>(std::move(var));
+ auto* stmt = create<ast::VariableDeclStatement>(var);
auto* body = create<ast::BlockStatement>();
- body->append(std::move(stmt));
- auto* func =
- create<ast::Function>("func", ast::VariableList{}, &i32, std::move(body));
+ body->append(stmt);
+ auto* func = create<ast::Function>("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<ast::Variable>("var", ast::StorageClass::kWorkgroup, &i32);
- auto* stmt = create<ast::VariableDeclStatement>(std::move(var));
+ auto* stmt = create<ast::VariableDeclStatement>(var);
auto* body = create<ast::BlockStatement>();
- body->append(std::move(stmt));
- auto* func =
- create<ast::Function>("func", ast::VariableList{}, &i32, std::move(body));
+ body->append(stmt);
+ auto* func = create<ast::Function>("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 @@
create<ast::FloatLiteral>(&f32, 1.f)));
auto* ident = create<ast::IdentifierExpression>(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 @@
create<ast::FloatLiteral>(&f32, 3.0f)));
ast::ExpressionList params;
- params.push_back(
- create<ast::TypeConstructorExpression>(&vec, std::move(vals)));
+ params.push_back(create<ast::TypeConstructorExpression>(&vec, vals));
auto* ident = create<ast::IdentifierExpression>(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 @@
create<ast::SintLiteral>(&i32, 1)));
auto* ident = create<ast::IdentifierExpression>(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 @@
ast::ExpressionList params;
auto* ident = create<ast::IdentifierExpression>(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 @@
create<ast::FloatLiteral>(&f32, 1.f)));
auto* ident = create<ast::IdentifierExpression>(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 @@
create<ast::FloatLiteral>(&f32, 1.f)));
auto* ident = create<ast::IdentifierExpression>(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 @@
create<ast::FloatLiteral>(&f32, 3.0f)));
ast::ExpressionList params;
- params.push_back(
- create<ast::TypeConstructorExpression>(&vec, std::move(vals)));
+ params.push_back(create<ast::TypeConstructorExpression>(&vec, vals));
auto* ident = create<ast::IdentifierExpression>(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 @@
create<ast::SintLiteral>(&i32, -11)));
auto* ident = create<ast::IdentifierExpression>(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 @@
create<ast::SintLiteral>(&i32, 3)));
ast::ExpressionList params;
- params.push_back(
- create<ast::TypeConstructorExpression>(&vec, std::move(vals)));
+ params.push_back(create<ast::TypeConstructorExpression>(&vec, vals));
auto* ident = create<ast::IdentifierExpression>(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 @@
create<ast::UintLiteral>(&u32, 1)));
auto* ident = create<ast::IdentifierExpression>(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 @@
create<ast::UintLiteral>(&u32, 3.0f)));
ast::ExpressionList params;
- params.push_back(
- create<ast::TypeConstructorExpression>(&vec, std::move(vals)));
+ params.push_back(create<ast::TypeConstructorExpression>(&vec, vals));
auto* ident = create<ast::IdentifierExpression>(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 @@
create<ast::BoolLiteral>(&bool_type, false)));
auto* ident = create<ast::IdentifierExpression>(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 @@
ast::ExpressionList params;
auto* ident = create<ast::IdentifierExpression>(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 @@
create<ast::FloatLiteral>(&f32, 1.f)));
auto* ident = create<ast::IdentifierExpression>(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 @@
ASSERT_TRUE(td()->DetermineResultType(params)) << td()->error();
auto* ident = create<ast::IdentifierExpression>("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 @@
create<ast::FloatLiteral>(&f32, 3.0f)));
ast::ExpressionList params;
- params.push_back(
- create<ast::TypeConstructorExpression>(&vec, std::move(vals)));
+ params.push_back(create<ast::TypeConstructorExpression>(&vec, vals));
auto* ident = create<ast::IdentifierExpression>("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 @@
create<ast::SintLiteral>(&i32, 1)));
auto* ident = create<ast::IdentifierExpression>("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 @@
ast::ExpressionList params;
auto* ident = create<ast::IdentifierExpression>("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 @@
create<ast::FloatLiteral>(&f32, 1.f)));
auto* ident = create<ast::IdentifierExpression>("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 @@
create<ast::FloatLiteral>(&f32, 1.f)));
auto* ident = create<ast::IdentifierExpression>(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 @@
create<ast::FloatLiteral>(&f32, 3.0f)));
ast::ExpressionList params;
- params.push_back(
- create<ast::TypeConstructorExpression>(&vec, std::move(vals_1)));
- params.push_back(
- create<ast::TypeConstructorExpression>(&vec, std::move(vals_2)));
+ params.push_back(create<ast::TypeConstructorExpression>(&vec, vals_1));
+ params.push_back(create<ast::TypeConstructorExpression>(&vec, vals_2));
auto* ident = create<ast::IdentifierExpression>(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 @@
create<ast::SintLiteral>(&i32, 2)));
auto* ident = create<ast::IdentifierExpression>(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 @@
ast::ExpressionList params;
auto* ident = create<ast::IdentifierExpression>(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 @@
create<ast::FloatLiteral>(&f32, 1.f)));
auto* ident = create<ast::IdentifierExpression>(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 @@
create<ast::FloatLiteral>(&f32, 3.0f)));
ast::ExpressionList params;
- params.push_back(
- create<ast::TypeConstructorExpression>(&vec2, std::move(vals_1)));
- params.push_back(
- create<ast::TypeConstructorExpression>(&vec3, std::move(vals_2)));
+ params.push_back(create<ast::TypeConstructorExpression>(&vec2, vals_1));
+ params.push_back(create<ast::TypeConstructorExpression>(&vec3, vals_2));
auto* ident = create<ast::IdentifierExpression>(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 @@
ast::ExpressionList params;
params.push_back(create<ast::ScalarConstructorExpression>(
create<ast::FloatLiteral>(&f32, 1.0f)));
- params.push_back(
- create<ast::TypeConstructorExpression>(&vec, std::move(vals)));
+ params.push_back(create<ast::TypeConstructorExpression>(&vec, vals));
auto* ident = create<ast::IdentifierExpression>(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 @@
create<ast::FloatLiteral>(&f32, 1.f)));
auto* ident = create<ast::IdentifierExpression>(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 @@
create<ast::FloatLiteral>(&f32, 1.f)));
auto* ident = create<ast::IdentifierExpression>("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 @@
create<ast::FloatLiteral>(&f32, 3.0f)));
ast::ExpressionList params;
- params.push_back(
- create<ast::TypeConstructorExpression>(&vec, std::move(vals_1)));
- params.push_back(
- create<ast::TypeConstructorExpression>(&vec, std::move(vals_2)));
+ params.push_back(create<ast::TypeConstructorExpression>(&vec, vals_1));
+ params.push_back(create<ast::TypeConstructorExpression>(&vec, vals_2));
auto* ident = create<ast::IdentifierExpression>("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 @@
create<ast::SintLiteral>(&i32, 2)));
auto* ident = create<ast::IdentifierExpression>("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 @@
ast::ExpressionList params;
auto* ident = create<ast::IdentifierExpression>("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 @@
create<ast::FloatLiteral>(&f32, 1.f)));
auto* ident = create<ast::IdentifierExpression>("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 @@
create<ast::FloatLiteral>(&f32, 3.0f)));
ast::ExpressionList params;
- params.push_back(
- create<ast::TypeConstructorExpression>(&vec2, std::move(vals_1)));
- params.push_back(
- create<ast::TypeConstructorExpression>(&vec3, std::move(vals_2)));
+ params.push_back(create<ast::TypeConstructorExpression>(&vec2, vals_1));
+ params.push_back(create<ast::TypeConstructorExpression>(&vec3, vals_2));
auto* ident = create<ast::IdentifierExpression>("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 @@
ast::ExpressionList params;
params.push_back(create<ast::ScalarConstructorExpression>(
create<ast::FloatLiteral>(&f32, 1.0f)));
- params.push_back(
- create<ast::TypeConstructorExpression>(&vec, std::move(vals)));
+ params.push_back(create<ast::TypeConstructorExpression>(&vec, vals));
auto* ident = create<ast::IdentifierExpression>("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 @@
create<ast::FloatLiteral>(&f32, 1.f)));
auto* ident = create<ast::IdentifierExpression>("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 @@
create<ast::FloatLiteral>(&f32, 3.0f)));
ast::ExpressionList params;
- params.push_back(
- create<ast::TypeConstructorExpression>(&vec, std::move(vals_1)));
- params.push_back(
- create<ast::TypeConstructorExpression>(&vec, std::move(vals_2)));
+ params.push_back(create<ast::TypeConstructorExpression>(&vec, vals_1));
+ params.push_back(create<ast::TypeConstructorExpression>(&vec, vals_2));
auto* ident = create<ast::IdentifierExpression>("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 @@
create<ast::FloatLiteral>(&f32, 1.0f)));
auto* ident = create<ast::IdentifierExpression>("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 @@
create<ast::SintLiteral>(&i32, 3)));
ast::ExpressionList params;
- params.push_back(
- create<ast::TypeConstructorExpression>(&vec, std::move(vals_1)));
- params.push_back(
- create<ast::TypeConstructorExpression>(&vec, std::move(vals_2)));
+ params.push_back(create<ast::TypeConstructorExpression>(&vec, vals_1));
+ params.push_back(create<ast::TypeConstructorExpression>(&vec, vals_2));
auto* ident = create<ast::IdentifierExpression>("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_MissingParams) {
ast::ExpressionList params;
auto* ident = create<ast::IdentifierExpression>("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 @@
create<ast::FloatLiteral>(&f32, 3.0f)));
ast::ExpressionList params;
- params.push_back(
- create<ast::TypeConstructorExpression>(&vec, std::move(vals_1)));
+ params.push_back(create<ast::TypeConstructorExpression>(&vec, vals_1));
auto* ident = create<ast::IdentifierExpression>("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 @@
create<ast::FloatLiteral>(&f32, 3.0f)));
ast::ExpressionList params;
- params.push_back(
- create<ast::TypeConstructorExpression>(&vec, std::move(vals_1)));
- params.push_back(
- create<ast::TypeConstructorExpression>(&vec, std::move(vals_2)));
- params.push_back(
- create<ast::TypeConstructorExpression>(&vec, std::move(vals_3)));
+ params.push_back(create<ast::TypeConstructorExpression>(&vec, vals_1));
+ params.push_back(create<ast::TypeConstructorExpression>(&vec, vals_2));
+ params.push_back(create<ast::TypeConstructorExpression>(&vec, vals_3));
auto* ident = create<ast::IdentifierExpression>("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 @@
create<ast::FloatLiteral>(&f32, 1.f)));
auto* ident = create<ast::IdentifierExpression>(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 @@
create<ast::FloatLiteral>(&f32, 3.0f)));
ast::ExpressionList params;
- params.push_back(
- create<ast::TypeConstructorExpression>(&vec, std::move(vals_1)));
- params.push_back(
- create<ast::TypeConstructorExpression>(&vec, std::move(vals_2)));
- params.push_back(
- create<ast::TypeConstructorExpression>(&vec, std::move(vals_3)));
+ params.push_back(create<ast::TypeConstructorExpression>(&vec, vals_1));
+ params.push_back(create<ast::TypeConstructorExpression>(&vec, vals_2));
+ params.push_back(create<ast::TypeConstructorExpression>(&vec, vals_3));
auto* ident = create<ast::IdentifierExpression>(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 @@
create<ast::SintLiteral>(&i32, 3)));
auto* ident = create<ast::IdentifierExpression>(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 @@
ast::ExpressionList params;
auto* ident = create<ast::IdentifierExpression>(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 @@
create<ast::FloatLiteral>(&f32, 1.f)));
auto* ident = create<ast::IdentifierExpression>(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 @@
create<ast::FloatLiteral>(&f32, 1.f)));
auto* ident = create<ast::IdentifierExpression>(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 @@
create<ast::FloatLiteral>(&f32, 3.0f)));
ast::ExpressionList params;
- params.push_back(
- create<ast::TypeConstructorExpression>(&vec2, std::move(vals_1)));
- params.push_back(
- create<ast::TypeConstructorExpression>(&vec3, std::move(vals_2)));
- params.push_back(
- create<ast::TypeConstructorExpression>(&vec3, std::move(vals_3)));
+ params.push_back(create<ast::TypeConstructorExpression>(&vec2, vals_1));
+ params.push_back(create<ast::TypeConstructorExpression>(&vec3, vals_2));
+ params.push_back(create<ast::TypeConstructorExpression>(&vec3, vals_3));
auto* ident = create<ast::IdentifierExpression>(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 @@
create<ast::FloatLiteral>(&f32, 1.0f)));
params.push_back(create<ast::ScalarConstructorExpression>(
create<ast::FloatLiteral>(&f32, 1.0f)));
- params.push_back(
- create<ast::TypeConstructorExpression>(&vec, std::move(vals)));
+ params.push_back(create<ast::TypeConstructorExpression>(&vec, vals));
auto* ident = create<ast::IdentifierExpression>(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 @@
create<ast::FloatLiteral>(&f32, 1.f)));
auto* ident = create<ast::IdentifierExpression>(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 @@
create<ast::FloatLiteral>(&f32, 1.f)));
auto* ident = create<ast::IdentifierExpression>(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 @@
create<ast::FloatLiteral>(&f32, 3.0f)));
ast::ExpressionList params;
- params.push_back(
- create<ast::TypeConstructorExpression>(&vec, std::move(vals_1)));
- params.push_back(
- create<ast::TypeConstructorExpression>(&vec, std::move(vals_2)));
- params.push_back(
- create<ast::TypeConstructorExpression>(&vec, std::move(vals_3)));
+ params.push_back(create<ast::TypeConstructorExpression>(&vec, vals_1));
+ params.push_back(create<ast::TypeConstructorExpression>(&vec, vals_2));
+ params.push_back(create<ast::TypeConstructorExpression>(&vec, vals_3));
auto* ident = create<ast::IdentifierExpression>(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 @@
create<ast::SintLiteral>(&i32, 1)));
auto* ident = create<ast::IdentifierExpression>(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 @@
create<ast::SintLiteral>(&i32, 3)));
ast::ExpressionList params;
- params.push_back(
- create<ast::TypeConstructorExpression>(&vec, std::move(vals_1)));
- params.push_back(
- create<ast::TypeConstructorExpression>(&vec, std::move(vals_2)));
- params.push_back(
- create<ast::TypeConstructorExpression>(&vec, std::move(vals_3)));
+ params.push_back(create<ast::TypeConstructorExpression>(&vec, vals_1));
+ params.push_back(create<ast::TypeConstructorExpression>(&vec, vals_2));
+ params.push_back(create<ast::TypeConstructorExpression>(&vec, vals_3));
auto* ident = create<ast::IdentifierExpression>(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 @@
create<ast::UintLiteral>(&u32, 1)));
auto* ident = create<ast::IdentifierExpression>(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 @@
create<ast::UintLiteral>(&u32, 3)));
ast::ExpressionList params;
- params.push_back(
- create<ast::TypeConstructorExpression>(&vec, std::move(vals_1)));
- params.push_back(
- create<ast::TypeConstructorExpression>(&vec, std::move(vals_2)));
- params.push_back(
- create<ast::TypeConstructorExpression>(&vec, std::move(vals_3)));
+ params.push_back(create<ast::TypeConstructorExpression>(&vec, vals_1));
+ params.push_back(create<ast::TypeConstructorExpression>(&vec, vals_2));
+ params.push_back(create<ast::TypeConstructorExpression>(&vec, vals_3));
auto* ident = create<ast::IdentifierExpression>(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 @@
create<ast::BoolLiteral>(&bool_type, true)));
auto* ident = create<ast::IdentifierExpression>(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 @@
ast::ExpressionList params;
auto* ident = create<ast::IdentifierExpression>(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 @@
create<ast::FloatLiteral>(&f32, 1.f)));
auto* ident = create<ast::IdentifierExpression>(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 @@
create<ast::FloatLiteral>(&f32, 1.f)));
auto* ident = create<ast::IdentifierExpression>(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 @@
create<ast::FloatLiteral>(&f32, 3.0f)));
ast::ExpressionList params;
- params.push_back(
- create<ast::TypeConstructorExpression>(&vec2, std::move(vals_1)));
- params.push_back(
- create<ast::TypeConstructorExpression>(&vec3, std::move(vals_2)));
- params.push_back(
- create<ast::TypeConstructorExpression>(&vec3, std::move(vals_3)));
+ params.push_back(create<ast::TypeConstructorExpression>(&vec2, vals_1));
+ params.push_back(create<ast::TypeConstructorExpression>(&vec3, vals_2));
+ params.push_back(create<ast::TypeConstructorExpression>(&vec3, vals_3));
auto* ident = create<ast::IdentifierExpression>(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 @@
create<ast::FloatLiteral>(&f32, 1.0f)));
params.push_back(create<ast::ScalarConstructorExpression>(
create<ast::FloatLiteral>(&f32, 1.0f)));
- params.push_back(
- create<ast::TypeConstructorExpression>(&vec, std::move(vals)));
+ params.push_back(create<ast::TypeConstructorExpression>(&vec, vals));
auto* ident = create<ast::IdentifierExpression>(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 @@
create<ast::FloatLiteral>(&f32, 1.f)));
auto* ident = create<ast::IdentifierExpression>(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 @@
create<ast::SintLiteral>(&i32, 1)));
auto* ident = create<ast::IdentifierExpression>(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 @@
create<ast::SintLiteral>(&i32, 3)));
ast::ExpressionList params;
- params.push_back(
- create<ast::TypeConstructorExpression>(&vec, std::move(vals)));
+ params.push_back(create<ast::TypeConstructorExpression>(&vec, vals));
auto* ident = create<ast::IdentifierExpression>(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 @@
create<ast::FloatLiteral>(&f32, 1.f)));
auto* ident = create<ast::IdentifierExpression>(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 @@
ast::ExpressionList params;
auto* ident = create<ast::IdentifierExpression>(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 @@
create<ast::SintLiteral>(&i32, 1)));
auto* ident = create<ast::IdentifierExpression>(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 @@
create<ast::SintLiteral>(&i32, 1)));
auto* ident = create<ast::IdentifierExpression>(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 @@
create<ast::UintLiteral>(&u32, 1)));
auto* ident = create<ast::IdentifierExpression>(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 @@
create<ast::FloatLiteral>(&f32, 1)));
auto* ident = create<ast::IdentifierExpression>(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 @@
create<ast::SintLiteral>(&i32, 3)));
ast::ExpressionList params;
- params.push_back(
- create<ast::TypeConstructorExpression>(&vec, std::move(vals_1)));
- params.push_back(
- create<ast::TypeConstructorExpression>(&vec, std::move(vals_2)));
+ params.push_back(create<ast::TypeConstructorExpression>(&vec, vals_1));
+ params.push_back(create<ast::TypeConstructorExpression>(&vec, vals_2));
auto* ident = create<ast::IdentifierExpression>(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 @@
create<ast::UintLiteral>(&u32, 3)));
ast::ExpressionList params;
- params.push_back(
- create<ast::TypeConstructorExpression>(&vec, std::move(vals_1)));
- params.push_back(
- create<ast::TypeConstructorExpression>(&vec, std::move(vals_2)));
+ params.push_back(create<ast::TypeConstructorExpression>(&vec, vals_1));
+ params.push_back(create<ast::TypeConstructorExpression>(&vec, vals_2));
auto* ident = create<ast::IdentifierExpression>(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 @@
create<ast::FloatLiteral>(&f32, 3)));
ast::ExpressionList params;
- params.push_back(
- create<ast::TypeConstructorExpression>(&vec, std::move(vals_1)));
- params.push_back(
- create<ast::TypeConstructorExpression>(&vec, std::move(vals_2)));
+ params.push_back(create<ast::TypeConstructorExpression>(&vec, vals_1));
+ params.push_back(create<ast::TypeConstructorExpression>(&vec, vals_2));
auto* ident = create<ast::IdentifierExpression>(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 @@
create<ast::BoolLiteral>(&bool_type, false)));
auto* ident = create<ast::IdentifierExpression>(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 @@
ast::ExpressionList params;
auto* ident = create<ast::IdentifierExpression>(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 @@
create<ast::SintLiteral>(&i32, 1)));
auto* ident = create<ast::IdentifierExpression>(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 @@
create<ast::SintLiteral>(&i32, 3)));
ast::ExpressionList params;
- params.push_back(
- create<ast::TypeConstructorExpression>(&vec2, std::move(vals_1)));
- params.push_back(
- create<ast::TypeConstructorExpression>(&vec3, std::move(vals_2)));
+ params.push_back(create<ast::TypeConstructorExpression>(&vec2, vals_1));
+ params.push_back(create<ast::TypeConstructorExpression>(&vec3, vals_2));
auto* ident = create<ast::IdentifierExpression>(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 @@
ast::ExpressionList params;
params.push_back(create<ast::ScalarConstructorExpression>(
create<ast::SintLiteral>(&i32, 1)));
- params.push_back(
- create<ast::TypeConstructorExpression>(&vec, std::move(vals)));
+ params.push_back(create<ast::TypeConstructorExpression>(&vec, vals));
auto* ident = create<ast::IdentifierExpression>(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 @@
create<ast::SintLiteral>(&i32, 1)));
auto* ident = create<ast::IdentifierExpression>(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 @@
ast::type::MatrixType mat(&f32, 3, 3);
auto* var = create<ast::Variable>("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 @@
params.push_back(create<ast::IdentifierExpression>("var"));
auto* ident = create<ast::IdentifierExpression>("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 @@
ast::type::F32Type f32;
auto* var = create<ast::Variable>("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 @@
params.push_back(create<ast::IdentifierExpression>("var"));
auto* ident = create<ast::IdentifierExpression>(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 @@
ast::ExpressionList params;
auto* ident = create<ast::IdentifierExpression>(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 @@
ast::type::MatrixType mat(&f32, 3, 3);
auto* var = create<ast::Variable>("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 @@
params.push_back(create<ast::IdentifierExpression>("var"));
auto* ident = create<ast::IdentifierExpression>(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 @@
ast::VariableList params;
auto* body = create<ast::BlockStatement>();
- auto* func_b =
- create<ast::Function>("b", std::move(params), &f32, std::move(body));
- auto* func_b_ptr = func_b;
+ auto* func_b = create<ast::Function>("b", params, &f32, body);
body = create<ast::BlockStatement>();
body->append(create<ast::AssignmentStatement>(
create<ast::IdentifierExpression>("second"),
create<ast::CallExpression>(create<ast::IdentifierExpression>("b"),
ast::ExpressionList{})));
- auto* func_c =
- create<ast::Function>("c", std::move(params), &f32, std::move(body));
- auto* func_c_ptr = func_c;
+ auto* func_c = create<ast::Function>("c", params, &f32, body);
body = create<ast::BlockStatement>();
body->append(create<ast::AssignmentStatement>(
create<ast::IdentifierExpression>("first"),
create<ast::CallExpression>(create<ast::IdentifierExpression>("c"),
ast::ExpressionList{})));
- auto* func_a =
- create<ast::Function>("a", std::move(params), &f32, std::move(body));
- auto* func_a_ptr = func_a;
+ auto* func_a = create<ast::Function>("a", params, &f32, body);
body = create<ast::BlockStatement>();
body->append(create<ast::AssignmentStatement>(
@@ -4617,28 +4482,24 @@
create<ast::IdentifierExpression>("call_b"),
create<ast::CallExpression>(create<ast::IdentifierExpression>("b"),
ast::ExpressionList{})));
- auto* ep_1 =
- create<ast::Function>("ep_1", std::move(params), &f32, std::move(body));
+ auto* ep_1 = create<ast::Function>("ep_1", params, &f32, body);
ep_1->add_decoration(
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}));
- auto* ep_1_ptr = ep_1;
body = create<ast::BlockStatement>();
body->append(create<ast::AssignmentStatement>(
create<ast::IdentifierExpression>("call_c"),
create<ast::CallExpression>(create<ast::IdentifierExpression>("c"),
ast::ExpressionList{})));
- auto* ep_2 =
- create<ast::Function>("ep_2", std::move(params), &f32, std::move(body));
+ auto* ep_2 = create<ast::Function>("ep_2", params, &f32, body);
ep_2->add_decoration(
create<ast::StageDecoration>(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<ast::Variable>("first", ast::StorageClass::kPrivate, &f32));
@@ -4654,22 +4515,22 @@
// 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 5f8eb86..21f7a29d 100644
--- a/src/validator/validator_control_block_test.cc
+++ b/src/validator/validator_control_block_test.cc
@@ -52,12 +52,11 @@
ast::CaseSelectorList default_csl;
auto* block_default = create<ast::BlockStatement>();
ast::CaseStatementList body;
- body.push_back(create<ast::CaseStatement>(std::move(default_csl),
- std::move(block_default)));
+ body.push_back(create<ast::CaseStatement>(default_csl, block_default));
auto* block = create<ast::BlockStatement>();
- block->append(create<ast::VariableDeclStatement>(std::move(var)));
- block->append(create<ast::SwitchStatement>(std::move(cond), std::move(body)));
+ block->append(create<ast::VariableDeclStatement>(var));
+ block->append(create<ast::SwitchStatement>(cond, body));
EXPECT_TRUE(td()->DetermineStatements(block)) << td()->error();
EXPECT_FALSE(v()->ValidateStatements(block));
@@ -80,13 +79,13 @@
ast::CaseSelectorList csl;
csl.push_back(create<ast::SintLiteral>(&i32, 1));
ast::CaseStatementList body;
- body.push_back(create<ast::CaseStatement>(std::move(csl),
- create<ast::BlockStatement>()));
+ body.push_back(
+ create<ast::CaseStatement>(csl, create<ast::BlockStatement>()));
auto* block = create<ast::BlockStatement>();
- block->append(create<ast::VariableDeclStatement>(std::move(var)));
+ block->append(create<ast::VariableDeclStatement>(var));
block->append(create<ast::SwitchStatement>(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 @@
ast::CaseSelectorList default_csl_1;
auto* block_default_1 = create<ast::BlockStatement>();
- switch_body.push_back(create<ast::CaseStatement>(std::move(default_csl_1),
- std::move(block_default_1)));
+ switch_body.push_back(
+ create<ast::CaseStatement>(default_csl_1, block_default_1));
ast::CaseSelectorList csl_case_1;
csl_case_1.push_back(create<ast::SintLiteral>(&i32, 1));
auto* block_case_1 = create<ast::BlockStatement>();
- switch_body.push_back(create<ast::CaseStatement>(std::move(csl_case_1),
- std::move(block_case_1)));
+ switch_body.push_back(create<ast::CaseStatement>(csl_case_1, block_case_1));
ast::CaseSelectorList default_csl_2;
auto* block_default_2 = create<ast::BlockStatement>();
- switch_body.push_back(create<ast::CaseStatement>(std::move(default_csl_2),
- std::move(block_default_2)));
+ switch_body.push_back(
+ create<ast::CaseStatement>(default_csl_2, block_default_2));
auto* block = create<ast::BlockStatement>();
- block->append(create<ast::VariableDeclStatement>(std::move(var)));
+ block->append(create<ast::VariableDeclStatement>(var));
block->append(create<ast::SwitchStatement>(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 @@
ast::CaseSelectorList csl;
csl.push_back(create<ast::UintLiteral>(&u32, 1));
switch_body.push_back(create<ast::CaseStatement>(
- Source{Source::Location{12, 34}}, std::move(csl),
- create<ast::BlockStatement>()));
+ Source{Source::Location{12, 34}}, csl, create<ast::BlockStatement>()));
ast::CaseSelectorList default_csl;
auto* block_default = create<ast::BlockStatement>();
- switch_body.push_back(create<ast::CaseStatement>(std::move(default_csl),
- std::move(block_default)));
+ switch_body.push_back(create<ast::CaseStatement>(default_csl, block_default));
auto* block = create<ast::BlockStatement>();
- block->append(create<ast::VariableDeclStatement>(std::move(var)));
- block->append(
- create<ast::SwitchStatement>(std::move(cond), std::move(switch_body)));
+ block->append(create<ast::VariableDeclStatement>(var));
+ block->append(create<ast::SwitchStatement>(cond, switch_body));
EXPECT_TRUE(td()->DetermineStatements(block)) << td()->error();
EXPECT_FALSE(v()->ValidateStatements(block));
@@ -197,18 +191,15 @@
ast::CaseSelectorList csl;
csl.push_back(create<ast::SintLiteral>(&i32, -1));
switch_body.push_back(create<ast::CaseStatement>(
- Source{Source::Location{12, 34}}, std::move(csl),
- create<ast::BlockStatement>()));
+ Source{Source::Location{12, 34}}, csl, create<ast::BlockStatement>()));
ast::CaseSelectorList default_csl;
auto* block_default = create<ast::BlockStatement>();
- switch_body.push_back(create<ast::CaseStatement>(std::move(default_csl),
- std::move(block_default)));
+ switch_body.push_back(create<ast::CaseStatement>(default_csl, block_default));
auto* block = create<ast::BlockStatement>();
- block->append(create<ast::VariableDeclStatement>(std::move(var)));
- block->append(
- create<ast::SwitchStatement>(std::move(cond), std::move(switch_body)));
+ block->append(create<ast::VariableDeclStatement>(var));
+ block->append(create<ast::SwitchStatement>(cond, switch_body));
EXPECT_TRUE(td()->DetermineStatements(block)) << td()->error();
EXPECT_FALSE(v()->ValidateStatements(block));
@@ -234,25 +225,22 @@
ast::CaseSelectorList csl_1;
csl_1.push_back(create<ast::UintLiteral>(&u32, 0));
- switch_body.push_back(create<ast::CaseStatement>(
- std::move(csl_1), create<ast::BlockStatement>()));
+ switch_body.push_back(
+ create<ast::CaseStatement>(csl_1, create<ast::BlockStatement>()));
ast::CaseSelectorList csl_2;
csl_2.push_back(create<ast::UintLiteral>(&u32, 2));
csl_2.push_back(create<ast::UintLiteral>(&u32, 2));
switch_body.push_back(create<ast::CaseStatement>(
- Source{Source::Location{12, 34}}, std::move(csl_2),
- create<ast::BlockStatement>()));
+ Source{Source::Location{12, 34}}, csl_2, create<ast::BlockStatement>()));
ast::CaseSelectorList default_csl;
auto* block_default = create<ast::BlockStatement>();
- switch_body.push_back(create<ast::CaseStatement>(std::move(default_csl),
- std::move(block_default)));
+ switch_body.push_back(create<ast::CaseStatement>(default_csl, block_default));
auto* block = create<ast::BlockStatement>();
- block->append(create<ast::VariableDeclStatement>(std::move(var)));
- block->append(
- create<ast::SwitchStatement>(std::move(cond), std::move(switch_body)));
+ block->append(create<ast::VariableDeclStatement>(var));
+ block->append(create<ast::SwitchStatement>(cond, switch_body));
EXPECT_TRUE(td()->DetermineStatements(block)) << td()->error();
EXPECT_FALSE(v()->ValidateStatements(block));
@@ -278,8 +266,8 @@
ast::CaseSelectorList csl_1;
csl_1.push_back(create<ast::SintLiteral>(&i32, 10));
- switch_body.push_back(create<ast::CaseStatement>(
- std::move(csl_1), create<ast::BlockStatement>()));
+ switch_body.push_back(
+ create<ast::CaseStatement>(csl_1, create<ast::BlockStatement>()));
ast::CaseSelectorList csl_2;
csl_2.push_back(create<ast::SintLiteral>(&i32, 0));
@@ -287,18 +275,15 @@
csl_2.push_back(create<ast::SintLiteral>(&i32, 2));
csl_2.push_back(create<ast::SintLiteral>(&i32, 10));
switch_body.push_back(create<ast::CaseStatement>(
- Source{Source::Location{12, 34}}, std::move(csl_2),
- create<ast::BlockStatement>()));
+ Source{Source::Location{12, 34}}, csl_2, create<ast::BlockStatement>()));
ast::CaseSelectorList default_csl;
auto* block_default = create<ast::BlockStatement>();
- switch_body.push_back(create<ast::CaseStatement>(std::move(default_csl),
- std::move(block_default)));
+ switch_body.push_back(create<ast::CaseStatement>(default_csl, block_default));
auto* block = create<ast::BlockStatement>();
- block->append(create<ast::VariableDeclStatement>(std::move(var)));
- block->append(
- create<ast::SwitchStatement>(std::move(cond), std::move(switch_body)));
+ block->append(create<ast::VariableDeclStatement>(var));
+ block->append(create<ast::SwitchStatement>(cond, switch_body));
EXPECT_TRUE(td()->DetermineStatements(block)) << td()->error();
EXPECT_FALSE(v()->ValidateStatements(block));
@@ -323,12 +308,11 @@
block_default->append(
create<ast::FallthroughStatement>(Source{Source::Location{12, 34}}));
ast::CaseStatementList body;
- body.push_back(create<ast::CaseStatement>(std::move(default_csl),
- std::move(block_default)));
+ body.push_back(create<ast::CaseStatement>(default_csl, block_default));
auto* block = create<ast::BlockStatement>();
- block->append(create<ast::VariableDeclStatement>(std::move(var)));
- block->append(create<ast::SwitchStatement>(std::move(cond), std::move(body)));
+ block->append(create<ast::VariableDeclStatement>(var));
+ block->append(create<ast::SwitchStatement>(cond, body));
EXPECT_TRUE(td()->DetermineStatements(block)) << td()->error();
EXPECT_FALSE(v()->ValidateStatements(block));
@@ -353,17 +337,15 @@
auto* block_default = create<ast::BlockStatement>();
ast::CaseStatementList body;
body.push_back(create<ast::CaseStatement>(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<ast::SintLiteral>(&i32, 5));
auto* block_case = create<ast::BlockStatement>();
- body.push_back(
- create<ast::CaseStatement>(std::move(case_csl), std::move(block_case)));
+ body.push_back(create<ast::CaseStatement>(case_csl, block_case));
auto* block = create<ast::BlockStatement>();
- block->append(create<ast::VariableDeclStatement>(std::move(var)));
- block->append(create<ast::SwitchStatement>(std::move(cond), std::move(body)));
+ block->append(create<ast::VariableDeclStatement>(var));
+ block->append(create<ast::SwitchStatement>(cond, body));
EXPECT_TRUE(td()->DetermineStatements(block)) << td()->error();
EXPECT_TRUE(v()->ValidateStatements(block)) << v()->error();
@@ -388,12 +370,11 @@
auto* block_default = create<ast::BlockStatement>();
ast::CaseStatementList body;
body.push_back(create<ast::CaseStatement>(Source{Source::Location{12, 34}},
- std::move(default_csl),
- std::move(block_default)));
+ default_csl, block_default));
auto* block = create<ast::BlockStatement>();
- block->append(create<ast::VariableDeclStatement>(std::move(var)));
- block->append(create<ast::SwitchStatement>(std::move(cond), std::move(body)));
+ block->append(create<ast::VariableDeclStatement>(var));
+ block->append(create<ast::SwitchStatement>(cond, body));
mod()->AddConstructedType(&my_int);
diff --git a/src/validator/validator_function_test.cc b/src/validator/validator_function_test.cc
index 7c431a0..6271fe3 100644
--- a/src/validator/validator_function_test.cc
+++ b/src/validator/validator_function_test.cc
@@ -46,13 +46,12 @@
ast::VariableList params;
ast::type::VoidType void_type;
auto* body = create<ast::BlockStatement>();
- body->append(create<ast::VariableDeclStatement>(std::move(var)));
- auto* func =
- create<ast::Function>(Source{Source::Location{12, 34}}, "func",
- std::move(params), &void_type, std::move(body));
+ body->append(create<ast::VariableDeclStatement>(var));
+ auto* func = create<ast::Function>(Source{Source::Location{12, 34}}, "func",
+ params, &void_type, body);
func->add_decoration(
create<ast::StageDecoration>(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 @@
// fn func -> void {}
ast::type::VoidType void_type;
ast::VariableList params;
- auto* func = create<ast::Function>(Source{Source::Location{12, 34}}, "func",
- std::move(params), &void_type,
- create<ast::BlockStatement>());
+ auto* func =
+ create<ast::Function>(Source{Source::Location{12, 34}}, "func", params,
+ &void_type, create<ast::BlockStatement>());
func->add_decoration(
create<ast::StageDecoration>(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 @@
ast::VariableList params;
ast::type::VoidType void_type;
auto* body = create<ast::BlockStatement>();
- body->append(create<ast::VariableDeclStatement>(std::move(var)));
+ body->append(create<ast::VariableDeclStatement>(var));
auto* func = create<ast::Function>(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 @@
ast::type::VoidType void_type;
ast::type::I32Type i32;
ast::VariableList params;
- auto* func = create<ast::Function>(Source{Source::Location{12, 34}}, "func",
- std::move(params), &i32,
- create<ast::BlockStatement>());
- mod()->AddFunction(std::move(func));
+ auto* func =
+ create<ast::Function>(Source{Source::Location{12, 34}}, "func", params,
+ &i32, create<ast::BlockStatement>());
+ mod()->AddFunction(func);
EXPECT_TRUE(td()->Determine()) << td()->error();
EXPECT_FALSE(v()->Validate(mod()));
@@ -123,11 +122,10 @@
auto* body = create<ast::BlockStatement>();
body->append(create<ast::ReturnStatement>());
- auto* func = create<ast::Function>("func", std::move(params), &void_type,
- std::move(body));
+ auto* func = create<ast::Function>("func", params, &void_type, body);
func->add_decoration(
create<ast::StageDecoration>(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 @@
create<ast::SintLiteral>(&i32, 2));
body->append(create<ast::ReturnStatement>(Source{Source::Location{12, 34}},
- std::move(return_expr)));
- auto* func = create<ast::Function>("func", std::move(params), &void_type,
- std::move(body));
- mod()->AddFunction(std::move(func));
+ return_expr));
+ auto* func = create<ast::Function>("func", params, &void_type, body);
+ mod()->AddFunction(func);
EXPECT_TRUE(td()->Determine()) << td()->error();
EXPECT_FALSE(v()->Validate(mod()));
@@ -166,10 +163,9 @@
create<ast::SintLiteral>(&i32, 2));
body->append(create<ast::ReturnStatement>(Source{Source::Location{12, 34}},
- std::move(return_expr)));
- auto* func =
- create<ast::Function>("func", std::move(params), &f32, std::move(body));
- mod()->AddFunction(std::move(func));
+ return_expr));
+ auto* func = create<ast::Function>("func", params, &f32, body);
+ mod()->AddFunction(func);
EXPECT_TRUE(td()->Determine()) << td()->error();
EXPECT_FALSE(v()->Validate(mod()));
@@ -190,22 +186,20 @@
auto* return_expr = create<ast::ScalarConstructorExpression>(
create<ast::SintLiteral>(&i32, 2));
- body->append(create<ast::ReturnStatement>(std::move(return_expr)));
- auto* func =
- create<ast::Function>("func", std::move(params), &i32, std::move(body));
+ body->append(create<ast::ReturnStatement>(return_expr));
+ auto* func = create<ast::Function>("func", params, &i32, body);
ast::VariableList params_copy;
auto* body_copy = create<ast::BlockStatement>();
auto* return_expr_copy = create<ast::ScalarConstructorExpression>(
create<ast::SintLiteral>(&i32, 2));
- body_copy->append(create<ast::ReturnStatement>(std::move(return_expr_copy)));
- auto* func_copy =
- create<ast::Function>(Source{Source::Location{12, 34}}, "func",
- std::move(params_copy), &i32, std::move(body_copy));
+ body_copy->append(create<ast::ReturnStatement>(return_expr_copy));
+ auto* func_copy = create<ast::Function>(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 @@
ast::ExpressionList call_params;
auto* call_expr = create<ast::CallExpression>(
Source{Source::Location{12, 34}},
- create<ast::IdentifierExpression>("func"), std::move(call_params));
+ create<ast::IdentifierExpression>("func"), call_params);
ast::VariableList params0;
auto* body0 = create<ast::BlockStatement>();
- body0->append(create<ast::CallStatement>(std::move(call_expr)));
+ body0->append(create<ast::CallStatement>(call_expr));
body0->append(create<ast::ReturnStatement>());
- auto* func0 =
- create<ast::Function>("func", std::move(params0), &f32, std::move(body0));
- mod()->AddFunction(std::move(func0));
+ auto* func0 = create<ast::Function>("func", params0, &f32, body0);
+ mod()->AddFunction(func0);
EXPECT_TRUE(td()->Determine()) << td()->error();
EXPECT_FALSE(v()->Validate(mod())) << v()->error();
@@ -241,18 +234,17 @@
ast::ExpressionList call_params;
auto* call_expr = create<ast::CallExpression>(
Source{Source::Location{12, 34}},
- create<ast::IdentifierExpression>("func"), std::move(call_params));
- var->set_constructor(std::move(call_expr));
+ create<ast::IdentifierExpression>("func"), call_params);
+ var->set_constructor(call_expr);
ast::VariableList params0;
auto* body0 = create<ast::BlockStatement>();
- body0->append(create<ast::VariableDeclStatement>(std::move(var)));
+ body0->append(create<ast::VariableDeclStatement>(var));
auto* return_expr = create<ast::ScalarConstructorExpression>(
create<ast::SintLiteral>(&i32, 2));
- body0->append(create<ast::ReturnStatement>(std::move(return_expr)));
- auto* func0 =
- create<ast::Function>("func", std::move(params0), &i32, std::move(body0));
- mod()->AddFunction(std::move(func0));
+ body0->append(create<ast::ReturnStatement>(return_expr));
+ auto* func0 = create<ast::Function>("func", params0, &i32, body0);
+ mod()->AddFunction(func0);
EXPECT_TRUE(td()->Determine()) << td()->error();
EXPECT_FALSE(v()->Validate(mod())) << v()->error();
@@ -268,14 +260,13 @@
create<ast::SintLiteral>(&i32, 0));
auto* body = create<ast::BlockStatement>();
- body->append(create<ast::ReturnStatement>(std::move(return_expr)));
- auto* func =
- create<ast::Function>(Source{Source::Location{12, 34}}, "vtx_main",
- std::move(params), &i32, std::move(body));
+ body->append(create<ast::ReturnStatement>(return_expr));
+ auto* func = create<ast::Function>(Source{Source::Location{12, 34}},
+ "vtx_main", params, &i32, body);
func->add_decoration(
create<ast::StageDecoration>(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 @@
params.push_back(create<ast::Variable>("a", ast::StorageClass::kNone, &i32));
auto* body = create<ast::BlockStatement>();
body->append(create<ast::ReturnStatement>());
- auto* func =
- create<ast::Function>(Source{Source::Location{12, 34}}, "vtx_func",
- std::move(params), &void_type, std::move(body));
+ auto* func = create<ast::Function>(Source{Source::Location{12, 34}},
+ "vtx_func", params, &void_type, body);
func->add_decoration(
create<ast::StageDecoration>(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 @@
ast::VariableList params;
auto* body = create<ast::BlockStatement>();
body->append(create<ast::ReturnStatement>());
- auto* func =
- create<ast::Function>(Source{Source::Location{12, 34}}, "main",
- std::move(params), &void_type, std::move(body));
+ auto* func = create<ast::Function>(Source{Source::Location{12, 34}}, "main",
+ params, &void_type, body);
func->add_decoration(
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}));
func->add_decoration(
create<ast::StageDecoration>(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 @@
ast::VariableList params;
auto* body = create<ast::BlockStatement>();
body->append(create<ast::ReturnStatement>());
- auto* func = create<ast::Function>("vtx_func", std::move(params), &void_type,
- std::move(body));
+ auto* func = create<ast::Function>("vtx_func", params, &void_type, body);
func->add_decoration(
create<ast::StageDecoration>(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 @@
ast::VariableList params;
auto* body = create<ast::BlockStatement>();
body->append(create<ast::ReturnStatement>());
- auto* func = create<ast::Function>("vtx_func", std::move(params), &void_type,
- std::move(body));
- mod()->AddFunction(std::move(func));
+ auto* func = create<ast::Function>("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 9edaf50..eccdde6 100644
--- a/src/validator/validator_impl.cc
+++ b/src/validator/validator_impl.cc
@@ -271,21 +271,19 @@
}
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<int32_t>(selector_ptr->type()->IsU32()
- ? selector_ptr->AsUint()->value()
- : selector_ptr->AsSint()->value());
+ auto v = static_cast<int32_t>(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 6b0b688..8b80ab3 100644
--- a/src/validator/validator_test.cc
+++ b/src/validator/validator_test.cc
@@ -67,8 +67,7 @@
auto* lhs = create<ast::ScalarConstructorExpression>(
create<ast::SintLiteral>(&i32, 1));
auto* rhs = create<ast::IdentifierExpression>("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 @@
auto* rhs = create<ast::ScalarConstructorExpression>(
create<ast::SintLiteral>(&i32, 2));
auto* assign = create<ast::AssignmentStatement>(
- 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 @@
auto* body = create<ast::BlockStatement>();
body->append(create<ast::AssignmentStatement>(
- 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 @@
create<ast::SintLiteral>(&i32, 2)));
auto* lhs = create<ast::IdentifierExpression>("a");
- auto* lhs_ptr = lhs;
auto* rhs = create<ast::ScalarConstructorExpression>(
create<ast::SintLiteral>(&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 @@
var->set_constructor(create<ast::ScalarConstructorExpression>(
create<ast::SintLiteral>(&i32, 2)));
auto* lhs = create<ast::IdentifierExpression>("a");
- auto* lhs_ptr = lhs;
auto* rhs = create<ast::ScalarConstructorExpression>(
create<ast::FloatLiteral>(&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 @@
create<ast::SintLiteral>(&i32, 2)));
auto* lhs = create<ast::IdentifierExpression>("a");
- auto* lhs_ptr = lhs;
auto* rhs = create<ast::ScalarConstructorExpression>(
create<ast::SintLiteral>(&i32, 2));
- auto* rhs_ptr = rhs;
auto* body = create<ast::BlockStatement>();
- body->append(create<ast::VariableDeclStatement>(std::move(var)));
+ body->append(create<ast::VariableDeclStatement>(var));
body->append(create<ast::AssignmentStatement>(
- 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 @@
var->set_constructor(create<ast::ScalarConstructorExpression>(
create<ast::SintLiteral>(&i32, 2)));
auto* lhs = create<ast::IdentifierExpression>("a");
- auto* lhs_ptr = lhs;
auto* rhs = create<ast::ScalarConstructorExpression>(
create<ast::FloatLiteral>(&f32, 2.3f));
- auto* rhs_ptr = rhs;
ast::BlockStatement block;
- block.append(create<ast::VariableDeclStatement>(std::move(var)));
+ block.append(create<ast::VariableDeclStatement>(var));
block.append(create<ast::AssignmentStatement>(
- 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 @@
auto* global_var =
create<ast::Variable>(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 @@
auto* global_var =
create<ast::Variable>(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 @@
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 @@
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 @@
create<ast::Variable>("global_var", ast::StorageClass::kPrivate, &f32);
global_var->set_constructor(create<ast::ScalarConstructorExpression>(
create<ast::FloatLiteral>(&f32, 2.1)));
- mod()->AddGlobalVariable(std::move(global_var));
+ mod()->AddGlobalVariable(global_var);
auto* lhs = create<ast::IdentifierExpression>(
Source{Source::Location{12, 34}}, "not_global_var");
@@ -299,11 +288,10 @@
ast::VariableList params;
auto* body = create<ast::BlockStatement>();
body->append(create<ast::AssignmentStatement>(
- Source{Source::Location{12, 34}}, std::move(lhs), std::move(rhs)));
+ Source{Source::Location{12, 34}}, lhs, rhs));
- auto* func = create<ast::Function>("my_func", std::move(params), &f32,
- std::move(body));
- mod()->AddFunction(std::move(func));
+ auto* func = create<ast::Function>("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 @@
create<ast::Variable>("global_var", ast::StorageClass::kPrivate, &f32);
global_var->set_constructor(create<ast::ScalarConstructorExpression>(
create<ast::FloatLiteral>(&f32, 2.1)));
- mod()->AddGlobalVariable(std::move(global_var));
+ mod()->AddGlobalVariable(global_var);
auto* lhs = create<ast::IdentifierExpression>("global_var");
auto* rhs = create<ast::ScalarConstructorExpression>(
@@ -332,13 +320,12 @@
auto* body = create<ast::BlockStatement>();
body->append(create<ast::AssignmentStatement>(
- Source{Source::Location{12, 34}}, std::move(lhs), std::move(rhs)));
+ Source{Source::Location{12, 34}}, lhs, rhs));
body->append(create<ast::ReturnStatement>());
- auto* func = create<ast::Function>("my_func", std::move(params), &void_type,
- std::move(body));
+ auto* func = create<ast::Function>("my_func", params, &void_type, body);
func->add_decoration(
create<ast::StageDecoration>(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 @@
auto* cond = create<ast::ScalarConstructorExpression>(
create<ast::BoolLiteral>(&bool_type, true));
auto* body = create<ast::BlockStatement>();
- body->append(create<ast::VariableDeclStatement>(std::move(var)));
+ body->append(create<ast::VariableDeclStatement>(var));
auto* lhs =
create<ast::IdentifierExpression>(Source{Source::Location{12, 34}}, "a");
- auto* lhs_ptr = lhs;
auto* rhs = create<ast::ScalarConstructorExpression>(
create<ast::FloatLiteral>(&f32, 3.14f));
- auto* rhs_ptr = rhs;
auto* outer_body = create<ast::BlockStatement>();
- outer_body->append(
- create<ast::IfStatement>(std::move(cond), std::move(body)));
+ outer_body->append(create<ast::IfStatement>(cond, body));
outer_body->append(create<ast::AssignmentStatement>(
- 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 @@
auto* lhs =
create<ast::IdentifierExpression>(Source{Source::Location{12, 34}}, "a");
- auto* lhs_ptr = lhs;
auto* rhs = create<ast::ScalarConstructorExpression>(
create<ast::FloatLiteral>(&f32, 3.14f));
- auto* rhs_ptr = rhs;
+
ast::type::BoolType bool_type;
auto* cond = create<ast::ScalarConstructorExpression>(
create<ast::BoolLiteral>(&bool_type, true));
auto* body = create<ast::BlockStatement>();
body->append(create<ast::AssignmentStatement>(
- Source{Source::Location{12, 34}}, std::move(lhs), std::move(rhs)));
+ Source{Source::Location{12, 34}}, lhs, rhs));
auto* outer_body = create<ast::BlockStatement>();
- outer_body->append(create<ast::VariableDeclStatement>(std::move(var)));
- outer_body->append(
- create<ast::IfStatement>(std::move(cond), std::move(body)));
+ outer_body->append(create<ast::VariableDeclStatement>(var));
+ outer_body->append(create<ast::IfStatement>(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 @@
create<ast::Variable>("global_var0", ast::StorageClass::kPrivate, &f32);
var0->set_constructor(create<ast::ScalarConstructorExpression>(
create<ast::FloatLiteral>(&f32, 0.1)));
- mod()->AddGlobalVariable(std::move(var0));
+ mod()->AddGlobalVariable(var0);
auto* var1 =
create<ast::Variable>(Source{Source::Location{12, 34}}, "global_var1",
ast::StorageClass::kPrivate, &f32);
var1->set_constructor(create<ast::ScalarConstructorExpression>(
create<ast::SintLiteral>(&i32, 0)));
- mod()->AddGlobalVariable(std::move(var1));
+ mod()->AddGlobalVariable(var1);
EXPECT_TRUE(v()->ValidateGlobalVariables(mod()->global_variables()))
<< v()->error();
@@ -444,14 +426,14 @@
create<ast::Variable>("global_var", ast::StorageClass::kPrivate, &f32);
var0->set_constructor(create<ast::ScalarConstructorExpression>(
create<ast::FloatLiteral>(&f32, 0.1)));
- mod()->AddGlobalVariable(std::move(var0));
+ mod()->AddGlobalVariable(var0);
auto* var1 =
create<ast::Variable>(Source{Source::Location{12, 34}}, "global_var",
ast::StorageClass::kPrivate, &f32);
var1->set_constructor(create<ast::ScalarConstructorExpression>(
create<ast::SintLiteral>(&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 @@
var->set_is_const(true);
auto* lhs = create<ast::IdentifierExpression>("a");
- auto* lhs_ptr = lhs;
auto* rhs = create<ast::ScalarConstructorExpression>(
create<ast::SintLiteral>(&i32, 2));
- auto* rhs_ptr = rhs;
auto* body = create<ast::BlockStatement>();
- body->append(create<ast::VariableDeclStatement>(std::move(var)));
+ body->append(create<ast::VariableDeclStatement>(var));
body->append(create<ast::AssignmentStatement>(
- 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 @@
create<ast::Variable>("a", ast::StorageClass::kPrivate, &f32);
global_var->set_constructor(create<ast::ScalarConstructorExpression>(
create<ast::FloatLiteral>(&f32, 2.1)));
- mod()->AddGlobalVariable(std::move(global_var));
+ mod()->AddGlobalVariable(global_var);
auto* var = create<ast::Variable>("a", ast::StorageClass::kNone, &f32);
var->set_constructor(create<ast::ScalarConstructorExpression>(
@@ -509,14 +489,13 @@
ast::VariableList params;
auto* body = create<ast::BlockStatement>();
body->append(create<ast::VariableDeclStatement>(
- Source{Source::Location{12, 34}}, std::move(var)));
- auto* func = create<ast::Function>("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<ast::Function>("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 @@
ast::VariableList params;
auto* body = create<ast::BlockStatement>();
- body->append(create<ast::VariableDeclStatement>(std::move(var)));
+ body->append(create<ast::VariableDeclStatement>(var));
body->append(create<ast::VariableDeclStatement>(
- Source{Source::Location{12, 34}}, std::move(var_a_float)));
- auto* func = create<ast::Function>("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<ast::Function>("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 @@
auto* cond = create<ast::ScalarConstructorExpression>(
create<ast::BoolLiteral>(&bool_type, true));
auto* body = create<ast::BlockStatement>();
- body->append(create<ast::VariableDeclStatement>(std::move(var)));
+ body->append(create<ast::VariableDeclStatement>(var));
auto* var_a_float =
create<ast::Variable>("a", ast::StorageClass::kNone, &f32);
@@ -576,10 +554,9 @@
create<ast::FloatLiteral>(&f32, 3.14)));
auto* outer_body = create<ast::BlockStatement>();
- outer_body->append(
- create<ast::IfStatement>(std::move(cond), std::move(body)));
+ outer_body->append(create<ast::IfStatement>(cond, body));
outer_body->append(create<ast::VariableDeclStatement>(
- 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 @@
create<ast::BoolLiteral>(&bool_type, true));
auto* body = create<ast::BlockStatement>();
body->append(create<ast::VariableDeclStatement>(
- Source{Source::Location{12, 34}}, std::move(var)));
+ Source{Source::Location{12, 34}}, var));
auto* outer_body = create<ast::BlockStatement>();
- outer_body->append(
- create<ast::VariableDeclStatement>(std::move(var_a_float)));
- outer_body->append(
- create<ast::IfStatement>(std::move(cond), std::move(body)));
+ outer_body->append(create<ast::VariableDeclStatement>(var_a_float));
+ outer_body->append(create<ast::IfStatement>(cond, body));
EXPECT_TRUE(td()->DetermineStatements(outer_body)) << td()->error();
EXPECT_FALSE(v()->ValidateStatements(outer_body));
@@ -636,23 +611,21 @@
ast::VariableList params0;
auto* body0 = create<ast::BlockStatement>();
body0->append(create<ast::VariableDeclStatement>(
- Source{Source::Location{12, 34}}, std::move(var0)));
+ Source{Source::Location{12, 34}}, var0));
body0->append(create<ast::ReturnStatement>());
- auto* func0 = create<ast::Function>("func0", std::move(params0), &void_type,
- std::move(body0));
+ auto* func0 = create<ast::Function>("func0", params0, &void_type, body0);
ast::VariableList params1;
auto* body1 = create<ast::BlockStatement>();
body1->append(create<ast::VariableDeclStatement>(
- Source{Source::Location{13, 34}}, std::move(var1)));
+ Source{Source::Location{13, 34}}, var1));
body1->append(create<ast::ReturnStatement>());
- auto* func1 = create<ast::Function>("func1", std::move(params1), &void_type,
- std::move(body1));
+ auto* func1 = create<ast::Function>("func1", params1, &void_type, body1);
func1->add_decoration(
create<ast::StageDecoration>(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 @@
td()->RegisterVariableForTesting(var);
auto* lhs = create<ast::IdentifierExpression>("a");
- auto* lhs_ptr = lhs;
auto* rhs = create<ast::ScalarConstructorExpression>(
create<ast::SintLiteral>(&i32, 2));
- auto* rhs_ptr = rhs;
auto* body = create<ast::BlockStatement>();
- body->append(create<ast::VariableDeclStatement>(std::move(var)));
+ body->append(create<ast::VariableDeclStatement>(var));
body->append(create<ast::AssignmentStatement>(
- 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 da36b1f..4dbe93a 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 @@
ast::type::I32Type i32;
ast::type::F32Type f32;
- ast::StructMemberList members;
- members.push_back(
- create<ast::StructMember>("a", &f32, ast::StructMemberDecorationList{}));
-
- ast::StructMemberDecorationList b_deco;
- b_deco.push_back(create<ast::StructMemberOffsetDecoration>(4, Source{}));
- members.push_back(create<ast::StructMember>("b", &i32, std::move(b_deco)));
-
auto* str = create<ast::Struct>();
- str->set_members(std::move(members));
+ str->set_members({
+ create<ast::StructMember>("a", &f32, ast::StructMemberDecorationList{}),
+ create<ast::StructMember>(
+ "b", &i32,
+ ast::StructMemberDecorationList{
+ create<ast::StructMemberOffsetDecoration>(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 a3e6e59..b803f8b 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 @@
TEST_F(HlslGeneratorImplTest_Expression, EmitExpression_ArrayAccessor) {
ast::type::I32Type i32;
auto* lit = create<ast::SintLiteral>(&i32, 5);
- auto* idx = create<ast::ScalarConstructorExpression>(std::move(lit));
+ auto* idx = create<ast::ScalarConstructorExpression>(lit);
auto* ary = create<ast::IdentifierExpression>("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 @@
auto* ary = create<ast::IdentifierExpression>("ary");
auto* idx = create<ast::IdentifierExpression>("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 bb13cc0..a34d9ac 100644
--- a/src/writer/hlsl/generator_impl_assign_test.cc
+++ b/src/writer/hlsl/generator_impl_assign_test.cc
@@ -30,7 +30,7 @@
TEST_F(HlslGeneratorImplTest_Assign, Emit_Assign) {
auto* lhs = create<ast::IdentifierExpression>("lhs");
auto* rhs = create<ast::IdentifierExpression>("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 ca333ca..23d76c5 100644
--- a/src/writer/hlsl/generator_impl_binary_test.cc
+++ b/src/writer/hlsl/generator_impl_binary_test.cc
@@ -57,7 +57,7 @@
auto* left = create<ast::IdentifierExpression>("left");
auto* right = create<ast::IdentifierExpression>("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 @@
auto* left = create<ast::IdentifierExpression>("left");
auto* right = create<ast::IdentifierExpression>("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 @@
ast::BinaryExpression expr(
ast::BinaryOp::kLogicalOr,
- create<ast::BinaryExpression>(ast::BinaryOp::kLogicalAnd, std::move(a),
- std::move(b)),
- create<ast::BinaryExpression>(ast::BinaryOp::kLogicalOr, std::move(c),
- std::move(d)));
+ create<ast::BinaryExpression>(ast::BinaryOp::kLogicalAnd, a, b),
+ create<ast::BinaryExpression>(ast::BinaryOp::kLogicalOr, c, d));
ASSERT_TRUE(gen.EmitExpression(pre, out, &expr)) << gen.error();
EXPECT_EQ(result(), "(_tint_tmp_0)");
@@ -134,8 +131,7 @@
auto* left = create<ast::IdentifierExpression>("left");
auto* right = create<ast::IdentifierExpression>("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 @@
body->append(
create<ast::ReturnStatement>(create<ast::ScalarConstructorExpression>(
create<ast::SintLiteral>(&i32, 3))));
- auto* else_stmt = create<ast::ElseStatement>(std::move(body));
+ auto* else_stmt = create<ast::ElseStatement>(body);
body = create<ast::BlockStatement>();
body->append(
@@ -171,11 +167,11 @@
create<ast::BinaryExpression>(ast::BinaryOp::kLogicalOr,
create<ast::IdentifierExpression>("b"),
create<ast::IdentifierExpression>("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<ast::BlockStatement>();
body->append(
@@ -186,8 +182,8 @@
create<ast::BinaryExpression>(ast::BinaryOp::kLogicalAnd,
create<ast::IdentifierExpression>("a"),
create<ast::IdentifierExpression>("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 @@
ast::ReturnStatement expr(create<ast::BinaryExpression>(
ast::BinaryOp::kLogicalOr,
- create<ast::BinaryExpression>(ast::BinaryOp::kLogicalAnd, std::move(a),
- std::move(b)),
- std::move(c)));
+ create<ast::BinaryExpression>(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 @@
auto* d = create<ast::IdentifierExpression>("d");
ast::AssignmentStatement expr(
- std::move(a),
+ a,
create<ast::BinaryExpression>(
ast::BinaryOp::kLogicalAnd,
- create<ast::BinaryExpression>(ast::BinaryOp::kLogicalOr, std::move(b),
- std::move(c)),
- std::move(d)));
+ create<ast::BinaryExpression>(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 @@
create<ast::Variable>("a", ast::StorageClass::kFunction, &bool_type);
var->set_constructor(create<ast::BinaryExpression>(
ast::BinaryOp::kLogicalOr,
- create<ast::BinaryExpression>(ast::BinaryOp::kLogicalAnd, std::move(b),
- std::move(c)),
- std::move(d)));
+ create<ast::BinaryExpression>(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 @@
auto* b = create<ast::IdentifierExpression>("b");
auto* c = create<ast::IdentifierExpression>("c");
- ast::BitcastExpression expr(
- &i32, create<ast::BinaryExpression>(
- ast::BinaryOp::kLogicalAnd, std::move(a),
- create<ast::BinaryExpression>(ast::BinaryOp::kLogicalOr,
- std::move(b), std::move(c))));
+ ast::BitcastExpression expr(&i32, create<ast::BinaryExpression>(
+ ast::BinaryOp::kLogicalAnd, a,
+ create<ast::BinaryExpression>(
+ 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 @@
auto* func = create<ast::Function>("foo", ast::VariableList{}, &void_type,
create<ast::BlockStatement>());
- mod.AddFunction(std::move(func));
+ mod.AddFunction(func);
ast::ExpressionList params;
params.push_back(create<ast::BinaryExpression>(
@@ -347,7 +336,7 @@
create<ast::IdentifierExpression>("d"))));
ast::CallStatement expr(create<ast::CallExpression>(
- create<ast::IdentifierExpression>("foo"), std::move(params)));
+ create<ast::IdentifierExpression>("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 d9b431c..1fa7d2e 100644
--- a/src/writer/hlsl/generator_impl_bitcast_test.cc
+++ b/src/writer/hlsl/generator_impl_bitcast_test.cc
@@ -32,7 +32,7 @@
TEST_F(HlslGeneratorImplTest_Bitcast, EmitExpression_Bitcast_Float) {
ast::type::F32Type f32;
auto* id = create<ast::IdentifierExpression>("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_Int) {
ast::type::I32Type i32;
auto* id = create<ast::IdentifierExpression>("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_Uint) {
ast::type::U32Type u32;
auto* id = create<ast::IdentifierExpression>("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 8f816a7..39f20ed 100644
--- a/src/writer/hlsl/generator_impl_call_test.cc
+++ b/src/writer/hlsl/generator_impl_call_test.cc
@@ -33,11 +33,11 @@
ast::type::VoidType void_type;
auto* id = create<ast::IdentifierExpression>("my_func");
- ast::CallExpression call(std::move(id), {});
+ ast::CallExpression call(id, {});
auto* func = create<ast::Function>("my_func", ast::VariableList{}, &void_type,
create<ast::BlockStatement>());
- 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 @@
ast::ExpressionList params;
params.push_back(create<ast::IdentifierExpression>("param1"));
params.push_back(create<ast::IdentifierExpression>("param2"));
- ast::CallExpression call(std::move(id), std::move(params));
+ ast::CallExpression call(id, params);
auto* func = create<ast::Function>("my_func", ast::VariableList{}, &void_type,
create<ast::BlockStatement>());
- 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 @@
ast::ExpressionList params;
params.push_back(create<ast::IdentifierExpression>("param1"));
params.push_back(create<ast::IdentifierExpression>("param2"));
- ast::CallStatement call(
- create<ast::CallExpression>(std::move(id), std::move(params)));
+ ast::CallStatement call(create<ast::CallExpression>(id, params));
auto* func = create<ast::Function>("my_func", ast::VariableList{}, &void_type,
create<ast::BlockStatement>());
- 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 a63a570..efff3e9 100644
--- a/src/writer/hlsl/generator_impl_case_test.cc
+++ b/src/writer/hlsl/generator_impl_case_test.cc
@@ -38,7 +38,7 @@
ast::CaseSelectorList lit;
lit.push_back(create<ast::SintLiteral>(&i32, 5));
- ast::CaseStatement c(std::move(lit), std::move(body));
+ ast::CaseStatement c(lit, body);
gen.increment_indent();
@@ -54,7 +54,7 @@
ast::CaseSelectorList lit;
lit.push_back(create<ast::SintLiteral>(&i32, 5));
- ast::CaseStatement c(std::move(lit), create<ast::BlockStatement>());
+ ast::CaseStatement c(lit, create<ast::BlockStatement>());
gen.increment_indent();
@@ -73,7 +73,7 @@
ast::CaseSelectorList lit;
lit.push_back(create<ast::SintLiteral>(&i32, 5));
- ast::CaseStatement c(std::move(lit), std::move(body));
+ ast::CaseStatement c(lit, body);
gen.increment_indent();
@@ -93,7 +93,7 @@
ast::CaseSelectorList lit;
lit.push_back(create<ast::SintLiteral>(&i32, 5));
lit.push_back(create<ast::SintLiteral>(&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_Default) {
auto* body = create<ast::BlockStatement>();
body->append(create<ast::BreakStatement>());
- 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 6052494..f2fbcde 100644
--- a/src/writer/hlsl/generator_impl_cast_test.cc
+++ b/src/writer/hlsl/generator_impl_cast_test.cc
@@ -34,7 +34,7 @@
ast::ExpressionList params;
params.push_back(create<ast::IdentifierExpression>("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 @@
ast::ExpressionList params;
params.push_back(create<ast::IdentifierExpression>("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<float, 3>(id)");
diff --git a/src/writer/hlsl/generator_impl_constructor_test.cc b/src/writer/hlsl/generator_impl_constructor_test.cc
index 02f307b..c0512e5 100644
--- a/src/writer/hlsl/generator_impl_constructor_test.cc
+++ b/src/writer/hlsl/generator_impl_constructor_test.cc
@@ -38,7 +38,7 @@
TEST_F(HlslGeneratorImplTest_Constructor, EmitConstructor_Bool) {
ast::type::BoolType bool_type;
auto* lit = create<ast::BoolLiteral>(&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_Int) {
ast::type::I32Type i32;
auto* lit = create<ast::SintLiteral>(&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_UInt) {
ast::type::U32Type u32;
auto* lit = create<ast::UintLiteral>(&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 @@
// Use a number close to 1<<30 but whose decimal representation ends in 0.
auto* lit =
create<ast::FloatLiteral>(&f32, static_cast<float>((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 @@
auto* lit = create<ast::FloatLiteral>(&f32, -1.2e-5);
ast::ExpressionList values;
- values.push_back(create<ast::ScalarConstructorExpression>(std::move(lit)));
+ values.push_back(create<ast::ScalarConstructorExpression>(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 @@
auto* lit = create<ast::BoolLiteral>(&b, true);
ast::ExpressionList values;
- values.push_back(create<ast::ScalarConstructorExpression>(std::move(lit)));
+ values.push_back(create<ast::ScalarConstructorExpression>(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 @@
auto* lit = create<ast::SintLiteral>(&i32, -12345);
ast::ExpressionList values;
- values.push_back(create<ast::ScalarConstructorExpression>(std::move(lit)));
+ values.push_back(create<ast::ScalarConstructorExpression>(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 @@
auto* lit = create<ast::UintLiteral>(&u32, 12345);
ast::ExpressionList values;
- values.push_back(create<ast::ScalarConstructorExpression>(std::move(lit)));
+ values.push_back(create<ast::ScalarConstructorExpression>(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 @@
auto* lit2 = create<ast::FloatLiteral>(&f32, 2.f);
auto* lit3 = create<ast::FloatLiteral>(&f32, 3.f);
ast::ExpressionList values;
- values.push_back(create<ast::ScalarConstructorExpression>(std::move(lit1)));
- values.push_back(create<ast::ScalarConstructorExpression>(std::move(lit2)));
- values.push_back(create<ast::ScalarConstructorExpression>(std::move(lit3)));
+ values.push_back(create<ast::ScalarConstructorExpression>(lit1));
+ values.push_back(create<ast::ScalarConstructorExpression>(lit2));
+ values.push_back(create<ast::ScalarConstructorExpression>(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 @@
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<float, 3>(0.0f)");
@@ -174,15 +174,14 @@
create<ast::FloatLiteral>(&f32, static_cast<float>(3 + (i * 2)));
ast::ExpressionList values;
- values.push_back(create<ast::ScalarConstructorExpression>(std::move(lit1)));
- values.push_back(create<ast::ScalarConstructorExpression>(std::move(lit2)));
- values.push_back(create<ast::ScalarConstructorExpression>(std::move(lit3)));
+ values.push_back(create<ast::ScalarConstructorExpression>(lit1));
+ values.push_back(create<ast::ScalarConstructorExpression>(lit2));
+ values.push_back(create<ast::ScalarConstructorExpression>(lit3));
- mat_values.push_back(
- create<ast::TypeConstructorExpression>(&vec, std::move(values)));
+ mat_values.push_back(create<ast::TypeConstructorExpression>(&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 @@
create<ast::FloatLiteral>(&f32, static_cast<float>(3 + (i * 3)));
ast::ExpressionList values;
- values.push_back(create<ast::ScalarConstructorExpression>(std::move(lit1)));
- values.push_back(create<ast::ScalarConstructorExpression>(std::move(lit2)));
- values.push_back(create<ast::ScalarConstructorExpression>(std::move(lit3)));
+ values.push_back(create<ast::ScalarConstructorExpression>(lit1));
+ values.push_back(create<ast::ScalarConstructorExpression>(lit2));
+ values.push_back(create<ast::ScalarConstructorExpression>(lit3));
- ary_values.push_back(
- create<ast::TypeConstructorExpression>(&vec, std::move(values)));
+ ary_values.push_back(create<ast::TypeConstructorExpression>(&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 8c0419a..9215cca 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 @@
auto* foo_var = create<ast::DecoratedVariable>(
create<ast::Variable>("foo", ast::StorageClass::kInput, &f32));
-
- ast::VariableDecorationList decos;
- decos.push_back(create<ast::LocationDecoration>(0, Source{}));
- foo_var->set_decorations(std::move(decos));
+ foo_var->set_decorations({create<ast::LocationDecoration>(0, Source{})});
auto* bar_var = create<ast::DecoratedVariable>(
create<ast::Variable>("bar", ast::StorageClass::kInput, &i32));
- decos.push_back(create<ast::LocationDecoration>(1, Source{}));
- bar_var->set_decorations(std::move(decos));
+ bar_var->set_decorations({create<ast::LocationDecoration>(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<ast::BlockStatement>();
@@ -80,18 +76,16 @@
create<ast::IdentifierExpression>("bar"),
create<ast::IdentifierExpression>("bar")));
- auto* func = create<ast::Function>("vtx_main", std::move(params), &f32,
- std::move(body));
+ auto* func = create<ast::Function>("vtx_main", params, &f32, body);
func->add_decoration(
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}));
- auto* func_ptr = func;
- mod.AddFunction(std::move(func));
+ mod.AddFunction(func);
std::unordered_set<std::string> 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 @@
auto* foo_var = create<ast::DecoratedVariable>(
create<ast::Variable>("foo", ast::StorageClass::kOutput, &f32));
-
- ast::VariableDecorationList decos;
- decos.push_back(create<ast::LocationDecoration>(0, Source{}));
- foo_var->set_decorations(std::move(decos));
+ foo_var->set_decorations({create<ast::LocationDecoration>(0, Source{})});
auto* bar_var = create<ast::DecoratedVariable>(
create<ast::Variable>("bar", ast::StorageClass::kOutput, &i32));
- decos.push_back(create<ast::LocationDecoration>(1, Source{}));
- bar_var->set_decorations(std::move(decos));
+ bar_var->set_decorations({create<ast::LocationDecoration>(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 @@
create<ast::IdentifierExpression>("bar"),
create<ast::IdentifierExpression>("bar")));
- auto* func = create<ast::Function>("vtx_main", std::move(params), &f32,
- std::move(body));
+ auto* func = create<ast::Function>("vtx_main", params, &f32, body);
func->add_decoration(
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}));
- auto* func_ptr = func;
- mod.AddFunction(std::move(func));
+ mod.AddFunction(func);
std::unordered_set<std::string> 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 @@
auto* foo_var = create<ast::DecoratedVariable>(
create<ast::Variable>("foo", ast::StorageClass::kInput, &f32));
-
- ast::VariableDecorationList decos;
- decos.push_back(create<ast::LocationDecoration>(0, Source{}));
- foo_var->set_decorations(std::move(decos));
+ foo_var->set_decorations({create<ast::LocationDecoration>(0, Source{})});
auto* bar_var = create<ast::DecoratedVariable>(
create<ast::Variable>("bar", ast::StorageClass::kInput, &i32));
- decos.push_back(create<ast::LocationDecoration>(1, Source{}));
- bar_var->set_decorations(std::move(decos));
+ bar_var->set_decorations({create<ast::LocationDecoration>(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 @@
create<ast::IdentifierExpression>("bar"),
create<ast::IdentifierExpression>("bar")));
- auto* func =
- create<ast::Function>("main", std::move(params), &f32, std::move(body));
+ auto* func = create<ast::Function>("main", params, &f32, body);
func->add_decoration(
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}));
- auto* func_ptr = func;
- mod.AddFunction(std::move(func));
+ mod.AddFunction(func);
std::unordered_set<std::string> 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 @@
auto* foo_var = create<ast::DecoratedVariable>(
create<ast::Variable>("foo", ast::StorageClass::kOutput, &f32));
-
- ast::VariableDecorationList decos;
- decos.push_back(create<ast::LocationDecoration>(0, Source{}));
- foo_var->set_decorations(std::move(decos));
+ foo_var->set_decorations({create<ast::LocationDecoration>(0, Source{})});
auto* bar_var = create<ast::DecoratedVariable>(
create<ast::Variable>("bar", ast::StorageClass::kOutput, &i32));
- decos.push_back(create<ast::LocationDecoration>(1, Source{}));
- bar_var->set_decorations(std::move(decos));
+ bar_var->set_decorations({create<ast::LocationDecoration>(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<ast::BlockStatement>();
@@ -262,18 +240,16 @@
create<ast::IdentifierExpression>("bar"),
create<ast::IdentifierExpression>("bar")));
- auto* func =
- create<ast::Function>("main", std::move(params), &f32, std::move(body));
+ auto* func = create<ast::Function>("main", params, &f32, body);
func->add_decoration(
create<ast::StageDecoration>(ast::PipelineStage::kFragment, Source{}));
- auto* func_ptr = func;
- mod.AddFunction(std::move(func));
+ mod.AddFunction(func);
std::unordered_set<std::string> 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 @@
ast::VariableDecorationList decos;
decos.push_back(create<ast::LocationDecoration>(0, Source{}));
- foo_var->set_decorations(std::move(decos));
+ foo_var->set_decorations(decos);
auto* bar_var = create<ast::DecoratedVariable>(
create<ast::Variable>("bar", ast::StorageClass::kInput, &i32));
decos.push_back(create<ast::LocationDecoration>(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<ast::BlockStatement>();
@@ -319,18 +295,16 @@
create<ast::IdentifierExpression>("bar"),
create<ast::IdentifierExpression>("bar")));
- auto* func =
- create<ast::Function>("main", std::move(params), &f32, std::move(body));
+ auto* func = create<ast::Function>("main", params, &f32, body);
func->add_decoration(
create<ast::StageDecoration>(ast::PipelineStage::kCompute, Source{}));
- auto* func_ptr = func;
- mod.AddFunction(std::move(func));
+ mod.AddFunction(func);
std::unordered_set<std::string> 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 @@
ast::VariableDecorationList decos;
decos.push_back(create<ast::LocationDecoration>(0, Source{}));
- foo_var->set_decorations(std::move(decos));
+ foo_var->set_decorations(decos);
auto* bar_var = create<ast::DecoratedVariable>(
create<ast::Variable>("bar", ast::StorageClass::kOutput, &i32));
decos.push_back(create<ast::LocationDecoration>(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<ast::BlockStatement>();
@@ -371,18 +345,16 @@
create<ast::IdentifierExpression>("bar"),
create<ast::IdentifierExpression>("bar")));
- auto* func =
- create<ast::Function>("main", std::move(params), &f32, std::move(body));
+ auto* func = create<ast::Function>("main", params, &f32, body);
func->add_decoration(
create<ast::StageDecoration>(ast::PipelineStage::kCompute, Source{}));
- auto* func_ptr = func;
- mod.AddFunction(std::move(func));
+ mod.AddFunction(func);
std::unordered_set<std::string> 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 @@
auto* coord_var = create<ast::DecoratedVariable>(
create<ast::Variable>("coord", ast::StorageClass::kInput, &vec4));
-
- ast::VariableDecorationList decos;
- decos.push_back(
- create<ast::BuiltinDecoration>(ast::Builtin::kFragCoord, Source{}));
- coord_var->set_decorations(std::move(decos));
+ coord_var->set_decorations(
+ {create<ast::BuiltinDecoration>(ast::Builtin::kFragCoord, Source{})});
auto* depth_var = create<ast::DecoratedVariable>(
create<ast::Variable>("depth", ast::StorageClass::kOutput, &f32));
- decos.push_back(
- create<ast::BuiltinDecoration>(ast::Builtin::kFragDepth, Source{}));
- depth_var->set_decorations(std::move(decos));
+ depth_var->set_decorations(
+ {create<ast::BuiltinDecoration>(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<ast::BlockStatement>();
@@ -431,18 +399,16 @@
create<ast::IdentifierExpression>("coord"),
create<ast::IdentifierExpression>("x"))));
- auto* func = create<ast::Function>("main", std::move(params), &void_type,
- std::move(body));
+ auto* func = create<ast::Function>("main", params, &void_type, body);
func->add_decoration(
create<ast::StageDecoration>(ast::PipelineStage::kFragment, Source{}));
- auto* func_ptr = func;
- mod.AddFunction(std::move(func));
+ mod.AddFunction(func);
std::unordered_set<std::string> 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<float, 4> coord : SV_Position;
};
diff --git a/src/writer/hlsl/generator_impl_function_test.cc b/src/writer/hlsl/generator_impl_function_test.cc
index d987ff3..9d84e94 100644
--- a/src/writer/hlsl/generator_impl_function_test.cc
+++ b/src/writer/hlsl/generator_impl_function_test.cc
@@ -59,10 +59,10 @@
auto* body = create<ast::BlockStatement>();
body->append(create<ast::ReturnStatement>());
- auto* func = create<ast::Function>("my_func", ast::VariableList{}, &void_type,
- std::move(body));
+ auto* func =
+ create<ast::Function>("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 @@
auto* body = create<ast::BlockStatement>();
body->append(create<ast::ReturnStatement>());
auto* func = create<ast::Function>("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 @@
auto* body = create<ast::BlockStatement>();
body->append(create<ast::ReturnStatement>());
- auto* func = create<ast::Function>("my_func", std::move(params), &void_type,
- std::move(body));
+ auto* func = create<ast::Function>("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 @@
auto* foo_var = create<ast::DecoratedVariable>(
create<ast::Variable>("foo", ast::StorageClass::kInput, &f32));
-
- ast::VariableDecorationList decos;
- decos.push_back(create<ast::LocationDecoration>(0, Source{}));
- foo_var->set_decorations(std::move(decos));
+ foo_var->set_decorations({create<ast::LocationDecoration>(0, Source{})});
auto* bar_var = create<ast::DecoratedVariable>(
create<ast::Variable>("bar", ast::StorageClass::kOutput, &f32));
- decos.push_back(create<ast::LocationDecoration>(1, Source{}));
- bar_var->set_decorations(std::move(decos));
+ bar_var->set_decorations({create<ast::LocationDecoration>(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<ast::BlockStatement>();
@@ -147,12 +142,11 @@
create<ast::IdentifierExpression>("bar"),
create<ast::IdentifierExpression>("foo")));
body->append(create<ast::ReturnStatement>());
- auto* func = create<ast::Function>("frag_main", std::move(params), &void_type,
- std::move(body));
+ auto* func = create<ast::Function>("frag_main", params, &void_type, body);
func->add_decoration(
create<ast::StageDecoration>(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 @@
auto* coord_var = create<ast::DecoratedVariable>(
create<ast::Variable>("coord", ast::StorageClass::kInput, &vec4));
- ast::VariableDecorationList decos;
- decos.push_back(
- create<ast::BuiltinDecoration>(ast::Builtin::kFragCoord, Source{}));
- coord_var->set_decorations(std::move(decos));
+ coord_var->set_decorations(
+ {create<ast::BuiltinDecoration>(ast::Builtin::kFragCoord, Source{})});
auto* depth_var = create<ast::DecoratedVariable>(
create<ast::Variable>("depth", ast::StorageClass::kOutput, &f32));
- decos.push_back(
- create<ast::BuiltinDecoration>(ast::Builtin::kFragDepth, Source{}));
- depth_var->set_decorations(std::move(decos));
+ depth_var->set_decorations(
+ {create<ast::BuiltinDecoration>(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<ast::BlockStatement>();
@@ -207,12 +198,11 @@
create<ast::IdentifierExpression>("coord"),
create<ast::IdentifierExpression>("x"))));
body->append(create<ast::ReturnStatement>());
- auto* func = create<ast::Function>("frag_main", std::move(params), &void_type,
- std::move(body));
+ auto* func = create<ast::Function>("frag_main", params, &void_type, body);
func->add_decoration(
create<ast::StageDecoration>(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 @@
ast::VariableDecorationList decos;
decos.push_back(create<ast::BindingDecoration>(0, Source{}));
decos.push_back(create<ast::SetDecoration>(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<ast::Variable>("v", ast::StorageClass::kFunction, &f32);
@@ -257,14 +247,13 @@
create<ast::IdentifierExpression>("x")));
auto* body = create<ast::BlockStatement>();
- body->append(create<ast::VariableDeclStatement>(std::move(var)));
+ body->append(create<ast::VariableDeclStatement>(var));
body->append(create<ast::ReturnStatement>());
- auto* func = create<ast::Function>("frag_main", std::move(params), &void_type,
- std::move(body));
+ auto* func = create<ast::Function>("frag_main", params, &void_type, body);
func->add_decoration(
create<ast::StageDecoration>(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 @@
"coord", &vec4, ast::StructMemberDecorationList{}));
auto* str = create<ast::Struct>();
- 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<ast::DecoratedVariable>(
create<ast::Variable>("uniforms", ast::StorageClass::kUniform, &s));
@@ -303,10 +292,10 @@
ast::VariableDecorationList decos;
decos.push_back(create<ast::BindingDecoration>(0, Source{}));
decos.push_back(create<ast::SetDecoration>(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<ast::Variable>("v", ast::StorageClass::kFunction, &f32);
@@ -317,14 +306,13 @@
create<ast::IdentifierExpression>("x")));
auto* body = create<ast::BlockStatement>();
- body->append(create<ast::VariableDeclStatement>(std::move(var)));
+ body->append(create<ast::VariableDeclStatement>(var));
body->append(create<ast::ReturnStatement>());
- auto* func = create<ast::Function>("frag_main", std::move(params), &void_type,
- std::move(body));
+ auto* func = create<ast::Function>("frag_main", params, &void_type, body);
func->add_decoration(
create<ast::StageDecoration>(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 @@
ast::StructMemberList members;
ast::StructMemberDecorationList a_deco;
a_deco.push_back(create<ast::StructMemberOffsetDecoration>(0, Source{}));
- members.push_back(create<ast::StructMember>("a", &i32, std::move(a_deco)));
+ members.push_back(create<ast::StructMember>("a", &i32, a_deco));
ast::StructMemberDecorationList b_deco;
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(4, Source{}));
- members.push_back(create<ast::StructMember>("b", &f32, std::move(b_deco)));
+ members.push_back(create<ast::StructMember>("b", &f32, b_deco));
auto* str = create<ast::Struct>();
- 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<ast::DecoratedVariable>(
@@ -369,10 +357,10 @@
ast::VariableDecorationList decos;
decos.push_back(create<ast::BindingDecoration>(0, Source{}));
decos.push_back(create<ast::SetDecoration>(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<ast::Variable>("v", ast::StorageClass::kFunction, &f32);
@@ -381,14 +369,13 @@
create<ast::IdentifierExpression>("b")));
auto* body = create<ast::BlockStatement>();
- body->append(create<ast::VariableDeclStatement>(std::move(var)));
+ body->append(create<ast::VariableDeclStatement>(var));
body->append(create<ast::ReturnStatement>());
- auto* func = create<ast::Function>("frag_main", std::move(params), &void_type,
- std::move(body));
+ auto* func = create<ast::Function>("frag_main", params, &void_type, body);
func->add_decoration(
create<ast::StageDecoration>(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 @@
ast::StructMemberList members;
ast::StructMemberDecorationList a_deco;
a_deco.push_back(create<ast::StructMemberOffsetDecoration>(0, Source{}));
- members.push_back(create<ast::StructMember>("a", &i32, std::move(a_deco)));
+ members.push_back(create<ast::StructMember>("a", &i32, a_deco));
ast::StructMemberDecorationList b_deco;
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(4, Source{}));
- members.push_back(create<ast::StructMember>("b", &f32, std::move(b_deco)));
+ members.push_back(create<ast::StructMember>("b", &f32, b_deco));
auto* str = create<ast::Struct>();
- 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<ast::DecoratedVariable>(
@@ -429,10 +416,10 @@
ast::VariableDecorationList decos;
decos.push_back(create<ast::BindingDecoration>(0, Source{}));
decos.push_back(create<ast::SetDecoration>(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<ast::Variable>("v", ast::StorageClass::kFunction, &f32);
@@ -441,14 +428,13 @@
create<ast::IdentifierExpression>("b")));
auto* body = create<ast::BlockStatement>();
- body->append(create<ast::VariableDeclStatement>(std::move(var)));
+ body->append(create<ast::VariableDeclStatement>(var));
body->append(create<ast::ReturnStatement>());
- auto* func = create<ast::Function>("frag_main", std::move(params), &void_type,
- std::move(body));
+ auto* func = create<ast::Function>("frag_main", params, &void_type, body);
func->add_decoration(
create<ast::StageDecoration>(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 @@
ast::StructMemberList members;
ast::StructMemberDecorationList a_deco;
a_deco.push_back(create<ast::StructMemberOffsetDecoration>(0, Source{}));
- members.push_back(create<ast::StructMember>("a", &i32, std::move(a_deco)));
+ members.push_back(create<ast::StructMember>("a", &i32, a_deco));
ast::StructMemberDecorationList b_deco;
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(4, Source{}));
- members.push_back(create<ast::StructMember>("b", &f32, std::move(b_deco)));
+ members.push_back(create<ast::StructMember>("b", &f32, b_deco));
auto* str = create<ast::Struct>();
- 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<ast::DecoratedVariable>(
@@ -489,11 +475,11 @@
ast::VariableDecorationList decos;
decos.push_back(create<ast::BindingDecoration>(0, Source{}));
decos.push_back(create<ast::SetDecoration>(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<ast::AssignmentStatement>(
@@ -504,14 +490,13 @@
create<ast::FloatLiteral>(&f32, 2.0f)));
auto* body = create<ast::BlockStatement>();
- body->append(std::move(assign));
+ body->append(assign);
body->append(create<ast::ReturnStatement>());
- auto* func = create<ast::Function>("frag_main", std::move(params), &void_type,
- std::move(body));
+ auto* func = create<ast::Function>("frag_main", params, &void_type, body);
func->add_decoration(
create<ast::StageDecoration>(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 @@
auto* foo_var = create<ast::DecoratedVariable>(
create<ast::Variable>("foo", ast::StorageClass::kInput, &f32));
-
- ast::VariableDecorationList decos;
- decos.push_back(create<ast::LocationDecoration>(0, Source{}));
- foo_var->set_decorations(std::move(decos));
+ foo_var->set_decorations({create<ast::LocationDecoration>(0, Source{})});
auto* bar_var = create<ast::DecoratedVariable>(
create<ast::Variable>("bar", ast::StorageClass::kOutput, &f32));
- decos.push_back(create<ast::LocationDecoration>(1, Source{}));
- bar_var->set_decorations(std::move(decos));
+ bar_var->set_decorations({create<ast::LocationDecoration>(1, Source{})});
auto* val_var = create<ast::DecoratedVariable>(
create<ast::Variable>("val", ast::StorageClass::kOutput, &f32));
- decos.push_back(create<ast::LocationDecoration>(0, Source{}));
- val_var->set_decorations(std::move(decos));
+ val_var->set_decorations({create<ast::LocationDecoration>(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 @@
create<ast::IdentifierExpression>("param")));
body->append(
create<ast::ReturnStatement>(create<ast::IdentifierExpression>("foo")));
- auto* sub_func = create<ast::Function>("sub_func", std::move(params), &f32,
- std::move(body));
+ auto* sub_func = create<ast::Function>("sub_func", params, &f32, body);
- mod.AddFunction(std::move(sub_func));
+ mod.AddFunction(sub_func);
ast::ExpressionList expr;
expr.push_back(create<ast::ScalarConstructorExpression>(
@@ -582,14 +561,13 @@
body->append(create<ast::AssignmentStatement>(
create<ast::IdentifierExpression>("bar"),
create<ast::CallExpression>(create<ast::IdentifierExpression>("sub_func"),
- std::move(expr))));
+ expr)));
body->append(create<ast::ReturnStatement>());
- auto* func_1 = create<ast::Function>("ep_1", std::move(params), &void_type,
- std::move(body));
+ auto* func_1 = create<ast::Function>("ep_1", params, &void_type, body);
func_1->add_decoration(
create<ast::StageDecoration>(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 @@
ast::VariableDecorationList decos;
decos.push_back(
create<ast::BuiltinDecoration>(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 @@
auto* body = create<ast::BlockStatement>();
body->append(
create<ast::ReturnStatement>(create<ast::IdentifierExpression>("param")));
- auto* sub_func = create<ast::Function>("sub_func", std::move(params), &f32,
- std::move(body));
+ auto* sub_func = create<ast::Function>("sub_func", params, &f32, body);
- mod.AddFunction(std::move(sub_func));
+ mod.AddFunction(sub_func);
ast::ExpressionList expr;
expr.push_back(create<ast::ScalarConstructorExpression>(
@@ -655,14 +632,13 @@
body->append(create<ast::AssignmentStatement>(
create<ast::IdentifierExpression>("depth"),
create<ast::CallExpression>(create<ast::IdentifierExpression>("sub_func"),
- std::move(expr))));
+ expr)));
body->append(create<ast::ReturnStatement>());
- auto* func_1 = create<ast::Function>("ep_1", std::move(params), &void_type,
- std::move(body));
+ auto* func_1 = create<ast::Function>("ep_1", params, &void_type, body);
func_1->add_decoration(
create<ast::StageDecoration>(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 @@
auto* coord_var = create<ast::DecoratedVariable>(
create<ast::Variable>("coord", ast::StorageClass::kInput, &vec4));
-
- ast::VariableDecorationList decos;
- decos.push_back(
- create<ast::BuiltinDecoration>(ast::Builtin::kFragCoord, Source{}));
- coord_var->set_decorations(std::move(decos));
+ coord_var->set_decorations(
+ {create<ast::BuiltinDecoration>(ast::Builtin::kFragCoord, Source{})});
auto* depth_var = create<ast::DecoratedVariable>(
create<ast::Variable>("depth", ast::StorageClass::kOutput, &f32));
- decos.push_back(
- create<ast::BuiltinDecoration>(ast::Builtin::kFragDepth, Source{}));
- depth_var->set_decorations(std::move(decos));
+ depth_var->set_decorations(
+ {create<ast::BuiltinDecoration>(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 @@
create<ast::IdentifierExpression>("x"))));
body->append(
create<ast::ReturnStatement>(create<ast::IdentifierExpression>("param")));
- auto* sub_func = create<ast::Function>("sub_func", std::move(params), &f32,
- std::move(body));
+ auto* sub_func = create<ast::Function>("sub_func", params, &f32, body);
- mod.AddFunction(std::move(sub_func));
+ mod.AddFunction(sub_func);
ast::ExpressionList expr;
expr.push_back(create<ast::ScalarConstructorExpression>(
@@ -735,14 +706,13 @@
body->append(create<ast::AssignmentStatement>(
create<ast::IdentifierExpression>("depth"),
create<ast::CallExpression>(create<ast::IdentifierExpression>("sub_func"),
- std::move(expr))));
+ expr)));
body->append(create<ast::ReturnStatement>());
- auto* func_1 = create<ast::Function>("ep_1", std::move(params), &void_type,
- std::move(body));
+ auto* func_1 = create<ast::Function>("ep_1", params, &void_type, body);
func_1->add_decoration(
create<ast::StageDecoration>(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 @@
ast::VariableDecorationList decos;
decos.push_back(create<ast::BindingDecoration>(0, Source{}));
decos.push_back(create<ast::SetDecoration>(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 @@
create<ast::ReturnStatement>(create<ast::MemberAccessorExpression>(
create<ast::IdentifierExpression>("coord"),
create<ast::IdentifierExpression>("x"))));
- auto* sub_func = create<ast::Function>("sub_func", std::move(params), &f32,
- std::move(body));
+ auto* sub_func = create<ast::Function>("sub_func", params, &f32, body);
- mod.AddFunction(std::move(sub_func));
+ mod.AddFunction(sub_func);
ast::ExpressionList expr;
expr.push_back(create<ast::ScalarConstructorExpression>(
@@ -806,17 +775,16 @@
auto* var = create<ast::Variable>("v", ast::StorageClass::kFunction, &f32);
var->set_constructor(create<ast::CallExpression>(
- create<ast::IdentifierExpression>("sub_func"), std::move(expr)));
+ create<ast::IdentifierExpression>("sub_func"), expr));
body = create<ast::BlockStatement>();
- body->append(create<ast::VariableDeclStatement>(std::move(var)));
+ body->append(create<ast::VariableDeclStatement>(var));
body->append(create<ast::ReturnStatement>());
- auto* func = create<ast::Function>("frag_main", std::move(params), &void_type,
- std::move(body));
+ auto* func = create<ast::Function>("frag_main", params, &void_type, body);
func->add_decoration(
create<ast::StageDecoration>(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 @@
ast::VariableDecorationList decos;
decos.push_back(create<ast::BindingDecoration>(0, Source{}));
decos.push_back(create<ast::SetDecoration>(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 @@
create<ast::ReturnStatement>(create<ast::MemberAccessorExpression>(
create<ast::IdentifierExpression>("coord"),
create<ast::IdentifierExpression>("x"))));
- auto* sub_func = create<ast::Function>("sub_func", std::move(params), &f32,
- std::move(body));
+ auto* sub_func = create<ast::Function>("sub_func", params, &f32, body);
- mod.AddFunction(std::move(sub_func));
+ mod.AddFunction(sub_func);
ast::ExpressionList expr;
expr.push_back(create<ast::ScalarConstructorExpression>(
@@ -874,17 +841,16 @@
auto* var = create<ast::Variable>("v", ast::StorageClass::kFunction, &f32);
var->set_constructor(create<ast::CallExpression>(
- create<ast::IdentifierExpression>("sub_func"), std::move(expr)));
+ create<ast::IdentifierExpression>("sub_func"), expr));
body = create<ast::BlockStatement>();
- body->append(create<ast::VariableDeclStatement>(std::move(var)));
+ body->append(create<ast::VariableDeclStatement>(var));
body->append(create<ast::ReturnStatement>());
- auto* func = create<ast::Function>("frag_main", std::move(params), &void_type,
- std::move(body));
+ auto* func = create<ast::Function>("frag_main", params, &void_type, body);
func->add_decoration(
create<ast::StageDecoration>(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 @@
create<ast::Variable>("bar", ast::StorageClass::kOutput, &f32));
ast::VariableDecorationList decos;
decos.push_back(create<ast::LocationDecoration>(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<ast::BlockStatement>();
@@ -933,15 +899,14 @@
create<ast::SintLiteral>(&i32, 1)),
create<ast::ScalarConstructorExpression>(
create<ast::SintLiteral>(&i32, 1))),
- std::move(list)));
+ list));
body->append(create<ast::ReturnStatement>());
- auto* func_1 = create<ast::Function>("ep_1", std::move(params), &void_type,
- std::move(body));
+ auto* func_1 = create<ast::Function>("ep_1", params, &void_type, body);
func_1->add_decoration(
create<ast::StageDecoration>(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 @@
func->add_decoration(
create<ast::StageDecoration>(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 @@
ast::VariableList params;
auto* body = create<ast::BlockStatement>();
body->append(create<ast::ReturnStatement>());
- auto* func = create<ast::Function>("main", std::move(params), &void_type,
- std::move(body));
+ auto* func = create<ast::Function>("main", params, &void_type, body);
func->add_decoration(
create<ast::StageDecoration>(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 @@
ast::VariableList params;
auto* body = create<ast::BlockStatement>();
body->append(create<ast::ReturnStatement>());
- auto* func = create<ast::Function>("main", std::move(params), &void_type,
- std::move(body));
+ auto* func = create<ast::Function>("main", params, &void_type, body);
func->add_decoration(
create<ast::StageDecoration>(ast::PipelineStage::kCompute, Source{}));
func->add_decoration(create<ast::WorkgroupDecoration>(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 @@
auto* body = create<ast::BlockStatement>();
body->append(create<ast::ReturnStatement>());
- auto* func = create<ast::Function>("my_func", std::move(params), &void_type,
- std::move(body));
+ auto* func = create<ast::Function>("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 @@
ast::StructMemberList members;
ast::StructMemberDecorationList a_deco;
a_deco.push_back(create<ast::StructMemberOffsetDecoration>(0, Source{}));
- members.push_back(create<ast::StructMember>("d", &f32, std::move(a_deco)));
+ members.push_back(create<ast::StructMember>("d", &f32, a_deco));
ast::StructDecorationList s_decos;
s_decos.push_back(create<ast::StructBlockDecoration>(Source{}));
- auto* str = create<ast::Struct>(std::move(s_decos), std::move(members));
+ auto* str = create<ast::Struct>(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<ast::DecoratedVariable>(
@@ -1093,11 +1055,11 @@
ast::VariableDecorationList decos;
decos.push_back(create<ast::BindingDecoration>(0, Source{}));
decos.push_back(create<ast::SetDecoration>(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 @@
create<ast::IdentifierExpression>("d")));
auto* body = create<ast::BlockStatement>();
- body->append(create<ast::VariableDeclStatement>(std::move(var)));
+ body->append(create<ast::VariableDeclStatement>(var));
body->append(create<ast::ReturnStatement>());
- auto* func = create<ast::Function>("a", std::move(params), &void_type,
- std::move(body));
+ auto* func = create<ast::Function>("a", params, &void_type, body);
func->add_decoration(
create<ast::StageDecoration>(ast::PipelineStage::kCompute, Source{}));
- mod.AddFunction(std::move(func));
+ mod.AddFunction(func);
}
{
@@ -1125,14 +1086,13 @@
create<ast::IdentifierExpression>("d")));
auto* body = create<ast::BlockStatement>();
- body->append(create<ast::VariableDeclStatement>(std::move(var)));
+ body->append(create<ast::VariableDeclStatement>(var));
body->append(create<ast::ReturnStatement>());
- auto* func = create<ast::Function>("b", std::move(params), &void_type,
- std::move(body));
+ auto* func = create<ast::Function>("b", params, &void_type, body);
func->add_decoration(
create<ast::StageDecoration>(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 e494c8d..6e9bd7a 100644
--- a/src/writer/hlsl/generator_impl_if_test.cc
+++ b/src/writer/hlsl/generator_impl_if_test.cc
@@ -31,7 +31,7 @@
auto* body = create<ast::BlockStatement>();
body->append(create<ast::ReturnStatement>());
- 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 @@
else_body->append(create<ast::ReturnStatement>());
ast::ElseStatementList elses;
- elses.push_back(
- create<ast::ElseStatement>(std::move(else_cond), std::move(else_body)));
+ elses.push_back(create<ast::ElseStatement>(else_cond, else_body));
auto* cond = create<ast::IdentifierExpression>("cond");
auto* body = create<ast::BlockStatement>();
body->append(create<ast::ReturnStatement>());
- 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 @@
else_body->append(create<ast::ReturnStatement>());
ast::ElseStatementList elses;
- elses.push_back(create<ast::ElseStatement>(std::move(else_body)));
+ elses.push_back(create<ast::ElseStatement>(else_body));
auto* cond = create<ast::IdentifierExpression>("cond");
auto* body = create<ast::BlockStatement>();
body->append(create<ast::ReturnStatement>());
- 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 @@
else_body_2->append(create<ast::ReturnStatement>());
ast::ElseStatementList elses;
- elses.push_back(
- create<ast::ElseStatement>(std::move(else_cond), std::move(else_body)));
- elses.push_back(create<ast::ElseStatement>(std::move(else_body_2)));
+ elses.push_back(create<ast::ElseStatement>(else_cond, else_body));
+ elses.push_back(create<ast::ElseStatement>(else_body_2));
auto* cond = create<ast::IdentifierExpression>("cond");
auto* body = create<ast::BlockStatement>();
body->append(create<ast::ReturnStatement>());
- 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 aa6f7d5..bfb5a85 100644
--- a/src/writer/hlsl/generator_impl_import_test.cc
+++ b/src/writer/hlsl/generator_impl_import_test.cc
@@ -58,7 +58,7 @@
create<ast::FloatLiteral>(&f32, 1.f)));
auto* ident = create<ast::IdentifierExpression>(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 @@
create<ast::SintLiteral>(&i32, 1)));
ast::CallExpression expr(create<ast::IdentifierExpression>(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 @@
create<ast::FloatLiteral>(&f32, 2.f)));
ast::CallExpression expr(create<ast::IdentifierExpression>(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 @@
ast::type::F32Type f32;
ast::type::VectorType vec(&f32, 3);
- ast::ExpressionList type_params;
- type_params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)));
- type_params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 2.f)));
- type_params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 3.f)));
-
ast::ExpressionList params;
- params.push_back(
- create<ast::TypeConstructorExpression>(&vec, std::move(type_params)));
+ params.push_back(create<ast::TypeConstructorExpression>(
+ &vec, ast::ExpressionList{
+ create<ast::ScalarConstructorExpression>(
+ create<ast::FloatLiteral>(&f32, 1.f)),
+ create<ast::ScalarConstructorExpression>(
+ create<ast::FloatLiteral>(&f32, 2.f)),
+ create<ast::ScalarConstructorExpression>(
+ create<ast::FloatLiteral>(&f32, 3.f)),
+ }));
- type_params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 4.f)));
- type_params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 5.f)));
- type_params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 6.f)));
- params.push_back(
- create<ast::TypeConstructorExpression>(&vec, std::move(type_params)));
+ params.push_back(create<ast::TypeConstructorExpression>(
+ &vec, ast::ExpressionList{
+ create<ast::ScalarConstructorExpression>(
+ create<ast::FloatLiteral>(&f32, 4.f)),
+ create<ast::ScalarConstructorExpression>(
+ create<ast::FloatLiteral>(&f32, 5.f)),
+ create<ast::ScalarConstructorExpression>(
+ create<ast::FloatLiteral>(&f32, 6.f)),
+ }));
ast::CallExpression expr(create<ast::IdentifierExpression>(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 @@
create<ast::SintLiteral>(&i32, 2)));
ast::CallExpression expr(create<ast::IdentifierExpression>(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 @@
create<ast::FloatLiteral>(&f32, 3.f)));
ast::CallExpression expr(create<ast::IdentifierExpression>(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 @@
create<ast::SintLiteral>(&i32, 3)));
ast::CallExpression expr(create<ast::IdentifierExpression>(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 @@
params.push_back(create<ast::IdentifierExpression>("var"));
ast::CallExpression expr(create<ast::IdentifierExpression>("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 38aebb3..b47a1e3 100644
--- a/src/writer/hlsl/generator_impl_intrinsic_test.cc
+++ b/src/writer/hlsl/generator_impl_intrinsic_test.cc
@@ -84,13 +84,13 @@
params.push_back(create<ast::IdentifierExpression>("b"));
ast::CallExpression call(create<ast::IdentifierExpression>("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 @@
params.push_back(create<ast::IdentifierExpression>("param1"));
params.push_back(create<ast::IdentifierExpression>("param2"));
- ast::CallExpression call(create<ast::IdentifierExpression>("dot"),
- std::move(params));
+ ast::CallExpression call(create<ast::IdentifierExpression>("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 05579df..71bdd20 100644
--- a/src/writer/hlsl/generator_impl_loop_test.cc
+++ b/src/writer/hlsl/generator_impl_loop_test.cc
@@ -37,7 +37,7 @@
auto* body = create<ast::BlockStatement>();
body->append(create<ast::DiscardStatement>());
- 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 @@
auto* continuing = create<ast::BlockStatement>();
continuing->append(create<ast::ReturnStatement>());
- 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 @@
auto* continuing = create<ast::BlockStatement>();
continuing->append(create<ast::ReturnStatement>());
- auto* inner =
- create<ast::LoopStatement>(std::move(body), std::move(continuing));
+ auto* inner = create<ast::LoopStatement>(body, continuing);
body = create<ast::BlockStatement>();
- body->append(std::move(inner));
+ body->append(inner);
auto* lhs = create<ast::IdentifierExpression>("lhs");
auto* rhs = create<ast::IdentifierExpression>("rhs");
continuing = create<ast::BlockStatement>();
- continuing->append(
- create<ast::AssignmentStatement>(std::move(lhs), std::move(rhs)));
+ continuing->append(create<ast::AssignmentStatement>(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 @@
create<ast::FloatLiteral>(&f32, 2.4)));
auto* body = create<ast::BlockStatement>();
- body->append(create<ast::VariableDeclStatement>(std::move(var)));
+ body->append(create<ast::VariableDeclStatement>(var));
body->append(create<ast::VariableDeclStatement>(
create<ast::Variable>("other", ast::StorageClass::kFunction, &f32)));
@@ -159,10 +157,9 @@
auto* rhs = create<ast::IdentifierExpression>("rhs");
auto* continuing = create<ast::BlockStatement>();
- continuing->append(
- create<ast::AssignmentStatement>(std::move(lhs), std::move(rhs)));
+ continuing->append(create<ast::AssignmentStatement>(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 74ea63f..7005f7e 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 @@
ast::StructMemberList members;
ast::StructMemberDecorationList deco;
deco.push_back(create<ast::StructMemberOffsetDecoration>(0, Source{}));
- members.push_back(create<ast::StructMember>("mem", &f32, std::move(deco)));
+ members.push_back(create<ast::StructMember>("mem", &f32, deco));
auto* strct = create<ast::Struct>();
- 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<ast::DecoratedVariable>(
create<ast::Variable>("str", ast::StorageClass::kPrivate, &s));
@@ -65,11 +65,11 @@
auto* str = create<ast::IdentifierExpression>("str");
auto* mem = create<ast::IdentifierExpression>("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 @@
ast::StructMemberList members;
ast::StructMemberDecorationList a_deco;
a_deco.push_back(create<ast::StructMemberOffsetDecoration>(0, Source{}));
- members.push_back(create<ast::StructMember>("a", &i32, std::move(a_deco)));
+ members.push_back(create<ast::StructMember>("a", &i32, a_deco));
ast::StructMemberDecorationList b_deco;
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(4, Source{}));
- members.push_back(create<ast::StructMember>("b", &f32, std::move(b_deco)));
+ members.push_back(create<ast::StructMember>("b", &f32, b_deco));
auto* str = create<ast::Struct>();
- 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<ast::DecoratedVariable>(
create<ast::Variable>("data", ast::StorageClass::kStorageBuffer, &s));
@@ -111,7 +111,7 @@
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 @@
ast::StructMemberList members;
ast::StructMemberDecorationList a_deco;
a_deco.push_back(create<ast::StructMemberOffsetDecoration>(0, Source{}));
- members.push_back(create<ast::StructMember>("a", &i32, std::move(a_deco)));
+ members.push_back(create<ast::StructMember>("a", &i32, a_deco));
ast::StructMemberDecorationList b_deco;
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(4, Source{}));
- members.push_back(create<ast::StructMember>("b", &f32, std::move(b_deco)));
+ members.push_back(create<ast::StructMember>("b", &f32, b_deco));
auto* str = create<ast::Struct>();
- 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<ast::DecoratedVariable>(
create<ast::Variable>("data", ast::StorageClass::kStorageBuffer, &s));
@@ -155,7 +155,7 @@
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 @@
ast::type::I32Type i32;
ast::type::MatrixType mat(&f32, 3, 2);
- ast::StructMemberList members;
- ast::StructMemberDecorationList a_deco;
- a_deco.push_back(create<ast::StructMemberOffsetDecoration>(0, Source{}));
- members.push_back(create<ast::StructMember>("z", &i32, std::move(a_deco)));
-
- ast::StructMemberDecorationList b_deco;
- b_deco.push_back(create<ast::StructMemberOffsetDecoration>(4, Source{}));
- members.push_back(create<ast::StructMember>("a", &mat, std::move(b_deco)));
-
auto* str = create<ast::Struct>();
- str->set_members(std::move(members));
+ str->set_members({
+ create<ast::StructMember>(
+ "z", &i32,
+ ast::StructMemberDecorationList{
+ create<ast::StructMemberOffsetDecoration>(0, Source{})}),
+ create<ast::StructMember>(
+ "a", &mat,
+ ast::StructMemberDecorationList{
+ create<ast::StructMemberOffsetDecoration>(4, Source{})}),
+ });
- ast::type::StructType s("Data", std::move(str));
+ ast::type::StructType s("Data", str);
auto* b_var = create<ast::Variable>("b", ast::StorageClass::kPrivate, &mat);
@@ -204,14 +204,14 @@
create<ast::IdentifierExpression>("a"));
auto* rhs = create<ast::IdentifierExpression>("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 @@
ast::StructMemberList members;
ast::StructMemberDecorationList a_deco;
a_deco.push_back(create<ast::StructMemberOffsetDecoration>(0, Source{}));
- members.push_back(create<ast::StructMember>("z", &i32, std::move(a_deco)));
+ members.push_back(create<ast::StructMember>("z", &i32, a_deco));
ast::StructMemberDecorationList b_deco;
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(4, Source{}));
- members.push_back(create<ast::StructMember>("a", &mat, std::move(b_deco)));
+ members.push_back(create<ast::StructMember>("a", &mat, b_deco));
auto* str = create<ast::Struct>();
- 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<ast::DecoratedVariable>(
create<ast::Variable>("data", ast::StorageClass::kStorageBuffer, &s));
@@ -263,11 +263,11 @@
auto* rhs =
create<ast::TypeConstructorExpression>(&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 @@
ast::StructMemberList members;
ast::StructMemberDecorationList a_deco;
a_deco.push_back(create<ast::StructMemberOffsetDecoration>(0, Source{}));
- members.push_back(create<ast::StructMember>("z", &i32, std::move(a_deco)));
+ members.push_back(create<ast::StructMember>("z", &i32, a_deco));
ast::StructMemberDecorationList b_deco;
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(4, Source{}));
- members.push_back(create<ast::StructMember>("a", &mat, std::move(b_deco)));
+ members.push_back(create<ast::StructMember>("a", &mat, b_deco));
auto* str = create<ast::Struct>();
- 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<ast::DecoratedVariable>(
create<ast::Variable>("data", ast::StorageClass::kStorageBuffer, &s));
@@ -318,7 +318,7 @@
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 @@
ast::StructMemberList members;
ast::StructMemberDecorationList a_deco;
a_deco.push_back(create<ast::StructMemberOffsetDecoration>(0, Source{}));
- members.push_back(create<ast::StructMember>("z", &i32, std::move(a_deco)));
+ members.push_back(create<ast::StructMember>("z", &i32, a_deco));
ast::StructMemberDecorationList b_deco;
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(4, Source{}));
- members.push_back(create<ast::StructMember>("a", &mat, std::move(b_deco)));
+ members.push_back(create<ast::StructMember>("a", &mat, b_deco));
auto* str = create<ast::Struct>();
- 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<ast::DecoratedVariable>(
create<ast::Variable>("data", ast::StorageClass::kStorageBuffer, &s));
@@ -369,7 +369,7 @@
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 @@
ast::StructMemberList members;
ast::StructMemberDecorationList deco;
deco.push_back(create<ast::StructMemberOffsetDecoration>(0, Source{}));
- members.push_back(create<ast::StructMember>("a", &mat, std::move(deco)));
+ members.push_back(create<ast::StructMember>("a", &mat, deco));
auto* str = create<ast::Struct>();
- 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<ast::DecoratedVariable>(
create<ast::Variable>("data", ast::StorageClass::kStorageBuffer, &s));
@@ -413,7 +413,7 @@
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 @@
ast::StructMemberList members;
ast::StructMemberDecorationList a_deco;
a_deco.push_back(create<ast::StructMemberOffsetDecoration>(0, Source{}));
- members.push_back(create<ast::StructMember>("z", &i32, std::move(a_deco)));
+ members.push_back(create<ast::StructMember>("z", &i32, a_deco));
ast::StructMemberDecorationList b_deco;
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(16, Source{}));
- members.push_back(create<ast::StructMember>("a", &mat, std::move(b_deco)));
+ members.push_back(create<ast::StructMember>("a", &mat, b_deco));
auto* str = create<ast::Struct>();
- 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<ast::DecoratedVariable>(
create<ast::Variable>("data", ast::StorageClass::kStorageBuffer, &s));
@@ -467,7 +467,7 @@
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 @@
ast::type::F32Type f32;
ast::type::I32Type i32;
ast::type::ArrayType ary(&i32, 5);
- ast::ArrayDecorationList decos;
- decos.push_back(create<ast::StrideDecoration>(4, Source{}));
- ary.set_decorations(std::move(decos));
+ ary.set_decorations({create<ast::StrideDecoration>(4, Source{})});
ast::StructMemberList members;
ast::StructMemberDecorationList a_deco;
a_deco.push_back(create<ast::StructMemberOffsetDecoration>(0, Source{}));
- members.push_back(create<ast::StructMember>("a", &ary, std::move(a_deco)));
+ members.push_back(create<ast::StructMember>("a", &ary, a_deco));
auto* str = create<ast::Struct>();
- 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<ast::DecoratedVariable>(
create<ast::Variable>("data", ast::StorageClass::kStorageBuffer, &s));
@@ -514,7 +512,7 @@
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 @@
ast::type::F32Type f32;
ast::type::I32Type i32;
ast::type::ArrayType ary(&i32, 5);
- ast::ArrayDecorationList decos;
- decos.push_back(create<ast::StrideDecoration>(4, Source{}));
- ary.set_decorations(std::move(decos));
+ ary.set_decorations({create<ast::StrideDecoration>(4, Source{})});
ast::StructMemberList members;
ast::StructMemberDecorationList a_deco;
a_deco.push_back(create<ast::StructMemberOffsetDecoration>(0, Source{}));
- members.push_back(create<ast::StructMember>("a", &ary, std::move(a_deco)));
+ members.push_back(create<ast::StructMember>("a", &ary, a_deco));
auto* str = create<ast::Struct>();
- 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<ast::DecoratedVariable>(
create<ast::Variable>("data", ast::StorageClass::kStorageBuffer, &s));
@@ -569,7 +565,7 @@
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 @@
ast::StructMemberList members;
ast::StructMemberDecorationList a_deco;
a_deco.push_back(create<ast::StructMemberOffsetDecoration>(0, Source{}));
- members.push_back(create<ast::StructMember>("a", &i32, std::move(a_deco)));
+ members.push_back(create<ast::StructMember>("a", &i32, a_deco));
ast::StructMemberDecorationList b_deco;
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(4, Source{}));
- members.push_back(create<ast::StructMember>("b", &f32, std::move(b_deco)));
+ members.push_back(create<ast::StructMember>("b", &f32, b_deco));
auto* str = create<ast::Struct>();
- 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<ast::DecoratedVariable>(
create<ast::Variable>("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 @@
create<ast::IdentifierExpression>("b"));
auto* rhs = create<ast::ScalarConstructorExpression>(
create<ast::FloatLiteral>(&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 @@
ast::type::F32Type f32;
ast::type::I32Type i32;
ast::type::ArrayType ary(&i32, 5);
- ast::ArrayDecorationList decos;
- decos.push_back(create<ast::StrideDecoration>(4, Source{}));
- ary.set_decorations(std::move(decos));
+ ary.set_decorations({create<ast::StrideDecoration>(4, Source{})});
ast::StructMemberList members;
ast::StructMemberDecorationList a_deco;
a_deco.push_back(create<ast::StructMemberOffsetDecoration>(0, Source{}));
- members.push_back(create<ast::StructMember>("a", &ary, std::move(a_deco)));
+ members.push_back(create<ast::StructMember>("a", &ary, a_deco));
auto* str = create<ast::Struct>();
- 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<ast::DecoratedVariable>(
create<ast::Variable>("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 @@
create<ast::SintLiteral>(&i32, 2)));
auto* rhs = create<ast::ScalarConstructorExpression>(
create<ast::SintLiteral>(&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 @@
ast::StructMemberList members;
ast::StructMemberDecorationList a_deco;
a_deco.push_back(create<ast::StructMemberOffsetDecoration>(0, Source{}));
- members.push_back(create<ast::StructMember>("a", &i32, std::move(a_deco)));
+ members.push_back(create<ast::StructMember>("a", &i32, a_deco));
ast::StructMemberDecorationList b_deco;
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(4, Source{}));
- members.push_back(create<ast::StructMember>("b", &f32, std::move(b_deco)));
+ members.push_back(create<ast::StructMember>("b", &f32, b_deco));
auto* str = create<ast::Struct>();
- 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<ast::DecoratedVariable>(
create<ast::Variable>("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 @@
create<ast::IdentifierExpression>("a"));
auto* rhs = create<ast::ScalarConstructorExpression>(
create<ast::SintLiteral>(&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 @@
ast::StructMemberList members;
ast::StructMemberDecorationList a_deco;
a_deco.push_back(create<ast::StructMemberOffsetDecoration>(0, Source{}));
- members.push_back(create<ast::StructMember>("a", &ivec3, std::move(a_deco)));
+ members.push_back(create<ast::StructMember>("a", &ivec3, a_deco));
ast::StructMemberDecorationList b_deco;
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(16, Source{}));
- members.push_back(create<ast::StructMember>("b", &fvec3, std::move(b_deco)));
+ members.push_back(create<ast::StructMember>("b", &fvec3, b_deco));
auto* str = create<ast::Struct>();
- 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<ast::DecoratedVariable>(
create<ast::Variable>("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 @@
ast::StructMemberList members;
ast::StructMemberDecorationList a_deco;
a_deco.push_back(create<ast::StructMemberOffsetDecoration>(0, Source{}));
- members.push_back(create<ast::StructMember>("a", &ivec3, std::move(a_deco)));
+ members.push_back(create<ast::StructMember>("a", &ivec3, a_deco));
ast::StructMemberDecorationList b_deco;
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(16, Source{}));
- members.push_back(create<ast::StructMember>("b", &fvec3, std::move(b_deco)));
+ members.push_back(create<ast::StructMember>("b", &fvec3, b_deco));
auto* str = create<ast::Struct>();
- 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<ast::DecoratedVariable>(
create<ast::Variable>("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 @@
auto* lit2 = create<ast::FloatLiteral>(&f32, 2.f);
auto* lit3 = create<ast::FloatLiteral>(&f32, 3.f);
ast::ExpressionList values;
- values.push_back(create<ast::ScalarConstructorExpression>(std::move(lit1)));
- values.push_back(create<ast::ScalarConstructorExpression>(std::move(lit2)));
- values.push_back(create<ast::ScalarConstructorExpression>(std::move(lit3)));
+ values.push_back(create<ast::ScalarConstructorExpression>(lit1));
+ values.push_back(create<ast::ScalarConstructorExpression>(lit2));
+ values.push_back(create<ast::ScalarConstructorExpression>(lit3));
auto* lhs = create<ast::MemberAccessorExpression>(
create<ast::IdentifierExpression>("data"),
create<ast::IdentifierExpression>("b"));
- auto* rhs = create<ast::TypeConstructorExpression>(&fvec3, std::move(values));
+ auto* rhs = create<ast::TypeConstructorExpression>(&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 @@
ast::type::VectorType ivec3(&i32, 3);
ast::type::VectorType fvec3(&f32, 3);
- ast::StructMemberList members;
- ast::StructMemberDecorationList deco;
- deco.push_back(create<ast::StructMemberOffsetDecoration>(0, Source{}));
- members.push_back(create<ast::StructMember>("a", &ivec3, std::move(deco)));
-
- deco.push_back(create<ast::StructMemberOffsetDecoration>(16, Source{}));
- members.push_back(create<ast::StructMember>("b", &fvec3, std::move(deco)));
-
auto* data_str = create<ast::Struct>();
- data_str->set_members(std::move(members));
+ data_str->set_members({
+ create<ast::StructMember>(
+ "a", &ivec3,
+ ast::StructMemberDecorationList{
+ create<ast::StructMemberOffsetDecoration>(0, Source{})}),
+ create<ast::StructMember>(
+ "b", &fvec3,
+ ast::StructMemberDecorationList{
+ create<ast::StructMemberOffsetDecoration>(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<ast::StrideDecoration>(32, Source{}));
- ary.set_decorations(std::move(decos));
-
- deco.push_back(create<ast::StructMemberOffsetDecoration>(0, Source{}));
- members.push_back(create<ast::StructMember>("c", &ary, std::move(deco)));
+ ary.set_decorations({create<ast::StrideDecoration>(32, Source{})});
auto* pre_str = create<ast::Struct>();
- pre_str->set_members(std::move(members));
+ pre_str->set_members({
+ create<ast::StructMember>(
+ "c", &ary,
+ ast::StructMemberDecorationList{
+ create<ast::StructMemberOffsetDecoration>(0, Source{})}),
+ });
- ast::type::StructType pre_struct("Pre", std::move(pre_str));
+ ast::type::StructType pre_struct("Pre", pre_str);
auto* coord_var = create<ast::DecoratedVariable>(create<ast::Variable>(
"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 @@
ast::StructMemberList members;
ast::StructMemberDecorationList deco;
- deco.push_back(create<ast::StructMemberOffsetDecoration>(0, Source{}));
- members.push_back(create<ast::StructMember>("a", &ivec3, std::move(deco)));
-
- deco.push_back(create<ast::StructMemberOffsetDecoration>(16, Source{}));
- members.push_back(create<ast::StructMember>("b", &fvec3, std::move(deco)));
auto* data_str = create<ast::Struct>();
- data_str->set_members(std::move(members));
+ data_str->set_members({
+ create<ast::StructMember>(
+ "a", &ivec3,
+ ast::StructMemberDecorationList{
+ create<ast::StructMemberOffsetDecoration>(0, Source{})}),
+ create<ast::StructMember>(
+ "b", &fvec3,
+ ast::StructMemberDecorationList{
+ create<ast::StructMemberOffsetDecoration>(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<ast::StrideDecoration>(32, Source{}));
- ary.set_decorations(std::move(decos));
-
- deco.push_back(create<ast::StructMemberOffsetDecoration>(0, Source{}));
- members.push_back(create<ast::StructMember>("c", &ary, std::move(deco)));
+ ary.set_decorations({create<ast::StrideDecoration>(32, Source{})});
auto* pre_str = create<ast::Struct>();
- pre_str->set_members(std::move(members));
+ pre_str->set_members({create<ast::StructMember>(
+ "c", &ary,
+ ast::StructMemberDecorationList{
+ create<ast::StructMemberOffsetDecoration>(0, Source{})})});
- ast::type::StructType pre_struct("Pre", std::move(pre_str));
+ ast::type::StructType pre_struct("Pre", pre_str);
auto* coord_var = create<ast::DecoratedVariable>(create<ast::Variable>(
"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 @@
ast::type::VectorType ivec3(&i32, 3);
ast::type::VectorType fvec3(&f32, 3);
- ast::StructMemberList members;
- ast::StructMemberDecorationList deco;
- deco.push_back(create<ast::StructMemberOffsetDecoration>(0, Source{}));
- members.push_back(create<ast::StructMember>("a", &ivec3, std::move(deco)));
-
- deco.push_back(create<ast::StructMemberOffsetDecoration>(16, Source{}));
- members.push_back(create<ast::StructMember>("b", &fvec3, std::move(deco)));
-
auto* data_str = create<ast::Struct>();
- data_str->set_members(std::move(members));
+ data_str->set_members({
+ create<ast::StructMember>(
+ "a", &ivec3,
+ ast::StructMemberDecorationList{
+ create<ast::StructMemberOffsetDecoration>(0, Source{})}),
+ create<ast::StructMember>(
+ "b", &fvec3,
+ ast::StructMemberDecorationList{
+ create<ast::StructMemberOffsetDecoration>(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<ast::StrideDecoration>(32, Source{}));
- ary.set_decorations(std::move(decos));
-
- deco.push_back(create<ast::StructMemberOffsetDecoration>(0, Source{}));
- members.push_back(create<ast::StructMember>("c", &ary, std::move(deco)));
+ ary.set_decorations({create<ast::StrideDecoration>(32, Source{})});
auto* pre_str = create<ast::Struct>();
- pre_str->set_members(std::move(members));
+ pre_str->set_members({create<ast::StructMember>(
+ "c", &ary,
+ ast::StructMemberDecorationList{
+ create<ast::StructMemberOffsetDecoration>(0, Source{})})});
- ast::type::StructType pre_struct("Pre", std::move(pre_str));
+ ast::type::StructType pre_struct("Pre", pre_str);
auto* coord_var = create<ast::DecoratedVariable>(create<ast::Variable>(
"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 @@
ast::type::VectorType ivec3(&i32, 3);
ast::type::VectorType fvec3(&f32, 3);
- ast::StructMemberList members;
- ast::StructMemberDecorationList deco;
- deco.push_back(create<ast::StructMemberOffsetDecoration>(0, Source{}));
- members.push_back(create<ast::StructMember>("a", &ivec3, std::move(deco)));
-
- deco.push_back(create<ast::StructMemberOffsetDecoration>(16, Source{}));
- members.push_back(create<ast::StructMember>("b", &fvec3, std::move(deco)));
-
auto* data_str = create<ast::Struct>();
- data_str->set_members(std::move(members));
+ data_str->set_members({
+ create<ast::StructMember>(
+ "a", &ivec3,
+ ast::StructMemberDecorationList{
+ create<ast::StructMemberOffsetDecoration>(0, Source{})}),
+ create<ast::StructMember>(
+ "b", &fvec3,
+ ast::StructMemberDecorationList{
+ create<ast::StructMemberOffsetDecoration>(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<ast::StrideDecoration>(32, Source{}));
- ary.set_decorations(std::move(decos));
-
- deco.push_back(create<ast::StructMemberOffsetDecoration>(0, Source{}));
- members.push_back(create<ast::StructMember>("c", &ary, std::move(deco)));
+ ary.set_decorations({create<ast::StrideDecoration>(32, Source{})});
auto* pre_str = create<ast::Struct>();
- pre_str->set_members(std::move(members));
+ pre_str->set_members({create<ast::StructMember>(
+ "c", &ary,
+ ast::StructMemberDecorationList{
+ create<ast::StructMemberOffsetDecoration>(0, Source{})})});
- ast::type::StructType pre_struct("Pre", std::move(pre_str));
+ ast::type::StructType pre_struct("Pre", pre_str);
auto* coord_var = create<ast::DecoratedVariable>(create<ast::Variable>(
"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 @@
ast::type::VectorType ivec3(&i32, 3);
ast::type::VectorType fvec3(&f32, 3);
- ast::StructMemberList members;
- ast::StructMemberDecorationList deco;
- deco.push_back(create<ast::StructMemberOffsetDecoration>(0, Source{}));
- members.push_back(create<ast::StructMember>("a", &ivec3, std::move(deco)));
-
- deco.push_back(create<ast::StructMemberOffsetDecoration>(16, Source{}));
- members.push_back(create<ast::StructMember>("b", &fvec3, std::move(deco)));
-
auto* data_str = create<ast::Struct>();
- data_str->set_members(std::move(members));
+ data_str->set_members({
+ create<ast::StructMember>(
+ "a", &ivec3,
+ ast::StructMemberDecorationList{
+ create<ast::StructMemberOffsetDecoration>(0, Source{})}),
+ create<ast::StructMember>(
+ "b", &fvec3,
+ ast::StructMemberDecorationList{
+ create<ast::StructMemberOffsetDecoration>(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<ast::StrideDecoration>(32, Source{}));
- ary.set_decorations(std::move(decos));
-
- deco.push_back(create<ast::StructMemberOffsetDecoration>(0, Source{}));
- members.push_back(create<ast::StructMember>("c", &ary, std::move(deco)));
+ ary.set_decorations({create<ast::StrideDecoration>(32, Source{})});
auto* pre_str = create<ast::Struct>();
- pre_str->set_members(std::move(members));
+ pre_str->set_members({create<ast::StructMember>(
+ "c", &ary,
+ ast::StructMemberDecorationList{
+ create<ast::StructMemberOffsetDecoration>(0, Source{})})});
- ast::type::StructType pre_struct("Pre", std::move(pre_str));
+ ast::type::StructType pre_struct("Pre", pre_str);
auto* coord_var = create<ast::DecoratedVariable>(create<ast::Variable>(
"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 @@
auto* lit2 = create<ast::FloatLiteral>(&f32, 2.f);
auto* lit3 = create<ast::FloatLiteral>(&f32, 3.f);
ast::ExpressionList values;
- values.push_back(create<ast::ScalarConstructorExpression>(std::move(lit1)));
- values.push_back(create<ast::ScalarConstructorExpression>(std::move(lit2)));
- values.push_back(create<ast::ScalarConstructorExpression>(std::move(lit3)));
+ values.push_back(create<ast::ScalarConstructorExpression>(lit1));
+ values.push_back(create<ast::ScalarConstructorExpression>(lit2));
+ values.push_back(create<ast::ScalarConstructorExpression>(lit3));
- auto* rhs = create<ast::TypeConstructorExpression>(&fvec3, std::move(values));
+ auto* rhs = create<ast::TypeConstructorExpression>(&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 @@
ast::type::VectorType ivec3(&i32, 3);
ast::type::VectorType fvec3(&f32, 3);
- ast::StructMemberList members;
- ast::StructMemberDecorationList deco;
- deco.push_back(create<ast::StructMemberOffsetDecoration>(0, Source{}));
- members.push_back(create<ast::StructMember>("a", &ivec3, std::move(deco)));
-
- deco.push_back(create<ast::StructMemberOffsetDecoration>(16, Source{}));
- members.push_back(create<ast::StructMember>("b", &fvec3, std::move(deco)));
-
auto* data_str = create<ast::Struct>();
- data_str->set_members(std::move(members));
+ data_str->set_members({
+ create<ast::StructMember>(
+ "a", &ivec3,
+ ast::StructMemberDecorationList{
+ create<ast::StructMemberOffsetDecoration>(0, Source{})}),
+ create<ast::StructMember>(
+ "b", &fvec3,
+ ast::StructMemberDecorationList{
+ create<ast::StructMemberOffsetDecoration>(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<ast::StrideDecoration>(32, Source{}));
- ary.set_decorations(std::move(decos));
-
- deco.push_back(create<ast::StructMemberOffsetDecoration>(0, Source{}));
- members.push_back(create<ast::StructMember>("c", &ary, std::move(deco)));
+ ary.set_decorations({create<ast::StrideDecoration>(32, Source{})});
auto* pre_str = create<ast::Struct>();
- pre_str->set_members(std::move(members));
+ pre_str->set_members({create<ast::StructMember>(
+ "c", &ary,
+ ast::StructMemberDecorationList{
+ create<ast::StructMemberOffsetDecoration>(0, Source{})})});
- ast::type::StructType pre_struct("Pre", std::move(pre_str));
+ ast::type::StructType pre_struct("Pre", pre_str);
auto* coord_var = create<ast::DecoratedVariable>(create<ast::Variable>(
"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 @@
auto* rhs = create<ast::ScalarConstructorExpression>(
create<ast::FloatLiteral>(&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 98e900f..3b78a97 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 @@
auto* var = create<ast::Variable>("pos", ast::StorageClass::kNone, &ary);
var->set_is_const(true);
- var->set_constructor(
- create<ast::TypeConstructorExpression>(&ary, std::move(exprs)));
+ var->set_constructor(create<ast::TypeConstructorExpression>(&ary, exprs));
ASSERT_TRUE(gen.EmitProgramConstVariable(out, var)) << gen.error();
EXPECT_EQ(
@@ -64,7 +63,7 @@
auto* var = create<ast::DecoratedVariable>(
create<ast::Variable>("pos", ast::StorageClass::kNone, &f32));
- var->set_decorations(std::move(decos));
+ var->set_decorations(decos);
var->set_is_const(true);
var->set_constructor(create<ast::ScalarConstructorExpression>(
create<ast::FloatLiteral>(&f32, 3.0f)));
@@ -86,7 +85,7 @@
auto* var = create<ast::DecoratedVariable>(
create<ast::Variable>("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 75473b0..4744be8 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_ReturnWithValue) {
auto* expr = create<ast::IdentifierExpression>("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 4104939..ab33821 100644
--- a/src/writer/hlsl/generator_impl_switch_test.cc
+++ b/src/writer/hlsl/generator_impl_switch_test.cc
@@ -33,7 +33,7 @@
TEST_F(HlslGeneratorImplTest_Switch, Emit_Switch) {
auto* def_body = create<ast::BlockStatement>();
def_body->append(create<ast::BreakStatement>());
- auto* def = create<ast::CaseStatement>(std::move(def_body));
+ auto* def = create<ast::CaseStatement>(def_body);
ast::type::I32Type i32;
ast::CaseSelectorList case_val;
@@ -42,15 +42,14 @@
auto* case_body = create<ast::BlockStatement>();
case_body->append(create<ast::BreakStatement>());
- auto* case_stmt =
- create<ast::CaseStatement>(std::move(case_val), std::move(case_body));
+ auto* case_stmt = create<ast::CaseStatement>(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<ast::IdentifierExpression>("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 7f11b76..f2854aa 100644
--- a/src/writer/hlsl/generator_impl_test.cc
+++ b/src/writer/hlsl/generator_impl_test.cc
@@ -31,7 +31,7 @@
ast::type::VoidType void_type;
auto* func = create<ast::Function>("my_func", ast::VariableList{}, &void_type,
create<ast::BlockStatement>());
- 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 b507f6b..a4ee48b 100644
--- a/src/writer/hlsl/generator_impl_type_test.cc
+++ b/src/writer/hlsl/generator_impl_type_test.cc
@@ -179,12 +179,12 @@
ast::StructMemberDecorationList b_deco;
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(4, Source{}));
- members.push_back(create<ast::StructMember>("b", &f32, std::move(b_deco)));
+ members.push_back(create<ast::StructMember>("b", &f32, b_deco));
auto* str = create<ast::Struct>();
- 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 @@
ast::StructMemberDecorationList b_deco;
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(4, Source{}));
- members.push_back(create<ast::StructMember>("b", &f32, std::move(b_deco)));
+ members.push_back(create<ast::StructMember>("b", &f32, b_deco));
auto* str = create<ast::Struct>();
- 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 @@
decos.push_back(create<ast::StructMemberOffsetDecoration>(4, Source{}));
ast::StructMemberList members;
- members.push_back(create<ast::StructMember>("a", &i32, std::move(decos)));
+ members.push_back(create<ast::StructMember>("a", &i32, decos));
decos.push_back(create<ast::StructMemberOffsetDecoration>(32, Source{}));
- members.push_back(create<ast::StructMember>("b", &f32, std::move(decos)));
+ members.push_back(create<ast::StructMember>("b", &f32, decos));
decos.push_back(create<ast::StructMemberOffsetDecoration>(128, Source{}));
- members.push_back(create<ast::StructMember>("c", &f32, std::move(decos)));
+ members.push_back(create<ast::StructMember>("c", &f32, decos));
auto* str = create<ast::Struct>();
- 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 @@
"double", &i32, ast::StructMemberDecorationList{}));
ast::StructMemberDecorationList b_deco;
- members.push_back(
- create<ast::StructMember>("float", &f32, std::move(b_deco)));
+ members.push_back(create<ast::StructMember>("float", &f32, b_deco));
auto* str = create<ast::Struct>();
- 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 @@
ast::StructMemberDecorationList b_deco;
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(4, Source{}));
- members.push_back(create<ast::StructMember>("b", &f32, std::move(b_deco)));
+ members.push_back(create<ast::StructMember>("b", &f32, b_deco));
ast::StructDecorationList decos;
decos.push_back(create<ast::StructBlockDecoration>(Source{}));
- auto* str = create<ast::Struct>(std::move(decos), std::move(members));
+ auto* str = create<ast::Struct>(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 30b25d0..7b9ed5f 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 @@
auto params = GetParam();
auto* expr = create<ast::IdentifierExpression>("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 f48ea87..813cdaa 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 @@
ast::type::F32Type f32;
auto* var = create<ast::Variable>("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 @@
auto* var = create<ast::Variable>("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 @@
auto* var = create<ast::Variable>("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 @@
ast::type::F32Type f32;
auto* var = create<ast::Variable>("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 @@
ast::type::F32Type f32;
auto* var = create<ast::Variable>("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 @@
ast::type::F32Type f32;
auto* var = create<ast::Variable>("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 @@
ast::type::VectorType vec(&f32, 3);
ast::ExpressionList values;
- auto* zero_vec =
- create<ast::TypeConstructorExpression>(&vec, std::move(values));
+ auto* zero_vec = create<ast::TypeConstructorExpression>(&vec, values);
auto* var = create<ast::Variable>("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<float, 3> a = vector<float, 3>(0.0f);
)");
@@ -129,13 +128,12 @@
ast::type::MatrixType mat(&f32, 3, 2);
ast::ExpressionList values;
- auto* zero_mat =
- create<ast::TypeConstructorExpression>(&mat, std::move(values));
+ auto* zero_mat = create<ast::TypeConstructorExpression>(&mat, values);
auto* var = create<ast::Variable>("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 e7b5eff..beebfc08 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 @@
ast::StructMemberDecorationList b_deco;
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(4, Source{}));
- members.push_back(create<ast::StructMember>("b", &i32, std::move(b_deco)));
+ members.push_back(create<ast::StructMember>("b", &i32, b_deco));
auto* str = create<ast::Struct>();
- 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 @@
ast::StructMemberDecorationList b_deco;
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(4, Source{}));
- members.push_back(create<ast::StructMember>("b", &i32, std::move(b_deco)));
+ members.push_back(create<ast::StructMember>("b", &i32, b_deco));
auto* str = create<ast::Struct>();
- 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 b9e47e9..ee85cb9 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 @@
TEST_F(MslGeneratorImplTest, EmitExpression_ArrayAccessor) {
ast::type::I32Type i32;
auto* lit = create<ast::SintLiteral>(&i32, 5);
- auto* idx = create<ast::ScalarConstructorExpression>(std::move(lit));
+ auto* idx = create<ast::ScalarConstructorExpression>(lit);
auto* ary = create<ast::IdentifierExpression>("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 @@
auto* ary = create<ast::IdentifierExpression>("ary");
auto* idx = create<ast::IdentifierExpression>("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 00ed1fb..eb673fe 100644
--- a/src/writer/msl/generator_impl_assign_test.cc
+++ b/src/writer/msl/generator_impl_assign_test.cc
@@ -32,7 +32,7 @@
TEST_F(MslGeneratorImplTest, Emit_Assign) {
auto* lhs = create<ast::IdentifierExpression>("lhs");
auto* rhs = create<ast::IdentifierExpression>("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 ac234e8..62e48ad 100644
--- a/src/writer/msl/generator_impl_binary_test.cc
+++ b/src/writer/msl/generator_impl_binary_test.cc
@@ -41,7 +41,7 @@
auto* left = create<ast::IdentifierExpression>("left");
auto* right = create<ast::IdentifierExpression>("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 776311e..82fdcab 100644
--- a/src/writer/msl/generator_impl_bitcast_test.cc
+++ b/src/writer/msl/generator_impl_bitcast_test.cc
@@ -32,7 +32,7 @@
TEST_F(MslGeneratorImplTest, EmitExpression_Bitcast) {
ast::type::F32Type f32;
auto* id = create<ast::IdentifierExpression>("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<float>(id)");
diff --git a/src/writer/msl/generator_impl_call_test.cc b/src/writer/msl/generator_impl_call_test.cc
index dee21a9..2a36938 100644
--- a/src/writer/msl/generator_impl_call_test.cc
+++ b/src/writer/msl/generator_impl_call_test.cc
@@ -35,11 +35,11 @@
ast::type::VoidType void_type;
auto* id = create<ast::IdentifierExpression>("my_func");
- ast::CallExpression call(std::move(id), {});
+ ast::CallExpression call(id, {});
auto* func = create<ast::Function>("my_func", ast::VariableList{}, &void_type,
create<ast::BlockStatement>());
- 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 @@
ast::ExpressionList params;
params.push_back(create<ast::IdentifierExpression>("param1"));
params.push_back(create<ast::IdentifierExpression>("param2"));
- ast::CallExpression call(std::move(id), std::move(params));
+ ast::CallExpression call(id, params);
auto* func = create<ast::Function>("my_func", ast::VariableList{}, &void_type,
create<ast::BlockStatement>());
- 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 @@
ast::ExpressionList params;
params.push_back(create<ast::IdentifierExpression>("param1"));
params.push_back(create<ast::IdentifierExpression>("param2"));
- ast::CallStatement call(
- create<ast::CallExpression>(std::move(id), std::move(params)));
+ ast::CallStatement call(create<ast::CallExpression>(id, params));
auto* func = create<ast::Function>("my_func", ast::VariableList{}, &void_type,
create<ast::BlockStatement>());
- 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 7419f16..72d07a9 100644
--- a/src/writer/msl/generator_impl_case_test.cc
+++ b/src/writer/msl/generator_impl_case_test.cc
@@ -40,7 +40,7 @@
ast::CaseSelectorList lit;
lit.push_back(create<ast::SintLiteral>(&i32, 5));
- ast::CaseStatement c(std::move(lit), std::move(body));
+ ast::CaseStatement c(lit, body);
gen.increment_indent();
@@ -56,7 +56,7 @@
ast::CaseSelectorList lit;
lit.push_back(create<ast::SintLiteral>(&i32, 5));
- ast::CaseStatement c(std::move(lit), create<ast::BlockStatement>());
+ ast::CaseStatement c(lit, create<ast::BlockStatement>());
gen.increment_indent();
@@ -75,7 +75,7 @@
ast::CaseSelectorList lit;
lit.push_back(create<ast::SintLiteral>(&i32, 5));
- ast::CaseStatement c(std::move(lit), std::move(body));
+ ast::CaseStatement c(lit, body);
gen.increment_indent();
@@ -95,7 +95,7 @@
ast::CaseSelectorList lit;
lit.push_back(create<ast::SintLiteral>(&i32, 5));
lit.push_back(create<ast::SintLiteral>(&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_Default) {
auto* body = create<ast::BlockStatement>();
body->append(create<ast::BreakStatement>());
- 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 eefa7a3..05b4fed 100644
--- a/src/writer/msl/generator_impl_cast_test.cc
+++ b/src/writer/msl/generator_impl_cast_test.cc
@@ -36,7 +36,7 @@
ast::ExpressionList params;
params.push_back(create<ast::IdentifierExpression>("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 @@
ast::ExpressionList params;
params.push_back(create<ast::IdentifierExpression>("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 41a8b75..27c8ec1 100644
--- a/src/writer/msl/generator_impl_constructor_test.cc
+++ b/src/writer/msl/generator_impl_constructor_test.cc
@@ -40,7 +40,7 @@
TEST_F(MslGeneratorImplTest, EmitConstructor_Bool) {
ast::type::BoolType bool_type;
auto* lit = create<ast::BoolLiteral>(&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_Int) {
ast::type::I32Type i32;
auto* lit = create<ast::SintLiteral>(&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_UInt) {
ast::type::U32Type u32;
auto* lit = create<ast::UintLiteral>(&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 @@
// Use a number close to 1<<30 but whose decimal representation ends in 0.
auto* lit =
create<ast::FloatLiteral>(&f32, static_cast<float>((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 @@
auto* lit = create<ast::FloatLiteral>(&f32, -1.2e-5);
ast::ExpressionList values;
- values.push_back(create<ast::ScalarConstructorExpression>(std::move(lit)));
+ values.push_back(create<ast::ScalarConstructorExpression>(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 @@
auto* lit = create<ast::BoolLiteral>(&b, true);
ast::ExpressionList values;
- values.push_back(create<ast::ScalarConstructorExpression>(std::move(lit)));
+ values.push_back(create<ast::ScalarConstructorExpression>(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 @@
auto* lit = create<ast::SintLiteral>(&i32, -12345);
ast::ExpressionList values;
- values.push_back(create<ast::ScalarConstructorExpression>(std::move(lit)));
+ values.push_back(create<ast::ScalarConstructorExpression>(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 @@
auto* lit = create<ast::UintLiteral>(&u32, 12345);
ast::ExpressionList values;
- values.push_back(create<ast::ScalarConstructorExpression>(std::move(lit)));
+ values.push_back(create<ast::ScalarConstructorExpression>(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 @@
auto* lit2 = create<ast::FloatLiteral>(&f32, 2.f);
auto* lit3 = create<ast::FloatLiteral>(&f32, 3.f);
ast::ExpressionList values;
- values.push_back(create<ast::ScalarConstructorExpression>(std::move(lit1)));
- values.push_back(create<ast::ScalarConstructorExpression>(std::move(lit2)));
- values.push_back(create<ast::ScalarConstructorExpression>(std::move(lit3)));
+ values.push_back(create<ast::ScalarConstructorExpression>(lit1));
+ values.push_back(create<ast::ScalarConstructorExpression>(lit2));
+ values.push_back(create<ast::ScalarConstructorExpression>(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 @@
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 @@
create<ast::FloatLiteral>(&f32, static_cast<float>(3 + (i * 2)));
ast::ExpressionList values;
- values.push_back(create<ast::ScalarConstructorExpression>(std::move(lit1)));
- values.push_back(create<ast::ScalarConstructorExpression>(std::move(lit2)));
- values.push_back(create<ast::ScalarConstructorExpression>(std::move(lit3)));
+ values.push_back(create<ast::ScalarConstructorExpression>(lit1));
+ values.push_back(create<ast::ScalarConstructorExpression>(lit2));
+ values.push_back(create<ast::ScalarConstructorExpression>(lit3));
- mat_values.push_back(
- create<ast::TypeConstructorExpression>(&vec, std::move(values)));
+ mat_values.push_back(create<ast::TypeConstructorExpression>(&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 @@
create<ast::FloatLiteral>(&f32, static_cast<float>(3 + (i * 3)));
ast::ExpressionList values;
- values.push_back(create<ast::ScalarConstructorExpression>(std::move(lit1)));
- values.push_back(create<ast::ScalarConstructorExpression>(std::move(lit2)));
- values.push_back(create<ast::ScalarConstructorExpression>(std::move(lit3)));
+ values.push_back(create<ast::ScalarConstructorExpression>(lit1));
+ values.push_back(create<ast::ScalarConstructorExpression>(lit2));
+ values.push_back(create<ast::ScalarConstructorExpression>(lit3));
- ary_values.push_back(
- create<ast::TypeConstructorExpression>(&vec, std::move(values)));
+ ary_values.push_back(create<ast::TypeConstructorExpression>(&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 3652697..492ffc8 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 @@
auto* foo_var = create<ast::DecoratedVariable>(
create<ast::Variable>("foo", ast::StorageClass::kInput, &f32));
-
- ast::VariableDecorationList decos;
- decos.push_back(create<ast::LocationDecoration>(0, Source{}));
- foo_var->set_decorations(std::move(decos));
+ foo_var->set_decorations({create<ast::LocationDecoration>(0, Source{})});
auto* bar_var = create<ast::DecoratedVariable>(
create<ast::Variable>("bar", ast::StorageClass::kInput, &i32));
- decos.push_back(create<ast::LocationDecoration>(1, Source{}));
- bar_var->set_decorations(std::move(decos));
+ bar_var->set_decorations({create<ast::LocationDecoration>(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<ast::BlockStatement>();
@@ -79,17 +75,15 @@
create<ast::IdentifierExpression>("bar"),
create<ast::IdentifierExpression>("bar")));
- auto* func = create<ast::Function>("vtx_main", std::move(params), &f32,
- std::move(body));
+ auto* func = create<ast::Function>("vtx_main", params, &f32, body);
func->add_decoration(
create<ast::StageDecoration>(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 @@
auto* foo_var = create<ast::DecoratedVariable>(
create<ast::Variable>("foo", ast::StorageClass::kOutput, &f32));
-
- ast::VariableDecorationList decos;
- decos.push_back(create<ast::LocationDecoration>(0, Source{}));
- foo_var->set_decorations(std::move(decos));
+ foo_var->set_decorations({create<ast::LocationDecoration>(0, Source{})});
auto* bar_var = create<ast::DecoratedVariable>(
create<ast::Variable>("bar", ast::StorageClass::kOutput, &i32));
- decos.push_back(create<ast::LocationDecoration>(1, Source{}));
- bar_var->set_decorations(std::move(decos));
+ bar_var->set_decorations({create<ast::LocationDecoration>(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<ast::BlockStatement>();
@@ -137,17 +127,15 @@
create<ast::IdentifierExpression>("bar"),
create<ast::IdentifierExpression>("bar")));
- auto* func = create<ast::Function>("vtx_main", std::move(params), &f32,
- std::move(body));
+ auto* func = create<ast::Function>("vtx_main", params, &f32, body);
func->add_decoration(
create<ast::StageDecoration>(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 @@
auto* foo_var = create<ast::DecoratedVariable>(
create<ast::Variable>("foo", ast::StorageClass::kInput, &f32));
-
- ast::VariableDecorationList decos;
- decos.push_back(create<ast::LocationDecoration>(0, Source{}));
- foo_var->set_decorations(std::move(decos));
+ foo_var->set_decorations({create<ast::LocationDecoration>(0, Source{})});
auto* bar_var = create<ast::DecoratedVariable>(
create<ast::Variable>("bar", ast::StorageClass::kInput, &i32));
- decos.push_back(create<ast::LocationDecoration>(1, Source{}));
- bar_var->set_decorations(std::move(decos));
+ bar_var->set_decorations({create<ast::LocationDecoration>(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<ast::BlockStatement>();
@@ -194,17 +178,15 @@
body->append(create<ast::AssignmentStatement>(
create<ast::IdentifierExpression>("bar"),
create<ast::IdentifierExpression>("bar")));
- auto* func =
- create<ast::Function>("main", std::move(params), &f32, std::move(body));
+ auto* func = create<ast::Function>("main", params, &f32, body);
func->add_decoration(
create<ast::StageDecoration>(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 @@
auto* foo_var = create<ast::DecoratedVariable>(
create<ast::Variable>("foo", ast::StorageClass::kOutput, &f32));
-
- ast::VariableDecorationList decos;
- decos.push_back(create<ast::LocationDecoration>(0, Source{}));
- foo_var->set_decorations(std::move(decos));
+ foo_var->set_decorations({create<ast::LocationDecoration>(0, Source{})});
auto* bar_var = create<ast::DecoratedVariable>(
create<ast::Variable>("bar", ast::StorageClass::kOutput, &i32));
- decos.push_back(create<ast::LocationDecoration>(1, Source{}));
- bar_var->set_decorations(std::move(decos));
+ bar_var->set_decorations({create<ast::LocationDecoration>(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<ast::BlockStatement>();
@@ -252,17 +230,15 @@
create<ast::IdentifierExpression>("bar"),
create<ast::IdentifierExpression>("bar")));
- auto* func =
- create<ast::Function>("main", std::move(params), &f32, std::move(body));
+ auto* func = create<ast::Function>("main", params, &f32, body);
func->add_decoration(
create<ast::StageDecoration>(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 @@
ast::VariableDecorationList decos;
decos.push_back(create<ast::LocationDecoration>(0, Source{}));
- foo_var->set_decorations(std::move(decos));
+ foo_var->set_decorations(decos);
auto* bar_var = create<ast::DecoratedVariable>(
create<ast::Variable>("bar", ast::StorageClass::kInput, &i32));
decos.push_back(create<ast::LocationDecoration>(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<ast::BlockStatement>();
@@ -307,17 +283,15 @@
create<ast::IdentifierExpression>("bar"),
create<ast::IdentifierExpression>("bar")));
- auto* func =
- create<ast::Function>("main", std::move(params), &f32, std::move(body));
+ auto* func = create<ast::Function>("main", params, &f32, body);
func->add_decoration(
create<ast::StageDecoration>(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 @@
ast::VariableDecorationList decos;
decos.push_back(create<ast::LocationDecoration>(0, Source{}));
- foo_var->set_decorations(std::move(decos));
+ foo_var->set_decorations(decos);
auto* bar_var = create<ast::DecoratedVariable>(
create<ast::Variable>("bar", ast::StorageClass::kOutput, &i32));
decos.push_back(create<ast::LocationDecoration>(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<ast::BlockStatement>();
@@ -357,17 +331,15 @@
create<ast::IdentifierExpression>("bar"),
create<ast::IdentifierExpression>("bar")));
- auto* func =
- create<ast::Function>("main", std::move(params), &f32, std::move(body));
+ auto* func = create<ast::Function>("main", params, &f32, body);
func->add_decoration(
create<ast::StageDecoration>(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 @@
auto* coord_var = create<ast::DecoratedVariable>(
create<ast::Variable>("coord", ast::StorageClass::kInput, &vec4));
-
- ast::VariableDecorationList decos;
- decos.push_back(
- create<ast::BuiltinDecoration>(ast::Builtin::kFragCoord, Source{}));
- coord_var->set_decorations(std::move(decos));
+ coord_var->set_decorations(
+ {create<ast::BuiltinDecoration>(ast::Builtin::kFragCoord, Source{})});
auto* depth_var = create<ast::DecoratedVariable>(
create<ast::Variable>("depth", ast::StorageClass::kOutput, &f32));
- decos.push_back(
- create<ast::BuiltinDecoration>(ast::Builtin::kFragDepth, Source{}));
- depth_var->set_decorations(std::move(decos));
+ depth_var->set_decorations(
+ {create<ast::BuiltinDecoration>(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 @@
create<ast::IdentifierExpression>("coord"),
create<ast::IdentifierExpression>("x"))));
- auto* func = create<ast::Function>("main", std::move(params), &void_type,
- std::move(body));
+ auto* func = create<ast::Function>("main", params, &void_type, body);
func->add_decoration(
create<ast::StageDecoration>(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 7a2ae42..5828ee2 100644
--- a/src/writer/msl/generator_impl_function_test.cc
+++ b/src/writer/msl/generator_impl_function_test.cc
@@ -62,10 +62,10 @@
auto* body = create<ast::BlockStatement>();
body->append(create<ast::ReturnStatement>());
- auto* func = create<ast::Function>("my_func", ast::VariableList{}, &void_type,
- std::move(body));
+ auto* func =
+ create<ast::Function>("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 @@
auto* body = create<ast::BlockStatement>();
body->append(create<ast::ReturnStatement>());
- auto* func = create<ast::Function>("main", ast::VariableList{}, &void_type,
- std::move(body));
+ auto* func =
+ create<ast::Function>("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 @@
auto* body = create<ast::BlockStatement>();
body->append(create<ast::ReturnStatement>());
- auto* func = create<ast::Function>("my_func", std::move(params), &void_type,
- std::move(body));
+ auto* func = create<ast::Function>("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 @@
auto* foo_var = create<ast::DecoratedVariable>(
create<ast::Variable>("foo", ast::StorageClass::kInput, &f32));
-
- ast::VariableDecorationList decos;
- decos.push_back(create<ast::LocationDecoration>(0, Source{}));
- foo_var->set_decorations(std::move(decos));
+ foo_var->set_decorations({create<ast::LocationDecoration>(0, Source{})});
auto* bar_var = create<ast::DecoratedVariable>(
create<ast::Variable>("bar", ast::StorageClass::kOutput, &f32));
- decos.push_back(create<ast::LocationDecoration>(1, Source{}));
- bar_var->set_decorations(std::move(decos));
+ bar_var->set_decorations({create<ast::LocationDecoration>(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<ast::BlockStatement>();
@@ -156,12 +151,11 @@
create<ast::IdentifierExpression>("foo")));
body->append(create<ast::ReturnStatement>());
- auto* func = create<ast::Function>("frag_main", std::move(params), &void_type,
- std::move(body));
+ auto* func = create<ast::Function>("frag_main", params, &void_type, body);
func->add_decoration(
create<ast::StageDecoration>(ast::PipelineStage::kFragment, Source{}));
- mod.AddFunction(std::move(func));
+ mod.AddFunction(func);
ASSERT_TRUE(td.Determine()) << td.error();
@@ -193,23 +187,19 @@
auto* coord_var = create<ast::DecoratedVariable>(
create<ast::Variable>("coord", ast::StorageClass::kInput, &vec4));
-
- ast::VariableDecorationList decos;
- decos.push_back(
- create<ast::BuiltinDecoration>(ast::Builtin::kFragCoord, Source{}));
- coord_var->set_decorations(std::move(decos));
+ coord_var->set_decorations(
+ {create<ast::BuiltinDecoration>(ast::Builtin::kFragCoord, Source{})});
auto* depth_var = create<ast::DecoratedVariable>(
create<ast::Variable>("depth", ast::StorageClass::kOutput, &f32));
- decos.push_back(
- create<ast::BuiltinDecoration>(ast::Builtin::kFragDepth, Source{}));
- depth_var->set_decorations(std::move(decos));
+ depth_var->set_decorations(
+ {create<ast::BuiltinDecoration>(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<ast::BlockStatement>();
@@ -220,12 +210,11 @@
create<ast::IdentifierExpression>("x"))));
body->append(create<ast::ReturnStatement>());
- auto* func = create<ast::Function>("frag_main", std::move(params), &void_type,
- std::move(body));
+ auto* func = create<ast::Function>("frag_main", params, &void_type, body);
func->add_decoration(
create<ast::StageDecoration>(ast::PipelineStage::kFragment, Source{}));
- mod.AddFunction(std::move(func));
+ mod.AddFunction(func);
ASSERT_TRUE(td.Determine()) << td.error();
@@ -256,11 +245,11 @@
ast::VariableDecorationList decos;
decos.push_back(create<ast::BindingDecoration>(0, Source{}));
decos.push_back(create<ast::SetDecoration>(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<ast::Variable>("v", ast::StorageClass::kFunction, &f32);
@@ -269,15 +258,14 @@
create<ast::IdentifierExpression>("x")));
auto* body = create<ast::BlockStatement>();
- body->append(create<ast::VariableDeclStatement>(std::move(var)));
+ body->append(create<ast::VariableDeclStatement>(var));
body->append(create<ast::ReturnStatement>());
- auto* func = create<ast::Function>("frag_main", std::move(params), &void_type,
- std::move(body));
+ auto* func = create<ast::Function>("frag_main", params, &void_type, body);
func->add_decoration(
create<ast::StageDecoration>(ast::PipelineStage::kFragment, Source{}));
- mod.AddFunction(std::move(func));
+ mod.AddFunction(func);
ASSERT_TRUE(td.Determine()) << td.error();
@@ -301,16 +289,16 @@
ast::StructMemberList members;
ast::StructMemberDecorationList a_deco;
a_deco.push_back(create<ast::StructMemberOffsetDecoration>(0, Source{}));
- members.push_back(create<ast::StructMember>("a", &i32, std::move(a_deco)));
+ members.push_back(create<ast::StructMember>("a", &i32, a_deco));
ast::StructMemberDecorationList b_deco;
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(4, Source{}));
- members.push_back(create<ast::StructMember>("b", &f32, std::move(b_deco)));
+ members.push_back(create<ast::StructMember>("b", &f32, b_deco));
auto* str = create<ast::Struct>();
- 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 @@
ast::VariableDecorationList decos;
decos.push_back(create<ast::BindingDecoration>(0, Source{}));
decos.push_back(create<ast::SetDecoration>(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<ast::Variable>("v", ast::StorageClass::kFunction, &f32);
@@ -334,15 +322,14 @@
create<ast::IdentifierExpression>("b")));
auto* body = create<ast::BlockStatement>();
- body->append(create<ast::VariableDeclStatement>(std::move(var)));
+ body->append(create<ast::VariableDeclStatement>(var));
body->append(create<ast::ReturnStatement>());
- auto* func = create<ast::Function>("frag_main", std::move(params), &void_type,
- std::move(body));
+ auto* func = create<ast::Function>("frag_main", params, &void_type, body);
func->add_decoration(
create<ast::StageDecoration>(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 @@
ast::StructMemberList members;
ast::StructMemberDecorationList a_deco;
a_deco.push_back(create<ast::StructMemberOffsetDecoration>(0, Source{}));
- members.push_back(create<ast::StructMember>("a", &i32, std::move(a_deco)));
+ members.push_back(create<ast::StructMember>("a", &i32, a_deco));
ast::StructMemberDecorationList b_deco;
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(4, Source{}));
- members.push_back(create<ast::StructMember>("b", &f32, std::move(b_deco)));
+ members.push_back(create<ast::StructMember>("b", &f32, b_deco));
auto* str = create<ast::Struct>();
- 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 @@
ast::VariableDecorationList decos;
decos.push_back(create<ast::BindingDecoration>(0, Source{}));
decos.push_back(create<ast::SetDecoration>(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 @@
create<ast::IdentifierExpression>("b")));
auto* body = create<ast::BlockStatement>();
- body->append(create<ast::VariableDeclStatement>(std::move(var)));
+ body->append(create<ast::VariableDeclStatement>(var));
body->append(create<ast::ReturnStatement>());
- auto* func = create<ast::Function>("frag_main", std::move(params), &void_type,
- std::move(body));
+ auto* func = create<ast::Function>("frag_main", params, &void_type, body);
func->add_decoration(
create<ast::StageDecoration>(ast::PipelineStage::kFragment, Source{}));
- mod.AddFunction(std::move(func));
+ mod.AddFunction(func);
ASSERT_TRUE(td.Determine()) << td.error();
@@ -440,28 +426,23 @@
auto* foo_var = create<ast::DecoratedVariable>(
create<ast::Variable>("foo", ast::StorageClass::kInput, &f32));
-
- ast::VariableDecorationList decos;
- decos.push_back(create<ast::LocationDecoration>(0, Source{}));
- foo_var->set_decorations(std::move(decos));
+ foo_var->set_decorations({create<ast::LocationDecoration>(0, Source{})});
auto* bar_var = create<ast::DecoratedVariable>(
create<ast::Variable>("bar", ast::StorageClass::kOutput, &f32));
- decos.push_back(create<ast::LocationDecoration>(1, Source{}));
- bar_var->set_decorations(std::move(decos));
+ bar_var->set_decorations({create<ast::LocationDecoration>(1, Source{})});
auto* val_var = create<ast::DecoratedVariable>(
create<ast::Variable>("val", ast::StorageClass::kOutput, &f32));
- decos.push_back(create<ast::LocationDecoration>(0, Source{}));
- val_var->set_decorations(std::move(decos));
+ val_var->set_decorations({create<ast::LocationDecoration>(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 @@
create<ast::IdentifierExpression>("param")));
body->append(
create<ast::ReturnStatement>(create<ast::IdentifierExpression>("foo")));
- auto* sub_func = create<ast::Function>("sub_func", std::move(params), &f32,
- std::move(body));
+ auto* sub_func = create<ast::Function>("sub_func", params, &f32, body);
- mod.AddFunction(std::move(sub_func));
+ mod.AddFunction(sub_func);
ast::ExpressionList expr;
expr.push_back(create<ast::ScalarConstructorExpression>(
@@ -489,14 +469,13 @@
body->append(create<ast::AssignmentStatement>(
create<ast::IdentifierExpression>("bar"),
create<ast::CallExpression>(create<ast::IdentifierExpression>("sub_func"),
- std::move(expr))));
+ expr)));
body->append(create<ast::ReturnStatement>());
- auto* func_1 = create<ast::Function>("ep_1", std::move(params), &void_type,
- std::move(body));
+ auto* func_1 = create<ast::Function>("ep_1", params, &void_type, body);
func_1->add_decoration(
create<ast::StageDecoration>(ast::PipelineStage::kFragment, Source{}));
- mod.AddFunction(std::move(func_1));
+ mod.AddFunction(func_1);
ASSERT_TRUE(td.Determine()) << td.error();
@@ -539,11 +518,11 @@
ast::VariableDecorationList decos;
decos.push_back(
create<ast::BuiltinDecoration>(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 @@
auto* body = create<ast::BlockStatement>();
body->append(
create<ast::ReturnStatement>(create<ast::IdentifierExpression>("param")));
- auto* sub_func = create<ast::Function>("sub_func", std::move(params), &f32,
- std::move(body));
+ auto* sub_func = create<ast::Function>("sub_func", params, &f32, body);
- mod.AddFunction(std::move(sub_func));
+ mod.AddFunction(sub_func);
ast::ExpressionList expr;
expr.push_back(create<ast::ScalarConstructorExpression>(
@@ -565,15 +543,14 @@
body->append(create<ast::AssignmentStatement>(
create<ast::IdentifierExpression>("depth"),
create<ast::CallExpression>(create<ast::IdentifierExpression>("sub_func"),
- std::move(expr))));
+ expr)));
body->append(create<ast::ReturnStatement>());
- auto* func_1 = create<ast::Function>("ep_1", std::move(params), &void_type,
- std::move(body));
+ auto* func_1 = create<ast::Function>("ep_1", params, &void_type, body);
func_1->add_decoration(
create<ast::StageDecoration>(ast::PipelineStage::kFragment, Source{}));
- mod.AddFunction(std::move(func_1));
+ mod.AddFunction(func_1);
ASSERT_TRUE(td.Determine()) << td.error();
@@ -606,23 +583,19 @@
auto* coord_var = create<ast::DecoratedVariable>(
create<ast::Variable>("coord", ast::StorageClass::kInput, &vec4));
-
- ast::VariableDecorationList decos;
- decos.push_back(
- create<ast::BuiltinDecoration>(ast::Builtin::kFragCoord, Source{}));
- coord_var->set_decorations(std::move(decos));
+ coord_var->set_decorations(
+ {create<ast::BuiltinDecoration>(ast::Builtin::kFragCoord, Source{})});
auto* depth_var = create<ast::DecoratedVariable>(
create<ast::Variable>("depth", ast::StorageClass::kOutput, &f32));
- decos.push_back(
- create<ast::BuiltinDecoration>(ast::Builtin::kFragDepth, Source{}));
- depth_var->set_decorations(std::move(decos));
+ depth_var->set_decorations(
+ {create<ast::BuiltinDecoration>(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 @@
create<ast::IdentifierExpression>("x"))));
body->append(
create<ast::ReturnStatement>(create<ast::IdentifierExpression>("param")));
- auto* sub_func = create<ast::Function>("sub_func", std::move(params), &f32,
- std::move(body));
+ auto* sub_func = create<ast::Function>("sub_func", params, &f32, body);
- mod.AddFunction(std::move(sub_func));
+ mod.AddFunction(sub_func);
ast::ExpressionList expr;
expr.push_back(create<ast::ScalarConstructorExpression>(
@@ -649,14 +621,13 @@
body->append(create<ast::AssignmentStatement>(
create<ast::IdentifierExpression>("depth"),
create<ast::CallExpression>(create<ast::IdentifierExpression>("sub_func"),
- std::move(expr))));
+ expr)));
body->append(create<ast::ReturnStatement>());
- auto* func_1 = create<ast::Function>("ep_1", std::move(params), &void_type,
- std::move(body));
+ auto* func_1 = create<ast::Function>("ep_1", params, &void_type, body);
func_1->add_decoration(
create<ast::StageDecoration>(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 @@
ast::VariableDecorationList decos;
decos.push_back(create<ast::BindingDecoration>(0, Source{}));
decos.push_back(create<ast::SetDecoration>(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 @@
create<ast::ReturnStatement>(create<ast::MemberAccessorExpression>(
create<ast::IdentifierExpression>("coord"),
create<ast::IdentifierExpression>("x"))));
- auto* sub_func = create<ast::Function>("sub_func", std::move(params), &f32,
- std::move(body));
+ auto* sub_func = create<ast::Function>("sub_func", params, &f32, body);
- mod.AddFunction(std::move(sub_func));
+ mod.AddFunction(sub_func);
ast::ExpressionList expr;
expr.push_back(create<ast::ScalarConstructorExpression>(
@@ -718,18 +688,17 @@
auto* var = create<ast::Variable>("v", ast::StorageClass::kFunction, &f32);
var->set_constructor(create<ast::CallExpression>(
- create<ast::IdentifierExpression>("sub_func"), std::move(expr)));
+ create<ast::IdentifierExpression>("sub_func"), expr));
body = create<ast::BlockStatement>();
- body->append(create<ast::VariableDeclStatement>(std::move(var)));
+ body->append(create<ast::VariableDeclStatement>(var));
body->append(create<ast::ReturnStatement>());
- auto* func = create<ast::Function>("frag_main", std::move(params), &void_type,
- std::move(body));
+ auto* func = create<ast::Function>("frag_main", params, &void_type, body);
func->add_decoration(
create<ast::StageDecoration>(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 @@
ast::StructMemberList members;
ast::StructMemberDecorationList a_deco;
a_deco.push_back(create<ast::StructMemberOffsetDecoration>(0, Source{}));
- members.push_back(create<ast::StructMember>("a", &i32, std::move(a_deco)));
+ members.push_back(create<ast::StructMember>("a", &i32, a_deco));
ast::StructMemberDecorationList b_deco;
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(4, Source{}));
- members.push_back(create<ast::StructMember>("b", &f32, std::move(b_deco)));
+ members.push_back(create<ast::StructMember>("b", &f32, b_deco));
auto* str = create<ast::Struct>();
- 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 @@
ast::VariableDecorationList decos;
decos.push_back(create<ast::BindingDecoration>(0, Source{}));
decos.push_back(create<ast::SetDecoration>(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 @@
create<ast::ReturnStatement>(create<ast::MemberAccessorExpression>(
create<ast::IdentifierExpression>("coord"),
create<ast::IdentifierExpression>("b"))));
- auto* sub_func = create<ast::Function>("sub_func", std::move(params), &f32,
- std::move(body));
+ auto* sub_func = create<ast::Function>("sub_func", params, &f32, body);
- mod.AddFunction(std::move(sub_func));
+ mod.AddFunction(sub_func);
ast::ExpressionList expr;
expr.push_back(create<ast::ScalarConstructorExpression>(
@@ -801,18 +769,17 @@
auto* var = create<ast::Variable>("v", ast::StorageClass::kFunction, &f32);
var->set_constructor(create<ast::CallExpression>(
- create<ast::IdentifierExpression>("sub_func"), std::move(expr)));
+ create<ast::IdentifierExpression>("sub_func"), expr));
body = create<ast::BlockStatement>();
- body->append(create<ast::VariableDeclStatement>(std::move(var)));
+ body->append(create<ast::VariableDeclStatement>(var));
body->append(create<ast::ReturnStatement>());
- auto* func = create<ast::Function>("frag_main", std::move(params), &void_type,
- std::move(body));
+ auto* func = create<ast::Function>("frag_main", params, &void_type, body);
func->add_decoration(
create<ast::StageDecoration>(ast::PipelineStage::kFragment, Source{}));
- mod.AddFunction(std::move(func));
+ mod.AddFunction(func);
ASSERT_TRUE(td.Determine()) << td.error();
@@ -845,16 +812,16 @@
ast::StructMemberList members;
ast::StructMemberDecorationList a_deco;
a_deco.push_back(create<ast::StructMemberOffsetDecoration>(0, Source{}));
- members.push_back(create<ast::StructMember>("a", &i32, std::move(a_deco)));
+ members.push_back(create<ast::StructMember>("a", &i32, a_deco));
ast::StructMemberDecorationList b_deco;
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(4, Source{}));
- members.push_back(create<ast::StructMember>("b", &f32, std::move(b_deco)));
+ members.push_back(create<ast::StructMember>("b", &f32, b_deco));
auto* str = create<ast::Struct>();
- 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 @@
ast::VariableDecorationList decos;
decos.push_back(create<ast::BindingDecoration>(0, Source{}));
decos.push_back(create<ast::SetDecoration>(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 @@
create<ast::ReturnStatement>(create<ast::MemberAccessorExpression>(
create<ast::IdentifierExpression>("coord"),
create<ast::IdentifierExpression>("b"))));
- auto* sub_func = create<ast::Function>("sub_func", std::move(params), &f32,
- std::move(body));
+ auto* sub_func = create<ast::Function>("sub_func", params, &f32, body);
- mod.AddFunction(std::move(sub_func));
+ mod.AddFunction(sub_func);
ast::ExpressionList expr;
expr.push_back(create<ast::ScalarConstructorExpression>(
@@ -890,18 +856,17 @@
auto* var = create<ast::Variable>("v", ast::StorageClass::kFunction, &f32);
var->set_constructor(create<ast::CallExpression>(
- create<ast::IdentifierExpression>("sub_func"), std::move(expr)));
+ create<ast::IdentifierExpression>("sub_func"), expr));
body = create<ast::BlockStatement>();
- body->append(create<ast::VariableDeclStatement>(std::move(var)));
+ body->append(create<ast::VariableDeclStatement>(var));
body->append(create<ast::ReturnStatement>());
- auto* func = create<ast::Function>("frag_main", std::move(params), &void_type,
- std::move(body));
+ auto* func = create<ast::Function>("frag_main", params, &void_type, body);
func->add_decoration(
create<ast::StageDecoration>(ast::PipelineStage::kFragment, Source{}));
- mod.AddFunction(std::move(func));
+ mod.AddFunction(func);
ASSERT_TRUE(td.Determine()) << td.error();
@@ -935,10 +900,10 @@
create<ast::Variable>("bar", ast::StorageClass::kOutput, &f32));
ast::VariableDecorationList decos;
decos.push_back(create<ast::LocationDecoration>(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<ast::BlockStatement>();
@@ -956,16 +921,15 @@
create<ast::SintLiteral>(&i32, 1)),
create<ast::ScalarConstructorExpression>(
create<ast::SintLiteral>(&i32, 1))),
- std::move(list)));
+ list));
body->append(create<ast::ReturnStatement>());
- auto* func_1 = create<ast::Function>("ep_1", std::move(params), &void_type,
- std::move(body));
+ auto* func_1 = create<ast::Function>("ep_1", params, &void_type, body);
func_1->add_decoration(
create<ast::StageDecoration>(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 @@
func->add_decoration(
create<ast::StageDecoration>(ast::PipelineStage::kCompute, Source{}));
- mod.AddFunction(std::move(func));
+ mod.AddFunction(func);
ASSERT_TRUE(gen.Generate()) << gen.error();
EXPECT_EQ(gen.result(), R"(#include <metal_stdlib>
@@ -1018,10 +982,9 @@
auto* body = create<ast::BlockStatement>();
body->append(create<ast::ReturnStatement>());
- auto* func = create<ast::Function>("my_func", std::move(params), &void_type,
- std::move(body));
+ auto* func = create<ast::Function>("my_func", params, &void_type, body);
- mod.AddFunction(std::move(func));
+ mod.AddFunction(func);
gen.increment_indent();
@@ -1059,14 +1022,14 @@
ast::StructMemberList members;
ast::StructMemberDecorationList a_deco;
a_deco.push_back(create<ast::StructMemberOffsetDecoration>(0, Source{}));
- members.push_back(create<ast::StructMember>("d", &f32, std::move(a_deco)));
+ members.push_back(create<ast::StructMember>("d", &f32, a_deco));
ast::StructDecorationList s_decos;
s_decos.push_back(create<ast::StructBlockDecoration>(Source{}));
- auto* str = create<ast::Struct>(std::move(s_decos), std::move(members));
+ auto* str = create<ast::Struct>(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<ast::DecoratedVariable>(
@@ -1075,12 +1038,12 @@
ast::VariableDecorationList decos;
decos.push_back(create<ast::BindingDecoration>(0, Source{}));
decos.push_back(create<ast::SetDecoration>(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 @@
create<ast::IdentifierExpression>("d")));
auto* body = create<ast::BlockStatement>();
- body->append(create<ast::VariableDeclStatement>(std::move(var)));
+ body->append(create<ast::VariableDeclStatement>(var));
body->append(create<ast::ReturnStatement>());
- auto* func = create<ast::Function>("a", std::move(params), &void_type,
- std::move(body));
+ auto* func = create<ast::Function>("a", params, &void_type, body);
func->add_decoration(
create<ast::StageDecoration>(ast::PipelineStage::kCompute, Source{}));
- mod.AddFunction(std::move(func));
+ mod.AddFunction(func);
}
{
@@ -1109,15 +1071,14 @@
create<ast::IdentifierExpression>("d")));
auto* body = create<ast::BlockStatement>();
- body->append(create<ast::VariableDeclStatement>(std::move(var)));
+ body->append(create<ast::VariableDeclStatement>(var));
body->append(create<ast::ReturnStatement>());
- auto* func = create<ast::Function>("b", std::move(params), &void_type,
- std::move(body));
+ auto* func = create<ast::Function>("b", params, &void_type, body);
func->add_decoration(
create<ast::StageDecoration>(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 eec75df..71428a8 100644
--- a/src/writer/msl/generator_impl_if_test.cc
+++ b/src/writer/msl/generator_impl_if_test.cc
@@ -33,7 +33,7 @@
auto* body = create<ast::BlockStatement>();
body->append(create<ast::ReturnStatement>());
- ast::IfStatement i(std::move(cond), std::move(body));
+ ast::IfStatement i(cond, body);
gen.increment_indent();
@@ -50,15 +50,14 @@
else_body->append(create<ast::ReturnStatement>());
ast::ElseStatementList elses;
- elses.push_back(
- create<ast::ElseStatement>(std::move(else_cond), std::move(else_body)));
+ elses.push_back(create<ast::ElseStatement>(else_cond, else_body));
auto* cond = create<ast::IdentifierExpression>("cond");
auto* body = create<ast::BlockStatement>();
body->append(create<ast::ReturnStatement>());
- 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 @@
else_body->append(create<ast::ReturnStatement>());
ast::ElseStatementList elses;
- elses.push_back(create<ast::ElseStatement>(std::move(else_body)));
+ elses.push_back(create<ast::ElseStatement>(else_body));
auto* cond = create<ast::IdentifierExpression>("cond");
auto* body = create<ast::BlockStatement>();
body->append(create<ast::ReturnStatement>());
- 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 @@
else_body_2->append(create<ast::ReturnStatement>());
ast::ElseStatementList elses;
- elses.push_back(
- create<ast::ElseStatement>(std::move(else_cond), std::move(else_body)));
- elses.push_back(create<ast::ElseStatement>(std::move(else_body_2)));
+ elses.push_back(create<ast::ElseStatement>(else_cond, else_body));
+ elses.push_back(create<ast::ElseStatement>(else_body_2));
auto* cond = create<ast::IdentifierExpression>("cond");
auto* body = create<ast::BlockStatement>();
body->append(create<ast::ReturnStatement>());
- 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 3920f50..9d3b71a 100644
--- a/src/writer/msl/generator_impl_import_test.cc
+++ b/src/writer/msl/generator_impl_import_test.cc
@@ -59,14 +59,13 @@
create<ast::FloatLiteral>(&f32, 1.f)));
auto* ident = create<ast::IdentifierExpression>(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 @@
params.push_back(create<ast::ScalarConstructorExpression>(
create<ast::SintLiteral>(&i32, 1)));
- ast::CallExpression expr(create<ast::IdentifierExpression>("abs"),
- std::move(params));
+ ast::CallExpression expr(create<ast::IdentifierExpression>("abs"), params);
ASSERT_TRUE(td.DetermineResultType(&expr)) << td.error();
@@ -124,7 +122,7 @@
create<ast::FloatLiteral>(&f32, 2.f)));
ast::CallExpression expr(create<ast::IdentifierExpression>(param.name),
- std::move(params));
+ params);
ASSERT_TRUE(td.DetermineResultType(&expr)) << td.error();
ASSERT_TRUE(gen.EmitCall(&expr)) << gen.error();
@@ -149,28 +147,30 @@
ast::type::VectorType vec(&f32, 3);
ast::ExpressionList type_params;
- type_params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)));
- type_params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 2.f)));
- type_params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 3.f)));
ast::ExpressionList params;
- params.push_back(
- create<ast::TypeConstructorExpression>(&vec, std::move(type_params)));
+ params.push_back(create<ast::TypeConstructorExpression>(
+ &vec, ast::ExpressionList{
+ create<ast::ScalarConstructorExpression>(
+ create<ast::FloatLiteral>(&f32, 1.f)),
+ create<ast::ScalarConstructorExpression>(
+ create<ast::FloatLiteral>(&f32, 2.f)),
+ create<ast::ScalarConstructorExpression>(
+ create<ast::FloatLiteral>(&f32, 3.f)),
+ }));
- type_params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 4.f)));
- type_params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 5.f)));
- type_params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 6.f)));
- params.push_back(
- create<ast::TypeConstructorExpression>(&vec, std::move(type_params)));
+ params.push_back(create<ast::TypeConstructorExpression>(
+ &vec, ast::ExpressionList{
+ create<ast::ScalarConstructorExpression>(
+ create<ast::FloatLiteral>(&f32, 4.f)),
+ create<ast::ScalarConstructorExpression>(
+ create<ast::FloatLiteral>(&f32, 5.f)),
+ create<ast::ScalarConstructorExpression>(
+ create<ast::FloatLiteral>(&f32, 6.f)),
+ }));
ast::CallExpression expr(create<ast::IdentifierExpression>(param.name),
- std::move(params));
+ params);
ASSERT_TRUE(td.DetermineResultType(&expr)) << td.error();
ASSERT_TRUE(gen.EmitCall(&expr)) << gen.error();
@@ -195,7 +195,7 @@
create<ast::SintLiteral>(&i32, 2)));
ast::CallExpression expr(create<ast::IdentifierExpression>(param.name),
- std::move(params));
+ params);
ASSERT_TRUE(td.DetermineResultType(&expr)) << td.error();
ASSERT_TRUE(gen.EmitCall(&expr)) << gen.error();
@@ -221,7 +221,7 @@
create<ast::FloatLiteral>(&f32, 3.f)));
ast::CallExpression expr(create<ast::IdentifierExpression>(param.name),
- std::move(params));
+ params);
ASSERT_TRUE(td.DetermineResultType(&expr)) << td.error();
ASSERT_TRUE(gen.EmitCall(&expr)) << gen.error();
@@ -252,7 +252,7 @@
create<ast::SintLiteral>(&i32, 3)));
ast::CallExpression expr(create<ast::IdentifierExpression>(param.name),
- std::move(params));
+ params);
ASSERT_TRUE(td.DetermineResultType(&expr)) << td.error();
ASSERT_TRUE(gen.EmitCall(&expr)) << gen.error();
@@ -274,9 +274,9 @@
params.push_back(create<ast::IdentifierExpression>("var"));
ast::CallExpression expr(create<ast::IdentifierExpression>("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 5821b5b..2bd7dbe 100644
--- a/src/writer/msl/generator_impl_intrinsic_test.cc
+++ b/src/writer/msl/generator_impl_intrinsic_test.cc
@@ -79,13 +79,13 @@
params.push_back(create<ast::IdentifierExpression>("b"));
ast::CallExpression call(create<ast::IdentifierExpression>("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 @@
params.push_back(create<ast::IdentifierExpression>("param1"));
params.push_back(create<ast::IdentifierExpression>("param2"));
- ast::CallExpression call(create<ast::IdentifierExpression>("dot"),
- std::move(params));
+ ast::CallExpression call(create<ast::IdentifierExpression>("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 faabd7b..800b51b 100644
--- a/src/writer/msl/generator_impl_loop_test.cc
+++ b/src/writer/msl/generator_impl_loop_test.cc
@@ -39,7 +39,7 @@
auto* body = create<ast::BlockStatement>();
body->append(create<ast::DiscardStatement>());
- ast::LoopStatement l(std::move(body), {});
+ ast::LoopStatement l(body, {});
gen.increment_indent();
@@ -57,7 +57,7 @@
auto* continuing = create<ast::BlockStatement>();
continuing->append(create<ast::ReturnStatement>());
- ast::LoopStatement l(std::move(body), std::move(continuing));
+ ast::LoopStatement l(body, continuing);
gen.increment_indent();
@@ -85,20 +85,18 @@
auto* continuing = create<ast::BlockStatement>();
continuing->append(create<ast::ReturnStatement>());
- auto* inner =
- create<ast::LoopStatement>(std::move(body), std::move(continuing));
+ auto* inner = create<ast::LoopStatement>(body, continuing);
body = create<ast::BlockStatement>();
- body->append(std::move(inner));
+ body->append(inner);
auto* lhs = create<ast::IdentifierExpression>("lhs");
auto* rhs = create<ast::IdentifierExpression>("rhs");
continuing = create<ast::BlockStatement>();
- continuing->append(
- create<ast::AssignmentStatement>(std::move(lhs), std::move(rhs)));
+ continuing->append(create<ast::AssignmentStatement>(lhs, rhs));
- ast::LoopStatement outer(std::move(body), std::move(continuing));
+ ast::LoopStatement outer(body, continuing);
gen.increment_indent();
@@ -156,7 +154,7 @@
create<ast::FloatLiteral>(&f32, 2.4)));
auto* body = create<ast::BlockStatement>();
- body->append(create<ast::VariableDeclStatement>(std::move(var)));
+ body->append(create<ast::VariableDeclStatement>(var));
body->append(create<ast::VariableDeclStatement>(
create<ast::Variable>("other", ast::StorageClass::kFunction, &f32)));
@@ -164,12 +162,11 @@
auto* rhs = create<ast::IdentifierExpression>("rhs");
auto* continuing = create<ast::BlockStatement>();
- continuing->append(
- create<ast::AssignmentStatement>(std::move(lhs), std::move(rhs)));
+ continuing->append(create<ast::AssignmentStatement>(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 d0d1dc9..7672a01 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 @@
auto* str = create<ast::IdentifierExpression>("str");
auto* mem = create<ast::IdentifierExpression>("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 b0b392e..1612537 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 @@
auto* var = create<ast::Variable>("pos", ast::StorageClass::kNone, &ary);
var->set_is_const(true);
- var->set_constructor(
- create<ast::TypeConstructorExpression>(&ary, std::move(exprs)));
+ var->set_constructor(create<ast::TypeConstructorExpression>(&ary, exprs));
ASSERT_TRUE(gen.EmitProgramConstVariable(var)) << gen.error();
EXPECT_EQ(
@@ -66,7 +65,7 @@
auto* var = create<ast::DecoratedVariable>(
create<ast::Variable>("pos", ast::StorageClass::kNone, &f32));
- var->set_decorations(std::move(decos));
+ var->set_decorations(decos);
var->set_is_const(true);
var->set_constructor(create<ast::ScalarConstructorExpression>(
create<ast::FloatLiteral>(&f32, 3.0f)));
diff --git a/src/writer/msl/generator_impl_return_test.cc b/src/writer/msl/generator_impl_return_test.cc
index 651440d..408a51c 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_ReturnWithValue) {
auto* expr = create<ast::IdentifierExpression>("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 7511f62..25546b7 100644
--- a/src/writer/msl/generator_impl_switch_test.cc
+++ b/src/writer/msl/generator_impl_switch_test.cc
@@ -35,7 +35,7 @@
TEST_F(MslGeneratorImplTest, Emit_Switch) {
auto* def_body = create<ast::BlockStatement>();
def_body->append(create<ast::BreakStatement>());
- auto* def = create<ast::CaseStatement>(std::move(def_body));
+ auto* def = create<ast::CaseStatement>(def_body);
ast::type::I32Type i32;
ast::CaseSelectorList case_val;
@@ -44,15 +44,14 @@
auto* case_body = create<ast::BlockStatement>();
case_body->append(create<ast::BreakStatement>());
- auto* case_stmt =
- create<ast::CaseStatement>(std::move(case_val), std::move(case_body));
+ auto* case_stmt = create<ast::CaseStatement>(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<ast::IdentifierExpression>("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 d974ec9..e97b033 100644
--- a/src/writer/msl/generator_impl_test.cc
+++ b/src/writer/msl/generator_impl_test.cc
@@ -54,7 +54,7 @@
create<ast::BlockStatement>());
func->add_decoration(
create<ast::StageDecoration>(ast::PipelineStage::kCompute, Source{}));
- mod.AddFunction(std::move(func));
+ mod.AddFunction(func);
ASSERT_TRUE(gen.Generate()) << gen.error();
EXPECT_EQ(gen.result(), R"(#include <metal_stdlib>
@@ -160,18 +160,18 @@
decos.push_back(create<ast::StructMemberOffsetDecoration>(4, Source{}));
ast::StructMemberList members;
- members.push_back(create<ast::StructMember>("a", &i32, std::move(decos)));
+ members.push_back(create<ast::StructMember>("a", &i32, decos));
decos.push_back(create<ast::StructMemberOffsetDecoration>(32, Source{}));
- members.push_back(create<ast::StructMember>("b", &f32, std::move(decos)));
+ members.push_back(create<ast::StructMember>("b", &f32, decos));
decos.push_back(create<ast::StructMemberOffsetDecoration>(128, Source{}));
- members.push_back(create<ast::StructMember>("c", &f32, std::move(decos)));
+ members.push_back(create<ast::StructMember>("c", &f32, decos));
auto* str = create<ast::Struct>();
- 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 @@
decos.push_back(create<ast::StructMemberOffsetDecoration>(0, Source{}));
ast::StructMemberList members;
- members.push_back(create<ast::StructMember>("a", &i32, std::move(decos)));
+ members.push_back(create<ast::StructMember>("a", &i32, decos));
decos.push_back(create<ast::StructMemberOffsetDecoration>(16, Source{}));
- members.push_back(create<ast::StructMember>("b", &fvec, std::move(decos)));
+ members.push_back(create<ast::StructMember>("b", &fvec, decos));
decos.push_back(create<ast::StructMemberOffsetDecoration>(32, Source{}));
- members.push_back(create<ast::StructMember>("c", &f32, std::move(decos)));
+ members.push_back(create<ast::StructMember>("c", &f32, decos));
auto* inner_str = create<ast::Struct>();
- 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<ast::StructMemberOffsetDecoration>(0, Source{}));
- members.push_back(create<ast::StructMember>("d", &f32, std::move(decos)));
+ members.push_back(create<ast::StructMember>("d", &f32, decos));
decos.push_back(create<ast::StructMemberOffsetDecoration>(32, Source{}));
- members.push_back(create<ast::StructMember>("e", &inner_s, std::move(decos)));
+ members.push_back(create<ast::StructMember>("e", &inner_s, decos));
decos.push_back(create<ast::StructMemberOffsetDecoration>(64, Source{}));
- members.push_back(create<ast::StructMember>("f", &f32, std::move(decos)));
+ members.push_back(create<ast::StructMember>("f", &f32, decos));
auto* outer_str = create<ast::Struct>();
- 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 1716eda..49f0399 100644
--- a/src/writer/msl/generator_impl_type_test.cc
+++ b/src/writer/msl/generator_impl_type_test.cc
@@ -181,12 +181,12 @@
ast::StructMemberDecorationList b_deco;
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(4, Source{}));
- members.push_back(create<ast::StructMember>("b", &f32, std::move(b_deco)));
+ members.push_back(create<ast::StructMember>("b", &f32, b_deco));
auto* str = create<ast::Struct>();
- 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 @@
ast::StructMemberDecorationList b_deco;
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(4, Source{}));
- members.push_back(create<ast::StructMember>("b", &f32, std::move(b_deco)));
+ members.push_back(create<ast::StructMember>("b", &f32, b_deco));
auto* str = create<ast::Struct>();
- 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 @@
ast::type::I32Type i32;
ast::type::F32Type f32;
- ast::StructMemberDecorationList decos;
- decos.push_back(create<ast::StructMemberOffsetDecoration>(4, Source{}));
-
- ast::StructMemberList members;
- members.push_back(create<ast::StructMember>("a", &i32, std::move(decos)));
-
- decos.push_back(create<ast::StructMemberOffsetDecoration>(32, Source{}));
- members.push_back(create<ast::StructMember>("b", &f32, std::move(decos)));
-
- decos.push_back(create<ast::StructMemberOffsetDecoration>(128, Source{}));
- members.push_back(create<ast::StructMember>("c", &f32, std::move(decos)));
-
auto* str = create<ast::Struct>();
- str->set_members(std::move(members));
+ str->set_members({
+ create<ast::StructMember>(
+ "a", &i32,
+ ast::StructMemberDecorationList{
+ create<ast::StructMemberOffsetDecoration>(4, Source{})}),
+ create<ast::StructMember>(
+ "b", &f32,
+ ast::StructMemberDecorationList{
+ create<ast::StructMemberOffsetDecoration>(32, Source{})}),
+ create<ast::StructMember>(
+ "c", &f32,
+ ast::StructMemberDecorationList{
+ create<ast::StructMemberOffsetDecoration>(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 @@
"main", &i32, ast::StructMemberDecorationList{}));
ast::StructMemberDecorationList b_deco;
- members.push_back(
- create<ast::StructMember>("float", &f32, std::move(b_deco)));
+ members.push_back(create<ast::StructMember>("float", &f32, b_deco));
auto* str = create<ast::Struct>();
- 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 @@
ast::StructMemberDecorationList b_deco;
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(4, Source{}));
- members.push_back(create<ast::StructMember>("b", &f32, std::move(b_deco)));
+ members.push_back(create<ast::StructMember>("b", &f32, b_deco));
ast::StructDecorationList decos;
decos.push_back(create<ast::StructBlockDecoration>(Source{}));
- auto* str = create<ast::Struct>(std::move(decos), std::move(members));
+ auto* str = create<ast::Struct>(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 ec78362..a676558 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 @@
auto params = GetParam();
auto* expr = create<ast::IdentifierExpression>("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 2681ae2..f0ec7a0 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 @@
ast::type::F32Type f32;
auto* var = create<ast::Variable>("a", ast::StorageClass::kNone, &f32);
- ast::VariableDeclStatement stmt(std::move(var));
+ ast::VariableDeclStatement stmt(var);
gen.increment_indent();
@@ -57,7 +57,7 @@
auto* var = create<ast::Variable>("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 @@
auto* var = create<ast::Variable>("a", ast::StorageClass::kNone, &ary);
- ast::VariableDeclStatement stmt(std::move(var));
+ ast::VariableDeclStatement stmt(var);
gen.increment_indent();
@@ -88,16 +88,16 @@
ast::StructMemberDecorationList b_deco;
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(4, Source{}));
- members.push_back(create<ast::StructMember>("b", &f32, std::move(b_deco)));
+ members.push_back(create<ast::StructMember>("b", &f32, b_deco));
auto* str = create<ast::Struct>();
- 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<ast::Variable>("a", ast::StorageClass::kNone, &s);
- ast::VariableDeclStatement stmt(std::move(var));
+ ast::VariableDeclStatement stmt(var);
gen.increment_indent();
@@ -112,7 +112,7 @@
auto* var = create<ast::Variable>("a", ast::StorageClass::kFunction, &vec);
- ast::VariableDeclStatement stmt(std::move(var));
+ ast::VariableDeclStatement stmt(var);
gen.increment_indent();
@@ -125,7 +125,7 @@
ast::type::MatrixType mat(&f32, 2, 3);
auto* var = create<ast::Variable>("a", ast::StorageClass::kFunction, &mat);
- ast::VariableDeclStatement stmt(std::move(var));
+ ast::VariableDeclStatement stmt(var);
gen.increment_indent();
@@ -137,7 +137,7 @@
ast::type::F32Type f32;
auto* var = create<ast::Variable>("a", ast::StorageClass::kPrivate, &f32);
- ast::VariableDeclStatement stmt(std::move(var));
+ ast::VariableDeclStatement stmt(var);
gen.increment_indent();
@@ -150,9 +150,9 @@
ast::type::F32Type f32;
auto* var = create<ast::Variable>("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 @@
ast::type::VectorType vec(&f32, 3);
ast::ExpressionList values;
- auto* zero_vec =
- create<ast::TypeConstructorExpression>(&vec, std::move(values));
+ auto* zero_vec = create<ast::TypeConstructorExpression>(&vec, values);
auto* var = create<ast::Variable>("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 705c66c..15c5987 100644
--- a/src/writer/spirv/builder_accessor_expression_test.cc
+++ b/src/writer/spirv/builder_accessor_expression_test.cc
@@ -60,7 +60,7 @@
auto* idx_expr = create<ast::ScalarConstructorExpression>(
create<ast::SintLiteral>(&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 @@
auto* ary = create<ast::IdentifierExpression>("ary");
auto* idx_expr = create<ast::IdentifierExpression>("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 @@
auto* ary = create<ast::IdentifierExpression>("ary");
ast::ArrayAccessorExpression expr(
- std::move(ary),
+ ary,
create<ast::BinaryExpression>(ast::BinaryOp::kAdd,
create<ast::ScalarConstructorExpression>(
create<ast::SintLiteral>(&i32, 1)),
@@ -284,11 +284,11 @@
ast::StructMemberDecorationList decos;
ast::StructMemberList members;
- members.push_back(create<ast::StructMember>("a", &f32, std::move(decos)));
- members.push_back(create<ast::StructMember>("b", &f32, std::move(decos)));
+ members.push_back(create<ast::StructMember>("a", &f32, decos));
+ members.push_back(create<ast::StructMember>("b", &f32, decos));
- auto* s = create<ast::Struct>(std::move(members));
- ast::type::StructType s_type("my_struct", std::move(s));
+ auto* s = create<ast::Struct>(members);
+ ast::type::StructType s_type("my_struct", s);
ast::Variable var("ident", ast::StorageClass::kFunction, &s_type);
@@ -333,20 +333,17 @@
// ident.inner.a
ast::StructMemberDecorationList decos;
ast::StructMemberList inner_members;
- inner_members.push_back(
- create<ast::StructMember>("a", &f32, std::move(decos)));
- inner_members.push_back(
- create<ast::StructMember>("b", &f32, std::move(decos)));
+ inner_members.push_back(create<ast::StructMember>("a", &f32, decos));
+ inner_members.push_back(create<ast::StructMember>("b", &f32, decos));
- ast::type::StructType inner_struct(
- "Inner", create<ast::Struct>(std::move(inner_members)));
+ ast::type::StructType inner_struct("Inner",
+ create<ast::Struct>(inner_members));
ast::StructMemberList outer_members;
outer_members.push_back(
- create<ast::StructMember>("inner", &inner_struct, std::move(decos)));
+ create<ast::StructMember>("inner", &inner_struct, decos));
- ast::type::StructType s_type("my_struct",
- create<ast::Struct>(std::move(outer_members)));
+ ast::type::StructType s_type("my_struct", create<ast::Struct>(outer_members));
ast::Variable var("ident", ast::StorageClass::kFunction, &s_type);
@@ -396,22 +393,18 @@
// ident.inner.a
ast::StructMemberDecorationList decos;
ast::StructMemberList inner_members;
- inner_members.push_back(
- create<ast::StructMember>("a", &f32, std::move(decos)));
- inner_members.push_back(
- create<ast::StructMember>("b", &f32, std::move(decos)));
+ inner_members.push_back(create<ast::StructMember>("a", &f32, decos));
+ inner_members.push_back(create<ast::StructMember>("b", &f32, decos));
- ast::type::StructType inner_struct(
- "Inner", create<ast::Struct>(std::move(inner_members)));
+ ast::type::StructType inner_struct("Inner",
+ create<ast::Struct>(inner_members));
ast::type::AliasType alias("Inner", &inner_struct);
ast::StructMemberList outer_members;
- outer_members.push_back(
- create<ast::StructMember>("inner", &alias, std::move(decos)));
+ outer_members.push_back(create<ast::StructMember>("inner", &alias, decos));
- ast::type::StructType s_type("Outer",
- create<ast::Struct>(std::move(outer_members)));
+ ast::type::StructType s_type("Outer", create<ast::Struct>(outer_members));
ast::Variable var("ident", ast::StorageClass::kFunction, &s_type);
@@ -461,20 +454,17 @@
ast::StructMemberDecorationList decos;
ast::StructMemberList inner_members;
- inner_members.push_back(
- create<ast::StructMember>("a", &f32, std::move(decos)));
- inner_members.push_back(
- create<ast::StructMember>("b", &f32, std::move(decos)));
+ inner_members.push_back(create<ast::StructMember>("a", &f32, decos));
+ inner_members.push_back(create<ast::StructMember>("b", &f32, decos));
- ast::type::StructType inner_struct(
- "Inner", create<ast::Struct>(std::move(inner_members)));
+ ast::type::StructType inner_struct("Inner",
+ create<ast::Struct>(inner_members));
ast::StructMemberList outer_members;
outer_members.push_back(
- create<ast::StructMember>("inner", &inner_struct, std::move(decos)));
+ create<ast::StructMember>("inner", &inner_struct, decos));
- ast::type::StructType s_type("my_struct",
- create<ast::Struct>(std::move(outer_members)));
+ ast::type::StructType s_type("my_struct", create<ast::Struct>(outer_members));
ast::Variable var("ident", ast::StorageClass::kFunction, &s_type);
@@ -487,7 +477,7 @@
auto* rhs = create<ast::ScalarConstructorExpression>(
create<ast::FloatLiteral>(&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 @@
ast::StructMemberDecorationList decos;
ast::StructMemberList inner_members;
- inner_members.push_back(
- create<ast::StructMember>("a", &f32, std::move(decos)));
- inner_members.push_back(
- create<ast::StructMember>("b", &f32, std::move(decos)));
+ inner_members.push_back(create<ast::StructMember>("a", &f32, decos));
+ inner_members.push_back(create<ast::StructMember>("b", &f32, decos));
- ast::type::StructType inner_struct(
- "Inner", create<ast::Struct>(std::move(inner_members)));
+ ast::type::StructType inner_struct("Inner",
+ create<ast::Struct>(inner_members));
ast::StructMemberList outer_members;
outer_members.push_back(
- create<ast::StructMember>("inner", &inner_struct, std::move(decos)));
+ create<ast::StructMember>("inner", &inner_struct, decos));
- ast::type::StructType s_type("my_struct",
- create<ast::Struct>(std::move(outer_members)));
+ ast::type::StructType s_type("my_struct", create<ast::Struct>(outer_members));
ast::Variable var("ident", ast::StorageClass::kFunction, &s_type);
ast::Variable store("store", ast::StorageClass::kFunction, &f32);
@@ -557,7 +544,7 @@
create<ast::IdentifierExpression>("inner")),
create<ast::IdentifierExpression>("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 @@
// index[0].foo[2].bar.baz.yx
ast::StructMemberDecorationList decos;
- ast::StructMemberList members;
- members.push_back(create<ast::StructMember>("baz", &vec3, std::move(decos)));
- auto* s = create<ast::Struct>(std::move(members));
- ast::type::StructType c_type("C", std::move(s));
- members.push_back(
- create<ast::StructMember>("bar", &c_type, std::move(decos)));
- s = create<ast::Struct>(std::move(members));
- ast::type::StructType b_type("B", std::move(s));
+ auto* s = create<ast::Struct>(
+ ast::StructMemberList{create<ast::StructMember>("baz", &vec3, decos)});
+ ast::type::StructType c_type("C", s);
+
+ s = create<ast::Struct>(
+ ast::StructMemberList{create<ast::StructMember>("bar", &c_type, decos)});
+ ast::type::StructType b_type("B", s);
ast::type::ArrayType b_ary_type(&b_type, 3);
- members.push_back(
- create<ast::StructMember>("foo", &b_ary_type, std::move(decos)));
- s = create<ast::Struct>(std::move(members));
- ast::type::StructType a_type("A", std::move(s));
+ s = create<ast::Struct>(ast::StructMemberList{
+ create<ast::StructMember>("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 @@
ast::type::ArrayType arr(&vec, 3);
ast::ExpressionList ary_params;
+ ary_params.push_back(create<ast::TypeConstructorExpression>(
+ &vec, ast::ExpressionList{
+ create<ast::ScalarConstructorExpression>(
+ create<ast::FloatLiteral>(&f32, 0.0)),
+ create<ast::ScalarConstructorExpression>(
+ create<ast::FloatLiteral>(&f32, 0.5)),
+ }));
- ast::ExpressionList vec_params;
- vec_params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 0.0)));
- vec_params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 0.5)));
- ary_params.push_back(
- create<ast::TypeConstructorExpression>(&vec, std::move(vec_params)));
+ ary_params.push_back(create<ast::TypeConstructorExpression>(
+ &vec, ast::ExpressionList{
+ create<ast::ScalarConstructorExpression>(
+ create<ast::FloatLiteral>(&f32, -0.5)),
+ create<ast::ScalarConstructorExpression>(
+ create<ast::FloatLiteral>(&f32, -0.5)),
+ }));
- vec_params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, -0.5)));
- vec_params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, -0.5)));
- ary_params.push_back(
- create<ast::TypeConstructorExpression>(&vec, std::move(vec_params)));
-
- vec_params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 0.5)));
- vec_params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, -0.5)));
- ary_params.push_back(
- create<ast::TypeConstructorExpression>(&vec, std::move(vec_params)));
+ ary_params.push_back(create<ast::TypeConstructorExpression>(
+ &vec, ast::ExpressionList{
+ create<ast::ScalarConstructorExpression>(
+ create<ast::FloatLiteral>(&f32, 0.5)),
+ create<ast::ScalarConstructorExpression>(
+ create<ast::FloatLiteral>(&f32, -0.5)),
+ }));
ast::Variable var("pos", ast::StorageClass::kPrivate, &arr);
var.set_is_const(true);
- var.set_constructor(
- create<ast::TypeConstructorExpression>(&arr, std::move(ary_params)));
+ var.set_constructor(create<ast::TypeConstructorExpression>(&arr, ary_params));
ast::ArrayAccessorExpression expr(create<ast::IdentifierExpression>("pos"),
create<ast::ScalarConstructorExpression>(
diff --git a/src/writer/spirv/builder_assign_test.cc b/src/writer/spirv/builder_assign_test.cc
index 7d60224..b2a574e 100644
--- a/src/writer/spirv/builder_assign_test.cc
+++ b/src/writer/spirv/builder_assign_test.cc
@@ -51,7 +51,7 @@
auto* val = create<ast::ScalarConstructorExpression>(
create<ast::FloatLiteral>(&f32, 1.0f));
- ast::AssignmentStatement assign(std::move(ident), std::move(val));
+ ast::AssignmentStatement assign(ident, val);
td.RegisterVariableForTesting(&v);
@@ -83,9 +83,9 @@
auto* ident = create<ast::IdentifierExpression>("var");
ast::ExpressionList vals;
- auto* val = create<ast::TypeConstructorExpression>(&vec, std::move(vals));
+ auto* val = create<ast::TypeConstructorExpression>(&vec, vals);
- ast::AssignmentStatement assign(std::move(ident), std::move(val));
+ ast::AssignmentStatement assign(ident, val);
td.RegisterVariableForTesting(&v);
@@ -114,23 +114,25 @@
ast::type::VectorType vec3(&f32, 3);
ast::type::VectorType vec2(&f32, 2);
- ast::ExpressionList vals;
- vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
- vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 2.0f)));
- auto* first = create<ast::TypeConstructorExpression>(&vec2, std::move(vals));
+ auto* first = create<ast::TypeConstructorExpression>(
+ &vec2, ast::ExpressionList{
+ create<ast::ScalarConstructorExpression>(
+ create<ast::FloatLiteral>(&f32, 1.0f)),
+ create<ast::ScalarConstructorExpression>(
+ create<ast::FloatLiteral>(&f32, 2.0f)),
+ });
- vals.push_back(std::move(first));
- vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 3.0f)));
-
- auto* init = create<ast::TypeConstructorExpression>(&vec3, std::move(vals));
+ auto* init = create<ast::TypeConstructorExpression>(
+ &vec3, ast::ExpressionList{
+ first,
+ create<ast::ScalarConstructorExpression>(
+ create<ast::FloatLiteral>(&f32, 3.0f)),
+ });
ast::Variable v("var", ast::StorageClass::kOutput, &vec3);
ast::AssignmentStatement assign(create<ast::IdentifierExpression>("var"),
- std::move(init));
+ init);
td.RegisterVariableForTesting(&v);
ASSERT_TRUE(td.DetermineResultType(&assign)) << td.error();
@@ -173,12 +175,12 @@
vals.push_back(create<ast::ScalarConstructorExpression>(
create<ast::FloatLiteral>(&f32, 3.0f)));
- auto* init = create<ast::TypeConstructorExpression>(&vec3, std::move(vals));
+ auto* init = create<ast::TypeConstructorExpression>(&vec3, vals);
ast::Variable v("var", ast::StorageClass::kOutput, &vec3);
ast::AssignmentStatement assign(create<ast::IdentifierExpression>("var"),
- std::move(init));
+ init);
td.RegisterVariableForTesting(&v);
ASSERT_TRUE(td.DetermineResultType(&assign)) << td.error();
@@ -216,11 +218,11 @@
ast::StructMemberDecorationList decos;
ast::StructMemberList members;
- members.push_back(create<ast::StructMember>("a", &f32, std::move(decos)));
- members.push_back(create<ast::StructMember>("b", &f32, std::move(decos)));
+ members.push_back(create<ast::StructMember>("a", &f32, decos));
+ members.push_back(create<ast::StructMember>("b", &f32, decos));
- auto* s = create<ast::Struct>(std::move(members));
- ast::type::StructType s_type("my_struct", std::move(s));
+ auto* s = create<ast::Struct>(members);
+ ast::type::StructType s_type("my_struct", s);
ast::Variable v("ident", ast::StorageClass::kFunction, &s_type);
@@ -231,7 +233,7 @@
auto* val = create<ast::ScalarConstructorExpression>(
create<ast::FloatLiteral>(&f32, 4.0f));
- ast::AssignmentStatement assign(std::move(ident), std::move(val));
+ ast::AssignmentStatement assign(ident, val);
td.RegisterVariableForTesting(&v);
@@ -276,9 +278,9 @@
vals.push_back(create<ast::ScalarConstructorExpression>(
create<ast::FloatLiteral>(&f32, 3.0f)));
- auto* val = create<ast::TypeConstructorExpression>(&vec3, std::move(vals));
+ auto* val = create<ast::TypeConstructorExpression>(&vec3, vals);
- ast::AssignmentStatement assign(std::move(ident), std::move(val));
+ ast::AssignmentStatement assign(ident, val);
td.RegisterVariableForTesting(&v);
@@ -319,7 +321,7 @@
auto* val = create<ast::ScalarConstructorExpression>(
create<ast::FloatLiteral>(&f32, 1.0f));
- ast::AssignmentStatement assign(std::move(ident), std::move(val));
+ ast::AssignmentStatement assign(ident, val);
td.RegisterVariableForTesting(&v);
@@ -365,7 +367,7 @@
auto* val = create<ast::ScalarConstructorExpression>(
create<ast::FloatLiteral>(&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 7a1f473..1b9c555 100644
--- a/src/writer/spirv/builder_binary_expression_test.cc
+++ b/src/writer/spirv/builder_binary_expression_test.cc
@@ -62,7 +62,7 @@
auto* rhs = create<ast::ScalarConstructorExpression>(
create<ast::SintLiteral>(&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 @@
ast::type::I32Type i32;
ast::type::VectorType vec3(&i32, 3);
- ast::ExpressionList vals;
- vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 1)));
- vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 1)));
- vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 1)));
- auto* lhs = create<ast::TypeConstructorExpression>(&vec3, std::move(vals));
+ auto* lhs = create<ast::TypeConstructorExpression>(
+ &vec3, ast::ExpressionList{
+ create<ast::ScalarConstructorExpression>(
+ create<ast::SintLiteral>(&i32, 1)),
+ create<ast::ScalarConstructorExpression>(
+ create<ast::SintLiteral>(&i32, 1)),
+ create<ast::ScalarConstructorExpression>(
+ create<ast::SintLiteral>(&i32, 1)),
+ });
- vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 1)));
- vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 1)));
- vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 1)));
- auto* rhs = create<ast::TypeConstructorExpression>(&vec3, std::move(vals));
+ auto* rhs = create<ast::TypeConstructorExpression>(
+ &vec3, ast::ExpressionList{
+ create<ast::ScalarConstructorExpression>(
+ create<ast::SintLiteral>(&i32, 1)),
+ create<ast::ScalarConstructorExpression>(
+ create<ast::SintLiteral>(&i32, 1)),
+ create<ast::ScalarConstructorExpression>(
+ create<ast::SintLiteral>(&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 @@
auto* lhs = create<ast::IdentifierExpression>("param");
auto* rhs = create<ast::IdentifierExpression>("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 @@
auto* rhs = create<ast::ScalarConstructorExpression>(
create<ast::UintLiteral>(&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 @@
ast::type::U32Type u32;
ast::type::VectorType vec3(&u32, 3);
- ast::ExpressionList vals;
- vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::UintLiteral>(&u32, 1)));
- vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::UintLiteral>(&u32, 1)));
- vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::UintLiteral>(&u32, 1)));
- auto* lhs = create<ast::TypeConstructorExpression>(&vec3, std::move(vals));
+ auto* lhs = create<ast::TypeConstructorExpression>(
+ &vec3, ast::ExpressionList{
+ create<ast::ScalarConstructorExpression>(
+ create<ast::UintLiteral>(&u32, 1)),
+ create<ast::ScalarConstructorExpression>(
+ create<ast::UintLiteral>(&u32, 1)),
+ create<ast::ScalarConstructorExpression>(
+ create<ast::UintLiteral>(&u32, 1)),
+ });
- vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::UintLiteral>(&u32, 1)));
- vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::UintLiteral>(&u32, 1)));
- vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::UintLiteral>(&u32, 1)));
- auto* rhs = create<ast::TypeConstructorExpression>(&vec3, std::move(vals));
+ auto* rhs = create<ast::TypeConstructorExpression>(
+ &vec3, ast::ExpressionList{
+ create<ast::ScalarConstructorExpression>(
+ create<ast::UintLiteral>(&u32, 1)),
+ create<ast::ScalarConstructorExpression>(
+ create<ast::UintLiteral>(&u32, 1)),
+ create<ast::ScalarConstructorExpression>(
+ create<ast::UintLiteral>(&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 @@
auto* rhs = create<ast::ScalarConstructorExpression>(
create<ast::FloatLiteral>(&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 @@
ast::type::F32Type f32;
ast::type::VectorType vec3(&f32, 3);
- ast::ExpressionList vals;
- vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)));
- vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)));
- vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)));
- auto* lhs = create<ast::TypeConstructorExpression>(&vec3, std::move(vals));
+ auto* lhs = create<ast::TypeConstructorExpression>(
+ &vec3, ast::ExpressionList{
+ create<ast::ScalarConstructorExpression>(
+ create<ast::FloatLiteral>(&f32, 1.f)),
+ create<ast::ScalarConstructorExpression>(
+ create<ast::FloatLiteral>(&f32, 1.f)),
+ create<ast::ScalarConstructorExpression>(
+ create<ast::FloatLiteral>(&f32, 1.f)),
+ });
- vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)));
- vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)));
- vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)));
- auto* rhs = create<ast::TypeConstructorExpression>(&vec3, std::move(vals));
+ auto* rhs = create<ast::TypeConstructorExpression>(
+ &vec3, ast::ExpressionList{
+ create<ast::ScalarConstructorExpression>(
+ create<ast::FloatLiteral>(&f32, 1.f)),
+ create<ast::ScalarConstructorExpression>(
+ create<ast::FloatLiteral>(&f32, 1.f)),
+ create<ast::ScalarConstructorExpression>(
+ create<ast::FloatLiteral>(&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 @@
auto* rhs = create<ast::ScalarConstructorExpression>(
create<ast::UintLiteral>(&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 @@
ast::type::U32Type u32;
ast::type::VectorType vec3(&u32, 3);
- ast::ExpressionList vals;
- vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::UintLiteral>(&u32, 1)));
- vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::UintLiteral>(&u32, 1)));
- vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::UintLiteral>(&u32, 1)));
- auto* lhs = create<ast::TypeConstructorExpression>(&vec3, std::move(vals));
+ auto* lhs = create<ast::TypeConstructorExpression>(
+ &vec3, ast::ExpressionList{
+ create<ast::ScalarConstructorExpression>(
+ create<ast::UintLiteral>(&u32, 1)),
+ create<ast::ScalarConstructorExpression>(
+ create<ast::UintLiteral>(&u32, 1)),
+ create<ast::ScalarConstructorExpression>(
+ create<ast::UintLiteral>(&u32, 1)),
+ });
- vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::UintLiteral>(&u32, 1)));
- vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::UintLiteral>(&u32, 1)));
- vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::UintLiteral>(&u32, 1)));
- auto* rhs = create<ast::TypeConstructorExpression>(&vec3, std::move(vals));
+ auto* rhs = create<ast::TypeConstructorExpression>(
+ &vec3, ast::ExpressionList{
+ create<ast::ScalarConstructorExpression>(
+ create<ast::UintLiteral>(&u32, 1)),
+ create<ast::ScalarConstructorExpression>(
+ create<ast::UintLiteral>(&u32, 1)),
+ create<ast::ScalarConstructorExpression>(
+ create<ast::UintLiteral>(&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 @@
auto* rhs = create<ast::ScalarConstructorExpression>(
create<ast::SintLiteral>(&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 @@
ast::type::I32Type i32;
ast::type::VectorType vec3(&i32, 3);
- ast::ExpressionList vals;
- vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 1)));
- vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 1)));
- vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 1)));
- auto* lhs = create<ast::TypeConstructorExpression>(&vec3, std::move(vals));
+ auto* lhs = create<ast::TypeConstructorExpression>(
+ &vec3, ast::ExpressionList{
+ create<ast::ScalarConstructorExpression>(
+ create<ast::SintLiteral>(&i32, 1)),
+ create<ast::ScalarConstructorExpression>(
+ create<ast::SintLiteral>(&i32, 1)),
+ create<ast::ScalarConstructorExpression>(
+ create<ast::SintLiteral>(&i32, 1)),
+ });
- vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 1)));
- vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 1)));
- vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 1)));
- auto* rhs = create<ast::TypeConstructorExpression>(&vec3, std::move(vals));
+ auto* rhs = create<ast::TypeConstructorExpression>(
+ &vec3, ast::ExpressionList{
+ create<ast::ScalarConstructorExpression>(
+ create<ast::SintLiteral>(&i32, 1)),
+ create<ast::ScalarConstructorExpression>(
+ create<ast::SintLiteral>(&i32, 1)),
+ create<ast::ScalarConstructorExpression>(
+ create<ast::SintLiteral>(&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 @@
auto* rhs = create<ast::ScalarConstructorExpression>(
create<ast::FloatLiteral>(&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 @@
ast::type::F32Type f32;
ast::type::VectorType vec3(&f32, 3);
- ast::ExpressionList vals;
- vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)));
- vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)));
- vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)));
- auto* lhs = create<ast::TypeConstructorExpression>(&vec3, std::move(vals));
+ auto* lhs = create<ast::TypeConstructorExpression>(
+ &vec3, ast::ExpressionList{
+ create<ast::ScalarConstructorExpression>(
+ create<ast::FloatLiteral>(&f32, 1.f)),
+ create<ast::ScalarConstructorExpression>(
+ create<ast::FloatLiteral>(&f32, 1.f)),
+ create<ast::ScalarConstructorExpression>(
+ create<ast::FloatLiteral>(&f32, 1.f)),
+ });
- vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)));
- vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)));
- vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)));
- auto* rhs = create<ast::TypeConstructorExpression>(&vec3, std::move(vals));
+ auto* rhs = create<ast::TypeConstructorExpression>(
+ &vec3, ast::ExpressionList{
+ create<ast::ScalarConstructorExpression>(
+ create<ast::FloatLiteral>(&f32, 1.f)),
+ create<ast::ScalarConstructorExpression>(
+ create<ast::FloatLiteral>(&f32, 1.f)),
+ create<ast::ScalarConstructorExpression>(
+ create<ast::FloatLiteral>(&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 @@
ast::type::F32Type f32;
ast::type::VectorType vec3(&f32, 3);
- ast::ExpressionList vals;
- vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)));
- vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)));
- vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)));
- auto* lhs = create<ast::TypeConstructorExpression>(&vec3, std::move(vals));
+ auto* lhs = create<ast::TypeConstructorExpression>(
+ &vec3, ast::ExpressionList{
+ create<ast::ScalarConstructorExpression>(
+ create<ast::FloatLiteral>(&f32, 1.f)),
+ create<ast::ScalarConstructorExpression>(
+ create<ast::FloatLiteral>(&f32, 1.f)),
+ create<ast::ScalarConstructorExpression>(
+ create<ast::FloatLiteral>(&f32, 1.f)),
+ });
auto* rhs = create<ast::ScalarConstructorExpression>(
create<ast::FloatLiteral>(&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 @@
create<ast::FloatLiteral>(&f32, 1.f)));
vals.push_back(create<ast::ScalarConstructorExpression>(
create<ast::FloatLiteral>(&f32, 1.f)));
- auto* rhs = create<ast::TypeConstructorExpression>(&vec3, std::move(vals));
+ auto* rhs = create<ast::TypeConstructorExpression>(&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 @@
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 @@
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 @@
create<ast::FloatLiteral>(&f32, 1.f)));
vals.push_back(create<ast::ScalarConstructorExpression>(
create<ast::FloatLiteral>(&f32, 1.f)));
- auto* rhs = create<ast::TypeConstructorExpression>(&vec3, std::move(vals));
+ auto* rhs = create<ast::TypeConstructorExpression>(&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 @@
create<ast::FloatLiteral>(&f32, 1.f)));
vals.push_back(create<ast::ScalarConstructorExpression>(
create<ast::FloatLiteral>(&f32, 1.f)));
- auto* lhs = create<ast::TypeConstructorExpression>(&vec3, std::move(vals));
+ auto* lhs = create<ast::TypeConstructorExpression>(&vec3, vals);
auto* rhs = create<ast::IdentifierExpression>("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 @@
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 @@
create<ast::ScalarConstructorExpression>(
create<ast::SintLiteral>(&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 @@
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 @@
create<ast::ScalarConstructorExpression>(
create<ast::SintLiteral>(&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 @@
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 8e5d888..362536a 100644
--- a/src/writer/spirv/builder_block_test.cc
+++ b/src/writer/spirv/builder_block_test.cc
@@ -57,7 +57,7 @@
create<ast::ScalarConstructorExpression>(
create<ast::FloatLiteral>(&f32, 2.0f))));
- outer.append(std::move(inner));
+ outer.append(inner);
outer.append(create<ast::AssignmentStatement>(
create<ast::IdentifierExpression>("var"),
create<ast::ScalarConstructorExpression>(
diff --git a/src/writer/spirv/builder_call_test.cc b/src/writer/spirv/builder_call_test.cc
index fcd1cd6..1ca5c0e 100644
--- a/src/writer/spirv/builder_call_test.cc
+++ b/src/writer/spirv/builder_call_test.cc
@@ -53,7 +53,7 @@
body->append(create<ast::ReturnStatement>(create<ast::BinaryExpression>(
ast::BinaryOp::kAdd, create<ast::IdentifierExpression>("a"),
create<ast::IdentifierExpression>("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<ast::BlockStatement>());
@@ -64,7 +64,7 @@
create<ast::FloatLiteral>(&f32, 1.f)));
ast::CallExpression expr(create<ast::IdentifierExpression>("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 @@
ast::BinaryOp::kAdd, create<ast::IdentifierExpression>("a"),
create<ast::IdentifierExpression>("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<ast::BlockStatement>());
@@ -126,7 +125,7 @@
create<ast::FloatLiteral>(&f32, 1.f)));
ast::CallStatement expr(create<ast::CallExpression>(
- create<ast::IdentifierExpression>("a_func"), std::move(call_params)));
+ create<ast::IdentifierExpression>("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 783d8dd..8af8ad5 100644
--- a/src/writer/spirv/builder_constructor_expression_test.cc
+++ b/src/writer/spirv/builder_constructor_expression_test.cc
@@ -53,7 +53,7 @@
TEST_F(BuilderTest, Constructor_Const) {
ast::type::F32Type f32;
auto* fl = create<ast::FloatLiteral>(&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 @@
vals.push_back(create<ast::ScalarConstructorExpression>(
create<ast::FloatLiteral>(&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 @@
create<ast::SintLiteral>(&i32, 1)));
ast::ExpressionList vals;
- vals.push_back(
- create<ast::TypeConstructorExpression>(&f32, std::move(type_vals)));
+ vals.push_back(create<ast::TypeConstructorExpression>(&f32, type_vals));
type_vals.push_back(create<ast::ScalarConstructorExpression>(
create<ast::SintLiteral>(&i32, 1)));
- vals.push_back(
- create<ast::TypeConstructorExpression>(&f32, std::move(type_vals)));
+ vals.push_back(create<ast::TypeConstructorExpression>(&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 @@
params.push_back(create<ast::ScalarConstructorExpression>(
create<ast::FloatLiteral>(&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 @@
create<ast::FloatLiteral>(&f32, 1.0f)));
vals.push_back(create<ast::IdentifierExpression>("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 @@
vals.push_back(create<ast::ScalarConstructorExpression>(
create<ast::SintLiteral>(&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 @@
ast::ExpressionList vals;
vals.push_back(create<ast::ScalarConstructorExpression>(
create<ast::FloatLiteral>(&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 @@
vals.push_back(create<ast::ScalarConstructorExpression>(
create<ast::BoolLiteral>(&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 @@
params.push_back(create<ast::ScalarConstructorExpression>(
create<ast::SintLiteral>(&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 @@
params.push_back(create<ast::ScalarConstructorExpression>(
create<ast::UintLiteral>(&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 @@
params.push_back(create<ast::ScalarConstructorExpression>(
create<ast::FloatLiteral>(&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 @@
params.push_back(create<ast::ScalarConstructorExpression>(
create<ast::FloatLiteral>(&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 @@
params.push_back(create<ast::ScalarConstructorExpression>(
create<ast::FloatLiteral>(&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 @@
ast::ExpressionList params;
params.push_back(create<ast::ScalarConstructorExpression>(
create<ast::FloatLiteral>(&f32, 2.0)));
- params.push_back(
- create<ast::TypeConstructorExpression>(&vec2, std::move(vec_params)));
+ params.push_back(create<ast::TypeConstructorExpression>(&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 @@
create<ast::FloatLiteral>(&f32, 2.0)));
ast::ExpressionList params;
- params.push_back(
- create<ast::TypeConstructorExpression>(&vec2, std::move(vec_params)));
+ params.push_back(create<ast::TypeConstructorExpression>(&vec2, vec_params));
params.push_back(create<ast::ScalarConstructorExpression>(
create<ast::FloatLiteral>(&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 @@
params.push_back(create<ast::ScalarConstructorExpression>(
create<ast::FloatLiteral>(&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 @@
create<ast::FloatLiteral>(&f32, 2.0)));
params.push_back(create<ast::ScalarConstructorExpression>(
create<ast::FloatLiteral>(&f32, 2.0)));
- params.push_back(
- create<ast::TypeConstructorExpression>(&vec2, std::move(vec_params)));
+ params.push_back(create<ast::TypeConstructorExpression>(&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 @@
ast::ExpressionList params;
params.push_back(create<ast::ScalarConstructorExpression>(
create<ast::FloatLiteral>(&f32, 2.0)));
- params.push_back(
- create<ast::TypeConstructorExpression>(&vec2, std::move(vec_params)));
+ params.push_back(create<ast::TypeConstructorExpression>(&vec2, vec_params));
params.push_back(create<ast::ScalarConstructorExpression>(
create<ast::FloatLiteral>(&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 @@
create<ast::FloatLiteral>(&f32, 2.0)));
ast::ExpressionList params;
- params.push_back(
- create<ast::TypeConstructorExpression>(&vec2, std::move(vec_params)));
+ params.push_back(create<ast::TypeConstructorExpression>(&vec2, vec_params));
params.push_back(create<ast::ScalarConstructorExpression>(
create<ast::FloatLiteral>(&f32, 2.0)));
params.push_back(create<ast::ScalarConstructorExpression>(
create<ast::FloatLiteral>(&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 @@
create<ast::FloatLiteral>(&f32, 2.0)));
ast::ExpressionList params;
- params.push_back(
- create<ast::TypeConstructorExpression>(&vec2, std::move(vec_params)));
- params.push_back(
- create<ast::TypeConstructorExpression>(&vec2, std::move(vec2_params)));
+ params.push_back(create<ast::TypeConstructorExpression>(&vec2, vec_params));
+ params.push_back(create<ast::TypeConstructorExpression>(&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 @@
ast::ExpressionList params;
params.push_back(create<ast::ScalarConstructorExpression>(
create<ast::FloatLiteral>(&f32, 2.0)));
- params.push_back(
- create<ast::TypeConstructorExpression>(&vec3, std::move(vec_params)));
+ params.push_back(create<ast::TypeConstructorExpression>(&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 @@
create<ast::FloatLiteral>(&f32, 2.0)));
ast::ExpressionList params;
- params.push_back(
- create<ast::TypeConstructorExpression>(&vec3, std::move(vec_params)));
+ params.push_back(create<ast::TypeConstructorExpression>(&vec3, vec_params));
params.push_back(create<ast::ScalarConstructorExpression>(
create<ast::FloatLiteral>(&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 @@
ast::ExpressionList params;
params.push_back(create<ast::ScalarConstructorExpression>(
create<ast::FloatLiteral>(&f32, 2.0)));
- params.push_back(
- create<ast::TypeConstructorExpression>(&vec2, std::move(vec_params)));
+ params.push_back(create<ast::TypeConstructorExpression>(&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 @@
create<ast::FloatLiteral>(&f32, 2.0)));
ast::ExpressionList params;
- params.push_back(
- create<ast::TypeConstructorExpression>(&vec2, std::move(vec_params)));
+ params.push_back(create<ast::TypeConstructorExpression>(&vec2, vec_params));
params.push_back(create<ast::ScalarConstructorExpression>(
create<ast::FloatLiteral>(&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 @@
create<ast::FloatLiteral>(&f32, 2.0)));
params.push_back(create<ast::ScalarConstructorExpression>(
create<ast::FloatLiteral>(&f32, 2.0)));
- params.push_back(
- create<ast::TypeConstructorExpression>(&vec2, std::move(vec_params)));
+ params.push_back(create<ast::TypeConstructorExpression>(&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 @@
ast::ExpressionList params;
params.push_back(create<ast::ScalarConstructorExpression>(
create<ast::FloatLiteral>(&f32, 2.0)));
- params.push_back(
- create<ast::TypeConstructorExpression>(&vec2, std::move(vec_params)));
+ params.push_back(create<ast::TypeConstructorExpression>(&vec2, vec_params));
params.push_back(create<ast::ScalarConstructorExpression>(
create<ast::FloatLiteral>(&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 @@
create<ast::FloatLiteral>(&f32, 2.0)));
ast::ExpressionList params;
- params.push_back(
- create<ast::TypeConstructorExpression>(&vec2, std::move(vec_params)));
+ params.push_back(create<ast::TypeConstructorExpression>(&vec2, vec_params));
params.push_back(create<ast::ScalarConstructorExpression>(
create<ast::FloatLiteral>(&f32, 2.0)));
params.push_back(create<ast::ScalarConstructorExpression>(
create<ast::FloatLiteral>(&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 @@
create<ast::FloatLiteral>(&f32, 2.0)));
ast::ExpressionList params;
- params.push_back(
- create<ast::TypeConstructorExpression>(&vec2, std::move(vec_params)));
- params.push_back(
- create<ast::TypeConstructorExpression>(&vec2, std::move(vec2_params)));
+ params.push_back(create<ast::TypeConstructorExpression>(&vec2, vec_params));
+ params.push_back(create<ast::TypeConstructorExpression>(&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 @@
ast::ExpressionList params;
params.push_back(create<ast::ScalarConstructorExpression>(
create<ast::FloatLiteral>(&f32, 2.0)));
- params.push_back(
- create<ast::TypeConstructorExpression>(&vec3, std::move(vec_params)));
+ params.push_back(create<ast::TypeConstructorExpression>(&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 @@
create<ast::FloatLiteral>(&f32, 2.0)));
ast::ExpressionList params;
- params.push_back(
- create<ast::TypeConstructorExpression>(&vec3, std::move(vec_params)));
+ params.push_back(create<ast::TypeConstructorExpression>(&vec3, vec_params));
params.push_back(create<ast::ScalarConstructorExpression>(
create<ast::FloatLiteral>(&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 @@
create<ast::FloatLiteral>(&f32, 2.0)));
ast::ExpressionList params;
- params.push_back(
- create<ast::TypeConstructorExpression>(&vec, std::move(vec_params)));
- params.push_back(
- create<ast::TypeConstructorExpression>(&vec, std::move(vec2_params)));
+ params.push_back(create<ast::TypeConstructorExpression>(&vec, vec_params));
+ params.push_back(create<ast::TypeConstructorExpression>(&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 @@
create<ast::FloatLiteral>(&f32, 2.0)));
ast::ExpressionList params;
- params.push_back(
- create<ast::TypeConstructorExpression>(&vec, std::move(vec_params)));
- params.push_back(
- create<ast::TypeConstructorExpression>(&vec, std::move(vec2_params)));
- params.push_back(
- create<ast::TypeConstructorExpression>(&vec, std::move(vec3_params)));
+ params.push_back(create<ast::TypeConstructorExpression>(&vec, vec_params));
+ params.push_back(create<ast::TypeConstructorExpression>(&vec, vec2_params));
+ params.push_back(create<ast::TypeConstructorExpression>(&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 @@
create<ast::FloatLiteral>(&f32, 2.0)));
ast::ExpressionList params;
- params.push_back(
- create<ast::TypeConstructorExpression>(&vec, std::move(vec_params)));
- params.push_back(
- create<ast::TypeConstructorExpression>(&vec, std::move(vec2_params)));
- params.push_back(
- create<ast::TypeConstructorExpression>(&vec, std::move(vec3_params)));
- params.push_back(
- create<ast::TypeConstructorExpression>(&vec, std::move(vec4_params)));
+ params.push_back(create<ast::TypeConstructorExpression>(&vec, vec_params));
+ params.push_back(create<ast::TypeConstructorExpression>(&vec, vec2_params));
+ params.push_back(create<ast::TypeConstructorExpression>(&vec, vec3_params));
+ params.push_back(create<ast::TypeConstructorExpression>(&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 @@
create<ast::FloatLiteral>(&f32, 2.0)));
ast::ExpressionList params;
- params.push_back(
- create<ast::TypeConstructorExpression>(&vec, std::move(vec_params)));
- params.push_back(
- create<ast::TypeConstructorExpression>(&vec, std::move(vec2_params)));
+ params.push_back(create<ast::TypeConstructorExpression>(&vec, vec_params));
+ params.push_back(create<ast::TypeConstructorExpression>(&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 @@
create<ast::FloatLiteral>(&f32, 2.0)));
ast::ExpressionList params;
- params.push_back(
- create<ast::TypeConstructorExpression>(&vec, std::move(vec_params)));
- params.push_back(
- create<ast::TypeConstructorExpression>(&vec, std::move(vec2_params)));
- params.push_back(
- create<ast::TypeConstructorExpression>(&vec, std::move(vec3_params)));
+ params.push_back(create<ast::TypeConstructorExpression>(&vec, vec_params));
+ params.push_back(create<ast::TypeConstructorExpression>(&vec, vec2_params));
+ params.push_back(create<ast::TypeConstructorExpression>(&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 @@
create<ast::FloatLiteral>(&f32, 2.0)));
ast::ExpressionList params;
- params.push_back(
- create<ast::TypeConstructorExpression>(&vec, std::move(vec_params)));
- params.push_back(
- create<ast::TypeConstructorExpression>(&vec, std::move(vec2_params)));
- params.push_back(
- create<ast::TypeConstructorExpression>(&vec, std::move(vec3_params)));
- params.push_back(
- create<ast::TypeConstructorExpression>(&vec, std::move(vec4_params)));
+ params.push_back(create<ast::TypeConstructorExpression>(&vec, vec_params));
+ params.push_back(create<ast::TypeConstructorExpression>(&vec, vec2_params));
+ params.push_back(create<ast::TypeConstructorExpression>(&vec, vec3_params));
+ params.push_back(create<ast::TypeConstructorExpression>(&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 @@
create<ast::FloatLiteral>(&f32, 2.0)));
ast::ExpressionList params;
- params.push_back(
- create<ast::TypeConstructorExpression>(&vec, std::move(vec_params)));
- params.push_back(
- create<ast::TypeConstructorExpression>(&vec, std::move(vec2_params)));
+ params.push_back(create<ast::TypeConstructorExpression>(&vec, vec_params));
+ params.push_back(create<ast::TypeConstructorExpression>(&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 @@
create<ast::FloatLiteral>(&f32, 2.0)));
ast::ExpressionList params;
- params.push_back(
- create<ast::TypeConstructorExpression>(&vec, std::move(vec_params)));
- params.push_back(
- create<ast::TypeConstructorExpression>(&vec, std::move(vec2_params)));
- params.push_back(
- create<ast::TypeConstructorExpression>(&vec, std::move(vec3_params)));
+ params.push_back(create<ast::TypeConstructorExpression>(&vec, vec_params));
+ params.push_back(create<ast::TypeConstructorExpression>(&vec, vec2_params));
+ params.push_back(create<ast::TypeConstructorExpression>(&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 @@
create<ast::FloatLiteral>(&f32, 2.0)));
ast::ExpressionList params;
- params.push_back(
- create<ast::TypeConstructorExpression>(&vec, std::move(vec_params)));
- params.push_back(
- create<ast::TypeConstructorExpression>(&vec, std::move(vec2_params)));
- params.push_back(
- create<ast::TypeConstructorExpression>(&vec, std::move(vec3_params)));
- params.push_back(
- create<ast::TypeConstructorExpression>(&vec, std::move(vec4_params)));
+ params.push_back(create<ast::TypeConstructorExpression>(&vec, vec_params));
+ params.push_back(create<ast::TypeConstructorExpression>(&vec, vec2_params));
+ params.push_back(create<ast::TypeConstructorExpression>(&vec, vec3_params));
+ params.push_back(create<ast::TypeConstructorExpression>(&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 @@
params.push_back(create<ast::ScalarConstructorExpression>(
create<ast::FloatLiteral>(&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 @@
create<ast::FloatLiteral>(&f32, 2.0)));
ast::ExpressionList params;
- params.push_back(
- create<ast::TypeConstructorExpression>(&vec, std::move(vec_params)));
- params.push_back(
- create<ast::TypeConstructorExpression>(&vec, std::move(vec2_params)));
+ params.push_back(create<ast::TypeConstructorExpression>(&vec, vec_params));
+ params.push_back(create<ast::TypeConstructorExpression>(&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 @@
ast::StructMemberDecorationList decos;
ast::StructMemberList members;
- members.push_back(create<ast::StructMember>("a", &f32, std::move(decos)));
- members.push_back(create<ast::StructMember>("b", &vec, std::move(decos)));
+ members.push_back(create<ast::StructMember>("a", &f32, decos));
+ members.push_back(create<ast::StructMember>("b", &vec, decos));
- auto* s = create<ast::Struct>(std::move(members));
- ast::type::StructType s_type("my_struct", std::move(s));
+ auto* s = create<ast::Struct>(members);
+ ast::type::StructType s_type("my_struct", s);
ast::ExpressionList vec_vals;
vec_vals.push_back(create<ast::ScalarConstructorExpression>(
@@ -1641,10 +1592,9 @@
ast::ExpressionList vals;
vals.push_back(create<ast::ScalarConstructorExpression>(
create<ast::FloatLiteral>(&f32, 2)));
- vals.push_back(
- create<ast::TypeConstructorExpression>(&vec, std::move(vec_vals)));
+ vals.push_back(create<ast::TypeConstructorExpression>(&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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
ast::StructMemberDecorationList decos;
ast::StructMemberList members;
- members.push_back(create<ast::StructMember>("a", &f32, std::move(decos)));
+ members.push_back(create<ast::StructMember>("a", &f32, decos));
- auto* s = create<ast::Struct>(std::move(members));
- ast::type::StructType s_type("my_struct", std::move(s));
+ auto* s = create<ast::Struct>(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 @@
params.push_back(create<ast::ScalarConstructorExpression>(
create<ast::UintLiteral>(&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 @@
params.push_back(create<ast::ScalarConstructorExpression>(
create<ast::SintLiteral>(&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 @@
params.push_back(create<ast::ScalarConstructorExpression>(
create<ast::FloatLiteral>(&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 @@
params.push_back(create<ast::ScalarConstructorExpression>(
create<ast::FloatLiteral>(&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 @@
params.push_back(create<ast::ScalarConstructorExpression>(
create<ast::SintLiteral>(&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 @@
params.push_back(create<ast::ScalarConstructorExpression>(
create<ast::UintLiteral>(&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 @@
ast::ExpressionList params;
params.push_back(create<ast::IdentifierExpression>("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 @@
ast::ExpressionList params;
params.push_back(create<ast::IdentifierExpression>("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 @@
ast::ExpressionList params;
params.push_back(create<ast::IdentifierExpression>("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 @@
ast::ExpressionList params;
params.push_back(create<ast::IdentifierExpression>("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 @@
ast::ExpressionList params;
params.push_back(create<ast::IdentifierExpression>("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 @@
ast::ExpressionList params;
params.push_back(create<ast::IdentifierExpression>("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 @@
create<ast::FloatLiteral>(&f32, 2.f)));
params.push_back(create<ast::ScalarConstructorExpression>(
create<ast::FloatLiteral>(&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 @@
params.push_back(create<ast::IdentifierExpression>("a"));
params.push_back(create<ast::IdentifierExpression>("b"));
params.push_back(create<ast::IdentifierExpression>("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 @@
create<ast::FloatLiteral>(&f32, 2.f)));
params.push_back(create<ast::ScalarConstructorExpression>(
create<ast::FloatLiteral>(&f32, 3.f)));
- auto* first = create<ast::TypeConstructorExpression>(&vec, std::move(params));
+ auto* first = create<ast::TypeConstructorExpression>(&vec, params);
params.push_back(create<ast::ScalarConstructorExpression>(
create<ast::FloatLiteral>(&f32, 1.f)));
@@ -2238,13 +2188,12 @@
create<ast::FloatLiteral>(&f32, 2.f)));
params.push_back(create<ast::ScalarConstructorExpression>(
create<ast::FloatLiteral>(&f32, 3.f)));
- auto* second =
- create<ast::TypeConstructorExpression>(&vec, std::move(params));
+ auto* second = create<ast::TypeConstructorExpression>(&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 @@
ast::ExpressionList params;
params.push_back(create<ast::ScalarConstructorExpression>(
create<ast::FloatLiteral>(&f32, 1.0)));
- vec_params.push_back(
- create<ast::TypeConstructorExpression>(&f32, std::move(params)));
+ vec_params.push_back(create<ast::TypeConstructorExpression>(&f32, params));
params.push_back(create<ast::ScalarConstructorExpression>(
create<ast::FloatLiteral>(&f32, 2.0)));
- vec_params.push_back(
- create<ast::TypeConstructorExpression>(&f32, std::move(params)));
+ vec_params.push_back(create<ast::TypeConstructorExpression>(&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 @@
ast::ExpressionList params;
params.push_back(create<ast::ScalarConstructorExpression>(
create<ast::SintLiteral>(&i32, 1)));
- vec_params.push_back(
- create<ast::TypeConstructorExpression>(&f32, std::move(params)));
+ vec_params.push_back(create<ast::TypeConstructorExpression>(&f32, params));
params.push_back(create<ast::ScalarConstructorExpression>(
create<ast::SintLiteral>(&i32, 2)));
- vec_params.push_back(
- create<ast::TypeConstructorExpression>(&f32, std::move(params)));
+ vec_params.push_back(create<ast::TypeConstructorExpression>(&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 @@
create<ast::FloatLiteral>(&f32, 2.f)));
params.push_back(create<ast::ScalarConstructorExpression>(
create<ast::FloatLiteral>(&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 @@
params.push_back(create<ast::IdentifierExpression>("a"));
params.push_back(create<ast::IdentifierExpression>("b"));
params.push_back(create<ast::IdentifierExpression>("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 @@
create<ast::FloatLiteral>(&f32, 2.f)));
params.push_back(create<ast::ScalarConstructorExpression>(
create<ast::FloatLiteral>(&f32, 3.f)));
- auto* first = create<ast::TypeConstructorExpression>(&vec, std::move(params));
+ auto* first = create<ast::TypeConstructorExpression>(&vec, params);
params.push_back(create<ast::ScalarConstructorExpression>(
create<ast::FloatLiteral>(&f32, 1.f)));
@@ -2372,13 +2317,12 @@
create<ast::FloatLiteral>(&f32, 2.f)));
params.push_back(create<ast::ScalarConstructorExpression>(
create<ast::FloatLiteral>(&f32, 3.f)));
- auto* second =
- create<ast::TypeConstructorExpression>(&vec, std::move(params));
+ auto* second = create<ast::TypeConstructorExpression>(&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 @@
ast::ExpressionList params;
params.push_back(create<ast::ScalarConstructorExpression>(
create<ast::SintLiteral>(&i32, 1)));
- vec_params.push_back(
- create<ast::TypeConstructorExpression>(&f32, std::move(params)));
+ vec_params.push_back(create<ast::TypeConstructorExpression>(&f32, params));
params.push_back(create<ast::ScalarConstructorExpression>(
create<ast::SintLiteral>(&i32, 2)));
- vec_params.push_back(
- create<ast::TypeConstructorExpression>(&f32, std::move(params)));
+ vec_params.push_back(create<ast::TypeConstructorExpression>(&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 @@
ast::ExpressionList params;
params.push_back(create<ast::ScalarConstructorExpression>(
create<ast::SintLiteral>(&i32, 1)));
- vec_params.push_back(
- create<ast::TypeConstructorExpression>(&f32, std::move(params)));
+ vec_params.push_back(create<ast::TypeConstructorExpression>(&f32, params));
params.push_back(create<ast::ScalarConstructorExpression>(
create<ast::SintLiteral>(&i32, 2)));
- vec_params.push_back(
- create<ast::TypeConstructorExpression>(&f32, std::move(params)));
+ vec_params.push_back(create<ast::TypeConstructorExpression>(&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 @@
vals.push_back(create<ast::ScalarConstructorExpression>(
create<ast::SintLiteral>(&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 @@
ast::StructMemberDecorationList decos;
ast::StructMemberList members;
- members.push_back(create<ast::StructMember>("a", &f32, std::move(decos)));
- members.push_back(create<ast::StructMember>("b", &vec, std::move(decos)));
+ members.push_back(create<ast::StructMember>("a", &f32, decos));
+ members.push_back(create<ast::StructMember>("b", &vec, decos));
- auto* s = create<ast::Struct>(std::move(members));
- ast::type::StructType s_type("my_struct", std::move(s));
+ auto* s = create<ast::Struct>(members);
+ ast::type::StructType s_type("my_struct", s);
ast::ExpressionList vec_vals;
vec_vals.push_back(create<ast::ScalarConstructorExpression>(
@@ -2482,10 +2422,9 @@
ast::ExpressionList vals;
vals.push_back(create<ast::ScalarConstructorExpression>(
create<ast::FloatLiteral>(&f32, 2)));
- vals.push_back(
- create<ast::TypeConstructorExpression>(&vec, std::move(vec_vals)));
+ vals.push_back(create<ast::TypeConstructorExpression>(&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 @@
ast::StructMemberDecorationList decos;
ast::StructMemberList members;
- members.push_back(create<ast::StructMember>("a", &f32, std::move(decos)));
- members.push_back(create<ast::StructMember>("b", &vec, std::move(decos)));
+ members.push_back(create<ast::StructMember>("a", &f32, decos));
+ members.push_back(create<ast::StructMember>("b", &vec, decos));
- auto* s = create<ast::Struct>(std::move(members));
- ast::type::StructType s_type("my_struct", std::move(s));
+ auto* s = create<ast::Struct>(members);
+ ast::type::StructType s_type("my_struct", s);
ast::ExpressionList vec_vals;
vec_vals.push_back(create<ast::ScalarConstructorExpression>(
@@ -2515,10 +2454,9 @@
ast::ExpressionList vals;
vals.push_back(create<ast::ScalarConstructorExpression>(
create<ast::FloatLiteral>(&f32, 2)));
- vals.push_back(
- create<ast::TypeConstructorExpression>(&vec, std::move(vec_vals)));
+ vals.push_back(create<ast::TypeConstructorExpression>(&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 716e620..a68f780 100644
--- a/src/writer/spirv/builder_function_decoration_test.cc
+++ b/src/writer/spirv/builder_function_decoration_test.cc
@@ -105,9 +105,9 @@
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 @@
body->append(create<ast::AssignmentStatement>(
create<ast::IdentifierExpression>("my_out"),
create<ast::IdentifierExpression>("my_in")));
- func.set_body(std::move(body));
+ func.set_body(body);
auto* v_in = create<ast::Variable>("my_in", ast::StorageClass::kInput, &f32);
auto* v_out =
@@ -168,9 +168,9 @@
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 7ff4676..528ee18 100644
--- a/src/writer/spirv/builder_function_test.cc
+++ b/src/writer/spirv/builder_function_test.cc
@@ -71,15 +71,15 @@
ast::VariableList params;
auto* var_a = create<ast::Variable>("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<ast::Variable>("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<ast::BlockStatement>();
body->append(
create<ast::ReturnStatement>(create<ast::IdentifierExpression>("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 @@
auto* body = create<ast::BlockStatement>();
body->append(create<ast::ReturnStatement>());
- 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 @@
ast::StructMemberList members;
ast::StructMemberDecorationList a_deco;
a_deco.push_back(create<ast::StructMemberOffsetDecoration>(0, Source{}));
- members.push_back(create<ast::StructMember>("d", &f32, std::move(a_deco)));
+ members.push_back(create<ast::StructMember>("d", &f32, a_deco));
ast::StructDecorationList s_decos;
s_decos.push_back(create<ast::StructBlockDecoration>(Source{}));
- auto* str = create<ast::Struct>(std::move(s_decos), std::move(members));
+ auto* str = create<ast::Struct>(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<ast::DecoratedVariable>(
@@ -181,12 +181,12 @@
ast::VariableDecorationList decos;
decos.push_back(create<ast::BindingDecoration>(0, Source{}));
decos.push_back(create<ast::SetDecoration>(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 @@
create<ast::IdentifierExpression>("d")));
auto* body = create<ast::BlockStatement>();
- body->append(create<ast::VariableDeclStatement>(std::move(var)));
+ body->append(create<ast::VariableDeclStatement>(var));
body->append(create<ast::ReturnStatement>());
- auto* func = create<ast::Function>("a", std::move(params), &void_type,
- std::move(body));
+ auto* func = create<ast::Function>("a", params, &void_type, body);
func->add_decoration(
create<ast::StageDecoration>(ast::PipelineStage::kCompute, Source{}));
- mod.AddFunction(std::move(func));
+ mod.AddFunction(func);
}
{
@@ -215,15 +214,14 @@
create<ast::IdentifierExpression>("d")));
auto* body = create<ast::BlockStatement>();
- body->append(create<ast::VariableDeclStatement>(std::move(var)));
+ body->append(create<ast::VariableDeclStatement>(var));
body->append(create<ast::ReturnStatement>());
- auto* func = create<ast::Function>("b", std::move(params), &void_type,
- std::move(body));
+ auto* func = create<ast::Function>("b", params, &void_type, body);
func->add_decoration(
create<ast::StageDecoration>(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 4b5beef..dbbdb79 100644
--- a/src/writer/spirv/builder_function_variable_test.cc
+++ b/src/writer/spirv/builder_function_variable_test.cc
@@ -77,12 +77,12 @@
vals.push_back(create<ast::ScalarConstructorExpression>(
create<ast::FloatLiteral>(&f32, 3.0f)));
- auto* init = create<ast::TypeConstructorExpression>(&vec, std::move(vals));
+ auto* init = create<ast::TypeConstructorExpression>(&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 @@
ast::ExpressionList vals;
vals.push_back(create<ast::ScalarConstructorExpression>(
create<ast::FloatLiteral>(&f32, 1.0f)));
- vals.push_back(std::move(rel));
+ vals.push_back(rel);
- auto* init = create<ast::TypeConstructorExpression>(&vec, std::move(vals));
+ auto* init = create<ast::TypeConstructorExpression>(&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 @@
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 @@
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 @@
vals.push_back(create<ast::ScalarConstructorExpression>(
create<ast::FloatLiteral>(&f32, 3.0f)));
- auto* init = create<ast::TypeConstructorExpression>(&vec, std::move(vals));
+ auto* init = create<ast::TypeConstructorExpression>(&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 332af1d..97ed8ff 100644
--- a/src/writer/spirv/builder_global_variable_test.cc
+++ b/src/writer/spirv/builder_global_variable_test.cc
@@ -104,12 +104,12 @@
vals.push_back(create<ast::ScalarConstructorExpression>(
create<ast::FloatLiteral>(&f32, 3.0f)));
- auto* init = create<ast::TypeConstructorExpression>(&vec, std::move(vals));
+ auto* init = create<ast::TypeConstructorExpression>(&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 @@
vals.push_back(create<ast::ScalarConstructorExpression>(
create<ast::FloatLiteral>(&f32, 3.0f)));
- auto* init = create<ast::TypeConstructorExpression>(&vec, std::move(vals));
+ auto* init = create<ast::TypeConstructorExpression>(&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 @@
create<ast::FloatLiteral>(&f32, 2.0f)));
vals.push_back(create<ast::ScalarConstructorExpression>(
create<ast::FloatLiteral>(&f32, 3.0f)));
- auto* init = create<ast::TypeConstructorExpression>(&vec3, std::move(vals));
+ auto* init = create<ast::TypeConstructorExpression>(&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 @@
ast::type::VectorType vec3(&f32, 3);
ast::type::VectorType vec2(&f32, 2);
- ast::ExpressionList vals;
- vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
- vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 2.0f)));
- auto* first = create<ast::TypeConstructorExpression>(&vec2, std::move(vals));
+ auto* first = create<ast::TypeConstructorExpression>(
+ &vec2, ast::ExpressionList{
+ create<ast::ScalarConstructorExpression>(
+ create<ast::FloatLiteral>(&f32, 1.0f)),
+ create<ast::ScalarConstructorExpression>(
+ create<ast::FloatLiteral>(&f32, 2.0f)),
+ });
- vals.push_back(std::move(first));
- vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 3.0f)));
-
- auto* init = create<ast::TypeConstructorExpression>(&vec3, std::move(vals));
+ auto* init = create<ast::TypeConstructorExpression>(
+ &vec3, ast::ExpressionList{
+ first,
+ create<ast::ScalarConstructorExpression>(
+ create<ast::FloatLiteral>(&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 @@
ast::VariableDecorationList decos;
decos.push_back(create<ast::LocationDecoration>(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 @@
decos.push_back(create<ast::BindingDecoration>(2, Source{}));
decos.push_back(create<ast::SetDecoration>(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 @@
decos.push_back(
create<ast::BuiltinDecoration>(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 @@
ast::DecoratedVariable v(
create<ast::Variable>("var", ast::StorageClass::kNone, &bool_type));
- v.set_decorations(std::move(decos));
+ v.set_decorations(decos);
v.set_constructor(create<ast::ScalarConstructorExpression>(
create<ast::BoolLiteral>(&bool_type, true)));
@@ -335,7 +337,7 @@
ast::DecoratedVariable v(
create<ast::Variable>("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 @@
ast::DecoratedVariable v(
create<ast::Variable>("var", ast::StorageClass::kNone, &f32));
- v.set_decorations(std::move(decos));
+ v.set_decorations(decos);
v.set_constructor(create<ast::ScalarConstructorExpression>(
create<ast::FloatLiteral>(&f32, 2.0)));
@@ -381,7 +383,7 @@
ast::DecoratedVariable v(
create<ast::Variable>("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 @@
ast::DecoratedVariable v(
create<ast::Variable>("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 @@
ast::DecoratedVariable v(
create<ast::Variable>("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 @@
ast::StructMemberDecorationList decos;
ast::StructMemberList members;
- members.push_back(create<ast::StructMember>("a", &i32, std::move(decos)));
- members.push_back(create<ast::StructMember>("b", &i32, std::move(decos)));
+ members.push_back(create<ast::StructMember>("a", &i32, decos));
+ members.push_back(create<ast::StructMember>("b", &i32, decos));
- ast::type::StructType A("A", create<ast::Struct>(std::move(members)));
+ ast::type::StructType A("A", create<ast::Struct>(members));
ast::type::AccessControlType ac{ast::AccessControl::kReadOnly, &A};
ast::Variable var("b", ast::StorageClass::kStorageBuffer, &ac);
@@ -519,9 +521,9 @@
ast::StructMemberDecorationList decos;
ast::StructMemberList members;
- members.push_back(create<ast::StructMember>("a", &i32, std::move(decos)));
+ members.push_back(create<ast::StructMember>("a", &i32, decos));
- ast::type::StructType A("A", create<ast::Struct>(std::move(members)));
+ ast::type::StructType A("A", create<ast::Struct>(members));
ast::type::AliasType B("B", &A);
ast::type::AccessControlType ac{ast::AccessControl::kReadOnly, &B};
@@ -553,9 +555,9 @@
ast::StructMemberDecorationList decos;
ast::StructMemberList members;
- members.push_back(create<ast::StructMember>("a", &i32, std::move(decos)));
+ members.push_back(create<ast::StructMember>("a", &i32, decos));
- ast::type::StructType A("A", create<ast::Struct>(std::move(members)));
+ ast::type::StructType A("A", create<ast::Struct>(members));
ast::type::AccessControlType ac{ast::AccessControl::kReadOnly, &A};
ast::type::AliasType B("B", &ac);
@@ -587,9 +589,9 @@
ast::StructMemberDecorationList decos;
ast::StructMemberList members;
- members.push_back(create<ast::StructMember>("a", &i32, std::move(decos)));
+ members.push_back(create<ast::StructMember>("a", &i32, decos));
- ast::type::StructType A("A", create<ast::Struct>(std::move(members)));
+ ast::type::StructType A("A", create<ast::Struct>(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 056a44e..40cd860 100644
--- a/src/writer/spirv/builder_ident_expression_test.cc
+++ b/src/writer/spirv/builder_ident_expression_test.cc
@@ -50,12 +50,12 @@
vals.push_back(create<ast::ScalarConstructorExpression>(
create<ast::FloatLiteral>(&f32, 3.0f)));
- auto* init = create<ast::TypeConstructorExpression>(&vec, std::move(vals));
+ auto* init = create<ast::TypeConstructorExpression>(&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 @@
vals.push_back(create<ast::ScalarConstructorExpression>(
create<ast::FloatLiteral>(&f32, 3.0f)));
- auto* init = create<ast::TypeConstructorExpression>(&vec, std::move(vals));
+ auto* init = create<ast::TypeConstructorExpression>(&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 @@
auto* lhs = create<ast::IdentifierExpression>("var");
auto* rhs = create<ast::IdentifierExpression>("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 @@
auto* lhs = create<ast::IdentifierExpression>("var");
auto* rhs = create<ast::IdentifierExpression>("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 75f56f0..e2303ca 100644
--- a/src/writer/spirv/builder_if_test.cc
+++ b/src/writer/spirv/builder_if_test.cc
@@ -49,7 +49,7 @@
auto* cond = create<ast::ScalarConstructorExpression>(
create<ast::BoolLiteral>(&bool_type, true));
- ast::IfStatement expr(std::move(cond), create<ast::BlockStatement>());
+ ast::IfStatement expr(cond, create<ast::BlockStatement>());
ASSERT_TRUE(td.DetermineResultType(&expr)) << td.error();
@@ -86,7 +86,7 @@
auto* cond = create<ast::ScalarConstructorExpression>(
create<ast::BoolLiteral>(&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 @@
create<ast::SintLiteral>(&i32, 3))));
ast::ElseStatementList else_stmts;
- else_stmts.push_back(create<ast::ElseStatement>(std::move(else_body)));
+ else_stmts.push_back(create<ast::ElseStatement>(else_body));
auto* cond = create<ast::ScalarConstructorExpression>(
create<ast::BoolLiteral>(&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 @@
create<ast::BoolLiteral>(&bool_type, true));
ast::ElseStatementList else_stmts;
- else_stmts.push_back(
- create<ast::ElseStatement>(std::move(else_cond), std::move(else_body)));
+ else_stmts.push_back(create<ast::ElseStatement>(else_cond, else_body));
auto* cond = create<ast::ScalarConstructorExpression>(
create<ast::BoolLiteral>(&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 @@
create<ast::BoolLiteral>(&bool_type, false));
ast::ElseStatementList else_stmts;
- else_stmts.push_back(create<ast::ElseStatement>(std::move(elseif_1_cond),
- std::move(elseif_1_body)));
- else_stmts.push_back(create<ast::ElseStatement>(std::move(elseif_2_cond),
- std::move(elseif_2_body)));
- else_stmts.push_back(create<ast::ElseStatement>(std::move(else_body)));
+ else_stmts.push_back(
+ create<ast::ElseStatement>(elseif_1_cond, elseif_1_body));
+ else_stmts.push_back(
+ create<ast::ElseStatement>(elseif_2_cond, elseif_2_body));
+ else_stmts.push_back(create<ast::ElseStatement>(else_body));
auto* cond = create<ast::ScalarConstructorExpression>(
create<ast::BoolLiteral>(&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 @@
auto* if_body = create<ast::BlockStatement>();
if_body->append(create<ast::BreakStatement>());
- auto* if_stmt = create<ast::IfStatement>(std::move(cond), std::move(if_body));
+ auto* if_stmt = create<ast::IfStatement>(cond, if_body);
auto* loop_body = create<ast::BlockStatement>();
- loop_body->append(std::move(if_stmt));
+ loop_body->append(if_stmt);
- ast::LoopStatement expr(std::move(loop_body), create<ast::BlockStatement>());
+ ast::LoopStatement expr(loop_body, create<ast::BlockStatement>());
ASSERT_TRUE(td.DetermineResultType(&expr)) << td.error();
@@ -410,16 +409,15 @@
else_body->append(create<ast::BreakStatement>());
ast::ElseStatementList else_stmts;
- else_stmts.push_back(create<ast::ElseStatement>(std::move(else_body)));
+ else_stmts.push_back(create<ast::ElseStatement>(else_body));
- auto* if_stmt =
- create<ast::IfStatement>(std::move(cond), create<ast::BlockStatement>());
- if_stmt->set_else_statements(std::move(else_stmts));
+ auto* if_stmt = create<ast::IfStatement>(cond, create<ast::BlockStatement>());
+ if_stmt->set_else_statements(else_stmts);
auto* loop_body = create<ast::BlockStatement>();
- loop_body->append(std::move(if_stmt));
+ loop_body->append(if_stmt);
- ast::LoopStatement expr(std::move(loop_body), create<ast::BlockStatement>());
+ ast::LoopStatement expr(loop_body, create<ast::BlockStatement>());
ASSERT_TRUE(td.DetermineResultType(&expr)) << td.error();
@@ -462,12 +460,12 @@
auto* if_body = create<ast::BlockStatement>();
if_body->append(create<ast::ContinueStatement>());
- auto* if_stmt = create<ast::IfStatement>(std::move(cond), std::move(if_body));
+ auto* if_stmt = create<ast::IfStatement>(cond, if_body);
auto* loop_body = create<ast::BlockStatement>();
- loop_body->append(std::move(if_stmt));
+ loop_body->append(if_stmt);
- ast::LoopStatement expr(std::move(loop_body), create<ast::BlockStatement>());
+ ast::LoopStatement expr(loop_body, create<ast::BlockStatement>());
ASSERT_TRUE(td.DetermineResultType(&expr)) << td.error();
@@ -510,16 +508,15 @@
else_body->append(create<ast::ContinueStatement>());
ast::ElseStatementList else_stmts;
- else_stmts.push_back(create<ast::ElseStatement>(std::move(else_body)));
+ else_stmts.push_back(create<ast::ElseStatement>(else_body));
- auto* if_stmt =
- create<ast::IfStatement>(std::move(cond), create<ast::BlockStatement>());
- if_stmt->set_else_statements(std::move(else_stmts));
+ auto* if_stmt = create<ast::IfStatement>(cond, create<ast::BlockStatement>());
+ if_stmt->set_else_statements(else_stmts);
auto* loop_body = create<ast::BlockStatement>();
- loop_body->append(std::move(if_stmt));
+ loop_body->append(if_stmt);
- ast::LoopStatement expr(std::move(loop_body), create<ast::BlockStatement>());
+ ast::LoopStatement expr(loop_body, create<ast::BlockStatement>());
ASSERT_TRUE(td.DetermineResultType(&expr)) << td.error();
@@ -560,7 +557,7 @@
auto* if_body = create<ast::BlockStatement>();
if_body->append(create<ast::ReturnStatement>());
- 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 @@
create<ast::BoolLiteral>(&bool_type, false));
auto* if_body = create<ast::BlockStatement>();
- if_body->append(create<ast::ReturnStatement>(std::move(cond2)));
+ if_body->append(create<ast::ReturnStatement>(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 c8fff57..695bd85 100644
--- a/src/writer/spirv/builder_intrinsic_test.cc
+++ b/src/writer/spirv/builder_intrinsic_test.cc
@@ -1706,10 +1706,10 @@
ast::StructMemberDecorationList decos;
ast::StructMemberList members;
- members.push_back(create<ast::StructMember>("a", &ary, std::move(decos)));
+ members.push_back(create<ast::StructMember>("a", &ary, decos));
- auto* s = create<ast::Struct>(std::move(members));
- ast::type::StructType s_type("my_struct", std::move(s));
+ auto* s = create<ast::Struct>(members);
+ ast::type::StructType s_type("my_struct", s);
auto* var = make_var("b", ast::StorageClass::kPrivate, &s_type);
@@ -1746,11 +1746,11 @@
ast::StructMemberDecorationList decos;
ast::StructMemberList members;
- members.push_back(create<ast::StructMember>("z", f32(), std::move(decos)));
- members.push_back(create<ast::StructMember>("a", &ary, std::move(decos)));
+ members.push_back(create<ast::StructMember>("z", f32(), decos));
+ members.push_back(create<ast::StructMember>("a", &ary, decos));
- auto* s = create<ast::Struct>(std::move(members));
- ast::type::StructType s_type("my_struct", std::move(s));
+ auto* s = create<ast::Struct>(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<ast::MemberAccessorExpression>(
@@ -1788,11 +1788,11 @@
ast::StructMemberDecorationList decos;
ast::StructMemberList members;
- members.push_back(create<ast::StructMember>("z", f32(), std::move(decos)));
- members.push_back(create<ast::StructMember>("a", &ary, std::move(decos)));
+ members.push_back(create<ast::StructMember>("z", f32(), decos));
+ members.push_back(create<ast::StructMember>("a", &ary, decos));
- auto* s = create<ast::Struct>(std::move(members));
- ast::type::StructType s_type("my_struct", std::move(s));
+ auto* s = create<ast::Struct>(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 319163e..ecfe48a 100644
--- a/src/writer/spirv/builder_loop_test.cc
+++ b/src/writer/spirv/builder_loop_test.cc
@@ -74,7 +74,7 @@
create<ast::ScalarConstructorExpression>(
create<ast::SintLiteral>(&i32, 2))));
- ast::LoopStatement expr(std::move(body), create<ast::BlockStatement>());
+ ast::LoopStatement expr(body, create<ast::BlockStatement>());
td.RegisterVariableForTesting(var);
ASSERT_TRUE(td.DetermineResultType(&expr)) << td.error();
@@ -125,7 +125,7 @@
create<ast::AssignmentStatement>(create<ast::IdentifierExpression>("v"),
create<ast::ScalarConstructorExpression>(
create<ast::SintLiteral>(&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 @@
auto* body = create<ast::BlockStatement>();
body->append(create<ast::ContinueStatement>());
- ast::LoopStatement expr(std::move(body), create<ast::BlockStatement>());
+ ast::LoopStatement expr(body, create<ast::BlockStatement>());
ASSERT_TRUE(td.DetermineResultType(&expr)) << td.error();
@@ -190,7 +190,7 @@
auto* body = create<ast::BlockStatement>();
body->append(create<ast::BreakStatement>());
- ast::LoopStatement expr(std::move(body), create<ast::BlockStatement>());
+ ast::LoopStatement expr(body, create<ast::BlockStatement>());
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 5c0dbb3..738a12a 100644
--- a/src/writer/spirv/builder_return_test.cc
+++ b/src/writer/spirv/builder_return_test.cc
@@ -58,9 +58,9 @@
vals.push_back(create<ast::ScalarConstructorExpression>(
create<ast::FloatLiteral>(&f32, 3.0f)));
- auto* val = create<ast::TypeConstructorExpression>(&vec, std::move(vals));
+ auto* val = create<ast::TypeConstructorExpression>(&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 1dfb466..2738b28 100644
--- a/src/writer/spirv/builder_switch_test.cc
+++ b/src/writer/spirv/builder_switch_test.cc
@@ -48,7 +48,7 @@
auto* cond = create<ast::ScalarConstructorExpression>(
create<ast::SintLiteral>(&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 @@
selector_2.push_back(create<ast::SintLiteral>(&i32, 2));
ast::CaseStatementList cases;
- cases.push_back(create<ast::CaseStatement>(std::move(selector_1),
- std::move(case_1_body)));
- cases.push_back(create<ast::CaseStatement>(std::move(selector_2),
- std::move(case_2_body)));
+ cases.push_back(create<ast::CaseStatement>(selector_1, case_1_body));
+ cases.push_back(create<ast::CaseStatement>(selector_2, case_2_body));
- ast::SwitchStatement expr(create<ast::IdentifierExpression>("a"),
- std::move(cases));
+ ast::SwitchStatement expr(create<ast::IdentifierExpression>("a"), cases);
td.RegisterVariableForTesting(v);
td.RegisterVariableForTesting(a);
@@ -166,10 +163,9 @@
create<ast::SintLiteral>(&i32, 1))));
ast::CaseStatementList cases;
- cases.push_back(create<ast::CaseStatement>(std::move(default_body)));
+ cases.push_back(create<ast::CaseStatement>(default_body));
- ast::SwitchStatement expr(create<ast::IdentifierExpression>("a"),
- std::move(cases));
+ ast::SwitchStatement expr(create<ast::IdentifierExpression>("a"), cases);
td.RegisterVariableForTesting(v);
td.RegisterVariableForTesting(a);
@@ -247,14 +243,11 @@
selector_2.push_back(create<ast::SintLiteral>(&i32, 3));
ast::CaseStatementList cases;
- cases.push_back(create<ast::CaseStatement>(std::move(selector_1),
- std::move(case_1_body)));
- cases.push_back(create<ast::CaseStatement>(std::move(selector_2),
- std::move(case_2_body)));
- cases.push_back(create<ast::CaseStatement>(std::move(default_body)));
+ cases.push_back(create<ast::CaseStatement>(selector_1, case_1_body));
+ cases.push_back(create<ast::CaseStatement>(selector_2, case_2_body));
+ cases.push_back(create<ast::CaseStatement>(default_body));
- ast::SwitchStatement expr(create<ast::IdentifierExpression>("a"),
- std::move(cases));
+ ast::SwitchStatement expr(create<ast::IdentifierExpression>("a"), cases);
td.RegisterVariableForTesting(v);
td.RegisterVariableForTesting(a);
@@ -341,14 +334,11 @@
selector_2.push_back(create<ast::SintLiteral>(&i32, 2));
ast::CaseStatementList cases;
- cases.push_back(create<ast::CaseStatement>(std::move(selector_1),
- std::move(case_1_body)));
- cases.push_back(create<ast::CaseStatement>(std::move(selector_2),
- std::move(case_2_body)));
- cases.push_back(create<ast::CaseStatement>(std::move(default_body)));
+ cases.push_back(create<ast::CaseStatement>(selector_1, case_1_body));
+ cases.push_back(create<ast::CaseStatement>(selector_2, case_2_body));
+ cases.push_back(create<ast::CaseStatement>(default_body));
- ast::SwitchStatement expr(create<ast::IdentifierExpression>("a"),
- std::move(cases));
+ ast::SwitchStatement expr(create<ast::IdentifierExpression>("a"), cases);
td.RegisterVariableForTesting(v);
td.RegisterVariableForTesting(a);
@@ -416,11 +406,9 @@
selector_1.push_back(create<ast::SintLiteral>(&i32, 1));
ast::CaseStatementList cases;
- cases.push_back(create<ast::CaseStatement>(std::move(selector_1),
- std::move(case_1_body)));
+ cases.push_back(create<ast::CaseStatement>(selector_1, case_1_body));
- ast::SwitchStatement expr(create<ast::IdentifierExpression>("a"),
- std::move(cases));
+ ast::SwitchStatement expr(create<ast::IdentifierExpression>("a"), cases);
td.RegisterVariableForTesting(v);
td.RegisterVariableForTesting(a);
@@ -458,7 +446,7 @@
case_1_body->append(
create<ast::IfStatement>(create<ast::ScalarConstructorExpression>(
create<ast::BoolLiteral>(&bool_type, true)),
- std::move(if_body)));
+ if_body));
case_1_body->append(
create<ast::AssignmentStatement>(create<ast::IdentifierExpression>("v"),
@@ -469,11 +457,9 @@
selector_1.push_back(create<ast::SintLiteral>(&i32, 1));
ast::CaseStatementList cases;
- cases.push_back(create<ast::CaseStatement>(std::move(selector_1),
- std::move(case_1_body)));
+ cases.push_back(create<ast::CaseStatement>(selector_1, case_1_body));
- ast::SwitchStatement expr(create<ast::IdentifierExpression>("a"),
- std::move(cases));
+ ast::SwitchStatement expr(create<ast::IdentifierExpression>("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 44ab429..01109a4 100644
--- a/src/writer/spirv/builder_type_test.cc
+++ b/src/writer/spirv/builder_type_test.cc
@@ -127,7 +127,7 @@
decos.push_back(create<ast::StrideDecoration>(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, GenerateStruct_Empty) {
auto* s = create<ast::Struct>();
- 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 @@
ast::StructMemberDecorationList decos;
ast::StructMemberList members;
- members.push_back(create<ast::StructMember>("a", &f32, std::move(decos)));
+ members.push_back(create<ast::StructMember>("a", &f32, decos));
- auto* s = create<ast::Struct>(std::move(members));
- ast::type::StructType s_type("my_struct", std::move(s));
+ auto* s = create<ast::Struct>(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 @@
ast::StructMemberDecorationList decos;
ast::StructMemberList members;
- members.push_back(create<ast::StructMember>("a", &f32, std::move(decos)));
+ members.push_back(create<ast::StructMember>("a", &f32, decos));
ast::StructDecorationList struct_decos;
struct_decos.push_back(create<ast::StructBlockDecoration>(Source{}));
- auto* s = create<ast::Struct>(std::move(struct_decos), std::move(members));
- ast::type::StructType s_type("my_struct", std::move(s));
+ auto* s = create<ast::Struct>(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 @@
b_decos.push_back(create<ast::StructMemberOffsetDecoration>(8, Source{}));
ast::StructMemberList members;
- members.push_back(create<ast::StructMember>("a", &f32, std::move(a_decos)));
- members.push_back(create<ast::StructMember>("b", &f32, std::move(b_decos)));
+ members.push_back(create<ast::StructMember>("a", &f32, a_decos));
+ members.push_back(create<ast::StructMember>("b", &f32, b_decos));
- auto* s = create<ast::Struct>(std::move(members));
- ast::type::StructType s_type("S", std::move(s));
+ auto* s = create<ast::Struct>(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 @@
ast::StructMemberDecorationList empty_b;
ast::StructMemberDecorationList empty_c;
ast::StructMemberList members;
- members.push_back(
- create<ast::StructMember>("a", &glsl_mat2x2, std::move(empty_a)));
- members.push_back(
- create<ast::StructMember>("b", &glsl_mat2x3, std::move(empty_b)));
- members.push_back(
- create<ast::StructMember>("c", &glsl_mat4x4, std::move(empty_c)));
+ members.push_back(create<ast::StructMember>("a", &glsl_mat2x2, empty_a));
+ members.push_back(create<ast::StructMember>("b", &glsl_mat2x3, empty_b));
+ members.push_back(create<ast::StructMember>("c", &glsl_mat4x4, empty_c));
- auto* s = create<ast::Struct>(std::move(members));
- ast::type::StructType s_type("S", std::move(s));
+ auto* s = create<ast::Struct>(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 @@
c_decos.push_back(create<ast::StructMemberOffsetDecoration>(48, Source{}));
ast::StructMemberList members;
- members.push_back(
- create<ast::StructMember>("a", &glsl_mat2x2, std::move(a_decos)));
- members.push_back(
- create<ast::StructMember>("b", &glsl_mat2x3, std::move(b_decos)));
- members.push_back(
- create<ast::StructMember>("c", &glsl_mat4x4, std::move(c_decos)));
+ members.push_back(create<ast::StructMember>("a", &glsl_mat2x2, a_decos));
+ members.push_back(create<ast::StructMember>("b", &glsl_mat2x3, b_decos));
+ members.push_back(create<ast::StructMember>("c", &glsl_mat4x4, c_decos));
- auto* s = create<ast::Struct>(std::move(members));
- ast::type::StructType s_type("S", std::move(s));
+ auto* s = create<ast::Struct>(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 @@
c_decos.push_back(create<ast::StructMemberOffsetDecoration>(48, Source{}));
ast::StructMemberList members;
- members.push_back(
- create<ast::StructMember>("a", &glsl_mat2x2, std::move(a_decos)));
- members.push_back(
- create<ast::StructMember>("b", &glsl_mat2x3, std::move(b_decos)));
- members.push_back(
- create<ast::StructMember>("c", &glsl_mat4x4, std::move(c_decos)));
+ members.push_back(create<ast::StructMember>("a", &glsl_mat2x2, a_decos));
+ members.push_back(create<ast::StructMember>("b", &glsl_mat2x3, b_decos));
+ members.push_back(create<ast::StructMember>("c", &glsl_mat4x4, c_decos));
- auto* s = create<ast::Struct>(std::move(members));
- ast::type::StructType s_type("S", std::move(s));
+ auto* s = create<ast::Struct>(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 73f0a72..ce1249e 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 @@
ast::StructMemberDecorationList b_deco;
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(4, Source{}));
- members.push_back(create<ast::StructMember>("b", &i32, std::move(b_deco)));
+ members.push_back(create<ast::StructMember>("b", &i32, b_deco));
auto* str = create<ast::Struct>();
- 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 @@
ast::StructMemberDecorationList b_deco;
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(4, Source{}));
- members.push_back(create<ast::StructMember>("b", &i32, std::move(b_deco)));
+ members.push_back(create<ast::StructMember>("b", &i32, b_deco));
auto* str = create<ast::Struct>();
- 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 3b8fa38..e187612 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 @@
TEST_F(WgslGeneratorImplTest, EmitExpression_ArrayAccessor) {
ast::type::I32Type i32;
auto* lit = create<ast::SintLiteral>(&i32, 5);
- auto* idx = create<ast::ScalarConstructorExpression>(std::move(lit));
+ auto* idx = create<ast::ScalarConstructorExpression>(lit);
auto* ary = create<ast::IdentifierExpression>("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 @@
auto* ary = create<ast::IdentifierExpression>("ary");
auto* idx = create<ast::IdentifierExpression>("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 36e8650..9679c6b 100644
--- a/src/writer/wgsl/generator_impl_assign_test.cc
+++ b/src/writer/wgsl/generator_impl_assign_test.cc
@@ -31,7 +31,7 @@
TEST_F(WgslGeneratorImplTest, Emit_Assign) {
auto* lhs = create<ast::IdentifierExpression>("lhs");
auto* rhs = create<ast::IdentifierExpression>("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 d210f73..825668f 100644
--- a/src/writer/wgsl/generator_impl_binary_test.cc
+++ b/src/writer/wgsl/generator_impl_binary_test.cc
@@ -40,7 +40,7 @@
auto* left = create<ast::IdentifierExpression>("left");
auto* right = create<ast::IdentifierExpression>("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 c6452ae..83ba9e6 100644
--- a/src/writer/wgsl/generator_impl_bitcast_test.cc
+++ b/src/writer/wgsl/generator_impl_bitcast_test.cc
@@ -31,7 +31,7 @@
TEST_F(WgslGeneratorImplTest, EmitExpression_Bitcast) {
ast::type::F32Type f32;
auto* id = create<ast::IdentifierExpression>("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<f32>(id)");
diff --git a/src/writer/wgsl/generator_impl_call_test.cc b/src/writer/wgsl/generator_impl_call_test.cc
index aa0c7cb..8afc062 100644
--- a/src/writer/wgsl/generator_impl_call_test.cc
+++ b/src/writer/wgsl/generator_impl_call_test.cc
@@ -30,7 +30,7 @@
TEST_F(WgslGeneratorImplTest, EmitExpression_Call_WithoutParams) {
auto* id = create<ast::IdentifierExpression>("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 @@
ast::ExpressionList params;
params.push_back(create<ast::IdentifierExpression>("param1"));
params.push_back(create<ast::IdentifierExpression>("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 @@
params.push_back(create<ast::IdentifierExpression>("param1"));
params.push_back(create<ast::IdentifierExpression>("param2"));
- ast::CallStatement call(
- create<ast::CallExpression>(std::move(id), std::move(params)));
+ ast::CallStatement call(create<ast::CallExpression>(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 1246465..5b5fc05 100644
--- a/src/writer/wgsl/generator_impl_case_test.cc
+++ b/src/writer/wgsl/generator_impl_case_test.cc
@@ -38,7 +38,7 @@
ast::CaseSelectorList lit;
lit.push_back(create<ast::SintLiteral>(&i32, 5));
- ast::CaseStatement c(std::move(lit), std::move(body));
+ ast::CaseStatement c(lit, body);
gen.increment_indent();
@@ -58,7 +58,7 @@
ast::CaseSelectorList lit;
lit.push_back(create<ast::SintLiteral>(&i32, 5));
lit.push_back(create<ast::SintLiteral>(&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_Default) {
auto* body = create<ast::BlockStatement>();
body->append(create<ast::BreakStatement>());
- 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 5d64f46..c2a86dc 100644
--- a/src/writer/wgsl/generator_impl_cast_test.cc
+++ b/src/writer/wgsl/generator_impl_cast_test.cc
@@ -34,7 +34,7 @@
ast::ExpressionList params;
params.push_back(create<ast::IdentifierExpression>("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 70e78e3..53ac451 100644
--- a/src/writer/wgsl/generator_impl_constructor_test.cc
+++ b/src/writer/wgsl/generator_impl_constructor_test.cc
@@ -38,7 +38,7 @@
TEST_F(WgslGeneratorImplTest, EmitConstructor_Bool) {
ast::type::BoolType bool_type;
auto* lit = create<ast::BoolLiteral>(&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_Int) {
ast::type::I32Type i32;
auto* lit = create<ast::SintLiteral>(&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_UInt) {
ast::type::U32Type u32;
auto* lit = create<ast::UintLiteral>(&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 @@
// Use a number close to 1<<30 but whose decimal representation ends in 0.
auto* lit =
create<ast::FloatLiteral>(&f32, static_cast<float>((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 @@
auto* lit = create<ast::FloatLiteral>(&f32, -1.2e-5);
ast::ExpressionList values;
- values.push_back(create<ast::ScalarConstructorExpression>(std::move(lit)));
+ values.push_back(create<ast::ScalarConstructorExpression>(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 @@
auto* lit = create<ast::BoolLiteral>(&b, true);
ast::ExpressionList values;
- values.push_back(create<ast::ScalarConstructorExpression>(std::move(lit)));
+ values.push_back(create<ast::ScalarConstructorExpression>(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 @@
auto* lit = create<ast::SintLiteral>(&i32, -12345);
ast::ExpressionList values;
- values.push_back(create<ast::ScalarConstructorExpression>(std::move(lit)));
+ values.push_back(create<ast::ScalarConstructorExpression>(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 @@
auto* lit = create<ast::UintLiteral>(&u32, 12345);
ast::ExpressionList values;
- values.push_back(create<ast::ScalarConstructorExpression>(std::move(lit)));
+ values.push_back(create<ast::ScalarConstructorExpression>(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 @@
auto* lit2 = create<ast::FloatLiteral>(&f32, 2.f);
auto* lit3 = create<ast::FloatLiteral>(&f32, 3.f);
ast::ExpressionList values;
- values.push_back(create<ast::ScalarConstructorExpression>(std::move(lit1)));
- values.push_back(create<ast::ScalarConstructorExpression>(std::move(lit2)));
- values.push_back(create<ast::ScalarConstructorExpression>(std::move(lit3)));
+ values.push_back(create<ast::ScalarConstructorExpression>(lit1));
+ values.push_back(create<ast::ScalarConstructorExpression>(lit2));
+ values.push_back(create<ast::ScalarConstructorExpression>(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<f32>(1.00000000, 2.00000000, 3.00000000)");
@@ -158,14 +158,13 @@
create<ast::FloatLiteral>(&f32, static_cast<float>(2 + (i * 2)));
ast::ExpressionList values;
- values.push_back(create<ast::ScalarConstructorExpression>(std::move(lit1)));
- values.push_back(create<ast::ScalarConstructorExpression>(std::move(lit2)));
+ values.push_back(create<ast::ScalarConstructorExpression>(lit1));
+ values.push_back(create<ast::ScalarConstructorExpression>(lit2));
- mat_values.push_back(
- create<ast::TypeConstructorExpression>(&vec, std::move(values)));
+ mat_values.push_back(create<ast::TypeConstructorExpression>(&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 @@
create<ast::FloatLiteral>(&f32, static_cast<float>(3 + (i * 3)));
ast::ExpressionList values;
- values.push_back(create<ast::ScalarConstructorExpression>(std::move(lit1)));
- values.push_back(create<ast::ScalarConstructorExpression>(std::move(lit2)));
- values.push_back(create<ast::ScalarConstructorExpression>(std::move(lit3)));
+ values.push_back(create<ast::ScalarConstructorExpression>(lit1));
+ values.push_back(create<ast::ScalarConstructorExpression>(lit2));
+ values.push_back(create<ast::ScalarConstructorExpression>(lit3));
- ary_values.push_back(
- create<ast::TypeConstructorExpression>(&vec, std::move(values)));
+ ary_values.push_back(create<ast::TypeConstructorExpression>(&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 c05e2df..6923099 100644
--- a/src/writer/wgsl/generator_impl_function_test.cc
+++ b/src/writer/wgsl/generator_impl_function_test.cc
@@ -48,7 +48,7 @@
body->append(create<ast::ReturnStatement>());
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 @@
params.push_back(create<ast::Variable>("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 @@
body->append(create<ast::ReturnStatement>());
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::WorkgroupDecoration>(2u, 4u, 6u, Source{}));
gen.increment_indent();
@@ -110,7 +110,7 @@
body->append(create<ast::ReturnStatement>());
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::StageDecoration>(ast::PipelineStage::kFragment, Source{}));
@@ -131,7 +131,7 @@
body->append(create<ast::ReturnStatement>());
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::StageDecoration>(ast::PipelineStage::kFragment, Source{}));
func.add_decoration(create<ast::WorkgroupDecoration>(2u, 4u, 6u, Source{}));
@@ -172,14 +172,14 @@
ast::StructMemberList members;
ast::StructMemberDecorationList a_deco;
a_deco.push_back(create<ast::StructMemberOffsetDecoration>(0, Source{}));
- members.push_back(create<ast::StructMember>("d", &f32, std::move(a_deco)));
+ members.push_back(create<ast::StructMember>("d", &f32, a_deco));
ast::StructDecorationList s_decos;
s_decos.push_back(create<ast::StructBlockDecoration>(Source{}));
- auto* str = create<ast::Struct>(std::move(s_decos), std::move(members));
+ auto* str = create<ast::Struct>(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<ast::DecoratedVariable>(
@@ -188,12 +188,12 @@
ast::VariableDecorationList decos;
decos.push_back(create<ast::BindingDecoration>(0, Source{}));
decos.push_back(create<ast::SetDecoration>(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 @@
create<ast::IdentifierExpression>("d")));
auto* body = create<ast::BlockStatement>();
- body->append(create<ast::VariableDeclStatement>(std::move(var)));
+ body->append(create<ast::VariableDeclStatement>(var));
body->append(create<ast::ReturnStatement>());
- auto* func = create<ast::Function>("a", std::move(params), &void_type,
- std::move(body));
+ auto* func = create<ast::Function>("a", params, &void_type, body);
func->add_decoration(
create<ast::StageDecoration>(ast::PipelineStage::kCompute, Source{}));
- mod.AddFunction(std::move(func));
+ mod.AddFunction(func);
}
{
@@ -222,15 +221,14 @@
create<ast::IdentifierExpression>("d")));
auto* body = create<ast::BlockStatement>();
- body->append(create<ast::VariableDeclStatement>(std::move(var)));
+ body->append(create<ast::VariableDeclStatement>(var));
body->append(create<ast::ReturnStatement>());
- auto* func = create<ast::Function>("b", std::move(params), &void_type,
- std::move(body));
+ auto* func = create<ast::Function>("b", params, &void_type, body);
func->add_decoration(
create<ast::StageDecoration>(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 3094210..b0c68b8 100644
--- a/src/writer/wgsl/generator_impl_if_test.cc
+++ b/src/writer/wgsl/generator_impl_if_test.cc
@@ -32,7 +32,7 @@
auto* body = create<ast::BlockStatement>();
body->append(create<ast::DiscardStatement>());
- ast::IfStatement i(std::move(cond), std::move(body));
+ ast::IfStatement i(cond, body);
gen.increment_indent();
@@ -49,15 +49,14 @@
else_body->append(create<ast::DiscardStatement>());
ast::ElseStatementList elses;
- elses.push_back(
- create<ast::ElseStatement>(std::move(else_cond), std::move(else_body)));
+ elses.push_back(create<ast::ElseStatement>(else_cond, else_body));
auto* cond = create<ast::IdentifierExpression>("cond");
auto* body = create<ast::BlockStatement>();
body->append(create<ast::DiscardStatement>());
- 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 @@
else_body->append(create<ast::DiscardStatement>());
ast::ElseStatementList elses;
- elses.push_back(create<ast::ElseStatement>(std::move(else_body)));
+ elses.push_back(create<ast::ElseStatement>(else_body));
auto* cond = create<ast::IdentifierExpression>("cond");
auto* body = create<ast::BlockStatement>();
body->append(create<ast::DiscardStatement>());
- 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 @@
else_body_2->append(create<ast::DiscardStatement>());
ast::ElseStatementList elses;
- elses.push_back(
- create<ast::ElseStatement>(std::move(else_cond), std::move(else_body)));
- elses.push_back(create<ast::ElseStatement>(std::move(else_body_2)));
+ elses.push_back(create<ast::ElseStatement>(else_cond, else_body));
+ elses.push_back(create<ast::ElseStatement>(else_body_2));
auto* cond = create<ast::IdentifierExpression>("cond");
auto* body = create<ast::BlockStatement>();
body->append(create<ast::DiscardStatement>());
- 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 2bcc614..41c399d 100644
--- a/src/writer/wgsl/generator_impl_loop_test.cc
+++ b/src/writer/wgsl/generator_impl_loop_test.cc
@@ -30,7 +30,7 @@
TEST_F(WgslGeneratorImplTest, Emit_Loop) {
auto* body = create<ast::BlockStatement>();
body->append(create<ast::DiscardStatement>());
- ast::LoopStatement l(std::move(body), {});
+ ast::LoopStatement l(body, {});
gen.increment_indent();
@@ -48,7 +48,7 @@
auto* continuing = create<ast::BlockStatement>();
continuing->append(create<ast::DiscardStatement>());
- 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 c939a02..8ff995e 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 @@
auto* str = create<ast::IdentifierExpression>("str");
auto* mem = create<ast::IdentifierExpression>("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 91f9e8b..51b1e78 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_ReturnWithValue) {
auto* expr = create<ast::IdentifierExpression>("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 1072d67..06904ee 100644
--- a/src/writer/wgsl/generator_impl_switch_test.cc
+++ b/src/writer/wgsl/generator_impl_switch_test.cc
@@ -34,7 +34,7 @@
TEST_F(WgslGeneratorImplTest, Emit_Switch) {
auto* def_body = create<ast::BlockStatement>();
def_body->append(create<ast::BreakStatement>());
- auto* def = create<ast::CaseStatement>(std::move(def_body));
+ auto* def = create<ast::CaseStatement>(def_body);
ast::type::I32Type i32;
ast::CaseSelectorList case_val;
@@ -43,15 +43,14 @@
auto* case_body = create<ast::BlockStatement>();
case_body->append(create<ast::BreakStatement>());
- auto* case_stmt =
- create<ast::CaseStatement>(std::move(case_val), std::move(case_body));
+ auto* case_stmt = create<ast::CaseStatement>(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<ast::IdentifierExpression>("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 48fbf4f..6cc49aa 100644
--- a/src/writer/wgsl/generator_impl_type_test.cc
+++ b/src/writer/wgsl/generator_impl_type_test.cc
@@ -67,7 +67,7 @@
decos.push_back(create<ast::StrideDecoration>(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<bool, 4>");
@@ -80,7 +80,7 @@
decos.push_back(create<ast::StrideDecoration>(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<bool, 4>");
@@ -141,12 +141,12 @@
ast::StructMemberDecorationList b_deco;
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(4, Source{}));
- members.push_back(create<ast::StructMember>("b", &f32, std::move(b_deco)));
+ members.push_back(create<ast::StructMember>("b", &f32, b_deco));
auto* str = create<ast::Struct>();
- 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 @@
ast::StructMemberDecorationList b_deco;
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(4, Source{}));
- members.push_back(create<ast::StructMember>("b", &f32, std::move(b_deco)));
+ members.push_back(create<ast::StructMember>("b", &f32, b_deco));
auto* str = create<ast::Struct>();
- 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 @@
ast::StructMemberDecorationList b_deco;
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(4, Source{}));
- members.push_back(create<ast::StructMember>("b", &f32, std::move(b_deco)));
+ members.push_back(create<ast::StructMember>("b", &f32, b_deco));
ast::StructDecorationList decos;
decos.push_back(create<ast::StructBlockDecoration>(Source{}));
- auto* str = create<ast::Struct>(std::move(decos), std::move(members));
+ auto* str = create<ast::Struct>(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 bebe74b..518be49 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 @@
auto params = GetParam();
auto* expr = create<ast::IdentifierExpression>("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 1db4355..7d19a1e 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 @@
ast::type::F32Type f32;
auto* var = create<ast::Variable>("a", ast::StorageClass::kNone, &f32);
- ast::VariableDeclStatement stmt(std::move(var));
+ ast::VariableDeclStatement stmt(var);
gen.increment_indent();
@@ -49,7 +49,7 @@
ast::type::F32Type f32;
auto* var = create<ast::Variable>("a", ast::StorageClass::kFunction, &f32);
- ast::VariableDeclStatement stmt(std::move(var));
+ ast::VariableDeclStatement stmt(var);
gen.increment_indent();
@@ -61,7 +61,7 @@
ast::type::F32Type f32;
auto* var = create<ast::Variable>("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 529bf05..23b9adf 100644
--- a/src/writer/wgsl/generator_impl_variable_test.cc
+++ b/src/writer/wgsl/generator_impl_variable_test.cc
@@ -60,7 +60,7 @@
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 @@
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 @@
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 @@
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();