clang 22.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"
20#include "clang/AST/Type.h"
22#include "clang/Basic/Module.h"
26#include "llvm/ADT/StringExtras.h"
27#include "llvm/Frontend/HLSL/HLSLRootSignature.h"
28
29#include <algorithm>
30#include <utility>
31
32using namespace clang;
33
34static void dumpPreviousDeclImpl(raw_ostream &OS, ...) {}
35
36template <typename T>
37static void dumpPreviousDeclImpl(raw_ostream &OS, const Mergeable<T> *D) {
38 const T *First = D->getFirstDecl();
39 if (First != D)
40 OS << " first " << First;
41}
42
43template <typename T>
44static void dumpPreviousDeclImpl(raw_ostream &OS, const Redeclarable<T> *D) {
45 const T *Prev = D->getPreviousDecl();
46 if (Prev)
47 OS << " prev " << Prev;
48}
49
50/// Dump the previous declaration in the redeclaration chain for a declaration,
51/// if any.
52static void dumpPreviousDecl(raw_ostream &OS, const Decl *D) {
53 switch (D->getKind()) {
54#define DECL(DERIVED, BASE) \
55 case Decl::DERIVED: \
56 return dumpPreviousDeclImpl(OS, cast<DERIVED##Decl>(D));
57#define ABSTRACT_DECL(DECL)
58#include "clang/AST/DeclNodes.inc"
59 }
60 llvm_unreachable("Decl that isn't part of DeclNodes.inc!");
61}
62
63TextNodeDumper::TextNodeDumper(raw_ostream &OS, const ASTContext &Context,
64 bool ShowColors)
65 : TextTreeStructure(OS, ShowColors), OS(OS), ShowColors(ShowColors),
66 Context(&Context), SM(&Context.getSourceManager()),
67 PrintPolicy(Context.getPrintingPolicy()),
68 Traits(&Context.getCommentCommandTraits()) {}
69
70TextNodeDumper::TextNodeDumper(raw_ostream &OS, bool ShowColors)
71 : TextTreeStructure(OS, ShowColors), OS(OS), ShowColors(ShowColors) {}
72
74 const comments::FullComment *FC) {
75 if (!C) {
76 ColorScope Color(OS, ShowColors, NullColor);
77 OS << "<<<NULL>>>";
78 return;
79 }
80
81 {
82 ColorScope Color(OS, ShowColors, CommentColor);
83 OS << C->getCommentKindName();
84 }
86 dumpSourceRange(C->getSourceRange());
87
88 ConstCommentVisitor<TextNodeDumper, void,
89 const comments::FullComment *>::visit(C, FC);
90}
91
93 {
94 ColorScope Color(OS, ShowColors, AttrColor);
95
96 switch (A->getKind()) {
97#define ATTR(X) \
98 case attr::X: \
99 OS << #X; \
100 break;
101#include "clang/Basic/AttrList.inc"
102 }
103 OS << "Attr";
104 }
105 dumpPointer(A);
107 if (A->isInherited())
108 OS << " Inherited";
109 if (A->isImplicit())
110 OS << " Implicit";
111
113}
114
116 const Decl *From, StringRef Label) {
117 OS << "TemplateArgument";
118 if (R.isValid())
120
121 if (From)
122 dumpDeclRef(From, Label);
123
125}
126
127void TextNodeDumper::Visit(const Stmt *Node) {
128 if (!Node) {
129 ColorScope Color(OS, ShowColors, NullColor);
130 OS << "<<<NULL>>>";
131 return;
132 }
133 {
134 ColorScope Color(OS, ShowColors, StmtColor);
135 OS << Node->getStmtClassName();
136 }
137 dumpPointer(Node);
139
140 if (const auto *E = dyn_cast<Expr>(Node)) {
141 dumpType(E->getType());
142
143 if (E->containsErrors()) {
144 ColorScope Color(OS, ShowColors, ErrorsColor);
145 OS << " contains-errors";
146 }
147
148 {
149 ColorScope Color(OS, ShowColors, ValueKindColor);
150 switch (E->getValueKind()) {
151 case VK_PRValue:
152 break;
153 case VK_LValue:
154 OS << " lvalue";
155 break;
156 case VK_XValue:
157 OS << " xvalue";
158 break;
159 }
160 }
161
162 {
163 ColorScope Color(OS, ShowColors, ObjectKindColor);
164 switch (E->getObjectKind()) {
165 case OK_Ordinary:
166 break;
167 case OK_BitField:
168 OS << " bitfield";
169 break;
170 case OK_ObjCProperty:
171 OS << " objcproperty";
172 break;
173 case OK_ObjCSubscript:
174 OS << " objcsubscript";
175 break;
177 OS << " vectorcomponent";
178 break;
180 OS << " matrixcomponent";
181 break;
182 }
183 }
184 }
185
187}
188
190 if (!T) {
191 ColorScope Color(OS, ShowColors, NullColor);
192 OS << "<<<NULL>>>";
193 return;
194 }
195 if (isa<LocInfoType>(T)) {
196 {
197 ColorScope Color(OS, ShowColors, TypeColor);
198 OS << "LocInfo Type";
199 }
200 dumpPointer(T);
201 return;
202 }
203
204 {
205 ColorScope Color(OS, ShowColors, TypeColor);
206 OS << T->getTypeClassName() << "Type";
207 }
208 dumpPointer(T);
209 OS << " ";
210 dumpBareType(QualType(T, 0), false);
211
212 QualType SingleStepDesugar =
213 T->getLocallyUnqualifiedSingleStepDesugaredType();
214 if (SingleStepDesugar != QualType(T, 0))
215 OS << " sugar";
216
217 if (T->containsErrors()) {
218 ColorScope Color(OS, ShowColors, ErrorsColor);
219 OS << " contains-errors";
220 }
221
222 if (T->isDependentType())
223 OS << " dependent";
224 else if (T->isInstantiationDependentType())
225 OS << " instantiation_dependent";
226
227 if (T->isVariablyModifiedType())
228 OS << " variably_modified";
229 if (T->containsUnexpandedParameterPack())
230 OS << " contains_unexpanded_pack";
231 if (T->isFromAST())
232 OS << " imported";
233
235}
236
238 OS << "QualType";
239 dumpPointer(T.getAsOpaquePtr());
240 OS << " ";
241 dumpBareType(T, false);
242 OS << " " << T.split().Quals.getAsString();
243}
244
246 if (!TL) {
247 ColorScope Color(OS, ShowColors, NullColor);
248 OS << "<<<NULL>>>";
249 return;
250 }
251
252 {
253 ColorScope Color(OS, ShowColors, TypeColor);
255 ? "Qualified"
256 : TL.getType()->getTypeClassName())
257 << "TypeLoc";
258 }
260 OS << ' ';
261 dumpBareType(TL.getType(), /*Desugar=*/false);
262
264}
265
267 if (!D) {
268 ColorScope Color(OS, ShowColors, NullColor);
269 OS << "<<<NULL>>>";
270 return;
271 }
272
273 {
274 ColorScope Color(OS, ShowColors, DeclKindNameColor);
275 OS << D->getDeclKindName() << "Decl";
276 }
277 dumpPointer(D);
278 if (D->getLexicalDeclContext() != D->getDeclContext())
279 OS << " parent " << cast<Decl>(D->getDeclContext());
280 dumpPreviousDecl(OS, D);
282 OS << ' ';
284 if (D->isFromASTFile())
285 OS << " imported";
286 if (Module *M = D->getOwningModule())
287 OS << " in " << M->getFullModuleName();
288 if (auto *ND = dyn_cast<NamedDecl>(D))
290 const_cast<NamedDecl *>(ND)))
291 AddChild([=] { OS << "also in " << M->getFullModuleName(); });
292 if (const NamedDecl *ND = dyn_cast<NamedDecl>(D))
293 if (!ND->isUnconditionallyVisible())
294 OS << " hidden";
295 if (D->isImplicit())
296 OS << " implicit";
297
298 if (D->isUsed())
299 OS << " used";
300 else if (D->isThisDeclarationReferenced())
301 OS << " referenced";
302
303 if (D->isInvalidDecl())
304 OS << " invalid";
305 if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) {
306 if (FD->isConstexprSpecified())
307 OS << " constexpr";
308 if (FD->isConsteval())
309 OS << " consteval";
310 else if (FD->isImmediateFunction())
311 OS << " immediate";
312 if (FD->isMultiVersion())
313 OS << " multiversion";
314 }
315
316 if (!isa<FunctionDecl>(*D)) {
317 const auto *MD = dyn_cast<ObjCMethodDecl>(D);
318 if (!MD || !MD->isThisDeclarationADefinition()) {
319 const auto *DC = dyn_cast<DeclContext>(D);
320 if (DC && DC->hasExternalLexicalStorage()) {
321 ColorScope Color(OS, ShowColors, UndeserializedColor);
322 OS << " <undeserialized declarations>";
323 }
324 }
325 }
326
327 switch (D->getFriendObjectKind()) {
328 case Decl::FOK_None:
329 break;
331 OS << " friend";
332 break;
334 OS << " friend_undeclared";
335 break;
336 }
337
339}
340
342 OS << "CXXCtorInitializer";
343 if (Init->isAnyMemberInitializer()) {
344 OS << ' ';
345 dumpBareDeclRef(Init->getAnyMember());
346 } else if (Init->isBaseInitializer()) {
347 dumpType(QualType(Init->getBaseClass(), 0));
348 } else if (Init->isDelegatingInitializer()) {
349 dumpType(Init->getTypeSourceInfo()->getType());
350 } else {
351 llvm_unreachable("Unknown initializer type");
352 }
353}
354
356 OS << "capture";
357 if (C.isByRef())
358 OS << " byref";
359 if (C.isNested())
360 OS << " nested";
361 if (C.getVariable()) {
362 OS << ' ';
363 dumpBareDeclRef(C.getVariable());
364 }
365}
366
368 if (!C) {
369 ColorScope Color(OS, ShowColors, NullColor);
370 OS << "<<<NULL>>> OMPClause";
371 return;
372 }
373 {
374 ColorScope Color(OS, ShowColors, AttrColor);
375 StringRef ClauseName(llvm::omp::getOpenMPClauseName(C->getClauseKind()));
376 OS << "OMP" << ClauseName.substr(/*Start=*/0, /*N=*/1).upper()
377 << ClauseName.drop_front() << "Clause";
378 }
379 dumpPointer(C);
380 dumpSourceRange(SourceRange(C->getBeginLoc(), C->getEndLoc()));
381 if (C->isImplicit())
382 OS << " <implicit>";
383}
384
386 const OpenACCAsteriskSizeExpr *E) {
387 // Nothing to do here, only location exists, and that is printed elsewhere.
388}
389
391 if (!C) {
392 ColorScope Color(OS, ShowColors, NullColor);
393 OS << "<<<NULL>>> OpenACCClause";
394 return;
395 }
396 {
397 ColorScope Color(OS, ShowColors, AttrColor);
398 OS << C->getClauseKind();
399
400 // Handle clauses with parens for types that have no children, likely
401 // because there is no sub expression.
402 switch (C->getClauseKind()) {
404 OS << '(' << cast<OpenACCDefaultClause>(C)->getDefaultClauseKind() << ')';
405 break;
438 // The condition expression will be printed as a part of the 'children',
439 // but print 'clause' here so it is clear what is happening from the dump.
440 OS << " clause";
441 break;
443 OS << " clause";
444 // print the list of all GangKinds, so that there is some sort of
445 // relationship to the expressions listed afterwards.
446 auto *GC = cast<OpenACCGangClause>(C);
447
448 for (unsigned I = 0; I < GC->getNumExprs(); ++I) {
449 OS << " " << GC->getExpr(I).first;
450 }
451 break;
452 }
454 OS << " clause";
455 if (cast<OpenACCCollapseClause>(C)->hasForce())
456 OS << ": force";
457 break;
458
462 OS << " clause";
463 if (cast<OpenACCCopyClause>(C)->getModifierList() !=
465 OS << " modifiers: " << cast<OpenACCCopyClause>(C)->getModifierList();
466 break;
470 OS << " clause";
471 if (cast<OpenACCCopyInClause>(C)->getModifierList() !=
473 OS << " modifiers: " << cast<OpenACCCopyInClause>(C)->getModifierList();
474 break;
478 OS << " clause";
479 if (cast<OpenACCCopyOutClause>(C)->getModifierList() !=
481 OS << " modifiers: "
482 << cast<OpenACCCopyOutClause>(C)->getModifierList();
483 break;
487 OS << " clause";
488 if (cast<OpenACCCreateClause>(C)->getModifierList() !=
490 OS << " modifiers: " << cast<OpenACCCreateClause>(C)->getModifierList();
491 break;
493 OS << " clause";
494 if (cast<OpenACCWaitClause>(C)->hasDevNumExpr())
495 OS << " has devnum";
496 if (cast<OpenACCWaitClause>(C)->hasQueuesTag())
497 OS << " has queues tag";
498 break;
501 OS << "(";
502 llvm::interleaveComma(
503 cast<OpenACCDeviceTypeClause>(C)->getArchitectures(), OS,
504 [&](const DeviceTypeArgument &Arch) {
505 if (Arch.getIdentifierInfo() == nullptr)
506 OS << "*";
507 else
508 OS << Arch.getIdentifierInfo()->getName();
509 });
510 OS << ")";
511 break;
513 OS << " clause Operator: "
514 << cast<OpenACCReductionClause>(C)->getReductionOp();
515 break;
517 OS << " clause";
518 if (cast<OpenACCBindClause>(C)->isIdentifierArgument())
519 OS << " identifier '"
520 << cast<OpenACCBindClause>(C)->getIdentifierArgument()->getName()
521 << "'";
522 else
523 AddChild(
524 [=] { Visit(cast<OpenACCBindClause>(C)->getStringArgument()); });
525 }
526 }
527 dumpPointer(C);
528 dumpSourceRange(SourceRange(C->getBeginLoc(), C->getEndLoc()));
529}
530
532 const TypeSourceInfo *TSI = A.getTypeSourceInfo();
533 if (TSI) {
534 OS << "case ";
535 dumpType(TSI->getType());
536 } else {
537 OS << "default";
538 }
539
540 if (A.isSelected())
541 OS << " selected";
542}
543
545 if (!R) {
546 ColorScope Color(OS, ShowColors, NullColor);
547 OS << "<<<NULL>>> ConceptReference";
548 return;
549 }
550
551 OS << "ConceptReference";
552 dumpPointer(R);
554 OS << ' ';
556}
557
559 if (!R) {
560 ColorScope Color(OS, ShowColors, NullColor);
561 OS << "<<<NULL>>> Requirement";
562 return;
563 }
564
565 {
566 ColorScope Color(OS, ShowColors, StmtColor);
567 switch (R->getKind()) {
569 OS << "TypeRequirement";
570 break;
572 OS << "SimpleRequirement";
573 break;
575 OS << "CompoundRequirement";
576 break;
578 OS << "NestedRequirement";
579 break;
580 }
581 }
582
583 dumpPointer(R);
584
585 if (auto *ER = dyn_cast<concepts::ExprRequirement>(R)) {
586 if (ER->hasNoexceptRequirement())
587 OS << " noexcept";
588 }
589
590 if (R->isDependent())
591 OS << " dependent";
592 else
593 OS << (R->isSatisfied() ? " satisfied" : " unsatisfied");
595 OS << " contains_unexpanded_pack";
596}
597
598static double GetApproxValue(const llvm::APFloat &F) {
599 llvm::APFloat V = F;
600 bool ignored;
601 V.convert(llvm::APFloat::IEEEdouble(), llvm::APFloat::rmNearestTiesToEven,
602 &ignored);
603 return V.convertToDouble();
604}
605
606/// True if the \p APValue \p Value can be folded onto the current line.
607static bool isSimpleAPValue(const APValue &Value) {
608 switch (Value.getKind()) {
609 case APValue::None:
611 case APValue::Int:
612 case APValue::Float:
616 case APValue::LValue:
619 return true;
620 case APValue::Vector:
621 case APValue::Array:
622 case APValue::Struct:
623 return false;
624 case APValue::Union:
625 return isSimpleAPValue(Value.getUnionValue());
626 }
627 llvm_unreachable("unexpected APValue kind!");
628}
629
630/// Dump the children of the \p APValue \p Value.
631///
632/// \param[in] Value The \p APValue to visit
633/// \param[in] Ty The \p QualType passed to \p Visit
634///
635/// \param[in] IdxToChildFun A function mapping an \p APValue and an index
636/// to one of the child of the \p APValue
637///
638/// \param[in] NumChildren \p IdxToChildFun will be called on \p Value with
639/// the indices in the range \p [0,NumChildren(
640///
641/// \param[in] LabelSingular The label to use on a line with a single child
642/// \param[in] LabelPlurial The label to use on a line with multiple children
643void TextNodeDumper::dumpAPValueChildren(
644 const APValue &Value, QualType Ty,
645 const APValue &(*IdxToChildFun)(const APValue &, unsigned),
646 unsigned NumChildren, StringRef LabelSingular, StringRef LabelPlurial) {
647 // To save some vertical space we print up to MaxChildrenPerLine APValues
648 // considered to be simple (by isSimpleAPValue) on a single line.
649 constexpr unsigned MaxChildrenPerLine = 4;
650 unsigned I = 0;
651 while (I < NumChildren) {
652 unsigned J = I;
653 while (J < NumChildren) {
654 if (isSimpleAPValue(IdxToChildFun(Value, J)) &&
655 (J - I < MaxChildrenPerLine)) {
656 ++J;
657 continue;
658 }
659 break;
660 }
661
662 J = std::max(I + 1, J);
663
664 // Print [I,J) on a single line.
665 AddChild(J - I > 1 ? LabelPlurial : LabelSingular, [=]() {
666 for (unsigned X = I; X < J; ++X) {
667 Visit(IdxToChildFun(Value, X), Ty);
668 if (X + 1 != J)
669 OS << ", ";
670 }
671 });
672 I = J;
673 }
674}
675
677 ColorScope Color(OS, ShowColors, ValueKindColor);
678 switch (Value.getKind()) {
679 case APValue::None:
680 OS << "None";
681 return;
683 OS << "Indeterminate";
684 return;
685 case APValue::Int:
686 OS << "Int ";
687 {
688 ColorScope Color(OS, ShowColors, ValueColor);
689 OS << Value.getInt();
690 }
691 return;
692 case APValue::Float:
693 OS << "Float ";
694 {
695 ColorScope Color(OS, ShowColors, ValueColor);
696 OS << GetApproxValue(Value.getFloat());
697 }
698 return;
700 OS << "FixedPoint ";
701 {
702 ColorScope Color(OS, ShowColors, ValueColor);
703 OS << Value.getFixedPoint();
704 }
705 return;
706 case APValue::Vector: {
707 unsigned VectorLength = Value.getVectorLength();
708 OS << "Vector length=" << VectorLength;
709
710 dumpAPValueChildren(
711 Value, Ty,
712 [](const APValue &Value, unsigned Index) -> const APValue & {
713 return Value.getVectorElt(Index);
714 },
715 VectorLength, "element", "elements");
716 return;
717 }
719 OS << "ComplexInt ";
720 {
721 ColorScope Color(OS, ShowColors, ValueColor);
722 OS << Value.getComplexIntReal() << " + " << Value.getComplexIntImag()
723 << 'i';
724 }
725 return;
727 OS << "ComplexFloat ";
728 {
729 ColorScope Color(OS, ShowColors, ValueColor);
730 OS << GetApproxValue(Value.getComplexFloatReal()) << " + "
731 << GetApproxValue(Value.getComplexFloatImag()) << 'i';
732 }
733 return;
734 case APValue::LValue: {
735 (void)Context;
736 OS << "LValue Base=";
737 APValue::LValueBase B = Value.getLValueBase();
738 if (B.isNull())
739 OS << "null";
740 else if (const auto *BE = B.dyn_cast<const Expr *>()) {
741 OS << BE->getStmtClassName() << ' ';
742 dumpPointer(BE);
743 } else if (const auto BTI = B.dyn_cast<TypeInfoLValue>()) {
744 OS << "TypeInfoLValue ";
745 ColorScope Color(OS, ShowColors, TypeColor);
746 BTI.print(OS, PrintPolicy);
747 } else if (B.is<DynamicAllocLValue>()) {
748 OS << "DynamicAllocLValue";
749 auto BDA = B.getDynamicAllocType();
750 dumpType(BDA);
751 } else {
752 const auto *VDB = B.get<const ValueDecl *>();
753 OS << VDB->getDeclKindName() << "Decl";
754 dumpPointer(VDB);
755 }
756 OS << ", Null=" << Value.isNullPointer()
757 << ", Offset=" << Value.getLValueOffset().getQuantity()
758 << ", HasPath=" << Value.hasLValuePath();
759 if (Value.hasLValuePath()) {
760 OS << ", PathLength=" << Value.getLValuePath().size();
761 OS << ", Path=(";
762 llvm::ListSeparator Sep;
763 for (const auto &PathEntry : Value.getLValuePath()) {
764 // We're printing all entries as array indices because don't have the
765 // type information here to do anything else.
766 OS << Sep << PathEntry.getAsArrayIndex();
767 }
768 OS << ")";
769 }
770 return;
771 }
772 case APValue::Array: {
773 unsigned ArraySize = Value.getArraySize();
774 unsigned NumInitializedElements = Value.getArrayInitializedElts();
775 OS << "Array size=" << ArraySize;
776
777 dumpAPValueChildren(
778 Value, Ty,
779 [](const APValue &Value, unsigned Index) -> const APValue & {
780 return Value.getArrayInitializedElt(Index);
781 },
782 NumInitializedElements, "element", "elements");
783
784 if (Value.hasArrayFiller()) {
785 AddChild("filler", [=] {
786 {
787 ColorScope Color(OS, ShowColors, ValueColor);
788 OS << ArraySize - NumInitializedElements << " x ";
789 }
790 Visit(Value.getArrayFiller(), Ty);
791 });
792 }
793
794 return;
795 }
796 case APValue::Struct: {
797 OS << "Struct";
798
799 dumpAPValueChildren(
800 Value, Ty,
801 [](const APValue &Value, unsigned Index) -> const APValue & {
802 return Value.getStructBase(Index);
803 },
804 Value.getStructNumBases(), "base", "bases");
805
806 dumpAPValueChildren(
807 Value, Ty,
808 [](const APValue &Value, unsigned Index) -> const APValue & {
809 return Value.getStructField(Index);
810 },
811 Value.getStructNumFields(), "field", "fields");
812
813 return;
814 }
815 case APValue::Union: {
816 OS << "Union";
817 {
818 ColorScope Color(OS, ShowColors, ValueColor);
819 if (const FieldDecl *FD = Value.getUnionField())
820 OS << " ." << *cast<NamedDecl>(FD);
821 }
822 // If the union value is considered to be simple, fold it into the
823 // current line to save some vertical space.
824 const APValue &UnionValue = Value.getUnionValue();
825 if (isSimpleAPValue(UnionValue)) {
826 OS << ' ';
827 Visit(UnionValue, Ty);
828 } else {
829 AddChild([=] { Visit(UnionValue, Ty); });
830 }
831
832 return;
833 }
835 OS << "MemberPointer ";
836 auto Path = Value.getMemberPointerPath();
837 for (const CXXRecordDecl *D : Path) {
838 {
839 ColorScope Color(OS, ShowColors, DeclNameColor);
840 OS << D->getDeclName();
841 }
842 OS << "::";
843 }
844
845 ColorScope Color(OS, ShowColors, DeclNameColor);
846 if (const ValueDecl *MemDecl = Value.getMemberPointerDecl())
847 OS << MemDecl->getDeclName();
848 else
849 OS << "null";
850 return;
851 }
853 OS << "AddrLabelDiff ";
854 OS << "&&" << Value.getAddrLabelDiffLHS()->getLabel()->getName();
855 OS << " - ";
856 OS << "&&" << Value.getAddrLabelDiffRHS()->getLabel()->getName();
857 return;
858 }
859 llvm_unreachable("Unknown APValue kind!");
860}
861
862void TextNodeDumper::dumpPointer(const void *Ptr) {
863 ColorScope Color(OS, ShowColors, AddressColor);
864 OS << ' ' << Ptr;
865}
866
868 if (!SM)
869 return;
870
871 ColorScope Color(OS, ShowColors, LocationColor);
872 SourceLocation SpellingLoc = SM->getSpellingLoc(Loc);
873
874 // The general format we print out is filename:line:col, but we drop pieces
875 // that haven't changed since the last loc printed.
876 PresumedLoc PLoc = SM->getPresumedLoc(SpellingLoc);
877
878 if (PLoc.isInvalid()) {
879 OS << "<invalid sloc>";
880 return;
881 }
882
883 if (strcmp(PLoc.getFilename(), LastLocFilename) != 0) {
884 OS << PLoc.getFilename() << ':' << PLoc.getLine() << ':'
885 << PLoc.getColumn();
886 LastLocFilename = PLoc.getFilename();
887 LastLocLine = PLoc.getLine();
888 } else if (PLoc.getLine() != LastLocLine) {
889 OS << "line" << ':' << PLoc.getLine() << ':' << PLoc.getColumn();
890 LastLocLine = PLoc.getLine();
891 } else {
892 OS << "col" << ':' << PLoc.getColumn();
893 }
894}
895
897 // Can't translate locations if a SourceManager isn't available.
898 if (!SM)
899 return;
900
901 OS << " <";
903 if (R.getBegin() != R.getEnd()) {
904 OS << ", ";
905 dumpLocation(R.getEnd());
906 }
907 OS << ">";
908
909 // <t2.c:123:421[blah], t2.c:412:321>
910}
911
913 ColorScope Color(OS, ShowColors, TypeColor);
914
915 SplitQualType T_split = T.split();
916 std::string T_str = QualType::getAsString(T_split, PrintPolicy);
917 OS << "'" << T_str << "'";
918
919 if (Desugar && !T.isNull()) {
920 // If the type is sugared, also dump a (shallow) desugared type when
921 // it is visibly different.
922 SplitQualType D_split = T.getSplitDesugaredType();
923 if (T_split != D_split) {
924 std::string D_str = QualType::getAsString(D_split, PrintPolicy);
925 if (T_str != D_str)
926 OS << ":'" << QualType::getAsString(D_split, PrintPolicy) << "'";
927 }
928 }
929}
930
932 OS << ' ';
934}
935
937 if (!D) {
938 ColorScope Color(OS, ShowColors, NullColor);
939 OS << "<<<NULL>>>";
940 return;
941 }
942
943 {
944 ColorScope Color(OS, ShowColors, DeclKindNameColor);
945 OS << D->getDeclKindName();
946 }
947 dumpPointer(D);
948
949 if (const NamedDecl *ND = dyn_cast<NamedDecl>(D)) {
950 ColorScope Color(OS, ShowColors, DeclNameColor);
951 if (DeclarationName Name = ND->getDeclName())
952 OS << " '" << Name << '\'';
953 else
954 switch (ND->getKind()) {
955 case Decl::Decomposition: {
956 auto *DD = cast<DecompositionDecl>(ND);
957 OS << " first_binding '" << DD->bindings()[0]->getDeclName() << '\'';
958 break;
959 }
960 case Decl::Field: {
961 auto *FD = cast<FieldDecl>(ND);
962 OS << " field_index " << FD->getFieldIndex();
963 break;
964 }
965 case Decl::ParmVar: {
966 auto *PD = cast<ParmVarDecl>(ND);
967 OS << " depth " << PD->getFunctionScopeDepth() << " index "
968 << PD->getFunctionScopeIndex();
969 break;
970 }
971 case Decl::TemplateTypeParm: {
972 auto *TD = cast<TemplateTypeParmDecl>(ND);
973 OS << " depth " << TD->getDepth() << " index " << TD->getIndex();
974 break;
975 }
976 case Decl::NonTypeTemplateParm: {
977 auto *TD = cast<NonTypeTemplateParmDecl>(ND);
978 OS << " depth " << TD->getDepth() << " index " << TD->getIndex();
979 break;
980 }
981 default:
982 // Var, Namespace, (CXX)Record: Nothing else besides source location.
983 dumpSourceRange(ND->getSourceRange());
984 break;
985 }
986 }
987
988 if (const ValueDecl *VD = dyn_cast<ValueDecl>(D))
989 dumpType(VD->getType());
990}
991
993 if (ND->getDeclName()) {
994 ColorScope Color(OS, ShowColors, DeclNameColor);
995 OS << ' ' << ND->getDeclName();
996 }
997}
998
1000 const auto AccessSpelling = getAccessSpelling(AS);
1001 if (AccessSpelling.empty())
1002 return;
1003 OS << AccessSpelling;
1004}
1005
1008 if (auto *BD = dyn_cast<BlockDecl *>(C))
1009 dumpDeclRef(BD, "cleanup");
1010 else if (auto *CLE = dyn_cast<CompoundLiteralExpr *>(C))
1011 AddChild([=] {
1012 OS << "cleanup ";
1013 {
1014 ColorScope Color(OS, ShowColors, StmtColor);
1015 OS << CLE->getStmtClassName();
1016 }
1017 dumpPointer(CLE);
1018 });
1019 else
1020 llvm_unreachable("unexpected cleanup type");
1021}
1022
1025 switch (TSK) {
1026 case TSK_Undeclared:
1027 break;
1029 OS << " implicit_instantiation";
1030 break;
1032 OS << " explicit_specialization";
1033 break;
1035 OS << " explicit_instantiation_declaration";
1036 break;
1038 OS << " explicit_instantiation_definition";
1039 break;
1040 }
1041}
1042
1044 if (!NNS)
1045 return;
1046
1047 AddChild([=] {
1048 OS << "NestedNameSpecifier";
1049
1050 switch (NNS.getKind()) {
1052 auto [Namespace, Prefix] = NNS.getAsNamespaceAndPrefix();
1053 OS << " "; // "Namespace" is printed as the decl kind.
1054 dumpBareDeclRef(Namespace);
1056 break;
1057 }
1059 OS << " TypeSpec";
1060 dumpType(QualType(NNS.getAsType(), 0));
1061 break;
1063 OS << " Global";
1064 break;
1066 OS << " Super";
1067 break;
1069 llvm_unreachable("unexpected null nested name specifier");
1070 }
1071 });
1072}
1073
1074void TextNodeDumper::dumpDeclRef(const Decl *D, StringRef Label) {
1075 if (!D)
1076 return;
1077
1078 AddChild([=] {
1079 if (!Label.empty())
1080 OS << Label << ' ';
1081 dumpBareDeclRef(D);
1082 });
1083}
1084
1087 {
1088 llvm::raw_svector_ostream SS(Str);
1089 TA.print(PrintPolicy, SS, /*IncludeType=*/true);
1090 }
1091 OS << " '" << Str << "'";
1092
1093 if (!Context)
1094 return;
1095
1096 if (TemplateArgument CanonTA = Context->getCanonicalTemplateArgument(TA);
1097 !CanonTA.structurallyEquals(TA)) {
1098 llvm::SmallString<128> CanonStr;
1099 {
1100 llvm::raw_svector_ostream SS(CanonStr);
1101 CanonTA.print(PrintPolicy, SS, /*IncludeType=*/true);
1102 }
1103 if (CanonStr != Str)
1104 OS << ":'" << CanonStr << "'";
1105 }
1106}
1107
1108const char *TextNodeDumper::getCommandName(unsigned CommandID) {
1109 if (Traits)
1110 return Traits->getCommandInfo(CommandID)->Name;
1111 const comments::CommandInfo *Info =
1113 if (Info)
1114 return Info->Name;
1115 return "<not a builtin command>";
1116}
1117
1118void TextNodeDumper::printFPOptions(FPOptionsOverride FPO) {
1119#define FP_OPTION(NAME, TYPE, WIDTH, PREVIOUS) \
1120 if (FPO.has##NAME##Override()) \
1121 OS << " " #NAME "=" << FPO.get##NAME##Override();
1122#include "clang/Basic/FPOptions.def"
1123}
1124
1126 const comments::FullComment *) {
1127 OS << " Text=\"" << C->getText() << "\"";
1128}
1129
1132 OS << " Name=\"" << getCommandName(C->getCommandID()) << "\"";
1133 switch (C->getRenderKind()) {
1135 OS << " RenderNormal";
1136 break;
1138 OS << " RenderBold";
1139 break;
1141 OS << " RenderMonospaced";
1142 break;
1144 OS << " RenderEmphasized";
1145 break;
1147 OS << " RenderAnchor";
1148 break;
1149 }
1150
1151 for (unsigned i = 0, e = C->getNumArgs(); i != e; ++i)
1152 OS << " Arg[" << i << "]=\"" << C->getArgText(i) << "\"";
1153}
1154
1157 OS << " Name=\"" << C->getTagName() << "\"";
1158 if (C->getNumAttrs() != 0) {
1159 OS << " Attrs: ";
1160 for (unsigned i = 0, e = C->getNumAttrs(); i != e; ++i) {
1161 const comments::HTMLStartTagComment::Attribute &Attr = C->getAttr(i);
1162 OS << " \"" << Attr.Name << "=\"" << Attr.Value << "\"";
1163 }
1164 }
1165 if (C->isSelfClosing())
1166 OS << " SelfClosing";
1167}
1168
1171 OS << " Name=\"" << C->getTagName() << "\"";
1172}
1173
1176 OS << " Name=\"" << getCommandName(C->getCommandID()) << "\"";
1177 for (unsigned i = 0, e = C->getNumArgs(); i != e; ++i)
1178 OS << " Arg[" << i << "]=\"" << C->getArgText(i) << "\"";
1179}
1180
1183 OS << " "
1185
1186 if (C->isDirectionExplicit())
1187 OS << " explicitly";
1188 else
1189 OS << " implicitly";
1190
1191 if (C->hasParamName()) {
1192 if (C->isParamIndexValid())
1193 OS << " Param=\"" << C->getParamName(FC) << "\"";
1194 else
1195 OS << " Param=\"" << C->getParamNameAsWritten() << "\"";
1196 }
1197
1198 if (C->isParamIndexValid() && !C->isVarArgParam())
1199 OS << " ParamIndex=" << C->getParamIndex();
1200}
1201
1204 if (C->hasParamName()) {
1205 if (C->isPositionValid())
1206 OS << " Param=\"" << C->getParamName(FC) << "\"";
1207 else
1208 OS << " Param=\"" << C->getParamNameAsWritten() << "\"";
1209 }
1210
1211 if (C->isPositionValid()) {
1212 OS << " Position=<";
1213 for (unsigned i = 0, e = C->getDepth(); i != e; ++i) {
1214 OS << C->getIndex(i);
1215 if (i != e - 1)
1216 OS << ", ";
1217 }
1218 OS << ">";
1219 }
1220}
1221
1224 OS << " Name=\"" << getCommandName(C->getCommandID())
1225 << "\""
1226 " CloseName=\""
1227 << C->getCloseName() << "\"";
1228}
1229
1232 const comments::FullComment *) {
1233 OS << " Text=\"" << C->getText() << "\"";
1234}
1235
1238 OS << " Text=\"" << C->getText() << "\"";
1239}
1240
1242 OS << " null";
1243}
1244
1246 OS << " type";
1248}
1249
1251 const TemplateArgument &TA) {
1252 OS << " decl";
1254 dumpDeclRef(TA.getAsDecl());
1255}
1256
1258 OS << " nullptr";
1260}
1261
1263 OS << " integral";
1265}
1266
1268 const TemplateArgument &TA) {
1269 OS << " structural value";
1271}
1272
1274 AddChild(Label, [=] {
1275 {
1277 {
1278 llvm::raw_svector_ostream SS(Str);
1279 TN.print(SS, PrintPolicy);
1280 }
1281 OS << "'" << Str << "'";
1282
1283 if (Context) {
1284 if (TemplateName CanonTN = Context->getCanonicalTemplateName(TN);
1285 CanonTN != TN) {
1286 llvm::SmallString<128> CanonStr;
1287 {
1288 llvm::raw_svector_ostream SS(CanonStr);
1289 CanonTN.print(SS, PrintPolicy);
1290 }
1291 if (CanonStr != Str)
1292 OS << ":'" << CanonStr << "'";
1293 }
1294 }
1295 }
1297 });
1298}
1299
1301 switch (TN.getKind()) {
1303 AddChild([=] { Visit(TN.getAsTemplateDecl()); });
1304 return;
1306 const UsingShadowDecl *USD = TN.getAsUsingShadowDecl();
1307 AddChild([=] { Visit(USD); });
1308 AddChild("target", [=] { Visit(USD->getTargetDecl()); });
1309 return;
1310 }
1312 OS << " qualified";
1314 if (QTN->hasTemplateKeyword())
1315 OS << " keyword";
1318 return;
1319 }
1321 OS << " dependent";
1324 return;
1325 }
1327 OS << " subst";
1330 OS << " index " << STS->getIndex();
1331 if (UnsignedOrNone PackIndex = STS->getPackIndex())
1332 OS << " pack_index " << *PackIndex;
1333 if (STS->getFinal())
1334 OS << " final";
1335 if (const TemplateTemplateParmDecl *P = STS->getParameter())
1336 AddChild("parameter", [=] { Visit(P); });
1337 dumpDeclRef(STS->getAssociatedDecl(), "associated");
1338 dumpTemplateName(STS->getReplacement(), "replacement");
1339 return;
1340 }
1342 OS << " deduced";
1344 dumpTemplateName(DTS->getUnderlying(), "underlying");
1345 AddChild("defaults", [=] {
1346 auto [StartPos, Args] = DTS->getDefaultArguments();
1347 OS << " start " << StartPos;
1348 for (const TemplateArgument &Arg : Args)
1349 AddChild([=] { Visit(Arg, SourceRange()); });
1350 });
1351 return;
1352 }
1353 // FIXME: Implement these.
1355 OS << " overloaded";
1356 return;
1358 OS << " assumed";
1359 return;
1361 OS << " subst_pack";
1362 return;
1363 }
1364 llvm_unreachable("Unexpected TemplateName Kind");
1365}
1366
1372
1379
1381 const TemplateArgument &TA) {
1382 OS << " expr";
1383 if (TA.isCanonicalExpr())
1384 OS << " canonical";
1386}
1387
1389 OS << " pack";
1391}
1392
1393static void dumpBasePath(raw_ostream &OS, const CastExpr *Node) {
1394 if (Node->path_empty())
1395 return;
1396
1397 OS << " (";
1398 bool First = true;
1400 E = Node->path_end();
1401 I != E; ++I) {
1402 const CXXBaseSpecifier *Base = *I;
1403 if (!First)
1404 OS << " -> ";
1405
1406 const auto *RD = cast<CXXRecordDecl>(
1407 Base->getType()->castAsCanonical<RecordType>()->getDecl());
1408
1409 if (Base->isVirtual())
1410 OS << "virtual ";
1411 OS << RD->getName();
1412 First = false;
1413 }
1414
1415 OS << ')';
1416}
1417
1419 if (!Node->hasLabelTarget())
1420 return;
1421
1422 OS << " '" << Node->getLabelDecl()->getIdentifier()->getName() << "' (";
1423
1424 auto *Target = Node->getNamedLoopOrSwitch();
1425 if (!Target) {
1426 ColorScope Color(OS, ShowColors, NullColor);
1427 OS << "<<<NULL>>>";
1428 } else {
1429 {
1430 ColorScope Color(OS, ShowColors, StmtColor);
1431 OS << Target->getStmtClassName();
1432 }
1434 }
1435 OS << ")";
1436}
1437
1439 if (Node->hasInitStorage())
1440 OS << " has_init";
1441 if (Node->hasVarStorage())
1442 OS << " has_var";
1443 if (Node->hasElseStorage())
1444 OS << " has_else";
1445 if (Node->isConstexpr())
1446 OS << " constexpr";
1447 if (Node->isConsteval()) {
1448 OS << " ";
1449 if (Node->isNegatedConsteval())
1450 OS << "!";
1451 OS << "consteval";
1452 }
1453}
1454
1456 if (Node->hasInitStorage())
1457 OS << " has_init";
1458 if (Node->hasVarStorage())
1459 OS << " has_var";
1460}
1461
1463 if (Node->hasVarStorage())
1464 OS << " has_var";
1465}
1466
1468 OS << " '" << Node->getName() << "'";
1469 if (Node->isSideEntry())
1470 OS << " side_entry";
1471}
1472
1474 OS << " '" << Node->getLabel()->getName() << "'";
1475 dumpPointer(Node->getLabel());
1476}
1477
1479 if (Node->caseStmtIsGNURange())
1480 OS << " gnu_range";
1481}
1482
1484 if (const VarDecl *Cand = Node->getNRVOCandidate()) {
1485 OS << " nrvo_candidate(";
1486 dumpBareDeclRef(Cand);
1487 OS << ")";
1488 }
1489}
1490
1492 if (Node->isImplicit())
1493 OS << " implicit";
1494}
1495
1497 if (Node->isImplicit())
1498 OS << " implicit";
1499}
1500
1502 if (Node->hasAPValueResult())
1503 AddChild("value",
1504 [=] { Visit(Node->getAPValueResult(), Node->getType()); });
1505}
1506
1508 if (Node->usesADL())
1509 OS << " adl";
1510 if (Node->hasStoredFPFeatures())
1511 printFPOptions(Node->getFPFeatures());
1512}
1513
1515 const char *OperatorSpelling = clang::getOperatorSpelling(Node->getOperator());
1516 if (OperatorSpelling)
1517 OS << " '" << OperatorSpelling << "'";
1518
1519 VisitCallExpr(Node);
1520}
1521
1523 OS << " <";
1524 {
1525 ColorScope Color(OS, ShowColors, CastColor);
1526 OS << Node->getCastKindName();
1527 }
1528 dumpBasePath(OS, Node);
1529 OS << ">";
1530 if (Node->hasStoredFPFeatures())
1531 printFPOptions(Node->getFPFeatures());
1532}
1533
1535 VisitCastExpr(Node);
1536 if (Node->isPartOfExplicitCast())
1537 OS << " part_of_explicit_cast";
1538}
1539
1541 OS << " ";
1542 dumpBareDeclRef(Node->getDecl());
1544 if (Node->getDecl() != Node->getFoundDecl()) {
1545 OS << " (";
1547 OS << ")";
1548 }
1549 switch (Node->isNonOdrUse()) {
1550 case NOUR_None: break;
1551 case NOUR_Unevaluated: OS << " non_odr_use_unevaluated"; break;
1552 case NOUR_Constant: OS << " non_odr_use_constant"; break;
1553 case NOUR_Discarded: OS << " non_odr_use_discarded"; break;
1554 }
1556 OS << " dependent_capture";
1557 else if (Node->refersToEnclosingVariableOrCapture())
1558 OS << " refers_to_enclosing_variable_or_capture";
1559
1560 if (Node->isImmediateEscalating())
1561 OS << " immediate-escalating";
1562}
1563
1569
1571 const UnresolvedLookupExpr *Node) {
1572 OS << " (";
1573 if (!Node->requiresADL())
1574 OS << "no ";
1575 OS << "ADL) = '" << Node->getName() << '\'';
1576
1578 E = Node->decls_end();
1579 if (I == E)
1580 OS << " empty";
1581 for (; I != E; ++I)
1582 dumpPointer(*I);
1583}
1584
1586 {
1587 ColorScope Color(OS, ShowColors, DeclKindNameColor);
1588 OS << " " << Node->getDecl()->getDeclKindName() << "Decl";
1589 }
1590 OS << "='" << *Node->getDecl() << "'";
1591 dumpPointer(Node->getDecl());
1592 if (Node->isFreeIvar())
1593 OS << " isFreeIvar";
1594}
1595
1600
1604
1606 ColorScope Color(OS, ShowColors, ValueColor);
1607 OS << " " << Node->getValue();
1608}
1609
1611 bool isSigned = Node->getType()->isSignedIntegerType();
1612 ColorScope Color(OS, ShowColors, ValueColor);
1613 OS << " " << toString(Node->getValue(), 10, isSigned);
1614}
1615
1617 ColorScope Color(OS, ShowColors, ValueColor);
1618 OS << " " << Node->getValueAsString(/*Radix=*/10);
1619}
1620
1622 ColorScope Color(OS, ShowColors, ValueColor);
1623 OS << " " << Node->getValueAsApproximateDouble();
1624}
1625
1627 ColorScope Color(OS, ShowColors, ValueColor);
1628 OS << " ";
1629 Str->outputString(OS);
1630}
1631
1633 if (auto *Field = ILE->getInitializedFieldInUnion()) {
1634 OS << " field ";
1635 dumpBareDeclRef(Field);
1636 }
1637}
1638
1640 if (E->isResultDependent())
1641 OS << " result_dependent";
1642}
1643
1645 OS << " " << (Node->isPostfix() ? "postfix" : "prefix") << " '"
1646 << UnaryOperator::getOpcodeStr(Node->getOpcode()) << "'";
1647 if (!Node->canOverflow())
1648 OS << " cannot overflow";
1649 if (Node->hasStoredFPFeatures())
1650 printFPOptions(Node->getStoredFPFeatures());
1651}
1652
1654 const UnaryExprOrTypeTraitExpr *Node) {
1655 OS << " " << getTraitSpelling(Node->getKind());
1656
1657 if (Node->isArgumentType())
1658 dumpType(Node->getArgumentType());
1659}
1660
1662 OS << " " << (Node->isArrow() ? "->" : ".") << *Node->getMemberDecl();
1663 dumpPointer(Node->getMemberDecl());
1665 switch (Node->isNonOdrUse()) {
1666 case NOUR_None: break;
1667 case NOUR_Unevaluated: OS << " non_odr_use_unevaluated"; break;
1668 case NOUR_Constant: OS << " non_odr_use_constant"; break;
1669 case NOUR_Discarded: OS << " non_odr_use_discarded"; break;
1670 }
1671}
1672
1674 const ExtVectorElementExpr *Node) {
1675 OS << " " << Node->getAccessor().getNameStart();
1676}
1677
1679 OS << " '" << BinaryOperator::getOpcodeStr(Node->getOpcode()) << "'";
1680 if (Node->hasStoredFPFeatures())
1681 printFPOptions(Node->getStoredFPFeatures());
1682}
1683
1685 const CompoundAssignOperator *Node) {
1686 OS << " '" << BinaryOperator::getOpcodeStr(Node->getOpcode())
1687 << "' ComputeLHSTy=";
1689 OS << " ComputeResultTy=";
1691 if (Node->hasStoredFPFeatures())
1692 printFPOptions(Node->getStoredFPFeatures());
1693}
1694
1696 OS << " " << Node->getLabel()->getName();
1697 dumpPointer(Node->getLabel());
1698}
1699
1701 OS << " " << Node->getCastName() << "<"
1702 << Node->getTypeAsWritten().getAsString() << ">"
1703 << " <" << Node->getCastKindName();
1704 dumpBasePath(OS, Node);
1705 OS << ">";
1706}
1707
1709 OS << " " << (Node->getValue() ? "true" : "false");
1710}
1711
1713 if (Node->isImplicit())
1714 OS << " implicit";
1716 OS << " dependent_capture";
1717 OS << " this";
1718}
1719
1721 const CXXFunctionalCastExpr *Node) {
1722 OS << " functional cast to " << Node->getTypeAsWritten().getAsString() << " <"
1723 << Node->getCastKindName() << ">";
1724 if (Node->hasStoredFPFeatures())
1725 printFPOptions(Node->getFPFeatures());
1726}
1727
1730 if (Node->hasStoredFPFeatures())
1731 printFPOptions(Node->getFPFeatures());
1732}
1733
1735 const CXXUnresolvedConstructExpr *Node) {
1736 dumpType(Node->getTypeAsWritten());
1737 if (Node->isListInitialization())
1738 OS << " list";
1739}
1740
1742 CXXConstructorDecl *Ctor = Node->getConstructor();
1743 dumpType(Ctor->getType());
1744 if (Node->isElidable())
1745 OS << " elidable";
1746 if (Node->isListInitialization())
1747 OS << " list";
1748 if (Node->isStdInitListInitialization())
1749 OS << " std::initializer_list";
1750 if (Node->requiresZeroInitialization())
1751 OS << " zeroing";
1752 if (Node->isImmediateEscalating())
1753 OS << " immediate-escalating";
1754}
1755
1757 const CXXBindTemporaryExpr *Node) {
1758 OS << " (CXXTemporary";
1759 dumpPointer(Node);
1760 OS << ")";
1761}
1762
1764 if (Node->isGlobalNew())
1765 OS << " global";
1766 if (Node->isArray())
1767 OS << " array";
1768 if (Node->getOperatorNew()) {
1769 OS << ' ';
1771 }
1772 // We could dump the deallocation function used in case of error, but it's
1773 // usually not that interesting.
1774}
1775
1777 if (Node->isGlobalDelete())
1778 OS << " global";
1779 if (Node->isArrayForm())
1780 OS << " array";
1781 if (Node->getOperatorDelete()) {
1782 OS << ' ';
1784 }
1785}
1786
1788 OS << " " << getTraitSpelling(Node->getTrait());
1789}
1790
1792 OS << " " << getTraitSpelling(Node->getTrait());
1793}
1794
1798
1800 if (Node->hasRewrittenInit())
1801 OS << " has rewritten init";
1802}
1803
1805 if (Node->hasRewrittenInit())
1806 OS << " has rewritten init";
1807}
1808
1810 const MaterializeTemporaryExpr *Node) {
1811 if (const ValueDecl *VD = Node->getExtendingDecl()) {
1812 OS << " extended by ";
1813 dumpBareDeclRef(VD);
1814 }
1815}
1816
1818 for (unsigned i = 0, e = Node->getNumObjects(); i != e; ++i)
1819 dumpCleanupObject(Node->getObject(i));
1820}
1821
1823 dumpPointer(Node->getPack());
1824 dumpName(Node->getPack());
1825}
1826
1828 const CXXDependentScopeMemberExpr *Node) {
1829 OS << " " << (Node->isArrow() ? "->" : ".") << Node->getMember();
1830}
1831
1833 OS << " selector=";
1834 Node->getSelector().print(OS);
1835 switch (Node->getReceiverKind()) {
1837 break;
1838
1840 OS << " class=";
1842 break;
1843
1845 OS << " super (instance)";
1846 break;
1847
1849 OS << " super (class)";
1850 break;
1851 }
1852}
1853
1855 if (auto *BoxingMethod = Node->getBoxingMethod()) {
1856 OS << " selector=";
1857 BoxingMethod->getSelector().print(OS);
1858 }
1859}
1860
1862 if (!Node->getCatchParamDecl())
1863 OS << " catch all";
1864}
1865
1869
1871 OS << " ";
1872 Node->getSelector().print(OS);
1873}
1874
1876 OS << ' ' << *Node->getProtocol();
1877}
1878
1880 if (Node->isImplicitProperty()) {
1881 OS << " Kind=MethodRef Getter=\"";
1882 if (Node->getImplicitPropertyGetter())
1884 else
1885 OS << "(null)";
1886
1887 OS << "\" Setter=\"";
1888 if (ObjCMethodDecl *Setter = Node->getImplicitPropertySetter())
1889 Setter->getSelector().print(OS);
1890 else
1891 OS << "(null)";
1892 OS << "\"";
1893 } else {
1894 OS << " Kind=PropertyRef Property=\"" << *Node->getExplicitProperty()
1895 << '"';
1896 }
1897
1898 if (Node->isSuperReceiver())
1899 OS << " super";
1900
1901 OS << " Messaging=";
1902 if (Node->isMessagingGetter() && Node->isMessagingSetter())
1903 OS << "Getter&Setter";
1904 else if (Node->isMessagingGetter())
1905 OS << "Getter";
1906 else if (Node->isMessagingSetter())
1907 OS << "Setter";
1908}
1909
1911 const ObjCSubscriptRefExpr *Node) {
1912 if (Node->isArraySubscriptRefExpr())
1913 OS << " Kind=ArraySubscript GetterForArray=\"";
1914 else
1915 OS << " Kind=DictionarySubscript GetterForDictionary=\"";
1916 if (Node->getAtIndexMethodDecl())
1917 Node->getAtIndexMethodDecl()->getSelector().print(OS);
1918 else
1919 OS << "(null)";
1920
1921 if (Node->isArraySubscriptRefExpr())
1922 OS << "\" SetterForArray=\"";
1923 else
1924 OS << "\" SetterForDictionary=\"";
1925 if (Node->setAtIndexMethodDecl())
1926 Node->setAtIndexMethodDecl()->getSelector().print(OS);
1927 else
1928 OS << "(null)";
1929}
1930
1932 OS << " " << (Node->getValue() ? "__objc_yes" : "__objc_no");
1933}
1934
1936 OS << " ";
1937 for (unsigned I = 0, E = Node->numOfIterators(); I < E; ++I) {
1938 Visit(Node->getIteratorDecl(I));
1939 OS << " = ";
1940 const OMPIteratorExpr::IteratorRange Range = Node->getIteratorRange(I);
1941 OS << " begin ";
1942 Visit(Range.Begin);
1943 OS << " end ";
1944 Visit(Range.End);
1945 if (Range.Step) {
1946 OS << " step ";
1947 Visit(Range.Step);
1948 }
1949 }
1950}
1951
1957
1959 const RequiresExpr *Node) {
1960 if (!Node->isValueDependent())
1961 OS << (Node->isSatisfied() ? " satisfied" : " unsatisfied");
1962}
1963
1965 if (T->isSpelledAsLValue())
1966 OS << " written as lvalue reference";
1967}
1968
1970 switch (T->getSizeModifier()) {
1972 break;
1974 OS << " static";
1975 break;
1977 OS << " *";
1978 break;
1979 }
1980 OS << " " << T->getIndexTypeQualifiers().getAsString();
1981}
1982
1984 OS << " " << T->getSize();
1986}
1987
1991
1996
1999 OS << " ";
2000 dumpLocation(T->getAttributeLoc());
2001}
2002
2004 switch (T->getVectorKind()) {
2006 break;
2008 OS << " altivec";
2009 break;
2011 OS << " altivec pixel";
2012 break;
2014 OS << " altivec bool";
2015 break;
2016 case VectorKind::Neon:
2017 OS << " neon";
2018 break;
2020 OS << " neon poly";
2021 break;
2023 OS << " fixed-length sve data vector";
2024 break;
2026 OS << " fixed-length sve predicate vector";
2027 break;
2029 OS << " fixed-length rvv data vector";
2030 break;
2035 OS << " fixed-length rvv mask vector";
2036 break;
2037 }
2038 OS << " " << T->getNumElements();
2039}
2040
2042 auto EI = T->getExtInfo();
2043 if (EI.getNoReturn())
2044 OS << " noreturn";
2045 if (EI.getProducesResult())
2046 OS << " produces_result";
2047 if (EI.getHasRegParm())
2048 OS << " regparm " << EI.getRegParm();
2049 OS << " " << FunctionType::getNameForCallConv(EI.getCC());
2050}
2051
2053 auto EPI = T->getExtProtoInfo();
2054 if (EPI.HasTrailingReturn)
2055 OS << " trailing_return";
2056 if (T->isConst())
2057 OS << " const";
2058 if (T->isVolatile())
2059 OS << " volatile";
2060 if (T->isRestrict())
2061 OS << " restrict";
2062 if (T->getExtProtoInfo().Variadic)
2063 OS << " variadic";
2064 switch (EPI.RefQualifier) {
2065 case RQ_None:
2066 break;
2067 case RQ_LValue:
2068 OS << " &";
2069 break;
2070 case RQ_RValue:
2071 OS << " &&";
2072 break;
2073 }
2074
2075 switch (EPI.ExceptionSpec.Type) {
2076 case EST_None:
2077 break;
2078 case EST_DynamicNone:
2079 OS << " exceptionspec_dynamic_none";
2080 break;
2081 case EST_Dynamic:
2082 OS << " exceptionspec_dynamic";
2083 break;
2084 case EST_MSAny:
2085 OS << " exceptionspec_ms_any";
2086 break;
2087 case EST_NoThrow:
2088 OS << " exceptionspec_nothrow";
2089 break;
2090 case EST_BasicNoexcept:
2091 OS << " exceptionspec_basic_noexcept";
2092 break;
2094 OS << " exceptionspec_dependent_noexcept";
2095 break;
2096 case EST_NoexceptFalse:
2097 OS << " exceptionspec_noexcept_false";
2098 break;
2099 case EST_NoexceptTrue:
2100 OS << " exceptionspec_noexcept_true";
2101 break;
2102 case EST_Unevaluated:
2103 OS << " exceptionspec_unevaluated";
2104 break;
2105 case EST_Uninstantiated:
2106 OS << " exceptionspec_uninstantiated";
2107 break;
2108 case EST_Unparsed:
2109 OS << " exceptionspec_unparsed";
2110 break;
2111 }
2112 if (!EPI.ExceptionSpec.Exceptions.empty()) {
2113 AddChild([=] {
2114 OS << "Exceptions:";
2115 for (unsigned I = 0, N = EPI.ExceptionSpec.Exceptions.size(); I != N;
2116 ++I) {
2117 if (I)
2118 OS << ",";
2119 dumpType(EPI.ExceptionSpec.Exceptions[I]);
2120 }
2121 });
2122 }
2123 if (EPI.ExceptionSpec.NoexceptExpr) {
2124 AddChild([=] {
2125 OS << "NoexceptExpr: ";
2126 Visit(EPI.ExceptionSpec.NoexceptExpr);
2127 });
2128 }
2129 dumpDeclRef(EPI.ExceptionSpec.SourceDecl, "ExceptionSourceDecl");
2130 dumpDeclRef(EPI.ExceptionSpec.SourceTemplate, "ExceptionSourceTemplate");
2131
2132 // FIXME: Consumed parameters.
2134}
2135
2137 if (ElaboratedTypeKeyword K = T->getKeyword();
2139 OS << ' ' << TypeWithKeyword::getKeywordName(K);
2140 dumpNestedNameSpecifier(T->getQualifier());
2141 dumpDeclRef(T->getDecl());
2142}
2143
2145 if (ElaboratedTypeKeyword K = T->getKeyword();
2147 OS << ' ' << TypeWithKeyword::getKeywordName(K);
2148 dumpNestedNameSpecifier(T->getQualifier());
2149 dumpDeclRef(T->getDecl());
2150 dumpType(T->desugar());
2151}
2152
2154 if (ElaboratedTypeKeyword K = T->getKeyword();
2156 OS << ' ' << TypeWithKeyword::getKeywordName(K);
2157 dumpNestedNameSpecifier(T->getQualifier());
2158 dumpDeclRef(T->getDecl());
2159 if (!T->typeMatchesDecl()) {
2160 OS << " divergent";
2161 dumpType(T->desugar());
2162 }
2163}
2164
2165void TextNodeDumper::VisitUnaryTransformType(const UnaryTransformType *T) {
2166 switch (T->getUTTKind()) {
2167#define TRANSFORM_TYPE_TRAIT_DEF(Enum, Trait) \
2168 case UnaryTransformType::Enum: \
2169 OS << " " #Trait; \
2170 break;
2171#include "clang/Basic/TransformTypeTraits.def"
2172 }
2173}
2174
2175void TextNodeDumper::VisitTagType(const TagType *T) {
2176 if (T->isCanonicalUnqualified())
2177 OS << " canonical";
2178 if (T->isTagOwned())
2179 OS << " owns_tag";
2180 if (T->isInjected())
2181 OS << " injected";
2182 if (ElaboratedTypeKeyword K = T->getKeyword();
2184 OS << ' ' << TypeWithKeyword::getKeywordName(K);
2185 dumpNestedNameSpecifier(T->getQualifier());
2186 dumpDeclRef(T->getDecl());
2187}
2188
2189void TextNodeDumper::VisitTemplateTypeParmType(const TemplateTypeParmType *T) {
2190 OS << " depth " << T->getDepth() << " index " << T->getIndex();
2191 if (T->isParameterPack())
2192 OS << " pack";
2193 dumpDeclRef(T->getDecl());
2194}
2195
2197 const SubstTemplateTypeParmType *T) {
2198 dumpDeclRef(T->getAssociatedDecl());
2199 VisitTemplateTypeParmDecl(T->getReplacedParameter());
2200 if (auto PackIndex = T->getPackIndex())
2201 OS << " pack_index " << *PackIndex;
2202 if (T->getFinal())
2203 OS << " final";
2204}
2205
2207 const SubstTemplateTypeParmPackType *T) {
2208 dumpDeclRef(T->getAssociatedDecl());
2209 VisitTemplateTypeParmDecl(T->getReplacedParameter());
2210}
2211
2212void TextNodeDumper::VisitAutoType(const AutoType *T) {
2213 if (T->isDecltypeAuto())
2214 OS << " decltype(auto)";
2215 if (!T->isDeduced())
2216 OS << " undeduced";
2217 if (T->isConstrained())
2218 dumpDeclRef(T->getTypeConstraintConcept());
2219}
2220
2222 const DeducedTemplateSpecializationType *T) {
2223 dumpTemplateName(T->getTemplateName(), "name");
2224}
2225
2227 const TemplateSpecializationType *T) {
2228 if (T->isTypeAlias())
2229 OS << " alias";
2230 if (ElaboratedTypeKeyword K = T->getKeyword();
2232 OS << ' ' << TypeWithKeyword::getKeywordName(K);
2233 dumpTemplateName(T->getTemplateName(), "name");
2234}
2235
2237 const InjectedClassNameType *T) {
2238 dumpDeclRef(T->getDecl());
2239}
2240
2244
2245void TextNodeDumper::VisitPackExpansionType(const PackExpansionType *T) {
2246 if (auto N = T->getNumExpansions())
2247 OS << " expansions " << *N;
2248}
2249
2251 // By default, add extra Type details with no extra loc info.
2253}
2254// FIXME: override behavior for TypeLocs that have interesting location
2255// information, such as the qualifier in ElaboratedTypeLoc.
2256
2258
2260 dumpName(D);
2262 if (D->isModulePrivate())
2263 OS << " __module_private__";
2264}
2265
2267 if (D->isScoped()) {
2268 if (D->isScopedUsingClassTag())
2269 OS << " class";
2270 else
2271 OS << " struct";
2272 }
2273 dumpName(D);
2274 if (D->isModulePrivate())
2275 OS << " __module_private__";
2276 if (D->isFixed())
2278
2279 if (const auto *Instance = D->getTemplateInstantiationPattern()) {
2280 OS << " instantiated_from";
2281 dumpPointer(Instance);
2282 }
2283}
2284
2286 OS << ' ' << D->getKindName();
2287 dumpName(D);
2288 if (D->isModulePrivate())
2289 OS << " __module_private__";
2290 if (D->isCompleteDefinition())
2291 OS << " definition";
2292}
2293
2298
2300 dumpName(D);
2301 dumpType(D->getType());
2302
2303 for (const auto *Child : D->chain())
2304 dumpDeclRef(Child);
2305}
2306
2308 dumpName(D);
2309 dumpType(D->getType());
2311
2312 StorageClass SC = D->getStorageClass();
2313 if (SC != SC_None)
2315 if (D->isInlineSpecified())
2316 OS << " inline";
2317 if (D->isVirtualAsWritten())
2318 OS << " virtual";
2319 if (D->isModulePrivate())
2320 OS << " __module_private__";
2321
2322 if (D->isPureVirtual())
2323 OS << " pure";
2324 if (D->isDefaulted()) {
2325 OS << " default";
2326 if (D->isDeleted())
2327 OS << "_delete";
2328 }
2329 if (D->isDeletedAsWritten())
2330 OS << " delete";
2331 if (D->isTrivial())
2332 OS << " trivial";
2333
2334 if (const StringLiteral *M = D->getDeletedMessage())
2335 AddChild("delete message", [=] { Visit(M); });
2336
2338 OS << (isa<CXXDestructorDecl>(D) ? " not_selected" : " ineligible");
2339
2340 if (const auto *FPT = D->getType()->getAs<FunctionProtoType>()) {
2341 FunctionProtoType::ExtProtoInfo EPI = FPT->getExtProtoInfo();
2342 switch (EPI.ExceptionSpec.Type) {
2343 default:
2344 break;
2345 case EST_Unevaluated:
2346 OS << " noexcept-unevaluated " << EPI.ExceptionSpec.SourceDecl;
2347 break;
2348 case EST_Uninstantiated:
2349 OS << " noexcept-uninstantiated " << EPI.ExceptionSpec.SourceTemplate;
2350 break;
2351 }
2352 }
2353
2354 if (const auto *MD = dyn_cast<CXXMethodDecl>(D)) {
2355 if (MD->size_overridden_methods() != 0) {
2356 auto dumpOverride = [=](const CXXMethodDecl *D) {
2357 SplitQualType T_split = D->getType().split();
2358 OS << D << " " << D->getParent()->getName() << "::" << D->getDeclName()
2359 << " '" << QualType::getAsString(T_split, PrintPolicy) << "'";
2360 };
2361
2362 AddChild([=] {
2363 auto Overrides = MD->overridden_methods();
2364 OS << "Overrides: [ ";
2365 dumpOverride(*Overrides.begin());
2366 for (const auto *Override : llvm::drop_begin(Overrides)) {
2367 OS << ", ";
2368 dumpOverride(Override);
2369 }
2370 OS << " ]";
2371 });
2372 }
2373 }
2374
2375 if (!D->isInlineSpecified() && D->isInlined()) {
2376 OS << " implicit-inline";
2377 }
2378 // Since NumParams comes from the FunctionProtoType of the FunctionDecl and
2379 // the Params are set later, it is possible for a dump during debugging to
2380 // encounter a FunctionDecl that has been created but hasn't been assigned
2381 // ParmVarDecls yet.
2382 if (!D->param_empty() && !D->param_begin())
2383 OS << " <<<NULL params x " << D->getNumParams() << ">>>";
2384
2385 if (const auto *Instance = D->getTemplateInstantiationPattern()) {
2386 OS << " instantiated_from";
2387 dumpPointer(Instance);
2388 }
2389}
2390
2392 const CXXDeductionGuideDecl *D) {
2394 switch (D->getDeductionCandidateKind()) {
2397 return;
2399 OS << " aggregate ";
2400 break;
2401 }
2402}
2403
2406 OS << " extended by ";
2408 OS << " mangling ";
2409 {
2410 ColorScope Color(OS, ShowColors, ValueColor);
2411 OS << D->getManglingNumber();
2412 }
2413}
2414
2416 dumpName(D);
2417 dumpType(D->getType());
2418 if (D->isMutable())
2419 OS << " mutable";
2420 if (D->isModulePrivate())
2421 OS << " __module_private__";
2422}
2423
2426 dumpName(D);
2427 if (const auto *P = dyn_cast<ParmVarDecl>(D);
2428 P && P->isExplicitObjectParameter())
2429 OS << " this";
2430
2431 dumpType(D->getType());
2433 StorageClass SC = D->getStorageClass();
2434 if (SC != SC_None)
2436 switch (D->getTLSKind()) {
2437 case VarDecl::TLS_None:
2438 break;
2440 OS << " tls";
2441 break;
2443 OS << " tls_dynamic";
2444 break;
2445 }
2446 if (D->isModulePrivate())
2447 OS << " __module_private__";
2448 if (D->isNRVOVariable())
2449 OS << " nrvo";
2450 if (D->isInline())
2451 OS << " inline";
2452 if (D->isConstexpr())
2453 OS << " constexpr";
2454 if (D->hasInit()) {
2455 switch (D->getInitStyle()) {
2456 case VarDecl::CInit:
2457 OS << " cinit";
2458 break;
2459 case VarDecl::CallInit:
2460 OS << " callinit";
2461 break;
2462 case VarDecl::ListInit:
2463 OS << " listinit";
2464 break;
2466 OS << " parenlistinit";
2467 }
2468 }
2469 if (D->needsDestruction(D->getASTContext()))
2470 OS << " destroyed";
2471 if (D->isParameterPack())
2472 OS << " pack";
2473
2474 if (const auto *Instance = D->getTemplateInstantiationPattern()) {
2475 OS << " instantiated_from";
2476 dumpPointer(Instance);
2477 }
2478
2479 if (D->hasInit()) {
2480 const Expr *E = D->getInit();
2481 // Only dump the value of constexpr VarDecls for now.
2482 if (E && !E->isValueDependent() && D->isConstexpr() &&
2483 !D->getType()->isDependentType()) {
2484 const APValue *Value = D->evaluateValue();
2485 if (Value)
2486 AddChild("value", [=] { Visit(*Value, E->getType()); });
2487 }
2488 }
2489}
2490
2492 dumpName(D);
2493 dumpType(D->getType());
2494}
2495
2497 if (D->isNothrow())
2498 OS << " nothrow";
2499}
2500
2502 OS << ' ' << D->getImportedModule()->getFullModuleName();
2503
2504 for (Decl *InitD :
2506 dumpDeclRef(InitD, "initializer");
2507}
2508
2510 OS << ' ';
2511 switch (D->getCommentKind()) {
2512 case PCK_Unknown:
2513 llvm_unreachable("unexpected pragma comment kind");
2514 case PCK_Compiler:
2515 OS << "compiler";
2516 break;
2517 case PCK_ExeStr:
2518 OS << "exestr";
2519 break;
2520 case PCK_Lib:
2521 OS << "lib";
2522 break;
2523 case PCK_Linker:
2524 OS << "linker";
2525 break;
2526 case PCK_User:
2527 OS << "user";
2528 break;
2529 }
2530 StringRef Arg = D->getArg();
2531 if (!Arg.empty())
2532 OS << " \"" << Arg << "\"";
2533}
2534
2536 const PragmaDetectMismatchDecl *D) {
2537 OS << " \"" << D->getName() << "\" \"" << D->getValue() << "\"";
2538}
2539
2541 const OMPExecutableDirective *D) {
2542 if (D->isStandaloneDirective())
2543 OS << " openmp_standalone_directive";
2544}
2545
2547 const OMPDeclareReductionDecl *D) {
2548 dumpName(D);
2549 dumpType(D->getType());
2550 OS << " combiner";
2552 if (const auto *Initializer = D->getInitializer()) {
2553 OS << " initializer";
2555 switch (D->getInitializerKind()) {
2557 OS << " omp_priv = ";
2558 break;
2560 OS << " omp_priv ()";
2561 break;
2563 break;
2564 }
2565 }
2566}
2567
2569 for (const auto *C : D->clauselists()) {
2570 AddChild([=] {
2571 if (!C) {
2572 ColorScope Color(OS, ShowColors, NullColor);
2573 OS << "<<<NULL>>> OMPClause";
2574 return;
2575 }
2576 {
2577 ColorScope Color(OS, ShowColors, AttrColor);
2578 StringRef ClauseName(
2579 llvm::omp::getOpenMPClauseName(C->getClauseKind()));
2580 OS << "OMP" << ClauseName.substr(/*Start=*/0, /*N=*/1).upper()
2581 << ClauseName.drop_front() << "Clause";
2582 }
2583 dumpPointer(C);
2584 dumpSourceRange(SourceRange(C->getBeginLoc(), C->getEndLoc()));
2585 });
2586 }
2587}
2588
2593
2595 dumpName(D);
2596 if (D->isInline())
2597 OS << " inline";
2598 if (D->isNested())
2599 OS << " nested";
2600 if (!D->isFirstDecl())
2601 dumpDeclRef(D->getFirstDecl(), "original");
2602}
2603
2608
2613
2618
2623
2625 VisitRecordDecl(D);
2626 if (const auto *Instance = D->getTemplateInstantiationPattern()) {
2627 OS << " instantiated_from";
2628 dumpPointer(Instance);
2629 }
2630 if (const auto *CTSD = dyn_cast<ClassTemplateSpecializationDecl>(D)) {
2631 dumpTemplateSpecializationKind(CTSD->getSpecializationKind());
2632 if (CTSD->hasStrictPackMatch())
2633 OS << " strict-pack-match";
2634 }
2635
2637
2638 if (!D->isCompleteDefinition())
2639 return;
2640
2641 AddChild([=] {
2642 {
2643 ColorScope Color(OS, ShowColors, DeclKindNameColor);
2644 OS << "DefinitionData";
2645 }
2646#define FLAG(fn, name) \
2647 if (D->fn()) \
2648 OS << " " #name;
2649 FLAG(isParsingBaseSpecifiers, parsing_base_specifiers);
2650
2651 FLAG(isGenericLambda, generic);
2652 FLAG(isLambda, lambda);
2653
2654 FLAG(isAnonymousStructOrUnion, is_anonymous);
2655 FLAG(canPassInRegisters, pass_in_registers);
2656 FLAG(isEmpty, empty);
2657 FLAG(isAggregate, aggregate);
2658 FLAG(isStandardLayout, standard_layout);
2659 FLAG(isTriviallyCopyable, trivially_copyable);
2660 FLAG(isPOD, pod);
2661 FLAG(isTrivial, trivial);
2662 FLAG(isPolymorphic, polymorphic);
2663 FLAG(isAbstract, abstract);
2664 FLAG(isLiteral, literal);
2665
2666 FLAG(hasUserDeclaredConstructor, has_user_declared_ctor);
2667 FLAG(hasConstexprNonCopyMoveConstructor, has_constexpr_non_copy_move_ctor);
2668 FLAG(hasMutableFields, has_mutable_fields);
2669 FLAG(hasVariantMembers, has_variant_members);
2670 FLAG(allowConstDefaultInit, can_const_default_init);
2671
2672 AddChild([=] {
2673 {
2674 ColorScope Color(OS, ShowColors, DeclKindNameColor);
2675 OS << "DefaultConstructor";
2676 }
2677 FLAG(hasDefaultConstructor, exists);
2678 FLAG(hasTrivialDefaultConstructor, trivial);
2679 FLAG(hasNonTrivialDefaultConstructor, non_trivial);
2680 FLAG(hasUserProvidedDefaultConstructor, user_provided);
2681 FLAG(hasConstexprDefaultConstructor, constexpr);
2682 FLAG(needsImplicitDefaultConstructor, needs_implicit);
2683 FLAG(defaultedDefaultConstructorIsConstexpr, defaulted_is_constexpr);
2684 });
2685
2686 AddChild([=] {
2687 {
2688 ColorScope Color(OS, ShowColors, DeclKindNameColor);
2689 OS << "CopyConstructor";
2690 }
2691 FLAG(hasSimpleCopyConstructor, simple);
2692 FLAG(hasTrivialCopyConstructor, trivial);
2693 FLAG(hasNonTrivialCopyConstructor, non_trivial);
2694 FLAG(hasUserDeclaredCopyConstructor, user_declared);
2695 FLAG(hasCopyConstructorWithConstParam, has_const_param);
2696 FLAG(needsImplicitCopyConstructor, needs_implicit);
2697 FLAG(needsOverloadResolutionForCopyConstructor,
2698 needs_overload_resolution);
2700 FLAG(defaultedCopyConstructorIsDeleted, defaulted_is_deleted);
2701 FLAG(implicitCopyConstructorHasConstParam, implicit_has_const_param);
2702 });
2703
2704 AddChild([=] {
2705 {
2706 ColorScope Color(OS, ShowColors, DeclKindNameColor);
2707 OS << "MoveConstructor";
2708 }
2709 FLAG(hasMoveConstructor, exists);
2710 FLAG(hasSimpleMoveConstructor, simple);
2711 FLAG(hasTrivialMoveConstructor, trivial);
2712 FLAG(hasNonTrivialMoveConstructor, non_trivial);
2713 FLAG(hasUserDeclaredMoveConstructor, user_declared);
2714 FLAG(needsImplicitMoveConstructor, needs_implicit);
2715 FLAG(needsOverloadResolutionForMoveConstructor,
2716 needs_overload_resolution);
2718 FLAG(defaultedMoveConstructorIsDeleted, defaulted_is_deleted);
2719 });
2720
2721 AddChild([=] {
2722 {
2723 ColorScope Color(OS, ShowColors, DeclKindNameColor);
2724 OS << "CopyAssignment";
2725 }
2726 FLAG(hasSimpleCopyAssignment, simple);
2727 FLAG(hasTrivialCopyAssignment, trivial);
2728 FLAG(hasNonTrivialCopyAssignment, non_trivial);
2729 FLAG(hasCopyAssignmentWithConstParam, has_const_param);
2730 FLAG(hasUserDeclaredCopyAssignment, user_declared);
2731 FLAG(needsImplicitCopyAssignment, needs_implicit);
2732 FLAG(needsOverloadResolutionForCopyAssignment, needs_overload_resolution);
2733 FLAG(implicitCopyAssignmentHasConstParam, implicit_has_const_param);
2734 });
2735
2736 AddChild([=] {
2737 {
2738 ColorScope Color(OS, ShowColors, DeclKindNameColor);
2739 OS << "MoveAssignment";
2740 }
2741 FLAG(hasMoveAssignment, exists);
2742 FLAG(hasSimpleMoveAssignment, simple);
2743 FLAG(hasTrivialMoveAssignment, trivial);
2744 FLAG(hasNonTrivialMoveAssignment, non_trivial);
2745 FLAG(hasUserDeclaredMoveAssignment, user_declared);
2746 FLAG(needsImplicitMoveAssignment, needs_implicit);
2747 FLAG(needsOverloadResolutionForMoveAssignment, needs_overload_resolution);
2748 });
2749
2750 AddChild([=] {
2751 {
2752 ColorScope Color(OS, ShowColors, DeclKindNameColor);
2753 OS << "Destructor";
2754 }
2755 FLAG(hasSimpleDestructor, simple);
2756 FLAG(hasIrrelevantDestructor, irrelevant);
2757 FLAG(hasTrivialDestructor, trivial);
2758 FLAG(hasNonTrivialDestructor, non_trivial);
2759 FLAG(hasUserDeclaredDestructor, user_declared);
2760 FLAG(hasConstexprDestructor, constexpr);
2761 FLAG(needsImplicitDestructor, needs_implicit);
2762 FLAG(needsOverloadResolutionForDestructor, needs_overload_resolution);
2764 FLAG(defaultedDestructorIsDeleted, defaulted_is_deleted);
2765 });
2766 });
2767
2768 for (const auto &I : D->bases()) {
2769 AddChild([=] {
2770 if (I.isVirtual())
2771 OS << "virtual ";
2772 dumpAccessSpecifier(I.getAccessSpecifier());
2773 dumpType(I.getType());
2774 if (I.isPackExpansion())
2775 OS << "...";
2776 });
2777 }
2778}
2779
2783
2787
2791
2795
2797 if (const auto *TC = D->getTypeConstraint()) {
2798 OS << " ";
2799 dumpBareDeclRef(TC->getNamedConcept());
2800 if (TC->getNamedConcept() != TC->getFoundDecl()) {
2801 OS << " (";
2802 dumpBareDeclRef(TC->getFoundDecl());
2803 OS << ")";
2804 }
2805 } else if (D->wasDeclaredWithTypename())
2806 OS << " typename";
2807 else
2808 OS << " class";
2809 OS << " depth " << D->getDepth() << " index " << D->getIndex();
2810 if (D->isParameterPack())
2811 OS << " ...";
2812 dumpName(D);
2813}
2814
2816 const NonTypeTemplateParmDecl *D) {
2817 dumpType(D->getType());
2818 OS << " depth " << D->getDepth() << " index " << D->getIndex();
2819 if (D->isParameterPack())
2820 OS << " ...";
2821 dumpName(D);
2822}
2823
2825 const TemplateTemplateParmDecl *D) {
2826 OS << " depth " << D->getDepth() << " index " << D->getIndex();
2827 if (D->isParameterPack())
2828 OS << " ...";
2829 dumpName(D);
2830}
2831
2833 OS << ' ';
2835 OS << D->getDeclName();
2837}
2838
2840 OS << ' ';
2842}
2843
2845 const UnresolvedUsingTypenameDecl *D) {
2846 OS << ' ';
2848 OS << D->getDeclName();
2849}
2850
2852 const UnresolvedUsingValueDecl *D) {
2853 OS << ' ';
2855 OS << D->getDeclName();
2856 dumpType(D->getType());
2857}
2858
2863
2865 const ConstructorUsingShadowDecl *D) {
2866 if (D->constructsVirtualBase())
2867 OS << " virtual";
2868
2869 AddChild([=] {
2870 OS << "target ";
2872 });
2873
2874 AddChild([=] {
2875 OS << "nominated ";
2877 OS << ' ';
2879 });
2880
2881 AddChild([=] {
2882 OS << "constructed ";
2884 OS << ' ';
2886 });
2887}
2888
2890 switch (D->getLanguage()) {
2892 OS << " C";
2893 break;
2895 OS << " C++";
2896 break;
2897 }
2898}
2899
2901 OS << ' ';
2903}
2904
2906 if (TypeSourceInfo *T = D->getFriendType())
2907 dumpType(T->getType());
2908 if (D->isPackExpansion())
2909 OS << "...";
2910}
2911
2913 dumpName(D);
2914 dumpType(D->getType());
2915 if (D->getSynthesize())
2916 OS << " synthesize";
2917
2918 switch (D->getAccessControl()) {
2919 case ObjCIvarDecl::None:
2920 OS << " none";
2921 break;
2923 OS << " private";
2924 break;
2926 OS << " protected";
2927 break;
2929 OS << " public";
2930 break;
2932 OS << " package";
2933 break;
2934 }
2935}
2936
2938 if (D->isInstanceMethod())
2939 OS << " -";
2940 else
2941 OS << " +";
2942 dumpName(D);
2943 dumpType(D->getReturnType());
2944
2945 if (D->isVariadic())
2946 OS << " variadic";
2947}
2948
2950 dumpName(D);
2951 switch (D->getVariance()) {
2953 break;
2954
2956 OS << " covariant";
2957 break;
2958
2960 OS << " contravariant";
2961 break;
2962 }
2963
2964 if (D->hasExplicitBound())
2965 OS << " bounded";
2967}
2968
2970 dumpName(D);
2973 for (const auto *P : D->protocols())
2974 dumpDeclRef(P);
2975}
2976
2982
2984 dumpName(D);
2985
2986 for (const auto *Child : D->protocols())
2987 dumpDeclRef(Child);
2988}
2989
2991 dumpName(D);
2992 dumpDeclRef(D->getSuperClass(), "super");
2993
2995 for (const auto *Child : D->protocols())
2996 dumpDeclRef(Child);
2997}
2998
3005
3011
3013 dumpName(D);
3014 dumpType(D->getType());
3015
3017 OS << " required";
3019 OS << " optional";
3020
3024 OS << " readonly";
3026 OS << " assign";
3028 OS << " readwrite";
3030 OS << " retain";
3032 OS << " copy";
3034 OS << " nonatomic";
3036 OS << " atomic";
3038 OS << " weak";
3040 OS << " strong";
3042 OS << " unsafe_unretained";
3044 OS << " class";
3046 OS << " direct";
3048 dumpDeclRef(D->getGetterMethodDecl(), "getter");
3050 dumpDeclRef(D->getSetterMethodDecl(), "setter");
3051 }
3052}
3053
3057 OS << " synthesize";
3058 else
3059 OS << " dynamic";
3062}
3063
3065 if (D->isVariadic())
3066 OS << " variadic";
3067
3068 if (D->capturesCXXThis())
3069 OS << " captures_this";
3070}
3071
3075
3077 VisitStmt(S);
3078 if (S->hasStoredFPFeatures())
3079 printFPOptions(S->getStoredFPFeatures());
3080}
3081
3083 if (D->isCBuffer())
3084 OS << " cbuffer";
3085 else
3086 OS << " tbuffer";
3087 dumpName(D);
3088}
3089
3091 const HLSLRootSignatureDecl *D) {
3092 dumpName(D);
3093 OS << " version: ";
3094 switch (D->getVersion()) {
3095 case llvm::dxbc::RootSignatureVersion::V1_0:
3096 OS << "1.0";
3097 break;
3098 case llvm::dxbc::RootSignatureVersion::V1_1:
3099 OS << "1.1";
3100 break;
3101 case llvm::dxbc::RootSignatureVersion::V1_2:
3102 OS << "1.2";
3103 break;
3104 }
3105 OS << ", ";
3106 llvm::hlsl::rootsig::dumpRootElements(OS, D->getRootElements());
3107}
3108
3110 OS << (E->isInOut() ? " inout" : " out");
3111}
3112
3117 if (S->isOrphanedLoopConstruct())
3118 OS << " <orphan>";
3119 else
3120 OS << " parent: " << S->getParentComputeConstructKind();
3121}
3122
3127
3131
3136
3141
3146
3151 const OpenACCCacheConstruct *S) {
3153 if (S->hasReadOnly())
3154 OS <<" readonly";
3155}
3170
3176
3178 OS << " " << D->getDirectiveKind();
3179
3180 for (const OpenACCClause *C : D->clauses())
3181 AddChild([=] {
3182 Visit(C);
3183 for (const Stmt *S : C->children())
3184 AddChild([=] { Visit(S); });
3185 });
3186}
3188 OS << " " << D->getDirectiveKind();
3189
3191
3192 AddChild([=] { Visit(D->getFunctionReference()); });
3193
3194 for (const OpenACCClause *C : D->clauses())
3195 AddChild([=] {
3196 Visit(C);
3197 for (const Stmt *S : C->children())
3198 AddChild([=] { Visit(S); });
3199 });
3200}
3201
3203 const OpenACCRoutineDeclAttr *A) {
3204 for (const OpenACCClause *C : A->Clauses)
3205 AddChild([=] {
3206 Visit(C);
3207 for (const Stmt *S : C->children())
3208 AddChild([=] { Visit(S); });
3209 });
3210}
3211
3213 AddChild("begin", [=] { OS << S->getStartingElementPos(); });
3214 AddChild("number of elements", [=] { OS << S->getDataElementCount(); });
3215}
3216
3218 OS << ' ' << AE->getOpAsString();
3219}
3220
3222 VisitStmt(S);
3223 if (S->hasStoredFPFeatures())
3224 printFPOptions(S->getStoredFPFeatures());
3225}
static double GetApproxValue(const llvm::APFloat &F)
Definition APValue.cpp:632
#define V(N, I)
static bool isTrivial(ASTContext &Ctx, const Expr *E)
Checks if the expression is constant or does not have non-trivial function calls.
This file defines OpenMP nodes for declarative directives.
Defines the C++ template declaration subclasses.
#define X(type, name)
Definition Value.h:97
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.
OpenACCAtomicKind getAtomicKind() const
bool hasReadOnly() const
This class represents a 'loop' construct. The 'loop' construct applies to a 'for' loop (or range-for ...
bool isOrphanedLoopConstruct() const
OpenACC 3.3 2.9: An orphaned loop construct is a loop construct that is not lexically enclosed within...
OpenACCDirectiveKind getParentComputeConstructKind() const
llvm::APInt getValue() const
QualType getDynamicAllocType() const
Definition APValue.cpp:122
APValue - This class implements a discriminated union of [uninitialized] [APSInt] [APFloat],...
Definition APValue.h:122
@ 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
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition ASTContext.h:220
ArrayRef< Decl * > getModuleInitializers(Module *M)
Get the initializations to perform when importing a module, if any.
const clang::PrintingPolicy & getPrintingPolicy() const
Definition ASTContext.h:829
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:4484
LabelDecl * getLabel() const
Definition Expr.h:4507
An Embarcadero array type trait, as used in the implementation of __array_rank and __array_extent.
Definition ExprCXX.h:2996
ArrayTypeTrait getTrait() const
Definition ExprCXX.h:3036
Represents an array type, per C99 6.7.5.2 - Array Declarators.
Definition TypeBase.h:3722
AtomicExpr - Variadic atomic builtins: __atomic_exchange, __atomic_fetch_*, __atomic_load,...
Definition Expr.h:6814
StringRef getOpAsString() const
Definition Expr.h:6878
Attr - This represents one attribute.
Definition Attr.h:45
attr::Kind getKind() const
Definition Attr.h:91
bool isInherited() const
Definition Attr.h:100
bool isImplicit() const
Returns true if the attribute has been implicitly created instead of explicitly written by the user.
Definition Attr.h:104
A builtin binary operation expression such as "x + y" or "x <= y".
Definition Expr.h:3972
StringRef getOpcodeStr() const
Definition Expr.h:4038
bool hasStoredFPFeatures() const
Definition Expr.h:4157
FPOptionsOverride getStoredFPFeatures() const
Get FPFeatures from trailing storage.
Definition Expr.h:4169
Opcode getOpcode() const
Definition Expr.h:4017
A binding in a decomposition declaration.
Definition DeclCXX.h:4185
A class which contains all the information about a particular captured value.
Definition Decl.h:4674
Represents a block literal declaration, which is like an unnamed FunctionDecl.
Definition Decl.h:4668
bool capturesCXXThis() const
Definition Decl.h:4800
bool isVariadic() const
Definition Decl.h:4743
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:1493
A boolean literal, per ([C++ lex.bool] Boolean literals).
Definition ExprCXX.h:723
bool getValue() const
Definition ExprCXX.h:740
Represents a call to a C++ constructor.
Definition ExprCXX.h:1548
bool isElidable() const
Whether this construction is elidable.
Definition ExprCXX.h:1617
bool isStdInitListInitialization() const
Whether this constructor call was written as list-initialization, but was interpreted as forming a st...
Definition ExprCXX.h:1641
bool isImmediateEscalating() const
Definition ExprCXX.h:1706
bool requiresZeroInitialization() const
Whether this construction first requires zero-initialization before the initializer is called.
Definition ExprCXX.h:1650
CXXConstructorDecl * getConstructor() const
Get the constructor that this expression will (ultimately) call.
Definition ExprCXX.h:1611
bool isListInitialization() const
Whether this constructor call was written as list-initialization.
Definition ExprCXX.h:1630
Represents a C++ constructor within a class.
Definition DeclCXX.h:2604
Represents a C++ base or member initializer.
Definition DeclCXX.h:2369
Represents a C++ deduction guide declaration.
Definition DeclCXX.h:1979
DeductionCandidate getDeductionCandidateKind() const
Definition DeclCXX.h:2075
A default argument (C++ [dcl.fct.default]).
Definition ExprCXX.h:1270
bool hasRewrittenInit() const
Definition ExprCXX.h:1315
A use of a default initializer in a constructor or in aggregate initialization.
Definition ExprCXX.h:1377
bool hasRewrittenInit() const
Definition ExprCXX.h:1406
Represents a delete expression for memory deallocation and destructor calls, e.g.
Definition ExprCXX.h:2626
FunctionDecl * getOperatorDelete() const
Definition ExprCXX.h:2665
bool isArrayForm() const
Definition ExprCXX.h:2652
bool isGlobalDelete() const
Definition ExprCXX.h:2651
Represents a C++ member access expression where the actual member referenced could not be resolved be...
Definition ExprCXX.h:3870
bool isArrow() const
Determine whether this member expression used the '->' operator; otherwise, it used the '.
Definition ExprCXX.h:3969
DeclarationName getMember() const
Retrieve the name of the member that this expression refers to.
Definition ExprCXX.h:4008
Represents an explicit C++ type conversion that uses "functional" notation (C++ [expr....
Definition ExprCXX.h:1831
Represents a static or instance method of a struct/union/class.
Definition DeclCXX.h:2129
Abstract class common to all of the C++ "named"/"keyword" casts.
Definition ExprCXX.h:375
const char * getCastName() const
getCastName - Get the name of the C++ cast being used, e.g., "static_cast", "dynamic_cast",...
Definition ExprCXX.cpp:768
Represents a new-expression for memory allocation and constructor calls, e.g: "new CXXNewExpr(foo)".
Definition ExprCXX.h:2355
bool isArray() const
Definition ExprCXX.h:2464
FunctionDecl * getOperatorNew() const
Definition ExprCXX.h:2459
bool isGlobalNew() const
Definition ExprCXX.h:2521
A call to an overloaded operator written using operator syntax.
Definition ExprCXX.h:84
OverloadedOperatorKind getOperator() const
Returns the kind of overloaded operator that this expression refers to.
Definition ExprCXX.h:114
Represents a C++ struct/union/class.
Definition DeclCXX.h:258
base_class_range bases()
Definition DeclCXX.h:608
const CXXRecordDecl * getTemplateInstantiationPattern() const
Retrieve the record declaration from which this record could be instantiated.
Definition DeclCXX.cpp:2075
bool needsOverloadResolutionForMoveConstructor() const
Determine whether we need to eagerly declare a defaulted move constructor for this class.
Definition DeclCXX.h:902
bool needsOverloadResolutionForDestructor() const
Determine whether we need to eagerly declare a destructor for this class.
Definition DeclCXX.h:1013
bool needsOverloadResolutionForCopyConstructor() const
Determine whether we need to eagerly declare a defaulted copy constructor for this class.
Definition DeclCXX.h:805
A C++ static_cast expression (C++ [expr.static.cast]).
Definition ExprCXX.h:436
Represents the this expression in C++.
Definition ExprCXX.h:1154
bool isCapturedByCopyInLambdaWithExplicitObjectParameter() const
Definition ExprCXX.h:1180
bool isImplicit() const
Definition ExprCXX.h:1177
Describes an explicit type conversion that uses functional notion but could not be resolved because o...
Definition ExprCXX.h:3744
bool isListInitialization() const
Determine whether this expression models list-initialization.
Definition ExprCXX.h:3799
QualType getTypeAsWritten() const
Retrieve the type that is being constructed, as specified in the source code.
Definition ExprCXX.h:3778
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
Definition Expr.h:2877
bool hasStoredFPFeatures() const
Definition Expr.h:3036
bool usesADL() const
Definition Expr.h:3034
FPOptionsOverride getFPFeatures() const
Definition Expr.h:3176
Represents the body of a CapturedStmt, and serves as its DeclContext.
Definition Decl.h:4940
bool isNothrow() const
Definition Decl.cpp:5628
CaseStmt - Represent a case statement.
Definition Stmt.h:1899
bool caseStmtIsGNURange() const
True if this case statement is of the form case LHS ... RHS, which is a GNU extension.
Definition Stmt.h:1962
CastExpr - Base class for type casts, including both implicit casts (ImplicitCastExpr) and explicit c...
Definition Expr.h:3610
path_iterator path_begin()
Definition Expr.h:3680
bool hasStoredFPFeatures() const
Definition Expr.h:3709
static const char * getCastKindName(CastKind CK)
Definition Expr.cpp:1947
path_iterator path_end()
Definition Expr.h:3681
const CXXBaseSpecifier *const * path_const_iterator
Definition Expr.h:3677
bool path_empty() const
Definition Expr.h:3678
FPOptionsOverride getFPFeatures() const
Definition Expr.h:3730
unsigned getValue() const
Definition Expr.h:1629
Declaration of a class template.
Represents a 'co_await' expression.
Definition ExprCXX.h:5369
bool isImplicit() const
Definition ExprCXX.h:5391
CompoundAssignOperator - For compound assignments (e.g.
Definition Expr.h:4234
QualType getComputationLHSType() const
Definition Expr.h:4268
QualType getComputationResultType() const
Definition Expr.h:4271
CompoundStmt - This represents a group of statements like { stmt stmt }.
Definition Stmt.h:1719
FPOptionsOverride getStoredFPFeatures() const
Get FPOptionsOverride from trailing storage.
Definition Stmt.h:1769
bool hasStoredFPFeatures() const
Definition Stmt.h:1766
Declaration of a C++20 concept.
A reference to a concept and its template args, as it appears in the code.
Definition ASTConcept.h:130
SourceRange getSourceRange() const LLVM_READONLY
Definition ASTConcept.h:193
TemplateDecl * getNamedConcept() const
Definition ASTConcept.h:201
Represents the specialization of a concept - evaluates to a prvalue of type bool.
NamedDecl * getFoundDecl() const
Represents the canonical version of C arrays with a specified constant size.
Definition TypeBase.h:3760
ConstantExpr - An expression that occurs in a constant context and optionally the result of evaluatin...
Definition Expr.h:1082
APValue getAPValueResult() const
Definition Expr.cpp:409
bool hasAPValueResult() const
Definition Expr.h:1157
Represents a shadow constructor declaration introduced into a class by a C++11 using-declaration that...
Definition DeclCXX.h:3677
CXXRecordDecl * getConstructedBaseClass() const
Get the base class whose constructor or constructor shadow declaration is passed the constructor argu...
Definition DeclCXX.h:3768
bool constructsVirtualBase() const
Returns true if the constructed base class is a virtual base class subobject of this declaration's cl...
Definition DeclCXX.h:3777
ConstructorUsingShadowDecl * getConstructedBaseClassShadowDecl() const
Get the inheriting constructor declaration for the base class for which we don't have an explicit ini...
Definition DeclCXX.h:3758
ConstructorUsingShadowDecl * getNominatedBaseClassShadowDecl() const
Get the inheriting constructor declaration for the direct base class from which this using shadow dec...
Definition DeclCXX.h:3752
CXXRecordDecl * getNominatedBaseClass() const
Get the base class that was named in the using declaration.
Definition DeclCXX.cpp:3397
ConvertVectorExpr - Clang builtin function __builtin_convertvector This AST node provides support for...
Definition Expr.h:4653
FPOptionsOverride getStoredFPFeatures() const
Get FPFeatures from trailing storage.
Definition Expr.h:4716
bool hasStoredFPFeatures() const
Is FPFeatures in Trailing Storage?
Definition Expr.h:4711
Represents a 'co_return' statement in the C++ Coroutines TS.
Definition StmtCXX.h:473
bool isImplicit() const
Definition StmtCXX.h:506
DeclContext * getParent()
getParent - Returns the containing DeclContext.
Definition DeclBase.h:2109
A reference to a declared variable, function, enum, etc.
Definition Expr.h:1270
NamedDecl * getFoundDecl()
Get the NamedDecl through which this reference occurred.
Definition Expr.h:1381
NestedNameSpecifier getQualifier() const
If the name was qualified, retrieves the nested-name-specifier that precedes the name.
Definition Expr.h:1371
bool refersToEnclosingVariableOrCapture() const
Does this DeclRefExpr refer to an enclosing local or a captured variable?
Definition Expr.h:1474
bool isCapturedByCopyInLambdaWithExplicitObjectParameter() const
Definition Expr.h:1486
ValueDecl * getDecl()
Definition Expr.h:1338
NonOdrUseReason isNonOdrUse() const
Is this expression a non-odr-use reference, and if so, why?
Definition Expr.h:1468
bool isImmediateEscalating() const
Definition Expr.h:1478
Decl - This represents one declaration (or definition), e.g.
Definition DeclBase.h:86
FriendObjectKind getFriendObjectKind() const
Determines whether this declaration is the object of a friend declaration and, if so,...
Definition DeclBase.h:1226
ASTContext & getASTContext() const LLVM_READONLY
Definition DeclBase.cpp:546
bool isImplicit() const
isImplicit - Indicates whether the declaration was implicitly generated by the implementation.
Definition DeclBase.h:593
@ FOK_Undeclared
A friend of a previously-undeclared entity.
Definition DeclBase.h:1219
@ FOK_None
Not a friend object.
Definition DeclBase.h:1217
@ FOK_Declared
A friend of a previously-declared entity.
Definition DeclBase.h:1218
Module * getOwningModule() const
Get the module that owns this declaration (for visibility purposes).
Definition DeclBase.h:842
bool isFromASTFile() const
Determine whether this declaration came from an AST file (such as a precompiled header or module) rat...
Definition DeclBase.h:793
bool isInvalidDecl() const
Definition DeclBase.h:588
SourceLocation getLocation() const
Definition DeclBase.h:439
const char * getDeclKindName() const
Definition DeclBase.cpp:169
bool isThisDeclarationReferenced() const
Whether this declaration was referenced.
Definition DeclBase.h:621
bool isUsed(bool CheckUsedAttr=true) const
Whether any (re-)declaration of the entity was used, meaning that a definition is required.
Definition DeclBase.cpp:575
DeclContext * getDeclContext()
Definition DeclBase.h:448
AccessSpecifier getAccess() const
Definition DeclBase.h:507
DeclContext * getLexicalDeclContext()
getLexicalDeclContext - The declaration context where this Decl was lexically declared (LexicalDC).
Definition DeclBase.h:918
Kind getKind() const
Definition DeclBase.h:442
virtual SourceRange getSourceRange() const LLVM_READONLY
Source range that this declaration covers.
Definition DeclBase.h:427
The name of a declaration.
NestedNameSpecifier getQualifier() const
Retrieve the nested-name-specifier that qualifies the name of this declaration, if it was present in ...
Definition Decl.h:837
TemplateName getUnderlying() const
DefaultArguments getDefaultArguments() const
A qualified reference to a name whose declaration cannot yet be resolved.
Definition ExprCXX.h:3510
NestedNameSpecifier getQualifier() const
Retrieve the nested-name-specifier that qualifies this declaration.
Definition ExprCXX.h:3562
Represents an array type in C++ whose size is a value-dependent expression.
Definition TypeBase.h:4011
Represents an extended vector type where either the type or size is dependent.
Definition TypeBase.h:4101
NestedNameSpecifier getQualifier() const
Return the nested name specifier that qualifies this name.
Symbolic representation of a dynamic allocation.
Definition APValue.h:65
Represents a reference to emded data.
Definition Expr.h:5060
unsigned getStartingElementPos() const
Definition Expr.h:5081
size_t getDataElementCount() const
Definition Expr.h:5082
An instance of this object exists for each enum constant that is defined.
Definition Decl.h:3423
Represents an enum.
Definition Decl.h:4007
bool isScoped() const
Returns true if this is a C++11 scoped enumeration.
Definition Decl.h:4225
bool isScopedUsingClassTag() const
Returns true if this is a C++11 scoped enumeration.
Definition Decl.h:4228
bool isFixed() const
Returns true if this is an Objective-C, C++11, or Microsoft-style enumeration with a fixed underlying...
Definition Decl.h:4234
QualType getIntegerType() const
Return the integer type this enum decl corresponds to.
Definition Decl.h:4180
EnumDecl * getTemplateInstantiationPattern() const
Retrieve the enum definition from which this enumeration could be instantiated, if it is an instantia...
Definition Decl.cpp:5073
QualType getTypeAsWritten() const
getTypeAsWritten - Returns the type that this expression is casting to, as written in the source code...
Definition Expr.h:3889
Represents an expression – generally a full-expression – that introduces cleanups to be run at the en...
Definition ExprCXX.h:3661
CleanupObject getObject(unsigned i) const
Definition ExprCXX.h:3691
unsigned getNumObjects() const
Definition ExprCXX.h:3689
llvm::PointerUnion< BlockDecl *, CompoundLiteralExpr * > CleanupObject
The type of objects that are kept in the cleanup.
Definition ExprCXX.h:3667
This represents one expression.
Definition Expr.h:112
bool isValueDependent() const
Determines whether the value of this expression depends on.
Definition Expr.h:177
QualType getType() const
Definition Expr.h:144
An expression trait intrinsic.
Definition ExprCXX.h:3069
ExpressionTrait getTrait() const
Definition ExprCXX.h:3104
ExtVectorElementExpr - This represents access to specific elements of a vector, and may occur on the ...
Definition Expr.h:6498
IdentifierInfo & getAccessor() const
Definition Expr.h:6519
Represents difference between two FPOptions values.
Represents a member of a struct/union/class.
Definition Decl.h:3160
bool isMutable() const
Determines whether this field is mutable (C++ only).
Definition Decl.h:3260
std::string getValueAsString(unsigned Radix) const
Definition Expr.cpp:1006
double getValueAsApproximateDouble() const
getValueAsApproximateDouble - This returns the value as an inaccurate double.
Definition Expr.cpp:1085
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:125
bool isPackExpansion() const
Definition DeclFriend.h:190
Represents a function declaration or definition.
Definition Decl.h:2000
StringLiteral * getDeletedMessage() const
Get the message that indicates why this function was deleted.
Definition Decl.h:2758
bool isInlined() const
Determine whether this function should be inlined, because it is either marked "inline" or "constexpr...
Definition Decl.h:2921
FunctionDecl * getTemplateInstantiationPattern(bool ForDefinition=true) const
Retrieve the function declaration from which this function could be instantiated, if it is an instant...
Definition Decl.cpp:4260
bool isTrivial() const
Whether this function is "trivial" in some specialized C++ senses.
Definition Decl.h:2377
param_iterator param_begin()
Definition Decl.h:2786
bool isDeleted() const
Whether this function has been deleted.
Definition Decl.h:2540
StorageClass getStorageClass() const
Returns the storage class as written in the source.
Definition Decl.h:2888
bool isDeletedAsWritten() const
Definition Decl.h:2544
bool isPureVirtual() const
Whether this virtual function is pure, i.e.
Definition Decl.h:2353
bool param_empty() const
Definition Decl.h:2785
bool isDefaulted() const
Whether this function is defaulted.
Definition Decl.h:2385
bool isIneligibleOrNotSelected() const
Definition Decl.h:2418
TemplateSpecializationKind getTemplateSpecializationKind() const
Determine what kind of template instantiation this function represents.
Definition Decl.cpp:4413
bool isVirtualAsWritten() const
Whether this function is marked as virtual explicitly.
Definition Decl.h:2344
unsigned getNumParams() const
Return the number of parameters this function must have based on its FunctionType.
Definition Decl.cpp:3822
bool isInlineSpecified() const
Determine whether the "inline" keyword was specified for this function.
Definition Decl.h:2899
Represents a prototype with parameter type info, e.g.
Definition TypeBase.h:5254
Declaration of a template function.
FunctionType - C99 6.7.5.3 - Function Declarators.
Definition TypeBase.h:4450
static StringRef getNameForCallConv(CallingConv CC)
Definition Type.cpp:3577
Represents a C11 generic selection.
Definition Expr.h:6112
AssociationTy< true > ConstAssociation
Definition Expr.h:6344
bool isResultDependent() const
Whether this generic selection is result-dependent.
Definition Expr.h:6364
GotoStmt - This represents a direct goto.
Definition Stmt.h:2948
LabelDecl * getLabel() const
Definition Stmt.h:2961
HLSLBufferDecl - Represent a cbuffer or tbuffer declaration.
Definition Decl.h:5190
bool isCBuffer() const
Definition Decl.h:5234
This class represents temporary values used to represent inout and out arguments in HLSL.
Definition Expr.h:7283
bool isInOut() const
returns true if the parameter is inout and false if the parameter is out.
Definition Expr.h:7342
ArrayRef< llvm::hlsl::rootsig::RootElement > getRootElements() const
Definition Decl.h:5307
llvm::dxbc::RootSignatureVersion getVersion() const
Definition Decl.h:5305
const char * getNameStart() const
Return the beginning of the actual null-terminated string for this identifier.
StringRef getName() const
Return the actual identifier string.
IfStmt - This represents an if/then/else.
Definition Stmt.h:2238
bool hasElseStorage() const
True if this IfStmt has storage for an else statement.
Definition Stmt.h:2313
bool hasVarStorage() const
True if this IfStmt has storage for a variable declaration.
Definition Stmt.h:2310
bool isConstexpr() const
Definition Stmt.h:2431
bool hasInitStorage() const
True if this IfStmt has the storage for an init statement.
Definition Stmt.h:2307
bool isNegatedConsteval() const
Definition Stmt.h:2427
bool isConsteval() const
Definition Stmt.h:2418
ImplicitCastExpr - Allows us to explicitly represent implicit type conversions, which have no direct ...
Definition Expr.h:3787
bool isPartOfExplicitCast() const
Definition Expr.h:3818
Describes a module import declaration, which makes the contents of the named module visible in the cu...
Definition Decl.h:5049
Module * getImportedModule() const
Retrieve the module that was imported by the import declaration.
Definition Decl.h:5107
Represents a field injected from an anonymous union/struct into the parent scope.
Definition Decl.h:3467
ArrayRef< NamedDecl * > chain() const
Definition Decl.h:3488
Describes an C or C++ initializer list.
Definition Expr.h:5233
FieldDecl * getInitializedFieldInUnion()
If this initializes a union, specifies which field in the union to initialize.
Definition Expr.h:5359
Represents the declaration of a label.
Definition Decl.h:524
LabelStmt - Represents a label, which has a substatement.
Definition Stmt.h:2125
bool isSideEntry() const
Definition Stmt.h:2172
const char * getName() const
Definition Stmt.cpp:432
Implicit declaration of a temporary that was materialized by a MaterializeTemporaryExpr and lifetime-...
Definition DeclCXX.h:3308
Represents a linkage specification.
Definition DeclCXX.h:3015
LinkageSpecLanguageIDs getLanguage() const
Return the language specified by this linkage specification.
Definition DeclCXX.h:3038
Base class for BreakStmt and ContinueStmt.
Definition Stmt.h:3036
LabelDecl * getLabelDecl()
Definition Stmt.h:3074
const Stmt * getNamedLoopOrSwitch() const
If this is a named break/continue, get the loop or switch statement that this targets.
Definition Stmt.cpp:1497
bool hasLabelTarget() const
Definition Stmt.h:3069
Represents a prvalue temporary that is written into memory so that a reference can bind to it.
Definition ExprCXX.h:4920
ValueDecl * getExtendingDecl()
Get the declaration which triggered the lifetime-extension of this temporary, if any.
Definition ExprCXX.h:4970
MemberExpr - [C99 6.5.2.3] Structure and Union Members.
Definition Expr.h:3298
NestedNameSpecifier getQualifier() const
If the member name was qualified, retrieves the nested-name-specifier that precedes the member name.
Definition Expr.h:3409
ValueDecl * getMemberDecl() const
Retrieve the member declaration to which this expression refers.
Definition Expr.h:3381
NonOdrUseReason isNonOdrUse() const
Is this expression a non-odr-use reference, and if so, why?
Definition Expr.h:3522
bool isArrow() const
Definition Expr.h:3482
Provides common interface for the Decls that cannot be redeclared, but can be merged if the same decl...
decl_type * getFirstDecl()
Return the first declaration of this declaration or itself if this is the only declaration.
Describes a module or submodule.
Definition Module.h:144
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:274
bool isModulePrivate() const
Whether this declaration was marked as being private to the module in which it was defined.
Definition DeclBase.h:648
IdentifierInfo * getIdentifier() const
Get the identifier that names this declaration, if there is one.
Definition Decl.h:295
StringRef getName() const
Get the name of identifier for this declaration as a StringRef.
Definition Decl.h:301
DeclarationName getDeclName() const
Get the actual, stored name of the declaration, which may be a special name.
Definition Decl.h:340
Represents a C++ namespace alias.
Definition DeclCXX.h:3201
NamespaceBaseDecl * getAliasedNamespace() const
Retrieve the namespace that this alias refers to, which may either be a NamespaceDecl or a NamespaceA...
Definition DeclCXX.h:3294
Represent a C++ namespace.
Definition Decl.h:592
bool isFirstDecl() const
True if this is the first declaration in its redeclaration chain.
bool isInline() const
Returns true if this is an inline namespace declaration.
Definition Decl.h:648
bool isNested() const
Returns true if this is a nested namespace declaration.
Definition Decl.h:657
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
NamespaceAndPrefix getAsNamespaceAndPrefix() const
void print(raw_ostream &OS, const PrintingPolicy &Policy, bool ResolveTemplateArguments=false, bool PrintFinalScopeResOp=true) const
Print this nested name specifier to the given output stream.
@ MicrosoftSuper
Microsoft's '__super' specifier, stored as a CXXRecordDecl* of the class it appeared in.
@ Global
The global specifier '::'. There is no stored value.
@ Namespace
A namespace-like entity, stored as a NamespaceBaseDecl*.
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:445
This is a basic class for representing single OpenMP clause.
This represents 'pragma omp declare reduction ...' directive.
Definition DeclOpenMP.h:239
Expr * getInitializer()
Get initializer expression (if specified) of the declare reduction construct.
Definition DeclOpenMP.h:300
Expr * getCombiner()
Get combiner expression of the declare reduction construct.
Definition DeclOpenMP.h:282
OMPDeclareReductionInitKind getInitializerKind() const
Get initializer kind.
Definition DeclOpenMP.h:303
OpenMP 5.0 [2.1.6 Iterators] Iterators are identifiers that expand to multiple values in the clause o...
Definition ExprOpenMP.h:151
IteratorRange getIteratorRange(unsigned I)
Gets the iterator range for the given iterator.
Definition Expr.cpp:5435
unsigned numOfIterators() const
Returns number of iterator definitions.
Definition ExprOpenMP.h:275
Decl * getIteratorDecl(unsigned I)
Gets the iterator declaration for the given iterator.
Definition Expr.cpp:5431
This represents 'pragma omp requires...' directive.
Definition DeclOpenMP.h:479
clauselist_range clauselists()
Definition DeclOpenMP.h:504
Represents Objective-C's @catch statement.
Definition StmtObjC.h:77
const VarDecl * getCatchParamDecl() const
Definition StmtObjC.h:97
ObjCBoolLiteralExpr - Objective-C Boolean Literal.
Definition ExprObjC.h:88
ObjCBoxedExpr - used for generalized expression boxing.
Definition ExprObjC.h:128
ObjCMethodDecl * getBoxingMethod() const
Definition ExprObjC.h:147
ObjCCategoryDecl - Represents a category declaration.
Definition DeclObjC.h:2329
ObjCCategoryImplDecl * getImplementation() const
ObjCInterfaceDecl * getClassInterface()
Definition DeclObjC.h:2372
protocol_range protocols() const
Definition DeclObjC.h:2403
ObjCCategoryImplDecl - An object of this class encapsulates a category @implementation declaration.
Definition DeclObjC.h:2545
ObjCCategoryDecl * getCategoryDecl() const
ObjCCompatibleAliasDecl - Represents alias of a class.
Definition DeclObjC.h:2775
const ObjCInterfaceDecl * getClassInterface() const
Definition DeclObjC.h:2793
ObjCEncodeExpr, used for @encode in Objective-C.
Definition ExprObjC.h:407
QualType getEncodedType() const
Definition ExprObjC.h:426
const ObjCInterfaceDecl * getClassInterface() const
Definition DeclObjC.h:2486
ObjCImplementationDecl - Represents a class definition - this is where method definitions are specifi...
Definition DeclObjC.h:2597
const ObjCInterfaceDecl * getSuperClass() const
Definition DeclObjC.h:2735
Represents an ObjC class declaration.
Definition DeclObjC.h:1154
protocol_range protocols() const
Definition DeclObjC.h:1359
ObjCImplementationDecl * getImplementation() const
ObjCInterfaceDecl * getSuperClass() const
Definition DeclObjC.cpp:349
Represents typeof(type), a C23 feature and GCC extension, or `typeof_unqual(type),...
Definition TypeBase.h:7840
ObjCIvarDecl - Represents an ObjC instance variable.
Definition DeclObjC.h:1952
AccessControl getAccessControl() const
Definition DeclObjC.h:2000
bool getSynthesize() const
Definition DeclObjC.h:2007
ObjCIvarRefExpr - A reference to an ObjC instance variable.
Definition ExprObjC.h:546
ObjCIvarDecl * getDecl()
Definition ExprObjC.h:576
bool isFreeIvar() const
Definition ExprObjC.h:585
An expression that sends a message to the given Objective-C object or class.
Definition ExprObjC.h:937
Selector getSelector() const
Definition ExprObjC.cpp:289
@ SuperInstance
The receiver is the instance of the superclass object.
Definition ExprObjC.h:951
@ Instance
The receiver is an object instance.
Definition ExprObjC.h:945
@ SuperClass
The receiver is a superclass.
Definition ExprObjC.h:948
@ Class
The receiver is a class.
Definition ExprObjC.h:942
QualType getClassReceiver() const
Returns the type of a class message send, or NULL if the message is not a class message.
Definition ExprObjC.h:1284
ReceiverKind getReceiverKind() const
Determine the kind of receiver that this message is being sent to.
Definition ExprObjC.h:1226
ObjCMethodDecl - Represents an instance or class method declaration.
Definition DeclObjC.h:140
bool isVariadic() const
Definition DeclObjC.h:431
Selector getSelector() const
Definition DeclObjC.h:327
bool isInstanceMethod() const
Definition DeclObjC.h:426
QualType getReturnType() const
Definition DeclObjC.h:329
Represents one property declaration in an Objective-C interface.
Definition DeclObjC.h:731
ObjCMethodDecl * getGetterMethodDecl() const
Definition DeclObjC.h:901
ObjCMethodDecl * getSetterMethodDecl() const
Definition DeclObjC.h:904
QualType getType() const
Definition DeclObjC.h:804
ObjCPropertyAttribute::Kind getPropertyAttributes() const
Definition DeclObjC.h:815
PropertyControl getPropertyImplementation() const
Definition DeclObjC.h:912
ObjCPropertyImplDecl - Represents implementation declaration of a property in a class or category imp...
Definition DeclObjC.h:2805
ObjCIvarDecl * getPropertyIvarDecl() const
Definition DeclObjC.h:2879
Kind getPropertyImplementation() const
Definition DeclObjC.h:2875
ObjCPropertyDecl * getPropertyDecl() const
Definition DeclObjC.h:2870
ObjCPropertyRefExpr - A dot-syntax expression to access an ObjC property.
Definition ExprObjC.h:614
bool isMessagingGetter() const
True if the property reference will result in a message to the getter.
Definition ExprObjC.h:733
ObjCPropertyDecl * getExplicitProperty() const
Definition ExprObjC.h:703
bool isMessagingSetter() const
True if the property reference will result in a message to the setter.
Definition ExprObjC.h:740
ObjCMethodDecl * getImplicitPropertyGetter() const
Definition ExprObjC.h:708
bool isImplicitProperty() const
Definition ExprObjC.h:700
ObjCMethodDecl * getImplicitPropertySetter() const
Definition ExprObjC.h:713
bool isSuperReceiver() const
Definition ExprObjC.h:768
Represents an Objective-C protocol declaration.
Definition DeclObjC.h:2084
protocol_range protocols() const
Definition DeclObjC.h:2161
ObjCProtocolExpr used for protocol expression in Objective-C.
Definition ExprObjC.h:502
ObjCProtocolDecl * getProtocol() const
Definition ExprObjC.h:519
ObjCSelectorExpr used for @selector in Objective-C.
Definition ExprObjC.h:452
Selector getSelector() const
Definition ExprObjC.h:466
ObjCSubscriptRefExpr - used for array and dictionary subscripting.
Definition ExprObjC.h:836
bool isArraySubscriptRefExpr() const
Definition ExprObjC.h:889
ObjCMethodDecl * getAtIndexMethodDecl() const
Definition ExprObjC.h:881
ObjCMethodDecl * setAtIndexMethodDecl() const
Definition ExprObjC.h:885
Represents the declaration of an Objective-C type parameter.
Definition DeclObjC.h:578
bool hasExplicitBound() const
Whether this type parameter has an explicitly-written type bound, e.g., "T : NSView".
Definition DeclObjC.h:640
ObjCTypeParamVariance getVariance() const
Determine the variance of this type parameter.
Definition DeclObjC.h:623
This expression type represents an asterisk in an OpenACC Size-Expr, used in the 'tile' and 'gang' cl...
Definition Expr.h:2090
This is the base type for all OpenACC Clauses.
OpenACCDirectiveKind getDirectiveKind() const
Definition DeclOpenACC.h:56
ArrayRef< const OpenACCClause * > clauses() const
Definition DeclOpenACC.h:62
This is the base class for an OpenACC statement-level construct, other construct types are expected t...
Definition StmtOpenACC.h:26
OpenACCDirectiveKind getDirectiveKind() const
Definition StmtOpenACC.h:57
SourceLocation getRParenLoc() const
const Expr * getFunctionReference() const
SourceLocation getLParenLoc() const
UnresolvedSetImpl::iterator decls_iterator
Definition ExprCXX.h:3219
decls_iterator decls_begin() const
Definition ExprCXX.h:3221
decls_iterator decls_end() const
Definition ExprCXX.h:3224
DeclarationName getName() const
Gets the name looked up.
Definition ExprCXX.h:3238
Represents a #pragma comment line.
Definition Decl.h:167
StringRef getArg() const
Definition Decl.h:190
PragmaMSCommentKind getCommentKind() const
Definition Decl.h:188
Represents a #pragma detect_mismatch line.
Definition Decl.h:201
StringRef getName() const
Definition Decl.h:222
StringRef getValue() const
Definition Decl.h:223
[C99 6.4.2.2] - A predefined identifier such as func.
Definition Expr.h:2005
StringRef getIdentKindName() const
Definition Expr.h:2062
PredefinedIdentKind getIdentKind() const
Definition Expr.h:2040
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 TypeBase.h:937
SplitQualType split() const
Divides a QualType into its unqualified type and a set of local qualifiers.
Definition TypeBase.h:8299
std::string getAsString() const
static std::string getAsString(SplitQualType split, const PrintingPolicy &Policy)
Definition TypeBase.h:1332
Represents a template name as written in source code.
NestedNameSpecifier getQualifier() const
Return the nested name specifier that qualifies this name.
TemplateName getUnderlyingTemplate() const
Return the underlying template name.
bool hasTemplateKeyword() const
Whether the template name was prefixed by the "template" keyword.
Represents a struct/union/class.
Definition Decl.h:4321
Provides common interface for the Decls that can be redeclared.
decl_type * getFirstDecl()
Return the first declaration of this declaration or itself if this is the only declaration.
decl_type * getPreviousDecl()
Return the previous declaration of this declaration or NULL if this is the first declaration.
Base for LValueReferenceType and RValueReferenceType.
Definition TypeBase.h:3573
C++2a [expr.prim.req]: A requires-expression provides a concise way to express requirements on templa...
bool isSatisfied() const
Whether or not the requires clause is satisfied.
ReturnStmt - This represents a return, optionally of an expression: return; return 4;.
Definition Stmt.h:3139
const VarDecl * getNRVOCandidate() const
Retrieve the variable that might be used for the named return value optimization.
Definition Stmt.h:3175
TypeSourceInfo * getTypeSourceInfo()
Definition Expr.h:2143
void print(llvm::raw_ostream &OS) const
Prints the full selector name (e.g. "foo:bar:").
Represents an expression that computes the length of a parameter pack.
Definition ExprCXX.h:4441
NamedDecl * getPack() const
Retrieve the parameter pack.
Definition ExprCXX.h:4509
Encodes a location in the source.
A trivial tuple used to represent a source range.
SourceLocation getEnd() const
SourceLocation getBegin() const
Stmt - This represents one statement.
Definition Stmt.h:85
SourceRange getSourceRange() const LLVM_READONLY
SourceLocation tokens are not useful in isolation - they are low level value objects created/interpre...
Definition Stmt.cpp:338
const char * getStmtClassName() const
Definition Stmt.cpp:87
StringLiteral - This represents a string literal expression, e.g.
Definition Expr.h:1799
void outputString(raw_ostream &OS) const
Definition Expr.cpp:1205
A structure for storing the information associated with a substituted template template parameter.
TemplateTemplateParmDecl * getParameter() const
unsigned getIndex() const
Returns the index of the replaced parameter in the associated declaration.
Decl * getAssociatedDecl() const
A template-like entity which owns the whole pattern being substituted.
SwitchStmt - This represents a 'switch' stmt.
Definition Stmt.h:2488
bool hasVarStorage() const
True if this SwitchStmt has storage for a condition variable.
Definition Stmt.h:2549
bool hasInitStorage() const
True if this SwitchStmt has storage for an init statement.
Definition Stmt.h:2546
StringRef getKindName() const
Definition Decl.h:3907
bool isCompleteDefinition() const
Return true if this decl has its body fully specified.
Definition Decl.h:3812
NestedNameSpecifier getQualifier() const
Retrieve the nested-name-specifier that qualifies the name of this declaration, if it was present in ...
Definition Decl.h:3957
Represents a template argument.
TemplateName getAsTemplate() const
Retrieve the template name for a template name argument.
bool structurallyEquals(const TemplateArgument &Other) const
Determines whether two template arguments are superficially the same.
void print(const PrintingPolicy &Policy, raw_ostream &Out, bool IncludeType) const
Print this template argument to the given output stream.
ValueDecl * getAsDecl() const
Retrieve the declaration for a declaration non-type template argument.
bool isCanonicalExpr() const
TemplateName getAsTemplateOrTemplatePattern() const
Retrieve the template argument as a template name; if the argument is a pack expansion,...
Represents a C++ template name within the type system.
TemplateDecl * getAsTemplateDecl(bool IgnoreDeduced=false) const
Retrieve the underlying template declaration that this template name refers to, if known.
DeducedTemplateStorage * getAsDeducedTemplateName() const
Retrieve the deduced template info, if any.
DependentTemplateName * getAsDependentTemplateName() const
Retrieve the underlying dependent template name structure, if any.
QualifiedTemplateName * getAsQualifiedTemplateName() const
Retrieve the underlying qualified template name structure, if any.
void print(raw_ostream &OS, const PrintingPolicy &Policy, Qualified Qual=Qualified::AsWritten) const
Print the template name.
NameKind getKind() const
@ UsingTemplate
A template name that refers to a template declaration found through a specific using shadow declarati...
@ OverloadedTemplate
A set of overloaded template declarations.
@ Template
A single template declaration.
@ DependentTemplate
A dependent template name that has not been resolved to a template (or set of templates).
@ SubstTemplateTemplateParm
A template template parameter that has been substituted for some other template name.
@ SubstTemplateTemplateParmPack
A template template parameter pack that has been substituted for a template template argument pack,...
@ DeducedTemplate
A template name that refers to another TemplateName with deduced default arguments.
@ QualifiedTemplate
A qualified template name, where the qualification is kept to describe the source code as written.
@ AssumedTemplate
An unqualified-id that has been assumed to name a function template that will be found by ADL.
UsingShadowDecl * getAsUsingShadowDecl() const
Retrieve the using shadow declaration through which the underlying template declaration is introduced...
SubstTemplateTemplateParmStorage * getAsSubstTemplateTemplateParm() const
Retrieve the substituted template template parameter, if known.
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.
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 VisitOpenACCLoopConstruct(const OpenACCLoopConstruct *S)
void VisitLinkageSpecDecl(const LinkageSpecDecl *D)
void VisitVectorType(const VectorType *T)
void VisitLoopControlStmt(const LoopControlStmt *L)
void VisitHLSLRootSignatureDecl(const HLSLRootSignatureDecl *D)
void VisitCoawaitExpr(const CoawaitExpr *Node)
void VisitUnaryOperator(const UnaryOperator *Node)
void dumpAccessSpecifier(AccessSpecifier AS)
void VisitHLSLOutArgExpr(const HLSLOutArgExpr *E)
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 VisitOpenACCRoutineDecl(const OpenACCRoutineDecl *D)
void VisitDependentScopeDeclRefExpr(const DependentScopeDeclRefExpr *Node)
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)
void VisitCXXDeductionGuideDecl(const CXXDeductionGuideDecl *D)
TextNodeDumper(raw_ostream &OS, const ASTContext &Context, bool ShowColors)
void VisitPredefinedExpr(const PredefinedExpr *Node)
void dumpType(QualType T)
void VisitObjCEncodeExpr(const ObjCEncodeExpr *Node)
void dumpNestedNameSpecifier(NestedNameSpecifier NNS)
void VisitStructuralValueTemplateArgument(const TemplateArgument &TA)
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 VisitOpenACCDataConstruct(const OpenACCDataConstruct *S)
void dumpBareTemplateName(TemplateName TN)
void VisitOpenACCConstructStmt(const OpenACCConstructStmt *S)
void VisitCompoundStmt(const CompoundStmt *Node)
void VisitConstantExpr(const ConstantExpr *Node)
void VisitObjCIvarRefExpr(const ObjCIvarRefExpr *Node)
void VisitOpenACCDeclareDecl(const OpenACCDeclareDecl *D)
void VisitOpenACCAsteriskSizeExpr(const OpenACCAsteriskSizeExpr *S)
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 VisitReturnStmt(const ReturnStmt *Node)
void VisitTypeLoc(TypeLoc TL)
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 VisitEmbedExpr(const EmbedExpr *S)
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 VisitOpenACCExitDataConstruct(const OpenACCExitDataConstruct *S)
void VisitCaseStmt(const CaseStmt *Node)
void VisitRValueReferenceType(const ReferenceType *T)
void VisitPackExpansionType(const PackExpansionType *T)
void VisitConceptDecl(const ConceptDecl *D)
void VisitOpenACCEnterDataConstruct(const OpenACCEnterDataConstruct *S)
void VisitCallExpr(const CallExpr *Node)
void VisitCapturedDecl(const CapturedDecl *D)
void VisitOpenACCWaitConstruct(const OpenACCWaitConstruct *S)
void VisitBuiltinTemplateDecl(const BuiltinTemplateDecl *D)
void VisitObjCPropertyRefExpr(const ObjCPropertyRefExpr *Node)
void VisitOMPDeclareReductionDecl(const OMPDeclareReductionDecl *D)
void VisitCoreturnStmt(const CoreturnStmt *Node)
void VisitSizeOfPackExpr(const SizeOfPackExpr *Node)
void VisitDeclRefExpr(const DeclRefExpr *Node)
void VisitLabelStmt(const LabelStmt *Node)
void VisitOpenACCUpdateConstruct(const OpenACCUpdateConstruct *S)
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 VisitOpenACCInitConstruct(const OpenACCInitConstruct *S)
void VisitTemplateTypeParmDecl(const TemplateTypeParmDecl *D)
void VisitCompoundAssignOperator(const CompoundAssignOperator *Node)
void VisitCXXThisExpr(const CXXThisExpr *Node)
void VisitOpenACCRoutineDeclAttr(const OpenACCRoutineDeclAttr *A)
void dumpName(const NamedDecl *ND)
void dumpTemplateName(TemplateName TN, StringRef Label={})
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 VisitOpenACCAtomicConstruct(const OpenACCAtomicConstruct *S)
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 VisitOpenACCCacheConstruct(const OpenACCCacheConstruct *S)
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 VisitOpenACCHostDataConstruct(const OpenACCHostDataConstruct *S)
void VisitCXXBoolLiteralExpr(const CXXBoolLiteralExpr *Node)
void VisitIfStmt(const IfStmt *Node)
void VisitCXXConstructExpr(const CXXConstructExpr *Node)
void VisitFunctionProtoType(const FunctionProtoType *T)
void dumpTemplateArgument(const TemplateArgument &TA)
void dumpLocation(SourceLocation Loc)
void VisitDependentSizedArrayType(const DependentSizedArrayType *T)
void VisitOpenACCCombinedConstruct(const OpenACCCombinedConstruct *S)
void VisitOMPExecutableDirective(const OMPExecutableDirective *D)
void VisitImplicitCastExpr(const ImplicitCastExpr *Node)
void VisitCXXDefaultArgExpr(const CXXDefaultArgExpr *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 VisitOpenACCSetConstruct(const OpenACCSetConstruct *S)
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 VisitConvertVectorExpr(const ConvertVectorExpr *S)
void visitVerbatimBlockLineComment(const comments::VerbatimBlockLineComment *C, const comments::FullComment *)
void VisitOpenACCShutdownConstruct(const OpenACCShutdownConstruct *S)
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 VisitCXXDefaultInitExpr(const CXXDefaultInitExpr *Node)
void visitHTMLStartTagComment(const comments::HTMLStartTagComment *C, const comments::FullComment *)
void VisitEnumConstantDecl(const EnumConstantDecl *D)
void VisitPragmaDetectMismatchDecl(const PragmaDetectMismatchDecl *D)
void dumpTemplateSpecializationKind(TemplateSpecializationKind TSK)
void VisitAtomicExpr(const AtomicExpr *AE)
void VisitObjCCompatibleAliasDecl(const ObjCCompatibleAliasDecl *D)
void VisitClassTemplateDecl(const ClassTemplateDecl *D)
void VisitBindingDecl(const BindingDecl *D)
void VisitTypedefType(const TypedefType *T)
TextTreeStructure(raw_ostream &OS, bool ShowColors)
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:3688
Declaration of an alias template.
Symbolic representation of typeid(T) for some type T.
Definition APValue.h:44
RetTy Visit(TypeLoc TyLoc)
Base wrapper for a particular "section" of type source info.
Definition TypeLoc.h:59
QualType getType() const
Get the type for which this source info wrapper provides information.
Definition TypeLoc.h:133
SourceRange getSourceRange() const LLVM_READONLY
Get the full source range.
Definition TypeLoc.h:154
TypeLocClass getTypeLocClass() const
Definition TypeLoc.h:116
const Type * getTypePtr() const
Definition TypeLoc.h:137
A container of type source information.
Definition TypeBase.h:8249
QualType getType() const
Return the type wrapped by this type source info.
Definition TypeBase.h:8260
A type trait used in the implementation of various C++11 and Library TR1 trait templates.
Definition ExprCXX.h:2896
TypeTrait getTrait() const
Determine which type trait this expression uses.
Definition ExprCXX.h:2939
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 TypeBase.h:1833
bool isSignedIntegerType() const
Return true if this is an integer type that is signed, according to C99 6.2.5p4 [char,...
Definition Type.cpp:2205
bool isDependentType() const
Whether this type is a dependent type, meaning that its definition somehow depends on a template para...
Definition TypeBase.h:2782
const char * getTypeClassName() const
Definition Type.cpp:3350
const T * getAs() const
Member-template getAs<specific type>'.
Definition TypeBase.h:9091
Represents the declaration of a typedef-name via the 'typedef' type specifier.
Definition Decl.h:3667
QualType getUnderlyingType() const
Definition Decl.h:3617
UnaryExprOrTypeTraitExpr - expression with either a type or (unevaluated) expression operand.
Definition Expr.h:2625
QualType getArgumentType() const
Definition Expr.h:2668
UnaryExprOrTypeTrait getKind() const
Definition Expr.h:2657
UnaryOperator - This represents the unary-expression's (except sizeof and alignof),...
Definition Expr.h:2244
static bool isPostfix(Opcode Op)
isPostfix - Return true if this is a postfix operation, like x++.
Definition Expr.h:2314
Opcode getOpcode() const
Definition Expr.h:2280
bool hasStoredFPFeatures() const
Is FPFeatures in Trailing Storage?
Definition Expr.h:2381
FPOptionsOverride getStoredFPFeatures() const
Get FPFeatures from trailing storage.
Definition Expr.h:2384
static StringRef getOpcodeStr(Opcode Op)
getOpcodeStr - Turn an Opcode enum value into the punctuation char it corresponds to,...
Definition Expr.cpp:1402
bool canOverflow() const
Returns true if the unary operator can cause an overflow.
Definition Expr.h:2298
A reference to a name which we were able to look up during parsing but could not resolve to a specifi...
Definition ExprCXX.h:3390
bool requiresADL() const
True if this declaration should be extended by argument-dependent lookup.
Definition ExprCXX.h:3459
Represents the dependent type named by a dependently-scoped typename using declaration,...
Definition TypeBase.h:5970
Represents a dependent using declaration which was marked with typename.
Definition DeclCXX.h:4037
NestedNameSpecifier getQualifier() const
Retrieve the nested-name-specifier that qualifies the name.
Definition DeclCXX.h:4074
Represents a dependent using declaration which was not marked with typename.
Definition DeclCXX.h:3940
NestedNameSpecifier getQualifier() const
Retrieve the nested-name-specifier that qualifies the name.
Definition DeclCXX.h:3984
Represents a C++ using-declaration.
Definition DeclCXX.h:3591
NestedNameSpecifier getQualifier() const
Retrieve the nested-name-specifier that qualifies the name.
Definition DeclCXX.h:3628
Represents C++ using-directive.
Definition DeclCXX.h:3096
NamespaceDecl * getNominatedNamespace()
Returns the namespace nominated by this using-directive.
Definition DeclCXX.cpp:3244
Represents a C++ using-enum-declaration.
Definition DeclCXX.h:3792
EnumDecl * getEnumDecl() const
Definition DeclCXX.h:3834
Represents a shadow declaration implicitly introduced into a scope by a (resolved) using-declaration ...
Definition DeclCXX.h:3399
NamedDecl * getTargetDecl() const
Gets the underlying declaration which has been brought into the local scope.
Definition DeclCXX.h:3463
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
Definition Decl.h:712
QualType getType() const
Definition Decl.h:723
bool isParameterPack() const
Determine whether this value is actually a function parameter pack, init-capture pack,...
Definition Decl.cpp:5520
Kind getKind() const
Definition Value.h:137
Represents a variable declaration or definition.
Definition Decl.h:926
bool isConstexpr() const
Whether this variable is (C++11) constexpr.
Definition Decl.h:1569
TLSKind getTLSKind() const
Definition Decl.cpp:2175
bool hasInit() const
Definition Decl.cpp:2405
InitializationStyle getInitStyle() const
The style of initialization for this declaration.
Definition Decl.h:1466
static const char * getStorageClassSpecifierString(StorageClass SC)
Return the string used to specify the storage class SC.
Definition Decl.cpp:2128
@ ListInit
Direct list-initialization (C++11)
Definition Decl.h:937
@ CInit
C-style initialization with assignment.
Definition Decl.h:931
@ ParenListInit
Parenthesized list-initialization (C++20)
Definition Decl.h:940
@ CallInit
Call-style initialization (C++98)
Definition Decl.h:934
APValue * evaluateValue() const
Attempt to evaluate the value of the initializer attached to this declaration, and produce notes expl...
Definition Decl.cpp:2582
VarDecl * getTemplateInstantiationPattern() const
Retrieve the variable declaration from which this variable could be instantiated, if it is an instant...
Definition Decl.cpp:2721
bool isNRVOVariable() const
Determine whether this local variable can be used with the named return value optimization (NRVO).
Definition Decl.h:1512
QualType::DestructionKind needsDestruction(const ASTContext &Ctx) const
Would the destruction of this variable have any effect, and if so, what kind?
Definition Decl.cpp:2858
bool isInline() const
Whether this variable is (C++1z) inline.
Definition Decl.h:1551
const Expr * getInit() const
Definition Decl.h:1368
@ TLS_Static
TLS with a known-constant initializer.
Definition Decl.h:949
@ TLS_Dynamic
TLS with a dynamic initializer.
Definition Decl.h:952
@ TLS_None
Not a TLS variable.
Definition Decl.h:946
StorageClass getStorageClass() const
Returns the storage class as written in the source.
Definition Decl.h:1168
TemplateSpecializationKind getTemplateSpecializationKind() const
If this variable is an instantiation of a variable template or a static data member of a class templa...
Definition Decl.cpp:2786
Declaration of a variable template.
Represents a C array with a specified size that is not an integer-constant-expression.
Definition TypeBase.h:3966
Represents a GCC generic vector type.
Definition TypeBase.h:4175
WhileStmt - This represents a 'while' stmt.
Definition Stmt.h:2676
bool hasVarStorage() const
True if this WhileStmt has storage for a condition variable.
Definition Stmt.h:2726
A command that has zero or more word-like arguments (number of word-like arguments depends on command...
Definition Comment.h:625
static const CommandInfo * getBuiltinCommandInfo(StringRef Name)
Any part of the comment.
Definition Comment.h:66
A full comment attached to a declaration, contains block content.
Definition Comment.h:1104
An opening HTML tag with attributes.
Definition Comment.h:454
A command with word-like arguments that is considered inline content.
Definition Comment.h:341
Doxygen \param command.
Definition Comment.h:732
static const char * getDirectionAsString(ParamCommandPassDirection D)
Definition Comment.cpp:189
Doxygen \tparam command, describes a template parameter.
Definition Comment.h:814
A verbatim block command (e.
Definition Comment.h:900
A line of text contained in a verbatim block.
Definition Comment.h:875
A verbatim line command.
Definition Comment.h:951
A static requirement that can be used in a requires-expression to check properties of types and expre...
RequirementKind getKind() const
bool containsUnexpandedParameterPack() const
The JSON file list parser is used to communicate input to InstallAPI.
static const TerminalColor NullColor
static const TerminalColor ErrorsColor
static const TerminalColor CommentColor
bool isa(CodeGen::Address addr)
Definition Address.h:330
static const TerminalColor DeclNameColor
llvm::StringRef getAccessSpelling(AccessSpecifier AS)
Definition Specifiers.h:419
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 TypeBase.h:1782
@ RQ_LValue
An lvalue ref-qualifier was provided (&).
Definition TypeBase.h:1785
@ RQ_RValue
An rvalue ref-qualifier was provided (&&).
Definition TypeBase.h:1788
@ OK_VectorComponent
A vector component is an element or range of elements on a vector.
Definition Specifiers.h:157
@ 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:161
@ OK_ObjCSubscript
An Objective-C array/dictionary subscripting which reads an object or writes at the subscripted array...
Definition Specifiers.h:166
@ OK_Ordinary
An ordinary object is located at an address in memory.
Definition Specifiers.h:151
@ OK_BitField
A bitfield object is a bitfield on a C or C++ record.
Definition Specifiers.h:154
@ OK_MatrixComponent
A matrix component is a single element of a matrix.
Definition Specifiers.h:169
static const TerminalColor StmtColor
static const TerminalColor UndeserializedColor
@ Override
Merge availability attributes for an override, which requires an exact match or a weakening of constr...
Definition Sema.h:634
@ Auto
'auto' clause, allowed on 'loop' directives.
@ Bind
'bind' clause, allowed on routine constructs.
@ Gang
'gang' clause, allowed on 'loop' and Combined constructs.
@ Wait
'wait' clause, allowed on Compute, Data, 'update', and Combined constructs.
@ DevicePtr
'deviceptr' clause, allowed on Compute and Combined Constructs, plus 'data' and 'declare'.
@ PCopyOut
'copyout' clause alias 'pcopyout'. Preserved for diagnostic purposes.
@ VectorLength
'vector_length' clause, allowed on 'parallel', 'kernels', 'parallel loop', and 'kernels loop' constru...
@ Async
'async' clause, allowed on Compute, Data, 'update', 'wait', and Combined constructs.
@ PresentOrCreate
'create' clause alias 'present_or_create'.
@ Collapse
'collapse' clause, allowed on 'loop' and Combined constructs.
@ NoHost
'nohost' clause, allowed on 'routine' directives.
@ PresentOrCopy
'copy' clause alias 'present_or_copy'. Preserved for diagnostic purposes.
@ DeviceNum
'device_num' clause, allowed on 'init', 'shutdown', and 'set' constructs.
@ Private
'private' clause, allowed on 'parallel', 'serial', 'loop', 'parallel loop', and 'serial loop' constru...
@ Invalid
Represents an invalid clause, for the purposes of parsing.
@ Vector
'vector' clause, allowed on 'loop', Combined, and 'routine' directives.
@ Copy
'copy' clause, allowed on Compute and Combined Constructs, plus 'data' and 'declare'.
@ Worker
'worker' clause, allowed on 'loop', Combined, and 'routine' directives.
@ Create
'create' clause, allowed on Compute and Combined constructs, plus 'data', 'enter data',...
@ DeviceType
'device_type' clause, allowed on Compute, 'data', 'init', 'shutdown', 'set', update',...
@ DefaultAsync
'default_async' clause, allowed on 'set' construct.
@ Attach
'attach' clause, allowed on Compute and Combined constructs, plus 'data' and 'enter data'.
@ Shortloop
'shortloop' is represented in the ACC.td file, but isn't present in the standard.
@ NumGangs
'num_gangs' clause, allowed on 'parallel', 'kernels', parallel loop', and 'kernels loop' constructs.
@ If
'if' clause, allowed on all the Compute Constructs, Data Constructs, Executable Constructs,...
@ Default
'default' clause, allowed on parallel, serial, kernel (and compound) constructs.
@ UseDevice
'use_device' clause, allowed on 'host_data' construct.
@ NoCreate
'no_create' clause, allowed on allowed on Compute and Combined constructs, plus 'data'.
@ PresentOrCopyOut
'copyout' clause alias 'present_or_copyout'.
@ Link
'link' clause, allowed on 'declare' construct.
@ Reduction
'reduction' clause, allowed on Parallel, Serial, Loop, and the combined constructs.
@ Self
'self' clause, allowed on Compute and Combined Constructs, plus 'update'.
@ CopyOut
'copyout' clause, allowed on Compute and Combined constructs, plus 'data', 'exit data',...
@ Seq
'seq' clause, allowed on 'loop' and 'routine' directives.
@ FirstPrivate
'firstprivate' clause, allowed on 'parallel', 'serial', 'parallel loop', and 'serial loop' constructs...
@ Host
'host' clause, allowed on 'update' construct.
@ PCopy
'copy' clause alias 'pcopy'. Preserved for diagnostic purposes.
@ Tile
'tile' clause, allowed on 'loop' and Combined constructs.
@ PCopyIn
'copyin' clause alias 'pcopyin'. Preserved for diagnostic purposes.
@ DeviceResident
'device_resident' clause, allowed on the 'declare' construct.
@ PCreate
'create' clause alias 'pcreate'. Preserved for diagnostic purposes.
@ Present
'present' clause, allowed on Compute and Combined constructs, plus 'data' and 'declare'.
@ DType
'dtype' clause, an alias for 'device_type', stored separately for diagnostic purposes.
@ CopyIn
'copyin' clause, allowed on Compute and Combined constructs, plus 'data', 'enter data',...
@ Device
'device' clause, allowed on the 'update' construct.
@ Independent
'independent' clause, allowed on 'loop' directives.
@ NumWorkers
'num_workers' clause, allowed on 'parallel', 'kernels', parallel loop', and 'kernels loop' constructs...
@ IfPresent
'if_present' clause, allowed on 'host_data' and 'update' directives.
@ Detach
'detach' clause, allowed on the 'exit data' construct.
@ Delete
'delete' clause, allowed on the 'exit data' construct.
@ PresentOrCopyIn
'copyin' clause alias 'present_or_copyin'.
@ Finalize
'finalize' clause, allowed on 'exit data' directive.
AccessSpecifier
A C++ access specifier (public, private, protected), plus the special value "none" which means differ...
Definition Specifiers.h:123
StorageClass
Storage classes.
Definition Specifiers.h:248
@ SC_None
Definition Specifiers.h:250
static const TerminalColor DeclKindNameColor
IdentifierLoc DeviceTypeArgument
const FunctionProtoType * T
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:135
@ VK_XValue
An x-value expression is a reference to an object with independent storage but which can be "moved",...
Definition Specifiers.h:144
@ VK_LValue
An l-value expression is a reference to an object with independent storage.
Definition Specifiers.h:139
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
TemplateSpecializationKind
Describes the kind of template specialization that a particular template specialization declaration r...
Definition Specifiers.h:188
@ TSK_ExplicitInstantiationDefinition
This template specialization was instantiated from a template due to an explicit instantiation defini...
Definition Specifiers.h:206
@ TSK_ExplicitInstantiationDeclaration
This template specialization was instantiated from a template due to an explicit instantiation declar...
Definition Specifiers.h:202
@ TSK_ExplicitSpecialization
This template specialization was declared or defined by an explicit specialization (C++ [temp....
Definition Specifiers.h:198
@ TSK_ImplicitInstantiation
This template specialization was implicitly instantiated from a template.
Definition Specifiers.h:194
@ TSK_Undeclared
This template specialization was formed from a template-id but has not yet been declared,...
Definition Specifiers.h:191
@ Invariant
The parameter is invariant: must match exactly.
Definition DeclObjC.h:555
@ Contravariant
The parameter is contravariant, e.g., X<T> is a subtype of X when the type parameter is covariant and...
Definition DeclObjC.h:563
@ Covariant
The parameter is covariant, e.g., X<T> is a subtype of X when the type parameter is covariant and T i...
Definition DeclObjC.h:559
const char * getOperatorSpelling(OverloadedOperatorKind Operator)
Retrieve the spelling of the given overloaded operator, without the preceding "operator" keyword.
@ AltiVecBool
is AltiVec 'vector bool ...'
Definition TypeBase.h:4145
@ SveFixedLengthData
is AArch64 SVE fixed-length data vector
Definition TypeBase.h:4154
@ AltiVecVector
is AltiVec vector
Definition TypeBase.h:4139
@ AltiVecPixel
is AltiVec 'vector Pixel'
Definition TypeBase.h:4142
@ Neon
is ARM Neon vector
Definition TypeBase.h:4148
@ Generic
not a target-specific vector type
Definition TypeBase.h:4136
@ RVVFixedLengthData
is RISC-V RVV fixed-length data vector
Definition TypeBase.h:4160
@ RVVFixedLengthMask
is RISC-V RVV fixed-length mask vector
Definition TypeBase.h:4163
@ NeonPoly
is ARM Neon polynomial vector
Definition TypeBase.h:4151
@ SveFixedLengthPredicate
is AArch64 SVE fixed-length predicate vector
Definition TypeBase.h:4157
U cast(CodeGen::Address addr)
Definition Address.h:327
static const TerminalColor ValueColor
ElaboratedTypeKeyword
The elaboration keyword that precedes a qualified type name or introduces an elaborated-type-specifie...
Definition TypeBase.h:5853
@ None
No keyword precedes the qualified type name.
Definition TypeBase.h:5874
@ EST_DependentNoexcept
noexcept(expression), value-dependent
@ EST_Uninstantiated
not instantiated yet
@ EST_Unparsed
not parsed yet
@ EST_NoThrow
Microsoft __declspec(nothrow) extension.
@ EST_None
no exception specification
@ EST_MSAny
Microsoft throw(...) extension.
@ EST_BasicNoexcept
noexcept
@ EST_NoexceptFalse
noexcept(expression), evals to 'false'
@ EST_Unevaluated
not evaluated yet, for special member function
@ EST_NoexceptTrue
noexcept(expression), evals to 'true'
@ EST_Dynamic
throw(T1, T2)
static const TerminalColor ObjectKindColor
@ NOUR_Discarded
This name appears as a potential result of a discarded value expression.
Definition Specifiers.h:183
@ NOUR_Unevaluated
This name appears in an unevaluated operand.
Definition Specifiers.h:177
@ NOUR_None
This is an odr-use.
Definition Specifiers.h:175
@ NOUR_Constant
This name appears as a potential result of an lvalue-to-rvalue conversion that is a constant expressi...
Definition Specifiers.h:180
FunctionDecl * SourceDecl
The function whose exception specification this is, for EST_Unevaluated and EST_Uninstantiated.
Definition TypeBase.h:5323
FunctionDecl * SourceTemplate
The function template whose exception specification this is instantiated from, for EST_Uninstantiated...
Definition TypeBase.h:5327
ExceptionSpecificationType Type
The kind of exception specification this is.
Definition TypeBase.h:5313
Extra information about a function prototype.
Definition TypeBase.h:5339
static StringRef getKeywordName(ElaboratedTypeKeyword Keyword)
Definition Type.cpp:3309
Iterator range representation begin:end[:step].
Definition ExprOpenMP.h:154
A std::pair-like structure for storing a qualified type split into its local qualifiers and its local...
Definition TypeBase.h:870
Information about a single command.