memgraph/src/utils/demangle.cpp
Marin Tomic 5ff1ca4a5d Add client side RPC stats
Summary: ^^

Reviewers: mferencevic, buda

Reviewed By: mferencevic

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D1224
2018-02-22 12:34:48 +01:00

19 lines
413 B
C++

#include "utils/demangle.hpp"
#include <cxxabi.h>
namespace utils {
std::experimental::optional<std::string> Demangle(const char *mangled_name) {
int s;
char *type_name = abi::__cxa_demangle(mangled_name, nullptr, nullptr, &s);
std::experimental::optional<std::string> ret = std::experimental::nullopt;
if (s == 0) {
ret = type_name;
free(type_name);
}
return ret;
}
} // namespace utils