9#ifndef LLVM_DEMANGLE_MICROSOFTDEMANGLE_H
10#define LLVM_DEMANGLE_MICROSOFTDEMANGLE_H
18namespace ms_demangle {
27 struct AllocatorNode {
28 uint8_t *Buf =
nullptr;
31 AllocatorNode *Next =
nullptr;
34 void addNode(
size_t Capacity) {
35 AllocatorNode *NewHead =
new AllocatorNode;
36 NewHead->Buf =
new uint8_t[Capacity];
38 NewHead->Capacity = Capacity;
50 AllocatorNode *Next = Head->Next;
59 uint8_t *
P = Head->Buf + Head->Used;
62 if (Head->Used <= Head->Capacity)
63 return reinterpret_cast<char *
>(
P);
67 return reinterpret_cast<char *
>(Head->Buf);
70 template <
typename T,
typename... Args>
T *
allocArray(
size_t Count) {
71 size_t Size = Count *
sizeof(
T);
74 size_t P = (size_t)Head->Buf + Head->Used;
76 (((
size_t)
P +
alignof(
T) - 1) & ~(size_t)(
alignof(
T) - 1));
77 uint8_t *PP = (uint8_t *)AlignedP;
78 size_t Adjustment = AlignedP -
P;
80 Head->Used +=
Size + Adjustment;
81 if (Head->Used <= Head->Capacity)
82 return new (PP)
T[Count]();
86 return new (Head->Buf)
T[Count]();
89 template <
typename T,
typename... Args>
T *
alloc(Args &&... ConstructorArgs) {
90 constexpr size_t Size =
sizeof(
T);
93 size_t P = (size_t)Head->Buf + Head->Used;
95 (((
size_t)
P +
alignof(
T) - 1) & ~(size_t)(
alignof(
T) - 1));
96 uint8_t *PP = (uint8_t *)AlignedP;
97 size_t Adjustment = AlignedP -
P;
99 Head->Used +=
Size + Adjustment;
100 if (Head->Used <= Head->Capacity)
101 return new (PP)
T(std::forward<Args>(ConstructorArgs)...);
106 return new (Head->Buf)
T(std::forward<Args>(ConstructorArgs)...);
110 AllocatorNode *Head =
nullptr;
114 static constexpr size_t Max = 10;
183 std::pair<uint64_t, bool> demangleNumber(
StringView &MangledName);
185 int64_t demangleSigned(
StringView &MangledName);
212 demangleFunctionIdentifierCode(
StringView &MangledName,
217 demangleConversionOperatorIdentifier(
StringView &MangledName);
219 demangleLiteralOperatorIdentifier(
StringView &MangledName);
223 demangleSpecialTableSymbolNode(
StringView &MangledName,
226 demangleLocalStaticGuard(
StringView &MangledName,
bool IsThread);
248 bool demangleThrowSpecification(
StringView &MangledName);
249 wchar_t demangleWcharLiteral(
StringView &MangledName);
250 uint8_t demangleCharLiteral(
StringView &MangledName);
252 std::pair<Qualifiers, bool> demangleQualifiers(
StringView &MangledName);
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
Lightweight error class with error context and mandatory checking.
T * alloc(Args &&... ConstructorArgs)
char * allocUnalignedBuffer(size_t Size)
T * allocArray(size_t Count)
TagTypeNode * parseTagUniqueName(StringView &MangledName)
virtual ~Demangler()=default
void dumpBackReferences()
FunctionIdentifierCodeGroup
constexpr size_t AllocUnit
This is an optimization pass for GlobalISel generic memory operations.
static constexpr size_t Max
NamedIdentifierNode * Names[Max]
TypeNode * FunctionParams[Max]
size_t FunctionParamCount