blob: 8e9fa6b70419a21dc9aa959f91c409f766727184 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <vespa/vespalib/util/classname.h>
#include <cxxabi.h>
namespace vespalib {
string demangle(const char * native) {
int status = 0;
size_t size = 0;
char *unmangled = abi::__cxa_demangle(native, nullptr, &size, &status);
if (unmangled == nullptr) {
return ""; // Demangling failed for some reason. TODO return `native` instead?
}
string result(unmangled);
free(unmangled);
return result;
}
}
|