blob: 039b12212febb6542247da2772090d9221151f6c [file] [log] [blame]
Zachary Turner03312862018-08-27 03:48:03 +00001//===- MicrosoftDemangle.cpp ----------------------------------------------===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is dual licensed under the MIT and the University of Illinois Open
6// Source Licenses. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// This file defines a demangler for MSVC-style mangled symbols.
11//
12//===----------------------------------------------------------------------===//
13
14#include "MicrosoftDemangleNodes.h"
15
16#include "llvm/Demangle/Compiler.h"
17#include "llvm/Demangle/Utility.h"
18
19using namespace llvm;
20using namespace ms_demangle;
21
22#define OUTPUT_ENUM_CLASS_VALUE(Enum, Value, Desc) \
23 case Enum::Value: \
24 OS << Desc; \
25 break;
26
27// Writes a space if the last token does not end with a punctuation.
28static void outputSpaceIfNecessary(OutputStream &OS) {
29 if (OS.empty())
30 return;
31
32 char C = OS.back();
33 if (isalnum(C) || C == '>')
34 OS << " ";
35}
36
37static bool outputSingleQualifier(OutputStream &OS, Qualifiers Q) {
38 switch (Q) {
39 case Q_Const:
40 OS << "const";
41 return true;
42 case Q_Volatile:
43 OS << "volatile";
44 return true;
45 case Q_Restrict:
46 OS << "__restrict";
47 return true;
48 default:
49 break;
50 }
51 return false;
52}
53
54static bool outputQualifierIfPresent(OutputStream &OS, Qualifiers Q,
55 Qualifiers Mask, bool NeedSpace) {
56 if (!(Q & Mask))
57 return NeedSpace;
58
59 if (NeedSpace)
60 OS << " ";
61
62 outputSingleQualifier(OS, Mask);
63 return true;
64}
65
66static void outputQualifiers(OutputStream &OS, Qualifiers Q, bool SpaceBefore,
67 bool SpaceAfter) {
68 if (Q == Q_None)
69 return;
70
71 size_t Pos1 = OS.getCurrentPosition();
72 SpaceBefore = outputQualifierIfPresent(OS, Q, Q_Const, SpaceBefore);
73 SpaceBefore = outputQualifierIfPresent(OS, Q, Q_Volatile, SpaceBefore);
74 SpaceBefore = outputQualifierIfPresent(OS, Q, Q_Restrict, SpaceBefore);
75 size_t Pos2 = OS.getCurrentPosition();
76 if (SpaceAfter && Pos2 > Pos1)
77 OS << " ";
78}
79
80static void outputCallingConvention(OutputStream &OS, CallingConv CC) {
81 outputSpaceIfNecessary(OS);
82
83 switch (CC) {
84 case CallingConv::Cdecl:
85 OS << "__cdecl";
86 break;
87 case CallingConv::Fastcall:
88 OS << "__fastcall";
89 break;
90 case CallingConv::Pascal:
91 OS << "__pascal";
92 break;
93 case CallingConv::Regcall:
94 OS << "__regcall";
95 break;
96 case CallingConv::Stdcall:
97 OS << "__stdcall";
98 break;
99 case CallingConv::Thiscall:
100 OS << "__thiscall";
101 break;
102 case CallingConv::Eabi:
103 OS << "__eabi";
104 break;
105 case CallingConv::Vectorcall:
106 OS << "__vectorcall";
107 break;
108 case CallingConv::Clrcall:
109 OS << "__clrcall";
110 break;
111 default:
112 break;
113 }
114}
115
116void TypeNode::outputQuals(bool SpaceBefore, bool SpaceAfter) const {}
117
118void PrimitiveTypeNode::outputPre(OutputStream &OS) const {
119 switch (PrimKind) {
120 OUTPUT_ENUM_CLASS_VALUE(PrimitiveKind, Void, "void");
121 OUTPUT_ENUM_CLASS_VALUE(PrimitiveKind, Bool, "bool");
122 OUTPUT_ENUM_CLASS_VALUE(PrimitiveKind, Char, "char");
123 OUTPUT_ENUM_CLASS_VALUE(PrimitiveKind, Schar, "signed char");
124 OUTPUT_ENUM_CLASS_VALUE(PrimitiveKind, Uchar, "unsigned char");
125 OUTPUT_ENUM_CLASS_VALUE(PrimitiveKind, Char16, "char16_t");
126 OUTPUT_ENUM_CLASS_VALUE(PrimitiveKind, Char32, "char32_t");
127 OUTPUT_ENUM_CLASS_VALUE(PrimitiveKind, Short, "short");
128 OUTPUT_ENUM_CLASS_VALUE(PrimitiveKind, Ushort, "unsigned short");
129 OUTPUT_ENUM_CLASS_VALUE(PrimitiveKind, Int, "int");
130 OUTPUT_ENUM_CLASS_VALUE(PrimitiveKind, Uint, "unsigned int");
131 OUTPUT_ENUM_CLASS_VALUE(PrimitiveKind, Long, "long");
132 OUTPUT_ENUM_CLASS_VALUE(PrimitiveKind, Ulong, "unsigned long");
133 OUTPUT_ENUM_CLASS_VALUE(PrimitiveKind, Int64, "__int64");
134 OUTPUT_ENUM_CLASS_VALUE(PrimitiveKind, Uint64, "unsigned __int64");
135 OUTPUT_ENUM_CLASS_VALUE(PrimitiveKind, Wchar, "wchar_t");
136 OUTPUT_ENUM_CLASS_VALUE(PrimitiveKind, Float, "float");
137 OUTPUT_ENUM_CLASS_VALUE(PrimitiveKind, Double, "double");
138 OUTPUT_ENUM_CLASS_VALUE(PrimitiveKind, Ldouble, "long double");
139 OUTPUT_ENUM_CLASS_VALUE(PrimitiveKind, Nullptr, "std::nullptr_t");
140 }
141 outputQualifiers(OS, Quals, true, false);
142}
143
144void NodeArrayNode::output(OutputStream &OS) const { output(OS, ", "); }
145
146void NodeArrayNode::output(OutputStream &OS, StringView Separator) const {
147 if (Count == 0)
148 return;
149 if (Nodes[0])
150 Nodes[0]->output(OS);
151 for (size_t I = 1; I < Count; ++I) {
152 OS << Separator;
153 Nodes[I]->output(OS);
154 }
155}
156
157void EncodedStringLiteralNode::output(OutputStream &OS) const {
158 switch (Char) {
159 case CharKind::Wchar:
160 OS << "const wchar_t * {L\"";
161 break;
162 case CharKind::Char:
163 OS << "const char * {\"";
164 break;
165 case CharKind::Char16:
166 OS << "const char16_t * {u\"";
167 break;
168 case CharKind::Char32:
169 OS << "const char32_t * {U\"";
170 break;
171 }
172 OS << DecodedString << "\"";
173 if (IsTruncated)
174 OS << "...";
175 OS << "}";
176}
177
178void IntegerLiteralNode::output(OutputStream &OS) const {
179 if (IsNegative)
180 OS << '-';
181 OS << Value;
182}
183
184void TemplateParameterReferenceNode::output(OutputStream &OS) const {
185 if (ThunkOffsetCount > 0)
186 OS << "{";
187 else if (Affinity == PointerAffinity::Pointer)
188 OS << "&";
189
190 if (Symbol) {
191 Symbol->output(OS);
192 if (ThunkOffsetCount > 0)
193 OS << ", ";
194 }
195
196 if (ThunkOffsetCount > 0)
197 OS << ThunkOffsets[0];
198 for (int I = 1; I < ThunkOffsetCount; ++I) {
199 OS << ", " << ThunkOffsets[I];
200 }
201 if (ThunkOffsetCount > 0)
202 OS << "}";
203}
204
205void IdentifierNode::outputTemplateParameters(OutputStream &OS) const {
206 if (!TemplateParams)
207 return;
208 OS << "<";
209 TemplateParams->output(OS);
210 OS << ">";
211}
212
213void DynamicStructorIdentifierNode::output(OutputStream &OS) const {
214 if (IsDestructor)
215 OS << "`dynamic atexit destructor for ";
216 else
217 OS << "`dynamic initializer for ";
218
219 OS << "'";
220 Name->output(OS);
221 OS << "''";
222}
223
224void NamedIdentifierNode::output(OutputStream &OS) const {
225 OS << Name;
226 outputTemplateParameters(OS);
227}
228
229void IntrinsicFunctionIdentifierNode::output(OutputStream &OS) const {
230 switch (Operator) {
231 OUTPUT_ENUM_CLASS_VALUE(IntrinsicFunctionKind, New, "operator new");
232 OUTPUT_ENUM_CLASS_VALUE(IntrinsicFunctionKind, Delete, "operator delete");
233 OUTPUT_ENUM_CLASS_VALUE(IntrinsicFunctionKind, Assign, "operator=");
234 OUTPUT_ENUM_CLASS_VALUE(IntrinsicFunctionKind, RightShift, "operator>>");
235 OUTPUT_ENUM_CLASS_VALUE(IntrinsicFunctionKind, LeftShift, "operator<<");
236 OUTPUT_ENUM_CLASS_VALUE(IntrinsicFunctionKind, LogicalNot, "operator!");
237 OUTPUT_ENUM_CLASS_VALUE(IntrinsicFunctionKind, Equals, "operator==");
238 OUTPUT_ENUM_CLASS_VALUE(IntrinsicFunctionKind, NotEquals, "operator!=");
239 OUTPUT_ENUM_CLASS_VALUE(IntrinsicFunctionKind, ArraySubscript,
240 "operator[]");
241 OUTPUT_ENUM_CLASS_VALUE(IntrinsicFunctionKind, Pointer, "operator->");
242 OUTPUT_ENUM_CLASS_VALUE(IntrinsicFunctionKind, Increment, "operator++");
243 OUTPUT_ENUM_CLASS_VALUE(IntrinsicFunctionKind, Decrement, "operator--");
244 OUTPUT_ENUM_CLASS_VALUE(IntrinsicFunctionKind, Minus, "operator-");
245 OUTPUT_ENUM_CLASS_VALUE(IntrinsicFunctionKind, Plus, "operator+");
246 OUTPUT_ENUM_CLASS_VALUE(IntrinsicFunctionKind, Dereference, "operator*");
247 OUTPUT_ENUM_CLASS_VALUE(IntrinsicFunctionKind, BitwiseAnd, "operator&");
248 OUTPUT_ENUM_CLASS_VALUE(IntrinsicFunctionKind, MemberPointer,
249 "operator->*");
250 OUTPUT_ENUM_CLASS_VALUE(IntrinsicFunctionKind, Divide, "operator/");
251 OUTPUT_ENUM_CLASS_VALUE(IntrinsicFunctionKind, Modulus, "operator%");
252 OUTPUT_ENUM_CLASS_VALUE(IntrinsicFunctionKind, LessThan, "operator<");
253 OUTPUT_ENUM_CLASS_VALUE(IntrinsicFunctionKind, LessThanEqual, "operator<=");
254 OUTPUT_ENUM_CLASS_VALUE(IntrinsicFunctionKind, GreaterThan, "operator>");
255 OUTPUT_ENUM_CLASS_VALUE(IntrinsicFunctionKind, GreaterThanEqual,
256 "operator>=");
257 OUTPUT_ENUM_CLASS_VALUE(IntrinsicFunctionKind, Comma, "operator,");
258 OUTPUT_ENUM_CLASS_VALUE(IntrinsicFunctionKind, Parens, "operator()");
259 OUTPUT_ENUM_CLASS_VALUE(IntrinsicFunctionKind, BitwiseNot, "operator~");
260 OUTPUT_ENUM_CLASS_VALUE(IntrinsicFunctionKind, BitwiseXor, "operator^");
261 OUTPUT_ENUM_CLASS_VALUE(IntrinsicFunctionKind, BitwiseOr, "operator|");
262 OUTPUT_ENUM_CLASS_VALUE(IntrinsicFunctionKind, LogicalAnd, "operator&&");
263 OUTPUT_ENUM_CLASS_VALUE(IntrinsicFunctionKind, LogicalOr, "operator||");
264 OUTPUT_ENUM_CLASS_VALUE(IntrinsicFunctionKind, TimesEqual, "operator*=");
265 OUTPUT_ENUM_CLASS_VALUE(IntrinsicFunctionKind, PlusEqual, "operator+=");
266 OUTPUT_ENUM_CLASS_VALUE(IntrinsicFunctionKind, MinusEqual, "operator-=");
267 OUTPUT_ENUM_CLASS_VALUE(IntrinsicFunctionKind, DivEqual, "operator/=");
268 OUTPUT_ENUM_CLASS_VALUE(IntrinsicFunctionKind, ModEqual, "operator%=");
269 OUTPUT_ENUM_CLASS_VALUE(IntrinsicFunctionKind, RshEqual, "operator>>=");
270 OUTPUT_ENUM_CLASS_VALUE(IntrinsicFunctionKind, LshEqual, "operator<<=");
271 OUTPUT_ENUM_CLASS_VALUE(IntrinsicFunctionKind, BitwiseAndEqual,
272 "operator&=");
273 OUTPUT_ENUM_CLASS_VALUE(IntrinsicFunctionKind, BitwiseOrEqual,
274 "operator|=");
275 OUTPUT_ENUM_CLASS_VALUE(IntrinsicFunctionKind, BitwiseXorEqual,
276 "operator^=");
277 OUTPUT_ENUM_CLASS_VALUE(IntrinsicFunctionKind, VbaseDtor, "`vbase dtor'");
278 OUTPUT_ENUM_CLASS_VALUE(IntrinsicFunctionKind, VecDelDtor,
279 "`vector deleting dtor'");
280 OUTPUT_ENUM_CLASS_VALUE(IntrinsicFunctionKind, DefaultCtorClosure,
281 "`default ctor closure'");
282 OUTPUT_ENUM_CLASS_VALUE(IntrinsicFunctionKind, ScalarDelDtor,
283 "`scalar deleting dtor'");
284 OUTPUT_ENUM_CLASS_VALUE(IntrinsicFunctionKind, VecCtorIter,
285 "`vector ctor iterator'");
286 OUTPUT_ENUM_CLASS_VALUE(IntrinsicFunctionKind, VecDtorIter,
287 "`vector dtor iterator'");
288 OUTPUT_ENUM_CLASS_VALUE(IntrinsicFunctionKind, VecVbaseCtorIter,
289 "`vector vbase ctor iterator'");
290 OUTPUT_ENUM_CLASS_VALUE(IntrinsicFunctionKind, VdispMap,
291 "`virtual displacement map'");
292 OUTPUT_ENUM_CLASS_VALUE(IntrinsicFunctionKind, EHVecCtorIter,
293 "`eh vector ctor iterator'");
294 OUTPUT_ENUM_CLASS_VALUE(IntrinsicFunctionKind, EHVecDtorIter,
295 "`eh vector dtor iterator'");
296 OUTPUT_ENUM_CLASS_VALUE(IntrinsicFunctionKind, EHVecVbaseCtorIter,
297 "`eh vector vbase ctor iterator'");
298 OUTPUT_ENUM_CLASS_VALUE(IntrinsicFunctionKind, CopyCtorClosure,
299 "`copy ctor closure'");
300 OUTPUT_ENUM_CLASS_VALUE(IntrinsicFunctionKind, LocalVftableCtorClosure,
301 "`local vftable ctor closure'");
302 OUTPUT_ENUM_CLASS_VALUE(IntrinsicFunctionKind, ArrayNew, "operator new[]");
303 OUTPUT_ENUM_CLASS_VALUE(IntrinsicFunctionKind, ArrayDelete,
304 "operator delete[]");
305 OUTPUT_ENUM_CLASS_VALUE(IntrinsicFunctionKind, ManVectorCtorIter,
306 "`managed vector ctor iterator'");
307 OUTPUT_ENUM_CLASS_VALUE(IntrinsicFunctionKind, ManVectorDtorIter,
308 "`managed vector dtor iterator'");
309 OUTPUT_ENUM_CLASS_VALUE(IntrinsicFunctionKind, EHVectorCopyCtorIter,
310 "`EH vector copy ctor iterator'");
311 OUTPUT_ENUM_CLASS_VALUE(IntrinsicFunctionKind, EHVectorVbaseCopyCtorIter,
312 "`EH vector vbase copy ctor iterator'");
313 OUTPUT_ENUM_CLASS_VALUE(IntrinsicFunctionKind, VectorCopyCtorIter,
314 "`vector copy ctor iterator'");
315 OUTPUT_ENUM_CLASS_VALUE(IntrinsicFunctionKind, VectorVbaseCopyCtorIter,
316 "`vector vbase copy constructor iterator'");
317 OUTPUT_ENUM_CLASS_VALUE(IntrinsicFunctionKind, ManVectorVbaseCopyCtorIter,
318 "`managed vector vbase copy constructor iterator'");
319 OUTPUT_ENUM_CLASS_VALUE(IntrinsicFunctionKind, CoAwait, "co_await");
320 OUTPUT_ENUM_CLASS_VALUE(IntrinsicFunctionKind, Spaceship, "operator <=>");
321 case IntrinsicFunctionKind::MaxIntrinsic:
322 case IntrinsicFunctionKind::None:
323 break;
324 }
325 outputTemplateParameters(OS);
326}
327
328void LocalStaticGuardIdentifierNode::output(OutputStream &OS) const {
329 OS << "`local static guard'";
330 if (ScopeIndex > 0)
331 OS << "{" << ScopeIndex << "}";
332}
333
334void ConversionOperatorIdentifierNode::output(OutputStream &OS) const {
335 OS << "operator";
336 outputTemplateParameters(OS);
337 OS << " ";
338 TargetType->output(OS);
339}
340
341void StructorIdentifierNode::output(OutputStream &OS) const {
342 if (IsDestructor)
343 OS << "~";
344 Class->output(OS);
345 outputTemplateParameters(OS);
346}
347
348void LiteralOperatorIdentifierNode::output(OutputStream &OS) const {
349 OS << "operator \"\"" << Name;
350 outputTemplateParameters(OS);
351}
352
353void FunctionSignatureNode::outputPre(OutputStream &OS,
354 FunctionSigFlags Flags) const {
355 if (!(FunctionClass & FC_Global)) {
356 if (FunctionClass & FC_Static)
357 OS << "static ";
358 }
359 if (FunctionClass & FC_ExternC)
360 OS << "extern \"C\" ";
361
362 if (FunctionClass & FC_Virtual)
363 OS << "virtual ";
364
365 if (ReturnType) {
366 ReturnType->outputPre(OS);
367 OS << " ";
368 }
369
370 if (!(Flags & FSF_NoCallingConvention))
371 outputCallingConvention(OS, CallConvention);
372}
373
374void FunctionSignatureNode::outputPost(OutputStream &OS,
375 FunctionSigFlags Flags) const {
376 if (!(FunctionClass & FC_NoParameterList)) {
377 OS << "(";
378 if (Params)
379 Params->output(OS);
380 else
381 OS << "void";
382 OS << ")";
383 }
384
385 if (Quals & Q_Const)
386 OS << " const";
387 if (Quals & Q_Volatile)
388 OS << " volatile";
389 if (Quals & Q_Restrict)
390 OS << " __restrict";
391 if (Quals & Q_Unaligned)
392 OS << " __unaligned";
393
394 if (RefQualifier == FunctionRefQualifier::Reference)
395 OS << " &";
396 else if (RefQualifier == FunctionRefQualifier::RValueReference)
397 OS << " &&";
398
399 if (ReturnType)
400 ReturnType->outputPost(OS);
401}
402
403void ThunkSignatureNode::outputPre(OutputStream &OS,
404 FunctionSigFlags Flags) const {
405 OS << "[thunk]: ";
406
407 FunctionSignatureNode::outputPre(OS, Flags);
408}
409
410void ThunkSignatureNode::outputPost(OutputStream &OS,
411 FunctionSigFlags Flags) const {
412 if (FunctionClass & FC_StaticThisAdjust) {
413 OS << "`adjustor{" << ThisAdjust.StaticOffset << "}'";
414 } else if (FunctionClass & FC_VirtualThisAdjust) {
415 if (FunctionClass & FC_VirtualThisAdjustEx) {
416 OS << "`vtordispex{" << ThisAdjust.VBPtrOffset << ", "
417 << ThisAdjust.VBOffsetOffset << ", " << ThisAdjust.VtordispOffset
418 << ", " << ThisAdjust.StaticOffset << "}'";
419 } else {
420 OS << "`vtordisp{" << ThisAdjust.VtordispOffset << ", "
421 << ThisAdjust.StaticOffset << "}'";
422 }
423 }
424
425 FunctionSignatureNode::outputPost(OS, Flags);
426}
427
428void PointerTypeNode::outputPre(OutputStream &OS) const {
429 if (Pointee->kind() == NodeKind::FunctionSignature) {
430 // If this is a pointer to a function, don't output the calling convention.
431 // It needs to go inside the parentheses.
432 const FunctionSignatureNode *Sig =
433 static_cast<const FunctionSignatureNode *>(Pointee);
434 Sig->outputPre(OS, FSF_NoCallingConvention);
435 } else
436 Pointee->outputPre(OS);
437
438 outputSpaceIfNecessary(OS);
439
440 if (Quals & Q_Unaligned)
441 OS << "__unaligned ";
442
443 if (Pointee->kind() == NodeKind::ArrayType) {
444 OS << "(";
445 } else if (Pointee->kind() == NodeKind::FunctionSignature) {
446 OS << "(";
447 const FunctionSignatureNode *Sig =
448 static_cast<const FunctionSignatureNode *>(Pointee);
449 outputCallingConvention(OS, Sig->CallConvention);
450 OS << " ";
451 }
452
453 if (ClassParent) {
454 ClassParent->output(OS);
455 OS << "::";
456 }
457
458 switch (Affinity) {
459 case PointerAffinity::Pointer:
460 OS << "*";
461 break;
462 case PointerAffinity::Reference:
463 OS << "&";
464 break;
465 case PointerAffinity::RValueReference:
466 OS << "&&";
467 break;
468 default:
469 assert(false);
470 }
471 outputQualifiers(OS, Quals, false, false);
472}
473
474void PointerTypeNode::outputPost(OutputStream &OS) const {
475 if (Pointee->kind() == NodeKind::ArrayType ||
476 Pointee->kind() == NodeKind::FunctionSignature)
477 OS << ")";
478
479 Pointee->outputPost(OS);
480}
481
482void TagTypeNode::outputPre(OutputStream &OS) const {
483 switch (Tag) {
484 OUTPUT_ENUM_CLASS_VALUE(TagKind, Class, "class");
485 OUTPUT_ENUM_CLASS_VALUE(TagKind, Struct, "struct");
486 OUTPUT_ENUM_CLASS_VALUE(TagKind, Union, "union");
487 OUTPUT_ENUM_CLASS_VALUE(TagKind, Enum, "enum");
488 }
489 OS << " ";
490 QualifiedName->output(OS);
491 outputQualifiers(OS, Quals, true, false);
492}
493
494void TagTypeNode::outputPost(OutputStream &OS) const {}
495
496void ArrayTypeNode::outputPre(OutputStream &OS) const {
497 ElementType->outputPre(OS);
498 outputQualifiers(OS, Quals, true, false);
499}
500
501void ArrayTypeNode::outputOneDimension(OutputStream &OS, Node *N) const {
502 assert(N->kind() == NodeKind::IntegerLiteral);
503 IntegerLiteralNode *ILN = static_cast<IntegerLiteralNode *>(N);
504 if (ILN->Value != 0)
505 ILN->output(OS);
506}
507
508void ArrayTypeNode::outputDimensionsImpl(OutputStream &OS) const {
509 if (Dimensions->Count == 0)
510 return;
511
512 outputOneDimension(OS, Dimensions->Nodes[0]);
513 for (size_t I = 1; I < Dimensions->Count; ++I) {
514 OS << "][";
515 outputOneDimension(OS, Dimensions->Nodes[I]);
516 }
517}
518
519void ArrayTypeNode::outputPost(OutputStream &OS) const {
520 OS << "[";
521 outputDimensionsImpl(OS);
522 OS << "]";
523
524 ElementType->outputPost(OS);
525}
526
527void SymbolNode::output(OutputStream &OS) const { Name->output(OS); }
528
529void FunctionSymbolNode::output(OutputStream &OS) const {
530 output(OS, FunctionSigFlags::FSF_Default);
531}
532
533void FunctionSymbolNode::output(OutputStream &OS,
534 FunctionSigFlags Flags) const {
535 Signature->outputPre(OS, Flags);
536 outputSpaceIfNecessary(OS);
537 Name->output(OS);
538 Signature->outputPost(OS, Flags);
539}
540
541void VariableSymbolNode::output(OutputStream &OS) const {
542 switch (SC) {
543 case StorageClass::PrivateStatic:
544 case StorageClass::PublicStatic:
545 case StorageClass::ProtectedStatic:
546 OS << "static ";
547 default:
548 break;
549 }
550
551 if (Type) {
552 Type->outputPre(OS);
553 outputSpaceIfNecessary(OS);
554 }
555 Name->output(OS);
556 if (Type)
557 Type->outputPost(OS);
558}
559
560void CustomNode::output(OutputStream &OS) const { OS << Name; }
561
562void QualifiedNameNode::output(OutputStream &OS) const {
563 Components->output(OS, "::");
564}
565
566void RttiBaseClassDescriptorNode::output(OutputStream &OS) const {
567 OS << "`RTTI Base Class Descriptor at (";
568 OS << NVOffset << ", " << VBPtrOffset << ", " << VBTableOffset << ", "
569 << Flags;
570 OS << ")'";
571}
572
573void LocalStaticGuardVariableNode::output(OutputStream &OS) const {
574 Name->output(OS);
575}
576
577void VcallThunkIdentifierNode::output(OutputStream &OS) const {
578 OS << "`vcall'{" << OffsetInVTable << ", {flat}}";
579}
580
581void SpecialTableSymbolNode::output(OutputStream &OS) const {
582 outputQualifiers(OS, Quals, false, true);
583 Name->output(OS);
584 if (TargetName) {
585 OS << "{for `";
586 TargetName->output(OS);
587 OS << "'}";
588 }
589 return;
590}