LCOV - code coverage report
Current view: top level - gcc/rust/checks/errors - rust-feature.cc (source / functions) Coverage Total Hit
Test: gcc.info Lines: 65.2 % 23 15
Test Date: 2024-05-04 14:01:55 Functions: 100.0 % 2 2
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                 :             : #include "rust-feature.h"
      20                 :             : #include "rust-session-manager.h"
      21                 :             : 
      22                 :             : namespace Rust {
      23                 :             : 
      24                 :             : Feature
      25                 :           5 : Feature::create (Feature::Name name)
      26                 :             : {
      27                 :           5 :   switch (name)
      28                 :             :     {
      29                 :           0 :     case Feature::Name::ASSOCIATED_TYPE_BOUNDS:
      30                 :           0 :       return Feature (Feature::Name::ASSOCIATED_TYPE_BOUNDS,
      31                 :             :                       Feature::State::ACCEPTED, "associated_type_bounds",
      32                 :           0 :                       "1.34.0", 52662, tl::nullopt, "");
      33                 :           2 :     case Feature::Name::INTRINSICS:
      34                 :           2 :       return Feature (Feature::Name::INTRINSICS, Feature::State::ACCEPTED,
      35                 :           2 :                       "intrinsics", "1.0.0", 0, tl::nullopt, "");
      36                 :           2 :     case Feature::Name::RUSTC_ATTRS:
      37                 :           2 :       return Feature (Feature::Name::RUSTC_ATTRS, Feature::State::ACCEPTED,
      38                 :           2 :                       "rustc_attrs", "1.0.0", 0, tl::nullopt, "");
      39                 :           0 :     case Feature::Name::DECL_MACRO:
      40                 :           0 :       return Feature (Feature::Name::DECL_MACRO, Feature::State::ACCEPTED,
      41                 :           0 :                       "decl_macro", "1.0.0", 0, tl::nullopt, "");
      42                 :           1 :     case Feature::Name::EXTERN_TYPES:
      43                 :           1 :       return Feature (Feature::Name::EXTERN_TYPES, Feature::State::ACTIVE,
      44                 :           1 :                       "extern_types", "1.23.0", 43467, tl::nullopt, "");
      45                 :           0 :     default:
      46                 :           0 :       rust_unreachable ();
      47                 :             :     }
      48                 :             : }
      49                 :             : 
      50                 :             : const std::map<std::string, Feature::Name> Feature::name_hash_map = {
      51                 :             :   {"associated_type_bounds", Feature::Name::ASSOCIATED_TYPE_BOUNDS},
      52                 :             :   {"intrinsics", Feature::Name::INTRINSICS},
      53                 :             :   {"rustc_attrs", Feature::Name::RUSTC_ATTRS},
      54                 :             :   {"decl_macro", Feature::Name::DECL_MACRO},
      55                 :             :   // TODO: Rename to "auto_traits" when supporting
      56                 :             :   // later Rust versions
      57                 :             :   {"optin_builtin_traits", Feature::Name::AUTO_TRAITS},
      58                 :             :   {"extern_types", Feature::Name::EXTERN_TYPES},
      59                 :             :   {"lang_items", Feature::Name::LANG_ITEMS},
      60                 :             :   {"no_core", Feature::Name::NO_CORE},
      61                 :             : }; // namespace Rust
      62                 :             : 
      63                 :             : tl::optional<Feature::Name>
      64                 :         354 : Feature::as_name (const std::string &name)
      65                 :             : {
      66                 :         354 :   if (Feature::name_hash_map.count (name))
      67                 :         351 :     return Feature::name_hash_map.at (name);
      68                 :             : 
      69                 :           3 :   return tl::nullopt;
      70                 :             : }
      71                 :             : 
      72                 :             : } // namespace Rust
        

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.