• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_BITCAST_EXPRESSION_H_
16 #define SRC_AST_BITCAST_EXPRESSION_H_
17 
18 #include "src/ast/expression.h"
19 
20 namespace tint {
21 namespace ast {
22 
23 // Forward declaration
24 class Type;
25 
26 /// A bitcast expression
27 class BitcastExpression : public Castable<BitcastExpression, Expression> {
28  public:
29   /// Constructor
30   /// @param program_id the identifier of the program that owns this node
31   /// @param source the bitcast expression source
32   /// @param type the type
33   /// @param expr the expr
34   BitcastExpression(ProgramID program_id,
35                     const Source& source,
36                     const Type* type,
37                     const Expression* expr);
38   /// Move constructor
39   BitcastExpression(BitcastExpression&&);
40   ~BitcastExpression() override;
41 
42   /// Clones this node and all transitive child nodes using the `CloneContext`
43   /// `ctx`.
44   /// @param ctx the clone context
45   /// @return the newly cloned node
46   const BitcastExpression* Clone(CloneContext* ctx) const override;
47 
48   /// the target cast type
49   const Type* const type;
50   /// the expression
51   const Expression* const expr;
52 };
53 
54 }  // namespace ast
55 }  // namespace tint
56 
57 #endif  // SRC_AST_BITCAST_EXPRESSION_H_
58