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 % 2 2
Test Date: 2025-04-19 15:48:17 Functions: 0.0 % 2 0
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: - 0 0

             Branch data     Line data    Source code
       1                 :             : 
       2                 :             : // Copyright (C) 2020-2025 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-ast-visitor.h"
      24                 :             : #include "rust-name-resolution-context.h"
      25                 :             : 
      26                 :             : namespace Rust {
      27                 :             : namespace Resolver2_0 {
      28                 :             : 
      29                 :             : /**
      30                 :             :  * The `DefaultResolver` is a base visitor for all passes of our name resolution
      31                 :             :  * algorithm: `TopLevel`, `Easy` and `Late`. It does not do a lot, apart from
      32                 :             :  * visiting each node's subnodes - a block's statements, a function call's
      33                 :             :  * arguments...
      34                 :             :  */
      35                 :             : class DefaultResolver : public AST::DefaultASTVisitor
      36                 :             : {
      37                 :             : public:
      38                 :             :   using AST::DefaultASTVisitor::visit;
      39                 :             : 
      40                 :         908 :   virtual ~DefaultResolver () {}
      41                 :             : 
      42                 :             :   // First, our lexical scope expressions - these visit their sub nodes, always
      43                 :             :   // these nodes create new scopes and ribs - they are often used to declare new
      44                 :             :   // variables, such as a for loop's iterator, or a function's arguments
      45                 :             :   void visit (AST::BlockExpr &) override;
      46                 :             :   void visit (AST::Module &) override;
      47                 :             :   void visit (AST::Function &) override;
      48                 :             :   void visit (AST::ForLoopExpr &expr) override;
      49                 :             :   void visit (AST::Trait &) override;
      50                 :             :   void visit (AST::InherentImpl &) override;
      51                 :             :   void visit (AST::TraitImpl &) override;
      52                 :             : 
      53                 :             :   // type dec nodes, which visit their fields or variants by default
      54                 :             :   void visit (AST::StructStruct &) override;
      55                 :             :   void visit (AST::TupleStruct &) override;
      56                 :             :   void visit (AST::Enum &) override;
      57                 :             :   void visit (AST::Union &) override;
      58                 :             :   void visit (AST::TypeAlias &) override;
      59                 :             : 
      60                 :             :   // Visitors that visit their expression node(s)
      61                 :             :   void visit (AST::ClosureExprInner &) override;
      62                 :             :   void visit (AST::ClosureExprInnerTyped &) override;
      63                 :             :   void visit (AST::MatchExpr &) override;
      64                 :             : 
      65                 :             :   // Leaf visitors, which do nothing by default
      66                 :             :   void visit (AST::ConstantItem &) override;
      67                 :             :   void visit (AST::StaticItem &) override;
      68                 :             : 
      69                 :             : protected:
      70                 :        6626 :   DefaultResolver (NameResolutionContext &ctx) : ctx (ctx) {}
      71                 :             : 
      72                 :             :   NameResolutionContext &ctx;
      73                 :             : };
      74                 :             : 
      75                 :             : } // namespace Resolver2_0
      76                 :             : } // namespace Rust
      77                 :             : 
      78                 :             : #endif // RUST_AST_DEFAULT_RESOLVER_H
        

Generated by: LCOV version 2.1-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.