LCOV - code coverage report
Current view: top level - gcc/analyzer - complexity.h Coverage Total Hit
Test: gcc.info Lines: 100.0 % 5 5
Test Date: 2026-11-14 16:39:50 Functions: - 0 0
Legend: Lines:     hit not hit

            Line data    Source code
       1              : /* Measuring the complexity of symbolic nodes.
       2              :    Copyright (C) 2020-2026 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
       8              : under the terms of the GNU General Public License as published by
       9              : the Free Software Foundation; either version 3, or (at your option)
      10              : any later version.
      11              : 
      12              : GCC is distributed in the hope that it will be useful, but
      13              : WITHOUT ANY WARRANTY; without even the implied warranty of
      14              : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      15              : General Public License 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_ANALYZER_COMPLEXITY_H
      22              : #define GCC_ANALYZER_COMPLEXITY_H
      23              : 
      24              : namespace ana {
      25              : 
      26              : /* A measurement of the complexity of a symbolic node, so that
      27              :    we can impose bounds on the growth of these tree-like structures
      28              :    and thus avoid infinite chains of analysis.  */
      29              : 
      30              : struct complexity
      31              : {
      32      1588510 :   complexity (unsigned num_nodes, unsigned max_depth)
      33        48664 :   : m_num_nodes (num_nodes), m_max_depth (max_depth)
      34              :   {}
      35              : 
      36              :   complexity (const symbolic::node &n);
      37              :   complexity (const region *reg);
      38              :   complexity (const svalue *sval);
      39              : 
      40              :   static complexity
      41              :   from_pair (const complexity &c1, const complexity &c);
      42              : 
      43              :   static complexity
      44              :   from_vec_svalue (const vec<const svalue *> &vec);
      45              : 
      46              :   static complexity
      47              :   from_child_complexities (const complexity &child_complexities);
      48              : 
      49              :   bool
      50           12 :   operator== (const complexity &other) const
      51              :   {
      52           12 :     return (m_num_nodes == other.m_num_nodes
      53           12 :             && m_max_depth == other.m_max_depth);
      54              :   }
      55              : 
      56              :   complexity
      57              :   operator+ (const complexity &other) const;
      58              : 
      59              :   complexity &
      60              :   operator+= (const complexity &other);
      61              : 
      62              :   /* The total number of nodes in the tree of this
      63              :      entity, including the entity itself.  */
      64              :   unsigned m_num_nodes;
      65              : 
      66              :   /* The maximum depth of the tree of this entity, including the
      67              :      entity itself.  */
      68              :   unsigned m_max_depth;
      69              : };
      70              : 
      71              : } // namespace ana
      72              : 
      73              : #endif /* GCC_ANALYZER_COMPLEXITY_H */
        

Generated by: LCOV version 2.5.0-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.