(root)/
gcc-13.2.0/
gcc/
rust/
rust-gcc.h
       1  // rust-gcc.cc -- Rust frontend to gcc IR.
       2  // Copyright (C) 2011-2023 Free Software Foundation, Inc.
       3  // Contributed by Ian Lance Taylor, Google.
       4  // forked from gccgo
       5  
       6  // This file is part of GCC.
       7  
       8  // GCC is free software; you can redistribute it and/or modify it under
       9  // the terms of the GNU General Public License as published by the Free
      10  // Software Foundation; either version 3, or (at your option) any later
      11  // version.
      12  
      13  // GCC is distributed in the hope that it will be useful, but WITHOUT ANY
      14  // WARRANTY; without even the implied warranty of MERCHANTABILITY or
      15  // FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
      16  // for more details.
      17  
      18  // You should have received a copy of the GNU General Public License
      19  // along with GCC; see the file COPYING3.  If not see
      20  // <http://www.gnu.org/licenses/>.
      21  
      22  #include "rust-system.h"
      23  
      24  // This has to be included outside of extern "C", so we have to
      25  // include it here before tree.h includes it later.
      26  #include <gmp.h>
      27  
      28  #include "tree.h"
      29  #include "rust-location.h"
      30  
      31  // TODO: this will have to be significantly modified to work with Rust
      32  
      33  // Bvariable is a bit more complicated, because of zero-sized types.
      34  // The GNU linker does not permit dynamic variables with zero size.
      35  // When we see such a variable, we generate a version of the type with
      36  // non-zero size.  However, when referring to the global variable, we
      37  // want an expression of zero size; otherwise, if, say, the global
      38  // variable is passed to a function, we will be passing a
      39  // non-zero-sized value to a zero-sized value, which can lead to a
      40  // miscompilation.
      41  
      42  class Bvariable
      43  {
      44  public:
      45    Bvariable (tree t) : t_ (t), orig_type_ (NULL) {}
      46  
      47    Bvariable (tree t, tree orig_type) : t_ (t), orig_type_ (orig_type) {}
      48  
      49    // Get the tree for use as an expression.
      50    tree get_tree (Location) const;
      51  
      52    // Get the actual decl;
      53    tree get_decl () const { return this->t_; }
      54  
      55  private:
      56    tree t_;
      57    tree orig_type_;
      58  };