Block-Structured AMR Software Framework
AMReX_Demangle.H
Go to the documentation of this file.
1 #ifndef AMREX_DEMANGLE_H_
2 #define AMREX_DEMANGLE_H_
3 #include <AMReX_Config.H>
4 
5 #include <string>
6 
7 #if __has_include(<cxxabi.h>)
8 # include <cxxabi.h>
9 # include <cstdlib>
10 # define AMREX_USE_CXXABI
11 #endif
12 
13 namespace amrex {
14 
25 inline std::string demangle (const char* name)
26 {
27 #ifdef AMREX_USE_CXXABI
28  int status;
29  char* p = abi::__cxa_demangle(name, nullptr, nullptr, &status);
30  if (p) {
31  std::string s(p);
32  std::free(p);
33  return s;
34  } else
35 #endif
36  {
37  return name;
38  }
39 }
40 
41 }
42 
43 #endif
void free(void *)
Definition: AMReX_Amr.cpp:49
std::string demangle(const char *name)
Demangle C++ name.
Definition: AMReX_Demangle.H:25