LLVM: include/llvm/Support/TypeName.h Source File (original) (raw)
41#if defined(__clang__) || defined(__GNUC__)
43
46 Name.substr(Name.find(Key));
47#if LLVM_GET_TYPE_NAME_STATIC_ASSERT
48 static_assert(!TemplateParamsStart.empty(),
49 "Unable to find the template parameter!");
50#else
51 assert(!TemplateParamsStart.empty() &&
52 "Unable to find the template parameter!");
53#endif
54
56 TemplateParamsStart.substr(Key.size());
57
58#if LLVM_GET_TYPE_NAME_STATIC_ASSERT
59
60 static_assert(!SubstitutionKey.empty() && SubstitutionKey.back() == ']',
61 "Name doesn't end in the substitution key!");
62#else
63 assert(!SubstitutionKey.empty() && SubstitutionKey.back() == ']' &&
64 "Name doesn't end in the substitution key!");
65#endif
66
67 return SubstitutionKey.substr(0, SubstitutionKey.size() - 1);
68#elif defined(_MSC_VER)
70
73 Name.substr(Name.find(Key));
74 static_assert(!GetTypeNameStart.empty(),
75 "Unable to find the template parameter!");
77 GetTypeNameStart.substr(Key.size());
78
79
81 SubstitutionKey.find("class ") == 0
82 ? SubstitutionKey.substr(sizeof("class ") - 1)
83 : SubstitutionKey;
85 RmPrefixClass.find("struct ") == 0
86 ? RmPrefixClass.substr(sizeof("struct ") - 1)
87 : RmPrefixClass;
89 RmPrefixStruct.find("union ") == 0
90 ? RmPrefixStruct.substr(sizeof("union ") - 1)
91 : RmPrefixStruct;
93 RmPrefixUnion.find("enum ") == 0
94 ? RmPrefixUnion.substr(sizeof("enum ") - 1)
95 : RmPrefixUnion;
96
98 static_assert(AnglePos != std::string_view::npos,
99 "Unable to find the closing '>'!");
100 return RmPrefixEnum.substr(0, AnglePos);
101#else
102
103
104 return "UNKNOWN_TYPE";
105#endif
106}