LCOV - code coverage report
Current view: top level - gcc/analyzer - call-info.h (source / functions) Coverage Total Hit
Test: gcc.info Lines: 72.7 % 11 8
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                 :             : /* Subclasses of custom_edge_info for describing outcomes of function calls.
       2                 :             :    Copyright (C) 2021-2024 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_INFO_H
      22                 :             : #define GCC_ANALYZER_CALL_INFO_H
      23                 :             : 
      24                 :             : namespace ana {
      25                 :             : 
      26                 :             : /* Subclass of custom_edge_info for an outcome of a call.
      27                 :             :    This is still abstract; the update_model and get_desc vfuncs must be
      28                 :             :    implemented.  */
      29                 :             : 
      30                 :           0 : class call_info : public custom_edge_info
      31                 :             : {
      32                 :             : public:
      33                 :             :   void print (pretty_printer *pp) const final override;
      34                 :             :   void add_events_to_path (checker_path *emission_path,
      35                 :             :                            const exploded_edge &eedge) const final override;
      36                 :             : 
      37                 :         345 :   const gcall *get_call_stmt () const { return m_call_stmt; }
      38                 :         566 :   tree get_fndecl () const { return m_fndecl; }
      39                 :             : 
      40                 :             :   virtual label_text get_desc (bool can_colorize) const = 0;
      41                 :             : 
      42                 :             :   call_details get_call_details (region_model *model,
      43                 :             :                                  region_model_context *ctxt) const;
      44                 :             : 
      45                 :             : protected:
      46                 :             :   call_info (const call_details &cd);
      47                 :             :   call_info (const call_details &cd, const function &called_fn);
      48                 :             : 
      49                 :             : private:
      50                 :             :   const gcall *m_call_stmt;
      51                 :             :   tree m_fndecl;
      52                 :             : };
      53                 :             : 
      54                 :             : /* Subclass of call_info for a "success" outcome of a call,
      55                 :             :    adding either a
      56                 :             :      "when `FNDECL' succeeds" message (when 'success' is true)
      57                 :             :    or a
      58                 :             :      "when `FNDECL' fails" message    (when 'success' is false).
      59                 :             :    This is still abstract: the custom_edge_info::update_model vfunc
      60                 :             :    must be implemented.  */
      61                 :             : 
      62                 :           0 : class succeed_or_fail_call_info : public call_info
      63                 :             : {
      64                 :             : public:
      65                 :             :   label_text get_desc (bool can_colorize) const final override;
      66                 :             : 
      67                 :             : protected:
      68                 :        2018 :   succeed_or_fail_call_info (const call_details &cd, bool success)
      69                 :        2526 :    : call_info (cd), m_success (success) {}
      70                 :             : 
      71                 :             :   bool m_success;
      72                 :             : };
      73                 :             : 
      74                 :             : /* Subclass of call_info for a "success" outcome of a call,
      75                 :             :    adding a "when `FNDECL' succeeds" message.
      76                 :             :    This is still abstract: the custom_edge_info::update_model vfunc
      77                 :             :    must be implemented.  */
      78                 :             : 
      79                 :             : class success_call_info : public succeed_or_fail_call_info
      80                 :             : {
      81                 :             : protected:
      82                 :           9 :   success_call_info (const call_details &cd)
      83                 :           9 :   : succeed_or_fail_call_info (cd, true)
      84                 :             :   {}
      85                 :             : };
      86                 :             : 
      87                 :             : /* Subclass of call_info for a "failure" outcome of a call,
      88                 :             :    adding a "when `FNDECL' fails" message.
      89                 :             :    This is still abstract: the custom_edge_info::update_model vfunc
      90                 :             :    must be implemented.  */
      91                 :             : 
      92                 :           0 : class failed_call_info : public succeed_or_fail_call_info
      93                 :             : {
      94                 :             : protected:
      95                 :         535 :   failed_call_info (const call_details &cd)
      96                 :         535 :   : succeed_or_fail_call_info (cd, false)
      97                 :             :   {}
      98                 :             : };
      99                 :             : 
     100                 :             : } // namespace ana
     101                 :             : 
     102                 :             : #endif /* GCC_ANALYZER_CALL_INFO_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.