LCOV - code coverage report
Current view: top level - gcc/text-art - tree-widget.h (source / functions) Coverage Total Hit
Test: gcc.info Lines: 100.0 % 9 9
Test Date: 2025-03-08 13:07:09 Functions: - 0 0
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: - 0 0

             Branch data     Line data    Source code
       1                 :             : /* Tree diagrams.
       2                 :             :    Copyright (C) 2024-2025 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_TEXT_ART_TREE_WIDGET_H
      22                 :             : #define GCC_TEXT_ART_TREE_WIDGET_H
      23                 :             : 
      24                 :             : #include "text-art/canvas.h"
      25                 :             : #include "text-art/widget.h"
      26                 :             : 
      27                 :             : namespace text_art {
      28                 :             : 
      29                 :             : class dump_widget_info;
      30                 :             : 
      31                 :             : class tree_widget : public widget
      32                 :             : {
      33                 :             : public:
      34                 :         120 :   tree_widget (std::unique_ptr<widget> node,
      35                 :             :                const theme &theme,
      36                 :             :                style::id_t style_id)
      37                 :         120 :   : m_node (std::move (node)),
      38                 :         120 :     m_theme (theme),
      39                 :         120 :     m_style_id (style_id)
      40                 :             :   {
      41                 :             :   }
      42                 :             : 
      43                 :             :   static std::unique_ptr<tree_widget>
      44                 :             :   make (styled_string str, const theme &theme, style::id_t style_id);
      45                 :             : 
      46                 :             :   static std::unique_ptr<tree_widget>
      47                 :             :   make (const dump_widget_info &dwi, pretty_printer *pp);
      48                 :             : 
      49                 :             :   static std::unique_ptr<tree_widget>
      50                 :             :   make (const dump_widget_info &dwi, const char *str);
      51                 :             : 
      52                 :             :   static std::unique_ptr<tree_widget>
      53                 :             :   from_fmt (const dump_widget_info &dwi,
      54                 :             :             printer_fn format_decoder,
      55                 :             :             const char *fmt, ...)
      56                 :             :     ATTRIBUTE_GCC_PPDIAG(3, 4);
      57                 :             : 
      58                 :             :   const char *get_desc () const override;
      59                 :             :   canvas::size_t calc_req_size () final override;
      60                 :             :   void update_child_alloc_rects () final override;
      61                 :             :   void paint_to_canvas (canvas &canvas) final override;
      62                 :             : 
      63                 :         112 :   void add_child (std::unique_ptr<widget> child)
      64                 :             :   {
      65                 :         112 :     if (child)
      66                 :         104 :       m_children.push_back (std::move (child));
      67                 :             :   }
      68                 :             : 
      69                 :           4 :   size_t get_num_children () const
      70                 :             :   {
      71                 :           4 :     return m_children.size ();
      72                 :             :   }
      73                 :             : 
      74                 :             : private:
      75                 :             :   std::unique_ptr<widget> m_node;
      76                 :             :   std::vector<std::unique_ptr<widget>> m_children;
      77                 :             :   const theme &m_theme;
      78                 :             :   style::id_t m_style_id;
      79                 :             : };
      80                 :             : 
      81                 :             : } // namespace text_art
      82                 :             : 
      83                 :             : #endif /* GCC_TEXT_ART_TREE_WIDGET_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.