mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-05-15 03:41:34 +00:00
Remove KillStatement
This CL removes the KillStatement from the AST and replaces all test usage with DiscardStatement. Bug: tint:169 Change-Id: Ie68dd3cdd54056f144d10506f05cc1f6903d1cda Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/25605 Reviewed-by: David Neto <dneto@google.com>
This commit is contained in:
parent
23508f4339
commit
8f3c6356d4
6
BUILD.gn
6
BUILD.gn
@ -273,8 +273,6 @@ source_set("libtint_core_src") {
|
|||||||
"src/ast/int_literal.h",
|
"src/ast/int_literal.h",
|
||||||
"src/ast/intrinsic.cc",
|
"src/ast/intrinsic.cc",
|
||||||
"src/ast/intrinsic.h",
|
"src/ast/intrinsic.h",
|
||||||
"src/ast/kill_statement.cc",
|
|
||||||
"src/ast/kill_statement.h",
|
|
||||||
"src/ast/literal.cc",
|
"src/ast/literal.cc",
|
||||||
"src/ast/literal.h",
|
"src/ast/literal.h",
|
||||||
"src/ast/location_decoration.cc",
|
"src/ast/location_decoration.cc",
|
||||||
@ -688,7 +686,6 @@ source_set("tint_unittests_core_src") {
|
|||||||
"src/ast/if_statement_test.cc",
|
"src/ast/if_statement_test.cc",
|
||||||
"src/ast/import_test.cc",
|
"src/ast/import_test.cc",
|
||||||
"src/ast/int_literal_test.cc",
|
"src/ast/int_literal_test.cc",
|
||||||
"src/ast/kill_statement_test.cc",
|
|
||||||
"src/ast/location_decoration_test.cc",
|
"src/ast/location_decoration_test.cc",
|
||||||
"src/ast/loop_statement_test.cc",
|
"src/ast/loop_statement_test.cc",
|
||||||
"src/ast/member_accessor_expression_test.cc",
|
"src/ast/member_accessor_expression_test.cc",
|
||||||
@ -811,7 +808,6 @@ source_set("tint_unittests_spv_writer_src") {
|
|||||||
"src/writer/spirv/builder_ident_expression_test.cc",
|
"src/writer/spirv/builder_ident_expression_test.cc",
|
||||||
"src/writer/spirv/builder_if_test.cc",
|
"src/writer/spirv/builder_if_test.cc",
|
||||||
"src/writer/spirv/builder_intrinsic_test.cc",
|
"src/writer/spirv/builder_intrinsic_test.cc",
|
||||||
"src/writer/spirv/builder_kill_test.cc",
|
|
||||||
"src/writer/spirv/builder_literal_test.cc",
|
"src/writer/spirv/builder_literal_test.cc",
|
||||||
"src/writer/spirv/builder_loop_test.cc",
|
"src/writer/spirv/builder_loop_test.cc",
|
||||||
"src/writer/spirv/builder_return_test.cc",
|
"src/writer/spirv/builder_return_test.cc",
|
||||||
@ -951,7 +947,6 @@ source_set("tint_unittests_wgsl_writer_src") {
|
|||||||
"src/writer/wgsl/generator_impl_identifier_test.cc",
|
"src/writer/wgsl/generator_impl_identifier_test.cc",
|
||||||
"src/writer/wgsl/generator_impl_if_test.cc",
|
"src/writer/wgsl/generator_impl_if_test.cc",
|
||||||
"src/writer/wgsl/generator_impl_import_test.cc",
|
"src/writer/wgsl/generator_impl_import_test.cc",
|
||||||
"src/writer/wgsl/generator_impl_kill_test.cc",
|
|
||||||
"src/writer/wgsl/generator_impl_loop_test.cc",
|
"src/writer/wgsl/generator_impl_loop_test.cc",
|
||||||
"src/writer/wgsl/generator_impl_member_accessor_test.cc",
|
"src/writer/wgsl/generator_impl_member_accessor_test.cc",
|
||||||
"src/writer/wgsl/generator_impl_return_test.cc",
|
"src/writer/wgsl/generator_impl_return_test.cc",
|
||||||
@ -1001,7 +996,6 @@ source_set("tint_unittests_msl_writer_src") {
|
|||||||
"src/writer/msl/generator_impl_identifier_test.cc",
|
"src/writer/msl/generator_impl_identifier_test.cc",
|
||||||
"src/writer/msl/generator_impl_if_test.cc",
|
"src/writer/msl/generator_impl_if_test.cc",
|
||||||
"src/writer/msl/generator_impl_import_test.cc",
|
"src/writer/msl/generator_impl_import_test.cc",
|
||||||
"src/writer/msl/generator_impl_kill_test.cc",
|
|
||||||
"src/writer/msl/generator_impl_loop_test.cc",
|
"src/writer/msl/generator_impl_loop_test.cc",
|
||||||
"src/writer/msl/generator_impl_member_accessor_test.cc",
|
"src/writer/msl/generator_impl_member_accessor_test.cc",
|
||||||
"src/writer/msl/generator_impl_module_constant_test.cc",
|
"src/writer/msl/generator_impl_module_constant_test.cc",
|
||||||
|
@ -94,8 +94,6 @@ set(TINT_LIB_SRCS
|
|||||||
ast/int_literal.h
|
ast/int_literal.h
|
||||||
ast/intrinsic.cc
|
ast/intrinsic.cc
|
||||||
ast/intrinsic.h
|
ast/intrinsic.h
|
||||||
ast/kill_statement.cc
|
|
||||||
ast/kill_statement.h
|
|
||||||
ast/literal.h
|
ast/literal.h
|
||||||
ast/literal.cc
|
ast/literal.cc
|
||||||
ast/location_decoration.cc
|
ast/location_decoration.cc
|
||||||
@ -300,7 +298,6 @@ set(TINT_TEST_SRCS
|
|||||||
ast/if_statement_test.cc
|
ast/if_statement_test.cc
|
||||||
ast/import_test.cc
|
ast/import_test.cc
|
||||||
ast/int_literal_test.cc
|
ast/int_literal_test.cc
|
||||||
ast/kill_statement_test.cc
|
|
||||||
ast/location_decoration_test.cc
|
ast/location_decoration_test.cc
|
||||||
ast/loop_statement_test.cc
|
ast/loop_statement_test.cc
|
||||||
ast/member_accessor_expression_test.cc
|
ast/member_accessor_expression_test.cc
|
||||||
@ -465,7 +462,6 @@ if(${TINT_BUILD_SPV_WRITER})
|
|||||||
writer/spirv/builder_ident_expression_test.cc
|
writer/spirv/builder_ident_expression_test.cc
|
||||||
writer/spirv/builder_if_test.cc
|
writer/spirv/builder_if_test.cc
|
||||||
writer/spirv/builder_intrinsic_test.cc
|
writer/spirv/builder_intrinsic_test.cc
|
||||||
writer/spirv/builder_kill_test.cc
|
|
||||||
writer/spirv/builder_literal_test.cc
|
writer/spirv/builder_literal_test.cc
|
||||||
writer/spirv/builder_loop_test.cc
|
writer/spirv/builder_loop_test.cc
|
||||||
writer/spirv/builder_return_test.cc
|
writer/spirv/builder_return_test.cc
|
||||||
@ -501,7 +497,6 @@ if(${TINT_BUILD_WGSL_WRITER})
|
|||||||
writer/wgsl/generator_impl_identifier_test.cc
|
writer/wgsl/generator_impl_identifier_test.cc
|
||||||
writer/wgsl/generator_impl_if_test.cc
|
writer/wgsl/generator_impl_if_test.cc
|
||||||
writer/wgsl/generator_impl_import_test.cc
|
writer/wgsl/generator_impl_import_test.cc
|
||||||
writer/wgsl/generator_impl_kill_test.cc
|
|
||||||
writer/wgsl/generator_impl_loop_test.cc
|
writer/wgsl/generator_impl_loop_test.cc
|
||||||
writer/wgsl/generator_impl_member_accessor_test.cc
|
writer/wgsl/generator_impl_member_accessor_test.cc
|
||||||
writer/wgsl/generator_impl_return_test.cc
|
writer/wgsl/generator_impl_return_test.cc
|
||||||
@ -532,7 +527,6 @@ if(${TINT_BUILD_MSL_WRITER})
|
|||||||
writer/msl/generator_impl_identifier_test.cc
|
writer/msl/generator_impl_identifier_test.cc
|
||||||
writer/msl/generator_impl_if_test.cc
|
writer/msl/generator_impl_if_test.cc
|
||||||
writer/msl/generator_impl_import_test.cc
|
writer/msl/generator_impl_import_test.cc
|
||||||
writer/msl/generator_impl_kill_test.cc
|
|
||||||
writer/msl/generator_impl_loop_test.cc
|
writer/msl/generator_impl_loop_test.cc
|
||||||
writer/msl/generator_impl_member_accessor_test.cc
|
writer/msl/generator_impl_member_accessor_test.cc
|
||||||
writer/msl/generator_impl_module_constant_test.cc
|
writer/msl/generator_impl_module_constant_test.cc
|
||||||
|
@ -15,8 +15,8 @@
|
|||||||
#include "src/ast/case_statement.h"
|
#include "src/ast/case_statement.h"
|
||||||
|
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
|
#include "src/ast/discard_statement.h"
|
||||||
#include "src/ast/if_statement.h"
|
#include "src/ast/if_statement.h"
|
||||||
#include "src/ast/kill_statement.h"
|
|
||||||
#include "src/ast/sint_literal.h"
|
#include "src/ast/sint_literal.h"
|
||||||
#include "src/ast/type/i32_type.h"
|
#include "src/ast/type/i32_type.h"
|
||||||
#include "src/ast/type/u32_type.h"
|
#include "src/ast/type/u32_type.h"
|
||||||
@ -35,16 +35,16 @@ TEST_F(CaseStatementTest, Creation_i32) {
|
|||||||
b.push_back(std::make_unique<SintLiteral>(&i32, 2));
|
b.push_back(std::make_unique<SintLiteral>(&i32, 2));
|
||||||
|
|
||||||
StatementList stmts;
|
StatementList stmts;
|
||||||
stmts.push_back(std::make_unique<KillStatement>());
|
stmts.push_back(std::make_unique<DiscardStatement>());
|
||||||
|
|
||||||
auto* int_ptr = b.back().get();
|
auto* int_ptr = b.back().get();
|
||||||
auto* kill_ptr = stmts[0].get();
|
auto* discard_ptr = stmts[0].get();
|
||||||
|
|
||||||
CaseStatement c(std::move(b), std::move(stmts));
|
CaseStatement c(std::move(b), std::move(stmts));
|
||||||
ASSERT_EQ(c.selectors().size(), 1u);
|
ASSERT_EQ(c.selectors().size(), 1u);
|
||||||
EXPECT_EQ(c.selectors()[0].get(), int_ptr);
|
EXPECT_EQ(c.selectors()[0].get(), int_ptr);
|
||||||
ASSERT_EQ(c.body().size(), 1u);
|
ASSERT_EQ(c.body().size(), 1u);
|
||||||
EXPECT_EQ(c.body()[0].get(), kill_ptr);
|
EXPECT_EQ(c.body()[0].get(), discard_ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(CaseStatementTest, Creation_u32) {
|
TEST_F(CaseStatementTest, Creation_u32) {
|
||||||
@ -54,16 +54,16 @@ TEST_F(CaseStatementTest, Creation_u32) {
|
|||||||
b.push_back(std::make_unique<UintLiteral>(&u32, 2));
|
b.push_back(std::make_unique<UintLiteral>(&u32, 2));
|
||||||
|
|
||||||
StatementList stmts;
|
StatementList stmts;
|
||||||
stmts.push_back(std::make_unique<KillStatement>());
|
stmts.push_back(std::make_unique<DiscardStatement>());
|
||||||
|
|
||||||
auto* int_ptr = b.back().get();
|
auto* int_ptr = b.back().get();
|
||||||
auto* kill_ptr = stmts[0].get();
|
auto* discard_ptr = stmts[0].get();
|
||||||
|
|
||||||
CaseStatement c(std::move(b), std::move(stmts));
|
CaseStatement c(std::move(b), std::move(stmts));
|
||||||
ASSERT_EQ(c.selectors().size(), 1u);
|
ASSERT_EQ(c.selectors().size(), 1u);
|
||||||
EXPECT_EQ(c.selectors()[0].get(), int_ptr);
|
EXPECT_EQ(c.selectors()[0].get(), int_ptr);
|
||||||
ASSERT_EQ(c.body().size(), 1u);
|
ASSERT_EQ(c.body().size(), 1u);
|
||||||
EXPECT_EQ(c.body()[0].get(), kill_ptr);
|
EXPECT_EQ(c.body()[0].get(), discard_ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(CaseStatementTest, Creation_WithSource) {
|
TEST_F(CaseStatementTest, Creation_WithSource) {
|
||||||
@ -72,7 +72,7 @@ TEST_F(CaseStatementTest, Creation_WithSource) {
|
|||||||
b.push_back(std::make_unique<SintLiteral>(&i32, 2));
|
b.push_back(std::make_unique<SintLiteral>(&i32, 2));
|
||||||
|
|
||||||
StatementList stmts;
|
StatementList stmts;
|
||||||
stmts.push_back(std::make_unique<KillStatement>());
|
stmts.push_back(std::make_unique<DiscardStatement>());
|
||||||
|
|
||||||
CaseStatement c(Source{20, 2}, std::move(b), std::move(stmts));
|
CaseStatement c(Source{20, 2}, std::move(b), std::move(stmts));
|
||||||
auto src = c.source();
|
auto src = c.source();
|
||||||
@ -82,7 +82,7 @@ TEST_F(CaseStatementTest, Creation_WithSource) {
|
|||||||
|
|
||||||
TEST_F(CaseStatementTest, IsDefault_WithoutSelectors) {
|
TEST_F(CaseStatementTest, IsDefault_WithoutSelectors) {
|
||||||
StatementList stmts;
|
StatementList stmts;
|
||||||
stmts.push_back(std::make_unique<KillStatement>());
|
stmts.push_back(std::make_unique<DiscardStatement>());
|
||||||
|
|
||||||
CaseStatement c;
|
CaseStatement c;
|
||||||
c.set_body(std::move(stmts));
|
c.set_body(std::move(stmts));
|
||||||
@ -115,7 +115,7 @@ TEST_F(CaseStatementTest, IsValid_NullBodyStatement) {
|
|||||||
b.push_back(std::make_unique<SintLiteral>(&i32, 2));
|
b.push_back(std::make_unique<SintLiteral>(&i32, 2));
|
||||||
|
|
||||||
StatementList stmts;
|
StatementList stmts;
|
||||||
stmts.push_back(std::make_unique<KillStatement>());
|
stmts.push_back(std::make_unique<DiscardStatement>());
|
||||||
stmts.push_back(nullptr);
|
stmts.push_back(nullptr);
|
||||||
|
|
||||||
CaseStatement c(std::move(b), std::move(stmts));
|
CaseStatement c(std::move(b), std::move(stmts));
|
||||||
@ -140,13 +140,13 @@ TEST_F(CaseStatementTest, ToStr_WithSelectors_i32) {
|
|||||||
b.push_back(std::make_unique<SintLiteral>(&i32, -2));
|
b.push_back(std::make_unique<SintLiteral>(&i32, -2));
|
||||||
|
|
||||||
StatementList stmts;
|
StatementList stmts;
|
||||||
stmts.push_back(std::make_unique<KillStatement>());
|
stmts.push_back(std::make_unique<DiscardStatement>());
|
||||||
CaseStatement c({std::move(b)}, std::move(stmts));
|
CaseStatement c({std::move(b)}, std::move(stmts));
|
||||||
|
|
||||||
std::ostringstream out;
|
std::ostringstream out;
|
||||||
c.to_str(out, 2);
|
c.to_str(out, 2);
|
||||||
EXPECT_EQ(out.str(), R"( Case -2{
|
EXPECT_EQ(out.str(), R"( Case -2{
|
||||||
Kill{}
|
Discard{}
|
||||||
}
|
}
|
||||||
)");
|
)");
|
||||||
}
|
}
|
||||||
@ -157,13 +157,13 @@ TEST_F(CaseStatementTest, ToStr_WithSelectors_u32) {
|
|||||||
b.push_back(std::make_unique<UintLiteral>(&u32, 2));
|
b.push_back(std::make_unique<UintLiteral>(&u32, 2));
|
||||||
|
|
||||||
StatementList stmts;
|
StatementList stmts;
|
||||||
stmts.push_back(std::make_unique<KillStatement>());
|
stmts.push_back(std::make_unique<DiscardStatement>());
|
||||||
CaseStatement c({std::move(b)}, std::move(stmts));
|
CaseStatement c({std::move(b)}, std::move(stmts));
|
||||||
|
|
||||||
std::ostringstream out;
|
std::ostringstream out;
|
||||||
c.to_str(out, 2);
|
c.to_str(out, 2);
|
||||||
EXPECT_EQ(out.str(), R"( Case 2{
|
EXPECT_EQ(out.str(), R"( Case 2{
|
||||||
Kill{}
|
Discard{}
|
||||||
}
|
}
|
||||||
)");
|
)");
|
||||||
}
|
}
|
||||||
@ -175,26 +175,26 @@ TEST_F(CaseStatementTest, ToStr_WithMultipleSelectors) {
|
|||||||
b.push_back(std::make_unique<SintLiteral>(&i32, 1));
|
b.push_back(std::make_unique<SintLiteral>(&i32, 1));
|
||||||
b.push_back(std::make_unique<SintLiteral>(&i32, 2));
|
b.push_back(std::make_unique<SintLiteral>(&i32, 2));
|
||||||
StatementList stmts;
|
StatementList stmts;
|
||||||
stmts.push_back(std::make_unique<KillStatement>());
|
stmts.push_back(std::make_unique<DiscardStatement>());
|
||||||
CaseStatement c(std::move(b), std::move(stmts));
|
CaseStatement c(std::move(b), std::move(stmts));
|
||||||
|
|
||||||
std::ostringstream out;
|
std::ostringstream out;
|
||||||
c.to_str(out, 2);
|
c.to_str(out, 2);
|
||||||
EXPECT_EQ(out.str(), R"( Case 1, 2{
|
EXPECT_EQ(out.str(), R"( Case 1, 2{
|
||||||
Kill{}
|
Discard{}
|
||||||
}
|
}
|
||||||
)");
|
)");
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(CaseStatementTest, ToStr_WithoutSelectors) {
|
TEST_F(CaseStatementTest, ToStr_WithoutSelectors) {
|
||||||
StatementList stmts;
|
StatementList stmts;
|
||||||
stmts.push_back(std::make_unique<KillStatement>());
|
stmts.push_back(std::make_unique<DiscardStatement>());
|
||||||
CaseStatement c(CaseSelectorList{}, std::move(stmts));
|
CaseStatement c(CaseSelectorList{}, std::move(stmts));
|
||||||
|
|
||||||
std::ostringstream out;
|
std::ostringstream out;
|
||||||
c.to_str(out, 2);
|
c.to_str(out, 2);
|
||||||
EXPECT_EQ(out.str(), R"( Default{
|
EXPECT_EQ(out.str(), R"( Default{
|
||||||
Kill{}
|
Discard{}
|
||||||
}
|
}
|
||||||
)");
|
)");
|
||||||
}
|
}
|
||||||
|
@ -16,8 +16,8 @@
|
|||||||
|
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
#include "src/ast/bool_literal.h"
|
#include "src/ast/bool_literal.h"
|
||||||
|
#include "src/ast/discard_statement.h"
|
||||||
#include "src/ast/if_statement.h"
|
#include "src/ast/if_statement.h"
|
||||||
#include "src/ast/kill_statement.h"
|
|
||||||
#include "src/ast/scalar_constructor_expression.h"
|
#include "src/ast/scalar_constructor_expression.h"
|
||||||
#include "src/ast/type/bool_type.h"
|
#include "src/ast/type/bool_type.h"
|
||||||
|
|
||||||
@ -32,15 +32,15 @@ TEST_F(ElseStatementTest, Creation) {
|
|||||||
auto cond = std::make_unique<ScalarConstructorExpression>(
|
auto cond = std::make_unique<ScalarConstructorExpression>(
|
||||||
std::make_unique<BoolLiteral>(&bool_type, true));
|
std::make_unique<BoolLiteral>(&bool_type, true));
|
||||||
StatementList body;
|
StatementList body;
|
||||||
body.push_back(std::make_unique<KillStatement>());
|
body.push_back(std::make_unique<DiscardStatement>());
|
||||||
|
|
||||||
auto* cond_ptr = cond.get();
|
auto* cond_ptr = cond.get();
|
||||||
auto* kill_ptr = body[0].get();
|
auto* discard_ptr = body[0].get();
|
||||||
|
|
||||||
ElseStatement e(std::move(cond), std::move(body));
|
ElseStatement e(std::move(cond), std::move(body));
|
||||||
EXPECT_EQ(e.condition(), cond_ptr);
|
EXPECT_EQ(e.condition(), cond_ptr);
|
||||||
ASSERT_EQ(e.body().size(), 1u);
|
ASSERT_EQ(e.body().size(), 1u);
|
||||||
EXPECT_EQ(e.body()[0].get(), kill_ptr);
|
EXPECT_EQ(e.body()[0].get(), discard_ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(ElseStatementTest, Creation_WithSource) {
|
TEST_F(ElseStatementTest, Creation_WithSource) {
|
||||||
@ -75,7 +75,7 @@ TEST_F(ElseStatementTest, IsValid) {
|
|||||||
|
|
||||||
TEST_F(ElseStatementTest, IsValid_WithBody) {
|
TEST_F(ElseStatementTest, IsValid_WithBody) {
|
||||||
StatementList body;
|
StatementList body;
|
||||||
body.push_back(std::make_unique<KillStatement>());
|
body.push_back(std::make_unique<DiscardStatement>());
|
||||||
|
|
||||||
ElseStatement e(std::move(body));
|
ElseStatement e(std::move(body));
|
||||||
EXPECT_TRUE(e.IsValid());
|
EXPECT_TRUE(e.IsValid());
|
||||||
@ -83,7 +83,7 @@ TEST_F(ElseStatementTest, IsValid_WithBody) {
|
|||||||
|
|
||||||
TEST_F(ElseStatementTest, IsValid_WithNullBodyStatement) {
|
TEST_F(ElseStatementTest, IsValid_WithNullBodyStatement) {
|
||||||
StatementList body;
|
StatementList body;
|
||||||
body.push_back(std::make_unique<KillStatement>());
|
body.push_back(std::make_unique<DiscardStatement>());
|
||||||
body.push_back(nullptr);
|
body.push_back(nullptr);
|
||||||
|
|
||||||
ElseStatement e(std::move(body));
|
ElseStatement e(std::move(body));
|
||||||
@ -109,7 +109,7 @@ TEST_F(ElseStatementTest, ToStr) {
|
|||||||
auto cond = std::make_unique<ScalarConstructorExpression>(
|
auto cond = std::make_unique<ScalarConstructorExpression>(
|
||||||
std::make_unique<BoolLiteral>(&bool_type, true));
|
std::make_unique<BoolLiteral>(&bool_type, true));
|
||||||
StatementList body;
|
StatementList body;
|
||||||
body.push_back(std::make_unique<KillStatement>());
|
body.push_back(std::make_unique<DiscardStatement>());
|
||||||
|
|
||||||
ElseStatement e(std::move(cond), std::move(body));
|
ElseStatement e(std::move(cond), std::move(body));
|
||||||
std::ostringstream out;
|
std::ostringstream out;
|
||||||
@ -119,7 +119,7 @@ TEST_F(ElseStatementTest, ToStr) {
|
|||||||
ScalarConstructor{true}
|
ScalarConstructor{true}
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
Kill{}
|
Discard{}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)");
|
)");
|
||||||
@ -127,14 +127,14 @@ TEST_F(ElseStatementTest, ToStr) {
|
|||||||
|
|
||||||
TEST_F(ElseStatementTest, ToStr_NoCondition) {
|
TEST_F(ElseStatementTest, ToStr_NoCondition) {
|
||||||
StatementList body;
|
StatementList body;
|
||||||
body.push_back(std::make_unique<KillStatement>());
|
body.push_back(std::make_unique<DiscardStatement>());
|
||||||
|
|
||||||
ElseStatement e(std::move(body));
|
ElseStatement e(std::move(body));
|
||||||
std::ostringstream out;
|
std::ostringstream out;
|
||||||
e.to_str(out, 2);
|
e.to_str(out, 2);
|
||||||
EXPECT_EQ(out.str(), R"( Else{
|
EXPECT_EQ(out.str(), R"( Else{
|
||||||
{
|
{
|
||||||
Kill{}
|
Discard{}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)");
|
)");
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
#include "src/ast/builtin_decoration.h"
|
#include "src/ast/builtin_decoration.h"
|
||||||
#include "src/ast/decorated_variable.h"
|
#include "src/ast/decorated_variable.h"
|
||||||
#include "src/ast/kill_statement.h"
|
#include "src/ast/discard_statement.h"
|
||||||
#include "src/ast/location_decoration.h"
|
#include "src/ast/location_decoration.h"
|
||||||
#include "src/ast/pipeline_stage.h"
|
#include "src/ast/pipeline_stage.h"
|
||||||
#include "src/ast/type/f32_type.h"
|
#include "src/ast/type/f32_type.h"
|
||||||
@ -189,7 +189,7 @@ TEST_F(FunctionTest, IsValid) {
|
|||||||
std::make_unique<Variable>("var", StorageClass::kNone, &i32));
|
std::make_unique<Variable>("var", StorageClass::kNone, &i32));
|
||||||
|
|
||||||
StatementList body;
|
StatementList body;
|
||||||
body.push_back(std::make_unique<KillStatement>());
|
body.push_back(std::make_unique<DiscardStatement>());
|
||||||
|
|
||||||
Function f("func", std::move(params), &void_type);
|
Function f("func", std::move(params), &void_type);
|
||||||
f.set_body(std::move(body));
|
f.set_body(std::move(body));
|
||||||
@ -252,7 +252,7 @@ TEST_F(FunctionTest, IsValid_NullBodyStatement) {
|
|||||||
std::make_unique<Variable>("var", StorageClass::kNone, &i32));
|
std::make_unique<Variable>("var", StorageClass::kNone, &i32));
|
||||||
|
|
||||||
StatementList body;
|
StatementList body;
|
||||||
body.push_back(std::make_unique<KillStatement>());
|
body.push_back(std::make_unique<DiscardStatement>());
|
||||||
body.push_back(nullptr);
|
body.push_back(nullptr);
|
||||||
|
|
||||||
Function f("func", std::move(params), &void_type);
|
Function f("func", std::move(params), &void_type);
|
||||||
@ -269,7 +269,7 @@ TEST_F(FunctionTest, IsValid_InvalidBodyStatement) {
|
|||||||
std::make_unique<Variable>("var", StorageClass::kNone, &i32));
|
std::make_unique<Variable>("var", StorageClass::kNone, &i32));
|
||||||
|
|
||||||
StatementList body;
|
StatementList body;
|
||||||
body.push_back(std::make_unique<KillStatement>());
|
body.push_back(std::make_unique<DiscardStatement>());
|
||||||
body.push_back(nullptr);
|
body.push_back(nullptr);
|
||||||
|
|
||||||
Function f("func", std::move(params), &void_type);
|
Function f("func", std::move(params), &void_type);
|
||||||
@ -282,7 +282,7 @@ TEST_F(FunctionTest, ToStr) {
|
|||||||
type::I32Type i32;
|
type::I32Type i32;
|
||||||
|
|
||||||
StatementList body;
|
StatementList body;
|
||||||
body.push_back(std::make_unique<KillStatement>());
|
body.push_back(std::make_unique<DiscardStatement>());
|
||||||
|
|
||||||
Function f("func", {}, &void_type);
|
Function f("func", {}, &void_type);
|
||||||
f.set_body(std::move(body));
|
f.set_body(std::move(body));
|
||||||
@ -292,7 +292,7 @@ TEST_F(FunctionTest, ToStr) {
|
|||||||
EXPECT_EQ(out.str(), R"( Function func -> __void
|
EXPECT_EQ(out.str(), R"( Function func -> __void
|
||||||
()
|
()
|
||||||
{
|
{
|
||||||
Kill{}
|
Discard{}
|
||||||
}
|
}
|
||||||
)");
|
)");
|
||||||
}
|
}
|
||||||
@ -306,7 +306,7 @@ TEST_F(FunctionTest, ToStr_WithParams) {
|
|||||||
std::make_unique<Variable>("var", StorageClass::kNone, &i32));
|
std::make_unique<Variable>("var", StorageClass::kNone, &i32));
|
||||||
|
|
||||||
StatementList body;
|
StatementList body;
|
||||||
body.push_back(std::make_unique<KillStatement>());
|
body.push_back(std::make_unique<DiscardStatement>());
|
||||||
|
|
||||||
Function f("func", std::move(params), &void_type);
|
Function f("func", std::move(params), &void_type);
|
||||||
f.set_body(std::move(body));
|
f.set_body(std::move(body));
|
||||||
@ -322,7 +322,7 @@ TEST_F(FunctionTest, ToStr_WithParams) {
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
Kill{}
|
Discard{}
|
||||||
}
|
}
|
||||||
)");
|
)");
|
||||||
}
|
}
|
||||||
|
@ -15,8 +15,8 @@
|
|||||||
#include "src/ast/if_statement.h"
|
#include "src/ast/if_statement.h"
|
||||||
|
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
|
#include "src/ast/discard_statement.h"
|
||||||
#include "src/ast/identifier_expression.h"
|
#include "src/ast/identifier_expression.h"
|
||||||
#include "src/ast/kill_statement.h"
|
|
||||||
|
|
||||||
namespace tint {
|
namespace tint {
|
||||||
namespace ast {
|
namespace ast {
|
||||||
@ -27,7 +27,7 @@ using IfStatementTest = testing::Test;
|
|||||||
TEST_F(IfStatementTest, Creation) {
|
TEST_F(IfStatementTest, Creation) {
|
||||||
auto cond = std::make_unique<IdentifierExpression>("cond");
|
auto cond = std::make_unique<IdentifierExpression>("cond");
|
||||||
StatementList body;
|
StatementList body;
|
||||||
body.push_back(std::make_unique<KillStatement>());
|
body.push_back(std::make_unique<DiscardStatement>());
|
||||||
|
|
||||||
auto* cond_ptr = cond.get();
|
auto* cond_ptr = cond.get();
|
||||||
auto* stmt_ptr = body[0].get();
|
auto* stmt_ptr = body[0].get();
|
||||||
@ -41,7 +41,7 @@ TEST_F(IfStatementTest, Creation) {
|
|||||||
TEST_F(IfStatementTest, Creation_WithSource) {
|
TEST_F(IfStatementTest, Creation_WithSource) {
|
||||||
auto cond = std::make_unique<IdentifierExpression>("cond");
|
auto cond = std::make_unique<IdentifierExpression>("cond");
|
||||||
StatementList body;
|
StatementList body;
|
||||||
body.push_back(std::make_unique<KillStatement>());
|
body.push_back(std::make_unique<DiscardStatement>());
|
||||||
|
|
||||||
IfStatement stmt(Source{20, 2}, std::move(cond), std::move(body));
|
IfStatement stmt(Source{20, 2}, std::move(cond), std::move(body));
|
||||||
auto src = stmt.source();
|
auto src = stmt.source();
|
||||||
@ -57,7 +57,7 @@ TEST_F(IfStatementTest, IsIf) {
|
|||||||
TEST_F(IfStatementTest, IsValid) {
|
TEST_F(IfStatementTest, IsValid) {
|
||||||
auto cond = std::make_unique<IdentifierExpression>("cond");
|
auto cond = std::make_unique<IdentifierExpression>("cond");
|
||||||
StatementList body;
|
StatementList body;
|
||||||
body.push_back(std::make_unique<KillStatement>());
|
body.push_back(std::make_unique<DiscardStatement>());
|
||||||
|
|
||||||
IfStatement stmt(std::move(cond), std::move(body));
|
IfStatement stmt(std::move(cond), std::move(body));
|
||||||
EXPECT_TRUE(stmt.IsValid());
|
EXPECT_TRUE(stmt.IsValid());
|
||||||
@ -66,7 +66,7 @@ TEST_F(IfStatementTest, IsValid) {
|
|||||||
TEST_F(IfStatementTest, IsValid_WithElseStatements) {
|
TEST_F(IfStatementTest, IsValid_WithElseStatements) {
|
||||||
auto cond = std::make_unique<IdentifierExpression>("cond");
|
auto cond = std::make_unique<IdentifierExpression>("cond");
|
||||||
StatementList body;
|
StatementList body;
|
||||||
body.push_back(std::make_unique<KillStatement>());
|
body.push_back(std::make_unique<DiscardStatement>());
|
||||||
|
|
||||||
ElseStatementList else_stmts;
|
ElseStatementList else_stmts;
|
||||||
else_stmts.push_back(std::make_unique<ElseStatement>());
|
else_stmts.push_back(std::make_unique<ElseStatement>());
|
||||||
@ -80,7 +80,7 @@ TEST_F(IfStatementTest, IsValid_WithElseStatements) {
|
|||||||
|
|
||||||
TEST_F(IfStatementTest, IsValid_MissingCondition) {
|
TEST_F(IfStatementTest, IsValid_MissingCondition) {
|
||||||
StatementList body;
|
StatementList body;
|
||||||
body.push_back(std::make_unique<KillStatement>());
|
body.push_back(std::make_unique<DiscardStatement>());
|
||||||
|
|
||||||
IfStatement stmt(nullptr, std::move(body));
|
IfStatement stmt(nullptr, std::move(body));
|
||||||
EXPECT_FALSE(stmt.IsValid());
|
EXPECT_FALSE(stmt.IsValid());
|
||||||
@ -89,7 +89,7 @@ TEST_F(IfStatementTest, IsValid_MissingCondition) {
|
|||||||
TEST_F(IfStatementTest, IsValid_InvalidCondition) {
|
TEST_F(IfStatementTest, IsValid_InvalidCondition) {
|
||||||
auto cond = std::make_unique<IdentifierExpression>("");
|
auto cond = std::make_unique<IdentifierExpression>("");
|
||||||
StatementList body;
|
StatementList body;
|
||||||
body.push_back(std::make_unique<KillStatement>());
|
body.push_back(std::make_unique<DiscardStatement>());
|
||||||
|
|
||||||
IfStatement stmt(std::move(cond), std::move(body));
|
IfStatement stmt(std::move(cond), std::move(body));
|
||||||
EXPECT_FALSE(stmt.IsValid());
|
EXPECT_FALSE(stmt.IsValid());
|
||||||
@ -98,7 +98,7 @@ TEST_F(IfStatementTest, IsValid_InvalidCondition) {
|
|||||||
TEST_F(IfStatementTest, IsValid_NullBodyStatement) {
|
TEST_F(IfStatementTest, IsValid_NullBodyStatement) {
|
||||||
auto cond = std::make_unique<IdentifierExpression>("cond");
|
auto cond = std::make_unique<IdentifierExpression>("cond");
|
||||||
StatementList body;
|
StatementList body;
|
||||||
body.push_back(std::make_unique<KillStatement>());
|
body.push_back(std::make_unique<DiscardStatement>());
|
||||||
body.push_back(nullptr);
|
body.push_back(nullptr);
|
||||||
|
|
||||||
IfStatement stmt(std::move(cond), std::move(body));
|
IfStatement stmt(std::move(cond), std::move(body));
|
||||||
@ -108,7 +108,7 @@ TEST_F(IfStatementTest, IsValid_NullBodyStatement) {
|
|||||||
TEST_F(IfStatementTest, IsValid_InvalidBodyStatement) {
|
TEST_F(IfStatementTest, IsValid_InvalidBodyStatement) {
|
||||||
auto cond = std::make_unique<IdentifierExpression>("cond");
|
auto cond = std::make_unique<IdentifierExpression>("cond");
|
||||||
StatementList body;
|
StatementList body;
|
||||||
body.push_back(std::make_unique<KillStatement>());
|
body.push_back(std::make_unique<DiscardStatement>());
|
||||||
body.push_back(std::make_unique<IfStatement>());
|
body.push_back(std::make_unique<IfStatement>());
|
||||||
|
|
||||||
IfStatement stmt(std::move(cond), std::move(body));
|
IfStatement stmt(std::move(cond), std::move(body));
|
||||||
@ -118,7 +118,7 @@ TEST_F(IfStatementTest, IsValid_InvalidBodyStatement) {
|
|||||||
TEST_F(IfStatementTest, IsValid_NullElseStatement) {
|
TEST_F(IfStatementTest, IsValid_NullElseStatement) {
|
||||||
auto cond = std::make_unique<IdentifierExpression>("cond");
|
auto cond = std::make_unique<IdentifierExpression>("cond");
|
||||||
StatementList body;
|
StatementList body;
|
||||||
body.push_back(std::make_unique<KillStatement>());
|
body.push_back(std::make_unique<DiscardStatement>());
|
||||||
|
|
||||||
ElseStatementList else_stmts;
|
ElseStatementList else_stmts;
|
||||||
else_stmts.push_back(std::make_unique<ElseStatement>());
|
else_stmts.push_back(std::make_unique<ElseStatement>());
|
||||||
@ -134,7 +134,7 @@ TEST_F(IfStatementTest, IsValid_NullElseStatement) {
|
|||||||
TEST_F(IfStatementTest, IsValid_InvalidElseStatement) {
|
TEST_F(IfStatementTest, IsValid_InvalidElseStatement) {
|
||||||
auto cond = std::make_unique<IdentifierExpression>("cond");
|
auto cond = std::make_unique<IdentifierExpression>("cond");
|
||||||
StatementList body;
|
StatementList body;
|
||||||
body.push_back(std::make_unique<KillStatement>());
|
body.push_back(std::make_unique<DiscardStatement>());
|
||||||
|
|
||||||
ElseStatementList else_stmts;
|
ElseStatementList else_stmts;
|
||||||
else_stmts.push_back(std::make_unique<ElseStatement>());
|
else_stmts.push_back(std::make_unique<ElseStatement>());
|
||||||
@ -148,7 +148,7 @@ TEST_F(IfStatementTest, IsValid_InvalidElseStatement) {
|
|||||||
TEST_F(IfStatementTest, IsValid_MultipleElseWiththoutCondition) {
|
TEST_F(IfStatementTest, IsValid_MultipleElseWiththoutCondition) {
|
||||||
auto cond = std::make_unique<IdentifierExpression>("cond");
|
auto cond = std::make_unique<IdentifierExpression>("cond");
|
||||||
StatementList body;
|
StatementList body;
|
||||||
body.push_back(std::make_unique<KillStatement>());
|
body.push_back(std::make_unique<DiscardStatement>());
|
||||||
|
|
||||||
ElseStatementList else_stmts;
|
ElseStatementList else_stmts;
|
||||||
else_stmts.push_back(std::make_unique<ElseStatement>());
|
else_stmts.push_back(std::make_unique<ElseStatement>());
|
||||||
@ -162,7 +162,7 @@ TEST_F(IfStatementTest, IsValid_MultipleElseWiththoutCondition) {
|
|||||||
TEST_F(IfStatementTest, IsValid_ElseNotLast) {
|
TEST_F(IfStatementTest, IsValid_ElseNotLast) {
|
||||||
auto cond = std::make_unique<IdentifierExpression>("cond");
|
auto cond = std::make_unique<IdentifierExpression>("cond");
|
||||||
StatementList body;
|
StatementList body;
|
||||||
body.push_back(std::make_unique<KillStatement>());
|
body.push_back(std::make_unique<DiscardStatement>());
|
||||||
|
|
||||||
ElseStatementList else_stmts;
|
ElseStatementList else_stmts;
|
||||||
else_stmts.push_back(std::make_unique<ElseStatement>());
|
else_stmts.push_back(std::make_unique<ElseStatement>());
|
||||||
@ -177,7 +177,7 @@ TEST_F(IfStatementTest, IsValid_ElseNotLast) {
|
|||||||
TEST_F(IfStatementTest, ToStr) {
|
TEST_F(IfStatementTest, ToStr) {
|
||||||
auto cond = std::make_unique<IdentifierExpression>("cond");
|
auto cond = std::make_unique<IdentifierExpression>("cond");
|
||||||
StatementList body;
|
StatementList body;
|
||||||
body.push_back(std::make_unique<KillStatement>());
|
body.push_back(std::make_unique<DiscardStatement>());
|
||||||
|
|
||||||
IfStatement stmt(std::move(cond), std::move(body));
|
IfStatement stmt(std::move(cond), std::move(body));
|
||||||
|
|
||||||
@ -188,7 +188,7 @@ TEST_F(IfStatementTest, ToStr) {
|
|||||||
Identifier{cond}
|
Identifier{cond}
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
Kill{}
|
Discard{}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)");
|
)");
|
||||||
@ -197,14 +197,14 @@ TEST_F(IfStatementTest, ToStr) {
|
|||||||
TEST_F(IfStatementTest, ToStr_WithElseStatements) {
|
TEST_F(IfStatementTest, ToStr_WithElseStatements) {
|
||||||
auto cond = std::make_unique<IdentifierExpression>("cond");
|
auto cond = std::make_unique<IdentifierExpression>("cond");
|
||||||
StatementList body;
|
StatementList body;
|
||||||
body.push_back(std::make_unique<KillStatement>());
|
body.push_back(std::make_unique<DiscardStatement>());
|
||||||
|
|
||||||
StatementList else_if_body;
|
StatementList else_if_body;
|
||||||
else_if_body.push_back(std::make_unique<KillStatement>());
|
else_if_body.push_back(std::make_unique<DiscardStatement>());
|
||||||
|
|
||||||
StatementList else_body;
|
StatementList else_body;
|
||||||
else_body.push_back(std::make_unique<KillStatement>());
|
else_body.push_back(std::make_unique<DiscardStatement>());
|
||||||
else_body.push_back(std::make_unique<KillStatement>());
|
else_body.push_back(std::make_unique<DiscardStatement>());
|
||||||
|
|
||||||
ElseStatementList else_stmts;
|
ElseStatementList else_stmts;
|
||||||
else_stmts.push_back(std::make_unique<ElseStatement>());
|
else_stmts.push_back(std::make_unique<ElseStatement>());
|
||||||
@ -223,7 +223,7 @@ TEST_F(IfStatementTest, ToStr_WithElseStatements) {
|
|||||||
Identifier{cond}
|
Identifier{cond}
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
Kill{}
|
Discard{}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Else{
|
Else{
|
||||||
@ -231,13 +231,13 @@ TEST_F(IfStatementTest, ToStr_WithElseStatements) {
|
|||||||
Identifier{ident}
|
Identifier{ident}
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
Kill{}
|
Discard{}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Else{
|
Else{
|
||||||
{
|
{
|
||||||
Kill{}
|
Discard{}
|
||||||
Kill{}
|
Discard{}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)");
|
)");
|
||||||
|
@ -1,40 +0,0 @@
|
|||||||
// Copyright 2020 The Tint Authors.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
#include "src/ast/kill_statement.h"
|
|
||||||
|
|
||||||
namespace tint {
|
|
||||||
namespace ast {
|
|
||||||
|
|
||||||
KillStatement::KillStatement() : Statement() {}
|
|
||||||
|
|
||||||
KillStatement::KillStatement(const Source& source) : Statement(source) {}
|
|
||||||
|
|
||||||
KillStatement::~KillStatement() = default;
|
|
||||||
|
|
||||||
bool KillStatement::IsKill() const {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool KillStatement::IsValid() const {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void KillStatement::to_str(std::ostream& out, size_t indent) const {
|
|
||||||
make_indent(out, indent);
|
|
||||||
out << "Kill{}" << std::endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace ast
|
|
||||||
} // namespace tint
|
|
@ -1,53 +0,0 @@
|
|||||||
// Copyright 2020 The Tint Authors.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
#ifndef SRC_AST_KILL_STATEMENT_H_
|
|
||||||
#define SRC_AST_KILL_STATEMENT_H_
|
|
||||||
|
|
||||||
#include "src/ast/statement.h"
|
|
||||||
|
|
||||||
namespace tint {
|
|
||||||
namespace ast {
|
|
||||||
|
|
||||||
/// A kill statement
|
|
||||||
class KillStatement : public Statement {
|
|
||||||
public:
|
|
||||||
/// Constructor
|
|
||||||
KillStatement();
|
|
||||||
/// Constructor
|
|
||||||
/// @param source the kill statement source
|
|
||||||
explicit KillStatement(const Source& source);
|
|
||||||
/// Move constructor
|
|
||||||
KillStatement(KillStatement&&) = default;
|
|
||||||
~KillStatement() override;
|
|
||||||
|
|
||||||
/// @returns true if this is a kill statement
|
|
||||||
bool IsKill() const override;
|
|
||||||
|
|
||||||
/// @returns true if the node is valid
|
|
||||||
bool IsValid() const override;
|
|
||||||
|
|
||||||
/// Writes a representation of the node to the output stream
|
|
||||||
/// @param out the stream to write to
|
|
||||||
/// @param indent number of spaces to indent the node when writing
|
|
||||||
void to_str(std::ostream& out, size_t indent) const override;
|
|
||||||
|
|
||||||
private:
|
|
||||||
KillStatement(const KillStatement&) = delete;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace ast
|
|
||||||
} // namespace tint
|
|
||||||
|
|
||||||
#endif // SRC_AST_KILL_STATEMENT_H_
|
|
@ -1,59 +0,0 @@
|
|||||||
// Copyright 2020 The Tint Authors.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
#include "src/ast/kill_statement.h"
|
|
||||||
|
|
||||||
#include <sstream>
|
|
||||||
|
|
||||||
#include "gtest/gtest.h"
|
|
||||||
|
|
||||||
namespace tint {
|
|
||||||
namespace ast {
|
|
||||||
namespace {
|
|
||||||
|
|
||||||
using KillStatementTest = testing::Test;
|
|
||||||
|
|
||||||
TEST_F(KillStatementTest, Creation) {
|
|
||||||
KillStatement k;
|
|
||||||
EXPECT_EQ(k.line(), 0u);
|
|
||||||
EXPECT_EQ(k.column(), 0u);
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(KillStatementTest, Creation_WithSource) {
|
|
||||||
KillStatement k(Source{20, 2});
|
|
||||||
EXPECT_EQ(k.line(), 20u);
|
|
||||||
EXPECT_EQ(k.column(), 2u);
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(KillStatementTest, IsKill) {
|
|
||||||
KillStatement k;
|
|
||||||
EXPECT_TRUE(k.IsKill());
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(KillStatementTest, IsValid) {
|
|
||||||
KillStatement k;
|
|
||||||
EXPECT_TRUE(k.IsValid());
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(KillStatementTest, ToStr) {
|
|
||||||
KillStatement k;
|
|
||||||
std::ostringstream out;
|
|
||||||
k.to_str(out, 2);
|
|
||||||
EXPECT_EQ(out.str(), R"( Kill{}
|
|
||||||
)");
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace
|
|
||||||
} // namespace ast
|
|
||||||
} // namespace tint
|
|
@ -18,8 +18,8 @@
|
|||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
|
#include "src/ast/discard_statement.h"
|
||||||
#include "src/ast/if_statement.h"
|
#include "src/ast/if_statement.h"
|
||||||
#include "src/ast/kill_statement.h"
|
|
||||||
|
|
||||||
namespace tint {
|
namespace tint {
|
||||||
namespace ast {
|
namespace ast {
|
||||||
@ -29,11 +29,11 @@ using LoopStatementTest = testing::Test;
|
|||||||
|
|
||||||
TEST_F(LoopStatementTest, Creation) {
|
TEST_F(LoopStatementTest, Creation) {
|
||||||
StatementList body;
|
StatementList body;
|
||||||
body.push_back(std::make_unique<KillStatement>());
|
body.push_back(std::make_unique<DiscardStatement>());
|
||||||
auto* b_ptr = body[0].get();
|
auto* b_ptr = body[0].get();
|
||||||
|
|
||||||
StatementList continuing;
|
StatementList continuing;
|
||||||
continuing.push_back(std::make_unique<KillStatement>());
|
continuing.push_back(std::make_unique<DiscardStatement>());
|
||||||
auto* c_ptr = continuing[0].get();
|
auto* c_ptr = continuing[0].get();
|
||||||
|
|
||||||
LoopStatement l(std::move(body), std::move(continuing));
|
LoopStatement l(std::move(body), std::move(continuing));
|
||||||
@ -45,10 +45,10 @@ TEST_F(LoopStatementTest, Creation) {
|
|||||||
|
|
||||||
TEST_F(LoopStatementTest, Creation_WithSource) {
|
TEST_F(LoopStatementTest, Creation_WithSource) {
|
||||||
StatementList body;
|
StatementList body;
|
||||||
body.push_back(std::make_unique<KillStatement>());
|
body.push_back(std::make_unique<DiscardStatement>());
|
||||||
|
|
||||||
StatementList continuing;
|
StatementList continuing;
|
||||||
continuing.push_back(std::make_unique<KillStatement>());
|
continuing.push_back(std::make_unique<DiscardStatement>());
|
||||||
|
|
||||||
LoopStatement l(Source{20, 2}, std::move(body), std::move(continuing));
|
LoopStatement l(Source{20, 2}, std::move(body), std::move(continuing));
|
||||||
auto src = l.source();
|
auto src = l.source();
|
||||||
@ -63,7 +63,7 @@ TEST_F(LoopStatementTest, IsLoop) {
|
|||||||
|
|
||||||
TEST_F(LoopStatementTest, HasContinuing_WithoutContinuing) {
|
TEST_F(LoopStatementTest, HasContinuing_WithoutContinuing) {
|
||||||
StatementList body;
|
StatementList body;
|
||||||
body.push_back(std::make_unique<KillStatement>());
|
body.push_back(std::make_unique<DiscardStatement>());
|
||||||
|
|
||||||
LoopStatement l(std::move(body), {});
|
LoopStatement l(std::move(body), {});
|
||||||
EXPECT_FALSE(l.has_continuing());
|
EXPECT_FALSE(l.has_continuing());
|
||||||
@ -71,10 +71,10 @@ TEST_F(LoopStatementTest, HasContinuing_WithoutContinuing) {
|
|||||||
|
|
||||||
TEST_F(LoopStatementTest, HasContinuing_WithContinuing) {
|
TEST_F(LoopStatementTest, HasContinuing_WithContinuing) {
|
||||||
StatementList body;
|
StatementList body;
|
||||||
body.push_back(std::make_unique<KillStatement>());
|
body.push_back(std::make_unique<DiscardStatement>());
|
||||||
|
|
||||||
StatementList continuing;
|
StatementList continuing;
|
||||||
continuing.push_back(std::make_unique<KillStatement>());
|
continuing.push_back(std::make_unique<DiscardStatement>());
|
||||||
|
|
||||||
LoopStatement l(std::move(body), std::move(continuing));
|
LoopStatement l(std::move(body), std::move(continuing));
|
||||||
EXPECT_TRUE(l.has_continuing());
|
EXPECT_TRUE(l.has_continuing());
|
||||||
@ -82,10 +82,10 @@ TEST_F(LoopStatementTest, HasContinuing_WithContinuing) {
|
|||||||
|
|
||||||
TEST_F(LoopStatementTest, IsValid) {
|
TEST_F(LoopStatementTest, IsValid) {
|
||||||
StatementList body;
|
StatementList body;
|
||||||
body.push_back(std::make_unique<KillStatement>());
|
body.push_back(std::make_unique<DiscardStatement>());
|
||||||
|
|
||||||
StatementList continuing;
|
StatementList continuing;
|
||||||
continuing.push_back(std::make_unique<KillStatement>());
|
continuing.push_back(std::make_unique<DiscardStatement>());
|
||||||
|
|
||||||
LoopStatement l(std::move(body), std::move(continuing));
|
LoopStatement l(std::move(body), std::move(continuing));
|
||||||
EXPECT_TRUE(l.IsValid());
|
EXPECT_TRUE(l.IsValid());
|
||||||
@ -93,7 +93,7 @@ TEST_F(LoopStatementTest, IsValid) {
|
|||||||
|
|
||||||
TEST_F(LoopStatementTest, IsValid_WithoutContinuing) {
|
TEST_F(LoopStatementTest, IsValid_WithoutContinuing) {
|
||||||
StatementList body;
|
StatementList body;
|
||||||
body.push_back(std::make_unique<KillStatement>());
|
body.push_back(std::make_unique<DiscardStatement>());
|
||||||
|
|
||||||
LoopStatement l(std::move(body), {});
|
LoopStatement l(std::move(body), {});
|
||||||
EXPECT_TRUE(l.IsValid());
|
EXPECT_TRUE(l.IsValid());
|
||||||
@ -106,11 +106,11 @@ TEST_F(LoopStatementTest, IsValid_WithoutBody) {
|
|||||||
|
|
||||||
TEST_F(LoopStatementTest, IsValid_NullBodyStatement) {
|
TEST_F(LoopStatementTest, IsValid_NullBodyStatement) {
|
||||||
StatementList body;
|
StatementList body;
|
||||||
body.push_back(std::make_unique<KillStatement>());
|
body.push_back(std::make_unique<DiscardStatement>());
|
||||||
body.push_back(nullptr);
|
body.push_back(nullptr);
|
||||||
|
|
||||||
StatementList continuing;
|
StatementList continuing;
|
||||||
continuing.push_back(std::make_unique<KillStatement>());
|
continuing.push_back(std::make_unique<DiscardStatement>());
|
||||||
|
|
||||||
LoopStatement l(std::move(body), std::move(continuing));
|
LoopStatement l(std::move(body), std::move(continuing));
|
||||||
EXPECT_FALSE(l.IsValid());
|
EXPECT_FALSE(l.IsValid());
|
||||||
@ -118,11 +118,11 @@ TEST_F(LoopStatementTest, IsValid_NullBodyStatement) {
|
|||||||
|
|
||||||
TEST_F(LoopStatementTest, IsValid_InvalidBodyStatement) {
|
TEST_F(LoopStatementTest, IsValid_InvalidBodyStatement) {
|
||||||
StatementList body;
|
StatementList body;
|
||||||
body.push_back(std::make_unique<KillStatement>());
|
body.push_back(std::make_unique<DiscardStatement>());
|
||||||
body.push_back(std::make_unique<IfStatement>());
|
body.push_back(std::make_unique<IfStatement>());
|
||||||
|
|
||||||
StatementList continuing;
|
StatementList continuing;
|
||||||
continuing.push_back(std::make_unique<KillStatement>());
|
continuing.push_back(std::make_unique<DiscardStatement>());
|
||||||
|
|
||||||
LoopStatement l(std::move(body), std::move(continuing));
|
LoopStatement l(std::move(body), std::move(continuing));
|
||||||
EXPECT_FALSE(l.IsValid());
|
EXPECT_FALSE(l.IsValid());
|
||||||
@ -130,10 +130,10 @@ TEST_F(LoopStatementTest, IsValid_InvalidBodyStatement) {
|
|||||||
|
|
||||||
TEST_F(LoopStatementTest, IsValid_NullContinuingStatement) {
|
TEST_F(LoopStatementTest, IsValid_NullContinuingStatement) {
|
||||||
StatementList body;
|
StatementList body;
|
||||||
body.push_back(std::make_unique<KillStatement>());
|
body.push_back(std::make_unique<DiscardStatement>());
|
||||||
|
|
||||||
StatementList continuing;
|
StatementList continuing;
|
||||||
continuing.push_back(std::make_unique<KillStatement>());
|
continuing.push_back(std::make_unique<DiscardStatement>());
|
||||||
continuing.push_back(nullptr);
|
continuing.push_back(nullptr);
|
||||||
|
|
||||||
LoopStatement l(std::move(body), std::move(continuing));
|
LoopStatement l(std::move(body), std::move(continuing));
|
||||||
@ -142,10 +142,10 @@ TEST_F(LoopStatementTest, IsValid_NullContinuingStatement) {
|
|||||||
|
|
||||||
TEST_F(LoopStatementTest, IsValid_InvalidContinuingStatement) {
|
TEST_F(LoopStatementTest, IsValid_InvalidContinuingStatement) {
|
||||||
StatementList body;
|
StatementList body;
|
||||||
body.push_back(std::make_unique<KillStatement>());
|
body.push_back(std::make_unique<DiscardStatement>());
|
||||||
|
|
||||||
StatementList continuing;
|
StatementList continuing;
|
||||||
continuing.push_back(std::make_unique<KillStatement>());
|
continuing.push_back(std::make_unique<DiscardStatement>());
|
||||||
continuing.push_back(std::make_unique<IfStatement>());
|
continuing.push_back(std::make_unique<IfStatement>());
|
||||||
|
|
||||||
LoopStatement l(std::move(body), std::move(continuing));
|
LoopStatement l(std::move(body), std::move(continuing));
|
||||||
@ -154,31 +154,31 @@ TEST_F(LoopStatementTest, IsValid_InvalidContinuingStatement) {
|
|||||||
|
|
||||||
TEST_F(LoopStatementTest, ToStr) {
|
TEST_F(LoopStatementTest, ToStr) {
|
||||||
StatementList body;
|
StatementList body;
|
||||||
body.push_back(std::make_unique<KillStatement>());
|
body.push_back(std::make_unique<DiscardStatement>());
|
||||||
|
|
||||||
LoopStatement l(std::move(body), {});
|
LoopStatement l(std::move(body), {});
|
||||||
std::ostringstream out;
|
std::ostringstream out;
|
||||||
l.to_str(out, 2);
|
l.to_str(out, 2);
|
||||||
EXPECT_EQ(out.str(), R"( Loop{
|
EXPECT_EQ(out.str(), R"( Loop{
|
||||||
Kill{}
|
Discard{}
|
||||||
}
|
}
|
||||||
)");
|
)");
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(LoopStatementTest, ToStr_WithContinuing) {
|
TEST_F(LoopStatementTest, ToStr_WithContinuing) {
|
||||||
StatementList body;
|
StatementList body;
|
||||||
body.push_back(std::make_unique<KillStatement>());
|
body.push_back(std::make_unique<DiscardStatement>());
|
||||||
|
|
||||||
StatementList continuing;
|
StatementList continuing;
|
||||||
continuing.push_back(std::make_unique<KillStatement>());
|
continuing.push_back(std::make_unique<DiscardStatement>());
|
||||||
|
|
||||||
LoopStatement l(std::move(body), std::move(continuing));
|
LoopStatement l(std::move(body), std::move(continuing));
|
||||||
std::ostringstream out;
|
std::ostringstream out;
|
||||||
l.to_str(out, 2);
|
l.to_str(out, 2);
|
||||||
EXPECT_EQ(out.str(), R"( Loop{
|
EXPECT_EQ(out.str(), R"( Loop{
|
||||||
Kill{}
|
Discard{}
|
||||||
continuing {
|
continuing {
|
||||||
Kill{}
|
Discard{}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)");
|
)");
|
||||||
|
@ -25,7 +25,6 @@
|
|||||||
#include "src/ast/else_statement.h"
|
#include "src/ast/else_statement.h"
|
||||||
#include "src/ast/fallthrough_statement.h"
|
#include "src/ast/fallthrough_statement.h"
|
||||||
#include "src/ast/if_statement.h"
|
#include "src/ast/if_statement.h"
|
||||||
#include "src/ast/kill_statement.h"
|
|
||||||
#include "src/ast/loop_statement.h"
|
#include "src/ast/loop_statement.h"
|
||||||
#include "src/ast/return_statement.h"
|
#include "src/ast/return_statement.h"
|
||||||
#include "src/ast/switch_statement.h"
|
#include "src/ast/switch_statement.h"
|
||||||
@ -78,10 +77,6 @@ bool Statement::IsIf() const {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Statement::IsKill() const {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Statement::IsLoop() const {
|
bool Statement::IsLoop() const {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -143,11 +138,6 @@ const IfStatement* Statement::AsIf() const {
|
|||||||
return static_cast<const IfStatement*>(this);
|
return static_cast<const IfStatement*>(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
const KillStatement* Statement::AsKill() const {
|
|
||||||
assert(IsKill());
|
|
||||||
return static_cast<const KillStatement*>(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
const LoopStatement* Statement::AsLoop() const {
|
const LoopStatement* Statement::AsLoop() const {
|
||||||
assert(IsLoop());
|
assert(IsLoop());
|
||||||
return static_cast<const LoopStatement*>(this);
|
return static_cast<const LoopStatement*>(this);
|
||||||
@ -213,11 +203,6 @@ IfStatement* Statement::AsIf() {
|
|||||||
return static_cast<IfStatement*>(this);
|
return static_cast<IfStatement*>(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
KillStatement* Statement::AsKill() {
|
|
||||||
assert(IsKill());
|
|
||||||
return static_cast<KillStatement*>(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
LoopStatement* Statement::AsLoop() {
|
LoopStatement* Statement::AsLoop() {
|
||||||
assert(IsLoop());
|
assert(IsLoop());
|
||||||
return static_cast<LoopStatement*>(this);
|
return static_cast<LoopStatement*>(this);
|
||||||
|
@ -32,7 +32,6 @@ class DiscardStatement;
|
|||||||
class ElseStatement;
|
class ElseStatement;
|
||||||
class FallthroughStatement;
|
class FallthroughStatement;
|
||||||
class IfStatement;
|
class IfStatement;
|
||||||
class KillStatement;
|
|
||||||
class LoopStatement;
|
class LoopStatement;
|
||||||
class ReturnStatement;
|
class ReturnStatement;
|
||||||
class SwitchStatement;
|
class SwitchStatement;
|
||||||
@ -61,8 +60,6 @@ class Statement : public Node {
|
|||||||
virtual bool IsFallthrough() const;
|
virtual bool IsFallthrough() const;
|
||||||
/// @returns true if this is an if statement
|
/// @returns true if this is an if statement
|
||||||
virtual bool IsIf() const;
|
virtual bool IsIf() const;
|
||||||
/// @returns true if this is a kill statement
|
|
||||||
virtual bool IsKill() const;
|
|
||||||
/// @returns true if this is a loop statement
|
/// @returns true if this is a loop statement
|
||||||
virtual bool IsLoop() const;
|
virtual bool IsLoop() const;
|
||||||
/// @returns true if this is a return statement
|
/// @returns true if this is a return statement
|
||||||
@ -90,8 +87,6 @@ class Statement : public Node {
|
|||||||
const FallthroughStatement* AsFallthrough() const;
|
const FallthroughStatement* AsFallthrough() const;
|
||||||
/// @returns the statement as a const if statement
|
/// @returns the statement as a const if statement
|
||||||
const IfStatement* AsIf() const;
|
const IfStatement* AsIf() const;
|
||||||
/// @returns the statement as a const kill statement
|
|
||||||
const KillStatement* AsKill() const;
|
|
||||||
/// @returns the statement as a const loop statement
|
/// @returns the statement as a const loop statement
|
||||||
const LoopStatement* AsLoop() const;
|
const LoopStatement* AsLoop() const;
|
||||||
/// @returns the statement as a const return statement
|
/// @returns the statement as a const return statement
|
||||||
@ -119,8 +114,6 @@ class Statement : public Node {
|
|||||||
FallthroughStatement* AsFallthrough();
|
FallthroughStatement* AsFallthrough();
|
||||||
/// @returns the statement as a if statement
|
/// @returns the statement as a if statement
|
||||||
IfStatement* AsIf();
|
IfStatement* AsIf();
|
||||||
/// @returns the statement as a kill statement
|
|
||||||
KillStatement* AsKill();
|
|
||||||
/// @returns the statement as a loop statement
|
/// @returns the statement as a loop statement
|
||||||
LoopStatement* AsLoop();
|
LoopStatement* AsLoop();
|
||||||
/// @returns the statement as a return statement
|
/// @returns the statement as a return statement
|
||||||
|
@ -2192,7 +2192,7 @@ bool FunctionEmitter::EmitNormalTerminator(const BlockInfo& block_info) {
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
case SpvOpKill:
|
case SpvOpKill:
|
||||||
// For now, assume SPIR-V OpKill has same semantics as WGSL kill.
|
// For now, assume SPIR-V OpKill has same semantics as WGSL discard.
|
||||||
// TODO(dneto): https://github.com/gpuweb/gpuweb/issues/676
|
// TODO(dneto): https://github.com/gpuweb/gpuweb/issues/676
|
||||||
AddStatement(std::make_unique<ast::DiscardStatement>());
|
AddStatement(std::make_unique<ast::DiscardStatement>());
|
||||||
return true;
|
return true;
|
||||||
|
@ -527,8 +527,6 @@ Token Lexer::check_keyword(const Source& source, const std::string& str) {
|
|||||||
return {Token::Type::kImport, source, "import"};
|
return {Token::Type::kImport, source, "import"};
|
||||||
if (str == "in")
|
if (str == "in")
|
||||||
return {Token::Type::kIn, source, "in"};
|
return {Token::Type::kIn, source, "in"};
|
||||||
if (str == "kill")
|
|
||||||
return {Token::Type::kKill, source, "kill"};
|
|
||||||
if (str == "location")
|
if (str == "location")
|
||||||
return {Token::Type::kLocation, source, "location"};
|
return {Token::Type::kLocation, source, "location"};
|
||||||
if (str == "loop")
|
if (str == "loop")
|
||||||
|
@ -440,7 +440,6 @@ INSTANTIATE_TEST_SUITE_P(
|
|||||||
TokenData{"image", Token::Type::kImage},
|
TokenData{"image", Token::Type::kImage},
|
||||||
TokenData{"import", Token::Type::kImport},
|
TokenData{"import", Token::Type::kImport},
|
||||||
TokenData{"in", Token::Type::kIn},
|
TokenData{"in", Token::Type::kIn},
|
||||||
TokenData{"kill", Token::Type::kKill},
|
|
||||||
TokenData{"location", Token::Type::kLocation},
|
TokenData{"location", Token::Type::kLocation},
|
||||||
TokenData{"loop", Token::Type::kLoop},
|
TokenData{"loop", Token::Type::kLoop},
|
||||||
TokenData{"mat2x2", Token::Type::kMat2x2},
|
TokenData{"mat2x2", Token::Type::kMat2x2},
|
||||||
|
@ -35,7 +35,6 @@
|
|||||||
#include "src/ast/float_literal.h"
|
#include "src/ast/float_literal.h"
|
||||||
#include "src/ast/identifier_expression.h"
|
#include "src/ast/identifier_expression.h"
|
||||||
#include "src/ast/if_statement.h"
|
#include "src/ast/if_statement.h"
|
||||||
#include "src/ast/kill_statement.h"
|
|
||||||
#include "src/ast/location_decoration.h"
|
#include "src/ast/location_decoration.h"
|
||||||
#include "src/ast/member_accessor_expression.h"
|
#include "src/ast/member_accessor_expression.h"
|
||||||
#include "src/ast/return_statement.h"
|
#include "src/ast/return_statement.h"
|
||||||
@ -1428,7 +1427,6 @@ ast::StatementList ParserImpl::statements() {
|
|||||||
// | break_stmt SEMICOLON
|
// | break_stmt SEMICOLON
|
||||||
// | continue_stmt SEMICOLON
|
// | continue_stmt SEMICOLON
|
||||||
// | DISCARD SEMICOLON
|
// | DISCARD SEMICOLON
|
||||||
// | KILL SEMICOLON
|
|
||||||
// | assignment_stmt SEMICOLON
|
// | assignment_stmt SEMICOLON
|
||||||
std::unique_ptr<ast::Statement> ParserImpl::statement() {
|
std::unique_ptr<ast::Statement> ParserImpl::statement() {
|
||||||
auto t = peek();
|
auto t = peek();
|
||||||
@ -1527,18 +1525,6 @@ std::unique_ptr<ast::Statement> ParserImpl::statement() {
|
|||||||
return std::make_unique<ast::DiscardStatement>(source);
|
return std::make_unique<ast::DiscardStatement>(source);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (t.IsKill()) {
|
|
||||||
auto source = t.source();
|
|
||||||
next(); // Consume the peek
|
|
||||||
|
|
||||||
t = next();
|
|
||||||
if (!t.IsSemicolon()) {
|
|
||||||
set_error(t, "missing ;");
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
return std::make_unique<ast::KillStatement>(source);
|
|
||||||
}
|
|
||||||
|
|
||||||
auto assign = assignment_stmt();
|
auto assign = assignment_stmt();
|
||||||
if (has_error())
|
if (has_error())
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -23,13 +23,13 @@ namespace {
|
|||||||
|
|
||||||
TEST_F(ParserImplTest, BodyStmt) {
|
TEST_F(ParserImplTest, BodyStmt) {
|
||||||
auto* p = parser(R"({
|
auto* p = parser(R"({
|
||||||
kill;
|
discard;
|
||||||
return 1 + b / 2;
|
return 1 + b / 2;
|
||||||
})");
|
})");
|
||||||
auto e = p->body_stmt();
|
auto e = p->body_stmt();
|
||||||
ASSERT_FALSE(p->has_error()) << p->error();
|
ASSERT_FALSE(p->has_error()) << p->error();
|
||||||
ASSERT_EQ(e.size(), 2u);
|
ASSERT_EQ(e.size(), 2u);
|
||||||
EXPECT_TRUE(e[0]->IsKill());
|
EXPECT_TRUE(e[0]->IsDiscard());
|
||||||
EXPECT_TRUE(e[1]->IsReturn());
|
EXPECT_TRUE(e[1]->IsReturn());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,19 +22,19 @@ namespace wgsl {
|
|||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
TEST_F(ParserImplTest, ContinuingStmt) {
|
TEST_F(ParserImplTest, ContinuingStmt) {
|
||||||
auto* p = parser("continuing { kill; }");
|
auto* p = parser("continuing { discard; }");
|
||||||
auto e = p->continuing_stmt();
|
auto e = p->continuing_stmt();
|
||||||
ASSERT_FALSE(p->has_error()) << p->error();
|
ASSERT_FALSE(p->has_error()) << p->error();
|
||||||
ASSERT_EQ(e.size(), 1u);
|
ASSERT_EQ(e.size(), 1u);
|
||||||
ASSERT_TRUE(e[0]->IsKill());
|
ASSERT_TRUE(e[0]->IsDiscard());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(ParserImplTest, ContinuingStmt_InvalidBody) {
|
TEST_F(ParserImplTest, ContinuingStmt_InvalidBody) {
|
||||||
auto* p = parser("continuing { kill }");
|
auto* p = parser("continuing { discard }");
|
||||||
auto e = p->continuing_stmt();
|
auto e = p->continuing_stmt();
|
||||||
ASSERT_TRUE(p->has_error());
|
ASSERT_TRUE(p->has_error());
|
||||||
ASSERT_EQ(e.size(), 0u);
|
ASSERT_EQ(e.size(), 0u);
|
||||||
EXPECT_EQ(p->error(), "1:19: missing ;");
|
EXPECT_EQ(p->error(), "1:22: missing ;");
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
@ -22,28 +22,28 @@ namespace wgsl {
|
|||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
TEST_F(ParserImplTest, LoopStmt_BodyNoContinuing) {
|
TEST_F(ParserImplTest, LoopStmt_BodyNoContinuing) {
|
||||||
auto* p = parser("loop { kill; }");
|
auto* p = parser("loop { discard; }");
|
||||||
auto e = p->loop_stmt();
|
auto e = p->loop_stmt();
|
||||||
ASSERT_FALSE(p->has_error()) << p->error();
|
ASSERT_FALSE(p->has_error()) << p->error();
|
||||||
ASSERT_NE(e, nullptr);
|
ASSERT_NE(e, nullptr);
|
||||||
|
|
||||||
ASSERT_EQ(e->body().size(), 1u);
|
ASSERT_EQ(e->body().size(), 1u);
|
||||||
EXPECT_TRUE(e->body()[0]->IsKill());
|
EXPECT_TRUE(e->body()[0]->IsDiscard());
|
||||||
|
|
||||||
EXPECT_EQ(e->continuing().size(), 0u);
|
EXPECT_EQ(e->continuing().size(), 0u);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(ParserImplTest, LoopStmt_BodyWithContinuing) {
|
TEST_F(ParserImplTest, LoopStmt_BodyWithContinuing) {
|
||||||
auto* p = parser("loop { kill; continuing { kill; }}");
|
auto* p = parser("loop { discard; continuing { discard; }}");
|
||||||
auto e = p->loop_stmt();
|
auto e = p->loop_stmt();
|
||||||
ASSERT_FALSE(p->has_error()) << p->error();
|
ASSERT_FALSE(p->has_error()) << p->error();
|
||||||
ASSERT_NE(e, nullptr);
|
ASSERT_NE(e, nullptr);
|
||||||
|
|
||||||
ASSERT_EQ(e->body().size(), 1u);
|
ASSERT_EQ(e->body().size(), 1u);
|
||||||
EXPECT_TRUE(e->body()[0]->IsKill());
|
EXPECT_TRUE(e->body()[0]->IsDiscard());
|
||||||
|
|
||||||
EXPECT_EQ(e->continuing().size(), 1u);
|
EXPECT_EQ(e->continuing().size(), 1u);
|
||||||
EXPECT_TRUE(e->continuing()[0]->IsKill());
|
EXPECT_TRUE(e->continuing()[0]->IsDiscard());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(ParserImplTest, LoopStmt_NoBodyNoContinuing) {
|
TEST_F(ParserImplTest, LoopStmt_NoBodyNoContinuing) {
|
||||||
@ -56,17 +56,17 @@ TEST_F(ParserImplTest, LoopStmt_NoBodyNoContinuing) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(ParserImplTest, LoopStmt_NoBodyWithContinuing) {
|
TEST_F(ParserImplTest, LoopStmt_NoBodyWithContinuing) {
|
||||||
auto* p = parser("loop { continuing { kill; }}");
|
auto* p = parser("loop { continuing { discard; }}");
|
||||||
auto e = p->loop_stmt();
|
auto e = p->loop_stmt();
|
||||||
ASSERT_FALSE(p->has_error()) << p->error();
|
ASSERT_FALSE(p->has_error()) << p->error();
|
||||||
ASSERT_NE(e, nullptr);
|
ASSERT_NE(e, nullptr);
|
||||||
ASSERT_EQ(e->body().size(), 0u);
|
ASSERT_EQ(e->body().size(), 0u);
|
||||||
ASSERT_EQ(e->continuing().size(), 1u);
|
ASSERT_EQ(e->continuing().size(), 1u);
|
||||||
EXPECT_TRUE(e->continuing()[0]->IsKill());
|
EXPECT_TRUE(e->continuing()[0]->IsDiscard());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(ParserImplTest, LoopStmt_MissingBracketLeft) {
|
TEST_F(ParserImplTest, LoopStmt_MissingBracketLeft) {
|
||||||
auto* p = parser("loop kill; }");
|
auto* p = parser("loop discard; }");
|
||||||
auto e = p->loop_stmt();
|
auto e = p->loop_stmt();
|
||||||
ASSERT_TRUE(p->has_error());
|
ASSERT_TRUE(p->has_error());
|
||||||
ASSERT_EQ(e, nullptr);
|
ASSERT_EQ(e, nullptr);
|
||||||
@ -74,27 +74,27 @@ TEST_F(ParserImplTest, LoopStmt_MissingBracketLeft) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(ParserImplTest, LoopStmt_MissingBracketRight) {
|
TEST_F(ParserImplTest, LoopStmt_MissingBracketRight) {
|
||||||
auto* p = parser("loop { kill; ");
|
auto* p = parser("loop { discard; ");
|
||||||
auto e = p->loop_stmt();
|
auto e = p->loop_stmt();
|
||||||
ASSERT_TRUE(p->has_error());
|
ASSERT_TRUE(p->has_error());
|
||||||
ASSERT_EQ(e, nullptr);
|
ASSERT_EQ(e, nullptr);
|
||||||
EXPECT_EQ(p->error(), "1:14: missing } for loop");
|
EXPECT_EQ(p->error(), "1:17: missing } for loop");
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(ParserImplTest, LoopStmt_InvalidStatements) {
|
TEST_F(ParserImplTest, LoopStmt_InvalidStatements) {
|
||||||
auto* p = parser("loop { kill }");
|
auto* p = parser("loop { discard }");
|
||||||
auto e = p->loop_stmt();
|
auto e = p->loop_stmt();
|
||||||
ASSERT_TRUE(p->has_error());
|
ASSERT_TRUE(p->has_error());
|
||||||
ASSERT_EQ(e, nullptr);
|
ASSERT_EQ(e, nullptr);
|
||||||
EXPECT_EQ(p->error(), "1:13: missing ;");
|
EXPECT_EQ(p->error(), "1:16: missing ;");
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(ParserImplTest, LoopStmt_InvalidContinuing) {
|
TEST_F(ParserImplTest, LoopStmt_InvalidContinuing) {
|
||||||
auto* p = parser("loop { continuing { kill }}");
|
auto* p = parser("loop { continuing { discard }}");
|
||||||
auto e = p->loop_stmt();
|
auto e = p->loop_stmt();
|
||||||
ASSERT_TRUE(p->has_error());
|
ASSERT_TRUE(p->has_error());
|
||||||
ASSERT_EQ(e, nullptr);
|
ASSERT_EQ(e, nullptr);
|
||||||
EXPECT_EQ(p->error(), "1:26: missing ;");
|
EXPECT_EQ(p->error(), "1:29: missing ;");
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
@ -142,7 +142,7 @@ TEST_F(ParserImplTest, Statement_Loop) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(ParserImplTest, Statement_Loop_Invalid) {
|
TEST_F(ParserImplTest, Statement_Loop_Invalid) {
|
||||||
auto* p = parser("loop kill; }");
|
auto* p = parser("loop discard; }");
|
||||||
auto e = p->statement();
|
auto e = p->statement();
|
||||||
ASSERT_TRUE(p->has_error());
|
ASSERT_TRUE(p->has_error());
|
||||||
ASSERT_EQ(e, nullptr);
|
ASSERT_EQ(e, nullptr);
|
||||||
@ -205,22 +205,6 @@ TEST_F(ParserImplTest, Statement_Continue_MissingSemicolon) {
|
|||||||
EXPECT_EQ(p->error(), "1:9: missing ;");
|
EXPECT_EQ(p->error(), "1:9: missing ;");
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(ParserImplTest, Statement_Kill) {
|
|
||||||
auto* p = parser("kill;");
|
|
||||||
auto e = p->statement();
|
|
||||||
ASSERT_FALSE(p->has_error()) << p->error();
|
|
||||||
EXPECT_NE(e, nullptr);
|
|
||||||
ASSERT_TRUE(e->IsKill());
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(ParserImplTest, Statement_Kill_MissingSemicolon) {
|
|
||||||
auto* p = parser("kill");
|
|
||||||
auto e = p->statement();
|
|
||||||
ASSERT_TRUE(p->has_error());
|
|
||||||
EXPECT_EQ(e, nullptr);
|
|
||||||
EXPECT_EQ(p->error(), "1:5: missing ;");
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(ParserImplTest, Statement_Discard) {
|
TEST_F(ParserImplTest, Statement_Discard) {
|
||||||
auto* p = parser("discard;");
|
auto* p = parser("discard;");
|
||||||
auto e = p->statement();
|
auto e = p->statement();
|
||||||
|
@ -23,11 +23,11 @@ namespace wgsl {
|
|||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
TEST_F(ParserImplTest, Statements) {
|
TEST_F(ParserImplTest, Statements) {
|
||||||
auto* p = parser("kill; return;");
|
auto* p = parser("discard; return;");
|
||||||
auto e = p->statements();
|
auto e = p->statements();
|
||||||
ASSERT_FALSE(p->has_error()) << p->error();
|
ASSERT_FALSE(p->has_error()) << p->error();
|
||||||
ASSERT_EQ(e.size(), 2u);
|
ASSERT_EQ(e.size(), 2u);
|
||||||
EXPECT_TRUE(e[0]->IsKill());
|
EXPECT_TRUE(e[0]->IsDiscard());
|
||||||
EXPECT_TRUE(e[1]->IsReturn());
|
EXPECT_TRUE(e[1]->IsReturn());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -163,8 +163,6 @@ std::string Token::TypeToName(Type type) {
|
|||||||
return "import";
|
return "import";
|
||||||
case Token::Type::kIn:
|
case Token::Type::kIn:
|
||||||
return "in";
|
return "in";
|
||||||
case Token::Type::kKill:
|
|
||||||
return "kill";
|
|
||||||
case Token::Type::kLocation:
|
case Token::Type::kLocation:
|
||||||
return "location";
|
return "location";
|
||||||
case Token::Type::kLoop:
|
case Token::Type::kLoop:
|
||||||
|
@ -174,8 +174,6 @@ class Token {
|
|||||||
kImport,
|
kImport,
|
||||||
/// A 'in'
|
/// A 'in'
|
||||||
kIn,
|
kIn,
|
||||||
/// A 'kill'
|
|
||||||
kKill,
|
|
||||||
/// A 'location'
|
/// A 'location'
|
||||||
kLocation,
|
kLocation,
|
||||||
/// A 'loop'
|
/// A 'loop'
|
||||||
@ -429,8 +427,6 @@ class Token {
|
|||||||
bool IsImport() const { return type_ == Type::kImport; }
|
bool IsImport() const { return type_ == Type::kImport; }
|
||||||
/// @returns true if token is a 'in'
|
/// @returns true if token is a 'in'
|
||||||
bool IsIn() const { return type_ == Type::kIn; }
|
bool IsIn() const { return type_ == Type::kIn; }
|
||||||
/// @returns true if token is a 'kill'
|
|
||||||
bool IsKill() const { return type_ == Type::kKill; }
|
|
||||||
/// @returns true if token is a 'location'
|
/// @returns true if token is a 'location'
|
||||||
bool IsLocation() const { return type_ == Type::kLocation; }
|
bool IsLocation() const { return type_ == Type::kLocation; }
|
||||||
/// @returns true if token is a 'loop'
|
/// @returns true if token is a 'loop'
|
||||||
|
@ -295,6 +295,9 @@ bool TypeDeterminer::DetermineResultType(ast::Statement* stmt) {
|
|||||||
if (stmt->IsContinue()) {
|
if (stmt->IsContinue()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
if (stmt->IsDiscard()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
if (stmt->IsElse()) {
|
if (stmt->IsElse()) {
|
||||||
auto* e = stmt->AsElse();
|
auto* e = stmt->AsElse();
|
||||||
return DetermineResultType(e->condition()) &&
|
return DetermineResultType(e->condition()) &&
|
||||||
@ -317,9 +320,6 @@ bool TypeDeterminer::DetermineResultType(ast::Statement* stmt) {
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (stmt->IsKill()) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (stmt->IsLoop()) {
|
if (stmt->IsLoop()) {
|
||||||
auto* l = stmt->AsLoop();
|
auto* l = stmt->AsLoop();
|
||||||
return DetermineStatements(l->body()) &&
|
return DetermineStatements(l->body()) &&
|
||||||
|
@ -1397,14 +1397,6 @@ bool GeneratorImpl::EmitDiscard(ast::DiscardStatement*) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GeneratorImpl::EmitKill(ast::KillStatement*) {
|
|
||||||
make_indent();
|
|
||||||
// TODO(dsinclair): Verify this is correct when the kill semantics are defined
|
|
||||||
// for WGSL (https://github.com/gpuweb/gpuweb/issues/361)
|
|
||||||
out_ << "discard_fragment();" << std::endl;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool GeneratorImpl::EmitElse(ast::ElseStatement* stmt) {
|
bool GeneratorImpl::EmitElse(ast::ElseStatement* stmt) {
|
||||||
if (stmt->HasCondition()) {
|
if (stmt->HasCondition()) {
|
||||||
out_ << " else if (";
|
out_ << " else if (";
|
||||||
@ -1528,9 +1520,6 @@ bool GeneratorImpl::EmitStatement(ast::Statement* stmt) {
|
|||||||
if (stmt->IsIf()) {
|
if (stmt->IsIf()) {
|
||||||
return EmitIf(stmt->AsIf());
|
return EmitIf(stmt->AsIf());
|
||||||
}
|
}
|
||||||
if (stmt->IsKill()) {
|
|
||||||
return EmitKill(stmt->AsKill());
|
|
||||||
}
|
|
||||||
if (stmt->IsLoop()) {
|
if (stmt->IsLoop()) {
|
||||||
return EmitLoop(stmt->AsLoop());
|
return EmitLoop(stmt->AsLoop());
|
||||||
}
|
}
|
||||||
|
@ -142,10 +142,6 @@ class GeneratorImpl : public TextGenerator {
|
|||||||
/// @param expr the expression
|
/// @param expr the expression
|
||||||
/// @returns true if the expression was successfully emitted.
|
/// @returns true if the expression was successfully emitted.
|
||||||
bool EmitImportFunction(ast::CallExpression* expr);
|
bool EmitImportFunction(ast::CallExpression* expr);
|
||||||
/// Handles generating a kill statement
|
|
||||||
/// @param stmt the kill statement
|
|
||||||
/// @returns true if the statement was successfully emitted
|
|
||||||
bool EmitKill(ast::KillStatement* stmt);
|
|
||||||
/// Handles a literal
|
/// Handles a literal
|
||||||
/// @param lit the literal to emit
|
/// @param lit the literal to emit
|
||||||
/// @returns true if the literal was successfully emitted
|
/// @returns true if the literal was successfully emitted
|
||||||
|
@ -1,41 +0,0 @@
|
|||||||
// Copyright 2020 The Tint Authors.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
#include "gtest/gtest.h"
|
|
||||||
#include "src/ast/kill_statement.h"
|
|
||||||
#include "src/ast/module.h"
|
|
||||||
#include "src/writer/msl/generator_impl.h"
|
|
||||||
|
|
||||||
namespace tint {
|
|
||||||
namespace writer {
|
|
||||||
namespace msl {
|
|
||||||
namespace {
|
|
||||||
|
|
||||||
using MslGeneratorImplTest = testing::Test;
|
|
||||||
|
|
||||||
TEST_F(MslGeneratorImplTest, Emit_Kill) {
|
|
||||||
ast::KillStatement k;
|
|
||||||
|
|
||||||
ast::Module m;
|
|
||||||
GeneratorImpl g(&m);
|
|
||||||
g.increment_indent();
|
|
||||||
|
|
||||||
ASSERT_TRUE(g.EmitStatement(&k)) << g.error();
|
|
||||||
EXPECT_EQ(g.result(), " discard_fragment();\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace
|
|
||||||
} // namespace msl
|
|
||||||
} // namespace writer
|
|
||||||
} // namespace tint
|
|
@ -16,9 +16,9 @@
|
|||||||
|
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
#include "src/ast/assignment_statement.h"
|
#include "src/ast/assignment_statement.h"
|
||||||
|
#include "src/ast/discard_statement.h"
|
||||||
#include "src/ast/float_literal.h"
|
#include "src/ast/float_literal.h"
|
||||||
#include "src/ast/identifier_expression.h"
|
#include "src/ast/identifier_expression.h"
|
||||||
#include "src/ast/kill_statement.h"
|
|
||||||
#include "src/ast/loop_statement.h"
|
#include "src/ast/loop_statement.h"
|
||||||
#include "src/ast/module.h"
|
#include "src/ast/module.h"
|
||||||
#include "src/ast/return_statement.h"
|
#include "src/ast/return_statement.h"
|
||||||
@ -36,7 +36,7 @@ using MslGeneratorImplTest = testing::Test;
|
|||||||
|
|
||||||
TEST_F(MslGeneratorImplTest, Emit_Loop) {
|
TEST_F(MslGeneratorImplTest, Emit_Loop) {
|
||||||
ast::StatementList body;
|
ast::StatementList body;
|
||||||
body.push_back(std::make_unique<ast::KillStatement>());
|
body.push_back(std::make_unique<ast::DiscardStatement>());
|
||||||
|
|
||||||
ast::LoopStatement l(std::move(body), {});
|
ast::LoopStatement l(std::move(body), {});
|
||||||
|
|
||||||
@ -53,7 +53,7 @@ TEST_F(MslGeneratorImplTest, Emit_Loop) {
|
|||||||
|
|
||||||
TEST_F(MslGeneratorImplTest, Emit_LoopWithContinuing) {
|
TEST_F(MslGeneratorImplTest, Emit_LoopWithContinuing) {
|
||||||
ast::StatementList body;
|
ast::StatementList body;
|
||||||
body.push_back(std::make_unique<ast::KillStatement>());
|
body.push_back(std::make_unique<ast::DiscardStatement>());
|
||||||
|
|
||||||
ast::StatementList continuing;
|
ast::StatementList continuing;
|
||||||
continuing.push_back(std::make_unique<ast::ReturnStatement>());
|
continuing.push_back(std::make_unique<ast::ReturnStatement>());
|
||||||
@ -83,7 +83,7 @@ TEST_F(MslGeneratorImplTest, Emit_LoopNestedWithContinuing) {
|
|||||||
ast::type::F32Type f32;
|
ast::type::F32Type f32;
|
||||||
|
|
||||||
ast::StatementList body;
|
ast::StatementList body;
|
||||||
body.push_back(std::make_unique<ast::KillStatement>());
|
body.push_back(std::make_unique<ast::DiscardStatement>());
|
||||||
|
|
||||||
ast::StatementList continuing;
|
ast::StatementList continuing;
|
||||||
continuing.push_back(std::make_unique<ast::ReturnStatement>());
|
continuing.push_back(std::make_unique<ast::ReturnStatement>());
|
||||||
|
@ -106,7 +106,7 @@ bool LastIsTerminator(const ast::StatementList& stmts) {
|
|||||||
|
|
||||||
auto* last = stmts.back().get();
|
auto* last = stmts.back().get();
|
||||||
return last->IsBreak() || last->IsContinue() || last->IsDiscard() ||
|
return last->IsBreak() || last->IsContinue() || last->IsDiscard() ||
|
||||||
last->IsReturn() || last->IsKill() || last->IsFallthrough();
|
last->IsReturn() || last->IsFallthrough();
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t IndexFromName(char name) {
|
uint32_t IndexFromName(char name) {
|
||||||
@ -281,14 +281,6 @@ bool Builder::GenerateDiscardStatement(ast::DiscardStatement*) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(dsinclair): This is generating an OpKill but the semantics of kill
|
|
||||||
// haven't been defined for WGSL yet. So, this may need to change.
|
|
||||||
// https://github.com/gpuweb/gpuweb/issues/676
|
|
||||||
bool Builder::GenerateKillStatement(ast::KillStatement*) {
|
|
||||||
push_function_inst(spv::Op::OpKill, {});
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Builder::GenerateEntryPoint(ast::EntryPoint* ep) {
|
bool Builder::GenerateEntryPoint(ast::EntryPoint* ep) {
|
||||||
auto name = ep->name();
|
auto name = ep->name();
|
||||||
if (name.empty()) {
|
if (name.empty()) {
|
||||||
@ -1834,9 +1826,6 @@ bool Builder::GenerateStatement(ast::Statement* stmt) {
|
|||||||
if (stmt->IsIf()) {
|
if (stmt->IsIf()) {
|
||||||
return GenerateIfStatement(stmt->AsIf());
|
return GenerateIfStatement(stmt->AsIf());
|
||||||
}
|
}
|
||||||
if (stmt->IsKill()) {
|
|
||||||
return GenerateKillStatement(stmt->AsKill());
|
|
||||||
}
|
|
||||||
if (stmt->IsLoop()) {
|
if (stmt->IsLoop()) {
|
||||||
return GenerateLoopStatement(stmt->AsLoop());
|
return GenerateLoopStatement(stmt->AsLoop());
|
||||||
}
|
}
|
||||||
|
@ -179,10 +179,6 @@ class Builder {
|
|||||||
/// @param stmt the statement to generate
|
/// @param stmt the statement to generate
|
||||||
/// @returns true if the statement was successfully generated
|
/// @returns true if the statement was successfully generated
|
||||||
bool GenerateDiscardStatement(ast::DiscardStatement* stmt);
|
bool GenerateDiscardStatement(ast::DiscardStatement* stmt);
|
||||||
/// Generates a kill statement
|
|
||||||
/// @param stmt the statement to generate
|
|
||||||
/// @returns true if the statement was successfully generated
|
|
||||||
bool GenerateKillStatement(ast::KillStatement* stmt);
|
|
||||||
/// Generates an entry point instruction
|
/// Generates an entry point instruction
|
||||||
/// @param ep the entry point
|
/// @param ep the entry point
|
||||||
/// @returns true if the instruction was generated, false otherwise
|
/// @returns true if the instruction was generated, false otherwise
|
||||||
|
@ -1,43 +0,0 @@
|
|||||||
// Copyright 2020 The Tint Authors.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
#include "gtest/gtest.h"
|
|
||||||
#include "src/ast/kill_statement.h"
|
|
||||||
#include "src/context.h"
|
|
||||||
#include "src/type_determiner.h"
|
|
||||||
#include "src/writer/spirv/builder.h"
|
|
||||||
#include "src/writer/spirv/spv_dump.h"
|
|
||||||
|
|
||||||
namespace tint {
|
|
||||||
namespace writer {
|
|
||||||
namespace spirv {
|
|
||||||
namespace {
|
|
||||||
|
|
||||||
using BuilderTest = testing::Test;
|
|
||||||
|
|
||||||
TEST_F(BuilderTest, Kill) {
|
|
||||||
ast::KillStatement expr;
|
|
||||||
|
|
||||||
ast::Module mod;
|
|
||||||
Builder b(&mod);
|
|
||||||
b.push_function(Function{});
|
|
||||||
EXPECT_EQ(b.GenerateKillStatement(&expr), 1u) << b.error();
|
|
||||||
EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"(OpKill
|
|
||||||
)");
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace
|
|
||||||
} // namespace spirv
|
|
||||||
} // namespace writer
|
|
||||||
} // namespace tint
|
|
@ -652,9 +652,6 @@ bool GeneratorImpl::EmitStatement(ast::Statement* stmt) {
|
|||||||
if (stmt->IsIf()) {
|
if (stmt->IsIf()) {
|
||||||
return EmitIf(stmt->AsIf());
|
return EmitIf(stmt->AsIf());
|
||||||
}
|
}
|
||||||
if (stmt->IsKill()) {
|
|
||||||
return EmitKill(stmt->AsKill());
|
|
||||||
}
|
|
||||||
if (stmt->IsLoop()) {
|
if (stmt->IsLoop()) {
|
||||||
return EmitLoop(stmt->AsLoop());
|
return EmitLoop(stmt->AsLoop());
|
||||||
}
|
}
|
||||||
@ -777,12 +774,6 @@ bool GeneratorImpl::EmitDiscard(ast::DiscardStatement*) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GeneratorImpl::EmitKill(ast::KillStatement*) {
|
|
||||||
make_indent();
|
|
||||||
out_ << "kill;" << std::endl;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool GeneratorImpl::EmitLoop(ast::LoopStatement* stmt) {
|
bool GeneratorImpl::EmitLoop(ast::LoopStatement* stmt) {
|
||||||
make_indent();
|
make_indent();
|
||||||
|
|
||||||
|
@ -131,10 +131,6 @@ class GeneratorImpl : public TextGenerator {
|
|||||||
/// @param stmt the discard statement
|
/// @param stmt the discard statement
|
||||||
/// @returns true if the statement was successfully emitted
|
/// @returns true if the statement was successfully emitted
|
||||||
bool EmitDiscard(ast::DiscardStatement* stmt);
|
bool EmitDiscard(ast::DiscardStatement* stmt);
|
||||||
/// Handles generating a kill statement
|
|
||||||
/// @param stmt the kill statement
|
|
||||||
/// @returns true if the statement was successfully emitted
|
|
||||||
bool EmitKill(ast::KillStatement* stmt);
|
|
||||||
/// Handles a literal
|
/// Handles a literal
|
||||||
/// @param lit the literal to emit
|
/// @param lit the literal to emit
|
||||||
/// @returns true if the literal was successfully emitted
|
/// @returns true if the literal was successfully emitted
|
||||||
|
@ -13,8 +13,8 @@
|
|||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
|
#include "src/ast/discard_statement.h"
|
||||||
#include "src/ast/function.h"
|
#include "src/ast/function.h"
|
||||||
#include "src/ast/kill_statement.h"
|
|
||||||
#include "src/ast/return_statement.h"
|
#include "src/ast/return_statement.h"
|
||||||
#include "src/ast/type/f32_type.h"
|
#include "src/ast/type/f32_type.h"
|
||||||
#include "src/ast/type/i32_type.h"
|
#include "src/ast/type/i32_type.h"
|
||||||
@ -31,7 +31,7 @@ using WgslGeneratorImplTest = testing::Test;
|
|||||||
|
|
||||||
TEST_F(WgslGeneratorImplTest, Emit_Function) {
|
TEST_F(WgslGeneratorImplTest, Emit_Function) {
|
||||||
ast::StatementList body;
|
ast::StatementList body;
|
||||||
body.push_back(std::make_unique<ast::KillStatement>());
|
body.push_back(std::make_unique<ast::DiscardStatement>());
|
||||||
body.push_back(std::make_unique<ast::ReturnStatement>());
|
body.push_back(std::make_unique<ast::ReturnStatement>());
|
||||||
|
|
||||||
ast::type::VoidType void_type;
|
ast::type::VoidType void_type;
|
||||||
@ -43,7 +43,7 @@ TEST_F(WgslGeneratorImplTest, Emit_Function) {
|
|||||||
|
|
||||||
ASSERT_TRUE(g.EmitFunction(&func));
|
ASSERT_TRUE(g.EmitFunction(&func));
|
||||||
EXPECT_EQ(g.result(), R"( fn my_func() -> void {
|
EXPECT_EQ(g.result(), R"( fn my_func() -> void {
|
||||||
kill;
|
discard;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
)");
|
)");
|
||||||
@ -51,7 +51,7 @@ TEST_F(WgslGeneratorImplTest, Emit_Function) {
|
|||||||
|
|
||||||
TEST_F(WgslGeneratorImplTest, Emit_Function_WithParams) {
|
TEST_F(WgslGeneratorImplTest, Emit_Function_WithParams) {
|
||||||
ast::StatementList body;
|
ast::StatementList body;
|
||||||
body.push_back(std::make_unique<ast::KillStatement>());
|
body.push_back(std::make_unique<ast::DiscardStatement>());
|
||||||
body.push_back(std::make_unique<ast::ReturnStatement>());
|
body.push_back(std::make_unique<ast::ReturnStatement>());
|
||||||
|
|
||||||
ast::type::F32Type f32;
|
ast::type::F32Type f32;
|
||||||
@ -71,7 +71,7 @@ TEST_F(WgslGeneratorImplTest, Emit_Function_WithParams) {
|
|||||||
|
|
||||||
ASSERT_TRUE(g.EmitFunction(&func));
|
ASSERT_TRUE(g.EmitFunction(&func));
|
||||||
EXPECT_EQ(g.result(), R"( fn my_func(a : f32, b : i32) -> void {
|
EXPECT_EQ(g.result(), R"( fn my_func(a : f32, b : i32) -> void {
|
||||||
kill;
|
discard;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
)");
|
)");
|
||||||
|
@ -13,10 +13,10 @@
|
|||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
|
#include "src/ast/discard_statement.h"
|
||||||
#include "src/ast/else_statement.h"
|
#include "src/ast/else_statement.h"
|
||||||
#include "src/ast/identifier_expression.h"
|
#include "src/ast/identifier_expression.h"
|
||||||
#include "src/ast/if_statement.h"
|
#include "src/ast/if_statement.h"
|
||||||
#include "src/ast/kill_statement.h"
|
|
||||||
#include "src/writer/wgsl/generator_impl.h"
|
#include "src/writer/wgsl/generator_impl.h"
|
||||||
|
|
||||||
namespace tint {
|
namespace tint {
|
||||||
@ -29,7 +29,7 @@ using WgslGeneratorImplTest = testing::Test;
|
|||||||
TEST_F(WgslGeneratorImplTest, Emit_If) {
|
TEST_F(WgslGeneratorImplTest, Emit_If) {
|
||||||
auto cond = std::make_unique<ast::IdentifierExpression>("cond");
|
auto cond = std::make_unique<ast::IdentifierExpression>("cond");
|
||||||
ast::StatementList body;
|
ast::StatementList body;
|
||||||
body.push_back(std::make_unique<ast::KillStatement>());
|
body.push_back(std::make_unique<ast::DiscardStatement>());
|
||||||
|
|
||||||
ast::IfStatement i(std::move(cond), std::move(body));
|
ast::IfStatement i(std::move(cond), std::move(body));
|
||||||
|
|
||||||
@ -38,7 +38,7 @@ TEST_F(WgslGeneratorImplTest, Emit_If) {
|
|||||||
|
|
||||||
ASSERT_TRUE(g.EmitStatement(&i)) << g.error();
|
ASSERT_TRUE(g.EmitStatement(&i)) << g.error();
|
||||||
EXPECT_EQ(g.result(), R"( if (cond) {
|
EXPECT_EQ(g.result(), R"( if (cond) {
|
||||||
kill;
|
discard;
|
||||||
}
|
}
|
||||||
)");
|
)");
|
||||||
}
|
}
|
||||||
@ -47,7 +47,7 @@ TEST_F(WgslGeneratorImplTest, Emit_IfWithElseIf) {
|
|||||||
auto else_cond = std::make_unique<ast::IdentifierExpression>("else_cond");
|
auto else_cond = std::make_unique<ast::IdentifierExpression>("else_cond");
|
||||||
|
|
||||||
ast::StatementList else_body;
|
ast::StatementList else_body;
|
||||||
else_body.push_back(std::make_unique<ast::KillStatement>());
|
else_body.push_back(std::make_unique<ast::DiscardStatement>());
|
||||||
|
|
||||||
ast::ElseStatementList elses;
|
ast::ElseStatementList elses;
|
||||||
elses.push_back(std::make_unique<ast::ElseStatement>(std::move(else_cond),
|
elses.push_back(std::make_unique<ast::ElseStatement>(std::move(else_cond),
|
||||||
@ -55,7 +55,7 @@ TEST_F(WgslGeneratorImplTest, Emit_IfWithElseIf) {
|
|||||||
|
|
||||||
auto cond = std::make_unique<ast::IdentifierExpression>("cond");
|
auto cond = std::make_unique<ast::IdentifierExpression>("cond");
|
||||||
ast::StatementList body;
|
ast::StatementList body;
|
||||||
body.push_back(std::make_unique<ast::KillStatement>());
|
body.push_back(std::make_unique<ast::DiscardStatement>());
|
||||||
|
|
||||||
ast::IfStatement i(std::move(cond), std::move(body));
|
ast::IfStatement i(std::move(cond), std::move(body));
|
||||||
i.set_else_statements(std::move(elses));
|
i.set_else_statements(std::move(elses));
|
||||||
@ -65,23 +65,23 @@ TEST_F(WgslGeneratorImplTest, Emit_IfWithElseIf) {
|
|||||||
|
|
||||||
ASSERT_TRUE(g.EmitStatement(&i)) << g.error();
|
ASSERT_TRUE(g.EmitStatement(&i)) << g.error();
|
||||||
EXPECT_EQ(g.result(), R"( if (cond) {
|
EXPECT_EQ(g.result(), R"( if (cond) {
|
||||||
kill;
|
discard;
|
||||||
} elseif (else_cond) {
|
} elseif (else_cond) {
|
||||||
kill;
|
discard;
|
||||||
}
|
}
|
||||||
)");
|
)");
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(WgslGeneratorImplTest, Emit_IfWithElse) {
|
TEST_F(WgslGeneratorImplTest, Emit_IfWithElse) {
|
||||||
ast::StatementList else_body;
|
ast::StatementList else_body;
|
||||||
else_body.push_back(std::make_unique<ast::KillStatement>());
|
else_body.push_back(std::make_unique<ast::DiscardStatement>());
|
||||||
|
|
||||||
ast::ElseStatementList elses;
|
ast::ElseStatementList elses;
|
||||||
elses.push_back(std::make_unique<ast::ElseStatement>(std::move(else_body)));
|
elses.push_back(std::make_unique<ast::ElseStatement>(std::move(else_body)));
|
||||||
|
|
||||||
auto cond = std::make_unique<ast::IdentifierExpression>("cond");
|
auto cond = std::make_unique<ast::IdentifierExpression>("cond");
|
||||||
ast::StatementList body;
|
ast::StatementList body;
|
||||||
body.push_back(std::make_unique<ast::KillStatement>());
|
body.push_back(std::make_unique<ast::DiscardStatement>());
|
||||||
|
|
||||||
ast::IfStatement i(std::move(cond), std::move(body));
|
ast::IfStatement i(std::move(cond), std::move(body));
|
||||||
i.set_else_statements(std::move(elses));
|
i.set_else_statements(std::move(elses));
|
||||||
@ -91,9 +91,9 @@ TEST_F(WgslGeneratorImplTest, Emit_IfWithElse) {
|
|||||||
|
|
||||||
ASSERT_TRUE(g.EmitStatement(&i)) << g.error();
|
ASSERT_TRUE(g.EmitStatement(&i)) << g.error();
|
||||||
EXPECT_EQ(g.result(), R"( if (cond) {
|
EXPECT_EQ(g.result(), R"( if (cond) {
|
||||||
kill;
|
discard;
|
||||||
} else {
|
} else {
|
||||||
kill;
|
discard;
|
||||||
}
|
}
|
||||||
)");
|
)");
|
||||||
}
|
}
|
||||||
@ -102,10 +102,10 @@ TEST_F(WgslGeneratorImplTest, Emit_IfWithMultiple) {
|
|||||||
auto else_cond = std::make_unique<ast::IdentifierExpression>("else_cond");
|
auto else_cond = std::make_unique<ast::IdentifierExpression>("else_cond");
|
||||||
|
|
||||||
ast::StatementList else_body;
|
ast::StatementList else_body;
|
||||||
else_body.push_back(std::make_unique<ast::KillStatement>());
|
else_body.push_back(std::make_unique<ast::DiscardStatement>());
|
||||||
|
|
||||||
ast::StatementList else_body_2;
|
ast::StatementList else_body_2;
|
||||||
else_body_2.push_back(std::make_unique<ast::KillStatement>());
|
else_body_2.push_back(std::make_unique<ast::DiscardStatement>());
|
||||||
|
|
||||||
ast::ElseStatementList elses;
|
ast::ElseStatementList elses;
|
||||||
elses.push_back(std::make_unique<ast::ElseStatement>(std::move(else_cond),
|
elses.push_back(std::make_unique<ast::ElseStatement>(std::move(else_cond),
|
||||||
@ -114,7 +114,7 @@ TEST_F(WgslGeneratorImplTest, Emit_IfWithMultiple) {
|
|||||||
|
|
||||||
auto cond = std::make_unique<ast::IdentifierExpression>("cond");
|
auto cond = std::make_unique<ast::IdentifierExpression>("cond");
|
||||||
ast::StatementList body;
|
ast::StatementList body;
|
||||||
body.push_back(std::make_unique<ast::KillStatement>());
|
body.push_back(std::make_unique<ast::DiscardStatement>());
|
||||||
|
|
||||||
ast::IfStatement i(std::move(cond), std::move(body));
|
ast::IfStatement i(std::move(cond), std::move(body));
|
||||||
i.set_else_statements(std::move(elses));
|
i.set_else_statements(std::move(elses));
|
||||||
@ -124,11 +124,11 @@ TEST_F(WgslGeneratorImplTest, Emit_IfWithMultiple) {
|
|||||||
|
|
||||||
ASSERT_TRUE(g.EmitStatement(&i)) << g.error();
|
ASSERT_TRUE(g.EmitStatement(&i)) << g.error();
|
||||||
EXPECT_EQ(g.result(), R"( if (cond) {
|
EXPECT_EQ(g.result(), R"( if (cond) {
|
||||||
kill;
|
discard;
|
||||||
} elseif (else_cond) {
|
} elseif (else_cond) {
|
||||||
kill;
|
discard;
|
||||||
} else {
|
} else {
|
||||||
kill;
|
discard;
|
||||||
}
|
}
|
||||||
)");
|
)");
|
||||||
}
|
}
|
||||||
|
@ -1,39 +0,0 @@
|
|||||||
// Copyright 2020 The Tint Authors.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
#include "gtest/gtest.h"
|
|
||||||
#include "src/ast/kill_statement.h"
|
|
||||||
#include "src/writer/wgsl/generator_impl.h"
|
|
||||||
|
|
||||||
namespace tint {
|
|
||||||
namespace writer {
|
|
||||||
namespace wgsl {
|
|
||||||
namespace {
|
|
||||||
|
|
||||||
using WgslGeneratorImplTest = testing::Test;
|
|
||||||
|
|
||||||
TEST_F(WgslGeneratorImplTest, Emit_kill) {
|
|
||||||
ast::KillStatement k;
|
|
||||||
|
|
||||||
GeneratorImpl g;
|
|
||||||
g.increment_indent();
|
|
||||||
|
|
||||||
ASSERT_TRUE(g.EmitStatement(&k)) << g.error();
|
|
||||||
EXPECT_EQ(g.result(), " kill;\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace
|
|
||||||
} // namespace wgsl
|
|
||||||
} // namespace writer
|
|
||||||
} // namespace tint
|
|
@ -15,7 +15,7 @@
|
|||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
#include "src/ast/kill_statement.h"
|
#include "src/ast/discard_statement.h"
|
||||||
#include "src/ast/loop_statement.h"
|
#include "src/ast/loop_statement.h"
|
||||||
#include "src/writer/wgsl/generator_impl.h"
|
#include "src/writer/wgsl/generator_impl.h"
|
||||||
|
|
||||||
@ -28,7 +28,7 @@ using WgslGeneratorImplTest = testing::Test;
|
|||||||
|
|
||||||
TEST_F(WgslGeneratorImplTest, Emit_Loop) {
|
TEST_F(WgslGeneratorImplTest, Emit_Loop) {
|
||||||
ast::StatementList body;
|
ast::StatementList body;
|
||||||
body.push_back(std::make_unique<ast::KillStatement>());
|
body.push_back(std::make_unique<ast::DiscardStatement>());
|
||||||
|
|
||||||
ast::LoopStatement l(std::move(body), {});
|
ast::LoopStatement l(std::move(body), {});
|
||||||
|
|
||||||
@ -37,17 +37,17 @@ TEST_F(WgslGeneratorImplTest, Emit_Loop) {
|
|||||||
|
|
||||||
ASSERT_TRUE(g.EmitStatement(&l)) << g.error();
|
ASSERT_TRUE(g.EmitStatement(&l)) << g.error();
|
||||||
EXPECT_EQ(g.result(), R"( loop {
|
EXPECT_EQ(g.result(), R"( loop {
|
||||||
kill;
|
discard;
|
||||||
}
|
}
|
||||||
)");
|
)");
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(WgslGeneratorImplTest, Emit_LoopWithContinuing) {
|
TEST_F(WgslGeneratorImplTest, Emit_LoopWithContinuing) {
|
||||||
ast::StatementList body;
|
ast::StatementList body;
|
||||||
body.push_back(std::make_unique<ast::KillStatement>());
|
body.push_back(std::make_unique<ast::DiscardStatement>());
|
||||||
|
|
||||||
ast::StatementList continuing;
|
ast::StatementList continuing;
|
||||||
continuing.push_back(std::make_unique<ast::KillStatement>());
|
continuing.push_back(std::make_unique<ast::DiscardStatement>());
|
||||||
|
|
||||||
ast::LoopStatement l(std::move(body), std::move(continuing));
|
ast::LoopStatement l(std::move(body), std::move(continuing));
|
||||||
|
|
||||||
@ -56,10 +56,10 @@ TEST_F(WgslGeneratorImplTest, Emit_LoopWithContinuing) {
|
|||||||
|
|
||||||
ASSERT_TRUE(g.EmitStatement(&l)) << g.error();
|
ASSERT_TRUE(g.EmitStatement(&l)) << g.error();
|
||||||
EXPECT_EQ(g.result(), R"( loop {
|
EXPECT_EQ(g.result(), R"( loop {
|
||||||
kill;
|
discard;
|
||||||
|
|
||||||
continuing {
|
continuing {
|
||||||
kill;
|
discard;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)");
|
)");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user