25#if defined(_MSC_VER) && defined(_WIN32)
26#include "../../char8_t_remediation.hpp"
29#include "../literal_string.hpp"
30#include "find_at_depth.hpp"
31#include "language_tokens.hpp"
32#include "parse_raw_identifier_name.hpp"
39namespace essence::meta::detail {
40#if defined(_MSC_VER) && defined(_WIN64)
41 inline constexpr std::array calling_conventions{U8(
"__cdecl"), U8(
"__vectorcall")};
42#elif defined(_MSC_VER) && defined(_WIN32)
43 inline constexpr std::array calling_conventions{
44 U8(
"__cdecl"), U8(
"__stdcall"), U8(
"__fastcall"), U8(
"__vectorcall"), U8(
"__thiscall")};
45#elif defined(__clang__) || defined(__GNUC__)
46 inline constexpr std::array<const char*, 0> calling_conventions{};
48#error "Unsupported compiler."
56 consteval std::string_view parse_qualified_function_name(std::string_view signature)
noexcept {
61 const auto start_index = [&]() -> std::size_t {
65 if constexpr (!calling_conventions.empty()) {
66 for (
auto&& item : calling_conventions) {
67 if (
const auto index = find_at_depth<find_mode_type::full_match>(signature, item);
68 index != std::string_view::npos) {
79 const auto function_name_start_index =
80 std::max(start_index, find_at_depth<find_mode_type::full_match_reverse>(signature, language_tokens::scope));
82 const auto end_index = find_at_depth<find_mode_type::any_of>(signature,
83 literal_string{language_tokens::left_parentheses, language_tokens::left_angle_bracket}, 1,
84 function_name_start_index != std::string_view::npos ? function_name_start_index : start_index);
86 const auto final_size =
87 end_index != std::string_view::npos ? (end_index - 1 - start_index) : (signature.size() - start_index);
89 return signature.substr(start_index, final_size);