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

            Line data    Source code
       1              : /* C++11 wrapper around libiberty's argv.c
       2              :    Copyright (C) 2024-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 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              : #ifndef GCC_UNIQUE_ARGV_H
      22              : #define GCC_UNIQUE_ARGV_H
      23              : 
      24              : /* C++11 wrapper around libiberty's argv.c, with
      25              :    ownership of the underlying array and strings.  */
      26              : 
      27              : struct unique_argv
      28              : {
      29              :   /* Take ownership of argv.  */
      30       285722 :   unique_argv (char **argv)
      31       285722 :   : m_argv (argv)
      32              :   {
      33              :   }
      34              : 
      35       855105 :   ~unique_argv ()
      36              :   {
      37       855105 :     freeargv (m_argv);
      38       571444 :   }
      39              : 
      40              :   unique_argv (const unique_argv &other) = delete;
      41              :   unique_argv &operator= (const unique_argv &other) = delete;
      42              : 
      43       571444 :   unique_argv (unique_argv &&other)
      44       571444 :   : m_argv (other.m_argv)
      45              :   {
      46       571444 :     other.m_argv = nullptr;
      47              :   }
      48              : 
      49              :   unique_argv &operator= (unique_argv &&other)
      50              :   {
      51              :     freeargv (m_argv);
      52              :     m_argv = other.m_argv;
      53              :     other.m_argv = nullptr;
      54              :     return *this;
      55              :   }
      56              : 
      57       285722 :   char **release ()
      58              :   {
      59       285722 :     char **result = m_argv;
      60       285722 :     m_argv = nullptr;
      61       285722 :     return result;
      62              :   }
      63              : 
      64              :   char **m_argv;
      65              : };
      66              : 
      67              : #endif /* ! GCC_UNIQUE_ARGV_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.