LCOV - code coverage report
Current view: top level - gcc - selftest-logical-location.h (source / functions) Coverage Total Hit
Test: gcc.info Lines: 66.7 % 6 4
Test Date: 2025-06-21 16:26:05 Functions: 0.0 % 1 0
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: - 0 0

             Branch data     Line data    Source code
       1                 :             : /* Concrete subclass of logical_location for use in selftests.
       2                 :             :    Copyright (C) 2024-2025 Free Software Foundation, Inc.
       3                 :             :    Contributed by David Malcolm <dmalcolm@redhat.com>.
       4                 :             : 
       5                 :             : This file is part of GCC.
       6                 :             : 
       7                 :             : GCC is free software; you can redistribute it and/or modify it under
       8                 :             : the terms of the GNU General Public License as published by the Free
       9                 :             : Software Foundation; either version 3, or (at your option) any later
      10                 :             : version.
      11                 :             : 
      12                 :             : GCC is distributed in the hope that it will be useful, but WITHOUT ANY
      13                 :             : WARRANTY; without even the implied warranty of MERCHANTABILITY or
      14                 :             : FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
      15                 :             : for more details.
      16                 :             : 
      17                 :             : You should have received a copy of the GNU General Public License
      18                 :             : along with GCC; see the file COPYING3.  If not see
      19                 :             : <http://www.gnu.org/licenses/>.  */
      20                 :             : 
      21                 :             : #ifndef GCC_SELFTEST_LOGICAL_LOCATION_H
      22                 :             : #define GCC_SELFTEST_LOGICAL_LOCATION_H
      23                 :             : 
      24                 :             : #include "logical-location.h"
      25                 :             : 
      26                 :             : /* The selftest code should entirely disappear in a production
      27                 :             :    configuration, hence we guard all of it with #if CHECKING_P.  */
      28                 :             : 
      29                 :             : #if CHECKING_P
      30                 :             : 
      31                 :             : namespace selftest {
      32                 :             : 
      33                 :             : /* Concrete subclass of logical_location_manager for use in selftests.  */
      34                 :             : 
      35                 :             : class test_logical_location_manager : public logical_location_manager
      36                 :             : {
      37                 :             : public:
      38                 :             :   ~test_logical_location_manager ();
      39                 :             : 
      40                 :             :   const char *get_short_name (key) const final override;
      41                 :             :   const char *get_name_with_scope (key) const final override;
      42                 :             :   const char *get_internal_name (key) const final override;
      43                 :             :   enum logical_location_kind get_kind (key) const final override;
      44                 :             :   label_text get_name_for_path_output (key) const final override;
      45                 :           0 :   key get_parent (key) const final override
      46                 :             :   {
      47                 :           0 :     return key ();
      48                 :             :   }
      49                 :             : 
      50                 :             :   logical_location
      51                 :             :   logical_location_from_funcname (const char *funcname);
      52                 :             : 
      53                 :             : private:
      54                 :             :   struct item
      55                 :             :   {
      56                 :          48 :     item (enum logical_location_kind kind,
      57                 :             :           const char *name)
      58                 :          48 :     : m_kind (kind),
      59                 :          48 :       m_name (name)
      60                 :             :     {
      61                 :             :     }
      62                 :             : 
      63                 :             :     enum logical_location_kind m_kind;
      64                 :             :     const char *m_name;
      65                 :             :   };
      66                 :             : 
      67                 :             :   const item *
      68                 :             :   item_from_funcname (const char *funcname);
      69                 :             : 
      70                 :             :   static const item *item_from_key (logical_location k)
      71                 :             :   {
      72                 :           8 :     return k.cast_to<const item *> ();
      73                 :             :   }
      74                 :             : 
      75                 :             :   hash_map<nofree_string_hash, item *> m_name_to_item_map;
      76                 :             : };
      77                 :             : 
      78                 :             : } // namespace selftest
      79                 :             : 
      80                 :             : #endif /* #if CHECKING_P */
      81                 :             : 
      82                 :             : 
      83                 :             : #endif /* GCC_SELFTEST_LOGICAL_LOCATION_H.  */
        

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.