Line data Source code
1 : // Copyright (C) 2020-2026 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_STMT
20 : #define RUST_COMPILE_STMT
21 :
22 : #include "rust-compile-base.h"
23 : #include "rust-hir-visitor.h"
24 :
25 : namespace Rust {
26 : namespace Compile {
27 :
28 21664 : class CompileStmt : private HIRCompileBase, protected HIR::HIRStmtVisitor
29 : {
30 : public:
31 : static tree Compile (HIR::Stmt *stmt, Context *ctx);
32 :
33 : void visit (HIR::ExprStmt &stmt) override;
34 : void visit (HIR::LetStmt &stmt) override;
35 :
36 : // Empty visit for unused Stmt HIR nodes.
37 135 : void visit (HIR::TupleStruct &) override {}
38 0 : void visit (HIR::EnumItem &) override {}
39 0 : void visit (HIR::EnumItemTuple &) override {}
40 0 : void visit (HIR::EnumItemStruct &) override {}
41 0 : void visit (HIR::EnumItemDiscriminant &) override {}
42 0 : void visit (HIR::TypePathSegmentFunction &) override {}
43 0 : void visit (HIR::TypePath &) override {}
44 0 : void visit (HIR::QualifiedPathInType &) override {}
45 0 : void visit (HIR::Module &) override {}
46 0 : void visit (HIR::ExternCrate &) override {}
47 0 : void visit (HIR::UseDeclaration &) override {}
48 54 : void visit (HIR::Function &) override {}
49 0 : void visit (HIR::TypeAlias &) override {}
50 115 : void visit (HIR::StructStruct &) override {}
51 4 : void visit (HIR::Enum &) override {}
52 0 : void visit (HIR::Union &) override {}
53 45 : void visit (HIR::ConstantItem &) override {}
54 1 : void visit (HIR::StaticItem &) override {}
55 1 : void visit (HIR::Trait &) override {}
56 3 : void visit (HIR::ImplBlock &) override {}
57 14 : void visit (HIR::ExternBlock &) override {}
58 45 : void visit (HIR::EmptyStmt &) override {}
59 :
60 : private:
61 : CompileStmt (Context *ctx);
62 :
63 : tree translated;
64 : };
65 :
66 : } // namespace Compile
67 : } // namespace Rust
68 :
69 : #endif // RUST_COMPILE_STMT
|