LCOV - code coverage report
Current view: top level - gcc/analyzer - access-diagram.h (source / functions) Coverage Total Hit
Test: gcc.info Lines: 83.3 % 12 10
Test Date: 2026-11-14 16:39:50 Functions: 0.0 % 1 0
Legend: Lines:     hit not hit

            Line data    Source code
       1              : /* Text art visualizations within -fanalyzer.
       2              :    Copyright (C) 2023-2026 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_ACCESS_DIAGRAM_H
      22              : #define GCC_ANALYZER_ACCESS_DIAGRAM_H
      23              : 
      24              : #include "text-art/canvas.h"
      25              : #include "text-art/theme.h"
      26              : #include "text-art/widget.h"
      27              : 
      28              : #include "analyzer/store.h"
      29              : 
      30              : namespace ana {
      31              : 
      32              : class bit_size_expr
      33              : {
      34              : public:
      35          178 :   bit_size_expr (const symbolic_bit_size &num_bits) : m_num_bits (num_bits) {}
      36              : 
      37              :   std::unique_ptr<text_art::styled_string>
      38              :   maybe_get_formatted_str (text_art::style_manager &sm,
      39              :                            const region_model &model,
      40              :                            const char *concrete_single_bit_fmt,
      41              :                            const char *concrete_plural_bits_fmt,
      42              :                            const char *concrete_single_byte_fmt,
      43              :                            const char *concrete_plural_bytes_fmt,
      44              :                            const char *symbolic_bits_fmt,
      45              :                            const char *symbolic_bytes_fmt) const;
      46              :   bool maybe_print_for_user (pretty_printer *pp,
      47              :                              const region_model &model) const;
      48              : 
      49              : private:
      50              :   const symbolic_bit_size &m_num_bits;
      51              : };
      52              : 
      53              : struct access_operation
      54              : {
      55          621 :   access_operation (const region_model &model,
      56              :                     enum access_direction dir,
      57              :                     const symbolic::memory_range &attempted_range,
      58              :                     const svalue *sval_hint)
      59          621 :   : m_model (model),
      60          621 :     m_dir (dir),
      61          621 :     m_attempted_range (attempted_range),
      62          621 :     m_sval_hint (sval_hint)
      63              :   {}
      64              : 
      65          136 :   region_model_manager *get_manager () const
      66              :   {
      67          136 :     return m_model.get_manager ();
      68              :   }
      69              : 
      70              :   /* Get the valid bits to access within the base region.  */
      71              :   symbolic_bit_range get_valid_bits () const;
      72              : 
      73              :   /* Get the actual bits accessed within the base region.  */
      74              :   symbolic_bit_range get_actual_bits () const;
      75              : 
      76              :   bool maybe_get_invalid_before_bits (symbolic_bit_range *out) const;
      77              :   bool maybe_get_invalid_after_bits (symbolic_bit_range *out) const;
      78              : 
      79              :   const region &
      80          574 :   get_base_region () const { return m_attempted_range.get_base_region (); }
      81              : 
      82              :   const region_model &m_model;
      83              :   enum access_direction m_dir;
      84              :   symbolic::memory_range m_attempted_range;
      85              :   const svalue *m_sval_hint;
      86              : };
      87              : 
      88           68 : class access_diagram : public text_art::wrapper_widget
      89              : {
      90              : public:
      91              :   access_diagram (const access_operation &op,
      92              :                   diagnostics::paths::event_id_t region_creation_event_id,
      93              :                   text_art::style_manager &sm,
      94              :                   const text_art::theme &theme,
      95              :                   logger *logger);
      96            0 :   const char *get_desc () const override
      97              :   {
      98            0 :     return "access_diagram";
      99              :   }
     100              : };
     101              : 
     102              : } // namespace ana
     103              : 
     104              : #endif /* GCC_ANALYZER_ACCESS_DIAGRAM_H */
        

Generated by: LCOV version 2.5.0-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.