LCOV - code coverage report
Current view: top level - gcc - diagnostic-context-rich-location.h Coverage Total Hit
Test: gcc.info Lines: 100.0 % 11 11
Test Date: 2026-02-28 14:20:25 Functions: - 0 0
Legend: Lines:     hit not hit

            Line data    Source code
       1              : /* A rich_location subclass that lazily populates a diagnostic_path
       2              :    with diagnostic context events, but only if the path is actually to be
       3              :    used.
       4              :    Copyright (C) 2025-2026 Free Software Foundation, Inc.
       5              :    Contributed by Qing Zhao<qing.zhao@oracle.com>
       6              : 
       7              : This file is part of GCC.
       8              : 
       9              : GCC is free software; you can redistribute it and/or modify it under
      10              : the terms of the GNU General Public License as published by the Free
      11              : Software Foundation; either version 3, or (at your option) any later
      12              : version.
      13              : 
      14              : GCC is distributed in the hope that it will be useful, but WITHOUT ANY
      15              : WARRANTY; without even the implied warranty of MERCHANTABILITY or
      16              : FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
      17              : for more details.
      18              : 
      19              : You should have received a copy of the GNU General Public License
      20              : along with GCC; see the file COPYING3.  If not see
      21              : <http://www.gnu.org/licenses/>.  */
      22              : 
      23              : #ifndef GCC_DIAGNOSTIC_CONTEXT_RICH_LOCATION_H
      24              : #define GCC_DIAGNOSTIC_CONTEXT_RICH_LOCATION_H
      25              : 
      26              : #include "gcc-rich-location.h"
      27              : #include "diagnostics/lazy-paths.h"
      28              : #include "tree-logical-location.h"
      29              : 
      30              : class lazy_diagnostic_context_path : public diagnostics::paths::lazy_path
      31              : {
      32              : public:
      33       890278 :   lazy_diagnostic_context_path (const tree_logical_location_manager
      34              :                                 &logical_loc_mgr,
      35              :                                 location_t location, gimple *stmt)
      36       890278 :   : diagnostics::paths::lazy_path (logical_loc_mgr),
      37       886115 :     m_logical_loc_mgr (logical_loc_mgr),
      38       890278 :     m_location (location), m_stmt (stmt)
      39              :   {
      40              :   }
      41              : 
      42              :   std::unique_ptr<diagnostics::paths::path>
      43              :   make_inner_path () const final override;
      44              :   /* This method will be called on demand if a diagnostic is actually
      45              :      emitted for this rich_location.  */
      46              : 
      47              :   const tree_logical_location_manager &m_logical_loc_mgr;
      48              :   location_t m_location;
      49              :   gimple *m_stmt;
      50              : };
      51              : 
      52              : class rich_location_with_details : public gcc_rich_location
      53              : {
      54              : public:
      55       889513 :   rich_location_with_details (location_t location, gimple *stmt)
      56       889513 :   : gcc_rich_location (location),
      57       889513 :     m_lazy_diagnostic_context_path (m_logical_loc_mgr, location, stmt)
      58              :   {
      59       889513 :     set_path (&m_lazy_diagnostic_context_path);
      60              :   }
      61              : 
      62          765 :   rich_location_with_details (location_t location, tree exp ATTRIBUTE_UNUSED)
      63          765 :   : gcc_rich_location (location),
      64          765 :     m_lazy_diagnostic_context_path (m_logical_loc_mgr, location, nullptr)
      65              :   {
      66              :   }
      67              : 
      68              : private:
      69              :   const tree_logical_location_manager m_logical_loc_mgr;
      70              :   lazy_diagnostic_context_path m_lazy_diagnostic_context_path;
      71              : };
      72              : 
      73              : #endif // GCC_DIAGNOSTIC_CONTEXT_RICH_LOCATION_H
        

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