Coverage Report

Created: 2025-06-13 06:46

/src/Fast-DDS/thirdparty/taocpp-pegtl/pegtl/internal/demangle_cxxabi.hpp
Line
Count
Source (jump to first uncovered line)
1
// Copyright (c) 2014-2020 Dr. Colin Hirsch and Daniel Frey
2
// Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/
3
4
#ifndef TAO_PEGTL_INTERNAL_DEMANGLE_CXXABI_HPP
5
#define TAO_PEGTL_INTERNAL_DEMANGLE_CXXABI_HPP
6
7
#include <cstdlib>
8
#include <cxxabi.h>
9
#include <memory>
10
#include <string>
11
12
#include "../config.hpp"
13
14
#include "demangle_sanitise.hpp"
15
16
namespace tao
17
{
18
   namespace TAO_PEGTL_NAMESPACE
19
   {
20
      namespace internal
21
      {
22
         inline std::string demangle( const char* symbol )
23
0
         {
24
0
            const std::unique_ptr< char, decltype( &std::free ) > demangled( abi::__cxa_demangle( symbol, nullptr, nullptr, nullptr ), &std::free );
25
0
            if( !demangled ) {
26
0
               return symbol;
27
0
            }
28
0
            std::string result( demangled.get() );
29
#ifdef TAO_PEGTL_PRETTY_DEMANGLE
30
            demangle_sanitise_chars( result );  // LCOV_EXCL_LINE
31
#endif
32
0
            return result;
33
0
         }
34
35
      }  // namespace internal
36
37
   }  // namespace TAO_PEGTL_NAMESPACE
38
39
}  // namespace tao
40
41
#endif