2020-03-02 12:47:43 -08:00
|
|
|
// 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.
|
|
|
|
|
2022-02-21 07:19:07 -08:00
|
|
|
#ifndef SRC_TINT_AST_BITCAST_EXPRESSION_H_
|
|
|
|
#define SRC_TINT_AST_BITCAST_EXPRESSION_H_
|
2020-03-02 12:47:43 -08:00
|
|
|
|
2022-02-21 07:19:07 -08:00
|
|
|
#include "src/tint/ast/expression.h"
|
2020-03-02 12:47:43 -08:00
|
|
|
|
|
|
|
namespace tint {
|
|
|
|
namespace ast {
|
|
|
|
|
2021-05-20 08:10:48 -07:00
|
|
|
// Forward declaration
|
|
|
|
class Type;
|
|
|
|
|
2020-09-22 15:07:13 -07:00
|
|
|
/// A bitcast expression
|
2022-03-07 10:37:46 -08:00
|
|
|
class BitcastExpression final : public Castable<BitcastExpression, Expression> {
|
2020-03-02 12:47:43 -08:00
|
|
|
public:
|
|
|
|
/// Constructor
|
2021-04-13 16:27:27 -07:00
|
|
|
/// @param program_id the identifier of the program that owns this node
|
2020-09-22 15:07:13 -07:00
|
|
|
/// @param source the bitcast expression source
|
2020-03-02 12:47:43 -08:00
|
|
|
/// @param type the type
|
|
|
|
/// @param expr the expr
|
2021-04-13 16:27:27 -07:00
|
|
|
BitcastExpression(ProgramID program_id,
|
|
|
|
const Source& source,
|
2021-10-19 11:38:54 -07:00
|
|
|
const Type* type,
|
|
|
|
const Expression* expr);
|
2020-03-02 12:47:43 -08:00
|
|
|
/// Move constructor
|
2020-09-22 15:07:13 -07:00
|
|
|
BitcastExpression(BitcastExpression&&);
|
|
|
|
~BitcastExpression() override;
|
2020-03-02 12:47:43 -08:00
|
|
|
|
2020-12-01 10:04:17 -08:00
|
|
|
/// Clones this node and all transitive child nodes using the `CloneContext`
|
|
|
|
/// `ctx`.
|
|
|
|
/// @param ctx the clone context
|
|
|
|
/// @return the newly cloned node
|
2021-10-19 11:38:54 -07:00
|
|
|
const BitcastExpression* Clone(CloneContext* ctx) const override;
|
2020-12-01 10:04:17 -08:00
|
|
|
|
2021-10-15 10:33:10 -07:00
|
|
|
/// the target cast type
|
2021-10-19 11:38:54 -07:00
|
|
|
const Type* const type;
|
2021-10-15 10:33:10 -07:00
|
|
|
/// the expression
|
2021-10-19 11:38:54 -07:00
|
|
|
const Expression* const expr;
|
2020-03-02 12:47:43 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace ast
|
|
|
|
} // namespace tint
|
|
|
|
|
2022-02-21 07:19:07 -08:00
|
|
|
#endif // SRC_TINT_AST_BITCAST_EXPRESSION_H_
|