dan sinclair | b4374c2 | 2020-07-25 03:34:33 +0000 | [diff] [blame] | 1 | // 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 | #ifndef SRC_AST_DISCARD_STATEMENT_H_ |
| 16 | #define SRC_AST_DISCARD_STATEMENT_H_ |
| 17 | |
| 18 | #include "src/ast/statement.h" |
| 19 | |
| 20 | namespace tint { |
| 21 | namespace ast { |
| 22 | |
| 23 | /// A discard statement |
Ben Clayton | e319d7f | 2020-11-30 23:30:58 +0000 | [diff] [blame] | 24 | class DiscardStatement : public Castable<DiscardStatement, Statement> { |
dan sinclair | b4374c2 | 2020-07-25 03:34:33 +0000 | [diff] [blame] | 25 | public: |
| 26 | /// Constructor |
Ben Clayton | e6995de | 2021-04-13 23:27:27 +0000 | [diff] [blame] | 27 | /// @param program_id the identifier of the program that owns this node |
dan sinclair | b4374c2 | 2020-07-25 03:34:33 +0000 | [diff] [blame] | 28 | /// @param source the discard statement source |
Ben Clayton | e6995de | 2021-04-13 23:27:27 +0000 | [diff] [blame] | 29 | DiscardStatement(ProgramID program_id, const Source& source); |
dan sinclair | b4374c2 | 2020-07-25 03:34:33 +0000 | [diff] [blame] | 30 | /// Move constructor |
Ben Clayton | e319d7f | 2020-11-30 23:30:58 +0000 | [diff] [blame] | 31 | DiscardStatement(DiscardStatement&&); |
dan sinclair | b4374c2 | 2020-07-25 03:34:33 +0000 | [diff] [blame] | 32 | ~DiscardStatement() override; |
| 33 | |
Ben Clayton | ed2b978 | 2020-12-01 18:04:17 +0000 | [diff] [blame] | 34 | /// Clones this node and all transitive child nodes using the `CloneContext` |
| 35 | /// `ctx`. |
Ben Clayton | ed2b978 | 2020-12-01 18:04:17 +0000 | [diff] [blame] | 36 | /// @param ctx the clone context |
| 37 | /// @return the newly cloned node |
| 38 | DiscardStatement* Clone(CloneContext* ctx) const override; |
| 39 | |
dan sinclair | b4374c2 | 2020-07-25 03:34:33 +0000 | [diff] [blame] | 40 | /// Writes a representation of the node to the output stream |
Ben Clayton | dd1b6fc | 2021-01-29 10:55:40 +0000 | [diff] [blame] | 41 | /// @param sem the semantic info for the program |
dan sinclair | b4374c2 | 2020-07-25 03:34:33 +0000 | [diff] [blame] | 42 | /// @param out the stream to write to |
| 43 | /// @param indent number of spaces to indent the node when writing |
Antonio Maiorano | 5cd71b8 | 2021-04-16 19:07:51 +0000 | [diff] [blame^] | 44 | void to_str(const sem::Info& sem, |
Ben Clayton | dd1b6fc | 2021-01-29 10:55:40 +0000 | [diff] [blame] | 45 | std::ostream& out, |
| 46 | size_t indent) const override; |
dan sinclair | b4374c2 | 2020-07-25 03:34:33 +0000 | [diff] [blame] | 47 | |
| 48 | private: |
| 49 | DiscardStatement(const DiscardStatement&) = delete; |
| 50 | }; |
| 51 | |
| 52 | } // namespace ast |
| 53 | } // namespace tint |
| 54 | |
| 55 | #endif // SRC_AST_DISCARD_STATEMENT_H_ |