LCOV - code coverage report
Current view: top level - gcc/rust/ast - rust-ast-visitor.h (source / functions) Coverage Total Hit
Test: gcc.info Lines: 100.0 % 13 13
Test Date: 2024-12-21 13:15:12 Functions: - 0 0
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: - 0 0

             Branch data     Line data    Source code
       1                 :             : // Copyright (C) 2020-2024 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_AST_VISITOR_H
      20                 :             : #define RUST_AST_VISITOR_H
      21                 :             : // Visitor base for AST
      22                 :             : 
      23                 :             : // full include not required - only forward decls
      24                 :             : #include "rust-ast-full-decls.h"
      25                 :             : #include "rust-ast.h"
      26                 :             : #include "rust-item.h"
      27                 :             : #include "rust-system.h"
      28                 :             : 
      29                 :             : namespace Rust {
      30                 :             : namespace AST {
      31                 :             : /* Pure abstract class that provides an interface for accessing different
      32                 :             :  * classes of the AST. */
      33                 :      473741 : class ASTVisitor
      34                 :             : {
      35                 :             : public:
      36                 :             :   // only concrete class overloads are required
      37                 :             : 
      38                 :             :   // rust-ast.h
      39                 :             :   // virtual void visit(AttrInput& attr_input) = 0;
      40                 :             :   // virtual void visit(TokenTree& token_tree) = 0;
      41                 :             :   // virtual void visit(MacroMatch& macro_match) = 0;
      42                 :             :   virtual void visit (Token &tok) = 0;
      43                 :             :   virtual void visit (DelimTokenTree &delim_tok_tree) = 0;
      44                 :             :   virtual void visit (AttrInputMetaItemContainer &input) = 0;
      45                 :             :   // virtual void visit(MetaItem& meta_item) = 0;
      46                 :             :   // virtual void visit(Stmt& stmt) = 0;
      47                 :             :   // virtual void visit(Expr& expr) = 0;
      48                 :             :   virtual void visit (IdentifierExpr &ident_expr) = 0;
      49                 :             :   // virtual void visit(Pattern& pattern) = 0;
      50                 :             :   // virtual void visit(Type& type) = 0;
      51                 :             :   // virtual void visit(TypeParamBound& type_param_bound) = 0;
      52                 :             :   virtual void visit (Lifetime &lifetime) = 0;
      53                 :             :   // virtual void visit(GenericParam& generic_param) = 0;
      54                 :             :   virtual void visit (LifetimeParam &lifetime_param) = 0;
      55                 :             :   virtual void visit (ConstGenericParam &const_param) = 0;
      56                 :             :   // virtual void visit(TraitItem& trait_item) = 0;
      57                 :             :   // virtual void visit(InherentImplItem& inherent_impl_item) = 0;
      58                 :             :   // virtual void visit(TraitImplItem& trait_impl_item) = 0;
      59                 :             : 
      60                 :             :   // rust-path.h
      61                 :             :   virtual void visit (PathInExpression &path) = 0;
      62                 :             :   virtual void visit (TypePathSegment &segment) = 0;
      63                 :             :   virtual void visit (TypePathSegmentGeneric &segment) = 0;
      64                 :             :   virtual void visit (TypePathSegmentFunction &segment) = 0;
      65                 :             :   virtual void visit (TypePath &path) = 0;
      66                 :             :   virtual void visit (QualifiedPathInExpression &path) = 0;
      67                 :             :   virtual void visit (QualifiedPathInType &path) = 0;
      68                 :             : 
      69                 :             :   // rust-expr.h
      70                 :             :   virtual void visit (LiteralExpr &expr) = 0;
      71                 :             :   virtual void visit (AttrInputLiteral &attr_input) = 0;
      72                 :             :   virtual void visit (AttrInputMacro &attr_input) = 0;
      73                 :             :   virtual void visit (MetaItemLitExpr &meta_item) = 0;
      74                 :             :   virtual void visit (MetaItemPathLit &meta_item) = 0;
      75                 :             :   virtual void visit (BorrowExpr &expr) = 0;
      76                 :             :   virtual void visit (DereferenceExpr &expr) = 0;
      77                 :             :   virtual void visit (ErrorPropagationExpr &expr) = 0;
      78                 :             :   virtual void visit (NegationExpr &expr) = 0;
      79                 :             :   virtual void visit (ArithmeticOrLogicalExpr &expr) = 0;
      80                 :             :   virtual void visit (ComparisonExpr &expr) = 0;
      81                 :             :   virtual void visit (LazyBooleanExpr &expr) = 0;
      82                 :             :   virtual void visit (TypeCastExpr &expr) = 0;
      83                 :             :   virtual void visit (AssignmentExpr &expr) = 0;
      84                 :             :   virtual void visit (CompoundAssignmentExpr &expr) = 0;
      85                 :             :   virtual void visit (GroupedExpr &expr) = 0;
      86                 :             :   // virtual void visit(ArrayElems& elems) = 0;
      87                 :             :   virtual void visit (ArrayElemsValues &elems) = 0;
      88                 :             :   virtual void visit (ArrayElemsCopied &elems) = 0;
      89                 :             :   virtual void visit (ArrayExpr &expr) = 0;
      90                 :             :   virtual void visit (ArrayIndexExpr &expr) = 0;
      91                 :             :   virtual void visit (TupleExpr &expr) = 0;
      92                 :             :   virtual void visit (TupleIndexExpr &expr) = 0;
      93                 :             :   virtual void visit (StructExprStruct &expr) = 0;
      94                 :             :   // virtual void visit(StructExprField& field) = 0;
      95                 :             :   virtual void visit (StructExprFieldIdentifier &field) = 0;
      96                 :             :   virtual void visit (StructExprFieldIdentifierValue &field) = 0;
      97                 :             :   virtual void visit (StructExprFieldIndexValue &field) = 0;
      98                 :             :   virtual void visit (StructExprStructFields &expr) = 0;
      99                 :             :   virtual void visit (StructExprStructBase &expr) = 0;
     100                 :             :   virtual void visit (CallExpr &expr) = 0;
     101                 :             :   virtual void visit (MethodCallExpr &expr) = 0;
     102                 :             :   virtual void visit (FieldAccessExpr &expr) = 0;
     103                 :             :   virtual void visit (ClosureExprInner &expr) = 0;
     104                 :             :   virtual void visit (BlockExpr &expr) = 0;
     105                 :             :   virtual void visit (ClosureExprInnerTyped &expr) = 0;
     106                 :             :   virtual void visit (ContinueExpr &expr) = 0;
     107                 :             :   virtual void visit (BreakExpr &expr) = 0;
     108                 :             :   virtual void visit (RangeFromToExpr &expr) = 0;
     109                 :             :   virtual void visit (RangeFromExpr &expr) = 0;
     110                 :             :   virtual void visit (RangeToExpr &expr) = 0;
     111                 :             :   virtual void visit (RangeFullExpr &expr) = 0;
     112                 :             :   virtual void visit (RangeFromToInclExpr &expr) = 0;
     113                 :             :   virtual void visit (RangeToInclExpr &expr) = 0;
     114                 :             :   virtual void visit (ReturnExpr &expr) = 0;
     115                 :             :   virtual void visit (UnsafeBlockExpr &expr) = 0;
     116                 :             :   virtual void visit (LoopExpr &expr) = 0;
     117                 :             :   virtual void visit (WhileLoopExpr &expr) = 0;
     118                 :             :   virtual void visit (WhileLetLoopExpr &expr) = 0;
     119                 :             :   virtual void visit (ForLoopExpr &expr) = 0;
     120                 :             :   virtual void visit (IfExpr &expr) = 0;
     121                 :             :   virtual void visit (IfExprConseqElse &expr) = 0;
     122                 :             :   virtual void visit (IfLetExpr &expr) = 0;
     123                 :             :   virtual void visit (IfLetExprConseqElse &expr) = 0;
     124                 :             :   // virtual void visit(MatchCase& match_case) = 0;
     125                 :             :   // virtual void visit (MatchCaseBlockExpr &match_case) = 0;
     126                 :             :   // virtual void visit (MatchCaseExpr &match_case) = 0;
     127                 :             :   virtual void visit (MatchExpr &expr) = 0;
     128                 :             :   virtual void visit (AwaitExpr &expr) = 0;
     129                 :             :   virtual void visit (AsyncBlockExpr &expr) = 0;
     130                 :             : 
     131                 :             :   // rust-item.h
     132                 :             :   virtual void visit (TypeParam &param) = 0;
     133                 :             :   virtual void visit (SelfParam &param) = 0;
     134                 :             :   virtual void visit (FunctionParam &param) = 0;
     135                 :             :   virtual void visit (VariadicParam &param) = 0;
     136                 :             : 
     137                 :             :   // virtual void visit(WhereClauseItem& item) = 0;
     138                 :             :   virtual void visit (LifetimeWhereClauseItem &item) = 0;
     139                 :             :   virtual void visit (TypeBoundWhereClauseItem &item) = 0;
     140                 :             :   virtual void visit (Module &module) = 0;
     141                 :             :   virtual void visit (ExternCrate &crate) = 0;
     142                 :             :   // virtual void visit(UseTree& use_tree) = 0;
     143                 :             :   virtual void visit (UseTreeGlob &use_tree) = 0;
     144                 :             :   virtual void visit (UseTreeList &use_tree) = 0;
     145                 :             :   virtual void visit (UseTreeRebind &use_tree) = 0;
     146                 :             :   virtual void visit (UseDeclaration &use_decl) = 0;
     147                 :             :   virtual void visit (Function &function) = 0;
     148                 :             :   virtual void visit (TypeAlias &type_alias) = 0;
     149                 :             :   virtual void visit (StructStruct &struct_item) = 0;
     150                 :             :   virtual void visit (TupleStruct &tuple_struct) = 0;
     151                 :             :   virtual void visit (EnumItem &item) = 0;
     152                 :             :   virtual void visit (EnumItemTuple &item) = 0;
     153                 :             :   virtual void visit (EnumItemStruct &item) = 0;
     154                 :             :   virtual void visit (EnumItemDiscriminant &item) = 0;
     155                 :             :   virtual void visit (Enum &enum_item) = 0;
     156                 :             :   virtual void visit (Union &union_item) = 0;
     157                 :             :   virtual void visit (ConstantItem &const_item) = 0;
     158                 :             :   virtual void visit (StaticItem &static_item) = 0;
     159                 :             :   virtual void visit (TraitItemConst &item) = 0;
     160                 :             :   virtual void visit (TraitItemType &item) = 0;
     161                 :             :   virtual void visit (Trait &trait) = 0;
     162                 :             :   virtual void visit (InherentImpl &impl) = 0;
     163                 :             :   virtual void visit (TraitImpl &impl) = 0;
     164                 :             :   // virtual void visit(ExternalItem& item) = 0;
     165                 :             :   virtual void visit (ExternalTypeItem &type) = 0;
     166                 :             :   virtual void visit (ExternalStaticItem &item) = 0;
     167                 :             :   virtual void visit (ExternBlock &block) = 0;
     168                 :             : 
     169                 :             :   // rust-macro.h
     170                 :             :   virtual void visit (MacroMatchFragment &match) = 0;
     171                 :             :   virtual void visit (MacroMatchRepetition &match) = 0;
     172                 :             :   virtual void visit (MacroMatcher &matcher) = 0;
     173                 :             :   virtual void visit (MacroRulesDefinition &rules_def) = 0;
     174                 :             :   virtual void visit (MacroInvocation &macro_invoc) = 0;
     175                 :             :   virtual void visit (MetaItemPath &meta_item) = 0;
     176                 :             :   virtual void visit (MetaItemSeq &meta_item) = 0;
     177                 :             :   virtual void visit (MetaWord &meta_item) = 0;
     178                 :             :   virtual void visit (MetaNameValueStr &meta_item) = 0;
     179                 :             :   virtual void visit (MetaListPaths &meta_item) = 0;
     180                 :             :   virtual void visit (MetaListNameValueStr &meta_item) = 0;
     181                 :             : 
     182                 :             :   // rust-pattern.h
     183                 :             :   virtual void visit (LiteralPattern &pattern) = 0;
     184                 :             :   virtual void visit (IdentifierPattern &pattern) = 0;
     185                 :             :   virtual void visit (WildcardPattern &pattern) = 0;
     186                 :             :   virtual void visit (RestPattern &pattern) = 0;
     187                 :             :   // virtual void visit(RangePatternBound& bound) = 0;
     188                 :             :   virtual void visit (RangePatternBoundLiteral &bound) = 0;
     189                 :             :   virtual void visit (RangePatternBoundPath &bound) = 0;
     190                 :             :   virtual void visit (RangePatternBoundQualPath &bound) = 0;
     191                 :             :   virtual void visit (RangePattern &pattern) = 0;
     192                 :             :   virtual void visit (ReferencePattern &pattern) = 0;
     193                 :             :   // virtual void visit(StructPatternField& field) = 0;
     194                 :             :   virtual void visit (StructPatternFieldTuplePat &field) = 0;
     195                 :             :   virtual void visit (StructPatternFieldIdentPat &field) = 0;
     196                 :             :   virtual void visit (StructPatternFieldIdent &field) = 0;
     197                 :             :   virtual void visit (StructPattern &pattern) = 0;
     198                 :             :   // virtual void visit(TupleStructItems& tuple_items) = 0;
     199                 :             :   virtual void visit (TupleStructItemsNoRange &tuple_items) = 0;
     200                 :             :   virtual void visit (TupleStructItemsRange &tuple_items) = 0;
     201                 :             :   virtual void visit (TupleStructPattern &pattern) = 0;
     202                 :             :   // virtual void visit(TuplePatternItems& tuple_items) = 0;
     203                 :             :   virtual void visit (TuplePatternItemsMultiple &tuple_items) = 0;
     204                 :             :   virtual void visit (TuplePatternItemsRanged &tuple_items) = 0;
     205                 :             :   virtual void visit (TuplePattern &pattern) = 0;
     206                 :             :   virtual void visit (GroupedPattern &pattern) = 0;
     207                 :             :   virtual void visit (SlicePattern &pattern) = 0;
     208                 :             :   virtual void visit (AltPattern &pattern) = 0;
     209                 :             : 
     210                 :             :   // rust-stmt.h
     211                 :             :   virtual void visit (EmptyStmt &stmt) = 0;
     212                 :             :   virtual void visit (LetStmt &stmt) = 0;
     213                 :             :   virtual void visit (ExprStmt &stmt) = 0;
     214                 :             : 
     215                 :             :   // rust-type.h
     216                 :             :   virtual void visit (TraitBound &bound) = 0;
     217                 :             :   virtual void visit (ImplTraitType &type) = 0;
     218                 :             :   virtual void visit (TraitObjectType &type) = 0;
     219                 :             :   virtual void visit (ParenthesisedType &type) = 0;
     220                 :             :   virtual void visit (ImplTraitTypeOneBound &type) = 0;
     221                 :             :   virtual void visit (TraitObjectTypeOneBound &type) = 0;
     222                 :             :   virtual void visit (TupleType &type) = 0;
     223                 :             :   virtual void visit (NeverType &type) = 0;
     224                 :             :   virtual void visit (RawPointerType &type) = 0;
     225                 :             :   virtual void visit (ReferenceType &type) = 0;
     226                 :             :   virtual void visit (ArrayType &type) = 0;
     227                 :             :   virtual void visit (SliceType &type) = 0;
     228                 :             :   virtual void visit (InferredType &type) = 0;
     229                 :             :   virtual void visit (BareFunctionType &type) = 0;
     230                 :             : 
     231                 :             :   // special AST nodes for certain builtin macros such as `asm!()`
     232                 :             :   virtual void visit (FormatArgs &fmt) = 0;
     233                 :             : 
     234                 :             :   // TODO: rust-cond-compilation.h visiting? not currently used
     235                 :             : };
     236                 :             : 
     237                 :       23146 : class DefaultASTVisitor : public ASTVisitor
     238                 :             : {
     239                 :             : public:
     240                 :             :   virtual void visit (AST::Crate &crate);
     241                 :             : 
     242                 :             : protected:
     243                 :             :   virtual void visit (AST::Token &tok) override;
     244                 :             :   virtual void visit (AST::DelimTokenTree &delim_tok_tree) override;
     245                 :             :   virtual void visit (AST::AttrInputMetaItemContainer &input) override;
     246                 :             :   virtual void visit (AST::IdentifierExpr &ident_expr) override;
     247                 :             :   virtual void visit (AST::Lifetime &lifetime) override;
     248                 :             :   virtual void visit (AST::LifetimeParam &lifetime_param) override;
     249                 :             :   virtual void visit (AST::ConstGenericParam &const_param) override;
     250                 :             :   virtual void visit (AST::PathInExpression &path) override;
     251                 :             :   virtual void visit (AST::TypePathSegment &segment) override;
     252                 :             :   virtual void visit (AST::TypePathSegmentGeneric &segment) override;
     253                 :             :   virtual void visit (AST::TypePathSegmentFunction &segment) override;
     254                 :             :   virtual void visit (AST::TypePath &path) override;
     255                 :             :   virtual void visit (AST::QualifiedPathInExpression &path) override;
     256                 :             :   virtual void visit (AST::QualifiedPathInType &path) override;
     257                 :             :   virtual void visit (AST::LiteralExpr &expr) override;
     258                 :             :   virtual void visit (AST::AttrInputLiteral &attr_input) override;
     259                 :             :   virtual void visit (AST::AttrInputMacro &attr_input) override;
     260                 :             :   virtual void visit (AST::MetaItemLitExpr &meta_item) override;
     261                 :             :   virtual void visit (AST::MetaItemPathLit &meta_item) override;
     262                 :             :   virtual void visit (AST::BorrowExpr &expr) override;
     263                 :             :   virtual void visit (AST::DereferenceExpr &expr) override;
     264                 :             :   virtual void visit (AST::ErrorPropagationExpr &expr) override;
     265                 :             :   virtual void visit (AST::NegationExpr &expr) override;
     266                 :             :   virtual void visit (AST::ArithmeticOrLogicalExpr &expr) override;
     267                 :             :   virtual void visit (AST::ComparisonExpr &expr) override;
     268                 :             :   virtual void visit (AST::LazyBooleanExpr &expr) override;
     269                 :             :   virtual void visit (AST::TypeCastExpr &expr) override;
     270                 :             :   virtual void visit (AST::AssignmentExpr &expr) override;
     271                 :             :   virtual void visit (AST::CompoundAssignmentExpr &expr) override;
     272                 :             :   virtual void visit (AST::GroupedExpr &expr) override;
     273                 :             :   virtual void visit (AST::ArrayElemsValues &elems) override;
     274                 :             :   virtual void visit (AST::ArrayElemsCopied &elems) override;
     275                 :             :   virtual void visit (AST::ArrayExpr &expr) override;
     276                 :             :   virtual void visit (AST::ArrayIndexExpr &expr) override;
     277                 :             :   virtual void visit (AST::TupleExpr &expr) override;
     278                 :             :   virtual void visit (AST::TupleIndexExpr &expr) override;
     279                 :             :   virtual void visit (AST::StructExprStruct &expr) override;
     280                 :             :   virtual void visit (AST::StructExprFieldIdentifier &field) override;
     281                 :             :   virtual void visit (AST::StructExprFieldIdentifierValue &field) override;
     282                 :             :   virtual void visit (AST::StructExprFieldIndexValue &field) override;
     283                 :             :   virtual void visit (AST::StructExprStructFields &expr) override;
     284                 :             :   virtual void visit (AST::StructExprStructBase &expr) override;
     285                 :             :   virtual void visit (AST::CallExpr &expr) override;
     286                 :             :   virtual void visit (AST::MethodCallExpr &expr) override;
     287                 :             :   virtual void visit (AST::FieldAccessExpr &expr) override;
     288                 :             :   virtual void visit (AST::ClosureExprInner &expr) override;
     289                 :             :   virtual void visit (AST::BlockExpr &expr) override;
     290                 :             :   virtual void visit (AST::ClosureExprInnerTyped &expr) override;
     291                 :             :   virtual void visit (AST::ContinueExpr &expr) override;
     292                 :             :   virtual void visit (AST::BreakExpr &expr) override;
     293                 :             :   virtual void visit (AST::RangeFromToExpr &expr) override;
     294                 :             :   virtual void visit (AST::RangeFromExpr &expr) override;
     295                 :             :   virtual void visit (AST::RangeToExpr &expr) override;
     296                 :             :   virtual void visit (AST::RangeFullExpr &expr) override;
     297                 :             :   virtual void visit (AST::RangeFromToInclExpr &expr) override;
     298                 :             :   virtual void visit (AST::RangeToInclExpr &expr) override;
     299                 :             :   virtual void visit (AST::ReturnExpr &expr) override;
     300                 :             :   virtual void visit (AST::UnsafeBlockExpr &expr) override;
     301                 :             :   virtual void visit (AST::LoopExpr &expr) override;
     302                 :             :   virtual void visit (AST::WhileLoopExpr &expr) override;
     303                 :             :   virtual void visit (AST::WhileLetLoopExpr &expr) override;
     304                 :             :   virtual void visit (AST::ForLoopExpr &expr) override;
     305                 :             :   virtual void visit (AST::IfExpr &expr) override;
     306                 :             :   virtual void visit (AST::IfExprConseqElse &expr) override;
     307                 :             :   virtual void visit (AST::IfLetExpr &expr) override;
     308                 :             :   virtual void visit (AST::IfLetExprConseqElse &expr) override;
     309                 :             :   virtual void visit (AST::MatchExpr &expr) override;
     310                 :             :   virtual void visit (AST::AwaitExpr &expr) override;
     311                 :             :   virtual void visit (AST::AsyncBlockExpr &expr) override;
     312                 :             :   virtual void visit (AST::TypeParam &param) override;
     313                 :             :   virtual void visit (AST::LifetimeWhereClauseItem &item) override;
     314                 :             :   virtual void visit (AST::TypeBoundWhereClauseItem &item) override;
     315                 :             :   virtual void visit (AST::Module &module) override;
     316                 :             :   virtual void visit (AST::ExternCrate &crate) override;
     317                 :             :   virtual void visit (AST::UseTreeGlob &use_tree) override;
     318                 :             :   virtual void visit (AST::UseTreeList &use_tree) override;
     319                 :             :   virtual void visit (AST::UseTreeRebind &use_tree) override;
     320                 :             :   virtual void visit (AST::UseDeclaration &use_decl) override;
     321                 :             :   virtual void visit (AST::Function &function) override;
     322                 :             :   virtual void visit (AST::TypeAlias &type_alias) override;
     323                 :             :   virtual void visit (AST::StructStruct &struct_item) override;
     324                 :             :   virtual void visit (AST::TupleStruct &tuple_struct) override;
     325                 :             :   virtual void visit (AST::EnumItem &item) override;
     326                 :             :   virtual void visit (AST::EnumItemTuple &item) override;
     327                 :             :   virtual void visit (AST::EnumItemStruct &item) override;
     328                 :             :   virtual void visit (AST::EnumItemDiscriminant &item) override;
     329                 :             :   virtual void visit (AST::Enum &enum_item) override;
     330                 :             :   virtual void visit (AST::Union &union_item) override;
     331                 :             :   virtual void visit (AST::ConstantItem &const_item) override;
     332                 :             :   virtual void visit (AST::StaticItem &static_item) override;
     333                 :             :   virtual void visit (AST::TraitItemConst &item) override;
     334                 :             :   virtual void visit (AST::TraitItemType &item) override;
     335                 :             :   virtual void visit (AST::Trait &trait) override;
     336                 :             :   virtual void visit (AST::InherentImpl &impl) override;
     337                 :             :   virtual void visit (AST::TraitImpl &impl) override;
     338                 :             :   virtual void visit (AST::ExternalTypeItem &item) override;
     339                 :             :   virtual void visit (AST::ExternalStaticItem &item) override;
     340                 :             :   virtual void visit (AST::ExternBlock &block) override;
     341                 :             :   virtual void visit (AST::MacroMatchFragment &match) override;
     342                 :             :   virtual void visit (AST::MacroMatchRepetition &match) override;
     343                 :             :   virtual void visit (AST::MacroMatcher &matcher) override;
     344                 :             :   virtual void visit (AST::MacroRulesDefinition &rules_def) override;
     345                 :             :   virtual void visit (AST::MacroInvocation &macro_invoc) override;
     346                 :             :   virtual void visit (AST::MetaItemPath &meta_item) override;
     347                 :             :   virtual void visit (AST::MetaItemSeq &meta_item) override;
     348                 :             :   virtual void visit (AST::MetaWord &meta_item) override;
     349                 :             :   virtual void visit (AST::MetaNameValueStr &meta_item) override;
     350                 :             :   virtual void visit (AST::MetaListPaths &meta_item) override;
     351                 :             :   virtual void visit (AST::MetaListNameValueStr &meta_item) override;
     352                 :             :   virtual void visit (AST::LiteralPattern &pattern) override;
     353                 :             :   virtual void visit (AST::IdentifierPattern &pattern) override;
     354                 :             :   virtual void visit (AST::WildcardPattern &pattern) override;
     355                 :             :   virtual void visit (AST::RestPattern &pattern) override;
     356                 :             :   virtual void visit (AST::RangePatternBoundLiteral &bound) override;
     357                 :             :   virtual void visit (AST::RangePatternBoundPath &bound) override;
     358                 :             :   virtual void visit (AST::RangePatternBoundQualPath &bound) override;
     359                 :             :   virtual void visit (AST::RangePattern &pattern) override;
     360                 :             :   virtual void visit (AST::ReferencePattern &pattern) override;
     361                 :             :   virtual void visit (AST::StructPatternFieldTuplePat &field) override;
     362                 :             :   virtual void visit (AST::StructPatternFieldIdentPat &field) override;
     363                 :             :   virtual void visit (AST::StructPatternFieldIdent &field) override;
     364                 :             :   virtual void visit (AST::StructPattern &pattern) override;
     365                 :             :   virtual void visit (AST::TupleStructItemsNoRange &tuple_items) override;
     366                 :             :   virtual void visit (AST::TupleStructItemsRange &tuple_items) override;
     367                 :             :   virtual void visit (AST::TupleStructPattern &pattern) override;
     368                 :             :   virtual void visit (AST::TuplePatternItemsMultiple &tuple_items) override;
     369                 :             :   virtual void visit (AST::TuplePatternItemsRanged &tuple_items) override;
     370                 :             :   virtual void visit (AST::TuplePattern &pattern) override;
     371                 :             :   virtual void visit (AST::GroupedPattern &pattern) override;
     372                 :             :   virtual void visit (AST::SlicePattern &pattern) override;
     373                 :             :   virtual void visit (AST::AltPattern &pattern) override;
     374                 :             :   virtual void visit (AST::EmptyStmt &stmt) override;
     375                 :             :   virtual void visit (AST::LetStmt &stmt) override;
     376                 :             :   virtual void visit (AST::ExprStmt &stmt) override;
     377                 :             :   virtual void visit (AST::TraitBound &bound) override;
     378                 :             :   virtual void visit (AST::ImplTraitType &type) override;
     379                 :             :   virtual void visit (AST::TraitObjectType &type) override;
     380                 :             :   virtual void visit (AST::ParenthesisedType &type) override;
     381                 :             :   virtual void visit (AST::ImplTraitTypeOneBound &type) override;
     382                 :             :   virtual void visit (AST::TraitObjectTypeOneBound &type) override;
     383                 :             :   virtual void visit (AST::TupleType &type) override;
     384                 :             :   virtual void visit (AST::NeverType &type) override;
     385                 :             :   virtual void visit (AST::RawPointerType &type) override;
     386                 :             :   virtual void visit (AST::ReferenceType &type) override;
     387                 :             :   virtual void visit (AST::ArrayType &type) override;
     388                 :             :   virtual void visit (AST::SliceType &type) override;
     389                 :             :   virtual void visit (AST::InferredType &type) override;
     390                 :             :   virtual void visit (AST::BareFunctionType &type) override;
     391                 :             :   virtual void visit (AST::SelfParam &self) override;
     392                 :             :   virtual void visit (AST::FunctionParam &param) override;
     393                 :             :   virtual void visit (AST::VariadicParam &param) override;
     394                 :             :   virtual void visit (AST::FormatArgs &fmt) override;
     395                 :             : 
     396                 :     2671043 :   template <typename T> void visit (T &node) { node.accept_vis (*this); }
     397                 :             : 
     398                 :      480809 :   template <typename T> void visit (std::unique_ptr<T> &node)
     399                 :             :   {
     400                 :      480809 :     node->accept_vis (*this);
     401                 :       36800 :   }
     402                 :             : 
     403                 :             :   virtual void visit (AST::GenericArgsBinding &binding);
     404                 :             :   virtual void visit (AST::PathExprSegment &segment);
     405                 :             :   virtual void visit (AST::GenericArgs &args);
     406                 :             :   virtual void visit (AST::QualifiedPathType &path);
     407                 :             :   virtual void visit (AST::TypePathFunction &tpf);
     408                 :             :   virtual void visit (AST::PathIdentSegment &segment);
     409                 :             :   virtual void visit (AST::SimplePath &path);
     410                 :             :   virtual void visit (AST::SimplePathSegment &segment);
     411                 :             :   virtual void visit (AST::StructBase &base);
     412                 :             :   virtual void visit (AST::ClosureParam &param);
     413                 :             :   virtual void visit (AST::LoopLabel &label);
     414                 :             :   virtual void visit (AST::MatchCase &arm);
     415                 :             :   virtual void visit (AST::MatchArm &arm);
     416                 :             :   virtual void visit (AST::Visibility &vis);
     417                 :             :   virtual void visit (AST::FunctionQualifiers &qualifiers);
     418                 :             :   virtual void visit (AST::WhereClause &where);
     419                 :             :   virtual void visit (AST::StructField &field);
     420                 :             :   virtual void visit (AST::TupleField &field);
     421                 :             :   virtual void visit (AST::NamedFunctionParam &param);
     422                 :             :   virtual void visit (AST::MacroRule &rule);
     423                 :             :   virtual void visit (AST::MacroInvocData &data);
     424                 :             :   virtual void visit (AST::MacroTranscriber &transcriber);
     425                 :             :   virtual void visit (AST::StructPatternElements &spe);
     426                 :             :   virtual void visit (AST::MaybeNamedParam &param);
     427                 :             : 
     428                 :             :   void visit (AST::Attribute &attribute) {}
     429                 :             : 
     430                 :      122931 :   template <typename T> void visit_outer_attrs (T &node)
     431                 :             :   {
     432                 :     1555267 :     for (auto &attr : node.get_outer_attrs ())
     433                 :             :       visit (attr);
     434                 :             :   }
     435                 :             : 
     436                 :       87132 :   template <typename T> void visit_inner_attrs (T &node)
     437                 :             :   {
     438                 :       87132 :     for (auto &attr : node.get_inner_attrs ())
     439                 :             :       visit (attr);
     440                 :             :   }
     441                 :             : };
     442                 :             : 
     443                 :        3618 : class ContextualASTVisitor : public DefaultASTVisitor
     444                 :             : {
     445                 :             : protected:
     446                 :             :   enum class Context
     447                 :             :   {
     448                 :             :     FUNCTION,
     449                 :             :     INHERENT_IMPL,
     450                 :             :     TRAIT_IMPL,
     451                 :             :     TRAIT,
     452                 :             :     MODULE,
     453                 :             :     CRATE,
     454                 :             :   };
     455                 :             :   using DefaultASTVisitor::visit;
     456                 :             : 
     457                 :             :   virtual void visit (AST::Crate &crate) override;
     458                 :             : 
     459                 :             :   virtual void visit (AST::InherentImpl &impl) override;
     460                 :             : 
     461                 :             :   virtual void visit (AST::TraitImpl &impl) override;
     462                 :             : 
     463                 :             :   virtual void visit (AST::Trait &trait) override;
     464                 :             : 
     465                 :             :   template <typename T> void visit (T &item)
     466                 :             :   {
     467                 :             :     DefaultASTVisitor::visit (item);
     468                 :             :   }
     469                 :             : 
     470                 :             :   std::vector<Context> context;
     471                 :             : 
     472                 :        8833 :   void push_context (Context ctx) { context.push_back (ctx); }
     473                 :             : 
     474                 :        8833 :   void pop_context () { context.pop_back (); }
     475                 :             : };
     476                 :             : 
     477                 :             : } // namespace AST
     478                 :             : } // namespace Rust
     479                 :             : 
     480                 :             : #endif
        

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.