LCOV - code coverage report
Current view: top level - gcc/rust/resolve - rust-default-resolver.h (source / functions) Coverage Total Hit
Test: gcc.info Lines: 100.0 % 4 4
Test Date: 2026-07-11 15:47:05 Functions: 100.0 % 4 4
Legend: Lines:     hit not hit

            Line data    Source code
       1              : 
       2              : // Copyright (C) 2020-2026 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_AST_DEFAULT_RESOLVER_H
      21              : #define RUST_AST_DEFAULT_RESOLVER_H
      22              : 
      23              : #include "rust-system.h"
      24              : #include "rust-ast-visitor.h"
      25              : #include "rust-name-resolution-context.h"
      26              : 
      27              : namespace Rust {
      28              : namespace Resolver2_0 {
      29              : 
      30              : /**
      31              :  * The `DefaultResolver` is a base visitor for all passes of our name resolution
      32              :  * algorithm: `TopLevel`, `Easy` and `Late`. It does not do a lot, apart from
      33              :  * visiting each node's subnodes - a block's statements, a function call's
      34              :  * arguments...
      35              :  */
      36              : class DefaultResolver : public AST::DefaultASTVisitor
      37              : {
      38              : public:
      39              :   using AST::DefaultASTVisitor::visit;
      40              : 
      41         4765 :   virtual ~DefaultResolver () {}
      42              : 
      43              :   void visit (AST::Crate &) override;
      44              :   // First, our lexical scope expressions - these visit their sub nodes, always
      45              :   // these nodes create new scopes and ribs - they are often used to declare new
      46              :   // variables, such as a for loop's iterator, or a function's arguments
      47              :   void visit (AST::BlockExpr &) override;
      48              :   void visit (AST::Module &) override;
      49              :   void visit (AST::Function &) override;
      50              :   void visit (AST::ForLoopExpr &expr) override;
      51              :   virtual void visit_if_let_patterns (AST::IfLetExpr &expr);
      52              :   void visit (AST::IfLetExpr &expr) override;
      53              :   void visit (AST::IfLetExprConseqElse &expr) override;
      54              :   void visit (AST::Trait &) override;
      55              :   // used to handle Self insertion in TopLevel
      56        19293 :   virtual void maybe_insert_big_self (AST::Impl &) {}
      57        32878 :   virtual void visit_impl_type (AST::Type &type) { visit (type); }
      58              :   void visit (AST::InherentImpl &) override;
      59              :   void visit (AST::TraitImpl &) override;
      60              : 
      61              :   void visit (AST::TypeParam &) override;
      62              : 
      63              :   virtual void visit_extern_crate (AST::ExternCrate &, AST::Crate &, CrateNum);
      64              :   void visit (AST::ExternCrate &) override;
      65              : 
      66              :   // type dec nodes, which visit their fields or variants by default
      67              :   void visit (AST::StructStruct &) override;
      68              :   void visit (AST::TupleStruct &) override;
      69              :   void visit (AST::EnumItem &) override;
      70              :   void visit (AST::EnumItemTuple &) override;
      71              :   void visit (AST::EnumItemStruct &) override;
      72              :   void visit (AST::EnumItemDiscriminant &) override;
      73              :   void visit (AST::Enum &) override;
      74              :   void visit (AST::Union &) override;
      75              :   void visit (AST::TypeAlias &) override;
      76              : 
      77              :   // Visitors that visit their expression node(s)
      78              :   virtual void visit_closure_params (AST::ClosureExpr &);
      79              :   virtual void visit (AST::ClosureExpr &);
      80              :   void visit (AST::ClosureExprInner &) override;
      81              :   void visit (AST::ClosureExprInnerTyped &) override;
      82              :   void visit (AST::MatchExpr &) override;
      83              :   void visit (AST::MatchCase &) override;
      84              : 
      85              :   // Leaf visitors, which do nothing by default
      86              :   void visit (AST::ConstantItem &) override;
      87              :   void visit (AST::StaticItem &) override;
      88              : 
      89              : protected:
      90        31352 :   DefaultResolver (NameResolutionContext &ctx) : ctx (ctx) {}
      91              : 
      92              :   NameResolutionContext &ctx;
      93              : 
      94              :   std::set<NodeId> visited_crates;
      95              : };
      96              : 
      97              : } // namespace Resolver2_0
      98              : } // namespace Rust
      99              : 
     100              : #endif // RUST_AST_DEFAULT_RESOLVER_H
        

Generated by: LCOV version 2.4-beta

LCOV profile is generated on x86_64 machine using following configure options: configure --disable-bootstrap --enable-coverage=opt --enable-languages=c,c++,fortran,go,jit,lto,rust,m2 --enable-host-shared. GCC test suite is run with the built compiler.