LCOV - code coverage report
Current view: top level - gcc/analyzer - pending-diagnostic.cc (source / functions) Hit Total Coverage
Test: gcc.info Lines: 20 20 100.0 %
Date: 2020-03-28 11:57:23 Functions: 2 2 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : /* Classes for analyzer diagnostics.
       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                 :            : #include "config.h"
      22                 :            : #include "system.h"
      23                 :            : #include "coretypes.h"
      24                 :            : #include "tree.h"
      25                 :            : #include "intl.h"
      26                 :            : #include "diagnostic.h"
      27                 :            : #include "function.h"
      28                 :            : #include "analyzer/analyzer.h"
      29                 :            : #include "diagnostic-event-id.h"
      30                 :            : #include "analyzer/analyzer-logging.h"
      31                 :            : #include "analyzer/sm.h"
      32                 :            : #include "diagnostic-event-id.h"
      33                 :            : #include "analyzer/sm.h"
      34                 :            : #include "analyzer/pending-diagnostic.h"
      35                 :            : 
      36                 :            : #if ENABLE_ANALYZER
      37                 :            : 
      38                 :            : namespace ana {
      39                 :            : 
      40                 :            : /* Generate a label_text by printing FMT.
      41                 :            : 
      42                 :            :    Use a clone of the global_dc for formatting callbacks.
      43                 :            : 
      44                 :            :    Use this evdesc::event_desc's m_colorize flag to control colorization
      45                 :            :    (so that e.g. we can disable it for JSON output).  */
      46                 :            : 
      47                 :            : label_text
      48                 :        973 : evdesc::event_desc::formatted_print (const char *fmt, ...) const
      49                 :            : {
      50                 :        973 :   pretty_printer *pp = global_dc->printer->clone ();
      51                 :            : 
      52                 :        973 :   pp_show_color (pp) = m_colorize;
      53                 :            : 
      54                 :        973 :   text_info ti;
      55                 :        973 :   rich_location rich_loc (line_table, UNKNOWN_LOCATION);
      56                 :        973 :   va_list ap;
      57                 :        973 :   va_start (ap, fmt);
      58                 :        973 :   ti.format_spec = _(fmt);
      59                 :        973 :   ti.args_ptr = &ap;
      60                 :        973 :   ti.err_no = 0;
      61                 :        973 :   ti.x_data = NULL;
      62                 :        973 :   ti.m_richloc = &rich_loc;
      63                 :        973 :   pp_format (pp, &ti);
      64                 :        973 :   pp_output_formatted_text (pp);
      65                 :        973 :   va_end (ap);
      66                 :            : 
      67                 :        973 :   label_text result = label_text::take (xstrdup (pp_formatted_text (pp)));
      68                 :        973 :   delete pp;
      69                 :        973 :   return result;
      70                 :            : }
      71                 :            : 
      72                 :            : /* Return true if T1 and T2 are "the same" for the purposes of
      73                 :            :    diagnostic deduplication.  */
      74                 :            : 
      75                 :            : bool
      76                 :        803 : pending_diagnostic::same_tree_p (tree t1, tree t2)
      77                 :            : {
      78                 :        803 :   return simple_cst_equal (t1, t2) == 1;
      79                 :            : }
      80                 :            : 
      81                 :            : } // namespace ana
      82                 :            : 
      83                 :            : #endif /* #if ENABLE_ANALYZER */

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.