repr 0.1
Reconstructable string representations and more
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages Concepts
undecorate.h
Go to the documentation of this file.
#pragma once
#if USING(LIBREPR_PLATFORM_WINDOWS)
#pragma comment(lib, "dbghelp.lib")
#define WIN32_LEAN_AND_MEAN
#define NOMINMAX
#include <Windows.h>
#include <DbgHelp.h>
#include <array>
#include <mutex>
#include <typeinfo>
#include "denoise.h"
#include "undname.h"
namespace librepr::detail {
namespace msvc {
inline constexpr bool has_rawname = requires(const std::type_info& ty) { ty.raw_name(); };
} // namespace msvc
// TODO: Make this better ig
[[nodiscard]] inline int syminit_() {
assert(did_initialize && "Failed to initialize the symbol handler!");
return true;
}
{ [[maybe_unused]] static int sym = syminit_(); }
static std::mutex mtx { };
if(!symdata) [[unlikely]] { return 0; }
if constexpr (msvc::has_rawname) {
if (*symdata == '.') [[likely]] {
constexpr static auto flags =
auto denoised = denoise_name({ buf.data() });
std::memcpy(buf.data(), denoised.data(), denoised.size());
return denoised.size();
}
}
"Got '{}', expected '?'", *symdata);
}
} // namespace librepr::detail
#endif