LCOV - code coverage report
Current view: top level - gcc/diagnostics - logging.cc (source / functions) Coverage Total Hit
Test: gcc.info Lines: 0.0 % 21 0
Test Date: 2025-09-20 13:40:47 Functions: 0.0 % 5 0
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: - 0 0

             Branch data     Line data    Source code
       1                 :             : /* Utilities for implementing "dump" functions for the diagnostics subsystem.
       2                 :             :    Copyright (C) 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 under
       8                 :             : the terms of the GNU General Public License as published by the Free
       9                 :             : Software Foundation; either version 3, or (at your option) any later
      10                 :             : version.
      11                 :             : 
      12                 :             : GCC is distributed in the hope that it will be useful, but WITHOUT ANY
      13                 :             : WARRANTY; without even the implied warranty of MERCHANTABILITY or
      14                 :             : FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
      15                 :             : 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                 :             : 
      22                 :             : #include "config.h"
      23                 :             : #include "system.h"
      24                 :             : #include "coretypes.h"
      25                 :             : #include "diagnostics/logging.h"
      26                 :             : 
      27                 :             : namespace diagnostics {
      28                 :             : namespace logging {
      29                 :             : 
      30                 :           0 : logger::logger (output_file outfile)
      31                 :           0 : : m_outfile (std::move (outfile)),
      32                 :           0 :   m_log_depth (0)
      33                 :             : {
      34                 :           0 : }
      35                 :             : 
      36                 :             : void
      37                 :           0 : logger::log_printf (const char *fmt, ...)
      38                 :             : {
      39                 :           0 :   emit_indent ();
      40                 :             : 
      41                 :           0 :   va_list ap;
      42                 :           0 :   va_start (ap, fmt);
      43                 :           0 :   vfprintf (get_stream (), fmt, ap);
      44                 :           0 :   va_end (ap);
      45                 :             : 
      46                 :           0 :   emit_newline ();
      47                 :           0 : }
      48                 :             : 
      49                 :             : void
      50                 :           0 : logger::log_bool_return (const char *function_name, bool retval)
      51                 :             : {
      52                 :           0 :   log_printf ("%s <- %s",
      53                 :             :               retval ? "true" : "false",
      54                 :             :               function_name);
      55                 :           0 : }
      56                 :             : 
      57                 :             : /* Emit indentation to OUTFILE for the start of a log line.  */
      58                 :             : 
      59                 :             : void
      60                 :           0 : logger::emit_indent () const
      61                 :             : {
      62                 :           0 :   fprintf (get_stream (), "%*s", get_indent (), "");
      63                 :           0 : }
      64                 :             : 
      65                 :             : void
      66                 :           0 : logger::emit_newline () const
      67                 :             : {
      68                 :           0 :   fputc ('\n', get_stream ());
      69                 :           0 : }
      70                 :             : 
      71                 :             : } // namespace logging {
      72                 :             : } // namespace diagnostics
        

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.