Debian Codegraph @

gcc/rust/hir/tree/rust-hir-type-no-bounds.h

raw
1
2 // Copyright (C) 2020-2024 Free Software Foundation, Inc.
3
4 // This file is part of GCC.
5
6 // GCC is free software; you can redistribute it and/or modify it under
7 // the terms of the GNU General Public License as published by the Free
8 // Software Foundation; either version 3, or (at your option) any later
9 // version.
10
11 // GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12 // WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 // for more details.
15
16 // You should have received a copy of the GNU General Public License
17 // along with GCC; see the file COPYING3. If not see
18 // <http://www.gnu.org/licenses/>.
19
20 #ifndef RUST_HIR_TYPE_NO_BOUNDS_H
21 #define RUST_HIR_TYPE_NO_BOUNDS_H
22
23 #include "rust-hir-type-abstract.h"
24
25 namespace Rust {
26 namespace HIR {
27
28 // A type without parentheses? - abstract
29 class TypeNoBounds : public Type
30 {
31 public:
32 // Unique pointer custom clone function
33 std::unique_ptr<TypeNoBounds> clone_type_no_bounds () const
34 {
35 return std::unique_ptr<TypeNoBounds> (clone_type_no_bounds_impl ());
36 }
37
38 protected:
39 TypeNoBounds (Analysis::NodeMapping mappings, location_t locus)
40 : Type (mappings, locus)
41 {}
42
43 // Clone function implementation as pure virtual method
44 virtual TypeNoBounds *clone_type_no_bounds_impl () const = 0;
45
46 /* Save having to specify two clone methods in derived classes by making type
47 * clone return typenobounds clone. Hopefully won't affect performance too
48 * much. */
49 TypeNoBounds *clone_type_impl () const override
50 {
51 return clone_type_no_bounds_impl ();
52 }
53 };
54
55 } // namespace HIR
56 } // namespace Rust
57
58 #endif