]> git.tdb.fi Git - libs/core.git/blob - source/debug/demangle.cpp
Remove the custom demangle function and use GCC's abi::__cxa_demangle instead
[libs/core.git] / source / debug / demangle.cpp
1 /* $Id$
2
3 This file is part of libmspcore
4 Copyright © 2007 Mikko Rasa, Mikkosoft Productions
5 Distributed under the LGPL
6 */
7
8 #include <cxxabi.h>
9 #include "demangle.h"
10
11 using namespace std;
12
13 namespace Msp {
14 namespace Debug {
15
16 string demangle(const string &sym)
17 {
18 #ifdef __GNUC__
19         int status;
20         char *dm=abi::__cxa_demangle(sym.c_str(), 0, 0, &status);
21         string result(dm);
22         free(dm);
23         return result;
24 #else
25         return sym;
26 #endif
27 }
28
29 } // namespace Debug
30 } // namespace Msp