LCOV - code coverage report
Current view: top level - gcc/cp - type-utils.h (source / functions) Hit Total Coverage
Test: gcc.info Lines: 12 12 100.0 %
Date: 2020-03-28 11:57:23 Functions: 1 1 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : /* Utilities for querying and manipulating type trees.
       2                 :            :    Copyright (C) 2013-2020 Free Software Foundation, Inc.
       3                 :            : 
       4                 :            : This file is part of GCC.
       5                 :            : 
       6                 :            : GCC is free software; you can redistribute it and/or modify
       7                 :            : it under the terms of the GNU General Public License as published by
       8                 :            : the Free Software Foundation; either version 3, or (at your option)
       9                 :            : any later version.
      10                 :            : 
      11                 :            : GCC is distributed in the hope that it will be useful,
      12                 :            : but WITHOUT ANY WARRANTY; without even the implied warranty of
      13                 :            : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      14                 :            : GNU General Public License for more details.
      15                 :            : 
      16                 :            : You should have received a copy of the GNU General Public License
      17                 :            : along with GCC; see the file COPYING3.  If not see
      18                 :            : <http://www.gnu.org/licenses/>.  */
      19                 :            : 
      20                 :            : #ifndef GCC_CP_TYPE_UTILS_H
      21                 :            : #define GCC_CP_TYPE_UTILS_H
      22                 :            : 
      23                 :            : /* Returns a pointer to the first tree within *TP that is directly matched by
      24                 :            :    PRED.  *TP may be a type or PARM_DECL and is incrementally decomposed toward
      25                 :            :    its type-specifier until a match is found.  NULL is returned if PRED does not
      26                 :            :    match any part of *TP.
      27                 :            : 
      28                 :            :    This is primarily intended for detecting whether *TP uses `auto' or a concept
      29                 :            :    identifier.  Since either of these can only appear as a type-specifier for
      30                 :            :    the declaration in question, only top-level qualifications are traversed;
      31                 :            :    find_type_usage does not look through the whole type.  */
      32                 :            : 
      33                 :            : inline tree *
      34                 :  247157000 : find_type_usage (tree *tp, bool (*pred) (const_tree))
      35                 :            : {
      36                 :  303440000 :   tree t = *tp;
      37                 :  303440000 :   if (pred (t))
      38                 :            :     return tp;
      39                 :            : 
      40                 :  302393000 :   enum tree_code code = TREE_CODE (t);
      41                 :            : 
      42                 :  302393000 :   if (code == POINTER_TYPE || code == REFERENCE_TYPE
      43                 :  302393000 :       || code == PARM_DECL || code == OFFSET_TYPE
      44                 :  268781000 :       || code == FUNCTION_TYPE || code == METHOD_TYPE
      45                 :  256449000 :       || code == ARRAY_TYPE)
      46                 :   55824200 :     return find_type_usage (&TREE_TYPE (t), pred);
      47                 :            : 
      48                 :  246568000 :   if (TYPE_PTRMEMFUNC_P (t))
      49                 :     458779 :     return find_type_usage
      50                 :     458779 :       (&TREE_TYPE (TYPE_PTRMEMFUNC_FN_TYPE (t)), pred);
      51                 :            : 
      52                 :            :   return NULL;
      53                 :            : }
      54                 :            : 
      55                 :            : #endif // GCC_CP_TYPE_UTILS_H

Generated by: LCOV version 1.0

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 --enable-host-shared. GCC test suite is run with the built compiler.