LCOV - code coverage report
Current view: top level - gcc - graphviz.cc (source / functions) Coverage Total Hit
Test: gcc.info Lines: 100.0 % 50 50
Test Date: 2024-09-28 13:20:55 Functions: 100.0 % 10 10
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: - 0 0

             Branch data     Line data    Source code
       1                 :             : /* Helper code for graphviz output.
       2                 :             :    Copyright (C) 2019-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                 :             : #include "config.h"
      22                 :             : #include "system.h"
      23                 :             : #include "coretypes.h"
      24                 :             : #include "graphviz.h"
      25                 :             : 
      26                 :             : /* graphviz_out's ctor, wrapping PP.  */
      27                 :             : 
      28                 :          40 : graphviz_out::graphviz_out (pretty_printer *pp)
      29                 :          40 : : m_pp (pp),
      30                 :          40 :   m_indent (0)
      31                 :             : {
      32                 :          40 : }
      33                 :             : 
      34                 :             : /* Formatted print of FMT.  */
      35                 :             : 
      36                 :             : void
      37                 :        1392 : graphviz_out::print (const char *fmt, ...)
      38                 :             : {
      39                 :        1392 :   va_list ap;
      40                 :             : 
      41                 :        1392 :   va_start (ap, fmt);
      42                 :        1392 :   text_info text (fmt, &ap, errno);
      43                 :        1392 :   pp_format (m_pp, &text);
      44                 :        1392 :   pp_output_formatted_text (m_pp);
      45                 :        1392 :   va_end (ap);
      46                 :        1392 : }
      47                 :             : 
      48                 :             : /* Formatted print of FMT.  The text is indented by the current
      49                 :             :    indent, and a newline is added.  */
      50                 :             : 
      51                 :             : void
      52                 :        4264 : graphviz_out::println (const char *fmt, ...)
      53                 :             : {
      54                 :        4264 :   va_list ap;
      55                 :             : 
      56                 :        4264 :   write_indent ();
      57                 :             : 
      58                 :        4264 :   va_start (ap, fmt);
      59                 :        4264 :   text_info text (fmt, &ap, errno);
      60                 :        4264 :   pp_format (m_pp, &text);
      61                 :        4264 :   pp_output_formatted_text (m_pp);
      62                 :        4264 :   va_end (ap);
      63                 :             : 
      64                 :        4264 :   pp_newline (m_pp);
      65                 :        4264 : }
      66                 :             : 
      67                 :             : /* Print the current indent to the underlying pp.  */
      68                 :             : 
      69                 :             : void
      70                 :        5208 : graphviz_out::write_indent ()
      71                 :             : {
      72                 :       27568 :   for (int i = 0; i < m_indent * 2; ++i)
      73                 :       22360 :     pp_space (m_pp);
      74                 :        5208 : }
      75                 :             : 
      76                 :             : /* Write the start of an HTML-like row via <TR>, writing to the stream
      77                 :             :    so that followup text can be escaped.  */
      78                 :             : 
      79                 :             : void
      80                 :         565 : graphviz_out::begin_tr ()
      81                 :             : {
      82                 :         565 :   pp_string (m_pp, "<TR>");
      83                 :         565 :   pp_write_text_to_stream (m_pp);
      84                 :         565 : }
      85                 :             : 
      86                 :             : /* Write the end of an HTML-like row via </TR>, writing to the stream
      87                 :             :    so that followup text can be escaped.  */
      88                 :             : 
      89                 :             : void
      90                 :         557 : graphviz_out::end_tr ()
      91                 :             : {
      92                 :         557 :   pp_string (m_pp, "</TR>");
      93                 :         557 :   pp_write_text_to_stream (m_pp);
      94                 :         557 : }
      95                 :             : 
      96                 :             : /* Write the start of an HTML-like <TD>, writing to the stream
      97                 :             :    so that followup text can be escaped.  */
      98                 :             : 
      99                 :             : void
     100                 :         600 : graphviz_out::begin_td ()
     101                 :             : {
     102                 :         600 :   pp_string (m_pp, "<TD ALIGN=\"LEFT\">");
     103                 :         600 :   pp_write_text_to_stream (m_pp);
     104                 :         600 : }
     105                 :             : 
     106                 :             : /* Write the end of an HTML-like </TD>, writing to the stream
     107                 :             :    so that followup text can be escaped.  */
     108                 :             : 
     109                 :             : void
     110                 :         600 : graphviz_out::end_td ()
     111                 :             : {
     112                 :         600 :   pp_string (m_pp, "</TD>");
     113                 :         600 :   pp_write_text_to_stream (m_pp);
     114                 :         600 : }
     115                 :             : 
     116                 :             : /* Write the start of an HTML-like row via <TR><TD>, writing to the stream
     117                 :             :    so that followup text can be escaped.  */
     118                 :             : 
     119                 :             : void
     120                 :         746 : graphviz_out::begin_trtd ()
     121                 :             : {
     122                 :         746 :   pp_string (m_pp, "<TR><TD ALIGN=\"LEFT\">");
     123                 :         746 :   pp_write_text_to_stream (m_pp);
     124                 :         746 : }
     125                 :             : 
     126                 :             : /* Write the end of an HTML-like row via </TD></TR>, writing to the stream
     127                 :             :    so that followup text can be escaped.  */
     128                 :             : 
     129                 :             : void
     130                 :         754 : graphviz_out::end_tdtr ()
     131                 :             : {
     132                 :         754 :   pp_string (m_pp, "</TD></TR>");
     133                 :         754 :   pp_write_text_to_stream (m_pp);
     134                 :         754 : }
        

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.