1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
4 * Ceph - scalable distributed file system
6 * Copyright (C) 2016 Allen Samuels <allen.samuels@sandisk.com>
8 * This is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License version 2.1, as published by the Free Software
11 * Foundation. See file COPYING.
15 #ifndef CEPH_INCLUDE_DEMANGLE
16 #define CEPH_INCLUDE_DEMANGLE
18 //// Stole this code from http://stackoverflow.com/questions/281818/unmangling-the-result-of-stdtype-infoname
24 static std::string ceph_demangle(const char* name)
26 int status = -4; // some arbitrary value to eliminate the compiler warning
28 // enable c++11 by passing the flag -std=c++11 to g++
29 std::unique_ptr<char, void(*)(void*)> res {
30 abi::__cxa_demangle(name, NULL, NULL, &status),
34 return (status == 0) ? res.get() : name ;
39 // does nothing if not g++
40 static std::string demangle(const char* name)