clang 17.0.0git
TextNodeDumper.cpp
Go to the documentation of this file.
1//===--- TextNodeDumper.cpp - Printing of AST nodes -----------------------===//
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// This file implements AST dumping of components of individual AST nodes.
10//
11//===----------------------------------------------------------------------===//
12
14#include "clang/AST/APValue.h"
19#include "clang/AST/Type.h"
20#include "clang/Basic/Module.h"
24#include "llvm/ADT/StringExtras.h"
25
26#include <algorithm>
27#include <utility>
28
29using namespace clang;
30
31static void dumpPreviousDeclImpl(raw_ostream &OS, ...) {}
32
33template <typename T>
34static void dumpPreviousDeclImpl(raw_ostream &OS, const Mergeable<T> *D) {
35 const T *First = D->getFirstDecl();
36 if (First != D)
37 OS << " first " << First;
38}
39
40template <typename T>
41static void dumpPreviousDeclImpl(raw_ostream &OS, const Redeclarable<T> *D) {
42 const T *Prev = D->getPreviousDecl();
43 if (Prev)
44 OS << " prev " << Prev;
45}
46
47/// Dump the previous declaration in the redeclaration chain for a declaration,
48/// if any.
49static void dumpPreviousDecl(raw_ostream &OS, const Decl *D) {
50 switch (D->getKind()) {
51#define DECL(DERIVED, BASE) \
52 case Decl::DERIVED: \
53 return dumpPreviousDeclImpl(OS, cast<DERIVED##Decl>(D));
54#define ABSTRACT_DECL(DECL)
55#include "clang/AST/DeclNodes.inc"
56 }
57 llvm_unreachable("Decl that isn't part of DeclNodes.inc!");
58}
59
60TextNodeDumper::TextNodeDumper(raw_ostream &OS, const ASTContext &Context,
61 bool ShowColors)
62 : TextTreeStructure(OS, ShowColors), OS(OS), ShowColors(ShowColors),
63 Context(&Context), SM(&Context.getSourceManager()),
64 PrintPolicy(Context.getPrintingPolicy()),
65 Traits(&Context.getCommentCommandTraits()) {}
66
67TextNodeDumper::TextNodeDumper(raw_ostream &OS, bool ShowColors)
68 : TextTreeStructure(OS, ShowColors), OS(OS), ShowColors(ShowColors) {}
69
71 const comments::FullComment *FC) {
72 if (!C) {
73 ColorScope Color(OS, ShowColors, NullColor);
74 OS << "<<<NULL>>>";
75 return;
76 }
77
78 {
79 ColorScope Color(OS, ShowColors, CommentColor);
80 OS << C->getCommentKindName();
81 }
83 dumpSourceRange(C->getSourceRange());
84
85 ConstCommentVisitor<TextNodeDumper, void,
86 const comments::FullComment *>::visit(C, FC);
87}
88
90 {
91 ColorScope Color(OS, ShowColors, AttrColor);
92
93 switch (A->getKind()) {
94#define ATTR(X) \
95 case attr::X: \
96 OS << #X; \
97 break;
98#include "clang/Basic/AttrList.inc"
99 }
100 OS << "Attr";
101 }
102 dumpPointer(A);
104 if (A->isInherited())
105 OS << " Inherited";
106 if (A->isImplicit())
107 OS << " Implicit";
108
110}
111
113 const Decl *From, StringRef Label) {
114 OS << "TemplateArgument";
115 if (R.isValid())
117
118 if (From)
119 dumpDeclRef(From, Label);
120
122}
123
125 if (!Node) {
126 ColorScope Color(OS, ShowColors, NullColor);
127 OS << "<<<NULL>>>";
128 return;
129 }
130 {
131 ColorScope Color(OS, ShowColors, StmtColor);
132 OS << Node->getStmtClassName();
133 }
136
137 if (const auto *E = dyn_cast<Expr>(Node)) {
138 dumpType(E->getType());
139
140 if (E->containsErrors()) {
141 ColorScope Color(OS, ShowColors, ErrorsColor);
142 OS << " contains-errors";
143 }
144
145 {
146 ColorScope Color(OS, ShowColors, ValueKindColor);
147 switch (E->getValueKind()) {
148 case VK_PRValue:
149 break;
150 case VK_LValue:
151 OS << " lvalue";
152 break;
153 case VK_XValue:
154 OS << " xvalue";
155 break;
156 }
157 }
158
159 {
160 ColorScope Color(OS, ShowColors, ObjectKindColor);
161 switch (E->getObjectKind()) {
162 case OK_Ordinary:
163 break;
164 case OK_BitField:
165 OS << " bitfield";
166 break;
167 case OK_ObjCProperty:
168 OS << " objcproperty";
169 break;
170 case OK_ObjCSubscript:
171 OS << " objcsubscript";
172 break;
174 OS << " vectorcomponent";
175 break;
177 OS << " matrixcomponent";
178 break;
179 }
180 }
181 }
182
184}
185
187 if (!T) {
188 ColorScope Color(OS, ShowColors, NullColor);
189 OS << "<<<NULL>>>";
190 return;
191 }
192 if (isa<LocInfoType>(T)) {
193 {
194 ColorScope Color(OS, ShowColors, TypeColor);
195 OS << "LocInfo Type";
196 }
197 dumpPointer(T);
198 return;
199 }
200
201 {
202 ColorScope Color(OS, ShowColors, TypeColor);
203 OS << T->getTypeClassName() << "Type";
204 }
205 dumpPointer(T);
206 OS << " ";
207 dumpBareType(QualType(T, 0), false);
208
209 QualType SingleStepDesugar =
211 if (SingleStepDesugar != QualType(T, 0))
212 OS << " sugar";
213
214 if (T->containsErrors()) {
215 ColorScope Color(OS, ShowColors, ErrorsColor);
216 OS << " contains-errors";
217 }
218
219 if (T->isDependentType())
220 OS << " dependent";
221 else if (T->isInstantiationDependentType())
222 OS << " instantiation_dependent";
223
224 if (T->isVariablyModifiedType())
225 OS << " variably_modified";
227 OS << " contains_unexpanded_pack";
228 if (T->isFromAST())
229 OS << " imported";
230
232}
233
235 OS << "QualType";
237 OS << " ";
238 dumpBareType(T, false);
239 OS << " " << T.split().Quals.getAsString();
240}
241
243 if (!D) {
244 ColorScope Color(OS, ShowColors, NullColor);
245 OS << "<<<NULL>>>";
246 return;
247 }
248
249 {
250 ColorScope Color(OS, ShowColors, DeclKindNameColor);
251 OS << D->getDeclKindName() << "Decl";
252 }
253 dumpPointer(D);
254 if (D->getLexicalDeclContext() != D->getDeclContext())
255 OS << " parent " << cast<Decl>(D->getDeclContext());
256 dumpPreviousDecl(OS, D);
258 OS << ' ';
260 if (D->isFromASTFile())
261 OS << " imported";
262 if (Module *M = D->getOwningModule())
263 OS << " in " << M->getFullModuleName();
264 if (auto *ND = dyn_cast<NamedDecl>(D))
266 const_cast<NamedDecl *>(ND)))
267 AddChild([=] { OS << "also in " << M->getFullModuleName(); });
268 if (const NamedDecl *ND = dyn_cast<NamedDecl>(D))
269 if (!ND->isUnconditionallyVisible())
270 OS << " hidden";
271 if (D->isImplicit())
272 OS << " implicit";
273
274 if (D->isUsed())
275 OS << " used";
276 else if (D->isThisDeclarationReferenced())
277 OS << " referenced";
278
279 if (D->isInvalidDecl())
280 OS << " invalid";
281 if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) {
282 if (FD->isConstexprSpecified())
283 OS << " constexpr";
284 if (FD->isConsteval())
285 OS << " consteval";
286 if (FD->isMultiVersion())
287 OS << " multiversion";
288 }
289
290 if (!isa<FunctionDecl>(*D)) {
291 const auto *MD = dyn_cast<ObjCMethodDecl>(D);
292 if (!MD || !MD->isThisDeclarationADefinition()) {
293 const auto *DC = dyn_cast<DeclContext>(D);
294 if (DC && DC->hasExternalLexicalStorage()) {
295 ColorScope Color(OS, ShowColors, UndeserializedColor);
296 OS << " <undeserialized declarations>";
297 }
298 }
299 }
300
302}
303
305 OS << "CXXCtorInitializer";
306 if (Init->isAnyMemberInitializer()) {
307 OS << ' ';
308 dumpBareDeclRef(Init->getAnyMember());
309 } else if (Init->isBaseInitializer()) {
310 dumpType(QualType(Init->getBaseClass(), 0));
311 } else if (Init->isDelegatingInitializer()) {
312 dumpType(Init->getTypeSourceInfo()->getType());
313 } else {
314 llvm_unreachable("Unknown initializer type");
315 }
316}
317
319 OS << "capture";
320 if (C.isByRef())
321 OS << " byref";
322 if (C.isNested())
323 OS << " nested";
324 if (C.getVariable()) {
325 OS << ' ';
326 dumpBareDeclRef(C.getVariable());
327 }
328}
329
331 if (!C) {
332 ColorScope Color(OS, ShowColors, NullColor);
333 OS << "<<<NULL>>> OMPClause";
334 return;
335 }
336 {
337 ColorScope Color(OS, ShowColors, AttrColor);
338 StringRef ClauseName(llvm::omp::getOpenMPClauseName(C->getClauseKind()));
339 OS << "OMP" << ClauseName.substr(/*Start=*/0, /*N=*/1).upper()
340 << ClauseName.drop_front() << "Clause";
341 }
342 dumpPointer(C);
343 dumpSourceRange(SourceRange(C->getBeginLoc(), C->getEndLoc()));
344 if (C->isImplicit())
345 OS << " <implicit>";
346}
347
349 const TypeSourceInfo *TSI = A.getTypeSourceInfo();
350 if (TSI) {
351 OS << "case ";
352 dumpType(TSI->getType());
353 } else {
354 OS << "default";
355 }
356
357 if (A.isSelected())
358 OS << " selected";
359}
360
362 if (!R) {
363 ColorScope Color(OS, ShowColors, NullColor);
364 OS << "<<<NULL>>> Requirement";
365 return;
366 }
367
368 {
369 ColorScope Color(OS, ShowColors, StmtColor);
370 switch (R->getKind()) {
372 OS << "TypeRequirement";
373 break;
375 OS << "SimpleRequirement";
376 break;
378 OS << "CompoundRequirement";
379 break;
381 OS << "NestedRequirement";
382 break;
383 }
384 }
385
386 dumpPointer(R);
387
388 if (auto *ER = dyn_cast<concepts::ExprRequirement>(R)) {
389 if (ER->hasNoexceptRequirement())
390 OS << " noexcept";
391 }
392
393 if (R->isDependent())
394 OS << " dependent";
395 else
396 OS << (R->isSatisfied() ? " satisfied" : " unsatisfied");
398 OS << " contains_unexpanded_pack";
399}
400
401static double GetApproxValue(const llvm::APFloat &F) {
402 llvm::APFloat V = F;
403 bool ignored;
404 V.convert(llvm::APFloat::IEEEdouble(), llvm::APFloat::rmNearestTiesToEven,
405 &ignored);
406 return V.convertToDouble();
407}
408
409/// True if the \p APValue \p Value can be folded onto the current line.
410static bool isSimpleAPValue(const APValue &Value) {
411 switch (Value.getKind()) {
412 case APValue::None:
414 case APValue::Int:
415 case APValue::Float:
419 case APValue::LValue:
422 return true;
423 case APValue::Vector:
424 case APValue::Array:
425 case APValue::Struct:
426 return false;
427 case APValue::Union:
428 return isSimpleAPValue(Value.getUnionValue());
429 }
430 llvm_unreachable("unexpected APValue kind!");
431}
432
433/// Dump the children of the \p APValue \p Value.
434///
435/// \param[in] Value The \p APValue to visit
436/// \param[in] Ty The \p QualType passed to \p Visit
437///
438/// \param[in] IdxToChildFun A function mapping an \p APValue and an index
439/// to one of the child of the \p APValue
440///
441/// \param[in] NumChildren \p IdxToChildFun will be called on \p Value with
442/// the indices in the range \p [0,NumChildren(
443///
444/// \param[in] LabelSingular The label to use on a line with a single child
445/// \param[in] LabelPlurial The label to use on a line with multiple children
446void TextNodeDumper::dumpAPValueChildren(
447 const APValue &Value, QualType Ty,
448 const APValue &(*IdxToChildFun)(const APValue &, unsigned),
449 unsigned NumChildren, StringRef LabelSingular, StringRef LabelPlurial) {
450 // To save some vertical space we print up to MaxChildrenPerLine APValues
451 // considered to be simple (by isSimpleAPValue) on a single line.
452 constexpr unsigned MaxChildrenPerLine = 4;
453 unsigned I = 0;
454 while (I < NumChildren) {
455 unsigned J = I;
456 while (J < NumChildren) {
457 if (isSimpleAPValue(IdxToChildFun(Value, J)) &&
458 (J - I < MaxChildrenPerLine)) {
459 ++J;
460 continue;
461 }
462 break;
463 }
464
465 J = std::max(I + 1, J);
466
467 // Print [I,J) on a single line.
468 AddChild(J - I > 1 ? LabelPlurial : LabelSingular, [=]() {
469 for (unsigned X = I; X < J; ++X) {
470 Visit(IdxToChildFun(Value, X), Ty);
471 if (X + 1 != J)
472 OS << ", ";
473 }
474 });
475 I = J;
476 }
477}
478
480 ColorScope Color(OS, ShowColors, ValueKindColor);
481 switch (Value.getKind()) {
482 case APValue::None:
483 OS << "None";
484 return;
486 OS << "Indeterminate";
487 return;
488 case APValue::Int:
489 OS << "Int ";
490 {
491 ColorScope Color(OS, ShowColors, ValueColor);
492 OS << Value.getInt();
493 }
494 return;
495 case APValue::Float:
496 OS << "Float ";
497 {
498 ColorScope Color(OS, ShowColors, ValueColor);
499 OS << GetApproxValue(Value.getFloat());
500 }
501 return;
503 OS << "FixedPoint ";
504 {
505 ColorScope Color(OS, ShowColors, ValueColor);
506 OS << Value.getFixedPoint();
507 }
508 return;
509 case APValue::Vector: {
510 unsigned VectorLength = Value.getVectorLength();
511 OS << "Vector length=" << VectorLength;
512
513 dumpAPValueChildren(
514 Value, Ty,
515 [](const APValue &Value, unsigned Index) -> const APValue & {
516 return Value.getVectorElt(Index);
517 },
518 VectorLength, "element", "elements");
519 return;
520 }
522 OS << "ComplexInt ";
523 {
524 ColorScope Color(OS, ShowColors, ValueColor);
525 OS << Value.getComplexIntReal() << " + " << Value.getComplexIntImag()
526 << 'i';
527 }
528 return;
530 OS << "ComplexFloat ";
531 {
532 ColorScope Color(OS, ShowColors, ValueColor);
533 OS << GetApproxValue(Value.getComplexFloatReal()) << " + "
534 << GetApproxValue(Value.getComplexFloatImag()) << 'i';
535 }
536 return;
537 case APValue::LValue:
538 (void)Context;
539 OS << "LValue <todo>";
540 return;
541 case APValue::Array: {
542 unsigned ArraySize = Value.getArraySize();
543 unsigned NumInitializedElements = Value.getArrayInitializedElts();
544 OS << "Array size=" << ArraySize;
545
546 dumpAPValueChildren(
547 Value, Ty,
548 [](const APValue &Value, unsigned Index) -> const APValue & {
549 return Value.getArrayInitializedElt(Index);
550 },
551 NumInitializedElements, "element", "elements");
552
553 if (Value.hasArrayFiller()) {
554 AddChild("filler", [=] {
555 {
556 ColorScope Color(OS, ShowColors, ValueColor);
557 OS << ArraySize - NumInitializedElements << " x ";
558 }
559 Visit(Value.getArrayFiller(), Ty);
560 });
561 }
562
563 return;
564 }
565 case APValue::Struct: {
566 OS << "Struct";
567
568 dumpAPValueChildren(
569 Value, Ty,
570 [](const APValue &Value, unsigned Index) -> const APValue & {
571 return Value.getStructBase(Index);
572 },
573 Value.getStructNumBases(), "base", "bases");
574
575 dumpAPValueChildren(
576 Value, Ty,
577 [](const APValue &Value, unsigned Index) -> const APValue & {
578 return Value.getStructField(Index);
579 },
580 Value.getStructNumFields(), "field", "fields");
581
582 return;
583 }
584 case APValue::Union: {
585 OS << "Union";
586 {
587 ColorScope Color(OS, ShowColors, ValueColor);
588 if (const FieldDecl *FD = Value.getUnionField())
589 OS << " ." << *cast<NamedDecl>(FD);
590 }
591 // If the union value is considered to be simple, fold it into the
592 // current line to save some vertical space.
593 const APValue &UnionValue = Value.getUnionValue();
594 if (isSimpleAPValue(UnionValue)) {
595 OS << ' ';
596 Visit(UnionValue, Ty);
597 } else {
598 AddChild([=] { Visit(UnionValue, Ty); });
599 }
600
601 return;
602 }
604 OS << "MemberPointer <todo>";
605 return;
607 OS << "AddrLabelDiff <todo>";
608 return;
609 }
610 llvm_unreachable("Unknown APValue kind!");
611}
612
613void TextNodeDumper::dumpPointer(const void *Ptr) {
614 ColorScope Color(OS, ShowColors, AddressColor);
615 OS << ' ' << Ptr;
616}
617
619 if (!SM)
620 return;
621
622 ColorScope Color(OS, ShowColors, LocationColor);
623 SourceLocation SpellingLoc = SM->getSpellingLoc(Loc);
624
625 // The general format we print out is filename:line:col, but we drop pieces
626 // that haven't changed since the last loc printed.
627 PresumedLoc PLoc = SM->getPresumedLoc(SpellingLoc);
628
629 if (PLoc.isInvalid()) {
630 OS << "<invalid sloc>";
631 return;
632 }
633
634 if (strcmp(PLoc.getFilename(), LastLocFilename) != 0) {
635 OS << PLoc.getFilename() << ':' << PLoc.getLine() << ':'
636 << PLoc.getColumn();
637 LastLocFilename = PLoc.getFilename();
638 LastLocLine = PLoc.getLine();
639 } else if (PLoc.getLine() != LastLocLine) {
640 OS << "line" << ':' << PLoc.getLine() << ':' << PLoc.getColumn();
641 LastLocLine = PLoc.getLine();
642 } else {
643 OS << "col" << ':' << PLoc.getColumn();
644 }
645}
646
648 // Can't translate locations if a SourceManager isn't available.
649 if (!SM)
650 return;
651
652 OS << " <";
654 if (R.getBegin() != R.getEnd()) {
655 OS << ", ";
656 dumpLocation(R.getEnd());
657 }
658 OS << ">";
659
660 // <t2.c:123:421[blah], t2.c:412:321>
661}
662
664 ColorScope Color(OS, ShowColors, TypeColor);
665
666 SplitQualType T_split = T.split();
667 OS << "'" << QualType::getAsString(T_split, PrintPolicy) << "'";
668
669 if (Desugar && !T.isNull()) {
670 // If the type is sugared, also dump a (shallow) desugared type.
672 if (T_split != D_split)
673 OS << ":'" << QualType::getAsString(D_split, PrintPolicy) << "'";
674 }
675}
676
678 OS << ' ';
679 dumpBareType(T);
680}
681
683 if (!D) {
684 ColorScope Color(OS, ShowColors, NullColor);
685 OS << "<<<NULL>>>";
686 return;
687 }
688
689 {
690 ColorScope Color(OS, ShowColors, DeclKindNameColor);
691 OS << D->getDeclKindName();
692 }
693 dumpPointer(D);
694
695 if (const NamedDecl *ND = dyn_cast<NamedDecl>(D)) {
696 ColorScope Color(OS, ShowColors, DeclNameColor);
697 OS << " '" << ND->getDeclName() << '\'';
698 }
699
700 if (const ValueDecl *VD = dyn_cast<ValueDecl>(D))
701 dumpType(VD->getType());
702}
703
705 if (ND->getDeclName()) {
706 ColorScope Color(OS, ShowColors, DeclNameColor);
707 OS << ' ' << ND->getDeclName();
708 }
709}
710
712 const auto AccessSpelling = getAccessSpelling(AS);
713 if (AccessSpelling.empty())
714 return;
715 OS << AccessSpelling;
716}
717
720 if (auto *BD = C.dyn_cast<BlockDecl *>())
721 dumpDeclRef(BD, "cleanup");
722 else if (auto *CLE = C.dyn_cast<CompoundLiteralExpr *>())
723 AddChild([=] {
724 OS << "cleanup ";
725 {
726 ColorScope Color(OS, ShowColors, StmtColor);
727 OS << CLE->getStmtClassName();
728 }
729 dumpPointer(CLE);
730 });
731 else
732 llvm_unreachable("unexpected cleanup type");
733}
734
735void TextNodeDumper::dumpDeclRef(const Decl *D, StringRef Label) {
736 if (!D)
737 return;
738
739 AddChild([=] {
740 if (!Label.empty())
741 OS << Label << ' ';
743 });
744}
745
746const char *TextNodeDumper::getCommandName(unsigned CommandID) {
747 if (Traits)
748 return Traits->getCommandInfo(CommandID)->Name;
749 const comments::CommandInfo *Info =
751 if (Info)
752 return Info->Name;
753 return "<not a builtin command>";
754}
755
756void TextNodeDumper::printFPOptions(FPOptionsOverride FPO) {
757#define OPTION(NAME, TYPE, WIDTH, PREVIOUS) \
758 if (FPO.has##NAME##Override()) \
759 OS << " " #NAME "=" << FPO.get##NAME##Override();
760#include "clang/Basic/FPOptions.def"
761}
762
764 const comments::FullComment *) {
765 OS << " Text=\"" << C->getText() << "\"";
766}
767
770 OS << " Name=\"" << getCommandName(C->getCommandID()) << "\"";
771 switch (C->getRenderKind()) {
773 OS << " RenderNormal";
774 break;
776 OS << " RenderBold";
777 break;
779 OS << " RenderMonospaced";
780 break;
782 OS << " RenderEmphasized";
783 break;
785 OS << " RenderAnchor";
786 break;
787 }
788
789 for (unsigned i = 0, e = C->getNumArgs(); i != e; ++i)
790 OS << " Arg[" << i << "]=\"" << C->getArgText(i) << "\"";
791}
792
795 OS << " Name=\"" << C->getTagName() << "\"";
796 if (C->getNumAttrs() != 0) {
797 OS << " Attrs: ";
798 for (unsigned i = 0, e = C->getNumAttrs(); i != e; ++i) {
800 OS << " \"" << Attr.Name << "=\"" << Attr.Value << "\"";
801 }
802 }
803 if (C->isSelfClosing())
804 OS << " SelfClosing";
805}
806
809 OS << " Name=\"" << C->getTagName() << "\"";
810}
811
814 OS << " Name=\"" << getCommandName(C->getCommandID()) << "\"";
815 for (unsigned i = 0, e = C->getNumArgs(); i != e; ++i)
816 OS << " Arg[" << i << "]=\"" << C->getArgText(i) << "\"";
817}
818
821 OS << " "
823
824 if (C->isDirectionExplicit())
825 OS << " explicitly";
826 else
827 OS << " implicitly";
828
829 if (C->hasParamName()) {
830 if (C->isParamIndexValid())
831 OS << " Param=\"" << C->getParamName(FC) << "\"";
832 else
833 OS << " Param=\"" << C->getParamNameAsWritten() << "\"";
834 }
835
836 if (C->isParamIndexValid() && !C->isVarArgParam())
837 OS << " ParamIndex=" << C->getParamIndex();
838}
839
842 if (C->hasParamName()) {
843 if (C->isPositionValid())
844 OS << " Param=\"" << C->getParamName(FC) << "\"";
845 else
846 OS << " Param=\"" << C->getParamNameAsWritten() << "\"";
847 }
848
849 if (C->isPositionValid()) {
850 OS << " Position=<";
851 for (unsigned i = 0, e = C->getDepth(); i != e; ++i) {
852 OS << C->getIndex(i);
853 if (i != e - 1)
854 OS << ", ";
855 }
856 OS << ">";
857 }
858}
859
862 OS << " Name=\"" << getCommandName(C->getCommandID())
863 << "\""
864 " CloseName=\""
865 << C->getCloseName() << "\"";
866}
867
870 const comments::FullComment *) {
871 OS << " Text=\"" << C->getText() << "\"";
872}
873
876 OS << " Text=\"" << C->getText() << "\"";
877}
878
880 OS << " null";
881}
882
884 OS << " type";
885 dumpType(TA.getAsType());
886}
887
889 const TemplateArgument &TA) {
890 OS << " decl";
892}
893
895 OS << " nullptr";
896}
897
899 OS << " integral " << TA.getAsIntegral();
900}
901
904 OS << " using";
905 OS << " template ";
906 TA.getAsTemplate().dump(OS);
907}
908
910 const TemplateArgument &TA) {
913 OS << " using";
914 OS << " template expansion ";
916}
917
919 OS << " expr";
920}
921
923 OS << " pack";
924}
925
926static void dumpBasePath(raw_ostream &OS, const CastExpr *Node) {
927 if (Node->path_empty())
928 return;
929
930 OS << " (";
931 bool First = true;
932 for (CastExpr::path_const_iterator I = Node->path_begin(),
933 E = Node->path_end();
934 I != E; ++I) {
935 const CXXBaseSpecifier *Base = *I;
936 if (!First)
937 OS << " -> ";
938
939 const auto *RD =
940 cast<CXXRecordDecl>(Base->getType()->castAs<RecordType>()->getDecl());
941
942 if (Base->isVirtual())
943 OS << "virtual ";
944 OS << RD->getName();
945 First = false;
946 }
947
948 OS << ')';
949}
950
952 if (Node->hasInitStorage())
953 OS << " has_init";
954 if (Node->hasVarStorage())
955 OS << " has_var";
956 if (Node->hasElseStorage())
957 OS << " has_else";
958 if (Node->isConstexpr())
959 OS << " constexpr";
960 if (Node->isConsteval()) {
961 OS << " ";
962 if (Node->isNegatedConsteval())
963 OS << "!";
964 OS << "consteval";
965 }
966}
967
969 if (Node->hasInitStorage())
970 OS << " has_init";
971 if (Node->hasVarStorage())
972 OS << " has_var";
973}
974
976 if (Node->hasVarStorage())
977 OS << " has_var";
978}
979
981 OS << " '" << Node->getName() << "'";
982 if (Node->isSideEntry())
983 OS << " side_entry";
984}
985
987 OS << " '" << Node->getLabel()->getName() << "'";
988 dumpPointer(Node->getLabel());
989}
990
992 if (Node->caseStmtIsGNURange())
993 OS << " gnu_range";
994}
995
997 if (Node->hasAPValueResult())
998 AddChild("value",
999 [=] { Visit(Node->getAPValueResult(), Node->getType()); });
1000}
1001
1003 if (Node->usesADL())
1004 OS << " adl";
1005 if (Node->hasStoredFPFeatures())
1006 printFPOptions(Node->getFPFeatures());
1007}
1008
1010 const char *OperatorSpelling = clang::getOperatorSpelling(Node->getOperator());
1011 if (OperatorSpelling)
1012 OS << " '" << OperatorSpelling << "'";
1013
1015}
1016
1018 OS << " <";
1019 {
1020 ColorScope Color(OS, ShowColors, CastColor);
1021 OS << Node->getCastKindName();
1022 }
1023 dumpBasePath(OS, Node);
1024 OS << ">";
1025 if (Node->hasStoredFPFeatures())
1026 printFPOptions(Node->getFPFeatures());
1027}
1028
1031 if (Node->isPartOfExplicitCast())
1032 OS << " part_of_explicit_cast";
1033}
1034
1036 OS << " ";
1037 dumpBareDeclRef(Node->getDecl());
1038 if (Node->getDecl() != Node->getFoundDecl()) {
1039 OS << " (";
1040 dumpBareDeclRef(Node->getFoundDecl());
1041 OS << ")";
1042 }
1043 switch (Node->isNonOdrUse()) {
1044 case NOUR_None: break;
1045 case NOUR_Unevaluated: OS << " non_odr_use_unevaluated"; break;
1046 case NOUR_Constant: OS << " non_odr_use_constant"; break;
1047 case NOUR_Discarded: OS << " non_odr_use_discarded"; break;
1048 }
1049}
1050
1052 const UnresolvedLookupExpr *Node) {
1053 OS << " (";
1054 if (!Node->requiresADL())
1055 OS << "no ";
1056 OS << "ADL) = '" << Node->getName() << '\'';
1057
1058 UnresolvedLookupExpr::decls_iterator I = Node->decls_begin(),
1059 E = Node->decls_end();
1060 if (I == E)
1061 OS << " empty";
1062 for (; I != E; ++I)
1063 dumpPointer(*I);
1064}
1065
1067 {
1068 ColorScope Color(OS, ShowColors, DeclKindNameColor);
1069 OS << " " << Node->getDecl()->getDeclKindName() << "Decl";
1070 }
1071 OS << "='" << *Node->getDecl() << "'";
1072 dumpPointer(Node->getDecl());
1073 if (Node->isFreeIvar())
1074 OS << " isFreeIvar";
1075}
1076
1079 dumpType(Node->getTypeSourceInfo()->getType());
1080}
1081
1083 OS << " " << PredefinedExpr::getIdentKindName(Node->getIdentKind());
1084}
1085
1087 ColorScope Color(OS, ShowColors, ValueColor);
1088 OS << " " << Node->getValue();
1089}
1090
1092 bool isSigned = Node->getType()->isSignedIntegerType();
1093 ColorScope Color(OS, ShowColors, ValueColor);
1094 OS << " " << toString(Node->getValue(), 10, isSigned);
1095}
1096
1098 ColorScope Color(OS, ShowColors, ValueColor);
1099 OS << " " << Node->getValueAsString(/*Radix=*/10);
1100}
1101
1103 ColorScope Color(OS, ShowColors, ValueColor);
1104 OS << " " << Node->getValueAsApproximateDouble();
1105}
1106
1108 ColorScope Color(OS, ShowColors, ValueColor);
1109 OS << " ";
1110 Str->outputString(OS);
1111}
1112
1114 if (auto *Field = ILE->getInitializedFieldInUnion()) {
1115 OS << " field ";
1116 dumpBareDeclRef(Field);
1117 }
1118}
1119
1121 if (E->isResultDependent())
1122 OS << " result_dependent";
1123}
1124
1126 OS << " " << (Node->isPostfix() ? "postfix" : "prefix") << " '"
1127 << UnaryOperator::getOpcodeStr(Node->getOpcode()) << "'";
1128 if (!Node->canOverflow())
1129 OS << " cannot overflow";
1130 if (Node->hasStoredFPFeatures())
1131 printFPOptions(Node->getStoredFPFeatures());
1132}
1133
1136 OS << " " << getTraitSpelling(Node->getKind());
1137
1138 if (Node->isArgumentType())
1139 dumpType(Node->getArgumentType());
1140}
1141
1143 OS << " " << (Node->isArrow() ? "->" : ".") << *Node->getMemberDecl();
1144 dumpPointer(Node->getMemberDecl());
1145 switch (Node->isNonOdrUse()) {
1146 case NOUR_None: break;
1147 case NOUR_Unevaluated: OS << " non_odr_use_unevaluated"; break;
1148 case NOUR_Constant: OS << " non_odr_use_constant"; break;
1149 case NOUR_Discarded: OS << " non_odr_use_discarded"; break;
1150 }
1151}
1152
1154 const ExtVectorElementExpr *Node) {
1155 OS << " " << Node->getAccessor().getNameStart();
1156}
1157
1159 OS << " '" << BinaryOperator::getOpcodeStr(Node->getOpcode()) << "'";
1160 if (Node->hasStoredFPFeatures())
1161 printFPOptions(Node->getStoredFPFeatures());
1162}
1163
1166 OS << " '" << BinaryOperator::getOpcodeStr(Node->getOpcode())
1167 << "' ComputeLHSTy=";
1168 dumpBareType(Node->getComputationLHSType());
1169 OS << " ComputeResultTy=";
1170 dumpBareType(Node->getComputationResultType());
1171 if (Node->hasStoredFPFeatures())
1172 printFPOptions(Node->getStoredFPFeatures());
1173}
1174
1176 OS << " " << Node->getLabel()->getName();
1177 dumpPointer(Node->getLabel());
1178}
1179
1181 OS << " " << Node->getCastName() << "<"
1182 << Node->getTypeAsWritten().getAsString() << ">"
1183 << " <" << Node->getCastKindName();
1184 dumpBasePath(OS, Node);
1185 OS << ">";
1186}
1187
1189 OS << " " << (Node->getValue() ? "true" : "false");
1190}
1191
1193 if (Node->isImplicit())
1194 OS << " implicit";
1195 OS << " this";
1196}
1197
1199 const CXXFunctionalCastExpr *Node) {
1200 OS << " functional cast to " << Node->getTypeAsWritten().getAsString() << " <"
1201 << Node->getCastKindName() << ">";
1202 if (Node->hasStoredFPFeatures())
1203 printFPOptions(Node->getFPFeatures());
1204}
1205
1208 if (Node->hasStoredFPFeatures())
1209 printFPOptions(Node->getFPFeatures());
1210}
1211
1214 dumpType(Node->getTypeAsWritten());
1215 if (Node->isListInitialization())
1216 OS << " list";
1217}
1218
1220 CXXConstructorDecl *Ctor = Node->getConstructor();
1221 dumpType(Ctor->getType());
1222 if (Node->isElidable())
1223 OS << " elidable";
1224 if (Node->isListInitialization())
1225 OS << " list";
1226 if (Node->isStdInitListInitialization())
1227 OS << " std::initializer_list";
1228 if (Node->requiresZeroInitialization())
1229 OS << " zeroing";
1230}
1231
1233 const CXXBindTemporaryExpr *Node) {
1234 OS << " (CXXTemporary";
1236 OS << ")";
1237}
1238
1240 if (Node->isGlobalNew())
1241 OS << " global";
1242 if (Node->isArray())
1243 OS << " array";
1244 if (Node->getOperatorNew()) {
1245 OS << ' ';
1246 dumpBareDeclRef(Node->getOperatorNew());
1247 }
1248 // We could dump the deallocation function used in case of error, but it's
1249 // usually not that interesting.
1250}
1251
1253 if (Node->isGlobalDelete())
1254 OS << " global";
1255 if (Node->isArrayForm())
1256 OS << " array";
1257 if (Node->getOperatorDelete()) {
1258 OS << ' ';
1259 dumpBareDeclRef(Node->getOperatorDelete());
1260 }
1261}
1262
1264 OS << " " << getTraitSpelling(Node->getTrait());
1265}
1266
1268 OS << " " << getTraitSpelling(Node->getTrait());
1269}
1270
1272 OS << " " << getTraitSpelling(Node->getTrait());
1273}
1274
1277 if (const ValueDecl *VD = Node->getExtendingDecl()) {
1278 OS << " extended by ";
1279 dumpBareDeclRef(VD);
1280 }
1281}
1282
1284 for (unsigned i = 0, e = Node->getNumObjects(); i != e; ++i)
1285 dumpCleanupObject(Node->getObject(i));
1286}
1287
1289 dumpPointer(Node->getPack());
1290 dumpName(Node->getPack());
1291}
1292
1295 OS << " " << (Node->isArrow() ? "->" : ".") << Node->getMember();
1296}
1297
1299 OS << " selector=";
1300 Node->getSelector().print(OS);
1301 switch (Node->getReceiverKind()) {
1303 break;
1304
1306 OS << " class=";
1307 dumpBareType(Node->getClassReceiver());
1308 break;
1309
1311 OS << " super (instance)";
1312 break;
1313
1315 OS << " super (class)";
1316 break;
1317 }
1318}
1319
1321 if (auto *BoxingMethod = Node->getBoxingMethod()) {
1322 OS << " selector=";
1323 BoxingMethod->getSelector().print(OS);
1324 }
1325}
1326
1328 if (!Node->getCatchParamDecl())
1329 OS << " catch all";
1330}
1331
1333 dumpType(Node->getEncodedType());
1334}
1335
1337 OS << " ";
1338 Node->getSelector().print(OS);
1339}
1340
1342 OS << ' ' << *Node->getProtocol();
1343}
1344
1346 if (Node->isImplicitProperty()) {
1347 OS << " Kind=MethodRef Getter=\"";
1348 if (Node->getImplicitPropertyGetter())
1349 Node->getImplicitPropertyGetter()->getSelector().print(OS);
1350 else
1351 OS << "(null)";
1352
1353 OS << "\" Setter=\"";
1354 if (ObjCMethodDecl *Setter = Node->getImplicitPropertySetter())
1355 Setter->getSelector().print(OS);
1356 else
1357 OS << "(null)";
1358 OS << "\"";
1359 } else {
1360 OS << " Kind=PropertyRef Property=\"" << *Node->getExplicitProperty()
1361 << '"';
1362 }
1363
1364 if (Node->isSuperReceiver())
1365 OS << " super";
1366
1367 OS << " Messaging=";
1368 if (Node->isMessagingGetter() && Node->isMessagingSetter())
1369 OS << "Getter&Setter";
1370 else if (Node->isMessagingGetter())
1371 OS << "Getter";
1372 else if (Node->isMessagingSetter())
1373 OS << "Setter";
1374}
1375
1377 const ObjCSubscriptRefExpr *Node) {
1378 if (Node->isArraySubscriptRefExpr())
1379 OS << " Kind=ArraySubscript GetterForArray=\"";
1380 else
1381 OS << " Kind=DictionarySubscript GetterForDictionary=\"";
1382 if (Node->getAtIndexMethodDecl())
1383 Node->getAtIndexMethodDecl()->getSelector().print(OS);
1384 else
1385 OS << "(null)";
1386
1387 if (Node->isArraySubscriptRefExpr())
1388 OS << "\" SetterForArray=\"";
1389 else
1390 OS << "\" SetterForDictionary=\"";
1391 if (Node->setAtIndexMethodDecl())
1392 Node->setAtIndexMethodDecl()->getSelector().print(OS);
1393 else
1394 OS << "(null)";
1395}
1396
1398 OS << " " << (Node->getValue() ? "__objc_yes" : "__objc_no");
1399}
1400
1402 OS << " ";
1403 for (unsigned I = 0, E = Node->numOfIterators(); I < E; ++I) {
1404 Visit(Node->getIteratorDecl(I));
1405 OS << " = ";
1406 const OMPIteratorExpr::IteratorRange Range = Node->getIteratorRange(I);
1407 OS << " begin ";
1408 Visit(Range.Begin);
1409 OS << " end ";
1410 Visit(Range.End);
1411 if (Range.Step) {
1412 OS << " step ";
1413 Visit(Range.Step);
1414 }
1415 }
1416}
1417
1420 OS << " ";
1421 dumpBareDeclRef(Node->getFoundDecl());
1422}
1423
1425 const RequiresExpr *Node) {
1426 if (!Node->isValueDependent())
1427 OS << (Node->isSatisfied() ? " satisfied" : " unsatisfied");
1428}
1429
1431 if (T->isSpelledAsLValue())
1432 OS << " written as lvalue reference";
1433}
1434
1436 switch (T->getSizeModifier()) {
1437 case ArrayType::Normal:
1438 break;
1439 case ArrayType::Static:
1440 OS << " static";
1441 break;
1442 case ArrayType::Star:
1443 OS << " *";
1444 break;
1445 }
1446 OS << " " << T->getIndexTypeQualifiers().getAsString();
1447}
1448
1450 OS << " " << T->getSize();
1451 VisitArrayType(T);
1452}
1453
1455 OS << " ";
1457 VisitArrayType(T);
1458}
1459
1461 const DependentSizedArrayType *T) {
1462 VisitArrayType(T);
1463 OS << " ";
1465}
1466
1468 const DependentSizedExtVectorType *T) {
1469 OS << " ";
1471}
1472
1474 switch (T->getVectorKind()) {
1476 break;
1478 OS << " altivec";
1479 break;
1481 OS << " altivec pixel";
1482 break;
1484 OS << " altivec bool";
1485 break;
1487 OS << " neon";
1488 break;
1490 OS << " neon poly";
1491 break;
1493 OS << " fixed-length sve data vector";
1494 break;
1496 OS << " fixed-length sve predicate vector";
1497 break;
1498 }
1499 OS << " " << T->getNumElements();
1500}
1501
1503 auto EI = T->getExtInfo();
1504 if (EI.getNoReturn())
1505 OS << " noreturn";
1506 if (EI.getProducesResult())
1507 OS << " produces_result";
1508 if (EI.getHasRegParm())
1509 OS << " regparm " << EI.getRegParm();
1510 OS << " " << FunctionType::getNameForCallConv(EI.getCC());
1511}
1512
1514 auto EPI = T->getExtProtoInfo();
1515 if (EPI.HasTrailingReturn)
1516 OS << " trailing_return";
1517 if (T->isConst())
1518 OS << " const";
1519 if (T->isVolatile())
1520 OS << " volatile";
1521 if (T->isRestrict())
1522 OS << " restrict";
1523 if (T->getExtProtoInfo().Variadic)
1524 OS << " variadic";
1525 switch (EPI.RefQualifier) {
1526 case RQ_None:
1527 break;
1528 case RQ_LValue:
1529 OS << " &";
1530 break;
1531 case RQ_RValue:
1532 OS << " &&";
1533 break;
1534 }
1535 // FIXME: Exception specification.
1536 // FIXME: Consumed parameters.
1538}
1539
1541 dumpDeclRef(T->getDecl());
1542}
1543
1546 if (!T->typeMatchesDecl())
1547 OS << " divergent";
1548}
1549
1551 dumpDeclRef(T->getDecl());
1552 if (!T->typeMatchesDecl())
1553 OS << " divergent";
1554}
1555
1557 switch (T->getUTTKind()) {
1558#define TRANSFORM_TYPE_TRAIT_DEF(Enum, Trait) \
1559 case UnaryTransformType::Enum: \
1560 OS << " " #Trait; \
1561 break;
1562#include "clang/Basic/TransformTypeTraits.def"
1563 }
1564}
1565
1567 dumpDeclRef(T->getDecl());
1568}
1569
1571 OS << " depth " << T->getDepth() << " index " << T->getIndex();
1572 if (T->isParameterPack())
1573 OS << " pack";
1574 dumpDeclRef(T->getDecl());
1575}
1576
1578 const SubstTemplateTypeParmType *T) {
1581 if (auto PackIndex = T->getPackIndex())
1582 OS << " pack_index " << *PackIndex;
1583}
1584
1589}
1590
1592 if (T->isDecltypeAuto())
1593 OS << " decltype(auto)";
1594 if (!T->isDeduced())
1595 OS << " undeduced";
1596 if (T->isConstrained()) {
1598 for (const auto &Arg : T->getTypeConstraintArguments())
1600 }
1601}
1602
1606 OS << " using";
1607}
1608
1610 const TemplateSpecializationType *T) {
1611 if (T->isTypeAlias())
1612 OS << " alias";
1614 OS << " using";
1615 OS << " ";
1616 T->getTemplateName().dump(OS);
1617}
1618
1620 const InjectedClassNameType *T) {
1621 dumpDeclRef(T->getDecl());
1622}
1623
1625 dumpDeclRef(T->getDecl());
1626}
1627
1629 if (auto N = T->getNumExpansions())
1630 OS << " expansions " << *N;
1631}
1632
1634
1636 dumpName(D);
1638 if (D->isModulePrivate())
1639 OS << " __module_private__";
1640}
1641
1643 if (D->isScoped()) {
1644 if (D->isScopedUsingClassTag())
1645 OS << " class";
1646 else
1647 OS << " struct";
1648 }
1649 dumpName(D);
1650 if (D->isModulePrivate())
1651 OS << " __module_private__";
1652 if (D->isFixed())
1654}
1655
1657 OS << ' ' << D->getKindName();
1658 dumpName(D);
1659 if (D->isModulePrivate())
1660 OS << " __module_private__";
1661 if (D->isCompleteDefinition())
1662 OS << " definition";
1663}
1664
1666 dumpName(D);
1667 dumpType(D->getType());
1668}
1669
1671 dumpName(D);
1672 dumpType(D->getType());
1673
1674 for (const auto *Child : D->chain())
1675 dumpDeclRef(Child);
1676}
1677
1679 dumpName(D);
1680 dumpType(D->getType());
1681
1682 StorageClass SC = D->getStorageClass();
1683 if (SC != SC_None)
1685 if (D->isInlineSpecified())
1686 OS << " inline";
1687 if (D->isVirtualAsWritten())
1688 OS << " virtual";
1689 if (D->isModulePrivate())
1690 OS << " __module_private__";
1691
1692 if (D->isPure())
1693 OS << " pure";
1694 if (D->isDefaulted()) {
1695 OS << " default";
1696 if (D->isDeleted())
1697 OS << "_delete";
1698 }
1699 if (D->isDeletedAsWritten())
1700 OS << " delete";
1701 if (D->isTrivial())
1702 OS << " trivial";
1703
1705 OS << (isa<CXXDestructorDecl>(D) ? " not_selected" : " ineligible");
1706
1707 if (const auto *FPT = D->getType()->getAs<FunctionProtoType>()) {
1708 FunctionProtoType::ExtProtoInfo EPI = FPT->getExtProtoInfo();
1709 switch (EPI.ExceptionSpec.Type) {
1710 default:
1711 break;
1712 case EST_Unevaluated:
1713 OS << " noexcept-unevaluated " << EPI.ExceptionSpec.SourceDecl;
1714 break;
1715 case EST_Uninstantiated:
1716 OS << " noexcept-uninstantiated " << EPI.ExceptionSpec.SourceTemplate;
1717 break;
1718 }
1719 }
1720
1721 if (const auto *MD = dyn_cast<CXXMethodDecl>(D)) {
1722 if (MD->size_overridden_methods() != 0) {
1723 auto dumpOverride = [=](const CXXMethodDecl *D) {
1724 SplitQualType T_split = D->getType().split();
1725 OS << D << " " << D->getParent()->getName() << "::" << D->getDeclName()
1726 << " '" << QualType::getAsString(T_split, PrintPolicy) << "'";
1727 };
1728
1729 AddChild([=] {
1730 auto Overrides = MD->overridden_methods();
1731 OS << "Overrides: [ ";
1732 dumpOverride(*Overrides.begin());
1733 for (const auto *Override :
1734 llvm::make_range(Overrides.begin() + 1, Overrides.end())) {
1735 OS << ", ";
1736 dumpOverride(Override);
1737 }
1738 OS << " ]";
1739 });
1740 }
1741 }
1742
1743 if (!D->isInlineSpecified() && D->isInlined()) {
1744 OS << " implicit-inline";
1745 }
1746 // Since NumParams comes from the FunctionProtoType of the FunctionDecl and
1747 // the Params are set later, it is possible for a dump during debugging to
1748 // encounter a FunctionDecl that has been created but hasn't been assigned
1749 // ParmVarDecls yet.
1750 if (!D->param_empty() && !D->param_begin())
1751 OS << " <<<NULL params x " << D->getNumParams() << ">>>";
1752}
1753
1756 OS << " extended by ";
1758 OS << " mangling ";
1759 {
1760 ColorScope Color(OS, ShowColors, ValueColor);
1761 OS << D->getManglingNumber();
1762 }
1763}
1764
1766 dumpName(D);
1767 dumpType(D->getType());
1768 if (D->isMutable())
1769 OS << " mutable";
1770 if (D->isModulePrivate())
1771 OS << " __module_private__";
1772}
1773
1775 dumpName(D);
1776 dumpType(D->getType());
1777 StorageClass SC = D->getStorageClass();
1778 if (SC != SC_None)
1780 switch (D->getTLSKind()) {
1781 case VarDecl::TLS_None:
1782 break;
1784 OS << " tls";
1785 break;
1787 OS << " tls_dynamic";
1788 break;
1789 }
1790 if (D->isModulePrivate())
1791 OS << " __module_private__";
1792 if (D->isNRVOVariable())
1793 OS << " nrvo";
1794 if (D->isInline())
1795 OS << " inline";
1796 if (D->isConstexpr())
1797 OS << " constexpr";
1798 if (D->hasInit()) {
1799 switch (D->getInitStyle()) {
1800 case VarDecl::CInit:
1801 OS << " cinit";
1802 break;
1803 case VarDecl::CallInit:
1804 OS << " callinit";
1805 break;
1806 case VarDecl::ListInit:
1807 OS << " listinit";
1808 break;
1810 OS << " parenlistinit";
1811 }
1812 }
1813 if (D->needsDestruction(D->getASTContext()))
1814 OS << " destroyed";
1815 if (D->isParameterPack())
1816 OS << " pack";
1817
1818 if (D->hasInit()) {
1819 const Expr *E = D->getInit();
1820 // Only dump the value of constexpr VarDecls for now.
1821 if (E && !E->isValueDependent() && D->isConstexpr()) {
1822 const APValue *Value = D->evaluateValue();
1823 if (Value)
1824 AddChild("value", [=] { Visit(*Value, E->getType()); });
1825 }
1826 }
1827}
1828
1830 dumpName(D);
1831 dumpType(D->getType());
1832}
1833
1835 if (D->isNothrow())
1836 OS << " nothrow";
1837}
1838
1840 OS << ' ' << D->getImportedModule()->getFullModuleName();
1841
1842 for (Decl *InitD :
1844 dumpDeclRef(InitD, "initializer");
1845}
1846
1848 OS << ' ';
1849 switch (D->getCommentKind()) {
1850 case PCK_Unknown:
1851 llvm_unreachable("unexpected pragma comment kind");
1852 case PCK_Compiler:
1853 OS << "compiler";
1854 break;
1855 case PCK_ExeStr:
1856 OS << "exestr";
1857 break;
1858 case PCK_Lib:
1859 OS << "lib";
1860 break;
1861 case PCK_Linker:
1862 OS << "linker";
1863 break;
1864 case PCK_User:
1865 OS << "user";
1866 break;
1867 }
1868 StringRef Arg = D->getArg();
1869 if (!Arg.empty())
1870 OS << " \"" << Arg << "\"";
1871}
1872
1874 const PragmaDetectMismatchDecl *D) {
1875 OS << " \"" << D->getName() << "\" \"" << D->getValue() << "\"";
1876}
1877
1879 const OMPExecutableDirective *D) {
1880 if (D->isStandaloneDirective())
1881 OS << " openmp_standalone_directive";
1882}
1883
1885 const OMPDeclareReductionDecl *D) {
1886 dumpName(D);
1887 dumpType(D->getType());
1888 OS << " combiner";
1890 if (const auto *Initializer = D->getInitializer()) {
1891 OS << " initializer";
1893 switch (D->getInitializerKind()) {
1895 OS << " omp_priv = ";
1896 break;
1898 OS << " omp_priv ()";
1899 break;
1901 break;
1902 }
1903 }
1904}
1905
1907 for (const auto *C : D->clauselists()) {
1908 AddChild([=] {
1909 if (!C) {
1910 ColorScope Color(OS, ShowColors, NullColor);
1911 OS << "<<<NULL>>> OMPClause";
1912 return;
1913 }
1914 {
1915 ColorScope Color(OS, ShowColors, AttrColor);
1916 StringRef ClauseName(
1917 llvm::omp::getOpenMPClauseName(C->getClauseKind()));
1918 OS << "OMP" << ClauseName.substr(/*Start=*/0, /*N=*/1).upper()
1919 << ClauseName.drop_front() << "Clause";
1920 }
1921 dumpPointer(C);
1922 dumpSourceRange(SourceRange(C->getBeginLoc(), C->getEndLoc()));
1923 });
1924 }
1925}
1926
1928 dumpName(D);
1929 dumpType(D->getType());
1930}
1931
1933 dumpName(D);
1934 if (D->isInline())
1935 OS << " inline";
1936 if (D->isNested())
1937 OS << " nested";
1938 if (!D->isOriginalNamespace())
1939 dumpDeclRef(D->getOriginalNamespace(), "original");
1940}
1941
1943 OS << ' ';
1945}
1946
1948 dumpName(D);
1950}
1951
1953 dumpName(D);
1955}
1956
1958 const TypeAliasTemplateDecl *D) {
1959 dumpName(D);
1960}
1961
1963 VisitRecordDecl(D);
1964 if (!D->isCompleteDefinition())
1965 return;
1966
1967 AddChild([=] {
1968 {
1969 ColorScope Color(OS, ShowColors, DeclKindNameColor);
1970 OS << "DefinitionData";
1971 }
1972#define FLAG(fn, name) \
1973 if (D->fn()) \
1974 OS << " " #name;
1975 FLAG(isParsingBaseSpecifiers, parsing_base_specifiers);
1976
1977 FLAG(isGenericLambda, generic);
1978 FLAG(isLambda, lambda);
1979
1980 FLAG(isAnonymousStructOrUnion, is_anonymous);
1981 FLAG(canPassInRegisters, pass_in_registers);
1982 FLAG(isEmpty, empty);
1983 FLAG(isAggregate, aggregate);
1984 FLAG(isStandardLayout, standard_layout);
1985 FLAG(isTriviallyCopyable, trivially_copyable);
1986 FLAG(isPOD, pod);
1987 FLAG(isTrivial, trivial);
1988 FLAG(isPolymorphic, polymorphic);
1989 FLAG(isAbstract, abstract);
1990 FLAG(isLiteral, literal);
1991
1992 FLAG(hasUserDeclaredConstructor, has_user_declared_ctor);
1993 FLAG(hasConstexprNonCopyMoveConstructor, has_constexpr_non_copy_move_ctor);
1994 FLAG(hasMutableFields, has_mutable_fields);
1995 FLAG(hasVariantMembers, has_variant_members);
1996 FLAG(allowConstDefaultInit, can_const_default_init);
1997
1998 AddChild([=] {
1999 {
2000 ColorScope Color(OS, ShowColors, DeclKindNameColor);
2001 OS << "DefaultConstructor";
2002 }
2003 FLAG(hasDefaultConstructor, exists);
2004 FLAG(hasTrivialDefaultConstructor, trivial);
2005 FLAG(hasNonTrivialDefaultConstructor, non_trivial);
2006 FLAG(hasUserProvidedDefaultConstructor, user_provided);
2007 FLAG(hasConstexprDefaultConstructor, constexpr);
2008 FLAG(needsImplicitDefaultConstructor, needs_implicit);
2009 FLAG(defaultedDefaultConstructorIsConstexpr, defaulted_is_constexpr);
2010 });
2011
2012 AddChild([=] {
2013 {
2014 ColorScope Color(OS, ShowColors, DeclKindNameColor);
2015 OS << "CopyConstructor";
2016 }
2017 FLAG(hasSimpleCopyConstructor, simple);
2018 FLAG(hasTrivialCopyConstructor, trivial);
2019 FLAG(hasNonTrivialCopyConstructor, non_trivial);
2020 FLAG(hasUserDeclaredCopyConstructor, user_declared);
2021 FLAG(hasCopyConstructorWithConstParam, has_const_param);
2022 FLAG(needsImplicitCopyConstructor, needs_implicit);
2023 FLAG(needsOverloadResolutionForCopyConstructor,
2024 needs_overload_resolution);
2026 FLAG(defaultedCopyConstructorIsDeleted, defaulted_is_deleted);
2027 FLAG(implicitCopyConstructorHasConstParam, implicit_has_const_param);
2028 });
2029
2030 AddChild([=] {
2031 {
2032 ColorScope Color(OS, ShowColors, DeclKindNameColor);
2033 OS << "MoveConstructor";
2034 }
2035 FLAG(hasMoveConstructor, exists);
2036 FLAG(hasSimpleMoveConstructor, simple);
2037 FLAG(hasTrivialMoveConstructor, trivial);
2038 FLAG(hasNonTrivialMoveConstructor, non_trivial);
2039 FLAG(hasUserDeclaredMoveConstructor, user_declared);
2040 FLAG(needsImplicitMoveConstructor, needs_implicit);
2041 FLAG(needsOverloadResolutionForMoveConstructor,
2042 needs_overload_resolution);
2044 FLAG(defaultedMoveConstructorIsDeleted, defaulted_is_deleted);
2045 });
2046
2047 AddChild([=] {
2048 {
2049 ColorScope Color(OS, ShowColors, DeclKindNameColor);
2050 OS << "CopyAssignment";
2051 }
2052 FLAG(hasSimpleCopyAssignment, simple);
2053 FLAG(hasTrivialCopyAssignment, trivial);
2054 FLAG(hasNonTrivialCopyAssignment, non_trivial);
2055 FLAG(hasCopyAssignmentWithConstParam, has_const_param);
2056 FLAG(hasUserDeclaredCopyAssignment, user_declared);
2057 FLAG(needsImplicitCopyAssignment, needs_implicit);
2058 FLAG(needsOverloadResolutionForCopyAssignment, needs_overload_resolution);
2059 FLAG(implicitCopyAssignmentHasConstParam, implicit_has_const_param);
2060 });
2061
2062 AddChild([=] {
2063 {
2064 ColorScope Color(OS, ShowColors, DeclKindNameColor);
2065 OS << "MoveAssignment";
2066 }
2067 FLAG(hasMoveAssignment, exists);
2068 FLAG(hasSimpleMoveAssignment, simple);
2069 FLAG(hasTrivialMoveAssignment, trivial);
2070 FLAG(hasNonTrivialMoveAssignment, non_trivial);
2071 FLAG(hasUserDeclaredMoveAssignment, user_declared);
2072 FLAG(needsImplicitMoveAssignment, needs_implicit);
2073 FLAG(needsOverloadResolutionForMoveAssignment, needs_overload_resolution);
2074 });
2075
2076 AddChild([=] {
2077 {
2078 ColorScope Color(OS, ShowColors, DeclKindNameColor);
2079 OS << "Destructor";
2080 }
2081 FLAG(hasSimpleDestructor, simple);
2082 FLAG(hasIrrelevantDestructor, irrelevant);
2083 FLAG(hasTrivialDestructor, trivial);
2084 FLAG(hasNonTrivialDestructor, non_trivial);
2085 FLAG(hasUserDeclaredDestructor, user_declared);
2086 FLAG(hasConstexprDestructor, constexpr);
2087 FLAG(needsImplicitDestructor, needs_implicit);
2088 FLAG(needsOverloadResolutionForDestructor, needs_overload_resolution);
2090 FLAG(defaultedDestructorIsDeleted, defaulted_is_deleted);
2091 });
2092 });
2093
2094 for (const auto &I : D->bases()) {
2095 AddChild([=] {
2096 if (I.isVirtual())
2097 OS << "virtual ";
2098 dumpAccessSpecifier(I.getAccessSpecifier());
2099 dumpType(I.getType());
2100 if (I.isPackExpansion())
2101 OS << "...";
2102 });
2103 }
2104}
2105
2107 dumpName(D);
2108}
2109
2111 dumpName(D);
2112}
2113
2115 dumpName(D);
2116}
2117
2119 dumpName(D);
2120}
2121
2123 if (const auto *TC = D->getTypeConstraint()) {
2124 OS << " ";
2125 dumpBareDeclRef(TC->getNamedConcept());
2126 if (TC->getNamedConcept() != TC->getFoundDecl()) {
2127 OS << " (";
2128 dumpBareDeclRef(TC->getFoundDecl());
2129 OS << ")";
2130 }
2131 } else if (D->wasDeclaredWithTypename())
2132 OS << " typename";
2133 else
2134 OS << " class";
2135 OS << " depth " << D->getDepth() << " index " << D->getIndex();
2136 if (D->isParameterPack())
2137 OS << " ...";
2138 dumpName(D);
2139}
2140
2142 const NonTypeTemplateParmDecl *D) {
2143 dumpType(D->getType());
2144 OS << " depth " << D->getDepth() << " index " << D->getIndex();
2145 if (D->isParameterPack())
2146 OS << " ...";
2147 dumpName(D);
2148}
2149
2151 const TemplateTemplateParmDecl *D) {
2152 OS << " depth " << D->getDepth() << " index " << D->getIndex();
2153 if (D->isParameterPack())
2154 OS << " ...";
2155 dumpName(D);
2156}
2157
2159 OS << ' ';
2160 if (D->getQualifier())
2162 OS << D->getDeclName();
2163}
2164
2166 OS << ' ';
2168}
2169
2171 const UnresolvedUsingTypenameDecl *D) {
2172 OS << ' ';
2173 if (D->getQualifier())
2175 OS << D->getDeclName();
2176}
2177
2179 const UnresolvedUsingValueDecl *D) {
2180 OS << ' ';
2181 if (D->getQualifier())
2183 OS << D->getDeclName();
2184 dumpType(D->getType());
2185}
2186
2188 OS << ' ';
2190}
2191
2193 const ConstructorUsingShadowDecl *D) {
2194 if (D->constructsVirtualBase())
2195 OS << " virtual";
2196
2197 AddChild([=] {
2198 OS << "target ";
2200 });
2201
2202 AddChild([=] {
2203 OS << "nominated ";
2205 OS << ' ';
2207 });
2208
2209 AddChild([=] {
2210 OS << "constructed ";
2212 OS << ' ';
2214 });
2215}
2216
2218 switch (D->getLanguage()) {
2220 OS << " C";
2221 break;
2223 OS << " C++";
2224 break;
2225 }
2226}
2227
2229 OS << ' ';
2231}
2232
2234 if (TypeSourceInfo *T = D->getFriendType())
2235 dumpType(T->getType());
2236}
2237
2239 dumpName(D);
2240 dumpType(D->getType());
2241 if (D->getSynthesize())
2242 OS << " synthesize";
2243
2244 switch (D->getAccessControl()) {
2245 case ObjCIvarDecl::None:
2246 OS << " none";
2247 break;
2249 OS << " private";
2250 break;
2252 OS << " protected";
2253 break;
2255 OS << " public";
2256 break;
2258 OS << " package";
2259 break;
2260 }
2261}
2262
2264 if (D->isInstanceMethod())
2265 OS << " -";
2266 else
2267 OS << " +";
2268 dumpName(D);
2269 dumpType(D->getReturnType());
2270
2271 if (D->isVariadic())
2272 OS << " variadic";
2273}
2274
2276 dumpName(D);
2277 switch (D->getVariance()) {
2279 break;
2280
2282 OS << " covariant";
2283 break;
2284
2286 OS << " contravariant";
2287 break;
2288 }
2289
2290 if (D->hasExplicitBound())
2291 OS << " bounded";
2293}
2294
2296 dumpName(D);
2299 for (const auto *P : D->protocols())
2300 dumpDeclRef(P);
2301}
2302
2304 dumpName(D);
2307}
2308
2310 dumpName(D);
2311
2312 for (const auto *Child : D->protocols())
2313 dumpDeclRef(Child);
2314}
2315
2317 dumpName(D);
2318 dumpDeclRef(D->getSuperClass(), "super");
2319
2321 for (const auto *Child : D->protocols())
2322 dumpDeclRef(Child);
2323}
2324
2326 const ObjCImplementationDecl *D) {
2327 dumpName(D);
2328 dumpDeclRef(D->getSuperClass(), "super");
2330}
2331
2333 const ObjCCompatibleAliasDecl *D) {
2334 dumpName(D);
2336}
2337
2339 dumpName(D);
2340 dumpType(D->getType());
2341
2343 OS << " required";
2345 OS << " optional";
2346
2350 OS << " readonly";
2352 OS << " assign";
2354 OS << " readwrite";
2356 OS << " retain";
2358 OS << " copy";
2360 OS << " nonatomic";
2362 OS << " atomic";
2364 OS << " weak";
2366 OS << " strong";
2368 OS << " unsafe_unretained";
2370 OS << " class";
2372 OS << " direct";
2374 dumpDeclRef(D->getGetterMethodDecl(), "getter");
2376 dumpDeclRef(D->getSetterMethodDecl(), "setter");
2377 }
2378}
2379
2383 OS << " synthesize";
2384 else
2385 OS << " dynamic";
2388}
2389
2391 if (D->isVariadic())
2392 OS << " variadic";
2393
2394 if (D->capturesCXXThis())
2395 OS << " captures_this";
2396}
2397
2399 dumpName(D);
2400}
2401
2403 VisitStmt(S);
2404 if (S->hasStoredFPFeatures())
2405 printFPOptions(S->getStoredFPFeatures());
2406}
2407
2409 if (D->isCBuffer())
2410 OS << " cbuffer";
2411 else
2412 OS << " tbuffer";
2413 dumpName(D);
2414}
static double GetApproxValue(const llvm::APFloat &F)
Definition: APValue.cpp:620
#define V(N, I)
Definition: ASTContext.h:3217
DynTypedNode Node
#define SM(sm)
Definition: Cuda.cpp:78
static bool isTrivial(ASTContext &Ctx, const Expr *E)
Checks if the expression is constant or does not have non-trivial function calls.
static CompilationDatabasePluginRegistry::Add< FixedCompilationDatabasePlugin > X("fixed-compilation-database", "Reads plain-text flags file")
This file defines OpenMP nodes for declarative directives.
Defines the C++ template declaration subclasses.
Defines the clang::Module class, which describes a module in the source code.
static std::string toString(const clang::SanitizerSet &Sanitizers)
Produce a string containing comma-separated names of sanitizers in Sanitizers set.
static bool canPassInRegisters(Sema &S, CXXRecordDecl *D, TargetInfo::CallingConvKind CCK)
Determine whether a type is permitted to be passed or returned in registers, per C++ [class....
Defines the SourceManager interface.
Defines various enumerations that describe declaration and type specifiers.
static bool isSimpleAPValue(const APValue &Value)
True if the APValue Value can be folded onto the current line.
#define FLAG(fn, name)
static void dumpBasePath(raw_ostream &OS, const CastExpr *Node)
static void dumpPreviousDeclImpl(raw_ostream &OS,...)
static void dumpPreviousDecl(raw_ostream &OS, const Decl *D)
Dump the previous declaration in the redeclaration chain for a declaration, if any.
Defines enumerations for the type traits support.
C Language Family Type Representation.
std::string Label
APValue - This class implements a discriminated union of [uninitialized] [APSInt] [APFloat],...
Definition: APValue.h:122
APValue & getArrayInitializedElt(unsigned I)
Definition: APValue.h:502
APValue & getStructField(unsigned i)
Definition: APValue.h:543
unsigned getStructNumFields() const
Definition: APValue.h:534
unsigned getStructNumBases() const
Definition: APValue.h:530
APValue & getUnionValue()
Definition: APValue.h:559
APValue & getVectorElt(unsigned I)
Definition: APValue.h:489
@ Indeterminate
This object has an indeterminate value (C++ [basic.indet]).
Definition: APValue.h:131
@ None
There is no such object (it's outside its lifetime).
Definition: APValue.h:129
APValue & getStructBase(unsigned i)
Definition: APValue.h:538
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:182
ArrayRef< Decl * > getModuleInitializers(Module *M)
Get the initializations to perform when importing a module, if any.
const clang::PrintingPolicy & getPrintingPolicy() const
Definition: ASTContext.h:684
ArrayRef< Module * > getModulesWithMergedDefinition(const NamedDecl *Def)
Get the additional modules in which the definition Def has been merged.
Represents an access specifier followed by colon ':'.
Definition: DeclCXX.h:86
AddrLabelExpr - The GNU address of label extension, representing &&label.
Definition: Expr.h:4311
An Embarcadero array type trait, as used in the implementation of __array_rank and __array_extent.
Definition: ExprCXX.h:2827
Represents an array type, per C99 6.7.5.2 - Array Declarators.
Definition: Type.h:3031
ArraySizeModifier getSizeModifier() const
Definition: Type.h:3054
Qualifiers getIndexTypeQualifiers() const
Definition: Type.h:3058
Attr - This represents one attribute.
Definition: Attr.h:40
attr::Kind getKind() const
Definition: Attr.h:80
bool isInherited() const
Definition: Attr.h:89
bool isImplicit() const
Returns true if the attribute has been implicitly created instead of explicitly written by the user.
Definition: Attr.h:93
Represents a C++11 auto or C++14 decltype(auto) type, possibly constrained by a type-constraint.
Definition: Type.h:5267
ArrayRef< TemplateArgument > getTypeConstraintArguments() const
Definition: Type.h:5277
bool isDecltypeAuto() const
Definition: Type.h:5290
ConceptDecl * getTypeConstraintConcept() const
Definition: Type.h:5282
bool isConstrained() const
Definition: Type.h:5286
A builtin binary operation expression such as "x + y" or "x <= y".
Definition: Expr.h:3814
StringRef getOpcodeStr() const
Definition: Expr.h:3879
A binding in a decomposition declaration.
Definition: DeclCXX.h:4039
A class which contains all the information about a particular captured value.
Definition: Decl.h:4340
Represents a block literal declaration, which is like an unnamed FunctionDecl.
Definition: Decl.h:4334
bool capturesCXXThis() const
Definition: Decl.h:4466
bool isVariadic() const
Definition: Decl.h:4409
Represents the builtin template declaration which is used to implement __make_integer_seq and other b...
Represents a base class of a C++ class.
Definition: DeclCXX.h:146
Represents binding an expression to a temporary.
Definition: ExprCXX.h:1470
A boolean literal, per ([C++ lex.bool] Boolean literals).
Definition: ExprCXX.h:720
Represents a call to a C++ constructor.
Definition: ExprCXX.h:1518
Represents a C++ constructor within a class.
Definition: DeclCXX.h:2470
Represents a C++ base or member initializer.
Definition: DeclCXX.h:2238
Represents a delete expression for memory deallocation and destructor calls, e.g.
Definition: ExprCXX.h:2473
Represents a C++ member access expression where the actual member referenced could not be resolved be...
Definition: ExprCXX.h:3627
Represents an explicit C++ type conversion that uses "functional" notation (C++ [expr....
Definition: ExprCXX.h:1787
Represents a static or instance method of a struct/union/class.
Definition: DeclCXX.h:2014
Abstract class common to all of the C++ "named"/"keyword" casts.
Definition: ExprCXX.h:372
Represents a new-expression for memory allocation and constructor calls, e.g: "new CXXNewExpr(foo)".
Definition: ExprCXX.h:2199
A call to an overloaded operator written using operator syntax.
Definition: ExprCXX.h:81
Represents a C++ struct/union/class.
Definition: DeclCXX.h:254
base_class_range bases()
Definition: DeclCXX.h:602
bool needsOverloadResolutionForMoveConstructor() const
Determine whether we need to eagerly declare a defaulted move constructor for this class.
Definition: DeclCXX.h:889
bool needsOverloadResolutionForDestructor() const
Determine whether we need to eagerly declare a destructor for this class.
Definition: DeclCXX.h:1000
bool needsOverloadResolutionForCopyConstructor() const
Determine whether we need to eagerly declare a defaulted copy constructor for this class.
Definition: DeclCXX.h:799
A C++ static_cast expression (C++ [expr.static.cast]).
Definition: ExprCXX.h:433
Represents the this expression in C++.
Definition: ExprCXX.h:1148
Describes an explicit type conversion that uses functional notion but could not be resolved because o...
Definition: ExprCXX.h:3503
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
Definition: Expr.h:2812
Represents the body of a CapturedStmt, and serves as its DeclContext.
Definition: Decl.h:4526
bool isNothrow() const
Definition: Decl.cpp:5138
CaseStmt - Represent a case statement.
Definition: Stmt.h:1613
CastExpr - Base class for type casts, including both implicit casts (ImplicitCastExpr) and explicit c...
Definition: Expr.h:3482
const CXXBaseSpecifier *const * path_const_iterator
Definition: Expr.h:3549
Declaration of a class template.
CompoundAssignOperator - For compound assignments (e.g.
Definition: Expr.h:4061
CompoundLiteralExpr - [C99 6.5.2.5].
Definition: Expr.h:3412
CompoundStmt - This represents a group of statements like { stmt stmt }.
Definition: Stmt.h:1420
Declaration of a C++20 concept.
Represents the specialization of a concept - evaluates to a prvalue of type bool.
Definition: ExprConcepts.h:41
Represents the canonical version of C arrays with a specified constant size.
Definition: Type.h:3079
const llvm::APInt & getSize() const
Definition: Type.h:3100
ConstantExpr - An expression that occurs in a constant context and optionally the result of evaluatin...
Definition: Expr.h:1045
Represents a shadow constructor declaration introduced into a class by a C++11 using-declaration that...
Definition: DeclCXX.h:3531
CXXRecordDecl * getConstructedBaseClass() const
Get the base class whose constructor or constructor shadow declaration is passed the constructor argu...
Definition: DeclCXX.h:3621
bool constructsVirtualBase() const
Returns true if the constructed base class is a virtual base class subobject of this declaration's cl...
Definition: DeclCXX.h:3630
ConstructorUsingShadowDecl * getConstructedBaseClassShadowDecl() const
Get the inheriting constructor declaration for the base class for which we don't have an explicit ini...
Definition: DeclCXX.h:3611
ConstructorUsingShadowDecl * getNominatedBaseClassShadowDecl() const
Get the inheriting constructor declaration for the direct base class from which this using shadow dec...
Definition: DeclCXX.h:3605
CXXRecordDecl * getNominatedBaseClass() const
Get the base class that was named in the using declaration.
Definition: DeclCXX.cpp:3066
DeclContext * getParent()
getParent - Returns the containing DeclContext.
Definition: DeclBase.h:1933
A reference to a declared variable, function, enum, etc.
Definition: Expr.h:1238
Decl - This represents one declaration (or definition), e.g.
Definition: DeclBase.h:83
ASTContext & getASTContext() const LLVM_READONLY
Definition: DeclBase.cpp:428
bool isImplicit() const
isImplicit - Indicates whether the declaration was implicitly generated by the implementation.
Definition: DeclBase.h:576
Module * getOwningModule() const
Get the module that owns this declaration (for visibility purposes).
Definition: DeclBase.h:808
bool isFromASTFile() const
Determine whether this declaration came from an AST file (such as a precompiled header or module) rat...
Definition: DeclBase.h:751
bool isInvalidDecl() const
Definition: DeclBase.h:571
SourceLocation getLocation() const
Definition: DeclBase.h:432
const char * getDeclKindName() const
Definition: DeclBase.cpp:123
bool isThisDeclarationReferenced() const
Whether this declaration was referenced.
Definition: DeclBase.h:604
bool isUsed(bool CheckUsedAttr=true) const
Whether any (re-)declaration of the entity was used, meaning that a definition is required.
Definition: DeclBase.cpp:457
DeclContext * getDeclContext()
Definition: DeclBase.h:441
AccessSpecifier getAccess() const
Definition: DeclBase.h:491
DeclContext * getLexicalDeclContext()
getLexicalDeclContext - The declaration context where this Decl was lexically declared (LexicalDC).
Definition: DeclBase.h:883
Kind getKind() const
Definition: DeclBase.h:435
virtual SourceRange getSourceRange() const LLVM_READONLY
Source range that this declaration covers.
Definition: DeclBase.h:420
Represents a C++17 deduced template specialization type.
Definition: Type.h:5315
TemplateName getTemplateName() const
Retrieve the name of the template that we are deducing.
Definition: Type.h:5335
bool isDeduced() const
Definition: Type.h:5255
Represents an array type in C++ whose size is a value-dependent expression.
Definition: Type.h:3235
SourceRange getBracketsRange() const
Definition: Type.h:3263
Represents an extended vector type where either the type or size is dependent.
Definition: Type.h:3337
SourceLocation getAttributeLoc() const
Definition: Type.h:3354
SourceRange getSourceRange() const
For nodes which represent textual entities in the source code, return their SourceRange.
void print(llvm::raw_ostream &OS, const PrintingPolicy &PP) const
Prints the node to the given output stream.
An instance of this object exists for each enum constant that is defined.
Definition: Decl.h:3160
Represents an enum.
Definition: Decl.h:3720
bool isScoped() const
Returns true if this is a C++11 scoped enumeration.
Definition: Decl.h:3925
bool isScopedUsingClassTag() const
Returns true if this is a C++11 scoped enumeration.
Definition: Decl.h:3928
bool isFixed() const
Returns true if this is an Objective-C, C++11, or Microsoft-style enumeration with a fixed underlying...
Definition: Decl.h:3934
QualType getIntegerType() const
Return the integer type this enum decl corresponds to.
Definition: Decl.h:3880
Represents an expression – generally a full-expression – that introduces cleanups to be run at the en...
Definition: ExprCXX.h:3420
llvm::PointerUnion< BlockDecl *, CompoundLiteralExpr * > CleanupObject
The type of objects that are kept in the cleanup.
Definition: ExprCXX.h:3426
This represents one expression.
Definition: Expr.h:110
bool isValueDependent() const
Determines whether the value of this expression depends on.
Definition: Expr.h:169
QualType getType() const
Definition: Expr.h:142
An expression trait intrinsic.
Definition: ExprCXX.h:2897
ExtVectorElementExpr - This represents access to specific elements of a vector, and may occur on the ...
Definition: Expr.h:5915
Represents difference between two FPOptions values.
Definition: LangOptions.h:806
Represents a member of a struct/union/class.
Definition: Decl.h:2941
bool isMutable() const
Determines whether this field is mutable (C++ only).
Definition: Decl.h:3016
FriendDecl - Represents the declaration of a friend entity, which can be a function,...
Definition: DeclFriend.h:54
TypeSourceInfo * getFriendType() const
If this friend declaration names an (untemplated but possibly dependent) type, return the type; other...
Definition: DeclFriend.h:121
Represents a function declaration or definition.
Definition: Decl.h:1917
bool isPure() const
Whether this virtual function is pure, i.e.
Definition: Decl.h:2255
bool isInlined() const
Determine whether this function should be inlined, because it is either marked "inline" or "constexpr...
Definition: Decl.h:2712
bool isTrivial() const
Whether this function is "trivial" in some specialized C++ senses.
Definition: Decl.h:2272
param_iterator param_begin()
Definition: Decl.h:2594
bool isDeleted() const
Whether this function has been deleted.
Definition: Decl.h:2420
StorageClass getStorageClass() const
Returns the storage class as written in the source.
Definition: Decl.h:2679
bool isDeletedAsWritten() const
Definition: Decl.h:2424
bool param_empty() const
Definition: Decl.h:2593
bool isDefaulted() const
Whether this function is defaulted.
Definition: Decl.h:2280
bool isIneligibleOrNotSelected() const
Definition: Decl.h:2313
bool isVirtualAsWritten() const
Whether this function is marked as virtual explicitly.
Definition: Decl.h:2246
unsigned getNumParams() const
Return the number of parameters this function must have based on its FunctionType.
Definition: Decl.cpp:3489
bool isInlineSpecified() const
Determine whether the "inline" keyword was specified for this function.
Definition: Decl.h:2690
Represents a prototype with parameter type info, e.g.
Definition: Type.h:4041
ExtProtoInfo getExtProtoInfo() const
Definition: Type.h:4257
Declaration of a template function.
FunctionType - C99 6.7.5.3 - Function Declarators.
Definition: Type.h:3694
ExtInfo getExtInfo() const
Definition: Type.h:3971
static StringRef getNameForCallConv(CallingConv CC)
Definition: Type.cpp:3215
bool isConst() const
Definition: Type.h:3977
bool isRestrict() const
Definition: Type.h:3979
bool isVolatile() const
Definition: Type.h:3978
Represents a C11 generic selection.
Definition: Expr.h:5636
AssociationTy< true > ConstAssociation
Definition: Expr.h:5791
bool isResultDependent() const
Whether this generic selection is result-dependent.
Definition: Expr.h:5811
GotoStmt - This represents a direct goto.
Definition: Stmt.h:2649
HLSLBufferDecl - Represent a cbuffer or tbuffer declaration.
Definition: Decl.h:4780
bool isCBuffer() const
Definition: Decl.h:4808
IfStmt - This represents an if/then/else.
Definition: Stmt.h:1950
ImplicitCastExpr - Allows us to explicitly represent implicit type conversions, which have no direct ...
Definition: Expr.h:3629
Describes a module import declaration, which makes the contents of the named module visible in the cu...
Definition: Decl.h:4639
Module * getImportedModule() const
Retrieve the module that was imported by the import declaration.
Definition: Decl.h:4697
Represents a field injected from an anonymous union/struct into the parent scope.
Definition: Decl.h:3200
ArrayRef< NamedDecl * > chain() const
Definition: Decl.h:3221
Describes an C or C++ initializer list.
Definition: Expr.h:4800
FieldDecl * getInitializedFieldInUnion()
If this initializes a union, specifies which field in the union to initialize.
Definition: Expr.h:4912
The injected class name of a C++ class template or class template partial specialization.
Definition: Type.h:5509
CXXRecordDecl * getDecl() const
Definition: Type.cpp:3708
Represents the declaration of a label.
Definition: Decl.h:494
LabelStmt - Represents a label, which has a substatement.
Definition: Stmt.h:1843
Implicit declaration of a temporary that was materialized by a MaterializeTemporaryExpr and lifetime-...
Definition: DeclCXX.h:3162
unsigned getManglingNumber() const
Definition: DeclCXX.h:3211
Represents a linkage specification.
Definition: DeclCXX.h:2863
LanguageIDs getLanguage() const
Return the language specified by this linkage specification.
Definition: DeclCXX.h:2892
Represents a prvalue temporary that is written into memory so that a reference can bind to it.
Definition: ExprCXX.h:4562
MemberExpr - [C99 6.5.2.3] Structure and Union Members.
Definition: Expr.h:3175
Provides common interface for the Decls that cannot be redeclared, but can be merged if the same decl...
Definition: Redeclarable.h:314
decl_type * getFirstDecl()
Return the first declaration of this declaration or itself if this is the only declaration.
Definition: Redeclarable.h:320
Describes a module or submodule.
Definition: Module.h:98
std::string getFullModuleName(bool AllowStringLiterals=false) const
Retrieve the full name of this module, including the path from its top-level module.
Definition: Module.cpp:239
This represents a decl that may have a name.
Definition: Decl.h:247
bool isModulePrivate() const
Whether this declaration was marked as being private to the module in which it was defined.
Definition: DeclBase.h:625
DeclarationName getDeclName() const
Get the actual, stored name of the declaration, which may be a special name.
Definition: Decl.h:313
Represents a C++ namespace alias.
Definition: DeclCXX.h:3053
NamedDecl * getAliasedNamespace() const
Retrieve the namespace that this alias refers to, which may either be a NamespaceDecl or a NamespaceA...
Definition: DeclCXX.h:3148
Represent a C++ namespace.
Definition: Decl.h:542
bool isOriginalNamespace() const
Return true if this declaration is an original (first) declaration of the namespace.
Definition: DeclCXX.cpp:2940
bool isInline() const
Returns true if this is an inline namespace declaration.
Definition: Decl.h:605
NamespaceDecl * getOriginalNamespace()
Get the original (first) namespace declaration.
Definition: DeclCXX.cpp:2926
bool isNested() const
Returns true if this is a nested namespace declaration.
Definition: Decl.h:622
void print(raw_ostream &OS, const PrintingPolicy &Policy, bool ResolveTemplateArguments=false) const
Print this nested name specifier to the given output stream.
NonTypeTemplateParmDecl - Declares a non-type template parameter, e.g., "Size" in.
bool isParameterPack() const
Whether this parameter is a non-type template parameter pack.
unsigned getIndex() const
Get the index of the template parameter within its parameter list.
unsigned getDepth() const
Get the nesting depth of the template parameter.
Pseudo declaration for capturing expressions.
Definition: DeclOpenMP.h:383
This is a basic class for representing single OpenMP clause.
Definition: OpenMPClause.h:55
This represents '#pragma omp declare reduction ...' directive.
Definition: DeclOpenMP.h:171
Expr * getInitializer()
Get initializer expression (if specified) of the declare reduction construct.
Definition: DeclOpenMP.h:239
Expr * getCombiner()
Get combiner expression of the declare reduction construct.
Definition: DeclOpenMP.h:221
InitKind getInitializerKind() const
Get initializer kind.
Definition: DeclOpenMP.h:242
This is a basic class for representing single OpenMP executable directive.
Definition: StmtOpenMP.h:266
bool isStandaloneDirective() const
Returns whether or not this is a Standalone directive.
Definition: StmtOpenMP.cpp:58
OpenMP 5.0 [2.1.6 Iterators] Iterators are identifiers that expand to multiple values in the clause o...
Definition: ExprOpenMP.h:275
This represents '#pragma omp requires...' directive.
Definition: DeclOpenMP.h:416
clauselist_range clauselists()
Definition: DeclOpenMP.h:441
Represents Objective-C's @catch statement.
Definition: StmtObjC.h:77
ObjCBoolLiteralExpr - Objective-C Boolean Literal.
Definition: ExprObjC.h:87
ObjCBoxedExpr - used for generalized expression boxing.
Definition: ExprObjC.h:127
ObjCCategoryDecl - Represents a category declaration.
Definition: DeclObjC.h:2312
ObjCCategoryImplDecl * getImplementation() const
Definition: DeclObjC.cpp:2169
ObjCInterfaceDecl * getClassInterface()
Definition: DeclObjC.h:2357
protocol_range protocols() const
Definition: DeclObjC.h:2388
ObjCCategoryImplDecl - An object of this class encapsulates a category @implementation declaration.
Definition: DeclObjC.h:2531
ObjCCategoryDecl * getCategoryDecl() const
Definition: DeclObjC.cpp:2213
ObjCCompatibleAliasDecl - Represents alias of a class.
Definition: DeclObjC.h:2759
const ObjCInterfaceDecl * getClassInterface() const
Definition: DeclObjC.h:2777
ObjCEncodeExpr, used for @encode in Objective-C.
Definition: ExprObjC.h:409
const ObjCInterfaceDecl * getClassInterface() const
Definition: DeclObjC.h:2472
ObjCImplementationDecl - Represents a class definition - this is where method definitions are specifi...
Definition: DeclObjC.h:2584
const ObjCInterfaceDecl * getSuperClass() const
Definition: DeclObjC.h:2719
Represents an ObjC class declaration.
Definition: DeclObjC.h:1147
protocol_range protocols() const
Definition: DeclObjC.h:1347
ObjCImplementationDecl * getImplementation() const
Definition: DeclObjC.cpp:1635
ObjCInterfaceDecl * getSuperClass() const
Definition: DeclObjC.cpp:351
Interfaces are the core concept in Objective-C for object oriented design.
Definition: Type.h:6241
ObjCInterfaceDecl * getDecl() const
Get the declaration of this interface.
Definition: Type.cpp:827
ObjCIvarDecl - Represents an ObjC instance variable.
Definition: DeclObjC.h:1939
AccessControl getAccessControl() const
Definition: DeclObjC.h:1988
bool getSynthesize() const
Definition: DeclObjC.h:1995
ObjCIvarRefExpr - A reference to an ObjC instance variable.
Definition: ExprObjC.h:548
An expression that sends a message to the given Objective-C object or class.
Definition: ExprObjC.h:942
@ SuperInstance
The receiver is the instance of the superclass object.
Definition: ExprObjC.h:1097
@ Instance
The receiver is an object instance.
Definition: ExprObjC.h:1091
@ SuperClass
The receiver is a superclass.
Definition: ExprObjC.h:1094
@ Class
The receiver is a class.
Definition: ExprObjC.h:1088
ObjCMethodDecl - Represents an instance or class method declaration.
Definition: DeclObjC.h:138
bool isVariadic() const
Definition: DeclObjC.h:433
bool isInstanceMethod() const
Definition: DeclObjC.h:428
QualType getReturnType() const
Definition: DeclObjC.h:331
Represents one property declaration in an Objective-C interface.
Definition: DeclObjC.h:729
ObjCMethodDecl * getGetterMethodDecl() const
Definition: DeclObjC.h:894
ObjCMethodDecl * getSetterMethodDecl() const
Definition: DeclObjC.h:897
QualType getType() const
Definition: DeclObjC.h:797
ObjCPropertyAttribute::Kind getPropertyAttributes() const
Definition: DeclObjC.h:808
PropertyControl getPropertyImplementation() const
Definition: DeclObjC.h:905
ObjCPropertyImplDecl - Represents implementation declaration of a property in a class or category imp...
Definition: DeclObjC.h:2789
ObjCIvarDecl * getPropertyIvarDecl() const
Definition: DeclObjC.h:2862
Kind getPropertyImplementation() const
Definition: DeclObjC.h:2858
ObjCPropertyDecl * getPropertyDecl() const
Definition: DeclObjC.h:2853
ObjCPropertyRefExpr - A dot-syntax expression to access an ObjC property.
Definition: ExprObjC.h:614
Represents an Objective-C protocol declaration.
Definition: DeclObjC.h:2069
protocol_range protocols() const
Definition: DeclObjC.h:2144
ObjCProtocolExpr used for protocol expression in Objective-C.
Definition: ExprObjC.h:504
ObjCSelectorExpr used for @selector in Objective-C.
Definition: ExprObjC.h:454
ObjCSubscriptRefExpr - used for array and dictionary subscripting.
Definition: ExprObjC.h:841
Represents the declaration of an Objective-C type parameter.
Definition: DeclObjC.h:579
bool hasExplicitBound() const
Whether this type parameter has an explicitly-written type bound, e.g., "T : NSView".
Definition: DeclObjC.h:639
ObjCTypeParamVariance getVariance() const
Determine the variance of this type parameter.
Definition: DeclObjC.h:622
Represents a pack expansion of types.
Definition: Type.h:5858
std::optional< unsigned > getNumExpansions() const
Retrieve the number of expansions that this pack expansion will generate, if known.
Definition: Type.h:5883
Represents a #pragma comment line.
Definition: Decl.h:140
StringRef getArg() const
Definition: Decl.h:163
PragmaMSCommentKind getCommentKind() const
Definition: Decl.h:161
Represents a #pragma detect_mismatch line.
Definition: Decl.h:174
StringRef getName() const
Definition: Decl.h:195
StringRef getValue() const
Definition: Decl.h:196
[C99 6.4.2.2] - A predefined identifier such as func.
Definition: Expr.h:1972
StringRef getIdentKindName() const
Definition: Expr.h:2038
Represents an unpacked "presumed" location which can be presented to the user.
unsigned getColumn() const
Return the presumed column number of this location.
const char * getFilename() const
Return the presumed filename of this location.
unsigned getLine() const
Return the presumed line number of this location.
bool isInvalid() const
Return true if this object is invalid or uninitialized.
A (possibly-)qualified type.
Definition: Type.h:736
bool isNull() const
Return true if this QualType doesn't point to a type yet.
Definition: Type.h:803
SplitQualType getSplitDesugaredType() const
Definition: Type.h:1057
SplitQualType split() const
Divides a QualType into its unqualified type and a set of local qualifiers.
Definition: Type.h:6670
std::string getAsString() const
void * getAsOpaquePtr() const
Definition: Type.h:783
std::string getAsString() const
Represents a struct/union/class.
Definition: Decl.h:3998
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
Definition: Type.h:4835
RecordDecl * getDecl() const
Definition: Type.h:4845
Provides common interface for the Decls that can be redeclared.
Definition: Redeclarable.h:84
decl_type * getPreviousDecl()
Return the previous declaration of this declaration or NULL if this is the first declaration.
Definition: Redeclarable.h:204
Base for LValueReferenceType and RValueReferenceType.
Definition: Type.h:2899
bool isSpelledAsLValue() const
Definition: Type.h:2912
C++2a [expr.prim.req]: A requires-expression provides a concise way to express requirements on templa...
Definition: ExprConcepts.h:478
Represents an expression that computes the length of a parameter pack.
Definition: ExprCXX.h:4202
Encodes a location in the source.
PresumedLoc getPresumedLoc(SourceLocation Loc, bool UseLineDirectives=true) const
Returns the "presumed" location of a SourceLocation specifies.
SourceLocation getSpellingLoc(SourceLocation Loc) const
Given a SourceLocation object, return the spelling location referenced by the ID.
A trivial tuple used to represent a source range.
SourceLocation getEnd() const
SourceLocation getBegin() const
bool isValid() const
RetTy Visit(PTR(Stmt) S, ParamTys... P)
Definition: StmtVisitor.h:43
Stmt - This represents one statement.
Definition: Stmt.h:72
StringLiteral - This represents a string literal expression, e.g.
Definition: Expr.h:1781
void outputString(raw_ostream &OS) const
Definition: Expr.cpp:1207
Represents the result of substituting a set of types for a template type parameter pack.
Definition: Type.h:5175
Decl * getAssociatedDecl() const
A template-like entity which owns the whole pattern being substituted.
Definition: Type.cpp:3758
const TemplateTypeParmDecl * getReplacedParameter() const
Gets the template parameter declaration that was substituted for.
Definition: Type.cpp:3767
Represents the result of substituting a type for a template type parameter.
Definition: Type.h:5105
Decl * getAssociatedDecl() const
A template-like entity which owns the whole pattern being substituted.
Definition: Type.h:5126
std::optional< unsigned > getPackIndex() const
Definition: Type.h:5135
const TemplateTypeParmDecl * getReplacedParameter() const
Gets the template parameter declaration that was substituted for.
Definition: Type.cpp:3741
SwitchStmt - This represents a 'switch' stmt.
Definition: Stmt.h:2195
StringRef getKindName() const
Definition: Decl.h:3631
bool isCompleteDefinition() const
Return true if this decl has its body fully specified.
Definition: Decl.h:3543
TagDecl * getDecl() const
Definition: Type.cpp:3610
Represents a template argument.
Definition: TemplateBase.h:60
QualType getAsType() const
Retrieve the type for a type template argument.
Definition: TemplateBase.h:287
llvm::APSInt getAsIntegral() const
Retrieve the template argument as an integral value.
Definition: TemplateBase.h:331
TemplateName getAsTemplate() const
Retrieve the template name for a template name argument.
Definition: TemplateBase.h:311
ValueDecl * getAsDecl() const
Retrieve the declaration for a declaration non-type template argument.
Definition: TemplateBase.h:294
TemplateName getAsTemplateOrTemplatePattern() const
Retrieve the template argument as a template name; if the argument is a pack expansion,...
Definition: TemplateBase.h:318
NameKind getKind() const
@ UsingTemplate
A template name that refers to a template declaration found through a specific using shadow declarati...
Definition: TemplateName.h:247
void dump(raw_ostream &OS) const
Debugging aid that dumps the template name.
Represents a type template specialization; the template must be a class template, a type alias templa...
Definition: Type.h:5377
TemplateName getTemplateName() const
Retrieve the name of the template that we are specializing.
Definition: Type.h:5443
bool isTypeAlias() const
Determine if this template specialization type is for a type alias template that has been substituted...
Definition: Type.h:5436
TemplateTemplateParmDecl - Declares a template template parameter, e.g., "T" in.
bool isParameterPack() const
Whether this template template parameter is a template parameter pack.
unsigned getIndex() const
Get the index of the template parameter within its parameter list.
unsigned getDepth() const
Get the nesting depth of the template parameter.
Declaration of a template type parameter.
bool wasDeclaredWithTypename() const
Whether this template type parameter was declared with the 'typename' keyword.
unsigned getIndex() const
Retrieve the index of the template parameter.
const TypeConstraint * getTypeConstraint() const
Returns the type constraint associated with this template parameter (if any).
bool isParameterPack() const
Returns whether this is a parameter pack.
unsigned getDepth() const
Retrieve the depth of the template parameter.
TemplateTypeParmDecl * getDecl() const
Definition: Type.h:5068
bool isParameterPack() const
Definition: Type.h:5066
unsigned getIndex() const
Definition: Type.h:5065
unsigned getDepth() const
Definition: Type.h:5064
void VisitCXXFunctionalCastExpr(const CXXFunctionalCastExpr *Node)
void VisitEnumDecl(const EnumDecl *D)
void VisitExprWithCleanups(const ExprWithCleanups *Node)
void visitInlineCommandComment(const comments::InlineCommandComment *C, const comments::FullComment *)
void VisitCXXStaticCastExpr(const CXXStaticCastExpr *Node)
void visitVerbatimBlockComment(const comments::VerbatimBlockComment *C, const comments::FullComment *)
void dumpPointer(const void *Ptr)
void VisitDeclarationTemplateArgument(const TemplateArgument &TA)
void VisitLinkageSpecDecl(const LinkageSpecDecl *D)
void VisitVectorType(const VectorType *T)
void VisitUnaryOperator(const UnaryOperator *Node)
void dumpAccessSpecifier(AccessSpecifier AS)
void VisitDeducedTemplateSpecializationType(const DeducedTemplateSpecializationType *T)
void VisitObjCSelectorExpr(const ObjCSelectorExpr *Node)
void VisitCXXOperatorCallExpr(const CXXOperatorCallExpr *Node)
void VisitCXXUnresolvedConstructExpr(const CXXUnresolvedConstructExpr *Node)
void VisitPragmaCommentDecl(const PragmaCommentDecl *D)
void VisitImportDecl(const ImportDecl *D)
void VisitUsingEnumDecl(const UsingEnumDecl *D)
void VisitOMPCapturedExprDecl(const OMPCapturedExprDecl *D)
void VisitUnresolvedUsingType(const UnresolvedUsingType *T)
void VisitObjCProtocolExpr(const ObjCProtocolExpr *Node)
void VisitIntegralTemplateArgument(const TemplateArgument &TA)
void VisitObjCCategoryDecl(const ObjCCategoryDecl *D)
void VisitIndirectFieldDecl(const IndirectFieldDecl *D)
void VisitNullTemplateArgument(const TemplateArgument &TA)
void VisitPackTemplateArgument(const TemplateArgument &TA)
void VisitUsingType(const UsingType *T)
void VisitInjectedClassNameType(const InjectedClassNameType *T)
void VisitBinaryOperator(const BinaryOperator *Node)
void VisitUnresolvedLookupExpr(const UnresolvedLookupExpr *Node)
void VisitObjCInterfaceDecl(const ObjCInterfaceDecl *D)
void VisitBlockDecl(const BlockDecl *D)
void VisitCXXDeleteExpr(const CXXDeleteExpr *Node)
void VisitObjCBoxedExpr(const ObjCBoxedExpr *Node)
void VisitNullPtrTemplateArgument(const TemplateArgument &TA)
void VisitVarTemplateDecl(const VarTemplateDecl *D)
void VisitSubstTemplateTypeParmPackType(const SubstTemplateTypeParmPackType *T)
void VisitConceptSpecializationExpr(const ConceptSpecializationExpr *Node)
TextNodeDumper(raw_ostream &OS, const ASTContext &Context, bool ShowColors)
void VisitPredefinedExpr(const PredefinedExpr *Node)
void dumpType(QualType T)
void VisitObjCEncodeExpr(const ObjCEncodeExpr *Node)
void VisitHLSLBufferDecl(const HLSLBufferDecl *D)
void VisitUnresolvedUsingValueDecl(const UnresolvedUsingValueDecl *D)
void VisitNamespaceAliasDecl(const NamespaceAliasDecl *D)
void VisitObjCMessageExpr(const ObjCMessageExpr *Node)
void dumpSourceRange(SourceRange R)
void VisitMemberExpr(const MemberExpr *Node)
void VisitCompoundStmt(const CompoundStmt *Node)
void VisitConstantExpr(const ConstantExpr *Node)
void VisitObjCIvarRefExpr(const ObjCIvarRefExpr *Node)
void VisitMaterializeTemporaryExpr(const MaterializeTemporaryExpr *Node)
void VisitConstructorUsingShadowDecl(const ConstructorUsingShadowDecl *D)
void VisitWhileStmt(const WhileStmt *Node)
void VisitCharacterLiteral(const CharacterLiteral *Node)
void VisitAccessSpecDecl(const AccessSpecDecl *D)
void VisitFunctionType(const FunctionType *T)
void VisitObjCImplementationDecl(const ObjCImplementationDecl *D)
void VisitAutoType(const AutoType *T)
void VisitObjCInterfaceType(const ObjCInterfaceType *T)
void visitVerbatimLineComment(const comments::VerbatimLineComment *C, const comments::FullComment *)
void VisitTypedefDecl(const TypedefDecl *D)
void VisitUnaryExprOrTypeTraitExpr(const UnaryExprOrTypeTraitExpr *Node)
void visitParamCommandComment(const comments::ParamCommandComment *C, const comments::FullComment *FC)
void VisitIntegerLiteral(const IntegerLiteral *Node)
void VisitObjCProtocolDecl(const ObjCProtocolDecl *D)
void VisitGotoStmt(const GotoStmt *Node)
void VisitDependentSizedExtVectorType(const DependentSizedExtVectorType *T)
void VisitFriendDecl(const FriendDecl *D)
void VisitSwitchStmt(const SwitchStmt *Node)
void VisitCXXBindTemporaryExpr(const CXXBindTemporaryExpr *Node)
void VisitFunctionTemplateDecl(const FunctionTemplateDecl *D)
void VisitTemplateTemplateParmDecl(const TemplateTemplateParmDecl *D)
void VisitUsingDecl(const UsingDecl *D)
void VisitConstantArrayType(const ConstantArrayType *T)
void VisitTypeTemplateArgument(const TemplateArgument &TA)
void VisitObjCPropertyDecl(const ObjCPropertyDecl *D)
void VisitObjCCategoryImplDecl(const ObjCCategoryImplDecl *D)
void VisitObjCSubscriptRefExpr(const ObjCSubscriptRefExpr *Node)
void VisitArrayType(const ArrayType *T)
void visitHTMLEndTagComment(const comments::HTMLEndTagComment *C, const comments::FullComment *)
void VisitObjCAtCatchStmt(const ObjCAtCatchStmt *Node)
void visitTextComment(const comments::TextComment *C, const comments::FullComment *)
void VisitLifetimeExtendedTemporaryDecl(const LifetimeExtendedTemporaryDecl *D)
void VisitCXXRecordDecl(const CXXRecordDecl *D)
void VisitTemplateTemplateArgument(const TemplateArgument &TA)
void dumpCleanupObject(const ExprWithCleanups::CleanupObject &C)
void VisitCaseStmt(const CaseStmt *Node)
void VisitRValueReferenceType(const ReferenceType *T)
void VisitPackExpansionType(const PackExpansionType *T)
void VisitConceptDecl(const ConceptDecl *D)
void VisitCallExpr(const CallExpr *Node)
void VisitCapturedDecl(const CapturedDecl *D)
void VisitBuiltinTemplateDecl(const BuiltinTemplateDecl *D)
void VisitObjCPropertyRefExpr(const ObjCPropertyRefExpr *Node)
void VisitOMPDeclareReductionDecl(const OMPDeclareReductionDecl *D)
void VisitSizeOfPackExpr(const SizeOfPackExpr *Node)
void VisitDeclRefExpr(const DeclRefExpr *Node)
void VisitLabelStmt(const LabelStmt *Node)
void Visit(const comments::Comment *C, const comments::FullComment *FC)
void VisitLabelDecl(const LabelDecl *D)
void VisitUnaryTransformType(const UnaryTransformType *T)
void VisitStringLiteral(const StringLiteral *Str)
void VisitOMPRequiresDecl(const OMPRequiresDecl *D)
void dumpBareType(QualType T, bool Desugar=true)
void VisitTemplateSpecializationType(const TemplateSpecializationType *T)
void VisitTemplateTypeParmDecl(const TemplateTypeParmDecl *D)
void VisitCompoundAssignOperator(const CompoundAssignOperator *Node)
void VisitCXXThisExpr(const CXXThisExpr *Node)
void dumpName(const NamedDecl *ND)
void VisitArrayTypeTraitExpr(const ArrayTypeTraitExpr *Node)
void VisitObjCIvarDecl(const ObjCIvarDecl *D)
void VisitFieldDecl(const FieldDecl *D)
void dumpDeclRef(const Decl *D, StringRef Label={})
void VisitRecordDecl(const RecordDecl *D)
void VisitCXXNewExpr(const CXXNewExpr *Node)
void VisitObjCBoolLiteralExpr(const ObjCBoolLiteralExpr *Node)
void VisitCastExpr(const CastExpr *Node)
void VisitObjCTypeParamDecl(const ObjCTypeParamDecl *D)
void VisitSubstTemplateTypeParmType(const SubstTemplateTypeParmType *T)
void VisitExpressionTraitExpr(const ExpressionTraitExpr *Node)
void VisitAddrLabelExpr(const AddrLabelExpr *Node)
void VisitUnresolvedUsingTypenameDecl(const UnresolvedUsingTypenameDecl *D)
void VisitCXXDependentScopeMemberExpr(const CXXDependentScopeMemberExpr *Node)
void visitBlockCommandComment(const comments::BlockCommandComment *C, const comments::FullComment *)
void VisitExpressionTemplateArgument(const TemplateArgument &TA)
void VisitTypeAliasDecl(const TypeAliasDecl *D)
void VisitVarDecl(const VarDecl *D)
void VisitFixedPointLiteral(const FixedPointLiteral *Node)
void VisitOMPIteratorExpr(const OMPIteratorExpr *Node)
void VisitUsingDirectiveDecl(const UsingDirectiveDecl *D)
void VisitObjCMethodDecl(const ObjCMethodDecl *D)
void VisitObjCPropertyImplDecl(const ObjCPropertyImplDecl *D)
void VisitUsingShadowDecl(const UsingShadowDecl *D)
void VisitNamespaceDecl(const NamespaceDecl *D)
void VisitTypeAliasTemplateDecl(const TypeAliasTemplateDecl *D)
void VisitCXXBoolLiteralExpr(const CXXBoolLiteralExpr *Node)
void VisitIfStmt(const IfStmt *Node)
void VisitCXXConstructExpr(const CXXConstructExpr *Node)
void VisitFunctionProtoType(const FunctionProtoType *T)
void dumpLocation(SourceLocation Loc)
void VisitDependentSizedArrayType(const DependentSizedArrayType *T)
void VisitOMPExecutableDirective(const OMPExecutableDirective *D)
void VisitImplicitCastExpr(const ImplicitCastExpr *Node)
void VisitCXXNamedCastExpr(const CXXNamedCastExpr *Node)
void VisitTagType(const TagType *T)
void VisitTemplateExpansionTemplateArgument(const TemplateArgument &TA)
void VisitSYCLUniqueStableNameExpr(const SYCLUniqueStableNameExpr *Node)
void VisitNonTypeTemplateParmDecl(const NonTypeTemplateParmDecl *D)
void VisitFunctionDecl(const FunctionDecl *D)
void visitTParamCommandComment(const comments::TParamCommandComment *C, const comments::FullComment *FC)
void VisitTypeTraitExpr(const TypeTraitExpr *Node)
void dumpBareDeclRef(const Decl *D)
void VisitExtVectorElementExpr(const ExtVectorElementExpr *Node)
void visitVerbatimBlockLineComment(const comments::VerbatimBlockLineComment *C, const comments::FullComment *)
void VisitFloatingLiteral(const FloatingLiteral *Node)
void VisitInitListExpr(const InitListExpr *ILE)
void VisitRequiresExpr(const RequiresExpr *Node)
void VisitVariableArrayType(const VariableArrayType *T)
void VisitGenericSelectionExpr(const GenericSelectionExpr *E)
void VisitTemplateTypeParmType(const TemplateTypeParmType *T)
void visitHTMLStartTagComment(const comments::HTMLStartTagComment *C, const comments::FullComment *)
void VisitEnumConstantDecl(const EnumConstantDecl *D)
void VisitPragmaDetectMismatchDecl(const PragmaDetectMismatchDecl *D)
void VisitObjCCompatibleAliasDecl(const ObjCCompatibleAliasDecl *D)
void VisitClassTemplateDecl(const ClassTemplateDecl *D)
void VisitBindingDecl(const BindingDecl *D)
void VisitTypedefType(const TypedefType *T)
void AddChild(Fn DoAddChild)
Add a child of the current node. Calls DoAddChild without arguments.
Represents the declaration of a typedef-name via a C++11 alias-declaration.
Definition: Decl.h:3412
Declaration of an alias template.
A container of type source information.
Definition: Type.h:6620
QualType getType() const
Return the type wrapped by this type source info.
Definition: Type.h:6631
A type trait used in the implementation of various C++11 and Library TR1 trait templates.
Definition: ExprCXX.h:2742
RetTy Visit(const Type *T)
Performs the operation associated with this visitor object.
Definition: TypeVisitor.h:68
The base class of the type hierarchy.
Definition: Type.h:1566
QualType getLocallyUnqualifiedSingleStepDesugaredType() const
Pull a single level of sugar off of this locally-unqualified type.
Definition: Type.cpp:422
bool isInstantiationDependentType() const
Determine whether this type is an instantiation-dependent type, meaning that the type involves a temp...
Definition: Type.h:2325
bool isDependentType() const
Whether this type is a dependent type, meaning that its definition somehow depends on a template para...
Definition: Type.h:2317
bool containsUnexpandedParameterPack() const
Whether this type is or contains an unexpanded parameter pack, used to support C++0x variadic templat...
Definition: Type.h:2005
const char * getTypeClassName() const
Definition: Type.cpp:3006
bool containsErrors() const
Whether this type is an error type.
Definition: Type.h:2311
bool isVariablyModifiedType() const
Whether this type is a variably-modified type (C99 6.7.5).
Definition: Type.h:2335
bool isFromAST() const
Whether this type comes from an AST file.
Definition: Type.h:1988
const T * getAs() const
Member-template getAs<specific type>'.
Definition: Type.h:7424
Represents the declaration of a typedef-name via the 'typedef' type specifier.
Definition: Decl.h:3392
QualType getUnderlyingType() const
Definition: Decl.h:3345
TypedefNameDecl * getDecl() const
Definition: Type.h:4565
bool typeMatchesDecl() const
Definition: Type.h:4573
UnaryExprOrTypeTraitExpr - expression with either a type or (unevaluated) expression operand.
Definition: Expr.h:2560
UnaryOperator - This represents the unary-expression's (except sizeof and alignof),...
Definition: Expr.h:2176
static StringRef getOpcodeStr(Opcode Op)
getOpcodeStr - Turn an Opcode enum value into the punctuation char it corresponds to,...
Definition: Expr.cpp:1389
A unary type transform, which is a type constructed from another.
Definition: Type.h:4752
UTTKind getUTTKind() const
Definition: Type.h:4781
A reference to a name which we were able to look up during parsing but could not resolve to a specifi...
Definition: ExprCXX.h:3151
The iterator over UnresolvedSets.
Definition: UnresolvedSet.h:35
Represents the dependent type named by a dependently-scoped typename using declaration,...
Definition: Type.h:4491
UnresolvedUsingTypenameDecl * getDecl() const
Definition: Type.h:4502
Represents a dependent using declaration which was marked with typename.
Definition: DeclCXX.h:3891
NestedNameSpecifier * getQualifier() const
Retrieve the nested-name-specifier that qualifies the name.
Definition: DeclCXX.h:3928
Represents a dependent using declaration which was not marked with typename.
Definition: DeclCXX.h:3794
NestedNameSpecifier * getQualifier() const
Retrieve the nested-name-specifier that qualifies the name.
Definition: DeclCXX.h:3838
Represents a C++ using-declaration.
Definition: DeclCXX.h:3445
NestedNameSpecifier * getQualifier() const
Retrieve the nested-name-specifier that qualifies the name.
Definition: DeclCXX.h:3482
Represents C++ using-directive.
Definition: DeclCXX.h:2948
NamespaceDecl * getNominatedNamespace()
Returns the namespace nominated by this using-directive.
Definition: DeclCXX.cpp:2889
Represents a C++ using-enum-declaration.
Definition: DeclCXX.h:3645
EnumDecl * getEnumDecl() const
Definition: DeclCXX.h:3689
Represents a shadow declaration implicitly introduced into a scope by a (resolved) using-declaration ...
Definition: DeclCXX.h:3253
NamedDecl * getTargetDecl() const
Gets the underlying declaration which has been brought into the local scope.
Definition: DeclCXX.h:3317
UsingShadowDecl * getFoundDecl() const
Definition: Type.h:4531
bool typeMatchesDecl() const
Definition: Type.h:4540
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
Definition: Decl.h:701
QualType getType() const
Definition: Decl.h:712
Represents a variable declaration or definition.
Definition: Decl.h:913
bool isConstexpr() const
Whether this variable is (C++11) constexpr.
Definition: Decl.h:1519
TLSKind getTLSKind() const
Definition: Decl.cpp:2112
bool hasInit() const
Definition: Decl.cpp:2343
InitializationStyle getInitStyle() const
The style of initialization for this declaration.
Definition: Decl.h:1416
static const char * getStorageClassSpecifierString(StorageClass SC)
Return the string used to specify the storage class SC.
Definition: Decl.cpp:2065
@ ListInit
Direct list-initialization (C++11)
Definition: Decl.h:924
@ CInit
C-style initialization with assignment.
Definition: Decl.h:918
@ ParenListInit
Parenthesized list-initialization (C++20)
Definition: Decl.h:927
@ CallInit
Call-style initialization (C++98)
Definition: Decl.h:921
APValue * evaluateValue() const
Attempt to evaluate the value of the initializer attached to this declaration, and produce notes expl...
Definition: Decl.cpp:2491
bool isNRVOVariable() const
Determine whether this local variable can be used with the named return value optimization (NRVO).
Definition: Decl.h:1462
QualType::DestructionKind needsDestruction(const ASTContext &Ctx) const
Would the destruction of this variable have any effect, and if so, what kind?
Definition: Decl.cpp:2755
bool isInline() const
Whether this variable is (C++1z) inline.
Definition: Decl.h:1501
const Expr * getInit() const
Definition: Decl.h:1325
@ TLS_Static
TLS with a known-constant initializer.
Definition: Decl.h:936
@ TLS_Dynamic
TLS with a dynamic initializer.
Definition: Decl.h:939
@ TLS_None
Not a TLS variable.
Definition: Decl.h:933
StorageClass getStorageClass() const
Returns the storage class as written in the source.
Definition: Decl.h:1125
bool isParameterPack() const
Determine whether this variable is actually a function parameter pack or init-capture pack.
Definition: Decl.cpp:2598
Declaration of a variable template.
Represents a C array with a specified size that is not an integer-constant-expression.
Definition: Type.h:3181
SourceRange getBracketsRange() const
Definition: Type.h:3206
Represents a GCC generic vector type.
Definition: Type.h:3377
unsigned getNumElements() const
Definition: Type.h:3419
@ AltiVecBool
is AltiVec 'vector bool ...'
Definition: Type.h:3390
@ SveFixedLengthPredicateVector
is AArch64 SVE fixed-length predicate vector
Definition: Type.h:3402
@ NeonPolyVector
is ARM Neon polynomial vector
Definition: Type.h:3396
@ GenericVector
not a target-specific vector type
Definition: Type.h:3381
@ AltiVecPixel
is AltiVec 'vector Pixel'
Definition: Type.h:3387
@ SveFixedLengthDataVector
is AArch64 SVE fixed-length data vector
Definition: Type.h:3399
@ AltiVecVector
is AltiVec vector
Definition: Type.h:3384
@ NeonVector
is ARM Neon vector
Definition: Type.h:3393
VectorKind getVectorKind() const
Definition: Type.h:3424
WhileStmt - This represents a 'while' stmt.
Definition: Stmt.h:2386
RetTy Visit(PTR(Attr) A)
Definition: AttrVisitor.h:31
A command that has zero or more word-like arguments (number of word-like arguments depends on command...
Definition: Comment.h:588
static const CommandInfo * getBuiltinCommandInfo(StringRef Name)
const CommandInfo * getCommandInfo(StringRef Name) const
RetTy visit(PTR(Comment) C, ParamTys... P)
Any part of the comment.
Definition: Comment.h:52
A full comment attached to a declaration, contains block content.
Definition: Comment.h:1077
An opening HTML tag with attributes.
Definition: Comment.h:411
A command with word-like arguments that is considered inline content.
Definition: Comment.h:302
Doxygen \param command.
Definition: Comment.h:694
static const char * getDirectionAsString(PassDirection D)
Definition: Comment.cpp:187
Doxygen \tparam command, describes a template parameter.
Definition: Comment.h:782
A verbatim block command (e.
Definition: Comment.h:874
A line of text contained in a verbatim block.
Definition: Comment.h:846
A verbatim line command.
Definition: Comment.h:926
A static requirement that can be used in a requires-expression to check properties of types and expre...
Definition: ExprConcepts.h:146
RequirementKind getKind() const
Definition: ExprConcepts.h:173
bool containsUnexpandedParameterPack() const
Definition: ExprConcepts.h:193
RetTy Visit(PTR(Decl) D)
Definition: DeclVisitor.h:37
RetTy Visit(REF(TemplateArgument) TA, ParamTys... P)
RetTy VisitTemplateArgument(REF(TemplateArgument), ParamTys...)
static const TerminalColor NullColor
static const TerminalColor ErrorsColor
static const TerminalColor CommentColor
static const TerminalColor DeclNameColor
llvm::StringRef getAccessSpelling(AccessSpecifier AS)
Definition: Specifiers.h:383
static const TerminalColor AddressColor
@ PCK_ExeStr
Definition: PragmaKinds.h:19
@ PCK_Compiler
Definition: PragmaKinds.h:18
@ PCK_Linker
Definition: PragmaKinds.h:16
@ PCK_Lib
Definition: PragmaKinds.h:17
@ PCK_Unknown
Definition: PragmaKinds.h:15
@ PCK_User
Definition: PragmaKinds.h:20
@ RQ_None
No ref-qualifier was provided.
Definition: Type.h:1519
@ RQ_LValue
An lvalue ref-qualifier was provided (&).
Definition: Type.h:1522
@ RQ_RValue
An rvalue ref-qualifier was provided (&&).
Definition: Type.h:1525
@ OK_VectorComponent
A vector component is an element or range of elements on a vector.
Definition: Specifiers.h:145
@ OK_ObjCProperty
An Objective-C property is a logical field of an Objective-C object which is read and written via Obj...
Definition: Specifiers.h:149
@ OK_ObjCSubscript
An Objective-C array/dictionary subscripting which reads an object or writes at the subscripted array...
Definition: Specifiers.h:154
@ OK_Ordinary
An ordinary object is located at an address in memory.
Definition: Specifiers.h:139
@ OK_BitField
A bitfield object is a bitfield on a C or C++ record.
Definition: Specifiers.h:142
@ OK_MatrixComponent
A matrix component is a single element of a matrix.
Definition: Specifiers.h:157
static const TerminalColor StmtColor
static const TerminalColor UndeserializedColor
StorageClass
Storage classes.
Definition: Specifiers.h:236
@ SC_None
Definition: Specifiers.h:238
static const TerminalColor DeclKindNameColor
@ C
Languages that the frontend can parse and compile.
static const TerminalColor LocationColor
static const TerminalColor ValueKindColor
static const TerminalColor CastColor
@ VK_PRValue
A pr-value expression (in the C++11 taxonomy) produces a temporary value.
Definition: Specifiers.h:123
@ VK_XValue
An x-value expression is a reference to an object with independent storage but which can be "moved",...
Definition: Specifiers.h:132
@ VK_LValue
An l-value expression is a reference to an object with independent storage.
Definition: Specifiers.h:127
const char * getTraitSpelling(ExpressionTrait T) LLVM_READONLY
Return the spelling of the type trait TT. Never null.
static const TerminalColor AttrColor
static const TerminalColor TypeColor
if(T->getSizeExpr()) TRY_TO(TraverseStmt(T -> getSizeExpr()))
@ Invariant
The parameter is invariant: must match exactly.
@ Contravariant
The parameter is contravariant, e.g., X<T> is a subtype of X when the type parameter is covariant and...
@ Covariant
The parameter is covariant, e.g., X<T> is a subtype of X when the type parameter is covariant and T i...
const char * getOperatorSpelling(OverloadedOperatorKind Operator)
Retrieve the spelling of the given overloaded operator, without the preceding "operator" keyword.
static const TerminalColor ValueColor
@ EST_Uninstantiated
not instantiated yet
@ EST_Unevaluated
not evaluated yet, for special member function
static const TerminalColor ObjectKindColor
AccessSpecifier
A C++ access specifier (public, private, protected), plus the special value "none" which means differ...
Definition: Specifiers.h:111
@ NOUR_Discarded
This name appears as a potential result of a discarded value expression.
Definition: Specifiers.h:171
@ NOUR_Unevaluated
This name appears in an unevaluated operand.
Definition: Specifiers.h:165
@ NOUR_None
This is an odr-use.
Definition: Specifiers.h:163
@ NOUR_Constant
This name appears as a potential result of an lvalue-to-rvalue conversion that is a constant expressi...
Definition: Specifiers.h:168
FunctionDecl * SourceDecl
The function whose exception specification this is, for EST_Unevaluated and EST_Uninstantiated.
Definition: Type.h:4104
FunctionDecl * SourceTemplate
The function template whose exception specification this is instantiated from, for EST_Uninstantiated...
Definition: Type.h:4108
ExceptionSpecificationType Type
The kind of exception specification this is.
Definition: Type.h:4094
Extra information about a function prototype.
Definition: Type.h:4118
ExceptionSpecInfo ExceptionSpec
Definition: Type.h:4124
Iterator range representation begin:end[:step].
Definition: ExprOpenMP.h:278
A std::pair-like structure for storing a qualified type split into its local qualifiers and its local...
Definition: Type.h:669
Qualifiers Quals
The local qualifiers.
Definition: Type.h:674
Information about a single command.