Coverage Report

Created: 2022-08-24 06:19

/src/Fast-DDS/thirdparty/taocpp-pegtl/pegtl/internal/demangle.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_HPP
5
#define TAO_PEGTL_INTERNAL_DEMANGLE_HPP
6
7
#include <string>
8
#include <typeinfo>
9
10
#include "../config.hpp"
11
12
#if defined( __clang__ )
13
#if __has_feature( cxx_rtti )
14
#define TAO_PEGTL_RTTI_ENABLED
15
#endif
16
#elif defined( __GNUC__ )
17
#if defined( __GXX_RTTI )
18
#define TAO_PEGTL_RTTI_ENABLED
19
#endif
20
#elif defined( _MSC_VER )
21
#if defined( _CPPRTTI )
22
#define TAO_PEGTL_RTTI_ENABLED
23
#endif
24
#else
25
#define TAO_PEGTL_RTTI_ENABLED
26
#endif
27
28
#if !defined( TAO_PEGTL_RTTI_ENABLED )
29
#include <cassert>
30
#include <cstring>
31
#endif
32
33
#if defined( TAO_PEGTL_RTTI_ENABLED )
34
#if defined( __GLIBCXX__ )
35
#define TAO_PEGTL_USE_CXXABI_DEMANGLE
36
#elif defined( __has_include )
37
#if __has_include( <cxxabi.h> )
38
#define TAO_PEGTL_USE_CXXABI_DEMANGLE
39
#endif
40
#endif
41
#endif
42
43
#if defined( TAO_PEGTL_USE_CXXABI_DEMANGLE )
44
#include "demangle_cxxabi.hpp"
45
#undef TAO_PEGTL_USE_CXXABI_DEMANGLE
46
#else
47
#include "demangle_nop.hpp"
48
#endif
49
50
namespace tao
51
{
52
   namespace TAO_PEGTL_NAMESPACE
53
   {
54
      namespace internal
55
      {
56
         template< typename T >
57
         std::string demangle()
58
0
         {
59
0
#if defined( TAO_PEGTL_RTTI_ENABLED )
60
0
            return demangle( typeid( T ).name() );
61
#else
62
            const char* start = nullptr;
63
            const char* stop = nullptr;
64
#if defined( __clang__ ) || defined( __GNUC__ )
65
            start = std::strchr( __PRETTY_FUNCTION__, '=' ) + 2;
66
            stop = std::strrchr( start, ';' );
67
#elif defined( _MSC_VER )
68
            start = std::strstr( __FUNCSIG__, "demangle<" ) + ( sizeof( "demangle<" ) - 1 );
69
            stop = std::strrchr( start, '>' );
70
#else
71
            static_assert( false, "expected to use rtti with this compiler" );
72
#endif
73
            assert( start != nullptr );
74
            assert( stop != nullptr );
75
            return { start, std::size_t( stop - start ) };
76
#endif
77
0
         }
Unexecuted instantiation: std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > tao::pegtl::internal::demangle<eprosima::fastdds::dds::DDSSQLFilter::Condition>()
Unexecuted instantiation: std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > tao::pegtl::internal::demangle<eprosima::fastdds::dds::DDSSQLFilter::FilterExpression>()
Unexecuted instantiation: std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > tao::pegtl::internal::demangle<tao::pegtl::eof>()
Unexecuted instantiation: std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > tao::pegtl::internal::demangle<eprosima::fastdds::dds::DDSSQLFilter::Literal>()
78
79
      }  // namespace internal
80
81
   }  // namespace TAO_PEGTL_NAMESPACE
82
83
}  // namespace tao
84
85
#endif