TypeId.cc
Go to the documentation of this file.
1 #include <utl/TypeId.h>
2 #include <utl/ErrorLogger.h>
3 #ifdef __GNUC__
4 # include <cxxabi.h>
5 # include <cstdlib>
6 #endif
7 
8 using namespace std;
9 
10 
11 namespace utl {
12 
13  namespace TypeId {
14 
15  string
16  Demangle(const string& mangledName)
17  {
18 #ifdef __GNUC__
19  int status = 0;
20  char* const rName =
21  abi::__cxa_demangle(mangledName.c_str(), 0, 0, &status);
22  if (status) {
23  ostringstream warn;
24  warn << "Demangling of '" << mangledName << "' failed with return status " << status
25  << ". Returning nagled name instead.";
26  WARNING(warn);
27  return mangledName;
28  } else {
29  const string demangledName = rName;
30  free(rName);
31  return demangledName;
32  }
33 #else
34  return mangledName;
35 #endif
36  }
37 
38  }
39 
40 }
string Demangle(const string &mangledName)
Definition: TypeId.cc:16
#define WARNING(message)
Macro for logging warning messages.
Definition: ErrorLogger.h:163

, generated on Tue Sep 26 2023.