#pragma once #include #include /** * @file Demangle.hpp * @brief hot_reload::demangle() -- a human-readable form of a real (possibly mangled) C++ name. * * Every C++ symbol name this library's events and lookups ever use is always the real * symbol-table name (whatever Context::findSymbol() needs to find it again) -- this function is * an opt-in convenience for *displaying* that name, never applied automatically, so there is * never a mismatch between what an event reports and what you would pass back in to look the * symbol up. */ namespace hot_reload { /** * @brief Demangles @p name if it looks like a mangled C++ name; returns it unchanged * otherwise. * * Replaces hot_reload.h's `hot_reload_demangle()` / `hot_reload_free_string()` pair: the * result is returned by value, so there is nothing to separately free. * * @param name The real (possibly mangled) symbol name -- e.g. from * SymbolEventInfo::name. * @return The demangled form (GCC/Clang: Itanium ABI via `abi::__cxa_demangle`; MSVC: * `UnDecorateSymbolName`), or @p name itself, unchanged, if it does not demangle * (not a mangled C++ name at all, or memory ran out while demangling it) or this * build has no demangler for the compiler it was built with. */ [[nodiscard]] std::string demangle(std::string_view name); }