blob: aa3ff08dbcbd393fc0c628eccd86374a33205989 [file] [log] [blame]
dan sinclairb4374c22020-07-25 03:34:33 +00001// Copyright 2020 The Tint Authors.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15#include "src/ast/discard_statement.h"
16
Ben Claytona6b9a8e2021-01-26 16:57:10 +000017#include "src/program_builder.h"
Ben Claytoned2b9782020-12-01 18:04:17 +000018
Ben Clayton7732ca52021-03-02 20:51:18 +000019TINT_INSTANTIATE_TYPEINFO(tint::ast::DiscardStatement);
Ben Clayton89ea7052020-12-02 18:19:28 +000020
dan sinclairb4374c22020-07-25 03:34:33 +000021namespace tint {
22namespace ast {
23
Ben Claytone6995de2021-04-13 23:27:27 +000024DiscardStatement::DiscardStatement(ProgramID program_id, const Source& source)
25 : Base(program_id, source) {}
Ben Claytone319d7f2020-11-30 23:30:58 +000026
27DiscardStatement::DiscardStatement(DiscardStatement&&) = default;
dan sinclairb4374c22020-07-25 03:34:33 +000028
29DiscardStatement::~DiscardStatement() = default;
30
Ben Claytoned2b9782020-12-01 18:04:17 +000031DiscardStatement* DiscardStatement::Clone(CloneContext* ctx) const {
Ben Clayton545c9742021-02-11 20:27:14 +000032 // Clone arguments outside of create() call to have deterministic ordering
33 auto src = ctx->Clone(source());
34 return ctx->dst->create<DiscardStatement>(src);
Ben Claytoned2b9782020-12-01 18:04:17 +000035}
36
Antonio Maiorano5cd71b82021-04-16 19:07:51 +000037void DiscardStatement::to_str(const sem::Info&,
Ben Claytondd1b6fc2021-01-29 10:55:40 +000038 std::ostream& out,
39 size_t indent) const {
dan sinclairb4374c22020-07-25 03:34:33 +000040 make_indent(out, indent);
41 out << "Discard{}" << std::endl;
42}
43
44} // namespace ast
45} // namespace tint