1 // rust-gcc.cc -- Rust frontend to gcc IR.
2 // Copyright (C) 2011-2024 Free Software Foundation, Inc.
3 // Contributed by Ian Lance Taylor, Google.
6 // This file is part of GCC.
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
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
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/>.
22 #include "rust-system.h"
24 // This has to be included outside of extern "C", so we have to
25 // include it here before tree.h includes it later.
29 #include "rust-location.h"
31 // TODO: this will have to be significantly modified to work with Rust
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
45 Bvariable (tree t
) : t_ (t
), orig_type_ (NULL
) {}
47 Bvariable (tree t
, tree orig_type
) : t_ (t
), orig_type_ (orig_type
) {}
49 // Get the tree for use as an expression.
50 tree
get_tree (Location
) const;
52 // Get the actual decl;
53 tree
get_decl () const { return this->t_
; }