diff options
author | Baptiste Lepilleur <gaiacrtn@free.fr> | 2004-02-18 19:45:44 +0000 |
---|---|---|
committer | Baptiste Lepilleur <gaiacrtn@free.fr> | 2004-02-18 19:45:44 +0000 |
commit | b11bd9019deef39ed969fab8b85771946b83d17b (patch) | |
tree | 2f1a67e989f7e7c4329a1efc2c8887a4fc916caf /src/cppunit | |
parent | 90869fe73c518e3135906cd5648834366ada4299 (diff) | |
download | cppunit-b11bd9019deef39ed969fab8b85771946b83d17b.tar.gz |
Configure.
configure.in:
* config/ax_cxx_gcc_abi_demangle.m4:
* src/cppunit/TypeInfoHelper.cpp: added patch from
Neil Ferguson <nferguso@eso.org> to use gcc c++ abi to demangle typeinfo
name when available.
Diffstat (limited to 'src/cppunit')
-rw-r--r-- | src/cppunit/TypeInfoHelper.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/cppunit/TypeInfoHelper.cpp b/src/cppunit/TypeInfoHelper.cpp index 39356d6..bd01001 100644 --- a/src/cppunit/TypeInfoHelper.cpp +++ b/src/cppunit/TypeInfoHelper.cpp @@ -5,6 +5,10 @@ #include <string> +#if CPPUNIT_HAVE_GCC_ABI_DEMANGLE +#include <cxxabi.h> +#endif + CPPUNIT_NS_BEGIN @@ -12,6 +16,18 @@ CPPUNIT_NS_BEGIN std::string TypeInfoHelper::getClassName( const std::type_info &info ) { +#if defined(CPPUNIT_HAVE_GCC_ABI_DEMANGLE) && CPPUNIT_HAVE_GCC_ABI_DEMANGLE + + int status = 0; + char* c_name = 0; + + c_name = abi::__cxa_demangle( info.name(), 0, 0, &status ); + + std::string name( c_name ); + free( c_name ); + +#else // CPPUNIT_HAVE_GCC_ABI_DEMANGLE + static std::string classPrefix( "class " ); std::string name( info.name() ); @@ -25,6 +41,9 @@ TypeInfoHelper::getClassName( const std::type_info &info ) if ( name.substr( 0, classPrefix.length() ) == classPrefix ) return name.substr( classPrefix.length() ); + +#endif // CPPUNIT_HAVE_GCC_ABI_DEMANGLE + return name; } |