LCOV - code coverage report
Current view: top level - gcc - tree-pretty-print-markup.h (source / functions) Coverage Total Hit
Test: gcc.info Lines: 100.0 % 17 17
Test Date: 2024-12-21 13:15:12 Functions: 100.0 % 1 1
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: - 0 0

             Branch data     Line data    Source code
       1                 :             : /* Copyright (C) 2024 Free Software Foundation, Inc.
       2                 :             :    Contributed by David Malcolm <dmalcolm@redhat.com>
       3                 :             : 
       4                 :             : This file is part of GCC.
       5                 :             : 
       6                 :             : GCC is free software; you can redistribute it and/or modify it under
       7                 :             : the terms of the GNU General Public License as published by the Free
       8                 :             : Software Foundation; either version 3, or (at your option) any later
       9                 :             : version.
      10                 :             : 
      11                 :             : GCC is distributed in the hope that it will be useful, but WITHOUT ANY
      12                 :             : WARRANTY; without even the implied warranty of MERCHANTABILITY or
      13                 :             : FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
      14                 :             : for more details.
      15                 :             : 
      16                 :             : You should have received a copy of the GNU General Public License
      17                 :             : along with GCC; see the file COPYING3.  If not see
      18                 :             : <http://www.gnu.org/licenses/>.  */
      19                 :             : 
      20                 :             : #ifndef GCC_TREE_PRETTY_PRINT_MARKUP_H
      21                 :             : #define GCC_TREE_PRETTY_PRINT_MARKUP_H
      22                 :             : 
      23                 :             : #include "pretty-print-markup.h"
      24                 :             : #include "diagnostic-highlight-colors.h"
      25                 :             : 
      26                 :             : namespace pp_markup {
      27                 :             : 
      28                 :             : /* Concrete subclass of pp_markup::element.
      29                 :             :    Print a type in quotes with the given highlighting color.  */
      30                 :             : 
      31                 :        2793 : class element_quoted_type : public element
      32                 :             : {
      33                 :             : public:
      34                 :        2814 :   element_quoted_type (tree type, const char *highlight_color)
      35                 :        2814 :   : m_type (type),
      36                 :        2793 :     m_highlight_color (highlight_color)
      37                 :             :   {
      38                 :             :   }
      39                 :             : 
      40                 :        4368 :   void add_to_phase_2 (context &ctxt) override
      41                 :             :   {
      42                 :        4368 :     ctxt.begin_quote ();
      43                 :        4368 :     ctxt.begin_highlight_color (m_highlight_color);
      44                 :             : 
      45                 :        4368 :     print_type (ctxt);
      46                 :             : 
      47                 :        4368 :     ctxt.end_highlight_color ();
      48                 :        4368 :     ctxt.end_quote ();
      49                 :        4368 :   }
      50                 :             : 
      51                 :             :   void print_type (context &ctxt);
      52                 :             : 
      53                 :             : private:
      54                 :             :   tree m_type;
      55                 :             :   const char *m_highlight_color;
      56                 :             : };
      57                 :             : 
      58                 :             : /* Concrete subclass of pp_markup::element.
      59                 :             :    Print a type in quotes highlighted as the "expected" type.  */
      60                 :             : 
      61                 :        2214 : class element_expected_type : public element_quoted_type
      62                 :             : {
      63                 :             : public:
      64                 :        2214 :   element_expected_type (tree type)
      65                 :        2214 :   : element_quoted_type (type, highlight_colors::expected)
      66                 :             :   {
      67                 :             :   }
      68                 :             : };
      69                 :             : 
      70                 :             : /* Concrete subclass of pp_markup::element.
      71                 :             :    Print a type in quotes highlighted as the "actual" type.  */
      72                 :             : 
      73                 :        2214 : class element_actual_type : public element_quoted_type
      74                 :             : {
      75                 :             : public:
      76                 :        2214 :   element_actual_type (tree type)
      77                 :        2214 :   : element_quoted_type (type, highlight_colors::actual)
      78                 :             :   {
      79                 :             :   }
      80                 :             : };
      81                 :             : 
      82                 :             : } // namespace pp_markup
      83                 :             : 
      84                 :             : #endif /* GCC_TREE_PRETTY_PRINT_MARKUP_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.