1 // Copyright (C) 2020-2024 Free Software Foundation, Inc.
3 // This file is part of GCC.
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
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
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/>.
19 #ifndef RUST_COMPILE_TYPE
20 #define RUST_COMPILE_TYPE
22 #include "rust-compile-context.h"
27 class TyTyResolveCompile
: protected TyTy::TyConstVisitor
30 static tree
compile (Context
*ctx
, const TyTy::BaseType
*ty
,
31 bool trait_object_mode
= false);
33 static tree
get_implicit_enumeral_node_type (Context
*ctx
);
35 static tree
get_unit_type (Context
*ctx
);
37 void visit (const TyTy::InferType
&) override
;
38 void visit (const TyTy::ADTType
&) override
;
39 void visit (const TyTy::TupleType
&) override
;
40 void visit (const TyTy::FnType
&) override
;
41 void visit (const TyTy::FnPtr
&) override
;
42 void visit (const TyTy::ArrayType
&) override
;
43 void visit (const TyTy::SliceType
&) override
;
44 void visit (const TyTy::BoolType
&) override
;
45 void visit (const TyTy::IntType
&) override
;
46 void visit (const TyTy::UintType
&) override
;
47 void visit (const TyTy::FloatType
&) override
;
48 void visit (const TyTy::USizeType
&) override
;
49 void visit (const TyTy::ISizeType
&) override
;
50 void visit (const TyTy::ErrorType
&) override
;
51 void visit (const TyTy::CharType
&) override
;
52 void visit (const TyTy::ReferenceType
&) override
;
53 void visit (const TyTy::PointerType
&) override
;
54 void visit (const TyTy::ParamType
&) override
;
55 void visit (const TyTy::StrType
&) override
;
56 void visit (const TyTy::NeverType
&) override
;
57 void visit (const TyTy::PlaceholderType
&) override
;
58 void visit (const TyTy::ProjectionType
&) override
;
59 void visit (const TyTy::DynamicObjectType
&) override
;
60 void visit (const TyTy::ClosureType
&) override
;
63 static hashval_t
type_hasher (tree type
);
66 tree
create_slice_type_record (const TyTy::SliceType
&type
);
67 tree
create_str_type_record (const TyTy::StrType
&type
);
68 tree
create_dyn_obj_record (const TyTy::DynamicObjectType
&type
);
71 TyTyResolveCompile (Context
*ctx
, bool trait_object_mode
);
74 bool trait_object_mode
;
78 } // namespace Compile
81 #endif // RUST_COMPILE_TYPE