(root)/
gcc-13.2.0/
gcc/
rust/
backend/
rust-compile-fnparam.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_FNPARAM
      20  #define RUST_COMPILE_FNPARAM
      21  
      22  #include "rust-compile-base.h"
      23  
      24  namespace Rust {
      25  namespace Compile {
      26  
      27  class CompileFnParam : private HIRCompileBase, protected HIR::HIRPatternVisitor
      28  {
      29  public:
      30    static Bvariable *compile (Context *ctx, tree fndecl,
      31  			     HIR::FunctionParam *param, tree decl_type,
      32  			     Location locus);
      33    static Bvariable *compile (Context *ctx, tree fndecl, HIR::Pattern *param,
      34  			     tree decl_type, Location locus);
      35  
      36    void visit (HIR::IdentifierPattern &pattern) override;
      37    void visit (HIR::WildcardPattern &pattern) override;
      38    void visit (HIR::StructPattern &) override;
      39    void visit (HIR::TupleStructPattern &) override;
      40  
      41    // Empty visit for unused Pattern HIR nodes.
      42    void visit (HIR::LiteralPattern &) override {}
      43    void visit (HIR::PathInExpression &) override {}
      44    void visit (HIR::QualifiedPathInExpression &) override {}
      45    void visit (HIR::RangePattern &) override {}
      46    void visit (HIR::ReferencePattern &) override {}
      47    void visit (HIR::SlicePattern &) override {}
      48    void visit (HIR::TuplePattern &) override {}
      49  
      50  private:
      51    CompileFnParam (Context *ctx, tree fndecl, tree decl_type, Location locus);
      52  
      53    tree fndecl;
      54    tree decl_type;
      55    Location locus;
      56    Bvariable *compiled_param;
      57  };
      58  
      59  class CompileSelfParam : private HIRCompileBase
      60  {
      61  public:
      62    static Bvariable *compile (Context *ctx, tree fndecl, HIR::SelfParam &self,
      63  			     tree decl_type, Location locus);
      64  };
      65  
      66  } // namespace Compile
      67  } // namespace Rust
      68  
      69  #endif // RUST_COMPILE_FNPARAM