LeechCraft 0.6.70-18808-g3467692359
Modular cross-platform feature rich live environment.
Loading...
Searching...
No Matches
demangle.cpp
Go to the documentation of this file.
1/**********************************************************************
2 * LeechCraft - modular cross-platform feature rich internet client.
3 * Copyright (C) 2006-2014 Georg Rudoy
4 *
5 * Distributed under the Boost Software License, Version 1.0.
6 * (See accompanying file LICENSE or copy at https://www.boost.org/LICENSE_1_0.txt)
7 **********************************************************************/
8
9#include "demangle.h"
10#if __has_include(<cxxabi.h>)
11#include <cstdlib>
12#include <memory>
13#include <cxxabi.h>
14#define LC_HAS_CXA_DEMANGLE
15#endif
16#include <QString>
17
18namespace LC::Util
19{
20 QString Demangle (const char *name)
21 {
22#ifdef LC_HAS_CXA_DEMANGLE
23 const std::unique_ptr<char, decltype (&std::free)> demangled
24 {
25 abi::__cxa_demangle (name, nullptr, nullptr, nullptr),
26 &std::free
27 };
28 return demangled ? QString::fromLatin1 (demangled.get ()) : QString::fromLatin1 (name);
29#else
30 return QString::fromLatin1 (name);
31#endif
32 }
33
34 QString Demangle (const std::type_info& info)
35 {
36 return Demangle (info.name ());
37 }
38}
QString Demangle(const char *name)
Returns a human-readable form of a mangled symbol name.
Definition demangle.cpp:20