LCOV - code coverage report
Current view: top level - gcc/analyzer - call-string.h (source / functions) Hit Total Coverage
Test: gcc.info Lines: 7 7 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                 :            : /* Call stacks at program points.
       2                 :            :    Copyright (C) 2019-2020 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_CALL_STRING_H
      22                 :            : #define GCC_ANALYZER_CALL_STRING_H
      23                 :            : 
      24                 :            : namespace ana {
      25                 :            : 
      26                 :            : class supergraph;
      27                 :            : class call_superedge;
      28                 :            : class return_superedge;
      29                 :            : 
      30                 :            : /* A string of return_superedge pointers, representing a call stack
      31                 :            :    at a program point.
      32                 :            : 
      33                 :            :    This is used to ensure that we generate interprocedurally valid paths
      34                 :            :    i.e. that we return to the same callsite that called us.
      35                 :            : 
      36                 :            :    The class actually stores the return edges, rather than the call edges,
      37                 :            :    since that's what we need to compare against.  */
      38                 :            : 
      39                 :      39296 : class call_string
      40                 :            : {
      41                 :            : public:
      42                 :       1298 :   call_string () : m_return_edges () {}
      43                 :            :   call_string (const call_string &other);
      44                 :            :   call_string& operator= (const call_string &other);
      45                 :            : 
      46                 :            :   bool operator== (const call_string &other) const;
      47                 :            : 
      48                 :            :   void print (pretty_printer *pp) const;
      49                 :            : 
      50                 :            :   hashval_t hash () const;
      51                 :            : 
      52                 :      94296 :   bool empty_p () const { return m_return_edges.is_empty (); }
      53                 :            : 
      54                 :            :   void push_call (const supergraph &sg,
      55                 :            :                   const call_superedge *sedge);
      56                 :        557 :   const return_superedge *pop () { return m_return_edges.pop (); }
      57                 :            : 
      58                 :            :   int calc_recursion_depth () const;
      59                 :            : 
      60                 :            :   static int cmp (const call_string &a,
      61                 :            :                   const call_string &b);
      62                 :            : 
      63                 :     439369 :   unsigned length () const { return m_return_edges.length (); }
      64                 :      39744 :   const return_superedge *operator[] (unsigned idx) const
      65                 :            :   {
      66                 :      39744 :     return m_return_edges[idx];
      67                 :            :   }
      68                 :            : 
      69                 :            :   void validate () const;
      70                 :            : 
      71                 :            : private:
      72                 :            :   auto_vec<const return_superedge *> m_return_edges;
      73                 :            : };
      74                 :            : 
      75                 :            : } // namespace ana
      76                 :            : 
      77                 :            : #endif /* GCC_ANALYZER_CALL_STRING_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.