/src/freetype2-testing/external/llvm-project/libcxxabi/src/demangle/ItaniumDemangle.h
Line | Count | Source (jump to first uncovered line) |
1 | | //===------------------------- ItaniumDemangle.h ----------------*- C++ -*-===// |
2 | | // |
3 | | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
4 | | // See https://llvm.org/LICENSE.txt for license information. |
5 | | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
6 | | // |
7 | | //===----------------------------------------------------------------------===// |
8 | | // |
9 | | // Generic itanium demangler library. This file has two byte-per-byte identical |
10 | | // copies in the source tree, one in libcxxabi, and the other in llvm. |
11 | | // |
12 | | //===----------------------------------------------------------------------===// |
13 | | |
14 | | #ifndef DEMANGLE_ITANIUMDEMANGLE_H |
15 | | #define DEMANGLE_ITANIUMDEMANGLE_H |
16 | | |
17 | | // FIXME: (possibly) incomplete list of features that clang mangles that this |
18 | | // file does not yet support: |
19 | | // - C++ modules TS |
20 | | |
21 | | #include "DemangleConfig.h" |
22 | | #include "StringView.h" |
23 | | #include "Utility.h" |
24 | | #include <cassert> |
25 | | #include <cctype> |
26 | | #include <cstdio> |
27 | | #include <cstdlib> |
28 | | #include <cstring> |
29 | | #include <numeric> |
30 | | #include <utility> |
31 | | |
32 | | #define FOR_EACH_NODE_KIND(X) \ |
33 | 0 | X(NodeArrayNode) \ |
34 | 0 | X(DotSuffix) \ |
35 | 0 | X(VendorExtQualType) \ |
36 | 0 | X(QualType) \ |
37 | 0 | X(ConversionOperatorType) \ |
38 | 0 | X(PostfixQualifiedType) \ |
39 | 0 | X(ElaboratedTypeSpefType) \ |
40 | 0 | X(NameType) \ |
41 | 0 | X(AbiTagAttr) \ |
42 | 0 | X(EnableIfAttr) \ |
43 | 0 | X(ObjCProtoName) \ |
44 | 0 | X(PointerType) \ |
45 | 0 | X(ReferenceType) \ |
46 | 0 | X(PointerToMemberType) \ |
47 | 0 | X(ArrayType) \ |
48 | 0 | X(FunctionType) \ |
49 | 0 | X(NoexceptSpec) \ |
50 | 0 | X(DynamicExceptionSpec) \ |
51 | 0 | X(FunctionEncoding) \ |
52 | 0 | X(LiteralOperator) \ |
53 | 0 | X(SpecialName) \ |
54 | 0 | X(CtorVtableSpecialName) \ |
55 | 0 | X(QualifiedName) \ |
56 | 0 | X(NestedName) \ |
57 | 0 | X(LocalName) \ |
58 | 0 | X(VectorType) \ |
59 | 0 | X(PixelVectorType) \ |
60 | 0 | X(SyntheticTemplateParamName) \ |
61 | 0 | X(TypeTemplateParamDecl) \ |
62 | 0 | X(NonTypeTemplateParamDecl) \ |
63 | 0 | X(TemplateTemplateParamDecl) \ |
64 | 0 | X(TemplateParamPackDecl) \ |
65 | 0 | X(ParameterPack) \ |
66 | 0 | X(TemplateArgumentPack) \ |
67 | 0 | X(ParameterPackExpansion) \ |
68 | 0 | X(TemplateArgs) \ |
69 | 0 | X(ForwardTemplateReference) \ |
70 | 0 | X(NameWithTemplateArgs) \ |
71 | 0 | X(GlobalQualifiedName) \ |
72 | 0 | X(StdQualifiedName) \ |
73 | 0 | X(ExpandedSpecialSubstitution) \ |
74 | 0 | X(SpecialSubstitution) \ |
75 | 0 | X(CtorDtorName) \ |
76 | 0 | X(DtorName) \ |
77 | 0 | X(UnnamedTypeName) \ |
78 | 0 | X(ClosureTypeName) \ |
79 | 0 | X(StructuredBindingName) \ |
80 | 0 | X(BinaryExpr) \ |
81 | 0 | X(ArraySubscriptExpr) \ |
82 | 0 | X(PostfixExpr) \ |
83 | 0 | X(ConditionalExpr) \ |
84 | 0 | X(MemberExpr) \ |
85 | 0 | X(SubobjectExpr) \ |
86 | 0 | X(EnclosingExpr) \ |
87 | 0 | X(CastExpr) \ |
88 | 0 | X(SizeofParamPackExpr) \ |
89 | 0 | X(CallExpr) \ |
90 | 0 | X(NewExpr) \ |
91 | 0 | X(DeleteExpr) \ |
92 | 0 | X(PrefixExpr) \ |
93 | 0 | X(FunctionParam) \ |
94 | 0 | X(ConversionExpr) \ |
95 | 0 | X(PointerToMemberConversionExpr) \ |
96 | 0 | X(InitListExpr) \ |
97 | 0 | X(FoldExpr) \ |
98 | 0 | X(ThrowExpr) \ |
99 | 0 | X(BoolExpr) \ |
100 | 0 | X(StringLiteral) \ |
101 | 0 | X(LambdaExpr) \ |
102 | 0 | X(EnumLiteral) \ |
103 | 0 | X(IntegerLiteral) \ |
104 | 0 | X(FloatLiteral) \ |
105 | 0 | X(DoubleLiteral) \ |
106 | 0 | X(LongDoubleLiteral) \ |
107 | 0 | X(BracedExpr) \ |
108 | 0 | X(BracedRangeExpr) |
109 | | |
110 | | DEMANGLE_NAMESPACE_BEGIN |
111 | | |
112 | | // Base class of all AST nodes. The AST is built by the parser, then is |
113 | | // traversed by the printLeft/Right functions to produce a demangled string. |
114 | | class Node { |
115 | | public: |
116 | | enum Kind : unsigned char { |
117 | | #define ENUMERATOR(NodeKind) K ## NodeKind, |
118 | | FOR_EACH_NODE_KIND(ENUMERATOR) |
119 | | #undef ENUMERATOR |
120 | | }; |
121 | | |
122 | | /// Three-way bool to track a cached value. Unknown is possible if this node |
123 | | /// has an unexpanded parameter pack below it that may affect this cache. |
124 | | enum class Cache : unsigned char { Yes, No, Unknown, }; |
125 | | |
126 | | private: |
127 | | Kind K; |
128 | | |
129 | | // FIXME: Make these protected. |
130 | | public: |
131 | | /// Tracks if this node has a component on its right side, in which case we |
132 | | /// need to call printRight. |
133 | | Cache RHSComponentCache; |
134 | | |
135 | | /// Track if this node is a (possibly qualified) array type. This can affect |
136 | | /// how we format the output string. |
137 | | Cache ArrayCache; |
138 | | |
139 | | /// Track if this node is a (possibly qualified) function type. This can |
140 | | /// affect how we format the output string. |
141 | | Cache FunctionCache; |
142 | | |
143 | | public: |
144 | | Node(Kind K_, Cache RHSComponentCache_ = Cache::No, |
145 | | Cache ArrayCache_ = Cache::No, Cache FunctionCache_ = Cache::No) |
146 | | : K(K_), RHSComponentCache(RHSComponentCache_), ArrayCache(ArrayCache_), |
147 | 0 | FunctionCache(FunctionCache_) {} |
148 | | |
149 | | /// Visit the most-derived object corresponding to this object. |
150 | | template<typename Fn> void visit(Fn F) const; |
151 | | |
152 | | // The following function is provided by all derived classes: |
153 | | // |
154 | | // Call F with arguments that, when passed to the constructor of this node, |
155 | | // would construct an equivalent node. |
156 | | //template<typename Fn> void match(Fn F) const; |
157 | | |
158 | 0 | bool hasRHSComponent(OutputStream &S) const { |
159 | 0 | if (RHSComponentCache != Cache::Unknown) |
160 | 0 | return RHSComponentCache == Cache::Yes; |
161 | 0 | return hasRHSComponentSlow(S); |
162 | 0 | } |
163 | | |
164 | 0 | bool hasArray(OutputStream &S) const { |
165 | 0 | if (ArrayCache != Cache::Unknown) |
166 | 0 | return ArrayCache == Cache::Yes; |
167 | 0 | return hasArraySlow(S); |
168 | 0 | } |
169 | | |
170 | 0 | bool hasFunction(OutputStream &S) const { |
171 | 0 | if (FunctionCache != Cache::Unknown) |
172 | 0 | return FunctionCache == Cache::Yes; |
173 | 0 | return hasFunctionSlow(S); |
174 | 0 | } |
175 | | |
176 | 0 | Kind getKind() const { return K; } |
177 | | |
178 | 0 | virtual bool hasRHSComponentSlow(OutputStream &) const { return false; } |
179 | 0 | virtual bool hasArraySlow(OutputStream &) const { return false; } |
180 | 0 | virtual bool hasFunctionSlow(OutputStream &) const { return false; } |
181 | | |
182 | | // Dig through "glue" nodes like ParameterPack and ForwardTemplateReference to |
183 | | // get at a node that actually represents some concrete syntax. |
184 | 0 | virtual const Node *getSyntaxNode(OutputStream &) const { |
185 | 0 | return this; |
186 | 0 | } |
187 | | |
188 | 0 | void print(OutputStream &S) const { |
189 | 0 | printLeft(S); |
190 | 0 | if (RHSComponentCache != Cache::No) |
191 | 0 | printRight(S); |
192 | 0 | } |
193 | | |
194 | | // Print the "left" side of this Node into OutputStream. |
195 | | virtual void printLeft(OutputStream &) const = 0; |
196 | | |
197 | | // Print the "right". This distinction is necessary to represent C++ types |
198 | | // that appear on the RHS of their subtype, such as arrays or functions. |
199 | | // Since most types don't have such a component, provide a default |
200 | | // implementation. |
201 | 0 | virtual void printRight(OutputStream &) const {} |
202 | | |
203 | 0 | virtual StringView getBaseName() const { return StringView(); } |
204 | | |
205 | | // Silence compiler warnings, this dtor will never be called. |
206 | 0 | virtual ~Node() = default; |
207 | | |
208 | | #ifndef NDEBUG |
209 | | DEMANGLE_DUMP_METHOD void dump() const; |
210 | | #endif |
211 | | }; |
212 | | |
213 | | class NodeArray { |
214 | | Node **Elements; |
215 | | size_t NumElements; |
216 | | |
217 | | public: |
218 | 0 | NodeArray() : Elements(nullptr), NumElements(0) {} |
219 | | NodeArray(Node **Elements_, size_t NumElements_) |
220 | 0 | : Elements(Elements_), NumElements(NumElements_) {} |
221 | | |
222 | 0 | bool empty() const { return NumElements == 0; } |
223 | 0 | size_t size() const { return NumElements; } |
224 | | |
225 | 0 | Node **begin() const { return Elements; } |
226 | 0 | Node **end() const { return Elements + NumElements; } |
227 | | |
228 | 0 | Node *operator[](size_t Idx) const { return Elements[Idx]; } |
229 | | |
230 | 0 | void printWithComma(OutputStream &S) const { |
231 | 0 | bool FirstElement = true; |
232 | 0 | for (size_t Idx = 0; Idx != NumElements; ++Idx) { |
233 | 0 | size_t BeforeComma = S.getCurrentPosition(); |
234 | 0 | if (!FirstElement) |
235 | 0 | S += ", "; |
236 | 0 | size_t AfterComma = S.getCurrentPosition(); |
237 | 0 | Elements[Idx]->print(S); |
238 | | |
239 | | // Elements[Idx] is an empty parameter pack expansion, we should erase the |
240 | | // comma we just printed. |
241 | 0 | if (AfterComma == S.getCurrentPosition()) { |
242 | 0 | S.setCurrentPosition(BeforeComma); |
243 | 0 | continue; |
244 | 0 | } |
245 | | |
246 | 0 | FirstElement = false; |
247 | 0 | } |
248 | 0 | } |
249 | | }; |
250 | | |
251 | | struct NodeArrayNode : Node { |
252 | | NodeArray Array; |
253 | 0 | NodeArrayNode(NodeArray Array_) : Node(KNodeArrayNode), Array(Array_) {} |
254 | | |
255 | 0 | template<typename Fn> void match(Fn F) const { F(Array); } |
256 | | |
257 | 0 | void printLeft(OutputStream &S) const override { |
258 | 0 | Array.printWithComma(S); |
259 | 0 | } |
260 | | }; |
261 | | |
262 | | class DotSuffix final : public Node { |
263 | | const Node *Prefix; |
264 | | const StringView Suffix; |
265 | | |
266 | | public: |
267 | | DotSuffix(const Node *Prefix_, StringView Suffix_) |
268 | 0 | : Node(KDotSuffix), Prefix(Prefix_), Suffix(Suffix_) {} |
269 | | |
270 | 0 | template<typename Fn> void match(Fn F) const { F(Prefix, Suffix); } |
271 | | |
272 | 0 | void printLeft(OutputStream &s) const override { |
273 | 0 | Prefix->print(s); |
274 | 0 | s += " ("; |
275 | 0 | s += Suffix; |
276 | 0 | s += ")"; |
277 | 0 | } |
278 | | }; |
279 | | |
280 | | class VendorExtQualType final : public Node { |
281 | | const Node *Ty; |
282 | | StringView Ext; |
283 | | const Node *TA; |
284 | | |
285 | | public: |
286 | | VendorExtQualType(const Node *Ty_, StringView Ext_, const Node *TA_) |
287 | 0 | : Node(KVendorExtQualType), Ty(Ty_), Ext(Ext_), TA(TA_) {} |
288 | | |
289 | 0 | template <typename Fn> void match(Fn F) const { F(Ty, Ext, TA); } |
290 | | |
291 | 0 | void printLeft(OutputStream &S) const override { |
292 | 0 | Ty->print(S); |
293 | 0 | S += " "; |
294 | 0 | S += Ext; |
295 | 0 | if (TA != nullptr) |
296 | 0 | TA->print(S); |
297 | 0 | } |
298 | | }; |
299 | | |
300 | | enum FunctionRefQual : unsigned char { |
301 | | FrefQualNone, |
302 | | FrefQualLValue, |
303 | | FrefQualRValue, |
304 | | }; |
305 | | |
306 | | enum Qualifiers { |
307 | | QualNone = 0, |
308 | | QualConst = 0x1, |
309 | | QualVolatile = 0x2, |
310 | | QualRestrict = 0x4, |
311 | | }; |
312 | | |
313 | 0 | inline Qualifiers operator|=(Qualifiers &Q1, Qualifiers Q2) { |
314 | 0 | return Q1 = static_cast<Qualifiers>(Q1 | Q2); |
315 | 0 | } |
316 | | |
317 | | class QualType final : public Node { |
318 | | protected: |
319 | | const Qualifiers Quals; |
320 | | const Node *Child; |
321 | | |
322 | 0 | void printQuals(OutputStream &S) const { |
323 | 0 | if (Quals & QualConst) |
324 | 0 | S += " const"; |
325 | 0 | if (Quals & QualVolatile) |
326 | 0 | S += " volatile"; |
327 | 0 | if (Quals & QualRestrict) |
328 | 0 | S += " restrict"; |
329 | 0 | } |
330 | | |
331 | | public: |
332 | | QualType(const Node *Child_, Qualifiers Quals_) |
333 | | : Node(KQualType, Child_->RHSComponentCache, |
334 | | Child_->ArrayCache, Child_->FunctionCache), |
335 | 0 | Quals(Quals_), Child(Child_) {} |
336 | | |
337 | 0 | template<typename Fn> void match(Fn F) const { F(Child, Quals); } |
338 | | |
339 | 0 | bool hasRHSComponentSlow(OutputStream &S) const override { |
340 | 0 | return Child->hasRHSComponent(S); |
341 | 0 | } |
342 | 0 | bool hasArraySlow(OutputStream &S) const override { |
343 | 0 | return Child->hasArray(S); |
344 | 0 | } |
345 | 0 | bool hasFunctionSlow(OutputStream &S) const override { |
346 | 0 | return Child->hasFunction(S); |
347 | 0 | } |
348 | | |
349 | 0 | void printLeft(OutputStream &S) const override { |
350 | 0 | Child->printLeft(S); |
351 | 0 | printQuals(S); |
352 | 0 | } |
353 | | |
354 | 0 | void printRight(OutputStream &S) const override { Child->printRight(S); } |
355 | | }; |
356 | | |
357 | | class ConversionOperatorType final : public Node { |
358 | | const Node *Ty; |
359 | | |
360 | | public: |
361 | | ConversionOperatorType(const Node *Ty_) |
362 | 0 | : Node(KConversionOperatorType), Ty(Ty_) {} |
363 | | |
364 | 0 | template<typename Fn> void match(Fn F) const { F(Ty); } |
365 | | |
366 | 0 | void printLeft(OutputStream &S) const override { |
367 | 0 | S += "operator "; |
368 | 0 | Ty->print(S); |
369 | 0 | } |
370 | | }; |
371 | | |
372 | | class PostfixQualifiedType final : public Node { |
373 | | const Node *Ty; |
374 | | const StringView Postfix; |
375 | | |
376 | | public: |
377 | | PostfixQualifiedType(Node *Ty_, StringView Postfix_) |
378 | 0 | : Node(KPostfixQualifiedType), Ty(Ty_), Postfix(Postfix_) {} |
379 | | |
380 | 0 | template<typename Fn> void match(Fn F) const { F(Ty, Postfix); } |
381 | | |
382 | 0 | void printLeft(OutputStream &s) const override { |
383 | 0 | Ty->printLeft(s); |
384 | 0 | s += Postfix; |
385 | 0 | } |
386 | | }; |
387 | | |
388 | | class NameType final : public Node { |
389 | | const StringView Name; |
390 | | |
391 | | public: |
392 | 0 | NameType(StringView Name_) : Node(KNameType), Name(Name_) {} |
393 | | |
394 | 0 | template<typename Fn> void match(Fn F) const { F(Name); } |
395 | | |
396 | 0 | StringView getName() const { return Name; } |
397 | 0 | StringView getBaseName() const override { return Name; } |
398 | | |
399 | 0 | void printLeft(OutputStream &s) const override { s += Name; } |
400 | | }; |
401 | | |
402 | | class ElaboratedTypeSpefType : public Node { |
403 | | StringView Kind; |
404 | | Node *Child; |
405 | | public: |
406 | | ElaboratedTypeSpefType(StringView Kind_, Node *Child_) |
407 | 0 | : Node(KElaboratedTypeSpefType), Kind(Kind_), Child(Child_) {} |
408 | | |
409 | 0 | template<typename Fn> void match(Fn F) const { F(Kind, Child); } |
410 | | |
411 | 0 | void printLeft(OutputStream &S) const override { |
412 | 0 | S += Kind; |
413 | 0 | S += ' '; |
414 | 0 | Child->print(S); |
415 | 0 | } |
416 | | }; |
417 | | |
418 | | struct AbiTagAttr : Node { |
419 | | Node *Base; |
420 | | StringView Tag; |
421 | | |
422 | | AbiTagAttr(Node* Base_, StringView Tag_) |
423 | | : Node(KAbiTagAttr, Base_->RHSComponentCache, |
424 | | Base_->ArrayCache, Base_->FunctionCache), |
425 | 0 | Base(Base_), Tag(Tag_) {} |
426 | | |
427 | 0 | template<typename Fn> void match(Fn F) const { F(Base, Tag); } |
428 | | |
429 | 0 | void printLeft(OutputStream &S) const override { |
430 | 0 | Base->printLeft(S); |
431 | 0 | S += "[abi:"; |
432 | 0 | S += Tag; |
433 | 0 | S += "]"; |
434 | 0 | } |
435 | | }; |
436 | | |
437 | | class EnableIfAttr : public Node { |
438 | | NodeArray Conditions; |
439 | | public: |
440 | | EnableIfAttr(NodeArray Conditions_) |
441 | 0 | : Node(KEnableIfAttr), Conditions(Conditions_) {} |
442 | | |
443 | 0 | template<typename Fn> void match(Fn F) const { F(Conditions); } |
444 | | |
445 | 0 | void printLeft(OutputStream &S) const override { |
446 | 0 | S += " [enable_if:"; |
447 | 0 | Conditions.printWithComma(S); |
448 | 0 | S += ']'; |
449 | 0 | } |
450 | | }; |
451 | | |
452 | | class ObjCProtoName : public Node { |
453 | | const Node *Ty; |
454 | | StringView Protocol; |
455 | | |
456 | | friend class PointerType; |
457 | | |
458 | | public: |
459 | | ObjCProtoName(const Node *Ty_, StringView Protocol_) |
460 | 0 | : Node(KObjCProtoName), Ty(Ty_), Protocol(Protocol_) {} |
461 | | |
462 | 0 | template<typename Fn> void match(Fn F) const { F(Ty, Protocol); } |
463 | | |
464 | 0 | bool isObjCObject() const { |
465 | 0 | return Ty->getKind() == KNameType && |
466 | 0 | static_cast<const NameType *>(Ty)->getName() == "objc_object"; |
467 | 0 | } |
468 | | |
469 | 0 | void printLeft(OutputStream &S) const override { |
470 | 0 | Ty->print(S); |
471 | 0 | S += "<"; |
472 | 0 | S += Protocol; |
473 | 0 | S += ">"; |
474 | 0 | } |
475 | | }; |
476 | | |
477 | | class PointerType final : public Node { |
478 | | const Node *Pointee; |
479 | | |
480 | | public: |
481 | | PointerType(const Node *Pointee_) |
482 | | : Node(KPointerType, Pointee_->RHSComponentCache), |
483 | 0 | Pointee(Pointee_) {} |
484 | | |
485 | 0 | template<typename Fn> void match(Fn F) const { F(Pointee); } |
486 | | |
487 | 0 | bool hasRHSComponentSlow(OutputStream &S) const override { |
488 | 0 | return Pointee->hasRHSComponent(S); |
489 | 0 | } |
490 | | |
491 | 0 | void printLeft(OutputStream &s) const override { |
492 | | // We rewrite objc_object<SomeProtocol>* into id<SomeProtocol>. |
493 | 0 | if (Pointee->getKind() != KObjCProtoName || |
494 | 0 | !static_cast<const ObjCProtoName *>(Pointee)->isObjCObject()) { |
495 | 0 | Pointee->printLeft(s); |
496 | 0 | if (Pointee->hasArray(s)) |
497 | 0 | s += " "; |
498 | 0 | if (Pointee->hasArray(s) || Pointee->hasFunction(s)) |
499 | 0 | s += "("; |
500 | 0 | s += "*"; |
501 | 0 | } else { |
502 | 0 | const auto *objcProto = static_cast<const ObjCProtoName *>(Pointee); |
503 | 0 | s += "id<"; |
504 | 0 | s += objcProto->Protocol; |
505 | 0 | s += ">"; |
506 | 0 | } |
507 | 0 | } |
508 | | |
509 | 0 | void printRight(OutputStream &s) const override { |
510 | 0 | if (Pointee->getKind() != KObjCProtoName || |
511 | 0 | !static_cast<const ObjCProtoName *>(Pointee)->isObjCObject()) { |
512 | 0 | if (Pointee->hasArray(s) || Pointee->hasFunction(s)) |
513 | 0 | s += ")"; |
514 | 0 | Pointee->printRight(s); |
515 | 0 | } |
516 | 0 | } |
517 | | }; |
518 | | |
519 | | enum class ReferenceKind { |
520 | | LValue, |
521 | | RValue, |
522 | | }; |
523 | | |
524 | | // Represents either a LValue or an RValue reference type. |
525 | | class ReferenceType : public Node { |
526 | | const Node *Pointee; |
527 | | ReferenceKind RK; |
528 | | |
529 | | mutable bool Printing = false; |
530 | | |
531 | | // Dig through any refs to refs, collapsing the ReferenceTypes as we go. The |
532 | | // rule here is rvalue ref to rvalue ref collapses to a rvalue ref, and any |
533 | | // other combination collapses to a lvalue ref. |
534 | 0 | std::pair<ReferenceKind, const Node *> collapse(OutputStream &S) const { |
535 | 0 | auto SoFar = std::make_pair(RK, Pointee); |
536 | 0 | for (;;) { |
537 | 0 | const Node *SN = SoFar.second->getSyntaxNode(S); |
538 | 0 | if (SN->getKind() != KReferenceType) |
539 | 0 | break; |
540 | 0 | auto *RT = static_cast<const ReferenceType *>(SN); |
541 | 0 | SoFar.second = RT->Pointee; |
542 | 0 | SoFar.first = std::min(SoFar.first, RT->RK); |
543 | 0 | } |
544 | 0 | return SoFar; |
545 | 0 | } |
546 | | |
547 | | public: |
548 | | ReferenceType(const Node *Pointee_, ReferenceKind RK_) |
549 | | : Node(KReferenceType, Pointee_->RHSComponentCache), |
550 | 0 | Pointee(Pointee_), RK(RK_) {} |
551 | | |
552 | 0 | template<typename Fn> void match(Fn F) const { F(Pointee, RK); } |
553 | | |
554 | 0 | bool hasRHSComponentSlow(OutputStream &S) const override { |
555 | 0 | return Pointee->hasRHSComponent(S); |
556 | 0 | } |
557 | | |
558 | 0 | void printLeft(OutputStream &s) const override { |
559 | 0 | if (Printing) |
560 | 0 | return; |
561 | 0 | SwapAndRestore<bool> SavePrinting(Printing, true); |
562 | 0 | std::pair<ReferenceKind, const Node *> Collapsed = collapse(s); |
563 | 0 | Collapsed.second->printLeft(s); |
564 | 0 | if (Collapsed.second->hasArray(s)) |
565 | 0 | s += " "; |
566 | 0 | if (Collapsed.second->hasArray(s) || Collapsed.second->hasFunction(s)) |
567 | 0 | s += "("; |
568 | |
|
569 | 0 | s += (Collapsed.first == ReferenceKind::LValue ? "&" : "&&"); |
570 | 0 | } |
571 | 0 | void printRight(OutputStream &s) const override { |
572 | 0 | if (Printing) |
573 | 0 | return; |
574 | 0 | SwapAndRestore<bool> SavePrinting(Printing, true); |
575 | 0 | std::pair<ReferenceKind, const Node *> Collapsed = collapse(s); |
576 | 0 | if (Collapsed.second->hasArray(s) || Collapsed.second->hasFunction(s)) |
577 | 0 | s += ")"; |
578 | 0 | Collapsed.second->printRight(s); |
579 | 0 | } |
580 | | }; |
581 | | |
582 | | class PointerToMemberType final : public Node { |
583 | | const Node *ClassType; |
584 | | const Node *MemberType; |
585 | | |
586 | | public: |
587 | | PointerToMemberType(const Node *ClassType_, const Node *MemberType_) |
588 | | : Node(KPointerToMemberType, MemberType_->RHSComponentCache), |
589 | 0 | ClassType(ClassType_), MemberType(MemberType_) {} |
590 | | |
591 | 0 | template<typename Fn> void match(Fn F) const { F(ClassType, MemberType); } |
592 | | |
593 | 0 | bool hasRHSComponentSlow(OutputStream &S) const override { |
594 | 0 | return MemberType->hasRHSComponent(S); |
595 | 0 | } |
596 | | |
597 | 0 | void printLeft(OutputStream &s) const override { |
598 | 0 | MemberType->printLeft(s); |
599 | 0 | if (MemberType->hasArray(s) || MemberType->hasFunction(s)) |
600 | 0 | s += "("; |
601 | 0 | else |
602 | 0 | s += " "; |
603 | 0 | ClassType->print(s); |
604 | 0 | s += "::*"; |
605 | 0 | } |
606 | | |
607 | 0 | void printRight(OutputStream &s) const override { |
608 | 0 | if (MemberType->hasArray(s) || MemberType->hasFunction(s)) |
609 | 0 | s += ")"; |
610 | 0 | MemberType->printRight(s); |
611 | 0 | } |
612 | | }; |
613 | | |
614 | | class ArrayType final : public Node { |
615 | | const Node *Base; |
616 | | Node *Dimension; |
617 | | |
618 | | public: |
619 | | ArrayType(const Node *Base_, Node *Dimension_) |
620 | | : Node(KArrayType, |
621 | | /*RHSComponentCache=*/Cache::Yes, |
622 | | /*ArrayCache=*/Cache::Yes), |
623 | 0 | Base(Base_), Dimension(Dimension_) {} |
624 | | |
625 | 0 | template<typename Fn> void match(Fn F) const { F(Base, Dimension); } |
626 | | |
627 | 0 | bool hasRHSComponentSlow(OutputStream &) const override { return true; } |
628 | 0 | bool hasArraySlow(OutputStream &) const override { return true; } |
629 | | |
630 | 0 | void printLeft(OutputStream &S) const override { Base->printLeft(S); } |
631 | | |
632 | 0 | void printRight(OutputStream &S) const override { |
633 | 0 | if (S.back() != ']') |
634 | 0 | S += " "; |
635 | 0 | S += "["; |
636 | 0 | if (Dimension) |
637 | 0 | Dimension->print(S); |
638 | 0 | S += "]"; |
639 | 0 | Base->printRight(S); |
640 | 0 | } |
641 | | }; |
642 | | |
643 | | class FunctionType final : public Node { |
644 | | const Node *Ret; |
645 | | NodeArray Params; |
646 | | Qualifiers CVQuals; |
647 | | FunctionRefQual RefQual; |
648 | | const Node *ExceptionSpec; |
649 | | |
650 | | public: |
651 | | FunctionType(const Node *Ret_, NodeArray Params_, Qualifiers CVQuals_, |
652 | | FunctionRefQual RefQual_, const Node *ExceptionSpec_) |
653 | | : Node(KFunctionType, |
654 | | /*RHSComponentCache=*/Cache::Yes, /*ArrayCache=*/Cache::No, |
655 | | /*FunctionCache=*/Cache::Yes), |
656 | | Ret(Ret_), Params(Params_), CVQuals(CVQuals_), RefQual(RefQual_), |
657 | 0 | ExceptionSpec(ExceptionSpec_) {} |
658 | | |
659 | 0 | template<typename Fn> void match(Fn F) const { |
660 | 0 | F(Ret, Params, CVQuals, RefQual, ExceptionSpec); |
661 | 0 | } |
662 | | |
663 | 0 | bool hasRHSComponentSlow(OutputStream &) const override { return true; } |
664 | 0 | bool hasFunctionSlow(OutputStream &) const override { return true; } |
665 | | |
666 | | // Handle C++'s ... quirky decl grammar by using the left & right |
667 | | // distinction. Consider: |
668 | | // int (*f(float))(char) {} |
669 | | // f is a function that takes a float and returns a pointer to a function |
670 | | // that takes a char and returns an int. If we're trying to print f, start |
671 | | // by printing out the return types's left, then print our parameters, then |
672 | | // finally print right of the return type. |
673 | 0 | void printLeft(OutputStream &S) const override { |
674 | 0 | Ret->printLeft(S); |
675 | 0 | S += " "; |
676 | 0 | } |
677 | | |
678 | 0 | void printRight(OutputStream &S) const override { |
679 | 0 | S += "("; |
680 | 0 | Params.printWithComma(S); |
681 | 0 | S += ")"; |
682 | 0 | Ret->printRight(S); |
683 | |
|
684 | 0 | if (CVQuals & QualConst) |
685 | 0 | S += " const"; |
686 | 0 | if (CVQuals & QualVolatile) |
687 | 0 | S += " volatile"; |
688 | 0 | if (CVQuals & QualRestrict) |
689 | 0 | S += " restrict"; |
690 | |
|
691 | 0 | if (RefQual == FrefQualLValue) |
692 | 0 | S += " &"; |
693 | 0 | else if (RefQual == FrefQualRValue) |
694 | 0 | S += " &&"; |
695 | |
|
696 | 0 | if (ExceptionSpec != nullptr) { |
697 | 0 | S += ' '; |
698 | 0 | ExceptionSpec->print(S); |
699 | 0 | } |
700 | 0 | } |
701 | | }; |
702 | | |
703 | | class NoexceptSpec : public Node { |
704 | | const Node *E; |
705 | | public: |
706 | 0 | NoexceptSpec(const Node *E_) : Node(KNoexceptSpec), E(E_) {} |
707 | | |
708 | 0 | template<typename Fn> void match(Fn F) const { F(E); } |
709 | | |
710 | 0 | void printLeft(OutputStream &S) const override { |
711 | 0 | S += "noexcept("; |
712 | 0 | E->print(S); |
713 | 0 | S += ")"; |
714 | 0 | } |
715 | | }; |
716 | | |
717 | | class DynamicExceptionSpec : public Node { |
718 | | NodeArray Types; |
719 | | public: |
720 | | DynamicExceptionSpec(NodeArray Types_) |
721 | 0 | : Node(KDynamicExceptionSpec), Types(Types_) {} |
722 | | |
723 | 0 | template<typename Fn> void match(Fn F) const { F(Types); } |
724 | | |
725 | 0 | void printLeft(OutputStream &S) const override { |
726 | 0 | S += "throw("; |
727 | 0 | Types.printWithComma(S); |
728 | 0 | S += ')'; |
729 | 0 | } |
730 | | }; |
731 | | |
732 | | class FunctionEncoding final : public Node { |
733 | | const Node *Ret; |
734 | | const Node *Name; |
735 | | NodeArray Params; |
736 | | const Node *Attrs; |
737 | | Qualifiers CVQuals; |
738 | | FunctionRefQual RefQual; |
739 | | |
740 | | public: |
741 | | FunctionEncoding(const Node *Ret_, const Node *Name_, NodeArray Params_, |
742 | | const Node *Attrs_, Qualifiers CVQuals_, |
743 | | FunctionRefQual RefQual_) |
744 | | : Node(KFunctionEncoding, |
745 | | /*RHSComponentCache=*/Cache::Yes, /*ArrayCache=*/Cache::No, |
746 | | /*FunctionCache=*/Cache::Yes), |
747 | | Ret(Ret_), Name(Name_), Params(Params_), Attrs(Attrs_), |
748 | 0 | CVQuals(CVQuals_), RefQual(RefQual_) {} |
749 | | |
750 | 0 | template<typename Fn> void match(Fn F) const { |
751 | 0 | F(Ret, Name, Params, Attrs, CVQuals, RefQual); |
752 | 0 | } |
753 | | |
754 | 0 | Qualifiers getCVQuals() const { return CVQuals; } |
755 | 0 | FunctionRefQual getRefQual() const { return RefQual; } |
756 | 0 | NodeArray getParams() const { return Params; } |
757 | 0 | const Node *getReturnType() const { return Ret; } |
758 | | |
759 | 0 | bool hasRHSComponentSlow(OutputStream &) const override { return true; } |
760 | 0 | bool hasFunctionSlow(OutputStream &) const override { return true; } |
761 | | |
762 | 0 | const Node *getName() const { return Name; } |
763 | | |
764 | 0 | void printLeft(OutputStream &S) const override { |
765 | 0 | if (Ret) { |
766 | 0 | Ret->printLeft(S); |
767 | 0 | if (!Ret->hasRHSComponent(S)) |
768 | 0 | S += " "; |
769 | 0 | } |
770 | 0 | Name->print(S); |
771 | 0 | } |
772 | | |
773 | 0 | void printRight(OutputStream &S) const override { |
774 | 0 | S += "("; |
775 | 0 | Params.printWithComma(S); |
776 | 0 | S += ")"; |
777 | 0 | if (Ret) |
778 | 0 | Ret->printRight(S); |
779 | |
|
780 | 0 | if (CVQuals & QualConst) |
781 | 0 | S += " const"; |
782 | 0 | if (CVQuals & QualVolatile) |
783 | 0 | S += " volatile"; |
784 | 0 | if (CVQuals & QualRestrict) |
785 | 0 | S += " restrict"; |
786 | |
|
787 | 0 | if (RefQual == FrefQualLValue) |
788 | 0 | S += " &"; |
789 | 0 | else if (RefQual == FrefQualRValue) |
790 | 0 | S += " &&"; |
791 | |
|
792 | 0 | if (Attrs != nullptr) |
793 | 0 | Attrs->print(S); |
794 | 0 | } |
795 | | }; |
796 | | |
797 | | class LiteralOperator : public Node { |
798 | | const Node *OpName; |
799 | | |
800 | | public: |
801 | | LiteralOperator(const Node *OpName_) |
802 | 0 | : Node(KLiteralOperator), OpName(OpName_) {} |
803 | | |
804 | 0 | template<typename Fn> void match(Fn F) const { F(OpName); } |
805 | | |
806 | 0 | void printLeft(OutputStream &S) const override { |
807 | 0 | S += "operator\"\" "; |
808 | 0 | OpName->print(S); |
809 | 0 | } |
810 | | }; |
811 | | |
812 | | class SpecialName final : public Node { |
813 | | const StringView Special; |
814 | | const Node *Child; |
815 | | |
816 | | public: |
817 | | SpecialName(StringView Special_, const Node *Child_) |
818 | 0 | : Node(KSpecialName), Special(Special_), Child(Child_) {} |
819 | | |
820 | 0 | template<typename Fn> void match(Fn F) const { F(Special, Child); } |
821 | | |
822 | 0 | void printLeft(OutputStream &S) const override { |
823 | 0 | S += Special; |
824 | 0 | Child->print(S); |
825 | 0 | } |
826 | | }; |
827 | | |
828 | | class CtorVtableSpecialName final : public Node { |
829 | | const Node *FirstType; |
830 | | const Node *SecondType; |
831 | | |
832 | | public: |
833 | | CtorVtableSpecialName(const Node *FirstType_, const Node *SecondType_) |
834 | | : Node(KCtorVtableSpecialName), |
835 | 0 | FirstType(FirstType_), SecondType(SecondType_) {} |
836 | | |
837 | 0 | template<typename Fn> void match(Fn F) const { F(FirstType, SecondType); } |
838 | | |
839 | 0 | void printLeft(OutputStream &S) const override { |
840 | 0 | S += "construction vtable for "; |
841 | 0 | FirstType->print(S); |
842 | 0 | S += "-in-"; |
843 | 0 | SecondType->print(S); |
844 | 0 | } |
845 | | }; |
846 | | |
847 | | struct NestedName : Node { |
848 | | Node *Qual; |
849 | | Node *Name; |
850 | | |
851 | | NestedName(Node *Qual_, Node *Name_) |
852 | 0 | : Node(KNestedName), Qual(Qual_), Name(Name_) {} |
853 | | |
854 | 0 | template<typename Fn> void match(Fn F) const { F(Qual, Name); } |
855 | | |
856 | 0 | StringView getBaseName() const override { return Name->getBaseName(); } |
857 | | |
858 | 0 | void printLeft(OutputStream &S) const override { |
859 | 0 | Qual->print(S); |
860 | 0 | S += "::"; |
861 | 0 | Name->print(S); |
862 | 0 | } |
863 | | }; |
864 | | |
865 | | struct LocalName : Node { |
866 | | Node *Encoding; |
867 | | Node *Entity; |
868 | | |
869 | | LocalName(Node *Encoding_, Node *Entity_) |
870 | 0 | : Node(KLocalName), Encoding(Encoding_), Entity(Entity_) {} |
871 | | |
872 | 0 | template<typename Fn> void match(Fn F) const { F(Encoding, Entity); } |
873 | | |
874 | 0 | void printLeft(OutputStream &S) const override { |
875 | 0 | Encoding->print(S); |
876 | 0 | S += "::"; |
877 | 0 | Entity->print(S); |
878 | 0 | } |
879 | | }; |
880 | | |
881 | | class QualifiedName final : public Node { |
882 | | // qualifier::name |
883 | | const Node *Qualifier; |
884 | | const Node *Name; |
885 | | |
886 | | public: |
887 | | QualifiedName(const Node *Qualifier_, const Node *Name_) |
888 | 0 | : Node(KQualifiedName), Qualifier(Qualifier_), Name(Name_) {} |
889 | | |
890 | 0 | template<typename Fn> void match(Fn F) const { F(Qualifier, Name); } |
891 | | |
892 | 0 | StringView getBaseName() const override { return Name->getBaseName(); } |
893 | | |
894 | 0 | void printLeft(OutputStream &S) const override { |
895 | 0 | Qualifier->print(S); |
896 | 0 | S += "::"; |
897 | 0 | Name->print(S); |
898 | 0 | } |
899 | | }; |
900 | | |
901 | | class VectorType final : public Node { |
902 | | const Node *BaseType; |
903 | | const Node *Dimension; |
904 | | |
905 | | public: |
906 | | VectorType(const Node *BaseType_, Node *Dimension_) |
907 | | : Node(KVectorType), BaseType(BaseType_), |
908 | 0 | Dimension(Dimension_) {} |
909 | | |
910 | 0 | template<typename Fn> void match(Fn F) const { F(BaseType, Dimension); } |
911 | | |
912 | 0 | void printLeft(OutputStream &S) const override { |
913 | 0 | BaseType->print(S); |
914 | 0 | S += " vector["; |
915 | 0 | if (Dimension) |
916 | 0 | Dimension->print(S); |
917 | 0 | S += "]"; |
918 | 0 | } |
919 | | }; |
920 | | |
921 | | class PixelVectorType final : public Node { |
922 | | const Node *Dimension; |
923 | | |
924 | | public: |
925 | | PixelVectorType(const Node *Dimension_) |
926 | 0 | : Node(KPixelVectorType), Dimension(Dimension_) {} |
927 | | |
928 | 0 | template<typename Fn> void match(Fn F) const { F(Dimension); } |
929 | | |
930 | 0 | void printLeft(OutputStream &S) const override { |
931 | | // FIXME: This should demangle as "vector pixel". |
932 | 0 | S += "pixel vector["; |
933 | 0 | Dimension->print(S); |
934 | 0 | S += "]"; |
935 | 0 | } |
936 | | }; |
937 | | |
938 | | enum class TemplateParamKind { Type, NonType, Template }; |
939 | | |
940 | | /// An invented name for a template parameter for which we don't have a |
941 | | /// corresponding template argument. |
942 | | /// |
943 | | /// This node is created when parsing the <lambda-sig> for a lambda with |
944 | | /// explicit template arguments, which might be referenced in the parameter |
945 | | /// types appearing later in the <lambda-sig>. |
946 | | class SyntheticTemplateParamName final : public Node { |
947 | | TemplateParamKind Kind; |
948 | | unsigned Index; |
949 | | |
950 | | public: |
951 | | SyntheticTemplateParamName(TemplateParamKind Kind_, unsigned Index_) |
952 | 0 | : Node(KSyntheticTemplateParamName), Kind(Kind_), Index(Index_) {} |
953 | | |
954 | 0 | template<typename Fn> void match(Fn F) const { F(Kind, Index); } |
955 | | |
956 | 0 | void printLeft(OutputStream &S) const override { |
957 | 0 | switch (Kind) { |
958 | 0 | case TemplateParamKind::Type: |
959 | 0 | S += "$T"; |
960 | 0 | break; |
961 | 0 | case TemplateParamKind::NonType: |
962 | 0 | S += "$N"; |
963 | 0 | break; |
964 | 0 | case TemplateParamKind::Template: |
965 | 0 | S += "$TT"; |
966 | 0 | break; |
967 | 0 | } |
968 | 0 | if (Index > 0) |
969 | 0 | S << Index - 1; |
970 | 0 | } |
971 | | }; |
972 | | |
973 | | /// A template type parameter declaration, 'typename T'. |
974 | | class TypeTemplateParamDecl final : public Node { |
975 | | Node *Name; |
976 | | |
977 | | public: |
978 | | TypeTemplateParamDecl(Node *Name_) |
979 | 0 | : Node(KTypeTemplateParamDecl, Cache::Yes), Name(Name_) {} |
980 | | |
981 | 0 | template<typename Fn> void match(Fn F) const { F(Name); } |
982 | | |
983 | 0 | void printLeft(OutputStream &S) const override { |
984 | 0 | S += "typename "; |
985 | 0 | } |
986 | | |
987 | 0 | void printRight(OutputStream &S) const override { |
988 | 0 | Name->print(S); |
989 | 0 | } |
990 | | }; |
991 | | |
992 | | /// A non-type template parameter declaration, 'int N'. |
993 | | class NonTypeTemplateParamDecl final : public Node { |
994 | | Node *Name; |
995 | | Node *Type; |
996 | | |
997 | | public: |
998 | | NonTypeTemplateParamDecl(Node *Name_, Node *Type_) |
999 | 0 | : Node(KNonTypeTemplateParamDecl, Cache::Yes), Name(Name_), Type(Type_) {} |
1000 | | |
1001 | 0 | template<typename Fn> void match(Fn F) const { F(Name, Type); } |
1002 | | |
1003 | 0 | void printLeft(OutputStream &S) const override { |
1004 | 0 | Type->printLeft(S); |
1005 | 0 | if (!Type->hasRHSComponent(S)) |
1006 | 0 | S += " "; |
1007 | 0 | } |
1008 | | |
1009 | 0 | void printRight(OutputStream &S) const override { |
1010 | 0 | Name->print(S); |
1011 | 0 | Type->printRight(S); |
1012 | 0 | } |
1013 | | }; |
1014 | | |
1015 | | /// A template template parameter declaration, |
1016 | | /// 'template<typename T> typename N'. |
1017 | | class TemplateTemplateParamDecl final : public Node { |
1018 | | Node *Name; |
1019 | | NodeArray Params; |
1020 | | |
1021 | | public: |
1022 | | TemplateTemplateParamDecl(Node *Name_, NodeArray Params_) |
1023 | | : Node(KTemplateTemplateParamDecl, Cache::Yes), Name(Name_), |
1024 | 0 | Params(Params_) {} |
1025 | | |
1026 | 0 | template<typename Fn> void match(Fn F) const { F(Name, Params); } |
1027 | | |
1028 | 0 | void printLeft(OutputStream &S) const override { |
1029 | 0 | S += "template<"; |
1030 | 0 | Params.printWithComma(S); |
1031 | 0 | S += "> typename "; |
1032 | 0 | } |
1033 | | |
1034 | 0 | void printRight(OutputStream &S) const override { |
1035 | 0 | Name->print(S); |
1036 | 0 | } |
1037 | | }; |
1038 | | |
1039 | | /// A template parameter pack declaration, 'typename ...T'. |
1040 | | class TemplateParamPackDecl final : public Node { |
1041 | | Node *Param; |
1042 | | |
1043 | | public: |
1044 | | TemplateParamPackDecl(Node *Param_) |
1045 | 0 | : Node(KTemplateParamPackDecl, Cache::Yes), Param(Param_) {} |
1046 | | |
1047 | 0 | template<typename Fn> void match(Fn F) const { F(Param); } |
1048 | | |
1049 | 0 | void printLeft(OutputStream &S) const override { |
1050 | 0 | Param->printLeft(S); |
1051 | 0 | S += "..."; |
1052 | 0 | } |
1053 | | |
1054 | 0 | void printRight(OutputStream &S) const override { |
1055 | 0 | Param->printRight(S); |
1056 | 0 | } |
1057 | | }; |
1058 | | |
1059 | | /// An unexpanded parameter pack (either in the expression or type context). If |
1060 | | /// this AST is correct, this node will have a ParameterPackExpansion node above |
1061 | | /// it. |
1062 | | /// |
1063 | | /// This node is created when some <template-args> are found that apply to an |
1064 | | /// <encoding>, and is stored in the TemplateParams table. In order for this to |
1065 | | /// appear in the final AST, it has to referenced via a <template-param> (ie, |
1066 | | /// T_). |
1067 | | class ParameterPack final : public Node { |
1068 | | NodeArray Data; |
1069 | | |
1070 | | // Setup OutputStream for a pack expansion unless we're already expanding one. |
1071 | 0 | void initializePackExpansion(OutputStream &S) const { |
1072 | 0 | if (S.CurrentPackMax == std::numeric_limits<unsigned>::max()) { |
1073 | 0 | S.CurrentPackMax = static_cast<unsigned>(Data.size()); |
1074 | 0 | S.CurrentPackIndex = 0; |
1075 | 0 | } |
1076 | 0 | } |
1077 | | |
1078 | | public: |
1079 | 0 | ParameterPack(NodeArray Data_) : Node(KParameterPack), Data(Data_) { |
1080 | 0 | ArrayCache = FunctionCache = RHSComponentCache = Cache::Unknown; |
1081 | 0 | if (std::all_of(Data.begin(), Data.end(), [](Node* P) { |
1082 | 0 | return P->ArrayCache == Cache::No; |
1083 | 0 | })) |
1084 | 0 | ArrayCache = Cache::No; |
1085 | 0 | if (std::all_of(Data.begin(), Data.end(), [](Node* P) { |
1086 | 0 | return P->FunctionCache == Cache::No; |
1087 | 0 | })) |
1088 | 0 | FunctionCache = Cache::No; |
1089 | 0 | if (std::all_of(Data.begin(), Data.end(), [](Node* P) { |
1090 | 0 | return P->RHSComponentCache == Cache::No; |
1091 | 0 | })) |
1092 | 0 | RHSComponentCache = Cache::No; |
1093 | 0 | } |
1094 | | |
1095 | 0 | template<typename Fn> void match(Fn F) const { F(Data); } |
1096 | | |
1097 | 0 | bool hasRHSComponentSlow(OutputStream &S) const override { |
1098 | 0 | initializePackExpansion(S); |
1099 | 0 | size_t Idx = S.CurrentPackIndex; |
1100 | 0 | return Idx < Data.size() && Data[Idx]->hasRHSComponent(S); |
1101 | 0 | } |
1102 | 0 | bool hasArraySlow(OutputStream &S) const override { |
1103 | 0 | initializePackExpansion(S); |
1104 | 0 | size_t Idx = S.CurrentPackIndex; |
1105 | 0 | return Idx < Data.size() && Data[Idx]->hasArray(S); |
1106 | 0 | } |
1107 | 0 | bool hasFunctionSlow(OutputStream &S) const override { |
1108 | 0 | initializePackExpansion(S); |
1109 | 0 | size_t Idx = S.CurrentPackIndex; |
1110 | 0 | return Idx < Data.size() && Data[Idx]->hasFunction(S); |
1111 | 0 | } |
1112 | 0 | const Node *getSyntaxNode(OutputStream &S) const override { |
1113 | 0 | initializePackExpansion(S); |
1114 | 0 | size_t Idx = S.CurrentPackIndex; |
1115 | 0 | return Idx < Data.size() ? Data[Idx]->getSyntaxNode(S) : this; |
1116 | 0 | } |
1117 | | |
1118 | 0 | void printLeft(OutputStream &S) const override { |
1119 | 0 | initializePackExpansion(S); |
1120 | 0 | size_t Idx = S.CurrentPackIndex; |
1121 | 0 | if (Idx < Data.size()) |
1122 | 0 | Data[Idx]->printLeft(S); |
1123 | 0 | } |
1124 | 0 | void printRight(OutputStream &S) const override { |
1125 | 0 | initializePackExpansion(S); |
1126 | 0 | size_t Idx = S.CurrentPackIndex; |
1127 | 0 | if (Idx < Data.size()) |
1128 | 0 | Data[Idx]->printRight(S); |
1129 | 0 | } |
1130 | | }; |
1131 | | |
1132 | | /// A variadic template argument. This node represents an occurrence of |
1133 | | /// J<something>E in some <template-args>. It isn't itself unexpanded, unless |
1134 | | /// one of it's Elements is. The parser inserts a ParameterPack into the |
1135 | | /// TemplateParams table if the <template-args> this pack belongs to apply to an |
1136 | | /// <encoding>. |
1137 | | class TemplateArgumentPack final : public Node { |
1138 | | NodeArray Elements; |
1139 | | public: |
1140 | | TemplateArgumentPack(NodeArray Elements_) |
1141 | 0 | : Node(KTemplateArgumentPack), Elements(Elements_) {} |
1142 | | |
1143 | 0 | template<typename Fn> void match(Fn F) const { F(Elements); } |
1144 | | |
1145 | 0 | NodeArray getElements() const { return Elements; } |
1146 | | |
1147 | 0 | void printLeft(OutputStream &S) const override { |
1148 | 0 | Elements.printWithComma(S); |
1149 | 0 | } |
1150 | | }; |
1151 | | |
1152 | | /// A pack expansion. Below this node, there are some unexpanded ParameterPacks |
1153 | | /// which each have Child->ParameterPackSize elements. |
1154 | | class ParameterPackExpansion final : public Node { |
1155 | | const Node *Child; |
1156 | | |
1157 | | public: |
1158 | | ParameterPackExpansion(const Node *Child_) |
1159 | 0 | : Node(KParameterPackExpansion), Child(Child_) {} |
1160 | | |
1161 | 0 | template<typename Fn> void match(Fn F) const { F(Child); } |
1162 | | |
1163 | 0 | const Node *getChild() const { return Child; } |
1164 | | |
1165 | 0 | void printLeft(OutputStream &S) const override { |
1166 | 0 | constexpr unsigned Max = std::numeric_limits<unsigned>::max(); |
1167 | 0 | SwapAndRestore<unsigned> SavePackIdx(S.CurrentPackIndex, Max); |
1168 | 0 | SwapAndRestore<unsigned> SavePackMax(S.CurrentPackMax, Max); |
1169 | 0 | size_t StreamPos = S.getCurrentPosition(); |
1170 | | |
1171 | | // Print the first element in the pack. If Child contains a ParameterPack, |
1172 | | // it will set up S.CurrentPackMax and print the first element. |
1173 | 0 | Child->print(S); |
1174 | | |
1175 | | // No ParameterPack was found in Child. This can occur if we've found a pack |
1176 | | // expansion on a <function-param>. |
1177 | 0 | if (S.CurrentPackMax == Max) { |
1178 | 0 | S += "..."; |
1179 | 0 | return; |
1180 | 0 | } |
1181 | | |
1182 | | // We found a ParameterPack, but it has no elements. Erase whatever we may |
1183 | | // of printed. |
1184 | 0 | if (S.CurrentPackMax == 0) { |
1185 | 0 | S.setCurrentPosition(StreamPos); |
1186 | 0 | return; |
1187 | 0 | } |
1188 | | |
1189 | | // Else, iterate through the rest of the elements in the pack. |
1190 | 0 | for (unsigned I = 1, E = S.CurrentPackMax; I < E; ++I) { |
1191 | 0 | S += ", "; |
1192 | 0 | S.CurrentPackIndex = I; |
1193 | 0 | Child->print(S); |
1194 | 0 | } |
1195 | 0 | } |
1196 | | }; |
1197 | | |
1198 | | class TemplateArgs final : public Node { |
1199 | | NodeArray Params; |
1200 | | |
1201 | | public: |
1202 | 0 | TemplateArgs(NodeArray Params_) : Node(KTemplateArgs), Params(Params_) {} |
1203 | | |
1204 | 0 | template<typename Fn> void match(Fn F) const { F(Params); } |
1205 | | |
1206 | 0 | NodeArray getParams() { return Params; } |
1207 | | |
1208 | 0 | void printLeft(OutputStream &S) const override { |
1209 | 0 | S += "<"; |
1210 | 0 | Params.printWithComma(S); |
1211 | 0 | if (S.back() == '>') |
1212 | 0 | S += " "; |
1213 | 0 | S += ">"; |
1214 | 0 | } |
1215 | | }; |
1216 | | |
1217 | | /// A forward-reference to a template argument that was not known at the point |
1218 | | /// where the template parameter name was parsed in a mangling. |
1219 | | /// |
1220 | | /// This is created when demangling the name of a specialization of a |
1221 | | /// conversion function template: |
1222 | | /// |
1223 | | /// \code |
1224 | | /// struct A { |
1225 | | /// template<typename T> operator T*(); |
1226 | | /// }; |
1227 | | /// \endcode |
1228 | | /// |
1229 | | /// When demangling a specialization of the conversion function template, we |
1230 | | /// encounter the name of the template (including the \c T) before we reach |
1231 | | /// the template argument list, so we cannot substitute the parameter name |
1232 | | /// for the corresponding argument while parsing. Instead, we create a |
1233 | | /// \c ForwardTemplateReference node that is resolved after we parse the |
1234 | | /// template arguments. |
1235 | | struct ForwardTemplateReference : Node { |
1236 | | size_t Index; |
1237 | | Node *Ref = nullptr; |
1238 | | |
1239 | | // If we're currently printing this node. It is possible (though invalid) for |
1240 | | // a forward template reference to refer to itself via a substitution. This |
1241 | | // creates a cyclic AST, which will stack overflow printing. To fix this, bail |
1242 | | // out if more than one print* function is active. |
1243 | | mutable bool Printing = false; |
1244 | | |
1245 | | ForwardTemplateReference(size_t Index_) |
1246 | | : Node(KForwardTemplateReference, Cache::Unknown, Cache::Unknown, |
1247 | | Cache::Unknown), |
1248 | 0 | Index(Index_) {} |
1249 | | |
1250 | | // We don't provide a matcher for these, because the value of the node is |
1251 | | // not determined by its construction parameters, and it generally needs |
1252 | | // special handling. |
1253 | | template<typename Fn> void match(Fn F) const = delete; |
1254 | | |
1255 | 0 | bool hasRHSComponentSlow(OutputStream &S) const override { |
1256 | 0 | if (Printing) |
1257 | 0 | return false; |
1258 | 0 | SwapAndRestore<bool> SavePrinting(Printing, true); |
1259 | 0 | return Ref->hasRHSComponent(S); |
1260 | 0 | } |
1261 | 0 | bool hasArraySlow(OutputStream &S) const override { |
1262 | 0 | if (Printing) |
1263 | 0 | return false; |
1264 | 0 | SwapAndRestore<bool> SavePrinting(Printing, true); |
1265 | 0 | return Ref->hasArray(S); |
1266 | 0 | } |
1267 | 0 | bool hasFunctionSlow(OutputStream &S) const override { |
1268 | 0 | if (Printing) |
1269 | 0 | return false; |
1270 | 0 | SwapAndRestore<bool> SavePrinting(Printing, true); |
1271 | 0 | return Ref->hasFunction(S); |
1272 | 0 | } |
1273 | 0 | const Node *getSyntaxNode(OutputStream &S) const override { |
1274 | 0 | if (Printing) |
1275 | 0 | return this; |
1276 | 0 | SwapAndRestore<bool> SavePrinting(Printing, true); |
1277 | 0 | return Ref->getSyntaxNode(S); |
1278 | 0 | } |
1279 | | |
1280 | 0 | void printLeft(OutputStream &S) const override { |
1281 | 0 | if (Printing) |
1282 | 0 | return; |
1283 | 0 | SwapAndRestore<bool> SavePrinting(Printing, true); |
1284 | 0 | Ref->printLeft(S); |
1285 | 0 | } |
1286 | 0 | void printRight(OutputStream &S) const override { |
1287 | 0 | if (Printing) |
1288 | 0 | return; |
1289 | 0 | SwapAndRestore<bool> SavePrinting(Printing, true); |
1290 | 0 | Ref->printRight(S); |
1291 | 0 | } |
1292 | | }; |
1293 | | |
1294 | | struct NameWithTemplateArgs : Node { |
1295 | | // name<template_args> |
1296 | | Node *Name; |
1297 | | Node *TemplateArgs; |
1298 | | |
1299 | | NameWithTemplateArgs(Node *Name_, Node *TemplateArgs_) |
1300 | 0 | : Node(KNameWithTemplateArgs), Name(Name_), TemplateArgs(TemplateArgs_) {} |
1301 | | |
1302 | 0 | template<typename Fn> void match(Fn F) const { F(Name, TemplateArgs); } |
1303 | | |
1304 | 0 | StringView getBaseName() const override { return Name->getBaseName(); } |
1305 | | |
1306 | 0 | void printLeft(OutputStream &S) const override { |
1307 | 0 | Name->print(S); |
1308 | 0 | TemplateArgs->print(S); |
1309 | 0 | } |
1310 | | }; |
1311 | | |
1312 | | class GlobalQualifiedName final : public Node { |
1313 | | Node *Child; |
1314 | | |
1315 | | public: |
1316 | | GlobalQualifiedName(Node* Child_) |
1317 | 0 | : Node(KGlobalQualifiedName), Child(Child_) {} |
1318 | | |
1319 | 0 | template<typename Fn> void match(Fn F) const { F(Child); } |
1320 | | |
1321 | 0 | StringView getBaseName() const override { return Child->getBaseName(); } |
1322 | | |
1323 | 0 | void printLeft(OutputStream &S) const override { |
1324 | 0 | S += "::"; |
1325 | 0 | Child->print(S); |
1326 | 0 | } |
1327 | | }; |
1328 | | |
1329 | | struct StdQualifiedName : Node { |
1330 | | Node *Child; |
1331 | | |
1332 | 0 | StdQualifiedName(Node *Child_) : Node(KStdQualifiedName), Child(Child_) {} |
1333 | | |
1334 | 0 | template<typename Fn> void match(Fn F) const { F(Child); } |
1335 | | |
1336 | 0 | StringView getBaseName() const override { return Child->getBaseName(); } |
1337 | | |
1338 | 0 | void printLeft(OutputStream &S) const override { |
1339 | 0 | S += "std::"; |
1340 | 0 | Child->print(S); |
1341 | 0 | } |
1342 | | }; |
1343 | | |
1344 | | enum class SpecialSubKind { |
1345 | | allocator, |
1346 | | basic_string, |
1347 | | string, |
1348 | | istream, |
1349 | | ostream, |
1350 | | iostream, |
1351 | | }; |
1352 | | |
1353 | | class ExpandedSpecialSubstitution final : public Node { |
1354 | | SpecialSubKind SSK; |
1355 | | |
1356 | | public: |
1357 | | ExpandedSpecialSubstitution(SpecialSubKind SSK_) |
1358 | 0 | : Node(KExpandedSpecialSubstitution), SSK(SSK_) {} |
1359 | | |
1360 | 0 | template<typename Fn> void match(Fn F) const { F(SSK); } |
1361 | | |
1362 | 0 | StringView getBaseName() const override { |
1363 | 0 | switch (SSK) { |
1364 | 0 | case SpecialSubKind::allocator: |
1365 | 0 | return StringView("allocator"); |
1366 | 0 | case SpecialSubKind::basic_string: |
1367 | 0 | return StringView("basic_string"); |
1368 | 0 | case SpecialSubKind::string: |
1369 | 0 | return StringView("basic_string"); |
1370 | 0 | case SpecialSubKind::istream: |
1371 | 0 | return StringView("basic_istream"); |
1372 | 0 | case SpecialSubKind::ostream: |
1373 | 0 | return StringView("basic_ostream"); |
1374 | 0 | case SpecialSubKind::iostream: |
1375 | 0 | return StringView("basic_iostream"); |
1376 | 0 | } |
1377 | 0 | DEMANGLE_UNREACHABLE; |
1378 | 0 | } |
1379 | | |
1380 | 0 | void printLeft(OutputStream &S) const override { |
1381 | 0 | switch (SSK) { |
1382 | 0 | case SpecialSubKind::allocator: |
1383 | 0 | S += "std::allocator"; |
1384 | 0 | break; |
1385 | 0 | case SpecialSubKind::basic_string: |
1386 | 0 | S += "std::basic_string"; |
1387 | 0 | break; |
1388 | 0 | case SpecialSubKind::string: |
1389 | 0 | S += "std::basic_string<char, std::char_traits<char>, " |
1390 | 0 | "std::allocator<char> >"; |
1391 | 0 | break; |
1392 | 0 | case SpecialSubKind::istream: |
1393 | 0 | S += "std::basic_istream<char, std::char_traits<char> >"; |
1394 | 0 | break; |
1395 | 0 | case SpecialSubKind::ostream: |
1396 | 0 | S += "std::basic_ostream<char, std::char_traits<char> >"; |
1397 | 0 | break; |
1398 | 0 | case SpecialSubKind::iostream: |
1399 | 0 | S += "std::basic_iostream<char, std::char_traits<char> >"; |
1400 | 0 | break; |
1401 | 0 | } |
1402 | 0 | } |
1403 | | }; |
1404 | | |
1405 | | class SpecialSubstitution final : public Node { |
1406 | | public: |
1407 | | SpecialSubKind SSK; |
1408 | | |
1409 | | SpecialSubstitution(SpecialSubKind SSK_) |
1410 | 0 | : Node(KSpecialSubstitution), SSK(SSK_) {} |
1411 | | |
1412 | 0 | template<typename Fn> void match(Fn F) const { F(SSK); } |
1413 | | |
1414 | 0 | StringView getBaseName() const override { |
1415 | 0 | switch (SSK) { |
1416 | 0 | case SpecialSubKind::allocator: |
1417 | 0 | return StringView("allocator"); |
1418 | 0 | case SpecialSubKind::basic_string: |
1419 | 0 | return StringView("basic_string"); |
1420 | 0 | case SpecialSubKind::string: |
1421 | 0 | return StringView("string"); |
1422 | 0 | case SpecialSubKind::istream: |
1423 | 0 | return StringView("istream"); |
1424 | 0 | case SpecialSubKind::ostream: |
1425 | 0 | return StringView("ostream"); |
1426 | 0 | case SpecialSubKind::iostream: |
1427 | 0 | return StringView("iostream"); |
1428 | 0 | } |
1429 | 0 | DEMANGLE_UNREACHABLE; |
1430 | 0 | } |
1431 | | |
1432 | 0 | void printLeft(OutputStream &S) const override { |
1433 | 0 | switch (SSK) { |
1434 | 0 | case SpecialSubKind::allocator: |
1435 | 0 | S += "std::allocator"; |
1436 | 0 | break; |
1437 | 0 | case SpecialSubKind::basic_string: |
1438 | 0 | S += "std::basic_string"; |
1439 | 0 | break; |
1440 | 0 | case SpecialSubKind::string: |
1441 | 0 | S += "std::string"; |
1442 | 0 | break; |
1443 | 0 | case SpecialSubKind::istream: |
1444 | 0 | S += "std::istream"; |
1445 | 0 | break; |
1446 | 0 | case SpecialSubKind::ostream: |
1447 | 0 | S += "std::ostream"; |
1448 | 0 | break; |
1449 | 0 | case SpecialSubKind::iostream: |
1450 | 0 | S += "std::iostream"; |
1451 | 0 | break; |
1452 | 0 | } |
1453 | 0 | } |
1454 | | }; |
1455 | | |
1456 | | class CtorDtorName final : public Node { |
1457 | | const Node *Basename; |
1458 | | const bool IsDtor; |
1459 | | const int Variant; |
1460 | | |
1461 | | public: |
1462 | | CtorDtorName(const Node *Basename_, bool IsDtor_, int Variant_) |
1463 | | : Node(KCtorDtorName), Basename(Basename_), IsDtor(IsDtor_), |
1464 | 0 | Variant(Variant_) {} |
1465 | | |
1466 | 0 | template<typename Fn> void match(Fn F) const { F(Basename, IsDtor, Variant); } |
1467 | | |
1468 | 0 | void printLeft(OutputStream &S) const override { |
1469 | 0 | if (IsDtor) |
1470 | 0 | S += "~"; |
1471 | 0 | S += Basename->getBaseName(); |
1472 | 0 | } |
1473 | | }; |
1474 | | |
1475 | | class DtorName : public Node { |
1476 | | const Node *Base; |
1477 | | |
1478 | | public: |
1479 | 0 | DtorName(const Node *Base_) : Node(KDtorName), Base(Base_) {} |
1480 | | |
1481 | 0 | template<typename Fn> void match(Fn F) const { F(Base); } |
1482 | | |
1483 | 0 | void printLeft(OutputStream &S) const override { |
1484 | 0 | S += "~"; |
1485 | 0 | Base->printLeft(S); |
1486 | 0 | } |
1487 | | }; |
1488 | | |
1489 | | class UnnamedTypeName : public Node { |
1490 | | const StringView Count; |
1491 | | |
1492 | | public: |
1493 | 0 | UnnamedTypeName(StringView Count_) : Node(KUnnamedTypeName), Count(Count_) {} |
1494 | | |
1495 | 0 | template<typename Fn> void match(Fn F) const { F(Count); } |
1496 | | |
1497 | 0 | void printLeft(OutputStream &S) const override { |
1498 | 0 | S += "'unnamed"; |
1499 | 0 | S += Count; |
1500 | 0 | S += "\'"; |
1501 | 0 | } |
1502 | | }; |
1503 | | |
1504 | | class ClosureTypeName : public Node { |
1505 | | NodeArray TemplateParams; |
1506 | | NodeArray Params; |
1507 | | StringView Count; |
1508 | | |
1509 | | public: |
1510 | | ClosureTypeName(NodeArray TemplateParams_, NodeArray Params_, |
1511 | | StringView Count_) |
1512 | | : Node(KClosureTypeName), TemplateParams(TemplateParams_), |
1513 | 0 | Params(Params_), Count(Count_) {} |
1514 | | |
1515 | 0 | template<typename Fn> void match(Fn F) const { |
1516 | 0 | F(TemplateParams, Params, Count); |
1517 | 0 | } |
1518 | | |
1519 | 0 | void printDeclarator(OutputStream &S) const { |
1520 | 0 | if (!TemplateParams.empty()) { |
1521 | 0 | S += "<"; |
1522 | 0 | TemplateParams.printWithComma(S); |
1523 | 0 | S += ">"; |
1524 | 0 | } |
1525 | 0 | S += "("; |
1526 | 0 | Params.printWithComma(S); |
1527 | 0 | S += ")"; |
1528 | 0 | } |
1529 | | |
1530 | 0 | void printLeft(OutputStream &S) const override { |
1531 | 0 | S += "\'lambda"; |
1532 | 0 | S += Count; |
1533 | 0 | S += "\'"; |
1534 | 0 | printDeclarator(S); |
1535 | 0 | } |
1536 | | }; |
1537 | | |
1538 | | class StructuredBindingName : public Node { |
1539 | | NodeArray Bindings; |
1540 | | public: |
1541 | | StructuredBindingName(NodeArray Bindings_) |
1542 | 0 | : Node(KStructuredBindingName), Bindings(Bindings_) {} |
1543 | | |
1544 | 0 | template<typename Fn> void match(Fn F) const { F(Bindings); } |
1545 | | |
1546 | 0 | void printLeft(OutputStream &S) const override { |
1547 | 0 | S += '['; |
1548 | 0 | Bindings.printWithComma(S); |
1549 | 0 | S += ']'; |
1550 | 0 | } |
1551 | | }; |
1552 | | |
1553 | | // -- Expression Nodes -- |
1554 | | |
1555 | | class BinaryExpr : public Node { |
1556 | | const Node *LHS; |
1557 | | const StringView InfixOperator; |
1558 | | const Node *RHS; |
1559 | | |
1560 | | public: |
1561 | | BinaryExpr(const Node *LHS_, StringView InfixOperator_, const Node *RHS_) |
1562 | 0 | : Node(KBinaryExpr), LHS(LHS_), InfixOperator(InfixOperator_), RHS(RHS_) { |
1563 | 0 | } |
1564 | | |
1565 | 0 | template<typename Fn> void match(Fn F) const { F(LHS, InfixOperator, RHS); } |
1566 | | |
1567 | 0 | void printLeft(OutputStream &S) const override { |
1568 | | // might be a template argument expression, then we need to disambiguate |
1569 | | // with parens. |
1570 | 0 | if (InfixOperator == ">") |
1571 | 0 | S += "("; |
1572 | |
|
1573 | 0 | S += "("; |
1574 | 0 | LHS->print(S); |
1575 | 0 | S += ") "; |
1576 | 0 | S += InfixOperator; |
1577 | 0 | S += " ("; |
1578 | 0 | RHS->print(S); |
1579 | 0 | S += ")"; |
1580 | |
|
1581 | 0 | if (InfixOperator == ">") |
1582 | 0 | S += ")"; |
1583 | 0 | } |
1584 | | }; |
1585 | | |
1586 | | class ArraySubscriptExpr : public Node { |
1587 | | const Node *Op1; |
1588 | | const Node *Op2; |
1589 | | |
1590 | | public: |
1591 | | ArraySubscriptExpr(const Node *Op1_, const Node *Op2_) |
1592 | 0 | : Node(KArraySubscriptExpr), Op1(Op1_), Op2(Op2_) {} |
1593 | | |
1594 | 0 | template<typename Fn> void match(Fn F) const { F(Op1, Op2); } |
1595 | | |
1596 | 0 | void printLeft(OutputStream &S) const override { |
1597 | 0 | S += "("; |
1598 | 0 | Op1->print(S); |
1599 | 0 | S += ")["; |
1600 | 0 | Op2->print(S); |
1601 | 0 | S += "]"; |
1602 | 0 | } |
1603 | | }; |
1604 | | |
1605 | | class PostfixExpr : public Node { |
1606 | | const Node *Child; |
1607 | | const StringView Operator; |
1608 | | |
1609 | | public: |
1610 | | PostfixExpr(const Node *Child_, StringView Operator_) |
1611 | 0 | : Node(KPostfixExpr), Child(Child_), Operator(Operator_) {} |
1612 | | |
1613 | 0 | template<typename Fn> void match(Fn F) const { F(Child, Operator); } |
1614 | | |
1615 | 0 | void printLeft(OutputStream &S) const override { |
1616 | 0 | S += "("; |
1617 | 0 | Child->print(S); |
1618 | 0 | S += ")"; |
1619 | 0 | S += Operator; |
1620 | 0 | } |
1621 | | }; |
1622 | | |
1623 | | class ConditionalExpr : public Node { |
1624 | | const Node *Cond; |
1625 | | const Node *Then; |
1626 | | const Node *Else; |
1627 | | |
1628 | | public: |
1629 | | ConditionalExpr(const Node *Cond_, const Node *Then_, const Node *Else_) |
1630 | 0 | : Node(KConditionalExpr), Cond(Cond_), Then(Then_), Else(Else_) {} |
1631 | | |
1632 | 0 | template<typename Fn> void match(Fn F) const { F(Cond, Then, Else); } |
1633 | | |
1634 | 0 | void printLeft(OutputStream &S) const override { |
1635 | 0 | S += "("; |
1636 | 0 | Cond->print(S); |
1637 | 0 | S += ") ? ("; |
1638 | 0 | Then->print(S); |
1639 | 0 | S += ") : ("; |
1640 | 0 | Else->print(S); |
1641 | 0 | S += ")"; |
1642 | 0 | } |
1643 | | }; |
1644 | | |
1645 | | class MemberExpr : public Node { |
1646 | | const Node *LHS; |
1647 | | const StringView Kind; |
1648 | | const Node *RHS; |
1649 | | |
1650 | | public: |
1651 | | MemberExpr(const Node *LHS_, StringView Kind_, const Node *RHS_) |
1652 | 0 | : Node(KMemberExpr), LHS(LHS_), Kind(Kind_), RHS(RHS_) {} |
1653 | | |
1654 | 0 | template<typename Fn> void match(Fn F) const { F(LHS, Kind, RHS); } |
1655 | | |
1656 | 0 | void printLeft(OutputStream &S) const override { |
1657 | 0 | LHS->print(S); |
1658 | 0 | S += Kind; |
1659 | 0 | RHS->print(S); |
1660 | 0 | } |
1661 | | }; |
1662 | | |
1663 | | class SubobjectExpr : public Node { |
1664 | | const Node *Type; |
1665 | | const Node *SubExpr; |
1666 | | StringView Offset; |
1667 | | NodeArray UnionSelectors; |
1668 | | bool OnePastTheEnd; |
1669 | | |
1670 | | public: |
1671 | | SubobjectExpr(const Node *Type_, const Node *SubExpr_, StringView Offset_, |
1672 | | NodeArray UnionSelectors_, bool OnePastTheEnd_) |
1673 | | : Node(KSubobjectExpr), Type(Type_), SubExpr(SubExpr_), Offset(Offset_), |
1674 | 0 | UnionSelectors(UnionSelectors_), OnePastTheEnd(OnePastTheEnd_) {} |
1675 | | |
1676 | 0 | template<typename Fn> void match(Fn F) const { |
1677 | 0 | F(Type, SubExpr, Offset, UnionSelectors, OnePastTheEnd); |
1678 | 0 | } |
1679 | | |
1680 | 0 | void printLeft(OutputStream &S) const override { |
1681 | 0 | SubExpr->print(S); |
1682 | 0 | S += ".<"; |
1683 | 0 | Type->print(S); |
1684 | 0 | S += " at offset "; |
1685 | 0 | if (Offset.empty()) { |
1686 | 0 | S += "0"; |
1687 | 0 | } else if (Offset[0] == 'n') { |
1688 | 0 | S += "-"; |
1689 | 0 | S += Offset.dropFront(); |
1690 | 0 | } else { |
1691 | 0 | S += Offset; |
1692 | 0 | } |
1693 | 0 | S += ">"; |
1694 | 0 | } |
1695 | | }; |
1696 | | |
1697 | | class EnclosingExpr : public Node { |
1698 | | const StringView Prefix; |
1699 | | const Node *Infix; |
1700 | | const StringView Postfix; |
1701 | | |
1702 | | public: |
1703 | | EnclosingExpr(StringView Prefix_, Node *Infix_, StringView Postfix_) |
1704 | | : Node(KEnclosingExpr), Prefix(Prefix_), Infix(Infix_), |
1705 | 0 | Postfix(Postfix_) {} |
1706 | | |
1707 | 0 | template<typename Fn> void match(Fn F) const { F(Prefix, Infix, Postfix); } |
1708 | | |
1709 | 0 | void printLeft(OutputStream &S) const override { |
1710 | 0 | S += Prefix; |
1711 | 0 | Infix->print(S); |
1712 | 0 | S += Postfix; |
1713 | 0 | } |
1714 | | }; |
1715 | | |
1716 | | class CastExpr : public Node { |
1717 | | // cast_kind<to>(from) |
1718 | | const StringView CastKind; |
1719 | | const Node *To; |
1720 | | const Node *From; |
1721 | | |
1722 | | public: |
1723 | | CastExpr(StringView CastKind_, const Node *To_, const Node *From_) |
1724 | 0 | : Node(KCastExpr), CastKind(CastKind_), To(To_), From(From_) {} |
1725 | | |
1726 | 0 | template<typename Fn> void match(Fn F) const { F(CastKind, To, From); } |
1727 | | |
1728 | 0 | void printLeft(OutputStream &S) const override { |
1729 | 0 | S += CastKind; |
1730 | 0 | S += "<"; |
1731 | 0 | To->printLeft(S); |
1732 | 0 | S += ">("; |
1733 | 0 | From->printLeft(S); |
1734 | 0 | S += ")"; |
1735 | 0 | } |
1736 | | }; |
1737 | | |
1738 | | class SizeofParamPackExpr : public Node { |
1739 | | const Node *Pack; |
1740 | | |
1741 | | public: |
1742 | | SizeofParamPackExpr(const Node *Pack_) |
1743 | 0 | : Node(KSizeofParamPackExpr), Pack(Pack_) {} |
1744 | | |
1745 | 0 | template<typename Fn> void match(Fn F) const { F(Pack); } |
1746 | | |
1747 | 0 | void printLeft(OutputStream &S) const override { |
1748 | 0 | S += "sizeof...("; |
1749 | 0 | ParameterPackExpansion PPE(Pack); |
1750 | 0 | PPE.printLeft(S); |
1751 | 0 | S += ")"; |
1752 | 0 | } |
1753 | | }; |
1754 | | |
1755 | | class CallExpr : public Node { |
1756 | | const Node *Callee; |
1757 | | NodeArray Args; |
1758 | | |
1759 | | public: |
1760 | | CallExpr(const Node *Callee_, NodeArray Args_) |
1761 | 0 | : Node(KCallExpr), Callee(Callee_), Args(Args_) {} |
1762 | | |
1763 | 0 | template<typename Fn> void match(Fn F) const { F(Callee, Args); } |
1764 | | |
1765 | 0 | void printLeft(OutputStream &S) const override { |
1766 | 0 | Callee->print(S); |
1767 | 0 | S += "("; |
1768 | 0 | Args.printWithComma(S); |
1769 | 0 | S += ")"; |
1770 | 0 | } |
1771 | | }; |
1772 | | |
1773 | | class NewExpr : public Node { |
1774 | | // new (expr_list) type(init_list) |
1775 | | NodeArray ExprList; |
1776 | | Node *Type; |
1777 | | NodeArray InitList; |
1778 | | bool IsGlobal; // ::operator new ? |
1779 | | bool IsArray; // new[] ? |
1780 | | public: |
1781 | | NewExpr(NodeArray ExprList_, Node *Type_, NodeArray InitList_, bool IsGlobal_, |
1782 | | bool IsArray_) |
1783 | | : Node(KNewExpr), ExprList(ExprList_), Type(Type_), InitList(InitList_), |
1784 | 0 | IsGlobal(IsGlobal_), IsArray(IsArray_) {} |
1785 | | |
1786 | 0 | template<typename Fn> void match(Fn F) const { |
1787 | 0 | F(ExprList, Type, InitList, IsGlobal, IsArray); |
1788 | 0 | } |
1789 | | |
1790 | 0 | void printLeft(OutputStream &S) const override { |
1791 | 0 | if (IsGlobal) |
1792 | 0 | S += "::operator "; |
1793 | 0 | S += "new"; |
1794 | 0 | if (IsArray) |
1795 | 0 | S += "[]"; |
1796 | 0 | S += ' '; |
1797 | 0 | if (!ExprList.empty()) { |
1798 | 0 | S += "("; |
1799 | 0 | ExprList.printWithComma(S); |
1800 | 0 | S += ")"; |
1801 | 0 | } |
1802 | 0 | Type->print(S); |
1803 | 0 | if (!InitList.empty()) { |
1804 | 0 | S += "("; |
1805 | 0 | InitList.printWithComma(S); |
1806 | 0 | S += ")"; |
1807 | 0 | } |
1808 | |
|
1809 | 0 | } |
1810 | | }; |
1811 | | |
1812 | | class DeleteExpr : public Node { |
1813 | | Node *Op; |
1814 | | bool IsGlobal; |
1815 | | bool IsArray; |
1816 | | |
1817 | | public: |
1818 | | DeleteExpr(Node *Op_, bool IsGlobal_, bool IsArray_) |
1819 | 0 | : Node(KDeleteExpr), Op(Op_), IsGlobal(IsGlobal_), IsArray(IsArray_) {} |
1820 | | |
1821 | 0 | template<typename Fn> void match(Fn F) const { F(Op, IsGlobal, IsArray); } |
1822 | | |
1823 | 0 | void printLeft(OutputStream &S) const override { |
1824 | 0 | if (IsGlobal) |
1825 | 0 | S += "::"; |
1826 | 0 | S += "delete"; |
1827 | 0 | if (IsArray) |
1828 | 0 | S += "[] "; |
1829 | 0 | Op->print(S); |
1830 | 0 | } |
1831 | | }; |
1832 | | |
1833 | | class PrefixExpr : public Node { |
1834 | | StringView Prefix; |
1835 | | Node *Child; |
1836 | | |
1837 | | public: |
1838 | | PrefixExpr(StringView Prefix_, Node *Child_) |
1839 | 0 | : Node(KPrefixExpr), Prefix(Prefix_), Child(Child_) {} |
1840 | | |
1841 | 0 | template<typename Fn> void match(Fn F) const { F(Prefix, Child); } |
1842 | | |
1843 | 0 | void printLeft(OutputStream &S) const override { |
1844 | 0 | S += Prefix; |
1845 | 0 | S += "("; |
1846 | 0 | Child->print(S); |
1847 | 0 | S += ")"; |
1848 | 0 | } |
1849 | | }; |
1850 | | |
1851 | | class FunctionParam : public Node { |
1852 | | StringView Number; |
1853 | | |
1854 | | public: |
1855 | 0 | FunctionParam(StringView Number_) : Node(KFunctionParam), Number(Number_) {} |
1856 | | |
1857 | 0 | template<typename Fn> void match(Fn F) const { F(Number); } |
1858 | | |
1859 | 0 | void printLeft(OutputStream &S) const override { |
1860 | 0 | S += "fp"; |
1861 | 0 | S += Number; |
1862 | 0 | } |
1863 | | }; |
1864 | | |
1865 | | class ConversionExpr : public Node { |
1866 | | const Node *Type; |
1867 | | NodeArray Expressions; |
1868 | | |
1869 | | public: |
1870 | | ConversionExpr(const Node *Type_, NodeArray Expressions_) |
1871 | 0 | : Node(KConversionExpr), Type(Type_), Expressions(Expressions_) {} |
1872 | | |
1873 | 0 | template<typename Fn> void match(Fn F) const { F(Type, Expressions); } |
1874 | | |
1875 | 0 | void printLeft(OutputStream &S) const override { |
1876 | 0 | S += "("; |
1877 | 0 | Type->print(S); |
1878 | 0 | S += ")("; |
1879 | 0 | Expressions.printWithComma(S); |
1880 | 0 | S += ")"; |
1881 | 0 | } |
1882 | | }; |
1883 | | |
1884 | | class PointerToMemberConversionExpr : public Node { |
1885 | | const Node *Type; |
1886 | | const Node *SubExpr; |
1887 | | StringView Offset; |
1888 | | |
1889 | | public: |
1890 | | PointerToMemberConversionExpr(const Node *Type_, const Node *SubExpr_, |
1891 | | StringView Offset_) |
1892 | | : Node(KPointerToMemberConversionExpr), Type(Type_), SubExpr(SubExpr_), |
1893 | 0 | Offset(Offset_) {} |
1894 | | |
1895 | 0 | template<typename Fn> void match(Fn F) const { F(Type, SubExpr, Offset); } |
1896 | | |
1897 | 0 | void printLeft(OutputStream &S) const override { |
1898 | 0 | S += "("; |
1899 | 0 | Type->print(S); |
1900 | 0 | S += ")("; |
1901 | 0 | SubExpr->print(S); |
1902 | 0 | S += ")"; |
1903 | 0 | } |
1904 | | }; |
1905 | | |
1906 | | class InitListExpr : public Node { |
1907 | | const Node *Ty; |
1908 | | NodeArray Inits; |
1909 | | public: |
1910 | | InitListExpr(const Node *Ty_, NodeArray Inits_) |
1911 | 0 | : Node(KInitListExpr), Ty(Ty_), Inits(Inits_) {} |
1912 | | |
1913 | 0 | template<typename Fn> void match(Fn F) const { F(Ty, Inits); } |
1914 | | |
1915 | 0 | void printLeft(OutputStream &S) const override { |
1916 | 0 | if (Ty) |
1917 | 0 | Ty->print(S); |
1918 | 0 | S += '{'; |
1919 | 0 | Inits.printWithComma(S); |
1920 | 0 | S += '}'; |
1921 | 0 | } |
1922 | | }; |
1923 | | |
1924 | | class BracedExpr : public Node { |
1925 | | const Node *Elem; |
1926 | | const Node *Init; |
1927 | | bool IsArray; |
1928 | | public: |
1929 | | BracedExpr(const Node *Elem_, const Node *Init_, bool IsArray_) |
1930 | 0 | : Node(KBracedExpr), Elem(Elem_), Init(Init_), IsArray(IsArray_) {} |
1931 | | |
1932 | 0 | template<typename Fn> void match(Fn F) const { F(Elem, Init, IsArray); } |
1933 | | |
1934 | 0 | void printLeft(OutputStream &S) const override { |
1935 | 0 | if (IsArray) { |
1936 | 0 | S += '['; |
1937 | 0 | Elem->print(S); |
1938 | 0 | S += ']'; |
1939 | 0 | } else { |
1940 | 0 | S += '.'; |
1941 | 0 | Elem->print(S); |
1942 | 0 | } |
1943 | 0 | if (Init->getKind() != KBracedExpr && Init->getKind() != KBracedRangeExpr) |
1944 | 0 | S += " = "; |
1945 | 0 | Init->print(S); |
1946 | 0 | } |
1947 | | }; |
1948 | | |
1949 | | class BracedRangeExpr : public Node { |
1950 | | const Node *First; |
1951 | | const Node *Last; |
1952 | | const Node *Init; |
1953 | | public: |
1954 | | BracedRangeExpr(const Node *First_, const Node *Last_, const Node *Init_) |
1955 | 0 | : Node(KBracedRangeExpr), First(First_), Last(Last_), Init(Init_) {} |
1956 | | |
1957 | 0 | template<typename Fn> void match(Fn F) const { F(First, Last, Init); } |
1958 | | |
1959 | 0 | void printLeft(OutputStream &S) const override { |
1960 | 0 | S += '['; |
1961 | 0 | First->print(S); |
1962 | 0 | S += " ... "; |
1963 | 0 | Last->print(S); |
1964 | 0 | S += ']'; |
1965 | 0 | if (Init->getKind() != KBracedExpr && Init->getKind() != KBracedRangeExpr) |
1966 | 0 | S += " = "; |
1967 | 0 | Init->print(S); |
1968 | 0 | } |
1969 | | }; |
1970 | | |
1971 | | class FoldExpr : public Node { |
1972 | | const Node *Pack, *Init; |
1973 | | StringView OperatorName; |
1974 | | bool IsLeftFold; |
1975 | | |
1976 | | public: |
1977 | | FoldExpr(bool IsLeftFold_, StringView OperatorName_, const Node *Pack_, |
1978 | | const Node *Init_) |
1979 | | : Node(KFoldExpr), Pack(Pack_), Init(Init_), OperatorName(OperatorName_), |
1980 | 0 | IsLeftFold(IsLeftFold_) {} |
1981 | | |
1982 | 0 | template<typename Fn> void match(Fn F) const { |
1983 | 0 | F(IsLeftFold, OperatorName, Pack, Init); |
1984 | 0 | } |
1985 | | |
1986 | 0 | void printLeft(OutputStream &S) const override { |
1987 | 0 | auto PrintPack = [&] { |
1988 | 0 | S += '('; |
1989 | 0 | ParameterPackExpansion(Pack).print(S); |
1990 | 0 | S += ')'; |
1991 | 0 | }; |
1992 | |
|
1993 | 0 | S += '('; |
1994 | |
|
1995 | 0 | if (IsLeftFold) { |
1996 | | // init op ... op pack |
1997 | 0 | if (Init != nullptr) { |
1998 | 0 | Init->print(S); |
1999 | 0 | S += ' '; |
2000 | 0 | S += OperatorName; |
2001 | 0 | S += ' '; |
2002 | 0 | } |
2003 | | // ... op pack |
2004 | 0 | S += "... "; |
2005 | 0 | S += OperatorName; |
2006 | 0 | S += ' '; |
2007 | 0 | PrintPack(); |
2008 | 0 | } else { // !IsLeftFold |
2009 | | // pack op ... |
2010 | 0 | PrintPack(); |
2011 | 0 | S += ' '; |
2012 | 0 | S += OperatorName; |
2013 | 0 | S += " ..."; |
2014 | | // pack op ... op init |
2015 | 0 | if (Init != nullptr) { |
2016 | 0 | S += ' '; |
2017 | 0 | S += OperatorName; |
2018 | 0 | S += ' '; |
2019 | 0 | Init->print(S); |
2020 | 0 | } |
2021 | 0 | } |
2022 | 0 | S += ')'; |
2023 | 0 | } |
2024 | | }; |
2025 | | |
2026 | | class ThrowExpr : public Node { |
2027 | | const Node *Op; |
2028 | | |
2029 | | public: |
2030 | 0 | ThrowExpr(const Node *Op_) : Node(KThrowExpr), Op(Op_) {} |
2031 | | |
2032 | 0 | template<typename Fn> void match(Fn F) const { F(Op); } |
2033 | | |
2034 | 0 | void printLeft(OutputStream &S) const override { |
2035 | 0 | S += "throw "; |
2036 | 0 | Op->print(S); |
2037 | 0 | } |
2038 | | }; |
2039 | | |
2040 | | class BoolExpr : public Node { |
2041 | | bool Value; |
2042 | | |
2043 | | public: |
2044 | 0 | BoolExpr(bool Value_) : Node(KBoolExpr), Value(Value_) {} |
2045 | | |
2046 | 0 | template<typename Fn> void match(Fn F) const { F(Value); } |
2047 | | |
2048 | 0 | void printLeft(OutputStream &S) const override { |
2049 | 0 | S += Value ? StringView("true") : StringView("false"); |
2050 | 0 | } |
2051 | | }; |
2052 | | |
2053 | | class StringLiteral : public Node { |
2054 | | const Node *Type; |
2055 | | |
2056 | | public: |
2057 | 0 | StringLiteral(const Node *Type_) : Node(KStringLiteral), Type(Type_) {} |
2058 | | |
2059 | 0 | template<typename Fn> void match(Fn F) const { F(Type); } |
2060 | | |
2061 | 0 | void printLeft(OutputStream &S) const override { |
2062 | 0 | S += "\"<"; |
2063 | 0 | Type->print(S); |
2064 | 0 | S += ">\""; |
2065 | 0 | } |
2066 | | }; |
2067 | | |
2068 | | class LambdaExpr : public Node { |
2069 | | const Node *Type; |
2070 | | |
2071 | | public: |
2072 | 0 | LambdaExpr(const Node *Type_) : Node(KLambdaExpr), Type(Type_) {} |
2073 | | |
2074 | 0 | template<typename Fn> void match(Fn F) const { F(Type); } |
2075 | | |
2076 | 0 | void printLeft(OutputStream &S) const override { |
2077 | 0 | S += "[]"; |
2078 | 0 | if (Type->getKind() == KClosureTypeName) |
2079 | 0 | static_cast<const ClosureTypeName *>(Type)->printDeclarator(S); |
2080 | 0 | S += "{...}"; |
2081 | 0 | } |
2082 | | }; |
2083 | | |
2084 | | class EnumLiteral : public Node { |
2085 | | // ty(integer) |
2086 | | const Node *Ty; |
2087 | | StringView Integer; |
2088 | | |
2089 | | public: |
2090 | | EnumLiteral(const Node *Ty_, StringView Integer_) |
2091 | 0 | : Node(KEnumLiteral), Ty(Ty_), Integer(Integer_) {} |
2092 | | |
2093 | 0 | template<typename Fn> void match(Fn F) const { F(Ty, Integer); } |
2094 | | |
2095 | 0 | void printLeft(OutputStream &S) const override { |
2096 | 0 | S << "("; |
2097 | 0 | Ty->print(S); |
2098 | 0 | S << ")"; |
2099 | |
|
2100 | 0 | if (Integer[0] == 'n') |
2101 | 0 | S << "-" << Integer.dropFront(1); |
2102 | 0 | else |
2103 | 0 | S << Integer; |
2104 | 0 | } |
2105 | | }; |
2106 | | |
2107 | | class IntegerLiteral : public Node { |
2108 | | StringView Type; |
2109 | | StringView Value; |
2110 | | |
2111 | | public: |
2112 | | IntegerLiteral(StringView Type_, StringView Value_) |
2113 | 0 | : Node(KIntegerLiteral), Type(Type_), Value(Value_) {} |
2114 | | |
2115 | 0 | template<typename Fn> void match(Fn F) const { F(Type, Value); } |
2116 | | |
2117 | 0 | void printLeft(OutputStream &S) const override { |
2118 | 0 | if (Type.size() > 3) { |
2119 | 0 | S += "("; |
2120 | 0 | S += Type; |
2121 | 0 | S += ")"; |
2122 | 0 | } |
2123 | |
|
2124 | 0 | if (Value[0] == 'n') { |
2125 | 0 | S += "-"; |
2126 | 0 | S += Value.dropFront(1); |
2127 | 0 | } else |
2128 | 0 | S += Value; |
2129 | |
|
2130 | 0 | if (Type.size() <= 3) |
2131 | 0 | S += Type; |
2132 | 0 | } |
2133 | | }; |
2134 | | |
2135 | | template <class Float> struct FloatData; |
2136 | | |
2137 | | namespace float_literal_impl { |
2138 | 0 | constexpr Node::Kind getFloatLiteralKind(float *) { |
2139 | 0 | return Node::KFloatLiteral; |
2140 | 0 | } |
2141 | 0 | constexpr Node::Kind getFloatLiteralKind(double *) { |
2142 | 0 | return Node::KDoubleLiteral; |
2143 | 0 | } |
2144 | 0 | constexpr Node::Kind getFloatLiteralKind(long double *) { |
2145 | 0 | return Node::KLongDoubleLiteral; |
2146 | 0 | } |
2147 | | } |
2148 | | |
2149 | | template <class Float> class FloatLiteralImpl : public Node { |
2150 | | const StringView Contents; |
2151 | | |
2152 | | static constexpr Kind KindForClass = |
2153 | | float_literal_impl::getFloatLiteralKind((Float *)nullptr); |
2154 | | |
2155 | | public: |
2156 | | FloatLiteralImpl(StringView Contents_) |
2157 | 0 | : Node(KindForClass), Contents(Contents_) {} Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::FloatLiteralImpl<float>::FloatLiteralImpl((anonymous namespace)::itanium_demangle::StringView) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::FloatLiteralImpl<double>::FloatLiteralImpl((anonymous namespace)::itanium_demangle::StringView) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::FloatLiteralImpl<long double>::FloatLiteralImpl((anonymous namespace)::itanium_demangle::StringView) |
2158 | | |
2159 | 0 | template<typename Fn> void match(Fn F) const { F(Contents); } Unexecuted instantiation: cxa_demangle.cpp:void (anonymous namespace)::itanium_demangle::FloatLiteralImpl<float>::match<(anonymous namespace)::DumpVisitor::CtorArgPrinter>((anonymous namespace)::DumpVisitor::CtorArgPrinter) const Unexecuted instantiation: cxa_demangle.cpp:void (anonymous namespace)::itanium_demangle::FloatLiteralImpl<double>::match<(anonymous namespace)::DumpVisitor::CtorArgPrinter>((anonymous namespace)::DumpVisitor::CtorArgPrinter) const Unexecuted instantiation: cxa_demangle.cpp:void (anonymous namespace)::itanium_demangle::FloatLiteralImpl<long double>::match<(anonymous namespace)::DumpVisitor::CtorArgPrinter>((anonymous namespace)::DumpVisitor::CtorArgPrinter) const |
2160 | | |
2161 | 0 | void printLeft(OutputStream &s) const override { |
2162 | 0 | const char *first = Contents.begin(); |
2163 | 0 | const char *last = Contents.end() + 1; |
2164 | |
|
2165 | 0 | const size_t N = FloatData<Float>::mangled_size; |
2166 | 0 | if (static_cast<std::size_t>(last - first) > N) { |
2167 | 0 | last = first + N; |
2168 | 0 | union { |
2169 | 0 | Float value; |
2170 | 0 | char buf[sizeof(Float)]; |
2171 | 0 | }; |
2172 | 0 | const char *t = first; |
2173 | 0 | char *e = buf; |
2174 | 0 | for (; t != last; ++t, ++e) { |
2175 | 0 | unsigned d1 = isdigit(*t) ? static_cast<unsigned>(*t - '0') |
2176 | 0 | : static_cast<unsigned>(*t - 'a' + 10); |
2177 | 0 | ++t; |
2178 | 0 | unsigned d0 = isdigit(*t) ? static_cast<unsigned>(*t - '0') |
2179 | 0 | : static_cast<unsigned>(*t - 'a' + 10); |
2180 | 0 | *e = static_cast<char>((d1 << 4) + d0); |
2181 | 0 | } |
2182 | 0 | #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ |
2183 | 0 | std::reverse(buf, e); |
2184 | 0 | #endif |
2185 | 0 | char num[FloatData<Float>::max_demangled_size] = {0}; |
2186 | 0 | int n = snprintf(num, sizeof(num), FloatData<Float>::spec, value); |
2187 | 0 | s += StringView(num, num + n); |
2188 | 0 | } |
2189 | 0 | } Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::FloatLiteralImpl<float>::printLeft((anonymous namespace)::itanium_demangle::OutputStream&) const Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::FloatLiteralImpl<double>::printLeft((anonymous namespace)::itanium_demangle::OutputStream&) const Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::FloatLiteralImpl<long double>::printLeft((anonymous namespace)::itanium_demangle::OutputStream&) const |
2190 | | }; |
2191 | | |
2192 | | using FloatLiteral = FloatLiteralImpl<float>; |
2193 | | using DoubleLiteral = FloatLiteralImpl<double>; |
2194 | | using LongDoubleLiteral = FloatLiteralImpl<long double>; |
2195 | | |
2196 | | /// Visit the node. Calls \c F(P), where \c P is the node cast to the |
2197 | | /// appropriate derived class. |
2198 | | template<typename Fn> |
2199 | 0 | void Node::visit(Fn F) const { |
2200 | 0 | switch (K) { |
2201 | 0 | #define CASE(X) case K ## X: return F(static_cast<const X*>(this)); |
2202 | 0 | FOR_EACH_NODE_KIND(CASE) |
2203 | 0 | #undef CASE |
2204 | 0 | } |
2205 | 0 | assert(0 && "unknown mangling node kind"); |
2206 | 0 | } |
2207 | | |
2208 | | /// Determine the kind of a node from its type. |
2209 | | template<typename NodeT> struct NodeKind; |
2210 | | #define SPECIALIZATION(X) \ |
2211 | | template<> struct NodeKind<X> { \ |
2212 | | static constexpr Node::Kind Kind = Node::K##X; \ |
2213 | 0 | static constexpr const char *name() { return #X; } \ Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::NodeKind<(anonymous namespace)::itanium_demangle::NodeArrayNode>::name() Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::NodeKind<(anonymous namespace)::itanium_demangle::DotSuffix>::name() Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::NodeKind<(anonymous namespace)::itanium_demangle::VendorExtQualType>::name() Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::NodeKind<(anonymous namespace)::itanium_demangle::QualType>::name() Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::NodeKind<(anonymous namespace)::itanium_demangle::ConversionOperatorType>::name() Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::NodeKind<(anonymous namespace)::itanium_demangle::PostfixQualifiedType>::name() Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::NodeKind<(anonymous namespace)::itanium_demangle::ElaboratedTypeSpefType>::name() Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::NodeKind<(anonymous namespace)::itanium_demangle::NameType>::name() Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::NodeKind<(anonymous namespace)::itanium_demangle::AbiTagAttr>::name() Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::NodeKind<(anonymous namespace)::itanium_demangle::EnableIfAttr>::name() Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::NodeKind<(anonymous namespace)::itanium_demangle::ObjCProtoName>::name() Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::NodeKind<(anonymous namespace)::itanium_demangle::PointerType>::name() Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::NodeKind<(anonymous namespace)::itanium_demangle::ReferenceType>::name() Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::NodeKind<(anonymous namespace)::itanium_demangle::PointerToMemberType>::name() Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::NodeKind<(anonymous namespace)::itanium_demangle::ArrayType>::name() Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::NodeKind<(anonymous namespace)::itanium_demangle::FunctionType>::name() Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::NodeKind<(anonymous namespace)::itanium_demangle::NoexceptSpec>::name() Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::NodeKind<(anonymous namespace)::itanium_demangle::DynamicExceptionSpec>::name() Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::NodeKind<(anonymous namespace)::itanium_demangle::FunctionEncoding>::name() Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::NodeKind<(anonymous namespace)::itanium_demangle::LiteralOperator>::name() Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::NodeKind<(anonymous namespace)::itanium_demangle::SpecialName>::name() Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::NodeKind<(anonymous namespace)::itanium_demangle::CtorVtableSpecialName>::name() Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::NodeKind<(anonymous namespace)::itanium_demangle::QualifiedName>::name() Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::NodeKind<(anonymous namespace)::itanium_demangle::NestedName>::name() Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::NodeKind<(anonymous namespace)::itanium_demangle::LocalName>::name() Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::NodeKind<(anonymous namespace)::itanium_demangle::VectorType>::name() Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::NodeKind<(anonymous namespace)::itanium_demangle::PixelVectorType>::name() Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::NodeKind<(anonymous namespace)::itanium_demangle::SyntheticTemplateParamName>::name() Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::NodeKind<(anonymous namespace)::itanium_demangle::TypeTemplateParamDecl>::name() Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::NodeKind<(anonymous namespace)::itanium_demangle::NonTypeTemplateParamDecl>::name() Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::NodeKind<(anonymous namespace)::itanium_demangle::TemplateTemplateParamDecl>::name() Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::NodeKind<(anonymous namespace)::itanium_demangle::TemplateParamPackDecl>::name() Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::NodeKind<(anonymous namespace)::itanium_demangle::ParameterPack>::name() Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::NodeKind<(anonymous namespace)::itanium_demangle::TemplateArgumentPack>::name() Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::NodeKind<(anonymous namespace)::itanium_demangle::ParameterPackExpansion>::name() Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::NodeKind<(anonymous namespace)::itanium_demangle::TemplateArgs>::name() Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::NodeKind<(anonymous namespace)::itanium_demangle::NameWithTemplateArgs>::name() Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::NodeKind<(anonymous namespace)::itanium_demangle::GlobalQualifiedName>::name() Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::NodeKind<(anonymous namespace)::itanium_demangle::StdQualifiedName>::name() Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::NodeKind<(anonymous namespace)::itanium_demangle::ExpandedSpecialSubstitution>::name() Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::NodeKind<(anonymous namespace)::itanium_demangle::SpecialSubstitution>::name() Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::NodeKind<(anonymous namespace)::itanium_demangle::CtorDtorName>::name() Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::NodeKind<(anonymous namespace)::itanium_demangle::DtorName>::name() Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::NodeKind<(anonymous namespace)::itanium_demangle::UnnamedTypeName>::name() Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::NodeKind<(anonymous namespace)::itanium_demangle::ClosureTypeName>::name() Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::NodeKind<(anonymous namespace)::itanium_demangle::StructuredBindingName>::name() Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::NodeKind<(anonymous namespace)::itanium_demangle::BinaryExpr>::name() Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::NodeKind<(anonymous namespace)::itanium_demangle::ArraySubscriptExpr>::name() Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::NodeKind<(anonymous namespace)::itanium_demangle::PostfixExpr>::name() Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::NodeKind<(anonymous namespace)::itanium_demangle::ConditionalExpr>::name() Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::NodeKind<(anonymous namespace)::itanium_demangle::MemberExpr>::name() Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::NodeKind<(anonymous namespace)::itanium_demangle::SubobjectExpr>::name() Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::NodeKind<(anonymous namespace)::itanium_demangle::EnclosingExpr>::name() Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::NodeKind<(anonymous namespace)::itanium_demangle::CastExpr>::name() Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::NodeKind<(anonymous namespace)::itanium_demangle::SizeofParamPackExpr>::name() Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::NodeKind<(anonymous namespace)::itanium_demangle::CallExpr>::name() Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::NodeKind<(anonymous namespace)::itanium_demangle::NewExpr>::name() Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::NodeKind<(anonymous namespace)::itanium_demangle::DeleteExpr>::name() Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::NodeKind<(anonymous namespace)::itanium_demangle::PrefixExpr>::name() Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::NodeKind<(anonymous namespace)::itanium_demangle::FunctionParam>::name() Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::NodeKind<(anonymous namespace)::itanium_demangle::ConversionExpr>::name() Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::NodeKind<(anonymous namespace)::itanium_demangle::PointerToMemberConversionExpr>::name() Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::NodeKind<(anonymous namespace)::itanium_demangle::InitListExpr>::name() Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::NodeKind<(anonymous namespace)::itanium_demangle::FoldExpr>::name() Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::NodeKind<(anonymous namespace)::itanium_demangle::ThrowExpr>::name() Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::NodeKind<(anonymous namespace)::itanium_demangle::BoolExpr>::name() Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::NodeKind<(anonymous namespace)::itanium_demangle::StringLiteral>::name() Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::NodeKind<(anonymous namespace)::itanium_demangle::LambdaExpr>::name() Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::NodeKind<(anonymous namespace)::itanium_demangle::EnumLiteral>::name() Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::NodeKind<(anonymous namespace)::itanium_demangle::IntegerLiteral>::name() Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::NodeKind<(anonymous namespace)::itanium_demangle::FloatLiteralImpl<float> >::name() Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::NodeKind<(anonymous namespace)::itanium_demangle::FloatLiteralImpl<double> >::name() Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::NodeKind<(anonymous namespace)::itanium_demangle::FloatLiteralImpl<long double> >::name() Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::NodeKind<(anonymous namespace)::itanium_demangle::BracedExpr>::name() Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::NodeKind<(anonymous namespace)::itanium_demangle::BracedRangeExpr>::name() Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::NodeKind<(anonymous namespace)::itanium_demangle::ForwardTemplateReference>::name() |
2214 | | }; |
2215 | | FOR_EACH_NODE_KIND(SPECIALIZATION) |
2216 | | #undef SPECIALIZATION |
2217 | | |
2218 | | #undef FOR_EACH_NODE_KIND |
2219 | | |
2220 | | template <class T, size_t N> |
2221 | | class PODSmallVector { |
2222 | | static_assert(std::is_pod<T>::value, |
2223 | | "T is required to be a plain old data type"); |
2224 | | |
2225 | | T* First = nullptr; |
2226 | | T* Last = nullptr; |
2227 | | T* Cap = nullptr; |
2228 | | T Inline[N] = {0}; |
2229 | | |
2230 | 0 | bool isInline() const { return First == Inline; } Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::PODSmallVector<(anonymous namespace)::itanium_demangle::ForwardTemplateReference*, 4ul>::isInline() const Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::PODSmallVector<(anonymous namespace)::itanium_demangle::PODSmallVector<(anonymous namespace)::itanium_demangle::Node*, 8ul>*, 4ul>::isInline() const Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::PODSmallVector<(anonymous namespace)::itanium_demangle::Node*, 8ul>::isInline() const Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::PODSmallVector<(anonymous namespace)::itanium_demangle::Node*, 32ul>::isInline() const |
2231 | | |
2232 | 0 | void clearInline() { |
2233 | 0 | First = Inline; |
2234 | 0 | Last = Inline; |
2235 | 0 | Cap = Inline + N; |
2236 | 0 | } Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::PODSmallVector<(anonymous namespace)::itanium_demangle::PODSmallVector<(anonymous namespace)::itanium_demangle::Node*, 8ul>*, 4ul>::clearInline() Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::PODSmallVector<(anonymous namespace)::itanium_demangle::Node*, 8ul>::clearInline() |
2237 | | |
2238 | 0 | void reserve(size_t NewCap) { |
2239 | 0 | size_t S = size(); |
2240 | 0 | if (isInline()) { |
2241 | 0 | auto* Tmp = static_cast<T*>(std::malloc(NewCap * sizeof(T))); |
2242 | 0 | if (Tmp == nullptr) |
2243 | 0 | std::terminate(); |
2244 | 0 | std::copy(First, Last, Tmp); |
2245 | 0 | First = Tmp; |
2246 | 0 | } else { |
2247 | 0 | First = static_cast<T*>(std::realloc(First, NewCap * sizeof(T))); |
2248 | 0 | if (First == nullptr) |
2249 | 0 | std::terminate(); |
2250 | 0 | } |
2251 | 0 | Last = First + S; |
2252 | 0 | Cap = First + NewCap; |
2253 | 0 | } Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::PODSmallVector<(anonymous namespace)::itanium_demangle::ForwardTemplateReference*, 4ul>::reserve(unsigned long) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::PODSmallVector<(anonymous namespace)::itanium_demangle::PODSmallVector<(anonymous namespace)::itanium_demangle::Node*, 8ul>*, 4ul>::reserve(unsigned long) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::PODSmallVector<(anonymous namespace)::itanium_demangle::Node*, 8ul>::reserve(unsigned long) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::PODSmallVector<(anonymous namespace)::itanium_demangle::Node*, 32ul>::reserve(unsigned long) |
2254 | | |
2255 | | public: |
2256 | 0 | PODSmallVector() : First(Inline), Last(First), Cap(Inline + N) {} Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::PODSmallVector<(anonymous namespace)::itanium_demangle::Node*, 32ul>::PODSmallVector() Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::PODSmallVector<(anonymous namespace)::itanium_demangle::Node*, 8ul>::PODSmallVector() Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::PODSmallVector<(anonymous namespace)::itanium_demangle::PODSmallVector<(anonymous namespace)::itanium_demangle::Node*, 8ul>*, 4ul>::PODSmallVector() Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::PODSmallVector<(anonymous namespace)::itanium_demangle::ForwardTemplateReference*, 4ul>::PODSmallVector() |
2257 | | |
2258 | | PODSmallVector(const PODSmallVector&) = delete; |
2259 | | PODSmallVector& operator=(const PODSmallVector&) = delete; |
2260 | | |
2261 | 0 | PODSmallVector(PODSmallVector&& Other) : PODSmallVector() { |
2262 | 0 | if (Other.isInline()) { |
2263 | 0 | std::copy(Other.begin(), Other.end(), First); |
2264 | 0 | Last = First + Other.size(); |
2265 | 0 | Other.clear(); |
2266 | 0 | return; |
2267 | 0 | } |
2268 | | |
2269 | 0 | First = Other.First; |
2270 | 0 | Last = Other.Last; |
2271 | 0 | Cap = Other.Cap; |
2272 | 0 | Other.clearInline(); |
2273 | 0 | } |
2274 | | |
2275 | 0 | PODSmallVector& operator=(PODSmallVector&& Other) { |
2276 | 0 | if (Other.isInline()) { |
2277 | 0 | if (!isInline()) { |
2278 | 0 | std::free(First); |
2279 | 0 | clearInline(); |
2280 | 0 | } |
2281 | 0 | std::copy(Other.begin(), Other.end(), First); |
2282 | 0 | Last = First + Other.size(); |
2283 | 0 | Other.clear(); |
2284 | 0 | return *this; |
2285 | 0 | } |
2286 | | |
2287 | 0 | if (isInline()) { |
2288 | 0 | First = Other.First; |
2289 | 0 | Last = Other.Last; |
2290 | 0 | Cap = Other.Cap; |
2291 | 0 | Other.clearInline(); |
2292 | 0 | return *this; |
2293 | 0 | } |
2294 | | |
2295 | 0 | std::swap(First, Other.First); |
2296 | 0 | std::swap(Last, Other.Last); |
2297 | 0 | std::swap(Cap, Other.Cap); |
2298 | 0 | Other.clear(); |
2299 | 0 | return *this; |
2300 | 0 | } Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::PODSmallVector<(anonymous namespace)::itanium_demangle::PODSmallVector<(anonymous namespace)::itanium_demangle::Node*, 8ul>*, 4ul>::operator=((anonymous namespace)::itanium_demangle::PODSmallVector<(anonymous namespace)::itanium_demangle::PODSmallVector<(anonymous namespace)::itanium_demangle::Node*, 8ul>*, 4ul>&&) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::PODSmallVector<(anonymous namespace)::itanium_demangle::Node*, 8ul>::operator=((anonymous namespace)::itanium_demangle::PODSmallVector<(anonymous namespace)::itanium_demangle::Node*, 8ul>&&) |
2301 | | |
2302 | 0 | void push_back(const T& Elem) { |
2303 | 0 | if (Last == Cap) |
2304 | 0 | reserve(size() * 2); |
2305 | 0 | *Last++ = Elem; |
2306 | 0 | } Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::PODSmallVector<(anonymous namespace)::itanium_demangle::ForwardTemplateReference*, 4ul>::push_back((anonymous namespace)::itanium_demangle::ForwardTemplateReference* const&) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::PODSmallVector<(anonymous namespace)::itanium_demangle::PODSmallVector<(anonymous namespace)::itanium_demangle::Node*, 8ul>*, 4ul>::push_back((anonymous namespace)::itanium_demangle::PODSmallVector<(anonymous namespace)::itanium_demangle::Node*, 8ul>* const&) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::PODSmallVector<(anonymous namespace)::itanium_demangle::Node*, 8ul>::push_back((anonymous namespace)::itanium_demangle::Node* const&) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::PODSmallVector<(anonymous namespace)::itanium_demangle::Node*, 32ul>::push_back((anonymous namespace)::itanium_demangle::Node* const&) |
2307 | | |
2308 | 0 | void pop_back() { |
2309 | 0 | assert(Last != First && "Popping empty vector!"); |
2310 | 0 | --Last; |
2311 | 0 | } Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::PODSmallVector<(anonymous namespace)::itanium_demangle::PODSmallVector<(anonymous namespace)::itanium_demangle::Node*, 8ul>*, 4ul>::pop_back() Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::PODSmallVector<(anonymous namespace)::itanium_demangle::Node*, 32ul>::pop_back() |
2312 | | |
2313 | 0 | void dropBack(size_t Index) { |
2314 | 0 | assert(Index <= size() && "dropBack() can't expand!"); |
2315 | 0 | Last = First + Index; |
2316 | 0 | } Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::PODSmallVector<(anonymous namespace)::itanium_demangle::PODSmallVector<(anonymous namespace)::itanium_demangle::Node*, 8ul>*, 4ul>::dropBack(unsigned long) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::PODSmallVector<(anonymous namespace)::itanium_demangle::ForwardTemplateReference*, 4ul>::dropBack(unsigned long) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::PODSmallVector<(anonymous namespace)::itanium_demangle::Node*, 32ul>::dropBack(unsigned long) |
2317 | | |
2318 | 0 | T* begin() { return First; } Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::PODSmallVector<(anonymous namespace)::itanium_demangle::PODSmallVector<(anonymous namespace)::itanium_demangle::Node*, 8ul>*, 4ul>::begin() Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::PODSmallVector<(anonymous namespace)::itanium_demangle::Node*, 8ul>::begin() Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::PODSmallVector<(anonymous namespace)::itanium_demangle::Node*, 32ul>::begin() Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::PODSmallVector<(anonymous namespace)::itanium_demangle::ForwardTemplateReference*, 4ul>::begin() |
2319 | 0 | T* end() { return Last; } Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::PODSmallVector<(anonymous namespace)::itanium_demangle::PODSmallVector<(anonymous namespace)::itanium_demangle::Node*, 8ul>*, 4ul>::end() Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::PODSmallVector<(anonymous namespace)::itanium_demangle::Node*, 8ul>::end() Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::PODSmallVector<(anonymous namespace)::itanium_demangle::Node*, 32ul>::end() |
2320 | | |
2321 | 0 | bool empty() const { return First == Last; } Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::PODSmallVector<(anonymous namespace)::itanium_demangle::Node*, 32ul>::empty() const Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::PODSmallVector<(anonymous namespace)::itanium_demangle::PODSmallVector<(anonymous namespace)::itanium_demangle::Node*, 8ul>*, 4ul>::empty() const Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::PODSmallVector<(anonymous namespace)::itanium_demangle::ForwardTemplateReference*, 4ul>::empty() const |
2322 | 0 | size_t size() const { return static_cast<size_t>(Last - First); } Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::PODSmallVector<(anonymous namespace)::itanium_demangle::PODSmallVector<(anonymous namespace)::itanium_demangle::Node*, 8ul>*, 4ul>::size() const Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::PODSmallVector<(anonymous namespace)::itanium_demangle::Node*, 8ul>::size() const Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::PODSmallVector<(anonymous namespace)::itanium_demangle::ForwardTemplateReference*, 4ul>::size() const Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::PODSmallVector<(anonymous namespace)::itanium_demangle::Node*, 32ul>::size() const |
2323 | 0 | T& back() { |
2324 | 0 | assert(Last != First && "Calling back() on empty vector!"); |
2325 | 0 | return *(Last - 1); |
2326 | 0 | } |
2327 | 0 | T& operator[](size_t Index) { |
2328 | 0 | assert(Index < size() && "Invalid access!"); |
2329 | 0 | return *(begin() + Index); |
2330 | 0 | } Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::PODSmallVector<(anonymous namespace)::itanium_demangle::PODSmallVector<(anonymous namespace)::itanium_demangle::Node*, 8ul>*, 4ul>::operator[](unsigned long) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::PODSmallVector<(anonymous namespace)::itanium_demangle::Node*, 8ul>::operator[](unsigned long) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::PODSmallVector<(anonymous namespace)::itanium_demangle::Node*, 32ul>::operator[](unsigned long) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::PODSmallVector<(anonymous namespace)::itanium_demangle::ForwardTemplateReference*, 4ul>::operator[](unsigned long) |
2331 | 0 | void clear() { Last = First; } Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::PODSmallVector<(anonymous namespace)::itanium_demangle::PODSmallVector<(anonymous namespace)::itanium_demangle::Node*, 8ul>*, 4ul>::clear() Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::PODSmallVector<(anonymous namespace)::itanium_demangle::Node*, 8ul>::clear() |
2332 | | |
2333 | 0 | ~PODSmallVector() { |
2334 | 0 | if (!isInline()) |
2335 | 0 | std::free(First); |
2336 | 0 | } Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::PODSmallVector<(anonymous namespace)::itanium_demangle::ForwardTemplateReference*, 4ul>::~PODSmallVector() Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::PODSmallVector<(anonymous namespace)::itanium_demangle::PODSmallVector<(anonymous namespace)::itanium_demangle::Node*, 8ul>*, 4ul>::~PODSmallVector() Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::PODSmallVector<(anonymous namespace)::itanium_demangle::Node*, 8ul>::~PODSmallVector() Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::PODSmallVector<(anonymous namespace)::itanium_demangle::Node*, 32ul>::~PODSmallVector() |
2337 | | }; |
2338 | | |
2339 | | template <typename Derived, typename Alloc> struct AbstractManglingParser { |
2340 | | const char *First; |
2341 | | const char *Last; |
2342 | | |
2343 | | // Name stack, this is used by the parser to hold temporary names that were |
2344 | | // parsed. The parser collapses multiple names into new nodes to construct |
2345 | | // the AST. Once the parser is finished, names.size() == 1. |
2346 | | PODSmallVector<Node *, 32> Names; |
2347 | | |
2348 | | // Substitution table. Itanium supports name substitutions as a means of |
2349 | | // compression. The string "S42_" refers to the 44nd entry (base-36) in this |
2350 | | // table. |
2351 | | PODSmallVector<Node *, 32> Subs; |
2352 | | |
2353 | | using TemplateParamList = PODSmallVector<Node *, 8>; |
2354 | | |
2355 | | class ScopedTemplateParamList { |
2356 | | AbstractManglingParser *Parser; |
2357 | | size_t OldNumTemplateParamLists; |
2358 | | TemplateParamList Params; |
2359 | | |
2360 | | public: |
2361 | | ScopedTemplateParamList(AbstractManglingParser *TheParser) |
2362 | | : Parser(TheParser), |
2363 | 0 | OldNumTemplateParamLists(TheParser->TemplateParams.size()) { |
2364 | 0 | Parser->TemplateParams.push_back(&Params); |
2365 | 0 | } |
2366 | 0 | ~ScopedTemplateParamList() { |
2367 | 0 | assert(Parser->TemplateParams.size() >= OldNumTemplateParamLists); |
2368 | 0 | Parser->TemplateParams.dropBack(OldNumTemplateParamLists); |
2369 | 0 | } |
2370 | | }; |
2371 | | |
2372 | | // Template parameter table. Like the above, but referenced like "T42_". |
2373 | | // This has a smaller size compared to Subs and Names because it can be |
2374 | | // stored on the stack. |
2375 | | TemplateParamList OuterTemplateParams; |
2376 | | |
2377 | | // Lists of template parameters indexed by template parameter depth, |
2378 | | // referenced like "TL2_4_". If nonempty, element 0 is always |
2379 | | // OuterTemplateParams; inner elements are always template parameter lists of |
2380 | | // lambda expressions. For a generic lambda with no explicit template |
2381 | | // parameter list, the corresponding parameter list pointer will be null. |
2382 | | PODSmallVector<TemplateParamList *, 4> TemplateParams; |
2383 | | |
2384 | | // Set of unresolved forward <template-param> references. These can occur in a |
2385 | | // conversion operator's type, and are resolved in the enclosing <encoding>. |
2386 | | PODSmallVector<ForwardTemplateReference *, 4> ForwardTemplateRefs; |
2387 | | |
2388 | | bool TryToParseTemplateArgs = true; |
2389 | | bool PermitForwardTemplateReferences = false; |
2390 | | size_t ParsingLambdaParamsAtLevel = (size_t)-1; |
2391 | | |
2392 | | unsigned NumSyntheticTemplateParameters[3] = {}; |
2393 | | |
2394 | | Alloc ASTAllocator; |
2395 | | |
2396 | | AbstractManglingParser(const char *First_, const char *Last_) |
2397 | 0 | : First(First_), Last(Last_) {} |
2398 | | |
2399 | 0 | Derived &getDerived() { return static_cast<Derived &>(*this); } |
2400 | | |
2401 | | void reset(const char *First_, const char *Last_) { |
2402 | | First = First_; |
2403 | | Last = Last_; |
2404 | | Names.clear(); |
2405 | | Subs.clear(); |
2406 | | TemplateParams.clear(); |
2407 | | ParsingLambdaParamsAtLevel = (size_t)-1; |
2408 | | TryToParseTemplateArgs = true; |
2409 | | PermitForwardTemplateReferences = false; |
2410 | | for (int I = 0; I != 3; ++I) |
2411 | | NumSyntheticTemplateParameters[I] = 0; |
2412 | | ASTAllocator.reset(); |
2413 | | } |
2414 | | |
2415 | 0 | template <class T, class... Args> Node *make(Args &&... args) { |
2416 | 0 | return ASTAllocator.template makeNode<T>(std::forward<Args>(args)...); |
2417 | 0 | } Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::SpecialName, char const (&) [31], (anonymous namespace)::itanium_demangle::Node*&>(char const (&) [31], (anonymous namespace)::itanium_demangle::Node*&) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::SpecialName, char const (&) [12], (anonymous namespace)::itanium_demangle::Node*&>(char const (&) [12], (anonymous namespace)::itanium_demangle::Node*&) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::SpecialName, char const (&) [9], (anonymous namespace)::itanium_demangle::Node*&>(char const (&) [9], (anonymous namespace)::itanium_demangle::Node*&) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::SpecialName, char const (&) [14], (anonymous namespace)::itanium_demangle::Node*&>(char const (&) [14], (anonymous namespace)::itanium_demangle::Node*&) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::SpecialName, char const (&) [19], (anonymous namespace)::itanium_demangle::Node*&>(char const (&) [19], (anonymous namespace)::itanium_demangle::Node*&) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::SpecialName, char const (&) [27], (anonymous namespace)::itanium_demangle::Node*&>(char const (&) [27], (anonymous namespace)::itanium_demangle::Node*&) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::CtorVtableSpecialName, (anonymous namespace)::itanium_demangle::Node*&, (anonymous namespace)::itanium_demangle::Node*&>((anonymous namespace)::itanium_demangle::Node*&, (anonymous namespace)::itanium_demangle::Node*&) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::SpecialName, char const (&) [41], (anonymous namespace)::itanium_demangle::Node*&>(char const (&) [41], (anonymous namespace)::itanium_demangle::Node*&) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::SpecialName, char const (&) [18], (anonymous namespace)::itanium_demangle::Node*&>(char const (&) [18], (anonymous namespace)::itanium_demangle::Node*&) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::SpecialName, char const (&) [22], (anonymous namespace)::itanium_demangle::Node*&>(char const (&) [22], (anonymous namespace)::itanium_demangle::Node*&) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::SpecialName, char const (&) [20], (anonymous namespace)::itanium_demangle::Node*&>(char const (&) [20], (anonymous namespace)::itanium_demangle::Node*&) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::SpecialName, char const (&) [25], (anonymous namespace)::itanium_demangle::Node*&>(char const (&) [25], (anonymous namespace)::itanium_demangle::Node*&) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::NameType, char const (&) [4]>(char const (&) [4]) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::NestedName, (anonymous namespace)::itanium_demangle::Node*&, (anonymous namespace)::itanium_demangle::Node*&>((anonymous namespace)::itanium_demangle::Node*&, (anonymous namespace)::itanium_demangle::Node*&) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::ForwardTemplateReference, unsigned long&>(unsigned long&) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::NameType, char const (&) [5]>(char const (&) [5]) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::IntegerLiteral, (anonymous namespace)::itanium_demangle::StringView&, (anonymous namespace)::itanium_demangle::StringView&>((anonymous namespace)::itanium_demangle::StringView&, (anonymous namespace)::itanium_demangle::StringView&) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::BoolExpr, int>(int&&) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::FloatLiteralImpl<float>, (anonymous namespace)::itanium_demangle::StringView&>((anonymous namespace)::itanium_demangle::StringView&) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::FloatLiteralImpl<double>, (anonymous namespace)::itanium_demangle::StringView&>((anonymous namespace)::itanium_demangle::StringView&) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::FloatLiteralImpl<long double>, (anonymous namespace)::itanium_demangle::StringView&>((anonymous namespace)::itanium_demangle::StringView&) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::StringLiteral, (anonymous namespace)::itanium_demangle::Node*&>((anonymous namespace)::itanium_demangle::Node*&) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::NameType, char const (&) [8]>(char const (&) [8]) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::UnnamedTypeName, (anonymous namespace)::itanium_demangle::StringView&>((anonymous namespace)::itanium_demangle::StringView&) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::SyntheticTemplateParamName, (anonymous namespace)::itanium_demangle::TemplateParamKind&, unsigned int&>((anonymous namespace)::itanium_demangle::TemplateParamKind&, unsigned int&) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::TypeTemplateParamDecl, (anonymous namespace)::itanium_demangle::Node*&>((anonymous namespace)::itanium_demangle::Node*&) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::NonTypeTemplateParamDecl, (anonymous namespace)::itanium_demangle::Node*&, (anonymous namespace)::itanium_demangle::Node*&>((anonymous namespace)::itanium_demangle::Node*&, (anonymous namespace)::itanium_demangle::Node*&) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::TemplateTemplateParamDecl, (anonymous namespace)::itanium_demangle::Node*&, (anonymous namespace)::itanium_demangle::NodeArray&>((anonymous namespace)::itanium_demangle::Node*&, (anonymous namespace)::itanium_demangle::NodeArray&) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::TemplateParamPackDecl, (anonymous namespace)::itanium_demangle::Node*&>((anonymous namespace)::itanium_demangle::Node*&) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::ClosureTypeName, (anonymous namespace)::itanium_demangle::NodeArray&, (anonymous namespace)::itanium_demangle::NodeArray&, (anonymous namespace)::itanium_demangle::StringView&>((anonymous namespace)::itanium_demangle::NodeArray&, (anonymous namespace)::itanium_demangle::NodeArray&, (anonymous namespace)::itanium_demangle::StringView&) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::NameType, char const (&) [16]>(char const (&) [16]) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::LambdaExpr, (anonymous namespace)::itanium_demangle::Node*&>((anonymous namespace)::itanium_demangle::Node*&) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::EnumLiteral, (anonymous namespace)::itanium_demangle::Node*&, (anonymous namespace)::itanium_demangle::StringView&>((anonymous namespace)::itanium_demangle::Node*&, (anonymous namespace)::itanium_demangle::StringView&) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::FunctionParam, (anonymous namespace)::itanium_demangle::StringView&>((anonymous namespace)::itanium_demangle::StringView&) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::FoldExpr, bool&, (anonymous namespace)::itanium_demangle::StringView&, (anonymous namespace)::itanium_demangle::Node*&, (anonymous namespace)::itanium_demangle::Node*&>(bool&, (anonymous namespace)::itanium_demangle::StringView&, (anonymous namespace)::itanium_demangle::Node*&, (anonymous namespace)::itanium_demangle::Node*&) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::BinaryExpr, (anonymous namespace)::itanium_demangle::Node*&, (anonymous namespace)::itanium_demangle::StringView&, (anonymous namespace)::itanium_demangle::Node*&>((anonymous namespace)::itanium_demangle::Node*&, (anonymous namespace)::itanium_demangle::StringView&, (anonymous namespace)::itanium_demangle::Node*&) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::PrefixExpr, (anonymous namespace)::itanium_demangle::StringView&, (anonymous namespace)::itanium_demangle::Node*&>((anonymous namespace)::itanium_demangle::StringView&, (anonymous namespace)::itanium_demangle::Node*&) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::CastExpr, char const (&) [11], (anonymous namespace)::itanium_demangle::Node*&, (anonymous namespace)::itanium_demangle::Node*&>(char const (&) [11], (anonymous namespace)::itanium_demangle::Node*&, (anonymous namespace)::itanium_demangle::Node*&) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::CallExpr, (anonymous namespace)::itanium_demangle::Node*&, (anonymous namespace)::itanium_demangle::NodeArray>((anonymous namespace)::itanium_demangle::Node*&, (anonymous namespace)::itanium_demangle::NodeArray&&) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::ConversionExpr, (anonymous namespace)::itanium_demangle::Node*&, (anonymous namespace)::itanium_demangle::NodeArray&>((anonymous namespace)::itanium_demangle::Node*&, (anonymous namespace)::itanium_demangle::NodeArray&) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::ConversionExpr, (anonymous namespace)::itanium_demangle::Node*&, (anonymous namespace)::itanium_demangle::NodeArray>((anonymous namespace)::itanium_demangle::Node*&, (anonymous namespace)::itanium_demangle::NodeArray&&) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::DeleteExpr, (anonymous namespace)::itanium_demangle::Node*&, bool&, bool>((anonymous namespace)::itanium_demangle::Node*&, bool&, bool&&) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::CastExpr, char const (&) [13], (anonymous namespace)::itanium_demangle::Node*&, (anonymous namespace)::itanium_demangle::Node*&>(char const (&) [13], (anonymous namespace)::itanium_demangle::Node*&, (anonymous namespace)::itanium_demangle::Node*&) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::QualifiedName, (anonymous namespace)::itanium_demangle::Node*&, (anonymous namespace)::itanium_demangle::Node*&>((anonymous namespace)::itanium_demangle::Node*&, (anonymous namespace)::itanium_demangle::Node*&) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::DtorName, (anonymous namespace)::itanium_demangle::Node*&>((anonymous namespace)::itanium_demangle::Node*&) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::NameType, char const (&) [11]>(char const (&) [11]) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::NameType, char const (&) [10]>(char const (&) [10]) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::ConversionOperatorType, (anonymous namespace)::itanium_demangle::Node*&>((anonymous namespace)::itanium_demangle::Node*&) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::NameType, char const (&) [18]>(char const (&) [18]) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::LiteralOperator, (anonymous namespace)::itanium_demangle::Node*&>((anonymous namespace)::itanium_demangle::Node*&) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::NameType, char const (&) [12]>(char const (&) [12]) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::NameType, char const (&) [15]>(char const (&) [15]) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::NameType, char const (&) [13]>(char const (&) [13]) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::GlobalQualifiedName, (anonymous namespace)::itanium_demangle::Node*&>((anonymous namespace)::itanium_demangle::Node*&) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::MemberExpr, (anonymous namespace)::itanium_demangle::Node*&, char const (&) [3], (anonymous namespace)::itanium_demangle::Node*&>((anonymous namespace)::itanium_demangle::Node*&, char const (&) [3], (anonymous namespace)::itanium_demangle::Node*&) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::MemberExpr, (anonymous namespace)::itanium_demangle::Node*&, char const (&) [2], (anonymous namespace)::itanium_demangle::Node*&>((anonymous namespace)::itanium_demangle::Node*&, char const (&) [2], (anonymous namespace)::itanium_demangle::Node*&) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::ArraySubscriptExpr, (anonymous namespace)::itanium_demangle::Node*&, (anonymous namespace)::itanium_demangle::Node*&>((anonymous namespace)::itanium_demangle::Node*&, (anonymous namespace)::itanium_demangle::Node*&) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::BracedExpr, (anonymous namespace)::itanium_demangle::Node*&, (anonymous namespace)::itanium_demangle::Node*&, bool>((anonymous namespace)::itanium_demangle::Node*&, (anonymous namespace)::itanium_demangle::Node*&, bool&&) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::BracedRangeExpr, (anonymous namespace)::itanium_demangle::Node*&, (anonymous namespace)::itanium_demangle::Node*&, (anonymous namespace)::itanium_demangle::Node*&>((anonymous namespace)::itanium_demangle::Node*&, (anonymous namespace)::itanium_demangle::Node*&, (anonymous namespace)::itanium_demangle::Node*&) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::InitListExpr, decltype(nullptr), (anonymous namespace)::itanium_demangle::NodeArray>(decltype(nullptr)&&, (anonymous namespace)::itanium_demangle::NodeArray&&) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::PointerToMemberConversionExpr, (anonymous namespace)::itanium_demangle::Node*&, (anonymous namespace)::itanium_demangle::Node*&, (anonymous namespace)::itanium_demangle::StringView&>((anonymous namespace)::itanium_demangle::Node*&, (anonymous namespace)::itanium_demangle::Node*&, (anonymous namespace)::itanium_demangle::StringView&) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::PostfixExpr, (anonymous namespace)::itanium_demangle::Node*&, char const (&) [3]>((anonymous namespace)::itanium_demangle::Node*&, char const (&) [3]) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::NewExpr, (anonymous namespace)::itanium_demangle::NodeArray&, (anonymous namespace)::itanium_demangle::Node*&, (anonymous namespace)::itanium_demangle::NodeArray&, bool&, bool&>((anonymous namespace)::itanium_demangle::NodeArray&, (anonymous namespace)::itanium_demangle::Node*&, (anonymous namespace)::itanium_demangle::NodeArray&, bool&, bool&) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::NewExpr, (anonymous namespace)::itanium_demangle::NodeArray&, (anonymous namespace)::itanium_demangle::Node*&, (anonymous namespace)::itanium_demangle::NodeArray, bool&, bool&>((anonymous namespace)::itanium_demangle::NodeArray&, (anonymous namespace)::itanium_demangle::Node*&, (anonymous namespace)::itanium_demangle::NodeArray&&, bool&, bool&) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::EnclosingExpr, char const (&) [11], (anonymous namespace)::itanium_demangle::Node*&, char const (&) [2]>(char const (&) [11], (anonymous namespace)::itanium_demangle::Node*&, char const (&) [2]) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::ConditionalExpr, (anonymous namespace)::itanium_demangle::Node*&, (anonymous namespace)::itanium_demangle::Node*&, (anonymous namespace)::itanium_demangle::Node*&>((anonymous namespace)::itanium_demangle::Node*&, (anonymous namespace)::itanium_demangle::Node*&, (anonymous namespace)::itanium_demangle::Node*&) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::CastExpr, char const (&) [17], (anonymous namespace)::itanium_demangle::Node*&, (anonymous namespace)::itanium_demangle::Node*&>(char const (&) [17], (anonymous namespace)::itanium_demangle::Node*&, (anonymous namespace)::itanium_demangle::Node*&) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::CastExpr, char const (&) [12], (anonymous namespace)::itanium_demangle::Node*&, (anonymous namespace)::itanium_demangle::Node*&>(char const (&) [12], (anonymous namespace)::itanium_demangle::Node*&, (anonymous namespace)::itanium_demangle::Node*&) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::NameType, (anonymous namespace)::itanium_demangle::StringView>((anonymous namespace)::itanium_demangle::StringView&&) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::SubobjectExpr, (anonymous namespace)::itanium_demangle::Node*&, (anonymous namespace)::itanium_demangle::Node*&, (anonymous namespace)::itanium_demangle::StringView&, (anonymous namespace)::itanium_demangle::NodeArray, bool&>((anonymous namespace)::itanium_demangle::Node*&, (anonymous namespace)::itanium_demangle::Node*&, (anonymous namespace)::itanium_demangle::StringView&, (anonymous namespace)::itanium_demangle::NodeArray&&, bool&) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::ParameterPackExpansion, (anonymous namespace)::itanium_demangle::Node*&>((anonymous namespace)::itanium_demangle::Node*&) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::EnclosingExpr, char const (&) [9], (anonymous namespace)::itanium_demangle::Node*&, char const (&) [2]>(char const (&) [9], (anonymous namespace)::itanium_demangle::Node*&, char const (&) [2]) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::SizeofParamPackExpr, (anonymous namespace)::itanium_demangle::Node*&>((anonymous namespace)::itanium_demangle::Node*&) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::EnclosingExpr, char const (&) [12], (anonymous namespace)::itanium_demangle::Node*&, char const (&) [2]>(char const (&) [12], (anonymous namespace)::itanium_demangle::Node*&, char const (&) [2]) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::NodeArrayNode, (anonymous namespace)::itanium_demangle::NodeArray>((anonymous namespace)::itanium_demangle::NodeArray&&) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::InitListExpr, (anonymous namespace)::itanium_demangle::Node*&, (anonymous namespace)::itanium_demangle::NodeArray>((anonymous namespace)::itanium_demangle::Node*&, (anonymous namespace)::itanium_demangle::NodeArray&&) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::NameType, char const (&) [6]>(char const (&) [6]) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::ThrowExpr, (anonymous namespace)::itanium_demangle::Node*&>((anonymous namespace)::itanium_demangle::Node*&) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::NameType, char const (&) [22]>(char const (&) [22]) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::NameType, (anonymous namespace)::itanium_demangle::StringView&>((anonymous namespace)::itanium_demangle::StringView&) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::EnclosingExpr, char const (&) [10], (anonymous namespace)::itanium_demangle::Node*&, char const (&) [2]>(char const (&) [10], (anonymous namespace)::itanium_demangle::Node*&, char const (&) [2]) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::ExpandedSpecialSubstitution, (anonymous namespace)::itanium_demangle::SpecialSubKind&>((anonymous namespace)::itanium_demangle::SpecialSubKind&) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::CtorDtorName, (anonymous namespace)::itanium_demangle::Node*&, bool, int&>((anonymous namespace)::itanium_demangle::Node*&, bool&&, int&) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::AbiTagAttr, (anonymous namespace)::itanium_demangle::Node*&, (anonymous namespace)::itanium_demangle::StringView&>((anonymous namespace)::itanium_demangle::Node*&, (anonymous namespace)::itanium_demangle::StringView&) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::StructuredBindingName, (anonymous namespace)::itanium_demangle::NodeArray>((anonymous namespace)::itanium_demangle::NodeArray&&) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::LocalName, (anonymous namespace)::itanium_demangle::Node*&, (anonymous namespace)::itanium_demangle::Node*&>((anonymous namespace)::itanium_demangle::Node*&, (anonymous namespace)::itanium_demangle::Node*&) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::SpecialSubstitution, (anonymous namespace)::itanium_demangle::SpecialSubKind>((anonymous namespace)::itanium_demangle::SpecialSubKind&&) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::ParameterPack, (anonymous namespace)::itanium_demangle::NodeArray>((anonymous namespace)::itanium_demangle::NodeArray&&) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::TemplateArgs, (anonymous namespace)::itanium_demangle::NodeArray>((anonymous namespace)::itanium_demangle::NodeArray&&) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::NameWithTemplateArgs, (anonymous namespace)::itanium_demangle::Node*&, (anonymous namespace)::itanium_demangle::Node*&>((anonymous namespace)::itanium_demangle::Node*&, (anonymous namespace)::itanium_demangle::Node*&) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::StdQualifiedName, (anonymous namespace)::itanium_demangle::Node*&>((anonymous namespace)::itanium_demangle::Node*&) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::TemplateArgumentPack, (anonymous namespace)::itanium_demangle::NodeArray&>((anonymous namespace)::itanium_demangle::NodeArray&) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::EnableIfAttr, (anonymous namespace)::itanium_demangle::NodeArray>((anonymous namespace)::itanium_demangle::NodeArray&&) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::FunctionEncoding, (anonymous namespace)::itanium_demangle::Node*&, (anonymous namespace)::itanium_demangle::Node*&, (anonymous namespace)::itanium_demangle::NodeArray, (anonymous namespace)::itanium_demangle::Node*&, (anonymous namespace)::itanium_demangle::Qualifiers&, (anonymous namespace)::itanium_demangle::FunctionRefQual&>((anonymous namespace)::itanium_demangle::Node*&, (anonymous namespace)::itanium_demangle::Node*&, (anonymous namespace)::itanium_demangle::NodeArray&&, (anonymous namespace)::itanium_demangle::Node*&, (anonymous namespace)::itanium_demangle::Qualifiers&, (anonymous namespace)::itanium_demangle::FunctionRefQual&) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::DotSuffix, (anonymous namespace)::itanium_demangle::Node*&, (anonymous namespace)::itanium_demangle::StringView>((anonymous namespace)::itanium_demangle::Node*&, (anonymous namespace)::itanium_demangle::StringView&&) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::SpecialName, char const (&) [34], (anonymous namespace)::itanium_demangle::Node*&>(char const (&) [34], (anonymous namespace)::itanium_demangle::Node*&) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::NoexceptSpec, (anonymous namespace)::itanium_demangle::Node*&>((anonymous namespace)::itanium_demangle::Node*&) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::DynamicExceptionSpec, (anonymous namespace)::itanium_demangle::NodeArray>((anonymous namespace)::itanium_demangle::NodeArray&&) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::FunctionType, (anonymous namespace)::itanium_demangle::Node*&, (anonymous namespace)::itanium_demangle::NodeArray&, (anonymous namespace)::itanium_demangle::Qualifiers&, (anonymous namespace)::itanium_demangle::FunctionRefQual&, (anonymous namespace)::itanium_demangle::Node*&>((anonymous namespace)::itanium_demangle::Node*&, (anonymous namespace)::itanium_demangle::NodeArray&, (anonymous namespace)::itanium_demangle::Qualifiers&, (anonymous namespace)::itanium_demangle::FunctionRefQual&, (anonymous namespace)::itanium_demangle::Node*&) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::ObjCProtoName, (anonymous namespace)::itanium_demangle::Node*&, (anonymous namespace)::itanium_demangle::StringView&>((anonymous namespace)::itanium_demangle::Node*&, (anonymous namespace)::itanium_demangle::StringView&) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::VendorExtQualType, (anonymous namespace)::itanium_demangle::Node*&, (anonymous namespace)::itanium_demangle::StringView&, (anonymous namespace)::itanium_demangle::Node*&>((anonymous namespace)::itanium_demangle::Node*&, (anonymous namespace)::itanium_demangle::StringView&, (anonymous namespace)::itanium_demangle::Node*&) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::QualType, (anonymous namespace)::itanium_demangle::Node*&, (anonymous namespace)::itanium_demangle::Qualifiers&>((anonymous namespace)::itanium_demangle::Node*&, (anonymous namespace)::itanium_demangle::Qualifiers&) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::NameType, char const (&) [14]>(char const (&) [14]) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::NameType, char const (&) [19]>(char const (&) [19]) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::NameType, char const (&) [9]>(char const (&) [9]) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::NameType, char const (&) [7]>(char const (&) [7]) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::PixelVectorType, (anonymous namespace)::itanium_demangle::Node*&>((anonymous namespace)::itanium_demangle::Node*&) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::VectorType, (anonymous namespace)::itanium_demangle::Node*&, (anonymous namespace)::itanium_demangle::Node*&>((anonymous namespace)::itanium_demangle::Node*&, (anonymous namespace)::itanium_demangle::Node*&) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::VectorType, (anonymous namespace)::itanium_demangle::Node*&, decltype(nullptr)>((anonymous namespace)::itanium_demangle::Node*&, decltype(nullptr)&&) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::ArrayType, (anonymous namespace)::itanium_demangle::Node*&, (anonymous namespace)::itanium_demangle::Node*&>((anonymous namespace)::itanium_demangle::Node*&, (anonymous namespace)::itanium_demangle::Node*&) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::PointerToMemberType, (anonymous namespace)::itanium_demangle::Node*&, (anonymous namespace)::itanium_demangle::Node*&>((anonymous namespace)::itanium_demangle::Node*&, (anonymous namespace)::itanium_demangle::Node*&) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::ElaboratedTypeSpefType, (anonymous namespace)::itanium_demangle::StringView&, (anonymous namespace)::itanium_demangle::Node*&>((anonymous namespace)::itanium_demangle::StringView&, (anonymous namespace)::itanium_demangle::Node*&) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::PointerType, (anonymous namespace)::itanium_demangle::Node*&>((anonymous namespace)::itanium_demangle::Node*&) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::ReferenceType, (anonymous namespace)::itanium_demangle::Node*&, (anonymous namespace)::itanium_demangle::ReferenceKind>((anonymous namespace)::itanium_demangle::Node*&, (anonymous namespace)::itanium_demangle::ReferenceKind&&) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::PostfixQualifiedType, (anonymous namespace)::itanium_demangle::Node*&, char const (&) [9]>((anonymous namespace)::itanium_demangle::Node*&, char const (&) [9]) Unexecuted instantiation: cxa_demangle.cpp:(anonymous namespace)::itanium_demangle::Node* (anonymous namespace)::itanium_demangle::AbstractManglingParser<(anonymous namespace)::itanium_demangle::ManglingParser<(anonymous namespace)::DefaultAllocator>, (anonymous namespace)::DefaultAllocator>::make<(anonymous namespace)::itanium_demangle::PostfixQualifiedType, (anonymous namespace)::itanium_demangle::Node*&, char const (&) [11]>((anonymous namespace)::itanium_demangle::Node*&, char const (&) [11]) |
2418 | | |
2419 | 0 | template <class It> NodeArray makeNodeArray(It begin, It end) { |
2420 | 0 | size_t sz = static_cast<size_t>(end - begin); |
2421 | 0 | void *mem = ASTAllocator.allocateNodeArray(sz); |
2422 | 0 | Node **data = new (mem) Node *[sz]; |
2423 | 0 | std::copy(begin, end, data); |
2424 | 0 | return NodeArray(data, sz); |
2425 | 0 | } |
2426 | | |
2427 | 0 | NodeArray popTrailingNodeArray(size_t FromPosition) { |
2428 | 0 | assert(FromPosition <= Names.size()); |
2429 | 0 | NodeArray res = |
2430 | 0 | makeNodeArray(Names.begin() + (long)FromPosition, Names.end()); |
2431 | 0 | Names.dropBack(FromPosition); |
2432 | 0 | return res; |
2433 | 0 | } |
2434 | | |
2435 | 0 | bool consumeIf(StringView S) { |
2436 | 0 | if (StringView(First, Last).startsWith(S)) { |
2437 | 0 | First += S.size(); |
2438 | 0 | return true; |
2439 | 0 | } |
2440 | 0 | return false; |
2441 | 0 | } |
2442 | | |
2443 | 0 | bool consumeIf(char C) { |
2444 | 0 | if (First != Last && *First == C) { |
2445 | 0 | ++First; |
2446 | 0 | return true; |
2447 | 0 | } |
2448 | 0 | return false; |
2449 | 0 | } |
2450 | | |
2451 | 0 | char consume() { return First != Last ? *First++ : '\0'; } |
2452 | | |
2453 | 0 | char look(unsigned Lookahead = 0) { |
2454 | 0 | if (static_cast<size_t>(Last - First) <= Lookahead) |
2455 | 0 | return '\0'; |
2456 | 0 | return First[Lookahead]; |
2457 | 0 | } |
2458 | | |
2459 | 0 | size_t numLeft() const { return static_cast<size_t>(Last - First); } |
2460 | | |
2461 | | StringView parseNumber(bool AllowNegative = false); |
2462 | | Qualifiers parseCVQualifiers(); |
2463 | | bool parsePositiveInteger(size_t *Out); |
2464 | | StringView parseBareSourceName(); |
2465 | | |
2466 | | bool parseSeqId(size_t *Out); |
2467 | | Node *parseSubstitution(); |
2468 | | Node *parseTemplateParam(); |
2469 | | Node *parseTemplateParamDecl(); |
2470 | | Node *parseTemplateArgs(bool TagTemplates = false); |
2471 | | Node *parseTemplateArg(); |
2472 | | |
2473 | | /// Parse the <expr> production. |
2474 | | Node *parseExpr(); |
2475 | | Node *parsePrefixExpr(StringView Kind); |
2476 | | Node *parseBinaryExpr(StringView Kind); |
2477 | | Node *parseIntegerLiteral(StringView Lit); |
2478 | | Node *parseExprPrimary(); |
2479 | | template <class Float> Node *parseFloatingLiteral(); |
2480 | | Node *parseFunctionParam(); |
2481 | | Node *parseNewExpr(); |
2482 | | Node *parseConversionExpr(); |
2483 | | Node *parseBracedExpr(); |
2484 | | Node *parseFoldExpr(); |
2485 | | Node *parsePointerToMemberConversionExpr(); |
2486 | | Node *parseSubobjectExpr(); |
2487 | | |
2488 | | /// Parse the <type> production. |
2489 | | Node *parseType(); |
2490 | | Node *parseFunctionType(); |
2491 | | Node *parseVectorType(); |
2492 | | Node *parseDecltype(); |
2493 | | Node *parseArrayType(); |
2494 | | Node *parsePointerToMemberType(); |
2495 | | Node *parseClassEnumType(); |
2496 | | Node *parseQualifiedType(); |
2497 | | |
2498 | | Node *parseEncoding(); |
2499 | | bool parseCallOffset(); |
2500 | | Node *parseSpecialName(); |
2501 | | |
2502 | | /// Holds some extra information about a <name> that is being parsed. This |
2503 | | /// information is only pertinent if the <name> refers to an <encoding>. |
2504 | | struct NameState { |
2505 | | bool CtorDtorConversion = false; |
2506 | | bool EndsWithTemplateArgs = false; |
2507 | | Qualifiers CVQualifiers = QualNone; |
2508 | | FunctionRefQual ReferenceQualifier = FrefQualNone; |
2509 | | size_t ForwardTemplateRefsBegin; |
2510 | | |
2511 | | NameState(AbstractManglingParser *Enclosing) |
2512 | 0 | : ForwardTemplateRefsBegin(Enclosing->ForwardTemplateRefs.size()) {} |
2513 | | }; |
2514 | | |
2515 | 0 | bool resolveForwardTemplateRefs(NameState &State) { |
2516 | 0 | size_t I = State.ForwardTemplateRefsBegin; |
2517 | 0 | size_t E = ForwardTemplateRefs.size(); |
2518 | 0 | for (; I < E; ++I) { |
2519 | 0 | size_t Idx = ForwardTemplateRefs[I]->Index; |
2520 | 0 | if (TemplateParams.empty() || !TemplateParams[0] || |
2521 | 0 | Idx >= TemplateParams[0]->size()) |
2522 | 0 | return true; |
2523 | 0 | ForwardTemplateRefs[I]->Ref = (*TemplateParams[0])[Idx]; |
2524 | 0 | } |
2525 | 0 | ForwardTemplateRefs.dropBack(State.ForwardTemplateRefsBegin); |
2526 | 0 | return false; |
2527 | 0 | } |
2528 | | |
2529 | | /// Parse the <name> production> |
2530 | | Node *parseName(NameState *State = nullptr); |
2531 | | Node *parseLocalName(NameState *State); |
2532 | | Node *parseOperatorName(NameState *State); |
2533 | | Node *parseUnqualifiedName(NameState *State); |
2534 | | Node *parseUnnamedTypeName(NameState *State); |
2535 | | Node *parseSourceName(NameState *State); |
2536 | | Node *parseUnscopedName(NameState *State); |
2537 | | Node *parseNestedName(NameState *State); |
2538 | | Node *parseCtorDtorName(Node *&SoFar, NameState *State); |
2539 | | |
2540 | | Node *parseAbiTags(Node *N); |
2541 | | |
2542 | | /// Parse the <unresolved-name> production. |
2543 | | Node *parseUnresolvedName(); |
2544 | | Node *parseSimpleId(); |
2545 | | Node *parseBaseUnresolvedName(); |
2546 | | Node *parseUnresolvedType(); |
2547 | | Node *parseDestructorName(); |
2548 | | |
2549 | | /// Top-level entry point into the parser. |
2550 | | Node *parse(); |
2551 | | }; |
2552 | | |
2553 | | const char* parse_discriminator(const char* first, const char* last); |
2554 | | |
2555 | | // <name> ::= <nested-name> // N |
2556 | | // ::= <local-name> # See Scope Encoding below // Z |
2557 | | // ::= <unscoped-template-name> <template-args> |
2558 | | // ::= <unscoped-name> |
2559 | | // |
2560 | | // <unscoped-template-name> ::= <unscoped-name> |
2561 | | // ::= <substitution> |
2562 | | template <typename Derived, typename Alloc> |
2563 | 0 | Node *AbstractManglingParser<Derived, Alloc>::parseName(NameState *State) { |
2564 | 0 | consumeIf('L'); // extension |
2565 | |
|
2566 | 0 | if (look() == 'N') |
2567 | 0 | return getDerived().parseNestedName(State); |
2568 | 0 | if (look() == 'Z') |
2569 | 0 | return getDerived().parseLocalName(State); |
2570 | | |
2571 | | // ::= <unscoped-template-name> <template-args> |
2572 | 0 | if (look() == 'S' && look(1) != 't') { |
2573 | 0 | Node *S = getDerived().parseSubstitution(); |
2574 | 0 | if (S == nullptr) |
2575 | 0 | return nullptr; |
2576 | 0 | if (look() != 'I') |
2577 | 0 | return nullptr; |
2578 | 0 | Node *TA = getDerived().parseTemplateArgs(State != nullptr); |
2579 | 0 | if (TA == nullptr) |
2580 | 0 | return nullptr; |
2581 | 0 | if (State) State->EndsWithTemplateArgs = true; |
2582 | 0 | return make<NameWithTemplateArgs>(S, TA); |
2583 | 0 | } |
2584 | | |
2585 | 0 | Node *N = getDerived().parseUnscopedName(State); |
2586 | 0 | if (N == nullptr) |
2587 | 0 | return nullptr; |
2588 | | // ::= <unscoped-template-name> <template-args> |
2589 | 0 | if (look() == 'I') { |
2590 | 0 | Subs.push_back(N); |
2591 | 0 | Node *TA = getDerived().parseTemplateArgs(State != nullptr); |
2592 | 0 | if (TA == nullptr) |
2593 | 0 | return nullptr; |
2594 | 0 | if (State) State->EndsWithTemplateArgs = true; |
2595 | 0 | return make<NameWithTemplateArgs>(N, TA); |
2596 | 0 | } |
2597 | | // ::= <unscoped-name> |
2598 | 0 | return N; |
2599 | 0 | } |
2600 | | |
2601 | | // <local-name> := Z <function encoding> E <entity name> [<discriminator>] |
2602 | | // := Z <function encoding> E s [<discriminator>] |
2603 | | // := Z <function encoding> Ed [ <parameter number> ] _ <entity name> |
2604 | | template <typename Derived, typename Alloc> |
2605 | 0 | Node *AbstractManglingParser<Derived, Alloc>::parseLocalName(NameState *State) { |
2606 | 0 | if (!consumeIf('Z')) |
2607 | 0 | return nullptr; |
2608 | 0 | Node *Encoding = getDerived().parseEncoding(); |
2609 | 0 | if (Encoding == nullptr || !consumeIf('E')) |
2610 | 0 | return nullptr; |
2611 | | |
2612 | 0 | if (consumeIf('s')) { |
2613 | 0 | First = parse_discriminator(First, Last); |
2614 | 0 | auto *StringLitName = make<NameType>("string literal"); |
2615 | 0 | if (!StringLitName) |
2616 | 0 | return nullptr; |
2617 | 0 | return make<LocalName>(Encoding, StringLitName); |
2618 | 0 | } |
2619 | | |
2620 | 0 | if (consumeIf('d')) { |
2621 | 0 | parseNumber(true); |
2622 | 0 | if (!consumeIf('_')) |
2623 | 0 | return nullptr; |
2624 | 0 | Node *N = getDerived().parseName(State); |
2625 | 0 | if (N == nullptr) |
2626 | 0 | return nullptr; |
2627 | 0 | return make<LocalName>(Encoding, N); |
2628 | 0 | } |
2629 | | |
2630 | 0 | Node *Entity = getDerived().parseName(State); |
2631 | 0 | if (Entity == nullptr) |
2632 | 0 | return nullptr; |
2633 | 0 | First = parse_discriminator(First, Last); |
2634 | 0 | return make<LocalName>(Encoding, Entity); |
2635 | 0 | } |
2636 | | |
2637 | | // <unscoped-name> ::= <unqualified-name> |
2638 | | // ::= St <unqualified-name> # ::std:: |
2639 | | // extension ::= StL<unqualified-name> |
2640 | | template <typename Derived, typename Alloc> |
2641 | | Node * |
2642 | 0 | AbstractManglingParser<Derived, Alloc>::parseUnscopedName(NameState *State) { |
2643 | 0 | if (consumeIf("StL") || consumeIf("St")) { |
2644 | 0 | Node *R = getDerived().parseUnqualifiedName(State); |
2645 | 0 | if (R == nullptr) |
2646 | 0 | return nullptr; |
2647 | 0 | return make<StdQualifiedName>(R); |
2648 | 0 | } |
2649 | 0 | return getDerived().parseUnqualifiedName(State); |
2650 | 0 | } |
2651 | | |
2652 | | // <unqualified-name> ::= <operator-name> [abi-tags] |
2653 | | // ::= <ctor-dtor-name> |
2654 | | // ::= <source-name> |
2655 | | // ::= <unnamed-type-name> |
2656 | | // ::= DC <source-name>+ E # structured binding declaration |
2657 | | template <typename Derived, typename Alloc> |
2658 | | Node * |
2659 | 0 | AbstractManglingParser<Derived, Alloc>::parseUnqualifiedName(NameState *State) { |
2660 | | // <ctor-dtor-name>s are special-cased in parseNestedName(). |
2661 | 0 | Node *Result; |
2662 | 0 | if (look() == 'U') |
2663 | 0 | Result = getDerived().parseUnnamedTypeName(State); |
2664 | 0 | else if (look() >= '1' && look() <= '9') |
2665 | 0 | Result = getDerived().parseSourceName(State); |
2666 | 0 | else if (consumeIf("DC")) { |
2667 | 0 | size_t BindingsBegin = Names.size(); |
2668 | 0 | do { |
2669 | 0 | Node *Binding = getDerived().parseSourceName(State); |
2670 | 0 | if (Binding == nullptr) |
2671 | 0 | return nullptr; |
2672 | 0 | Names.push_back(Binding); |
2673 | 0 | } while (!consumeIf('E')); |
2674 | 0 | Result = make<StructuredBindingName>(popTrailingNodeArray(BindingsBegin)); |
2675 | 0 | } else |
2676 | 0 | Result = getDerived().parseOperatorName(State); |
2677 | 0 | if (Result != nullptr) |
2678 | 0 | Result = getDerived().parseAbiTags(Result); |
2679 | 0 | return Result; |
2680 | 0 | } |
2681 | | |
2682 | | // <unnamed-type-name> ::= Ut [<nonnegative number>] _ |
2683 | | // ::= <closure-type-name> |
2684 | | // |
2685 | | // <closure-type-name> ::= Ul <lambda-sig> E [ <nonnegative number> ] _ |
2686 | | // |
2687 | | // <lambda-sig> ::= <parameter type>+ # Parameter types or "v" if the lambda has no parameters |
2688 | | template <typename Derived, typename Alloc> |
2689 | | Node * |
2690 | 0 | AbstractManglingParser<Derived, Alloc>::parseUnnamedTypeName(NameState *State) { |
2691 | | // <template-params> refer to the innermost <template-args>. Clear out any |
2692 | | // outer args that we may have inserted into TemplateParams. |
2693 | 0 | if (State != nullptr) |
2694 | 0 | TemplateParams.clear(); |
2695 | |
|
2696 | 0 | if (consumeIf("Ut")) { |
2697 | 0 | StringView Count = parseNumber(); |
2698 | 0 | if (!consumeIf('_')) |
2699 | 0 | return nullptr; |
2700 | 0 | return make<UnnamedTypeName>(Count); |
2701 | 0 | } |
2702 | 0 | if (consumeIf("Ul")) { |
2703 | 0 | SwapAndRestore<size_t> SwapParams(ParsingLambdaParamsAtLevel, |
2704 | 0 | TemplateParams.size()); |
2705 | 0 | ScopedTemplateParamList LambdaTemplateParams(this); |
2706 | |
|
2707 | 0 | size_t ParamsBegin = Names.size(); |
2708 | 0 | while (look() == 'T' && |
2709 | 0 | StringView("yptn").find(look(1)) != StringView::npos) { |
2710 | 0 | Node *T = parseTemplateParamDecl(); |
2711 | 0 | if (!T) |
2712 | 0 | return nullptr; |
2713 | 0 | Names.push_back(T); |
2714 | 0 | } |
2715 | 0 | NodeArray TempParams = popTrailingNodeArray(ParamsBegin); |
2716 | | |
2717 | | // FIXME: If TempParams is empty and none of the function parameters |
2718 | | // includes 'auto', we should remove LambdaTemplateParams from the |
2719 | | // TemplateParams list. Unfortunately, we don't find out whether there are |
2720 | | // any 'auto' parameters until too late in an example such as: |
2721 | | // |
2722 | | // template<typename T> void f( |
2723 | | // decltype([](decltype([]<typename T>(T v) {}), |
2724 | | // auto) {})) {} |
2725 | | // template<typename T> void f( |
2726 | | // decltype([](decltype([]<typename T>(T w) {}), |
2727 | | // int) {})) {} |
2728 | | // |
2729 | | // Here, the type of v is at level 2 but the type of w is at level 1. We |
2730 | | // don't find this out until we encounter the type of the next parameter. |
2731 | | // |
2732 | | // However, compilers can't actually cope with the former example in |
2733 | | // practice, and it's likely to be made ill-formed in future, so we don't |
2734 | | // need to support it here. |
2735 | | // |
2736 | | // If we encounter an 'auto' in the function parameter types, we will |
2737 | | // recreate a template parameter scope for it, but any intervening lambdas |
2738 | | // will be parsed in the 'wrong' template parameter depth. |
2739 | 0 | if (TempParams.empty()) |
2740 | 0 | TemplateParams.pop_back(); |
2741 | |
|
2742 | 0 | if (!consumeIf("vE")) { |
2743 | 0 | do { |
2744 | 0 | Node *P = getDerived().parseType(); |
2745 | 0 | if (P == nullptr) |
2746 | 0 | return nullptr; |
2747 | 0 | Names.push_back(P); |
2748 | 0 | } while (!consumeIf('E')); |
2749 | 0 | } |
2750 | 0 | NodeArray Params = popTrailingNodeArray(ParamsBegin); |
2751 | |
|
2752 | 0 | StringView Count = parseNumber(); |
2753 | 0 | if (!consumeIf('_')) |
2754 | 0 | return nullptr; |
2755 | 0 | return make<ClosureTypeName>(TempParams, Params, Count); |
2756 | 0 | } |
2757 | 0 | if (consumeIf("Ub")) { |
2758 | 0 | (void)parseNumber(); |
2759 | 0 | if (!consumeIf('_')) |
2760 | 0 | return nullptr; |
2761 | 0 | return make<NameType>("'block-literal'"); |
2762 | 0 | } |
2763 | 0 | return nullptr; |
2764 | 0 | } |
2765 | | |
2766 | | // <source-name> ::= <positive length number> <identifier> |
2767 | | template <typename Derived, typename Alloc> |
2768 | 0 | Node *AbstractManglingParser<Derived, Alloc>::parseSourceName(NameState *) { |
2769 | 0 | size_t Length = 0; |
2770 | 0 | if (parsePositiveInteger(&Length)) |
2771 | 0 | return nullptr; |
2772 | 0 | if (numLeft() < Length || Length == 0) |
2773 | 0 | return nullptr; |
2774 | 0 | StringView Name(First, First + Length); |
2775 | 0 | First += Length; |
2776 | 0 | if (Name.startsWith("_GLOBAL__N")) |
2777 | 0 | return make<NameType>("(anonymous namespace)"); |
2778 | 0 | return make<NameType>(Name); |
2779 | 0 | } |
2780 | | |
2781 | | // <operator-name> ::= aa # && |
2782 | | // ::= ad # & (unary) |
2783 | | // ::= an # & |
2784 | | // ::= aN # &= |
2785 | | // ::= aS # = |
2786 | | // ::= cl # () |
2787 | | // ::= cm # , |
2788 | | // ::= co # ~ |
2789 | | // ::= cv <type> # (cast) |
2790 | | // ::= da # delete[] |
2791 | | // ::= de # * (unary) |
2792 | | // ::= dl # delete |
2793 | | // ::= dv # / |
2794 | | // ::= dV # /= |
2795 | | // ::= eo # ^ |
2796 | | // ::= eO # ^= |
2797 | | // ::= eq # == |
2798 | | // ::= ge # >= |
2799 | | // ::= gt # > |
2800 | | // ::= ix # [] |
2801 | | // ::= le # <= |
2802 | | // ::= li <source-name> # operator "" |
2803 | | // ::= ls # << |
2804 | | // ::= lS # <<= |
2805 | | // ::= lt # < |
2806 | | // ::= mi # - |
2807 | | // ::= mI # -= |
2808 | | // ::= ml # * |
2809 | | // ::= mL # *= |
2810 | | // ::= mm # -- (postfix in <expression> context) |
2811 | | // ::= na # new[] |
2812 | | // ::= ne # != |
2813 | | // ::= ng # - (unary) |
2814 | | // ::= nt # ! |
2815 | | // ::= nw # new |
2816 | | // ::= oo # || |
2817 | | // ::= or # | |
2818 | | // ::= oR # |= |
2819 | | // ::= pm # ->* |
2820 | | // ::= pl # + |
2821 | | // ::= pL # += |
2822 | | // ::= pp # ++ (postfix in <expression> context) |
2823 | | // ::= ps # + (unary) |
2824 | | // ::= pt # -> |
2825 | | // ::= qu # ? |
2826 | | // ::= rm # % |
2827 | | // ::= rM # %= |
2828 | | // ::= rs # >> |
2829 | | // ::= rS # >>= |
2830 | | // ::= ss # <=> C++2a |
2831 | | // ::= v <digit> <source-name> # vendor extended operator |
2832 | | template <typename Derived, typename Alloc> |
2833 | | Node * |
2834 | 0 | AbstractManglingParser<Derived, Alloc>::parseOperatorName(NameState *State) { |
2835 | 0 | switch (look()) { |
2836 | 0 | case 'a': |
2837 | 0 | switch (look(1)) { |
2838 | 0 | case 'a': |
2839 | 0 | First += 2; |
2840 | 0 | return make<NameType>("operator&&"); |
2841 | 0 | case 'd': |
2842 | 0 | case 'n': |
2843 | 0 | First += 2; |
2844 | 0 | return make<NameType>("operator&"); |
2845 | 0 | case 'N': |
2846 | 0 | First += 2; |
2847 | 0 | return make<NameType>("operator&="); |
2848 | 0 | case 'S': |
2849 | 0 | First += 2; |
2850 | 0 | return make<NameType>("operator="); |
2851 | 0 | } |
2852 | 0 | return nullptr; |
2853 | 0 | case 'c': |
2854 | 0 | switch (look(1)) { |
2855 | 0 | case 'l': |
2856 | 0 | First += 2; |
2857 | 0 | return make<NameType>("operator()"); |
2858 | 0 | case 'm': |
2859 | 0 | First += 2; |
2860 | 0 | return make<NameType>("operator,"); |
2861 | 0 | case 'o': |
2862 | 0 | First += 2; |
2863 | 0 | return make<NameType>("operator~"); |
2864 | | // ::= cv <type> # (cast) |
2865 | 0 | case 'v': { |
2866 | 0 | First += 2; |
2867 | 0 | SwapAndRestore<bool> SaveTemplate(TryToParseTemplateArgs, false); |
2868 | | // If we're parsing an encoding, State != nullptr and the conversion |
2869 | | // operators' <type> could have a <template-param> that refers to some |
2870 | | // <template-arg>s further ahead in the mangled name. |
2871 | 0 | SwapAndRestore<bool> SavePermit(PermitForwardTemplateReferences, |
2872 | 0 | PermitForwardTemplateReferences || |
2873 | 0 | State != nullptr); |
2874 | 0 | Node *Ty = getDerived().parseType(); |
2875 | 0 | if (Ty == nullptr) |
2876 | 0 | return nullptr; |
2877 | 0 | if (State) State->CtorDtorConversion = true; |
2878 | 0 | return make<ConversionOperatorType>(Ty); |
2879 | 0 | } |
2880 | 0 | } |
2881 | 0 | return nullptr; |
2882 | 0 | case 'd': |
2883 | 0 | switch (look(1)) { |
2884 | 0 | case 'a': |
2885 | 0 | First += 2; |
2886 | 0 | return make<NameType>("operator delete[]"); |
2887 | 0 | case 'e': |
2888 | 0 | First += 2; |
2889 | 0 | return make<NameType>("operator*"); |
2890 | 0 | case 'l': |
2891 | 0 | First += 2; |
2892 | 0 | return make<NameType>("operator delete"); |
2893 | 0 | case 'v': |
2894 | 0 | First += 2; |
2895 | 0 | return make<NameType>("operator/"); |
2896 | 0 | case 'V': |
2897 | 0 | First += 2; |
2898 | 0 | return make<NameType>("operator/="); |
2899 | 0 | } |
2900 | 0 | return nullptr; |
2901 | 0 | case 'e': |
2902 | 0 | switch (look(1)) { |
2903 | 0 | case 'o': |
2904 | 0 | First += 2; |
2905 | 0 | return make<NameType>("operator^"); |
2906 | 0 | case 'O': |
2907 | 0 | First += 2; |
2908 | 0 | return make<NameType>("operator^="); |
2909 | 0 | case 'q': |
2910 | 0 | First += 2; |
2911 | 0 | return make<NameType>("operator=="); |
2912 | 0 | } |
2913 | 0 | return nullptr; |
2914 | 0 | case 'g': |
2915 | 0 | switch (look(1)) { |
2916 | 0 | case 'e': |
2917 | 0 | First += 2; |
2918 | 0 | return make<NameType>("operator>="); |
2919 | 0 | case 't': |
2920 | 0 | First += 2; |
2921 | 0 | return make<NameType>("operator>"); |
2922 | 0 | } |
2923 | 0 | return nullptr; |
2924 | 0 | case 'i': |
2925 | 0 | if (look(1) == 'x') { |
2926 | 0 | First += 2; |
2927 | 0 | return make<NameType>("operator[]"); |
2928 | 0 | } |
2929 | 0 | return nullptr; |
2930 | 0 | case 'l': |
2931 | 0 | switch (look(1)) { |
2932 | 0 | case 'e': |
2933 | 0 | First += 2; |
2934 | 0 | return make<NameType>("operator<="); |
2935 | | // ::= li <source-name> # operator "" |
2936 | 0 | case 'i': { |
2937 | 0 | First += 2; |
2938 | 0 | Node *SN = getDerived().parseSourceName(State); |
2939 | 0 | if (SN == nullptr) |
2940 | 0 | return nullptr; |
2941 | 0 | return make<LiteralOperator>(SN); |
2942 | 0 | } |
2943 | 0 | case 's': |
2944 | 0 | First += 2; |
2945 | 0 | return make<NameType>("operator<<"); |
2946 | 0 | case 'S': |
2947 | 0 | First += 2; |
2948 | 0 | return make<NameType>("operator<<="); |
2949 | 0 | case 't': |
2950 | 0 | First += 2; |
2951 | 0 | return make<NameType>("operator<"); |
2952 | 0 | } |
2953 | 0 | return nullptr; |
2954 | 0 | case 'm': |
2955 | 0 | switch (look(1)) { |
2956 | 0 | case 'i': |
2957 | 0 | First += 2; |
2958 | 0 | return make<NameType>("operator-"); |
2959 | 0 | case 'I': |
2960 | 0 | First += 2; |
2961 | 0 | return make<NameType>("operator-="); |
2962 | 0 | case 'l': |
2963 | 0 | First += 2; |
2964 | 0 | return make<NameType>("operator*"); |
2965 | 0 | case 'L': |
2966 | 0 | First += 2; |
2967 | 0 | return make<NameType>("operator*="); |
2968 | 0 | case 'm': |
2969 | 0 | First += 2; |
2970 | 0 | return make<NameType>("operator--"); |
2971 | 0 | } |
2972 | 0 | return nullptr; |
2973 | 0 | case 'n': |
2974 | 0 | switch (look(1)) { |
2975 | 0 | case 'a': |
2976 | 0 | First += 2; |
2977 | 0 | return make<NameType>("operator new[]"); |
2978 | 0 | case 'e': |
2979 | 0 | First += 2; |
2980 | 0 | return make<NameType>("operator!="); |
2981 | 0 | case 'g': |
2982 | 0 | First += 2; |
2983 | 0 | return make<NameType>("operator-"); |
2984 | 0 | case 't': |
2985 | 0 | First += 2; |
2986 | 0 | return make<NameType>("operator!"); |
2987 | 0 | case 'w': |
2988 | 0 | First += 2; |
2989 | 0 | return make<NameType>("operator new"); |
2990 | 0 | } |
2991 | 0 | return nullptr; |
2992 | 0 | case 'o': |
2993 | 0 | switch (look(1)) { |
2994 | 0 | case 'o': |
2995 | 0 | First += 2; |
2996 | 0 | return make<NameType>("operator||"); |
2997 | 0 | case 'r': |
2998 | 0 | First += 2; |
2999 | 0 | return make<NameType>("operator|"); |
3000 | 0 | case 'R': |
3001 | 0 | First += 2; |
3002 | 0 | return make<NameType>("operator|="); |
3003 | 0 | } |
3004 | 0 | return nullptr; |
3005 | 0 | case 'p': |
3006 | 0 | switch (look(1)) { |
3007 | 0 | case 'm': |
3008 | 0 | First += 2; |
3009 | 0 | return make<NameType>("operator->*"); |
3010 | 0 | case 'l': |
3011 | 0 | First += 2; |
3012 | 0 | return make<NameType>("operator+"); |
3013 | 0 | case 'L': |
3014 | 0 | First += 2; |
3015 | 0 | return make<NameType>("operator+="); |
3016 | 0 | case 'p': |
3017 | 0 | First += 2; |
3018 | 0 | return make<NameType>("operator++"); |
3019 | 0 | case 's': |
3020 | 0 | First += 2; |
3021 | 0 | return make<NameType>("operator+"); |
3022 | 0 | case 't': |
3023 | 0 | First += 2; |
3024 | 0 | return make<NameType>("operator->"); |
3025 | 0 | } |
3026 | 0 | return nullptr; |
3027 | 0 | case 'q': |
3028 | 0 | if (look(1) == 'u') { |
3029 | 0 | First += 2; |
3030 | 0 | return make<NameType>("operator?"); |
3031 | 0 | } |
3032 | 0 | return nullptr; |
3033 | 0 | case 'r': |
3034 | 0 | switch (look(1)) { |
3035 | 0 | case 'm': |
3036 | 0 | First += 2; |
3037 | 0 | return make<NameType>("operator%"); |
3038 | 0 | case 'M': |
3039 | 0 | First += 2; |
3040 | 0 | return make<NameType>("operator%="); |
3041 | 0 | case 's': |
3042 | 0 | First += 2; |
3043 | 0 | return make<NameType>("operator>>"); |
3044 | 0 | case 'S': |
3045 | 0 | First += 2; |
3046 | 0 | return make<NameType>("operator>>="); |
3047 | 0 | } |
3048 | 0 | return nullptr; |
3049 | 0 | case 's': |
3050 | 0 | if (look(1) == 's') { |
3051 | 0 | First += 2; |
3052 | 0 | return make<NameType>("operator<=>"); |
3053 | 0 | } |
3054 | 0 | return nullptr; |
3055 | | // ::= v <digit> <source-name> # vendor extended operator |
3056 | 0 | case 'v': |
3057 | 0 | if (std::isdigit(look(1))) { |
3058 | 0 | First += 2; |
3059 | 0 | Node *SN = getDerived().parseSourceName(State); |
3060 | 0 | if (SN == nullptr) |
3061 | 0 | return nullptr; |
3062 | 0 | return make<ConversionOperatorType>(SN); |
3063 | 0 | } |
3064 | 0 | return nullptr; |
3065 | 0 | } |
3066 | 0 | return nullptr; |
3067 | 0 | } |
3068 | | |
3069 | | // <ctor-dtor-name> ::= C1 # complete object constructor |
3070 | | // ::= C2 # base object constructor |
3071 | | // ::= C3 # complete object allocating constructor |
3072 | | // extension ::= C4 # gcc old-style "[unified]" constructor |
3073 | | // extension ::= C5 # the COMDAT used for ctors |
3074 | | // ::= D0 # deleting destructor |
3075 | | // ::= D1 # complete object destructor |
3076 | | // ::= D2 # base object destructor |
3077 | | // extension ::= D4 # gcc old-style "[unified]" destructor |
3078 | | // extension ::= D5 # the COMDAT used for dtors |
3079 | | template <typename Derived, typename Alloc> |
3080 | | Node * |
3081 | | AbstractManglingParser<Derived, Alloc>::parseCtorDtorName(Node *&SoFar, |
3082 | 0 | NameState *State) { |
3083 | 0 | if (SoFar->getKind() == Node::KSpecialSubstitution) { |
3084 | 0 | auto SSK = static_cast<SpecialSubstitution *>(SoFar)->SSK; |
3085 | 0 | switch (SSK) { |
3086 | 0 | case SpecialSubKind::string: |
3087 | 0 | case SpecialSubKind::istream: |
3088 | 0 | case SpecialSubKind::ostream: |
3089 | 0 | case SpecialSubKind::iostream: |
3090 | 0 | SoFar = make<ExpandedSpecialSubstitution>(SSK); |
3091 | 0 | if (!SoFar) |
3092 | 0 | return nullptr; |
3093 | 0 | break; |
3094 | 0 | default: |
3095 | 0 | break; |
3096 | 0 | } |
3097 | 0 | } |
3098 | | |
3099 | 0 | if (consumeIf('C')) { |
3100 | 0 | bool IsInherited = consumeIf('I'); |
3101 | 0 | if (look() != '1' && look() != '2' && look() != '3' && look() != '4' && |
3102 | 0 | look() != '5') |
3103 | 0 | return nullptr; |
3104 | 0 | int Variant = look() - '0'; |
3105 | 0 | ++First; |
3106 | 0 | if (State) State->CtorDtorConversion = true; |
3107 | 0 | if (IsInherited) { |
3108 | 0 | if (getDerived().parseName(State) == nullptr) |
3109 | 0 | return nullptr; |
3110 | 0 | } |
3111 | 0 | return make<CtorDtorName>(SoFar, /*IsDtor=*/false, Variant); |
3112 | 0 | } |
3113 | | |
3114 | 0 | if (look() == 'D' && (look(1) == '0' || look(1) == '1' || look(1) == '2' || |
3115 | 0 | look(1) == '4' || look(1) == '5')) { |
3116 | 0 | int Variant = look(1) - '0'; |
3117 | 0 | First += 2; |
3118 | 0 | if (State) State->CtorDtorConversion = true; |
3119 | 0 | return make<CtorDtorName>(SoFar, /*IsDtor=*/true, Variant); |
3120 | 0 | } |
3121 | | |
3122 | 0 | return nullptr; |
3123 | 0 | } |
3124 | | |
3125 | | // <nested-name> ::= N [<CV-Qualifiers>] [<ref-qualifier>] <prefix> <unqualified-name> E |
3126 | | // ::= N [<CV-Qualifiers>] [<ref-qualifier>] <template-prefix> <template-args> E |
3127 | | // |
3128 | | // <prefix> ::= <prefix> <unqualified-name> |
3129 | | // ::= <template-prefix> <template-args> |
3130 | | // ::= <template-param> |
3131 | | // ::= <decltype> |
3132 | | // ::= # empty |
3133 | | // ::= <substitution> |
3134 | | // ::= <prefix> <data-member-prefix> |
3135 | | // extension ::= L |
3136 | | // |
3137 | | // <data-member-prefix> := <member source-name> [<template-args>] M |
3138 | | // |
3139 | | // <template-prefix> ::= <prefix> <template unqualified-name> |
3140 | | // ::= <template-param> |
3141 | | // ::= <substitution> |
3142 | | template <typename Derived, typename Alloc> |
3143 | | Node * |
3144 | 0 | AbstractManglingParser<Derived, Alloc>::parseNestedName(NameState *State) { |
3145 | 0 | if (!consumeIf('N')) |
3146 | 0 | return nullptr; |
3147 | | |
3148 | 0 | Qualifiers CVTmp = parseCVQualifiers(); |
3149 | 0 | if (State) State->CVQualifiers = CVTmp; |
3150 | |
|
3151 | 0 | if (consumeIf('O')) { |
3152 | 0 | if (State) State->ReferenceQualifier = FrefQualRValue; |
3153 | 0 | } else if (consumeIf('R')) { |
3154 | 0 | if (State) State->ReferenceQualifier = FrefQualLValue; |
3155 | 0 | } else |
3156 | 0 | if (State) State->ReferenceQualifier = FrefQualNone; |
3157 | |
|
3158 | 0 | Node *SoFar = nullptr; |
3159 | 0 | auto PushComponent = [&](Node *Comp) { |
3160 | 0 | if (!Comp) return false; |
3161 | 0 | if (SoFar) SoFar = make<NestedName>(SoFar, Comp); |
3162 | 0 | else SoFar = Comp; |
3163 | 0 | if (State) State->EndsWithTemplateArgs = false; |
3164 | 0 | return SoFar != nullptr; |
3165 | 0 | }; |
3166 | |
|
3167 | 0 | if (consumeIf("St")) { |
3168 | 0 | SoFar = make<NameType>("std"); |
3169 | 0 | if (!SoFar) |
3170 | 0 | return nullptr; |
3171 | 0 | } |
3172 | | |
3173 | 0 | while (!consumeIf('E')) { |
3174 | 0 | consumeIf('L'); // extension |
3175 | | |
3176 | | // <data-member-prefix> := <member source-name> [<template-args>] M |
3177 | 0 | if (consumeIf('M')) { |
3178 | 0 | if (SoFar == nullptr) |
3179 | 0 | return nullptr; |
3180 | 0 | continue; |
3181 | 0 | } |
3182 | | |
3183 | | // ::= <template-param> |
3184 | 0 | if (look() == 'T') { |
3185 | 0 | if (!PushComponent(getDerived().parseTemplateParam())) |
3186 | 0 | return nullptr; |
3187 | 0 | Subs.push_back(SoFar); |
3188 | 0 | continue; |
3189 | 0 | } |
3190 | | |
3191 | | // ::= <template-prefix> <template-args> |
3192 | 0 | if (look() == 'I') { |
3193 | 0 | Node *TA = getDerived().parseTemplateArgs(State != nullptr); |
3194 | 0 | if (TA == nullptr || SoFar == nullptr) |
3195 | 0 | return nullptr; |
3196 | 0 | SoFar = make<NameWithTemplateArgs>(SoFar, TA); |
3197 | 0 | if (!SoFar) |
3198 | 0 | return nullptr; |
3199 | 0 | if (State) State->EndsWithTemplateArgs = true; |
3200 | 0 | Subs.push_back(SoFar); |
3201 | 0 | continue; |
3202 | 0 | } |
3203 | | |
3204 | | // ::= <decltype> |
3205 | 0 | if (look() == 'D' && (look(1) == 't' || look(1) == 'T')) { |
3206 | 0 | if (!PushComponent(getDerived().parseDecltype())) |
3207 | 0 | return nullptr; |
3208 | 0 | Subs.push_back(SoFar); |
3209 | 0 | continue; |
3210 | 0 | } |
3211 | | |
3212 | | // ::= <substitution> |
3213 | 0 | if (look() == 'S' && look(1) != 't') { |
3214 | 0 | Node *S = getDerived().parseSubstitution(); |
3215 | 0 | if (!PushComponent(S)) |
3216 | 0 | return nullptr; |
3217 | 0 | if (SoFar != S) |
3218 | 0 | Subs.push_back(S); |
3219 | 0 | continue; |
3220 | 0 | } |
3221 | | |
3222 | | // Parse an <unqualified-name> thats actually a <ctor-dtor-name>. |
3223 | 0 | if (look() == 'C' || (look() == 'D' && look(1) != 'C')) { |
3224 | 0 | if (SoFar == nullptr) |
3225 | 0 | return nullptr; |
3226 | 0 | if (!PushComponent(getDerived().parseCtorDtorName(SoFar, State))) |
3227 | 0 | return nullptr; |
3228 | 0 | SoFar = getDerived().parseAbiTags(SoFar); |
3229 | 0 | if (SoFar == nullptr) |
3230 | 0 | return nullptr; |
3231 | 0 | Subs.push_back(SoFar); |
3232 | 0 | continue; |
3233 | 0 | } |
3234 | | |
3235 | | // ::= <prefix> <unqualified-name> |
3236 | 0 | if (!PushComponent(getDerived().parseUnqualifiedName(State))) |
3237 | 0 | return nullptr; |
3238 | 0 | Subs.push_back(SoFar); |
3239 | 0 | } |
3240 | | |
3241 | 0 | if (SoFar == nullptr || Subs.empty()) |
3242 | 0 | return nullptr; |
3243 | | |
3244 | 0 | Subs.pop_back(); |
3245 | 0 | return SoFar; |
3246 | 0 | } |
3247 | | |
3248 | | // <simple-id> ::= <source-name> [ <template-args> ] |
3249 | | template <typename Derived, typename Alloc> |
3250 | 0 | Node *AbstractManglingParser<Derived, Alloc>::parseSimpleId() { |
3251 | 0 | Node *SN = getDerived().parseSourceName(/*NameState=*/nullptr); |
3252 | 0 | if (SN == nullptr) |
3253 | 0 | return nullptr; |
3254 | 0 | if (look() == 'I') { |
3255 | 0 | Node *TA = getDerived().parseTemplateArgs(); |
3256 | 0 | if (TA == nullptr) |
3257 | 0 | return nullptr; |
3258 | 0 | return make<NameWithTemplateArgs>(SN, TA); |
3259 | 0 | } |
3260 | 0 | return SN; |
3261 | 0 | } |
3262 | | |
3263 | | // <destructor-name> ::= <unresolved-type> # e.g., ~T or ~decltype(f()) |
3264 | | // ::= <simple-id> # e.g., ~A<2*N> |
3265 | | template <typename Derived, typename Alloc> |
3266 | 0 | Node *AbstractManglingParser<Derived, Alloc>::parseDestructorName() { |
3267 | 0 | Node *Result; |
3268 | 0 | if (std::isdigit(look())) |
3269 | 0 | Result = getDerived().parseSimpleId(); |
3270 | 0 | else |
3271 | 0 | Result = getDerived().parseUnresolvedType(); |
3272 | 0 | if (Result == nullptr) |
3273 | 0 | return nullptr; |
3274 | 0 | return make<DtorName>(Result); |
3275 | 0 | } |
3276 | | |
3277 | | // <unresolved-type> ::= <template-param> |
3278 | | // ::= <decltype> |
3279 | | // ::= <substitution> |
3280 | | template <typename Derived, typename Alloc> |
3281 | 0 | Node *AbstractManglingParser<Derived, Alloc>::parseUnresolvedType() { |
3282 | 0 | if (look() == 'T') { |
3283 | 0 | Node *TP = getDerived().parseTemplateParam(); |
3284 | 0 | if (TP == nullptr) |
3285 | 0 | return nullptr; |
3286 | 0 | Subs.push_back(TP); |
3287 | 0 | return TP; |
3288 | 0 | } |
3289 | 0 | if (look() == 'D') { |
3290 | 0 | Node *DT = getDerived().parseDecltype(); |
3291 | 0 | if (DT == nullptr) |
3292 | 0 | return nullptr; |
3293 | 0 | Subs.push_back(DT); |
3294 | 0 | return DT; |
3295 | 0 | } |
3296 | 0 | return getDerived().parseSubstitution(); |
3297 | 0 | } |
3298 | | |
3299 | | // <base-unresolved-name> ::= <simple-id> # unresolved name |
3300 | | // extension ::= <operator-name> # unresolved operator-function-id |
3301 | | // extension ::= <operator-name> <template-args> # unresolved operator template-id |
3302 | | // ::= on <operator-name> # unresolved operator-function-id |
3303 | | // ::= on <operator-name> <template-args> # unresolved operator template-id |
3304 | | // ::= dn <destructor-name> # destructor or pseudo-destructor; |
3305 | | // # e.g. ~X or ~X<N-1> |
3306 | | template <typename Derived, typename Alloc> |
3307 | 0 | Node *AbstractManglingParser<Derived, Alloc>::parseBaseUnresolvedName() { |
3308 | 0 | if (std::isdigit(look())) |
3309 | 0 | return getDerived().parseSimpleId(); |
3310 | | |
3311 | 0 | if (consumeIf("dn")) |
3312 | 0 | return getDerived().parseDestructorName(); |
3313 | | |
3314 | 0 | consumeIf("on"); |
3315 | |
|
3316 | 0 | Node *Oper = getDerived().parseOperatorName(/*NameState=*/nullptr); |
3317 | 0 | if (Oper == nullptr) |
3318 | 0 | return nullptr; |
3319 | 0 | if (look() == 'I') { |
3320 | 0 | Node *TA = getDerived().parseTemplateArgs(); |
3321 | 0 | if (TA == nullptr) |
3322 | 0 | return nullptr; |
3323 | 0 | return make<NameWithTemplateArgs>(Oper, TA); |
3324 | 0 | } |
3325 | 0 | return Oper; |
3326 | 0 | } |
3327 | | |
3328 | | // <unresolved-name> |
3329 | | // extension ::= srN <unresolved-type> [<template-args>] <unresolved-qualifier-level>* E <base-unresolved-name> |
3330 | | // ::= [gs] <base-unresolved-name> # x or (with "gs") ::x |
3331 | | // ::= [gs] sr <unresolved-qualifier-level>+ E <base-unresolved-name> |
3332 | | // # A::x, N::y, A<T>::z; "gs" means leading "::" |
3333 | | // ::= sr <unresolved-type> <base-unresolved-name> # T::x / decltype(p)::x |
3334 | | // extension ::= sr <unresolved-type> <template-args> <base-unresolved-name> |
3335 | | // # T::N::x /decltype(p)::N::x |
3336 | | // (ignored) ::= srN <unresolved-type> <unresolved-qualifier-level>+ E <base-unresolved-name> |
3337 | | // |
3338 | | // <unresolved-qualifier-level> ::= <simple-id> |
3339 | | template <typename Derived, typename Alloc> |
3340 | 0 | Node *AbstractManglingParser<Derived, Alloc>::parseUnresolvedName() { |
3341 | 0 | Node *SoFar = nullptr; |
3342 | | |
3343 | | // srN <unresolved-type> [<template-args>] <unresolved-qualifier-level>* E <base-unresolved-name> |
3344 | | // srN <unresolved-type> <unresolved-qualifier-level>+ E <base-unresolved-name> |
3345 | 0 | if (consumeIf("srN")) { |
3346 | 0 | SoFar = getDerived().parseUnresolvedType(); |
3347 | 0 | if (SoFar == nullptr) |
3348 | 0 | return nullptr; |
3349 | | |
3350 | 0 | if (look() == 'I') { |
3351 | 0 | Node *TA = getDerived().parseTemplateArgs(); |
3352 | 0 | if (TA == nullptr) |
3353 | 0 | return nullptr; |
3354 | 0 | SoFar = make<NameWithTemplateArgs>(SoFar, TA); |
3355 | 0 | if (!SoFar) |
3356 | 0 | return nullptr; |
3357 | 0 | } |
3358 | | |
3359 | 0 | while (!consumeIf('E')) { |
3360 | 0 | Node *Qual = getDerived().parseSimpleId(); |
3361 | 0 | if (Qual == nullptr) |
3362 | 0 | return nullptr; |
3363 | 0 | SoFar = make<QualifiedName>(SoFar, Qual); |
3364 | 0 | if (!SoFar) |
3365 | 0 | return nullptr; |
3366 | 0 | } |
3367 | | |
3368 | 0 | Node *Base = getDerived().parseBaseUnresolvedName(); |
3369 | 0 | if (Base == nullptr) |
3370 | 0 | return nullptr; |
3371 | 0 | return make<QualifiedName>(SoFar, Base); |
3372 | 0 | } |
3373 | | |
3374 | 0 | bool Global = consumeIf("gs"); |
3375 | | |
3376 | | // [gs] <base-unresolved-name> # x or (with "gs") ::x |
3377 | 0 | if (!consumeIf("sr")) { |
3378 | 0 | SoFar = getDerived().parseBaseUnresolvedName(); |
3379 | 0 | if (SoFar == nullptr) |
3380 | 0 | return nullptr; |
3381 | 0 | if (Global) |
3382 | 0 | SoFar = make<GlobalQualifiedName>(SoFar); |
3383 | 0 | return SoFar; |
3384 | 0 | } |
3385 | | |
3386 | | // [gs] sr <unresolved-qualifier-level>+ E <base-unresolved-name> |
3387 | 0 | if (std::isdigit(look())) { |
3388 | 0 | do { |
3389 | 0 | Node *Qual = getDerived().parseSimpleId(); |
3390 | 0 | if (Qual == nullptr) |
3391 | 0 | return nullptr; |
3392 | 0 | if (SoFar) |
3393 | 0 | SoFar = make<QualifiedName>(SoFar, Qual); |
3394 | 0 | else if (Global) |
3395 | 0 | SoFar = make<GlobalQualifiedName>(Qual); |
3396 | 0 | else |
3397 | 0 | SoFar = Qual; |
3398 | 0 | if (!SoFar) |
3399 | 0 | return nullptr; |
3400 | 0 | } while (!consumeIf('E')); |
3401 | 0 | } |
3402 | | // sr <unresolved-type> <base-unresolved-name> |
3403 | | // sr <unresolved-type> <template-args> <base-unresolved-name> |
3404 | 0 | else { |
3405 | 0 | SoFar = getDerived().parseUnresolvedType(); |
3406 | 0 | if (SoFar == nullptr) |
3407 | 0 | return nullptr; |
3408 | | |
3409 | 0 | if (look() == 'I') { |
3410 | 0 | Node *TA = getDerived().parseTemplateArgs(); |
3411 | 0 | if (TA == nullptr) |
3412 | 0 | return nullptr; |
3413 | 0 | SoFar = make<NameWithTemplateArgs>(SoFar, TA); |
3414 | 0 | if (!SoFar) |
3415 | 0 | return nullptr; |
3416 | 0 | } |
3417 | 0 | } |
3418 | | |
3419 | 0 | assert(SoFar != nullptr); |
3420 | | |
3421 | 0 | Node *Base = getDerived().parseBaseUnresolvedName(); |
3422 | 0 | if (Base == nullptr) |
3423 | 0 | return nullptr; |
3424 | 0 | return make<QualifiedName>(SoFar, Base); |
3425 | 0 | } |
3426 | | |
3427 | | // <abi-tags> ::= <abi-tag> [<abi-tags>] |
3428 | | // <abi-tag> ::= B <source-name> |
3429 | | template <typename Derived, typename Alloc> |
3430 | 0 | Node *AbstractManglingParser<Derived, Alloc>::parseAbiTags(Node *N) { |
3431 | 0 | while (consumeIf('B')) { |
3432 | 0 | StringView SN = parseBareSourceName(); |
3433 | 0 | if (SN.empty()) |
3434 | 0 | return nullptr; |
3435 | 0 | N = make<AbiTagAttr>(N, SN); |
3436 | 0 | if (!N) |
3437 | 0 | return nullptr; |
3438 | 0 | } |
3439 | 0 | return N; |
3440 | 0 | } |
3441 | | |
3442 | | // <number> ::= [n] <non-negative decimal integer> |
3443 | | template <typename Alloc, typename Derived> |
3444 | | StringView |
3445 | 0 | AbstractManglingParser<Alloc, Derived>::parseNumber(bool AllowNegative) { |
3446 | 0 | const char *Tmp = First; |
3447 | 0 | if (AllowNegative) |
3448 | 0 | consumeIf('n'); |
3449 | 0 | if (numLeft() == 0 || !std::isdigit(*First)) |
3450 | 0 | return StringView(); |
3451 | 0 | while (numLeft() != 0 && std::isdigit(*First)) |
3452 | 0 | ++First; |
3453 | 0 | return StringView(Tmp, First); |
3454 | 0 | } |
3455 | | |
3456 | | // <positive length number> ::= [0-9]* |
3457 | | template <typename Alloc, typename Derived> |
3458 | 0 | bool AbstractManglingParser<Alloc, Derived>::parsePositiveInteger(size_t *Out) { |
3459 | 0 | *Out = 0; |
3460 | 0 | if (look() < '0' || look() > '9') |
3461 | 0 | return true; |
3462 | 0 | while (look() >= '0' && look() <= '9') { |
3463 | 0 | *Out *= 10; |
3464 | 0 | *Out += static_cast<size_t>(consume() - '0'); |
3465 | 0 | } |
3466 | 0 | return false; |
3467 | 0 | } |
3468 | | |
3469 | | template <typename Alloc, typename Derived> |
3470 | 0 | StringView AbstractManglingParser<Alloc, Derived>::parseBareSourceName() { |
3471 | 0 | size_t Int = 0; |
3472 | 0 | if (parsePositiveInteger(&Int) || numLeft() < Int) |
3473 | 0 | return StringView(); |
3474 | 0 | StringView R(First, First + Int); |
3475 | 0 | First += Int; |
3476 | 0 | return R; |
3477 | 0 | } |
3478 | | |
3479 | | // <function-type> ::= [<CV-qualifiers>] [<exception-spec>] [Dx] F [Y] <bare-function-type> [<ref-qualifier>] E |
3480 | | // |
3481 | | // <exception-spec> ::= Do # non-throwing exception-specification (e.g., noexcept, throw()) |
3482 | | // ::= DO <expression> E # computed (instantiation-dependent) noexcept |
3483 | | // ::= Dw <type>+ E # dynamic exception specification with instantiation-dependent types |
3484 | | // |
3485 | | // <ref-qualifier> ::= R # & ref-qualifier |
3486 | | // <ref-qualifier> ::= O # && ref-qualifier |
3487 | | template <typename Derived, typename Alloc> |
3488 | 0 | Node *AbstractManglingParser<Derived, Alloc>::parseFunctionType() { |
3489 | 0 | Qualifiers CVQuals = parseCVQualifiers(); |
3490 | |
|
3491 | 0 | Node *ExceptionSpec = nullptr; |
3492 | 0 | if (consumeIf("Do")) { |
3493 | 0 | ExceptionSpec = make<NameType>("noexcept"); |
3494 | 0 | if (!ExceptionSpec) |
3495 | 0 | return nullptr; |
3496 | 0 | } else if (consumeIf("DO")) { |
3497 | 0 | Node *E = getDerived().parseExpr(); |
3498 | 0 | if (E == nullptr || !consumeIf('E')) |
3499 | 0 | return nullptr; |
3500 | 0 | ExceptionSpec = make<NoexceptSpec>(E); |
3501 | 0 | if (!ExceptionSpec) |
3502 | 0 | return nullptr; |
3503 | 0 | } else if (consumeIf("Dw")) { |
3504 | 0 | size_t SpecsBegin = Names.size(); |
3505 | 0 | while (!consumeIf('E')) { |
3506 | 0 | Node *T = getDerived().parseType(); |
3507 | 0 | if (T == nullptr) |
3508 | 0 | return nullptr; |
3509 | 0 | Names.push_back(T); |
3510 | 0 | } |
3511 | 0 | ExceptionSpec = |
3512 | 0 | make<DynamicExceptionSpec>(popTrailingNodeArray(SpecsBegin)); |
3513 | 0 | if (!ExceptionSpec) |
3514 | 0 | return nullptr; |
3515 | 0 | } |
3516 | | |
3517 | 0 | consumeIf("Dx"); // transaction safe |
3518 | |
|
3519 | 0 | if (!consumeIf('F')) |
3520 | 0 | return nullptr; |
3521 | 0 | consumeIf('Y'); // extern "C" |
3522 | 0 | Node *ReturnType = getDerived().parseType(); |
3523 | 0 | if (ReturnType == nullptr) |
3524 | 0 | return nullptr; |
3525 | | |
3526 | 0 | FunctionRefQual ReferenceQualifier = FrefQualNone; |
3527 | 0 | size_t ParamsBegin = Names.size(); |
3528 | 0 | while (true) { |
3529 | 0 | if (consumeIf('E')) |
3530 | 0 | break; |
3531 | 0 | if (consumeIf('v')) |
3532 | 0 | continue; |
3533 | 0 | if (consumeIf("RE")) { |
3534 | 0 | ReferenceQualifier = FrefQualLValue; |
3535 | 0 | break; |
3536 | 0 | } |
3537 | 0 | if (consumeIf("OE")) { |
3538 | 0 | ReferenceQualifier = FrefQualRValue; |
3539 | 0 | break; |
3540 | 0 | } |
3541 | 0 | Node *T = getDerived().parseType(); |
3542 | 0 | if (T == nullptr) |
3543 | 0 | return nullptr; |
3544 | 0 | Names.push_back(T); |
3545 | 0 | } |
3546 | | |
3547 | 0 | NodeArray Params = popTrailingNodeArray(ParamsBegin); |
3548 | 0 | return make<FunctionType>(ReturnType, Params, CVQuals, |
3549 | 0 | ReferenceQualifier, ExceptionSpec); |
3550 | 0 | } |
3551 | | |
3552 | | // extension: |
3553 | | // <vector-type> ::= Dv <positive dimension number> _ <extended element type> |
3554 | | // ::= Dv [<dimension expression>] _ <element type> |
3555 | | // <extended element type> ::= <element type> |
3556 | | // ::= p # AltiVec vector pixel |
3557 | | template <typename Derived, typename Alloc> |
3558 | 0 | Node *AbstractManglingParser<Derived, Alloc>::parseVectorType() { |
3559 | 0 | if (!consumeIf("Dv")) |
3560 | 0 | return nullptr; |
3561 | 0 | if (look() >= '1' && look() <= '9') { |
3562 | 0 | Node *DimensionNumber = make<NameType>(parseNumber()); |
3563 | 0 | if (!DimensionNumber) |
3564 | 0 | return nullptr; |
3565 | 0 | if (!consumeIf('_')) |
3566 | 0 | return nullptr; |
3567 | 0 | if (consumeIf('p')) |
3568 | 0 | return make<PixelVectorType>(DimensionNumber); |
3569 | 0 | Node *ElemType = getDerived().parseType(); |
3570 | 0 | if (ElemType == nullptr) |
3571 | 0 | return nullptr; |
3572 | 0 | return make<VectorType>(ElemType, DimensionNumber); |
3573 | 0 | } |
3574 | | |
3575 | 0 | if (!consumeIf('_')) { |
3576 | 0 | Node *DimExpr = getDerived().parseExpr(); |
3577 | 0 | if (!DimExpr) |
3578 | 0 | return nullptr; |
3579 | 0 | if (!consumeIf('_')) |
3580 | 0 | return nullptr; |
3581 | 0 | Node *ElemType = getDerived().parseType(); |
3582 | 0 | if (!ElemType) |
3583 | 0 | return nullptr; |
3584 | 0 | return make<VectorType>(ElemType, DimExpr); |
3585 | 0 | } |
3586 | 0 | Node *ElemType = getDerived().parseType(); |
3587 | 0 | if (!ElemType) |
3588 | 0 | return nullptr; |
3589 | 0 | return make<VectorType>(ElemType, /*Dimension=*/nullptr); |
3590 | 0 | } |
3591 | | |
3592 | | // <decltype> ::= Dt <expression> E # decltype of an id-expression or class member access (C++0x) |
3593 | | // ::= DT <expression> E # decltype of an expression (C++0x) |
3594 | | template <typename Derived, typename Alloc> |
3595 | 0 | Node *AbstractManglingParser<Derived, Alloc>::parseDecltype() { |
3596 | 0 | if (!consumeIf('D')) |
3597 | 0 | return nullptr; |
3598 | 0 | if (!consumeIf('t') && !consumeIf('T')) |
3599 | 0 | return nullptr; |
3600 | 0 | Node *E = getDerived().parseExpr(); |
3601 | 0 | if (E == nullptr) |
3602 | 0 | return nullptr; |
3603 | 0 | if (!consumeIf('E')) |
3604 | 0 | return nullptr; |
3605 | 0 | return make<EnclosingExpr>("decltype(", E, ")"); |
3606 | 0 | } |
3607 | | |
3608 | | // <array-type> ::= A <positive dimension number> _ <element type> |
3609 | | // ::= A [<dimension expression>] _ <element type> |
3610 | | template <typename Derived, typename Alloc> |
3611 | 0 | Node *AbstractManglingParser<Derived, Alloc>::parseArrayType() { |
3612 | 0 | if (!consumeIf('A')) |
3613 | 0 | return nullptr; |
3614 | | |
3615 | 0 | Node *Dimension = nullptr; |
3616 | |
|
3617 | 0 | if (std::isdigit(look())) { |
3618 | 0 | Dimension = make<NameType>(parseNumber()); |
3619 | 0 | if (!Dimension) |
3620 | 0 | return nullptr; |
3621 | 0 | if (!consumeIf('_')) |
3622 | 0 | return nullptr; |
3623 | 0 | } else if (!consumeIf('_')) { |
3624 | 0 | Node *DimExpr = getDerived().parseExpr(); |
3625 | 0 | if (DimExpr == nullptr) |
3626 | 0 | return nullptr; |
3627 | 0 | if (!consumeIf('_')) |
3628 | 0 | return nullptr; |
3629 | 0 | Dimension = DimExpr; |
3630 | 0 | } |
3631 | | |
3632 | 0 | Node *Ty = getDerived().parseType(); |
3633 | 0 | if (Ty == nullptr) |
3634 | 0 | return nullptr; |
3635 | 0 | return make<ArrayType>(Ty, Dimension); |
3636 | 0 | } |
3637 | | |
3638 | | // <pointer-to-member-type> ::= M <class type> <member type> |
3639 | | template <typename Derived, typename Alloc> |
3640 | 0 | Node *AbstractManglingParser<Derived, Alloc>::parsePointerToMemberType() { |
3641 | 0 | if (!consumeIf('M')) |
3642 | 0 | return nullptr; |
3643 | 0 | Node *ClassType = getDerived().parseType(); |
3644 | 0 | if (ClassType == nullptr) |
3645 | 0 | return nullptr; |
3646 | 0 | Node *MemberType = getDerived().parseType(); |
3647 | 0 | if (MemberType == nullptr) |
3648 | 0 | return nullptr; |
3649 | 0 | return make<PointerToMemberType>(ClassType, MemberType); |
3650 | 0 | } |
3651 | | |
3652 | | // <class-enum-type> ::= <name> # non-dependent type name, dependent type name, or dependent typename-specifier |
3653 | | // ::= Ts <name> # dependent elaborated type specifier using 'struct' or 'class' |
3654 | | // ::= Tu <name> # dependent elaborated type specifier using 'union' |
3655 | | // ::= Te <name> # dependent elaborated type specifier using 'enum' |
3656 | | template <typename Derived, typename Alloc> |
3657 | 0 | Node *AbstractManglingParser<Derived, Alloc>::parseClassEnumType() { |
3658 | 0 | StringView ElabSpef; |
3659 | 0 | if (consumeIf("Ts")) |
3660 | 0 | ElabSpef = "struct"; |
3661 | 0 | else if (consumeIf("Tu")) |
3662 | 0 | ElabSpef = "union"; |
3663 | 0 | else if (consumeIf("Te")) |
3664 | 0 | ElabSpef = "enum"; |
3665 | |
|
3666 | 0 | Node *Name = getDerived().parseName(); |
3667 | 0 | if (Name == nullptr) |
3668 | 0 | return nullptr; |
3669 | | |
3670 | 0 | if (!ElabSpef.empty()) |
3671 | 0 | return make<ElaboratedTypeSpefType>(ElabSpef, Name); |
3672 | | |
3673 | 0 | return Name; |
3674 | 0 | } |
3675 | | |
3676 | | // <qualified-type> ::= <qualifiers> <type> |
3677 | | // <qualifiers> ::= <extended-qualifier>* <CV-qualifiers> |
3678 | | // <extended-qualifier> ::= U <source-name> [<template-args>] # vendor extended type qualifier |
3679 | | template <typename Derived, typename Alloc> |
3680 | 0 | Node *AbstractManglingParser<Derived, Alloc>::parseQualifiedType() { |
3681 | 0 | if (consumeIf('U')) { |
3682 | 0 | StringView Qual = parseBareSourceName(); |
3683 | 0 | if (Qual.empty()) |
3684 | 0 | return nullptr; |
3685 | | |
3686 | | // extension ::= U <objc-name> <objc-type> # objc-type<identifier> |
3687 | 0 | if (Qual.startsWith("objcproto")) { |
3688 | 0 | StringView ProtoSourceName = Qual.dropFront(std::strlen("objcproto")); |
3689 | 0 | StringView Proto; |
3690 | 0 | { |
3691 | 0 | SwapAndRestore<const char *> SaveFirst(First, ProtoSourceName.begin()), |
3692 | 0 | SaveLast(Last, ProtoSourceName.end()); |
3693 | 0 | Proto = parseBareSourceName(); |
3694 | 0 | } |
3695 | 0 | if (Proto.empty()) |
3696 | 0 | return nullptr; |
3697 | 0 | Node *Child = getDerived().parseQualifiedType(); |
3698 | 0 | if (Child == nullptr) |
3699 | 0 | return nullptr; |
3700 | 0 | return make<ObjCProtoName>(Child, Proto); |
3701 | 0 | } |
3702 | | |
3703 | 0 | Node *TA = nullptr; |
3704 | 0 | if (look() == 'I') { |
3705 | 0 | TA = getDerived().parseTemplateArgs(); |
3706 | 0 | if (TA == nullptr) |
3707 | 0 | return nullptr; |
3708 | 0 | } |
3709 | | |
3710 | 0 | Node *Child = getDerived().parseQualifiedType(); |
3711 | 0 | if (Child == nullptr) |
3712 | 0 | return nullptr; |
3713 | 0 | return make<VendorExtQualType>(Child, Qual, TA); |
3714 | 0 | } |
3715 | | |
3716 | 0 | Qualifiers Quals = parseCVQualifiers(); |
3717 | 0 | Node *Ty = getDerived().parseType(); |
3718 | 0 | if (Ty == nullptr) |
3719 | 0 | return nullptr; |
3720 | 0 | if (Quals != QualNone) |
3721 | 0 | Ty = make<QualType>(Ty, Quals); |
3722 | 0 | return Ty; |
3723 | 0 | } |
3724 | | |
3725 | | // <type> ::= <builtin-type> |
3726 | | // ::= <qualified-type> |
3727 | | // ::= <function-type> |
3728 | | // ::= <class-enum-type> |
3729 | | // ::= <array-type> |
3730 | | // ::= <pointer-to-member-type> |
3731 | | // ::= <template-param> |
3732 | | // ::= <template-template-param> <template-args> |
3733 | | // ::= <decltype> |
3734 | | // ::= P <type> # pointer |
3735 | | // ::= R <type> # l-value reference |
3736 | | // ::= O <type> # r-value reference (C++11) |
3737 | | // ::= C <type> # complex pair (C99) |
3738 | | // ::= G <type> # imaginary (C99) |
3739 | | // ::= <substitution> # See Compression below |
3740 | | // extension ::= U <objc-name> <objc-type> # objc-type<identifier> |
3741 | | // extension ::= <vector-type> # <vector-type> starts with Dv |
3742 | | // |
3743 | | // <objc-name> ::= <k0 number> objcproto <k1 number> <identifier> # k0 = 9 + <number of digits in k1> + k1 |
3744 | | // <objc-type> ::= <source-name> # PU<11+>objcproto 11objc_object<source-name> 11objc_object -> id<source-name> |
3745 | | template <typename Derived, typename Alloc> |
3746 | 0 | Node *AbstractManglingParser<Derived, Alloc>::parseType() { |
3747 | 0 | Node *Result = nullptr; |
3748 | |
|
3749 | 0 | switch (look()) { |
3750 | | // ::= <qualified-type> |
3751 | 0 | case 'r': |
3752 | 0 | case 'V': |
3753 | 0 | case 'K': { |
3754 | 0 | unsigned AfterQuals = 0; |
3755 | 0 | if (look(AfterQuals) == 'r') ++AfterQuals; |
3756 | 0 | if (look(AfterQuals) == 'V') ++AfterQuals; |
3757 | 0 | if (look(AfterQuals) == 'K') ++AfterQuals; |
3758 | |
|
3759 | 0 | if (look(AfterQuals) == 'F' || |
3760 | 0 | (look(AfterQuals) == 'D' && |
3761 | 0 | (look(AfterQuals + 1) == 'o' || look(AfterQuals + 1) == 'O' || |
3762 | 0 | look(AfterQuals + 1) == 'w' || look(AfterQuals + 1) == 'x'))) { |
3763 | 0 | Result = getDerived().parseFunctionType(); |
3764 | 0 | break; |
3765 | 0 | } |
3766 | 0 | DEMANGLE_FALLTHROUGH; |
3767 | 0 | } |
3768 | 0 | case 'U': { |
3769 | 0 | Result = getDerived().parseQualifiedType(); |
3770 | 0 | break; |
3771 | 0 | } |
3772 | | // <builtin-type> ::= v # void |
3773 | 0 | case 'v': |
3774 | 0 | ++First; |
3775 | 0 | return make<NameType>("void"); |
3776 | | // ::= w # wchar_t |
3777 | 0 | case 'w': |
3778 | 0 | ++First; |
3779 | 0 | return make<NameType>("wchar_t"); |
3780 | | // ::= b # bool |
3781 | 0 | case 'b': |
3782 | 0 | ++First; |
3783 | 0 | return make<NameType>("bool"); |
3784 | | // ::= c # char |
3785 | 0 | case 'c': |
3786 | 0 | ++First; |
3787 | 0 | return make<NameType>("char"); |
3788 | | // ::= a # signed char |
3789 | 0 | case 'a': |
3790 | 0 | ++First; |
3791 | 0 | return make<NameType>("signed char"); |
3792 | | // ::= h # unsigned char |
3793 | 0 | case 'h': |
3794 | 0 | ++First; |
3795 | 0 | return make<NameType>("unsigned char"); |
3796 | | // ::= s # short |
3797 | 0 | case 's': |
3798 | 0 | ++First; |
3799 | 0 | return make<NameType>("short"); |
3800 | | // ::= t # unsigned short |
3801 | 0 | case 't': |
3802 | 0 | ++First; |
3803 | 0 | return make<NameType>("unsigned short"); |
3804 | | // ::= i # int |
3805 | 0 | case 'i': |
3806 | 0 | ++First; |
3807 | 0 | return make<NameType>("int"); |
3808 | | // ::= j # unsigned int |
3809 | 0 | case 'j': |
3810 | 0 | ++First; |
3811 | 0 | return make<NameType>("unsigned int"); |
3812 | | // ::= l # long |
3813 | 0 | case 'l': |
3814 | 0 | ++First; |
3815 | 0 | return make<NameType>("long"); |
3816 | | // ::= m # unsigned long |
3817 | 0 | case 'm': |
3818 | 0 | ++First; |
3819 | 0 | return make<NameType>("unsigned long"); |
3820 | | // ::= x # long long, __int64 |
3821 | 0 | case 'x': |
3822 | 0 | ++First; |
3823 | 0 | return make<NameType>("long long"); |
3824 | | // ::= y # unsigned long long, __int64 |
3825 | 0 | case 'y': |
3826 | 0 | ++First; |
3827 | 0 | return make<NameType>("unsigned long long"); |
3828 | | // ::= n # __int128 |
3829 | 0 | case 'n': |
3830 | 0 | ++First; |
3831 | 0 | return make<NameType>("__int128"); |
3832 | | // ::= o # unsigned __int128 |
3833 | 0 | case 'o': |
3834 | 0 | ++First; |
3835 | 0 | return make<NameType>("unsigned __int128"); |
3836 | | // ::= f # float |
3837 | 0 | case 'f': |
3838 | 0 | ++First; |
3839 | 0 | return make<NameType>("float"); |
3840 | | // ::= d # double |
3841 | 0 | case 'd': |
3842 | 0 | ++First; |
3843 | 0 | return make<NameType>("double"); |
3844 | | // ::= e # long double, __float80 |
3845 | 0 | case 'e': |
3846 | 0 | ++First; |
3847 | 0 | return make<NameType>("long double"); |
3848 | | // ::= g # __float128 |
3849 | 0 | case 'g': |
3850 | 0 | ++First; |
3851 | 0 | return make<NameType>("__float128"); |
3852 | | // ::= z # ellipsis |
3853 | 0 | case 'z': |
3854 | 0 | ++First; |
3855 | 0 | return make<NameType>("..."); |
3856 | | |
3857 | | // <builtin-type> ::= u <source-name> # vendor extended type |
3858 | 0 | case 'u': { |
3859 | 0 | ++First; |
3860 | 0 | StringView Res = parseBareSourceName(); |
3861 | 0 | if (Res.empty()) |
3862 | 0 | return nullptr; |
3863 | | // Typically, <builtin-type>s are not considered substitution candidates, |
3864 | | // but the exception to that exception is vendor extended types (Itanium C++ |
3865 | | // ABI 5.9.1). |
3866 | 0 | Result = make<NameType>(Res); |
3867 | 0 | break; |
3868 | 0 | } |
3869 | 0 | case 'D': |
3870 | 0 | switch (look(1)) { |
3871 | | // ::= Dd # IEEE 754r decimal floating point (64 bits) |
3872 | 0 | case 'd': |
3873 | 0 | First += 2; |
3874 | 0 | return make<NameType>("decimal64"); |
3875 | | // ::= De # IEEE 754r decimal floating point (128 bits) |
3876 | 0 | case 'e': |
3877 | 0 | First += 2; |
3878 | 0 | return make<NameType>("decimal128"); |
3879 | | // ::= Df # IEEE 754r decimal floating point (32 bits) |
3880 | 0 | case 'f': |
3881 | 0 | First += 2; |
3882 | 0 | return make<NameType>("decimal32"); |
3883 | | // ::= Dh # IEEE 754r half-precision floating point (16 bits) |
3884 | 0 | case 'h': |
3885 | 0 | First += 2; |
3886 | 0 | return make<NameType>("half"); |
3887 | | // ::= Di # char32_t |
3888 | 0 | case 'i': |
3889 | 0 | First += 2; |
3890 | 0 | return make<NameType>("char32_t"); |
3891 | | // ::= Ds # char16_t |
3892 | 0 | case 's': |
3893 | 0 | First += 2; |
3894 | 0 | return make<NameType>("char16_t"); |
3895 | | // ::= Du # char8_t (C++2a, not yet in the Itanium spec) |
3896 | 0 | case 'u': |
3897 | 0 | First += 2; |
3898 | 0 | return make<NameType>("char8_t"); |
3899 | | // ::= Da # auto (in dependent new-expressions) |
3900 | 0 | case 'a': |
3901 | 0 | First += 2; |
3902 | 0 | return make<NameType>("auto"); |
3903 | | // ::= Dc # decltype(auto) |
3904 | 0 | case 'c': |
3905 | 0 | First += 2; |
3906 | 0 | return make<NameType>("decltype(auto)"); |
3907 | | // ::= Dn # std::nullptr_t (i.e., decltype(nullptr)) |
3908 | 0 | case 'n': |
3909 | 0 | First += 2; |
3910 | 0 | return make<NameType>("std::nullptr_t"); |
3911 | | |
3912 | | // ::= <decltype> |
3913 | 0 | case 't': |
3914 | 0 | case 'T': { |
3915 | 0 | Result = getDerived().parseDecltype(); |
3916 | 0 | break; |
3917 | 0 | } |
3918 | | // extension ::= <vector-type> # <vector-type> starts with Dv |
3919 | 0 | case 'v': { |
3920 | 0 | Result = getDerived().parseVectorType(); |
3921 | 0 | break; |
3922 | 0 | } |
3923 | | // ::= Dp <type> # pack expansion (C++0x) |
3924 | 0 | case 'p': { |
3925 | 0 | First += 2; |
3926 | 0 | Node *Child = getDerived().parseType(); |
3927 | 0 | if (!Child) |
3928 | 0 | return nullptr; |
3929 | 0 | Result = make<ParameterPackExpansion>(Child); |
3930 | 0 | break; |
3931 | 0 | } |
3932 | | // Exception specifier on a function type. |
3933 | 0 | case 'o': |
3934 | 0 | case 'O': |
3935 | 0 | case 'w': |
3936 | | // Transaction safe function type. |
3937 | 0 | case 'x': |
3938 | 0 | Result = getDerived().parseFunctionType(); |
3939 | 0 | break; |
3940 | 0 | } |
3941 | 0 | break; |
3942 | | // ::= <function-type> |
3943 | 0 | case 'F': { |
3944 | 0 | Result = getDerived().parseFunctionType(); |
3945 | 0 | break; |
3946 | 0 | } |
3947 | | // ::= <array-type> |
3948 | 0 | case 'A': { |
3949 | 0 | Result = getDerived().parseArrayType(); |
3950 | 0 | break; |
3951 | 0 | } |
3952 | | // ::= <pointer-to-member-type> |
3953 | 0 | case 'M': { |
3954 | 0 | Result = getDerived().parsePointerToMemberType(); |
3955 | 0 | break; |
3956 | 0 | } |
3957 | | // ::= <template-param> |
3958 | 0 | case 'T': { |
3959 | | // This could be an elaborate type specifier on a <class-enum-type>. |
3960 | 0 | if (look(1) == 's' || look(1) == 'u' || look(1) == 'e') { |
3961 | 0 | Result = getDerived().parseClassEnumType(); |
3962 | 0 | break; |
3963 | 0 | } |
3964 | | |
3965 | 0 | Result = getDerived().parseTemplateParam(); |
3966 | 0 | if (Result == nullptr) |
3967 | 0 | return nullptr; |
3968 | | |
3969 | | // Result could be either of: |
3970 | | // <type> ::= <template-param> |
3971 | | // <type> ::= <template-template-param> <template-args> |
3972 | | // |
3973 | | // <template-template-param> ::= <template-param> |
3974 | | // ::= <substitution> |
3975 | | // |
3976 | | // If this is followed by some <template-args>, and we're permitted to |
3977 | | // parse them, take the second production. |
3978 | | |
3979 | 0 | if (TryToParseTemplateArgs && look() == 'I') { |
3980 | 0 | Node *TA = getDerived().parseTemplateArgs(); |
3981 | 0 | if (TA == nullptr) |
3982 | 0 | return nullptr; |
3983 | 0 | Result = make<NameWithTemplateArgs>(Result, TA); |
3984 | 0 | } |
3985 | 0 | break; |
3986 | 0 | } |
3987 | | // ::= P <type> # pointer |
3988 | 0 | case 'P': { |
3989 | 0 | ++First; |
3990 | 0 | Node *Ptr = getDerived().parseType(); |
3991 | 0 | if (Ptr == nullptr) |
3992 | 0 | return nullptr; |
3993 | 0 | Result = make<PointerType>(Ptr); |
3994 | 0 | break; |
3995 | 0 | } |
3996 | | // ::= R <type> # l-value reference |
3997 | 0 | case 'R': { |
3998 | 0 | ++First; |
3999 | 0 | Node *Ref = getDerived().parseType(); |
4000 | 0 | if (Ref == nullptr) |
4001 | 0 | return nullptr; |
4002 | 0 | Result = make<ReferenceType>(Ref, ReferenceKind::LValue); |
4003 | 0 | break; |
4004 | 0 | } |
4005 | | // ::= O <type> # r-value reference (C++11) |
4006 | 0 | case 'O': { |
4007 | 0 | ++First; |
4008 | 0 | Node *Ref = getDerived().parseType(); |
4009 | 0 | if (Ref == nullptr) |
4010 | 0 | return nullptr; |
4011 | 0 | Result = make<ReferenceType>(Ref, ReferenceKind::RValue); |
4012 | 0 | break; |
4013 | 0 | } |
4014 | | // ::= C <type> # complex pair (C99) |
4015 | 0 | case 'C': { |
4016 | 0 | ++First; |
4017 | 0 | Node *P = getDerived().parseType(); |
4018 | 0 | if (P == nullptr) |
4019 | 0 | return nullptr; |
4020 | 0 | Result = make<PostfixQualifiedType>(P, " complex"); |
4021 | 0 | break; |
4022 | 0 | } |
4023 | | // ::= G <type> # imaginary (C99) |
4024 | 0 | case 'G': { |
4025 | 0 | ++First; |
4026 | 0 | Node *P = getDerived().parseType(); |
4027 | 0 | if (P == nullptr) |
4028 | 0 | return P; |
4029 | 0 | Result = make<PostfixQualifiedType>(P, " imaginary"); |
4030 | 0 | break; |
4031 | 0 | } |
4032 | | // ::= <substitution> # See Compression below |
4033 | 0 | case 'S': { |
4034 | 0 | if (look(1) && look(1) != 't') { |
4035 | 0 | Node *Sub = getDerived().parseSubstitution(); |
4036 | 0 | if (Sub == nullptr) |
4037 | 0 | return nullptr; |
4038 | | |
4039 | | // Sub could be either of: |
4040 | | // <type> ::= <substitution> |
4041 | | // <type> ::= <template-template-param> <template-args> |
4042 | | // |
4043 | | // <template-template-param> ::= <template-param> |
4044 | | // ::= <substitution> |
4045 | | // |
4046 | | // If this is followed by some <template-args>, and we're permitted to |
4047 | | // parse them, take the second production. |
4048 | | |
4049 | 0 | if (TryToParseTemplateArgs && look() == 'I') { |
4050 | 0 | Node *TA = getDerived().parseTemplateArgs(); |
4051 | 0 | if (TA == nullptr) |
4052 | 0 | return nullptr; |
4053 | 0 | Result = make<NameWithTemplateArgs>(Sub, TA); |
4054 | 0 | break; |
4055 | 0 | } |
4056 | | |
4057 | | // If all we parsed was a substitution, don't re-insert into the |
4058 | | // substitution table. |
4059 | 0 | return Sub; |
4060 | 0 | } |
4061 | 0 | DEMANGLE_FALLTHROUGH; |
4062 | 0 | } |
4063 | | // ::= <class-enum-type> |
4064 | 0 | default: { |
4065 | 0 | Result = getDerived().parseClassEnumType(); |
4066 | 0 | break; |
4067 | 0 | } |
4068 | 0 | } |
4069 | | |
4070 | | // If we parsed a type, insert it into the substitution table. Note that all |
4071 | | // <builtin-type>s and <substitution>s have already bailed out, because they |
4072 | | // don't get substitutions. |
4073 | 0 | if (Result != nullptr) |
4074 | 0 | Subs.push_back(Result); |
4075 | 0 | return Result; |
4076 | 0 | } |
4077 | | |
4078 | | template <typename Derived, typename Alloc> |
4079 | 0 | Node *AbstractManglingParser<Derived, Alloc>::parsePrefixExpr(StringView Kind) { |
4080 | 0 | Node *E = getDerived().parseExpr(); |
4081 | 0 | if (E == nullptr) |
4082 | 0 | return nullptr; |
4083 | 0 | return make<PrefixExpr>(Kind, E); |
4084 | 0 | } |
4085 | | |
4086 | | template <typename Derived, typename Alloc> |
4087 | 0 | Node *AbstractManglingParser<Derived, Alloc>::parseBinaryExpr(StringView Kind) { |
4088 | 0 | Node *LHS = getDerived().parseExpr(); |
4089 | 0 | if (LHS == nullptr) |
4090 | 0 | return nullptr; |
4091 | 0 | Node *RHS = getDerived().parseExpr(); |
4092 | 0 | if (RHS == nullptr) |
4093 | 0 | return nullptr; |
4094 | 0 | return make<BinaryExpr>(LHS, Kind, RHS); |
4095 | 0 | } |
4096 | | |
4097 | | template <typename Derived, typename Alloc> |
4098 | | Node * |
4099 | 0 | AbstractManglingParser<Derived, Alloc>::parseIntegerLiteral(StringView Lit) { |
4100 | 0 | StringView Tmp = parseNumber(true); |
4101 | 0 | if (!Tmp.empty() && consumeIf('E')) |
4102 | 0 | return make<IntegerLiteral>(Lit, Tmp); |
4103 | 0 | return nullptr; |
4104 | 0 | } |
4105 | | |
4106 | | // <CV-Qualifiers> ::= [r] [V] [K] |
4107 | | template <typename Alloc, typename Derived> |
4108 | 0 | Qualifiers AbstractManglingParser<Alloc, Derived>::parseCVQualifiers() { |
4109 | 0 | Qualifiers CVR = QualNone; |
4110 | 0 | if (consumeIf('r')) |
4111 | 0 | CVR |= QualRestrict; |
4112 | 0 | if (consumeIf('V')) |
4113 | 0 | CVR |= QualVolatile; |
4114 | 0 | if (consumeIf('K')) |
4115 | 0 | CVR |= QualConst; |
4116 | 0 | return CVR; |
4117 | 0 | } |
4118 | | |
4119 | | // <function-param> ::= fp <top-level CV-Qualifiers> _ # L == 0, first parameter |
4120 | | // ::= fp <top-level CV-Qualifiers> <parameter-2 non-negative number> _ # L == 0, second and later parameters |
4121 | | // ::= fL <L-1 non-negative number> p <top-level CV-Qualifiers> _ # L > 0, first parameter |
4122 | | // ::= fL <L-1 non-negative number> p <top-level CV-Qualifiers> <parameter-2 non-negative number> _ # L > 0, second and later parameters |
4123 | | // ::= fpT # 'this' expression (not part of standard?) |
4124 | | template <typename Derived, typename Alloc> |
4125 | 0 | Node *AbstractManglingParser<Derived, Alloc>::parseFunctionParam() { |
4126 | 0 | if (consumeIf("fpT")) |
4127 | 0 | return make<NameType>("this"); |
4128 | 0 | if (consumeIf("fp")) { |
4129 | 0 | parseCVQualifiers(); |
4130 | 0 | StringView Num = parseNumber(); |
4131 | 0 | if (!consumeIf('_')) |
4132 | 0 | return nullptr; |
4133 | 0 | return make<FunctionParam>(Num); |
4134 | 0 | } |
4135 | 0 | if (consumeIf("fL")) { |
4136 | 0 | if (parseNumber().empty()) |
4137 | 0 | return nullptr; |
4138 | 0 | if (!consumeIf('p')) |
4139 | 0 | return nullptr; |
4140 | 0 | parseCVQualifiers(); |
4141 | 0 | StringView Num = parseNumber(); |
4142 | 0 | if (!consumeIf('_')) |
4143 | 0 | return nullptr; |
4144 | 0 | return make<FunctionParam>(Num); |
4145 | 0 | } |
4146 | 0 | return nullptr; |
4147 | 0 | } |
4148 | | |
4149 | | // [gs] nw <expression>* _ <type> E # new (expr-list) type |
4150 | | // [gs] nw <expression>* _ <type> <initializer> # new (expr-list) type (init) |
4151 | | // [gs] na <expression>* _ <type> E # new[] (expr-list) type |
4152 | | // [gs] na <expression>* _ <type> <initializer> # new[] (expr-list) type (init) |
4153 | | // <initializer> ::= pi <expression>* E # parenthesized initialization |
4154 | | template <typename Derived, typename Alloc> |
4155 | 0 | Node *AbstractManglingParser<Derived, Alloc>::parseNewExpr() { |
4156 | 0 | bool Global = consumeIf("gs"); |
4157 | 0 | bool IsArray = look(1) == 'a'; |
4158 | 0 | if (!consumeIf("nw") && !consumeIf("na")) |
4159 | 0 | return nullptr; |
4160 | 0 | size_t Exprs = Names.size(); |
4161 | 0 | while (!consumeIf('_')) { |
4162 | 0 | Node *Ex = getDerived().parseExpr(); |
4163 | 0 | if (Ex == nullptr) |
4164 | 0 | return nullptr; |
4165 | 0 | Names.push_back(Ex); |
4166 | 0 | } |
4167 | 0 | NodeArray ExprList = popTrailingNodeArray(Exprs); |
4168 | 0 | Node *Ty = getDerived().parseType(); |
4169 | 0 | if (Ty == nullptr) |
4170 | 0 | return Ty; |
4171 | 0 | if (consumeIf("pi")) { |
4172 | 0 | size_t InitsBegin = Names.size(); |
4173 | 0 | while (!consumeIf('E')) { |
4174 | 0 | Node *Init = getDerived().parseExpr(); |
4175 | 0 | if (Init == nullptr) |
4176 | 0 | return Init; |
4177 | 0 | Names.push_back(Init); |
4178 | 0 | } |
4179 | 0 | NodeArray Inits = popTrailingNodeArray(InitsBegin); |
4180 | 0 | return make<NewExpr>(ExprList, Ty, Inits, Global, IsArray); |
4181 | 0 | } else if (!consumeIf('E')) |
4182 | 0 | return nullptr; |
4183 | 0 | return make<NewExpr>(ExprList, Ty, NodeArray(), Global, IsArray); |
4184 | 0 | } |
4185 | | |
4186 | | // cv <type> <expression> # conversion with one argument |
4187 | | // cv <type> _ <expression>* E # conversion with a different number of arguments |
4188 | | template <typename Derived, typename Alloc> |
4189 | 0 | Node *AbstractManglingParser<Derived, Alloc>::parseConversionExpr() { |
4190 | 0 | if (!consumeIf("cv")) |
4191 | 0 | return nullptr; |
4192 | 0 | Node *Ty; |
4193 | 0 | { |
4194 | 0 | SwapAndRestore<bool> SaveTemp(TryToParseTemplateArgs, false); |
4195 | 0 | Ty = getDerived().parseType(); |
4196 | 0 | } |
4197 | |
|
4198 | 0 | if (Ty == nullptr) |
4199 | 0 | return nullptr; |
4200 | | |
4201 | 0 | if (consumeIf('_')) { |
4202 | 0 | size_t ExprsBegin = Names.size(); |
4203 | 0 | while (!consumeIf('E')) { |
4204 | 0 | Node *E = getDerived().parseExpr(); |
4205 | 0 | if (E == nullptr) |
4206 | 0 | return E; |
4207 | 0 | Names.push_back(E); |
4208 | 0 | } |
4209 | 0 | NodeArray Exprs = popTrailingNodeArray(ExprsBegin); |
4210 | 0 | return make<ConversionExpr>(Ty, Exprs); |
4211 | 0 | } |
4212 | | |
4213 | 0 | Node *E[1] = {getDerived().parseExpr()}; |
4214 | 0 | if (E[0] == nullptr) |
4215 | 0 | return nullptr; |
4216 | 0 | return make<ConversionExpr>(Ty, makeNodeArray(E, E + 1)); |
4217 | 0 | } |
4218 | | |
4219 | | // <expr-primary> ::= L <type> <value number> E # integer literal |
4220 | | // ::= L <type> <value float> E # floating literal |
4221 | | // ::= L <string type> E # string literal |
4222 | | // ::= L <nullptr type> E # nullptr literal (i.e., "LDnE") |
4223 | | // ::= L <lambda type> E # lambda expression |
4224 | | // FIXME: ::= L <type> <real-part float> _ <imag-part float> E # complex floating point literal (C 2000) |
4225 | | // ::= L <mangled-name> E # external name |
4226 | | template <typename Derived, typename Alloc> |
4227 | 0 | Node *AbstractManglingParser<Derived, Alloc>::parseExprPrimary() { |
4228 | 0 | if (!consumeIf('L')) |
4229 | 0 | return nullptr; |
4230 | 0 | switch (look()) { |
4231 | 0 | case 'w': |
4232 | 0 | ++First; |
4233 | 0 | return getDerived().parseIntegerLiteral("wchar_t"); |
4234 | 0 | case 'b': |
4235 | 0 | if (consumeIf("b0E")) |
4236 | 0 | return make<BoolExpr>(0); |
4237 | 0 | if (consumeIf("b1E")) |
4238 | 0 | return make<BoolExpr>(1); |
4239 | 0 | return nullptr; |
4240 | 0 | case 'c': |
4241 | 0 | ++First; |
4242 | 0 | return getDerived().parseIntegerLiteral("char"); |
4243 | 0 | case 'a': |
4244 | 0 | ++First; |
4245 | 0 | return getDerived().parseIntegerLiteral("signed char"); |
4246 | 0 | case 'h': |
4247 | 0 | ++First; |
4248 | 0 | return getDerived().parseIntegerLiteral("unsigned char"); |
4249 | 0 | case 's': |
4250 | 0 | ++First; |
4251 | 0 | return getDerived().parseIntegerLiteral("short"); |
4252 | 0 | case 't': |
4253 | 0 | ++First; |
4254 | 0 | return getDerived().parseIntegerLiteral("unsigned short"); |
4255 | 0 | case 'i': |
4256 | 0 | ++First; |
4257 | 0 | return getDerived().parseIntegerLiteral(""); |
4258 | 0 | case 'j': |
4259 | 0 | ++First; |
4260 | 0 | return getDerived().parseIntegerLiteral("u"); |
4261 | 0 | case 'l': |
4262 | 0 | ++First; |
4263 | 0 | return getDerived().parseIntegerLiteral("l"); |
4264 | 0 | case 'm': |
4265 | 0 | ++First; |
4266 | 0 | return getDerived().parseIntegerLiteral("ul"); |
4267 | 0 | case 'x': |
4268 | 0 | ++First; |
4269 | 0 | return getDerived().parseIntegerLiteral("ll"); |
4270 | 0 | case 'y': |
4271 | 0 | ++First; |
4272 | 0 | return getDerived().parseIntegerLiteral("ull"); |
4273 | 0 | case 'n': |
4274 | 0 | ++First; |
4275 | 0 | return getDerived().parseIntegerLiteral("__int128"); |
4276 | 0 | case 'o': |
4277 | 0 | ++First; |
4278 | 0 | return getDerived().parseIntegerLiteral("unsigned __int128"); |
4279 | 0 | case 'f': |
4280 | 0 | ++First; |
4281 | 0 | return getDerived().template parseFloatingLiteral<float>(); |
4282 | 0 | case 'd': |
4283 | 0 | ++First; |
4284 | 0 | return getDerived().template parseFloatingLiteral<double>(); |
4285 | 0 | case 'e': |
4286 | 0 | ++First; |
4287 | | #if defined(__powerpc__) || defined(__s390__) |
4288 | | // Handle cases where long doubles encoded with e have the same size |
4289 | | // and representation as doubles. |
4290 | | return getDerived().template parseFloatingLiteral<double>(); |
4291 | | #else |
4292 | 0 | return getDerived().template parseFloatingLiteral<long double>(); |
4293 | 0 | #endif |
4294 | 0 | case '_': |
4295 | 0 | if (consumeIf("_Z")) { |
4296 | 0 | Node *R = getDerived().parseEncoding(); |
4297 | 0 | if (R != nullptr && consumeIf('E')) |
4298 | 0 | return R; |
4299 | 0 | } |
4300 | 0 | return nullptr; |
4301 | 0 | case 'A': { |
4302 | 0 | Node *T = getDerived().parseType(); |
4303 | 0 | if (T == nullptr) |
4304 | 0 | return nullptr; |
4305 | | // FIXME: We need to include the string contents in the mangling. |
4306 | 0 | if (consumeIf('E')) |
4307 | 0 | return make<StringLiteral>(T); |
4308 | 0 | return nullptr; |
4309 | 0 | } |
4310 | 0 | case 'D': |
4311 | 0 | if (consumeIf("DnE")) |
4312 | 0 | return make<NameType>("nullptr"); |
4313 | 0 | return nullptr; |
4314 | 0 | case 'T': |
4315 | | // Invalid mangled name per |
4316 | | // http://sourcerytools.com/pipermail/cxx-abi-dev/2011-August/002422.html |
4317 | 0 | return nullptr; |
4318 | 0 | case 'U': { |
4319 | | // FIXME: Should we support LUb... for block literals? |
4320 | 0 | if (look(1) != 'l') |
4321 | 0 | return nullptr; |
4322 | 0 | Node *T = parseUnnamedTypeName(nullptr); |
4323 | 0 | if (!T || !consumeIf('E')) |
4324 | 0 | return nullptr; |
4325 | 0 | return make<LambdaExpr>(T); |
4326 | 0 | } <
|