LCOV - code coverage report
Current view: top level - gcc/rust/checks/errors/privacy - rust-privacy-common.h (source / functions) Coverage Total Hit
Test: gcc.info Lines: 100.0 % 7 7
Test Date: 2024-04-20 14:03:02 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                 :             : #include "rust-mapping-common.h"
      20                 :             : 
      21                 :             : namespace Rust {
      22                 :             : namespace Privacy {
      23                 :             : 
      24                 :             : /**
      25                 :             :  * Visibility class related specifically to DefIds. This class allows defining
      26                 :             :  * the visibility of an item with regard to a specific module.
      27                 :             :  *
      28                 :             :  * Items are either public throughout a crate, or restricted to a specific
      29                 :             :  * module. Private items are simply restricted to the current module.
      30                 :             :  */
      31                 :             : class ModuleVisibility
      32                 :             : {
      33                 :             : public:
      34                 :             :   enum Type
      35                 :             :   {
      36                 :             :     Unknown,
      37                 :             :     Public,
      38                 :             :     Restricted,
      39                 :             :   };
      40                 :             : 
      41                 :       52516 :   ModuleVisibility () : kind (Unknown), module_id (UNKNOWN_DEFID) {}
      42                 :             : 
      43                 :        9420 :   static ModuleVisibility create_restricted (DefId module_id)
      44                 :             :   {
      45                 :        9420 :     return ModuleVisibility (Type::Restricted, module_id);
      46                 :             :   }
      47                 :             : 
      48                 :        6889 :   static ModuleVisibility create_public ()
      49                 :             :   {
      50                 :        6889 :     return ModuleVisibility (Type::Public, UNKNOWN_DEFID);
      51                 :             :   }
      52                 :             : 
      53                 :        4591 :   Type get_kind () const { return kind; }
      54                 :             : 
      55                 :             :   const DefId &get_module_id () const { return module_id; }
      56                 :             :   DefId &get_module_id () { return module_id; }
      57                 :             : 
      58                 :             : private:
      59                 :       16309 :   ModuleVisibility (Type kind, DefId module_id)
      60                 :             :     : kind (kind), module_id (module_id)
      61                 :             :   {}
      62                 :             : 
      63                 :             :   Type kind;
      64                 :             :   DefId module_id;
      65                 :             : };
      66                 :             : } // namespace Privacy
      67                 :             : } // 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.