(root)/
gcc-13.2.0/
gcc/
rust/
backend/
rust-compile-type.h
       1  // Copyright (C) 2020-2023 Free Software Foundation, Inc.
       2  
       3  // This file is part of GCC.
       4  
       5  // GCC is free software; you can redistribute it and/or modify it under
       6  // the terms of the GNU General Public License as published by the Free
       7  // Software Foundation; either version 3, or (at your option) any later
       8  // version.
       9  
      10  // GCC is distributed in the hope that it will be useful, but WITHOUT ANY
      11  // WARRANTY; without even the implied warranty of MERCHANTABILITY or
      12  // FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
      13  // for more details.
      14  
      15  // You should have received a copy of the GNU General Public License
      16  // along with GCC; see the file COPYING3.  If not see
      17  // <http://www.gnu.org/licenses/>.
      18  
      19  #ifndef RUST_COMPILE_TYPE
      20  #define RUST_COMPILE_TYPE
      21  
      22  #include "rust-compile-context.h"
      23  
      24  namespace Rust {
      25  namespace Compile {
      26  
      27  class TyTyResolveCompile : protected TyTy::TyConstVisitor
      28  {
      29  public:
      30    static tree compile (Context *ctx, const TyTy::BaseType *ty,
      31  		       bool trait_object_mode = false);
      32  
      33    static tree get_implicit_enumeral_node_type (Context *ctx);
      34  
      35    void visit (const TyTy::InferType &) override;
      36    void visit (const TyTy::ADTType &) override;
      37    void visit (const TyTy::TupleType &) override;
      38    void visit (const TyTy::FnType &) override;
      39    void visit (const TyTy::FnPtr &) override;
      40    void visit (const TyTy::ArrayType &) override;
      41    void visit (const TyTy::SliceType &) override;
      42    void visit (const TyTy::BoolType &) override;
      43    void visit (const TyTy::IntType &) override;
      44    void visit (const TyTy::UintType &) override;
      45    void visit (const TyTy::FloatType &) override;
      46    void visit (const TyTy::USizeType &) override;
      47    void visit (const TyTy::ISizeType &) override;
      48    void visit (const TyTy::ErrorType &) override;
      49    void visit (const TyTy::CharType &) override;
      50    void visit (const TyTy::ReferenceType &) override;
      51    void visit (const TyTy::PointerType &) override;
      52    void visit (const TyTy::ParamType &) override;
      53    void visit (const TyTy::StrType &) override;
      54    void visit (const TyTy::NeverType &) override;
      55    void visit (const TyTy::PlaceholderType &) override;
      56    void visit (const TyTy::ProjectionType &) override;
      57    void visit (const TyTy::DynamicObjectType &) override;
      58    void visit (const TyTy::ClosureType &) override;
      59  
      60  public:
      61    static hashval_t type_hasher (tree type);
      62  
      63  protected:
      64    tree create_slice_type_record (const TyTy::SliceType &type);
      65    tree create_str_type_record (const TyTy::StrType &type);
      66  
      67  private:
      68    TyTyResolveCompile (Context *ctx, bool trait_object_mode);
      69  
      70    Context *ctx;
      71    bool trait_object_mode;
      72    tree translated;
      73    int recurisve_ops;
      74  };
      75  
      76  } // namespace Compile
      77  } // namespace Rust
      78  
      79  #endif // RUST_COMPILE_TYPE