LCOV - code coverage report
Current view: top level - gcc/rust/checks/errors - rust-feature-gate.h (source / functions) Coverage Total Hit
Test: gcc.info Lines: 16.3 % 147 24
Test Date: 2024-12-21 13:15:12 Functions: 15.2 % 145 22
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_FEATURE_GATE_H
      20                 :             : #define RUST_FEATURE_GATE_H
      21                 :             : 
      22                 :             : #include "rust-ast-visitor.h"
      23                 :             : #include "rust-ast-full.h"
      24                 :             : #include "rust-feature.h"
      25                 :             : 
      26                 :             : namespace Rust {
      27                 :             : 
      28                 :        3618 : class FeatureGate : public AST::DefaultASTVisitor
      29                 :             : {
      30                 :             : public:
      31                 :        3618 :   FeatureGate () {}
      32                 :             : 
      33                 :             :   using AST::DefaultASTVisitor::visit;
      34                 :             : 
      35                 :             :   void check (AST::Crate &crate);
      36                 :             :   void visit (AST::Crate &crate) override;
      37                 :             : 
      38                 :           0 :   void visit (AST::Token &tok) override {}
      39                 :           0 :   void visit (AST::DelimTokenTree &delim_tok_tree) override {}
      40                 :           0 :   void visit (AST::AttrInputMetaItemContainer &input) override {}
      41                 :           0 :   void visit (AST::IdentifierExpr &ident_expr) override {}
      42                 :           0 :   void visit (AST::Lifetime &lifetime) override {}
      43                 :         126 :   void visit (AST::LifetimeParam &lifetime_param) override {}
      44                 :           2 :   void visit (AST::ConstGenericParam &const_param) override {}
      45                 :           0 :   void visit (AST::PathInExpression &path) override {}
      46                 :           0 :   void visit (AST::TypePathSegment &segment) override {}
      47                 :           0 :   void visit (AST::TypePathSegmentGeneric &segment) override {}
      48                 :           0 :   void visit (AST::TypePathSegmentFunction &segment) override {}
      49                 :        2689 :   void visit (AST::TypePath &path) override {}
      50                 :           0 :   void visit (AST::QualifiedPathInExpression &path) override {}
      51                 :           0 :   void visit (AST::QualifiedPathInType &path) override {}
      52                 :           0 :   void visit (AST::LiteralExpr &expr) override {}
      53                 :           0 :   void visit (AST::AttrInputLiteral &attr_input) override {}
      54                 :           0 :   void visit (AST::AttrInputMacro &attr_input) override {}
      55                 :           0 :   void visit (AST::MetaItemLitExpr &meta_item) override {}
      56                 :           0 :   void visit (AST::MetaItemPathLit &meta_item) override {}
      57                 :           0 :   void visit (AST::BorrowExpr &expr) override {}
      58                 :           0 :   void visit (AST::DereferenceExpr &expr) override {}
      59                 :           0 :   void visit (AST::ErrorPropagationExpr &expr) override {}
      60                 :           0 :   void visit (AST::NegationExpr &expr) override {}
      61                 :           0 :   void visit (AST::ArithmeticOrLogicalExpr &expr) override {}
      62                 :           0 :   void visit (AST::ComparisonExpr &expr) override {}
      63                 :           0 :   void visit (AST::LazyBooleanExpr &expr) override {}
      64                 :           0 :   void visit (AST::TypeCastExpr &expr) override {}
      65                 :           0 :   void visit (AST::AssignmentExpr &expr) override {}
      66                 :           0 :   void visit (AST::CompoundAssignmentExpr &expr) override {}
      67                 :           0 :   void visit (AST::GroupedExpr &expr) override {}
      68                 :           0 :   void visit (AST::ArrayElemsValues &elems) override {}
      69                 :           0 :   void visit (AST::ArrayElemsCopied &elems) override {}
      70                 :           0 :   void visit (AST::ArrayExpr &expr) override {}
      71                 :           0 :   void visit (AST::ArrayIndexExpr &expr) override {}
      72                 :           0 :   void visit (AST::TupleExpr &expr) override {}
      73                 :           0 :   void visit (AST::TupleIndexExpr &expr) override {}
      74                 :           0 :   void visit (AST::StructExprStruct &expr) override {}
      75                 :           0 :   void visit (AST::StructExprFieldIdentifier &field) override {}
      76                 :           0 :   void visit (AST::StructExprFieldIdentifierValue &field) override {}
      77                 :           0 :   void visit (AST::StructExprFieldIndexValue &field) override {}
      78                 :           0 :   void visit (AST::StructExprStructFields &expr) override {}
      79                 :           0 :   void visit (AST::StructExprStructBase &expr) override {}
      80                 :           0 :   void visit (AST::CallExpr &expr) override {}
      81                 :           0 :   void visit (AST::MethodCallExpr &expr) override {}
      82                 :           0 :   void visit (AST::FieldAccessExpr &expr) override {}
      83                 :           0 :   void visit (AST::ClosureExprInner &expr) override {}
      84                 :           0 :   void visit (AST::BlockExpr &expr) override {}
      85                 :           0 :   void visit (AST::ClosureExprInnerTyped &expr) override {}
      86                 :           0 :   void visit (AST::ContinueExpr &expr) override {}
      87                 :           0 :   void visit (AST::BreakExpr &expr) override {}
      88                 :           0 :   void visit (AST::RangeFromToExpr &expr) override {}
      89                 :           0 :   void visit (AST::RangeFromExpr &expr) override {}
      90                 :           0 :   void visit (AST::RangeToExpr &expr) override {}
      91                 :           0 :   void visit (AST::RangeFullExpr &expr) override {}
      92                 :           0 :   void visit (AST::RangeFromToInclExpr &expr) override {}
      93                 :           0 :   void visit (AST::RangeToInclExpr &expr) override {}
      94                 :           0 :   void visit (AST::ReturnExpr &expr) override {}
      95                 :           0 :   void visit (AST::UnsafeBlockExpr &expr) override {}
      96                 :           0 :   void visit (AST::LoopExpr &expr) override {}
      97                 :           0 :   void visit (AST::WhileLoopExpr &expr) override {}
      98                 :           0 :   void visit (AST::WhileLetLoopExpr &expr) override {}
      99                 :           0 :   void visit (AST::ForLoopExpr &expr) override {}
     100                 :           0 :   void visit (AST::IfExpr &expr) override {}
     101                 :           0 :   void visit (AST::IfExprConseqElse &expr) override {}
     102                 :           0 :   void visit (AST::IfLetExpr &expr) override {}
     103                 :           0 :   void visit (AST::IfLetExprConseqElse &expr) override {}
     104                 :           0 :   void visit (AST::MatchExpr &expr) override {}
     105                 :           0 :   void visit (AST::AwaitExpr &expr) override {}
     106                 :           0 :   void visit (AST::AsyncBlockExpr &expr) override {}
     107                 :         677 :   void visit (AST::TypeParam &param) override {}
     108                 :           0 :   void visit (AST::LifetimeWhereClauseItem &item) override {}
     109                 :          61 :   void visit (AST::TypeBoundWhereClauseItem &item) override {}
     110                 :         363 :   void visit (AST::Module &module) override {}
     111                 :          27 :   void visit (AST::ExternCrate &crate) override {}
     112                 :           0 :   void visit (AST::UseTreeGlob &use_tree) override {}
     113                 :           0 :   void visit (AST::UseTreeList &use_tree) override {}
     114                 :           0 :   void visit (AST::UseTreeRebind &use_tree) override {}
     115                 :          68 :   void visit (AST::UseDeclaration &use_decl) override {}
     116                 :             :   void visit (AST::Function &function) override;
     117                 :         811 :   void visit (AST::TypeAlias &type_alias) override {}
     118                 :         850 :   void visit (AST::StructStruct &struct_item) override {}
     119                 :         701 :   void visit (AST::TupleStruct &tuple_struct) override {}
     120                 :           0 :   void visit (AST::EnumItem &item) override {}
     121                 :           0 :   void visit (AST::EnumItemTuple &item) override {}
     122                 :           0 :   void visit (AST::EnumItemStruct &item) override {}
     123                 :           0 :   void visit (AST::EnumItemDiscriminant &item) override {}
     124                 :         159 :   void visit (AST::Enum &enum_item) override {}
     125                 :          96 :   void visit (AST::Union &union_item) override {}
     126                 :         420 :   void visit (AST::ConstantItem &const_item) override {}
     127                 :          43 :   void visit (AST::StaticItem &static_item) override {}
     128                 :           0 :   void visit (AST::TraitItemConst &item) override {}
     129                 :           0 :   void visit (AST::TraitItemType &item) override {}
     130                 :        2080 :   void visit (AST::Trait &trait) override {}
     131                 :             :   void visit (AST::ExternalTypeItem &item) override;
     132                 :           1 :   void visit (AST::ExternalStaticItem &item) override {}
     133                 :             :   void visit (AST::ExternBlock &block) override;
     134                 :           0 :   void visit (AST::MacroMatchFragment &match) override {}
     135                 :           0 :   void visit (AST::MacroMatchRepetition &match) override {}
     136                 :           0 :   void visit (AST::MacroMatcher &matcher) override {}
     137                 :             :   void visit (AST::MacroRulesDefinition &rules_def) override;
     138                 :           9 :   void visit (AST::MacroInvocation &macro_invoc) override {}
     139                 :           0 :   void visit (AST::MetaItemPath &meta_item) override {}
     140                 :           0 :   void visit (AST::MetaItemSeq &meta_item) override {}
     141                 :           0 :   void visit (AST::MetaWord &meta_item) override {}
     142                 :           0 :   void visit (AST::MetaNameValueStr &meta_item) override {}
     143                 :           0 :   void visit (AST::MetaListPaths &meta_item) override {}
     144                 :           0 :   void visit (AST::MetaListNameValueStr &meta_item) override {}
     145                 :           0 :   void visit (AST::LiteralPattern &pattern) override {}
     146                 :           0 :   void visit (AST::IdentifierPattern &pattern) override {}
     147                 :           0 :   void visit (AST::WildcardPattern &pattern) override {}
     148                 :           0 :   void visit (AST::RestPattern &pattern) override {}
     149                 :           0 :   void visit (AST::RangePatternBoundLiteral &bound) override {}
     150                 :           0 :   void visit (AST::RangePatternBoundPath &bound) override {}
     151                 :           0 :   void visit (AST::RangePatternBoundQualPath &bound) override {}
     152                 :           0 :   void visit (AST::RangePattern &pattern) override {}
     153                 :           0 :   void visit (AST::ReferencePattern &pattern) override {}
     154                 :           0 :   void visit (AST::StructPatternFieldTuplePat &field) override {}
     155                 :           0 :   void visit (AST::StructPatternFieldIdentPat &field) override {}
     156                 :           0 :   void visit (AST::StructPatternFieldIdent &field) override {}
     157                 :           0 :   void visit (AST::StructPattern &pattern) override {}
     158                 :           0 :   void visit (AST::TupleStructItemsNoRange &tuple_items) override {}
     159                 :           0 :   void visit (AST::TupleStructItemsRange &tuple_items) override {}
     160                 :           0 :   void visit (AST::TupleStructPattern &pattern) override {}
     161                 :           0 :   void visit (AST::TuplePatternItemsMultiple &tuple_items) override {}
     162                 :           0 :   void visit (AST::TuplePatternItemsRanged &tuple_items) override {}
     163                 :           0 :   void visit (AST::TuplePattern &pattern) override {}
     164                 :           0 :   void visit (AST::GroupedPattern &pattern) override {}
     165                 :           0 :   void visit (AST::SlicePattern &pattern) override {}
     166                 :           0 :   void visit (AST::AltPattern &pattern) override {}
     167                 :           0 :   void visit (AST::EmptyStmt &stmt) override {}
     168                 :           0 :   void visit (AST::LetStmt &stmt) override {}
     169                 :           0 :   void visit (AST::ExprStmt &stmt) override {}
     170                 :           0 :   void visit (AST::TraitBound &bound) override {}
     171                 :           0 :   void visit (AST::ImplTraitType &type) override {}
     172                 :           0 :   void visit (AST::TraitObjectType &type) override {}
     173                 :           0 :   void visit (AST::ParenthesisedType &type) override {}
     174                 :           0 :   void visit (AST::ImplTraitTypeOneBound &type) override {}
     175                 :           7 :   void visit (AST::TraitObjectTypeOneBound &type) override {}
     176                 :           0 :   void visit (AST::TupleType &type) override {}
     177                 :           0 :   void visit (AST::NeverType &type) override {}
     178                 :         103 :   void visit (AST::RawPointerType &type) override {}
     179                 :         196 :   void visit (AST::ReferenceType &type) override {}
     180                 :           0 :   void visit (AST::ArrayType &type) override {}
     181                 :          58 :   void visit (AST::SliceType &type) override {}
     182                 :           0 :   void visit (AST::InferredType &type) override {}
     183                 :           0 :   void visit (AST::BareFunctionType &type) override {}
     184                 :           0 :   void visit (AST::FunctionParam &param) override {}
     185                 :           0 :   void visit (AST::VariadicParam &param) override {}
     186                 :           0 :   void visit (AST::SelfParam &param) override {}
     187                 :             : 
     188                 :             : private:
     189                 :             :   void gate (Feature::Name name, location_t loc, const std::string &error_msg);
     190                 :             :   void check_rustc_attri (const std::vector<AST::Attribute> &attributes);
     191                 :             :   std::set<Feature::Name> valid_features;
     192                 :             : };
     193                 :             : } // namespace Rust
     194                 :             : #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.