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: 2024-04-27 14:03:13 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-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_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                 :          21 :   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 &);
      46                 :             :   void visit (AST::Module &);
      47                 :             :   void visit (AST::Function &);
      48                 :             :   void visit (AST::ForLoopExpr &);
      49                 :             :   void visit (AST::Trait &);
      50                 :             :   void visit (AST::InherentImpl &);
      51                 :             :   void visit (AST::TraitImpl &);
      52                 :             :   void visit (AST::ExternBlock &);
      53                 :             : 
      54                 :             :   // type dec nodes, which visit their fields or variants by default
      55                 :             :   void visit (AST::StructStruct &);
      56                 :             :   void visit (AST::Enum &);
      57                 :             : 
      58                 :             :   // Visitors that visit their expression node(s)
      59                 :             :   void visit (AST::StructExprFieldIdentifierValue &);
      60                 :             :   void visit (AST::StructExprFieldIndexValue &);
      61                 :             :   void visit (AST::ClosureExprInner &);
      62                 :             :   void visit (AST::ClosureExprInnerTyped &);
      63                 :             :   void visit (AST::ContinueExpr &);
      64                 :             :   void visit (AST::RangeFromToExpr &);
      65                 :             :   void visit (AST::RangeFromExpr &);
      66                 :             :   void visit (AST::RangeToExpr &);
      67                 :             :   void visit (AST::RangeFromToInclExpr &);
      68                 :             :   void visit (AST::RangeToInclExpr &);
      69                 :             :   void visit (AST::ReturnExpr &);
      70                 :             :   void visit (AST::UnsafeBlockExpr &);
      71                 :             :   void visit (AST::LoopExpr &);
      72                 :             :   void visit (AST::WhileLoopExpr &);
      73                 :             :   void visit (AST::WhileLetLoopExpr &);
      74                 :             :   void visit (AST::IfExpr &);
      75                 :             :   void visit (AST::IfExprConseqElse &);
      76                 :             :   void visit (AST::IfLetExpr &);
      77                 :             :   void visit (AST::IfLetExprConseqElse &);
      78                 :             :   void visit (AST::MatchExpr &);
      79                 :             :   void visit (AST::AwaitExpr &);
      80                 :             :   void visit (AST::AsyncBlockExpr &);
      81                 :             : 
      82                 :             :   // Leaf visitors, which do nothing by default
      83                 :             :   void visit (AST::DelimTokenTree &);
      84                 :             :   void visit (AST::AttrInputMetaItemContainer &);
      85                 :             :   void visit (AST::IdentifierExpr &);
      86                 :             :   void visit (AST::LifetimeParam &);
      87                 :             :   void visit (AST::ConstGenericParam &);
      88                 :             :   void visit (AST::PathInExpression &);
      89                 :             :   void visit (AST::TypePathSegmentGeneric &);
      90                 :             :   void visit (AST::TypePathSegmentFunction &);
      91                 :             :   void visit (AST::TypePath &);
      92                 :             :   void visit (AST::QualifiedPathInExpression &);
      93                 :             :   void visit (AST::QualifiedPathInType &);
      94                 :             :   void visit (AST::LiteralExpr &);
      95                 :             :   void visit (AST::AttrInputLiteral &);
      96                 :             :   void visit (AST::AttrInputMacro &);
      97                 :             :   void visit (AST::MetaItemLitExpr &);
      98                 :             :   void visit (AST::MetaItemPathLit &);
      99                 :             :   void visit (AST::StructExprStruct &);
     100                 :             :   void visit (AST::StructExprStructFields &);
     101                 :             :   void visit (AST::StructExprStructBase &);
     102                 :             :   void visit (AST::TypeParam &);
     103                 :             :   void visit (AST::LifetimeWhereClauseItem &);
     104                 :             :   void visit (AST::TypeBoundWhereClauseItem &);
     105                 :             :   void visit (AST::ExternCrate &);
     106                 :             :   void visit (AST::UseTreeGlob &);
     107                 :             :   void visit (AST::UseTreeList &);
     108                 :             :   void visit (AST::UseTreeRebind &);
     109                 :             :   void visit (AST::UseDeclaration &);
     110                 :             :   void visit (AST::TypeAlias &);
     111                 :             :   void visit (AST::EnumItem &);
     112                 :             :   void visit (AST::EnumItemTuple &);
     113                 :             :   void visit (AST::EnumItemStruct &);
     114                 :             :   void visit (AST::EnumItemDiscriminant &);
     115                 :             :   void visit (AST::ConstantItem &);
     116                 :             :   void visit (AST::StaticItem &);
     117                 :             :   void visit (AST::TraitItemConst &);
     118                 :             :   void visit (AST::TraitItemType &);
     119                 :             :   void visit (AST::ExternalTypeItem &);
     120                 :             :   void visit (AST::ExternalStaticItem &);
     121                 :             :   void visit (AST::ExternalFunctionItem &);
     122                 :             :   void visit (AST::MacroMatchRepetition &);
     123                 :             :   void visit (AST::MacroMatcher &);
     124                 :             :   void visit (AST::MacroRulesDefinition &);
     125                 :             :   void visit (AST::MacroInvocation &);
     126                 :             :   void visit (AST::MetaItemPath &);
     127                 :             :   void visit (AST::MetaItemSeq &);
     128                 :             :   void visit (AST::MetaListPaths &);
     129                 :             :   void visit (AST::MetaListNameValueStr &);
     130                 :             :   void visit (AST::RangePatternBoundPath &);
     131                 :             :   void visit (AST::RangePatternBoundQualPath &);
     132                 :             :   void visit (AST::RangePattern &);
     133                 :             :   void visit (AST::ReferencePattern &);
     134                 :             :   void visit (AST::StructPatternFieldTuplePat &);
     135                 :             :   void visit (AST::StructPatternFieldIdentPat &);
     136                 :             :   void visit (AST::StructPatternFieldIdent &);
     137                 :             :   void visit (AST::StructPattern &);
     138                 :             :   void visit (AST::TupleStructItemsNoRange &);
     139                 :             :   void visit (AST::TupleStructItemsRange &);
     140                 :             :   void visit (AST::TupleStructPattern &);
     141                 :             :   void visit (AST::TuplePatternItemsMultiple &);
     142                 :             :   void visit (AST::TuplePatternItemsRanged &);
     143                 :             :   void visit (AST::TuplePattern &);
     144                 :             :   void visit (AST::GroupedPattern &);
     145                 :             :   void visit (AST::SlicePattern &);
     146                 :             :   void visit (AST::AltPattern &);
     147                 :             :   void visit (AST::EmptyStmt &);
     148                 :             :   void visit (AST::TraitBound &);
     149                 :             :   void visit (AST::ImplTraitType &);
     150                 :             :   void visit (AST::TraitObjectType &);
     151                 :             :   void visit (AST::ParenthesisedType &);
     152                 :             :   void visit (AST::ImplTraitTypeOneBound &);
     153                 :             :   void visit (AST::TraitObjectTypeOneBound &);
     154                 :             :   void visit (AST::TupleType &);
     155                 :             :   void visit (AST::RawPointerType &);
     156                 :             :   void visit (AST::ReferenceType &);
     157                 :             :   void visit (AST::ArrayType &);
     158                 :             :   void visit (AST::SliceType &);
     159                 :             :   void visit (AST::BareFunctionType &);
     160                 :             :   void visit (AST::FunctionParam &);
     161                 :             :   void visit (AST::VariadicParam &);
     162                 :             :   void visit (AST::SelfParam &);
     163                 :             : 
     164                 :             : protected:
     165                 :          42 :   DefaultResolver (NameResolutionContext &ctx) : ctx (ctx) {}
     166                 :             : 
     167                 :             :   NameResolutionContext &ctx;
     168                 :             : };
     169                 :             : 
     170                 :             : } // namespace Resolver2_0
     171                 :             : } // namespace Rust
     172                 :             : 
     173                 :             : #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.