LCOV - code coverage report
Current view: top level - gcc/rust/checks/errors/feature - rust-feature-collector.h Coverage Total Hit
Test: gcc.info Lines: 100.0 % 2 2
Test Date: 2026-03-28 14:25:54 Functions: - 0 0
Legend: Lines:     hit not hit

            Line data    Source code
       1              : // Copyright (C) 2026 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              : #ifndef RUST_FEATURE_COLLECTOR_H
      19              : #define RUST_FEATURE_COLLECTOR_H
      20              : 
      21              : #include "rust-feature.h"
      22              : #include "rust-ast-visitor.h"
      23              : 
      24              : namespace Rust {
      25              : namespace Features {
      26              : 
      27              : /** Helper structure gathering all features enabled within a given crate
      28              :  * using the #![feature(XXXXX)] syntax.
      29              :  **/
      30              : struct CrateFeatures
      31              : {
      32              :   // The node id identifying the crate those features belong to.
      33              :   NodeId crate_id;
      34              :   // Language features that have been declared within the crate.
      35              :   std::set<Feature::Name> valid_lang_features;
      36              :   // Library features that have been declared within the crate.
      37              :   std::map<std::string, location_t> valid_lib_features;
      38              : 
      39         4522 :   CrateFeatures (NodeId crate_id) : crate_id (crate_id) {}
      40              : };
      41              : 
      42         4522 : class FeatureCollector : public AST::DefaultASTVisitor
      43              : {
      44              : public:
      45              :   FeatureCollector ();
      46              : 
      47              :   CrateFeatures collect (AST::Crate &crate);
      48              : 
      49              : private:
      50              :   CrateFeatures features;
      51              : 
      52              :   using AST::DefaultASTVisitor::visit;
      53              :   void visit (AST::Crate &crate) override;
      54              :   void identify_feature (const AST::Attribute &attribute);
      55              :   void add_features_from_token_tree (const AST::DelimTokenTree &delim_ttree);
      56              :   void add_features_from_meta_item_container (
      57              :     const AST::AttrInputMetaItemContainer &meta_item_container);
      58              : };
      59              : } // namespace Features
      60              : } // namespace Rust
      61              : 
      62              : #endif /* ! RUST_FEATURE_COLLECTOR_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.