Remove infrastructure for fallthrough

This Cl removes the internal infrastructor and backend code
generation for the fallthrough statement.

Bug: tint:1644
Change-Id: I2a1de7d527865e5a7221074f4e0fb106599f4c57
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/109005
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
This commit is contained in:
dan sinclair
2022-11-15 00:30:33 +00:00
committed by Dawn LUCI CQ
parent bf586f6dfd
commit 267f1748c8
32 changed files with 39 additions and 571 deletions

View File

@@ -1,36 +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/tint/ast/fallthrough_statement.h"
#include "src/tint/program_builder.h"
TINT_INSTANTIATE_TYPEINFO(tint::ast::FallthroughStatement);
namespace tint::ast {
FallthroughStatement::FallthroughStatement(ProgramID pid, NodeID nid, const Source& src)
: Base(pid, nid, src) {}
FallthroughStatement::FallthroughStatement(FallthroughStatement&&) = default;
FallthroughStatement::~FallthroughStatement() = default;
const FallthroughStatement* FallthroughStatement::Clone(CloneContext* ctx) const {
// Clone arguments outside of create() call to have deterministic ordering
auto src = ctx->Clone(source);
return ctx->dst->create<FallthroughStatement>(src);
}
} // namespace tint::ast

View File

@@ -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.
#ifndef SRC_TINT_AST_FALLTHROUGH_STATEMENT_H_
#define SRC_TINT_AST_FALLTHROUGH_STATEMENT_H_
#include "src/tint/ast/statement.h"
namespace tint::ast {
/// An fallthrough statement
class FallthroughStatement final : public Castable<FallthroughStatement, Statement> {
public:
/// Constructor
/// @param pid the identifier of the program that owns this node
/// @param nid the unique node identifier
/// @param src the source of this node
FallthroughStatement(ProgramID pid, NodeID nid, const Source& src);
/// Move constructor
FallthroughStatement(FallthroughStatement&&);
~FallthroughStatement() override;
/// Clones this node and all transitive child nodes using the `CloneContext`
/// `ctx`.
/// @param ctx the clone context
/// @return the newly cloned node
const FallthroughStatement* Clone(CloneContext* ctx) const override;
};
} // namespace tint::ast
#endif // SRC_TINT_AST_FALLTHROUGH_STATEMENT_H_

View File

@@ -1,45 +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/tint/ast/fallthrough_statement.h"
#include "src/tint/ast/test_helper.h"
namespace tint::ast {
namespace {
using FallthroughStatementTest = TestHelper;
TEST_F(FallthroughStatementTest, Creation) {
auto* stmt = create<FallthroughStatement>();
EXPECT_EQ(stmt->source.range.begin.line, 0u);
EXPECT_EQ(stmt->source.range.begin.column, 0u);
EXPECT_EQ(stmt->source.range.end.line, 0u);
EXPECT_EQ(stmt->source.range.end.column, 0u);
}
TEST_F(FallthroughStatementTest, Creation_WithSource) {
auto* stmt = create<FallthroughStatement>(Source{Source::Location{20, 2}});
auto src = stmt->source;
EXPECT_EQ(src.range.begin.line, 20u);
EXPECT_EQ(src.range.begin.column, 2u);
}
TEST_F(FallthroughStatementTest, IsFallthrough) {
auto* stmt = create<FallthroughStatement>();
EXPECT_TRUE(stmt->Is<FallthroughStatement>());
}
} // namespace
} // namespace tint::ast

View File

@@ -19,7 +19,6 @@
#include "src/tint/ast/call_statement.h"
#include "src/tint/ast/continue_statement.h"
#include "src/tint/ast/discard_statement.h"
#include "src/tint/ast/fallthrough_statement.h"
#include "src/tint/ast/if_statement.h"
#include "src/tint/ast/loop_statement.h"
#include "src/tint/ast/return_statement.h"
@@ -58,9 +57,6 @@ const char* Statement::Name() const {
if (Is<DiscardStatement>()) {
return "discard statement";
}
if (Is<FallthroughStatement>()) {
return "fallthrough statement";
}
if (Is<IfStatement>()) {
return "if statement";
}