clang: lib/AST/JSONNodeDumper.cpp Source File (original) (raw)
6#include "llvm/ADT/StringExtras.h"
7#include
8
9using namespace clang;
10
11void JSONNodeDumper::addPreviousDeclaration(const Decl *D) {
13#define DECL(DERIVED, BASE) \
14 case Decl::DERIVED: \
15 return writePreviousDeclImpl(cast<DERIVED##Decl>(D));
16#define ABSTRACT_DECL(DECL)
17#include "clang/AST/DeclNodes.inc"
18#undef ABSTRACT_DECL
19#undef DECL
20 }
21 llvm_unreachable("Decl that isn't part of DeclNodes.inc!");
22}
23
25 const char *AttrName = nullptr;
27#define ATTR(X) \
28 case attr::X: \
29 AttrName = #X"Attr"; \
30 break;
31#include "clang/Basic/AttrList.inc"
32#undef ATTR
33 }
34 JOS.attribute("id", createPointerRepresentation(A));
35 JOS.attribute("kind", AttrName);
36 JOS.attributeObject("range", [A, this] { writeSourceRange(A->getRange()); });
37 attributeOnlyIfTrue("inherited", A->isInherited());
38 attributeOnlyIfTrue("implicit", A->isImplicit());
39
40
41
42
43
44
45
47}
48
50 if (!S)
51 return;
52
53 JOS.attribute("id", createPointerRepresentation(S));
54 JOS.attribute("kind", S->getStmtClassName());
55 JOS.attributeObject("range",
56 [S, this] { writeSourceRange(S->getSourceRange()); });
57
58 if (const auto *E = dyn_cast(S)) {
59 JOS.attribute("type", createQualType(E->getType()));
60 const char *Category = nullptr;
66 break;
67 }
69 }
71}
72
74 JOS.attribute("id", createPointerRepresentation(T));
75
76 if ()
77 return;
78
80 JOS.attribute("type", createQualType(QualType(T, 0), false));
81 attributeOnlyIfTrue("containsErrors", T->containsErrors());
83 attributeOnlyIfTrue("isInstantiationDependent",
86 attributeOnlyIfTrue("containsUnexpandedPack",
88 attributeOnlyIfTrue("isImported", T->isFromAST());
90}
91
93 JOS.attribute("id", createPointerRepresentation(T.getAsOpaquePtr()));
94 JOS.attribute("kind", "QualType");
95 JOS.attribute("type", createQualType(T));
96 JOS.attribute("qualifiers", T.split().Quals.getAsString());
97}
98
101 return;
102 JOS.attribute("kind",
104 ? "Qualified"
106 "TypeLoc")
107 .str());
108 JOS.attribute("type",
109 createQualType(QualType(TL.getType()), false));
110 JOS.attributeObject("range",
111 [TL, this] { writeSourceRange(TL.getSourceRange()); });
112}
113
115 JOS.attribute("id", createPointerRepresentation(D));
116
117 if ()
118 return;
119
120 JOS.attribute("kind", (llvm::Twine(D->getDeclKindName()) + "Decl").str());
121 JOS.attributeObject("loc",
122 [D, this] { writeSourceLocation(D->getLocation()); });
123 JOS.attributeObject("range",
125 attributeOnlyIfTrue("isImplicit", D->isImplicit());
126 attributeOnlyIfTrue("isInvalid", D->isInvalidDecl());
127
129 JOS.attribute("isUsed", true);
131 JOS.attribute("isReferenced", true);
132
133 if (const auto *ND = dyn_cast(D))
134 attributeOnlyIfTrue("isHidden", !ND->isUnconditionallyVisible());
135
137
138
139
140 const auto *ParentDeclContextDecl = dyn_cast(D->getDeclContext());
141 JOS.attribute("parentDeclContextId",
142 createPointerRepresentation(ParentDeclContextDecl));
143 }
144
145 addPreviousDeclaration(D);
147}
148
151 if ()
152 return;
153
154 JOS.attribute("id", createPointerRepresentation(C));
155 JOS.attribute("kind", C->getCommentKindName());
156 JOS.attributeObject("loc",
157 [C, this] { writeSourceLocation(C->getLocation()); });
158 JOS.attributeObject("range",
159 [C, this] { writeSourceRange(C->getSourceRange()); });
160
162}
163
165 const Decl *From, StringRef Label) {
166 JOS.attribute("kind", "TemplateArgument");
168 JOS.attributeObject("range", [R, this] { writeSourceRange(R); });
169
170 if (From)
171 JOS.attribute(Label.empty() ? "fromDecl" : Label, createBareDeclRef(From));
172
174}
175
177 JOS.attribute("kind", "CXXCtorInitializer");
178 if (Init->isAnyMemberInitializer())
179 JOS.attribute("anyInit", createBareDeclRef(Init->getAnyMember()));
180 else if (Init->isBaseInitializer())
181 JOS.attribute("baseInit",
182 createQualType(QualType(Init->getBaseClass(), 0)));
183 else if (Init->isDelegatingInitializer())
184 JOS.attribute("delegatingInit",
185 createQualType(Init->getTypeSourceInfo()->getType()));
186 else
187 llvm_unreachable("Unknown initializer type");
188}
189
191
193
195 JOS.attribute("kind", "Capture");
196 attributeOnlyIfTrue("byref", C.isByRef());
197 attributeOnlyIfTrue("nested", C.isNested());
198 if (C.getVariable())
199 JOS.attribute("var", createBareDeclRef(C.getVariable()));
200}
201
203 JOS.attribute("associationKind", A.getTypeSourceInfo() ? "case" : "default");
204 attributeOnlyIfTrue("selected", A.isSelected());
205}
206
208 if (!R)
209 return;
210
213 JOS.attribute("kind", "TypeRequirement");
214 break;
216 JOS.attribute("kind", "SimpleRequirement");
217 break;
219 JOS.attribute("kind", "CompoundRequirement");
220 break;
222 JOS.attribute("kind", "NestedRequirement");
223 break;
224 }
225
226 if (auto *ER = dyn_castconcepts::ExprRequirement(R))
227 attributeOnlyIfTrue("noexcept", ER->hasNoexceptRequirement());
228
229 attributeOnlyIfTrue("isDependent", R->isDependent());
232 attributeOnlyIfTrue("containsUnexpandedPack",
234}
235
237 std::string Str;
238 llvm::raw_string_ostream OS(Str);
239 Value.printPretty(OS, Ctx, Ty);
240 JOS.attribute("value", Str);
241}
242
244 JOS.attribute("kind", "ConceptReference");
245 JOS.attribute("id", createPointerRepresentation(CR->getNamedConcept()));
247 JOS.attributeArray("templateArgsAsWritten", [Args, this] {
249 JOS.object(
250 [&TAL, this] { Visit(TAL.getArgument(), TAL.getSourceRange()); });
251 });
252 }
253 JOS.attributeObject("loc",
254 [CR, this] { writeSourceLocation(CR->getLocation()); });
255 JOS.attributeObject("range",
256 [CR, this] { writeSourceRange(CR->getSourceRange()); });
257}
258
259void JSONNodeDumper::writeIncludeStack(PresumedLoc Loc, bool JustFirst) {
261 return;
262
263 JOS.attributeBegin("includedFrom");
264 JOS.objectBegin();
265
266 if (!JustFirst) {
267
269 }
270
271 JOS.attribute("file", Loc.getFilename());
272 JOS.objectEnd();
273 JOS.attributeEnd();
274}
275
277 bool IsSpelling) {
282
283 if (Presumed.isValid()) {
285 if (LastLocFilename != ActualFile) {
286 JOS.attribute("file", ActualFile);
287 JOS.attribute("line", ActualLine);
288 } else if (LastLocLine != ActualLine)
289 JOS.attribute("line", ActualLine);
290
291 StringRef PresumedFile = Presumed.getFilename();
292 if (PresumedFile != ActualFile && LastLocPresumedFilename != PresumedFile)
293 JOS.attribute("presumedFile", PresumedFile);
294
295 unsigned PresumedLine = Presumed.getLine();
296 if (ActualLine != PresumedLine && LastLocPresumedLine != PresumedLine)
297 JOS.attribute("presumedLine", PresumedLine);
298
300 JOS.attribute("tokLen",
302 LastLocFilename = ActualFile;
303 LastLocPresumedFilename = PresumedFile;
304 LastLocPresumedLine = PresumedLine;
305 LastLocLine = ActualLine;
306
307
308
309
311 true);
312 }
313}
314
318
319 if (Expansion != Spelling) {
320
321
322 JOS.attributeObject("spellingLoc", [Spelling, this] {
323 writeBareSourceLocation(Spelling, true);
324 });
325 JOS.attributeObject("expansionLoc", [Expansion, Loc, this] {
326 writeBareSourceLocation(Expansion, false);
327
328
330 JOS.attribute("isMacroArgExpansion", true);
331 });
332 } else
333 writeBareSourceLocation(Spelling, true);
334}
335
336void JSONNodeDumper::writeSourceRange(SourceRange R) {
337 JOS.attributeObject("begin",
338 [R, this] { writeSourceLocation(R.getBegin()); });
339 JOS.attributeObject("end", [R, this] { writeSourceLocation(R.getEnd()); });
340}
341
342std::string JSONNodeDumper::createPointerRepresentation(const void *Ptr) {
343
344
345
346 return "0x" + llvm::utohexstr(reinterpret_cast<uint64_t>(Ptr), true);
347}
348
349llvm::json::Object JSONNodeDumper::createQualType(QualType QT, bool Desugar) {
352 llvm::json::Object Ret{{"qualType", SQTS}};
353
354 if (Desugar && !QT.isNull()) {
356 if (DSQT != SQT) {
358 if (DSQTS != SQTS)
359 Ret["desugaredQualType"] = DSQTS;
360 }
362 Ret["typeAliasDeclId"] = createPointerRepresentation(TT->getDecl());
363 }
364 return Ret;
365}
366
367void JSONNodeDumper::writeBareDeclRef(const Decl *D) {
368 JOS.attribute("id", createPointerRepresentation(D));
369 if ()
370 return;
371
372 JOS.attribute("kind", (llvm::Twine(D->getDeclKindName()) + "Decl").str());
373 if (const auto *ND = dyn_cast(D))
374 JOS.attribute("name", ND->getDeclName().getAsString());
375 if (const auto *VD = dyn_cast(D))
376 JOS.attribute("type", createQualType(VD->getType()));
377}
378
379llvm::json::Object JSONNodeDumper::createBareDeclRef(const Decl *D) {
380 llvm::json::Object Ret{{"id", createPointerRepresentation(D)}};
381 if ()
382 return Ret;
383
385 if (const auto *ND = dyn_cast(D))
386 Ret["name"] = ND->getDeclName().getAsString();
387 if (const auto *VD = dyn_cast(D))
388 Ret["type"] = createQualType(VD->getType());
389 return Ret;
390}
391
392llvm::json::Array JSONNodeDumper::createCastPath(const CastExpr *C) {
393 llvm::json::Array Ret;
394 if (C->path_empty())
395 return Ret;
396
397 for (auto I = C->path_begin(), E = C->path_end(); I != E; ++I) {
399 const auto *RD =
401
402 llvm::json::Object Val{{"name", RD->getName()}};
403 if (Base->isVirtual())
404 Val["isVirtual"] = true;
405 Ret.push_back(std::move(Val));
406 }
407 return Ret;
408}
409
410#define FIELD2(Name, Flag) if (RD->Flag()) Ret[Name] = true
411#define FIELD1(Flag) FIELD2(#Flag, Flag)
412
413static llvm::json::Object
415 llvm::json::Object Ret;
416
417 FIELD2("exists", hasDefaultConstructor);
418 FIELD2("trivial", hasTrivialDefaultConstructor);
419 FIELD2("nonTrivial", hasNonTrivialDefaultConstructor);
420 FIELD2("userProvided", hasUserProvidedDefaultConstructor);
421 FIELD2("isConstexpr", hasConstexprDefaultConstructor);
422 FIELD2("needsImplicit", needsImplicitDefaultConstructor);
423 FIELD2("defaultedIsConstexpr", defaultedDefaultConstructorIsConstexpr);
424
425 return Ret;
426}
427
428static llvm::json::Object
430 llvm::json::Object Ret;
431
432 FIELD2("simple", hasSimpleCopyConstructor);
433 FIELD2("trivial", hasTrivialCopyConstructor);
434 FIELD2("nonTrivial", hasNonTrivialCopyConstructor);
435 FIELD2("userDeclared", hasUserDeclaredCopyConstructor);
436 FIELD2("hasConstParam", hasCopyConstructorWithConstParam);
437 FIELD2("implicitHasConstParam", implicitCopyConstructorHasConstParam);
438 FIELD2("needsImplicit", needsImplicitCopyConstructor);
439 FIELD2("needsOverloadResolution", needsOverloadResolutionForCopyConstructor);
441 FIELD2("defaultedIsDeleted", defaultedCopyConstructorIsDeleted);
442
443 return Ret;
444}
445
446static llvm::json::Object
448 llvm::json::Object Ret;
449
450 FIELD2("exists", hasMoveConstructor);
451 FIELD2("simple", hasSimpleMoveConstructor);
452 FIELD2("trivial", hasTrivialMoveConstructor);
453 FIELD2("nonTrivial", hasNonTrivialMoveConstructor);
454 FIELD2("userDeclared", hasUserDeclaredMoveConstructor);
455 FIELD2("needsImplicit", needsImplicitMoveConstructor);
456 FIELD2("needsOverloadResolution", needsOverloadResolutionForMoveConstructor);
458 FIELD2("defaultedIsDeleted", defaultedMoveConstructorIsDeleted);
459
460 return Ret;
461}
462
463static llvm::json::Object
465 llvm::json::Object Ret;
466
467 FIELD2("simple", hasSimpleCopyAssignment);
468 FIELD2("trivial", hasTrivialCopyAssignment);
469 FIELD2("nonTrivial", hasNonTrivialCopyAssignment);
470 FIELD2("hasConstParam", hasCopyAssignmentWithConstParam);
471 FIELD2("implicitHasConstParam", implicitCopyAssignmentHasConstParam);
472 FIELD2("userDeclared", hasUserDeclaredCopyAssignment);
473 FIELD2("needsImplicit", needsImplicitCopyAssignment);
474 FIELD2("needsOverloadResolution", needsOverloadResolutionForCopyAssignment);
475
476 return Ret;
477}
478
479static llvm::json::Object
481 llvm::json::Object Ret;
482
483 FIELD2("exists", hasMoveAssignment);
484 FIELD2("simple", hasSimpleMoveAssignment);
485 FIELD2("trivial", hasTrivialMoveAssignment);
486 FIELD2("nonTrivial", hasNonTrivialMoveAssignment);
487 FIELD2("userDeclared", hasUserDeclaredMoveAssignment);
488 FIELD2("needsImplicit", needsImplicitMoveAssignment);
489 FIELD2("needsOverloadResolution", needsOverloadResolutionForMoveAssignment);
490
491 return Ret;
492}
493
494static llvm::json::Object
496 llvm::json::Object Ret;
497
498 FIELD2("simple", hasSimpleDestructor);
499 FIELD2("irrelevant", hasIrrelevantDestructor);
500 FIELD2("trivial", hasTrivialDestructor);
501 FIELD2("nonTrivial", hasNonTrivialDestructor);
502 FIELD2("userDeclared", hasUserDeclaredDestructor);
503 FIELD2("needsImplicit", needsImplicitDestructor);
504 FIELD2("needsOverloadResolution", needsOverloadResolutionForDestructor);
506 FIELD2("defaultedIsDeleted", defaultedDestructorIsDeleted);
507
508 return Ret;
509}
510
511llvm::json::Object
512JSONNodeDumper::createCXXRecordDefinitionData(const CXXRecordDecl *RD) {
513 llvm::json::Object Ret;
514
515
516 FIELD1(isGenericLambda);
520 FIELD1(isStandardLayout);
521 FIELD1(isTriviallyCopyable);
524 FIELD1(isPolymorphic);
528 FIELD1(hasUserDeclaredConstructor);
529 FIELD1(hasConstexprNonCopyMoveConstructor);
530 FIELD1(hasMutableFields);
531 FIELD1(hasVariantMembers);
532 FIELD2("canConstDefaultInit", allowConstDefaultInit);
533
540
541 return Ret;
542}
543
544#undef FIELD1
545#undef FIELD2
546
547std::string JSONNodeDumper::createAccessSpecifier(AccessSpecifier AS) {
549 if (AccessSpelling.empty())
550 return "none";
551 return AccessSpelling.str();
552}
553
554llvm::json::Object
555JSONNodeDumper::createCXXBaseSpecifier(const CXXBaseSpecifier &BS) {
556 llvm::json::Object Ret;
557
558 Ret["type"] = createQualType(BS.getType());
560 Ret["writtenAccess"] =
563 Ret["isVirtual"] = true;
565 Ret["isPackExpansion"] = true;
566
567 return Ret;
568}
569
571 JOS.attribute("aliasee", AA->getAliasee());
572}
573
575 JOS.attribute("cleanup_function", createBareDeclRef(CA->getFunctionDecl()));
576}
577
579 if (!DA->getMessage().empty())
580 JOS.attribute("message", DA->getMessage());
581 if (!DA->getReplacement().empty())
582 JOS.attribute("replacement", DA->getReplacement());
583}
584
586 if (!UA->getMessage().empty())
587 JOS.attribute("message", UA->getMessage());
588}
589
591 JOS.attribute("section_name", SA->getName());
592}
593
595 JOS.attribute("visibility", VisibilityAttr::ConvertVisibilityTypeToStr(
596 VA->getVisibility()));
597}
598
600 JOS.attribute("tls_model", TA->getModel());
601}
602
604 JOS.attribute("decl", createBareDeclRef(TT->getDecl()));
606 JOS.attribute("type", createQualType(TT->desugar()));
607}
608
610 JOS.attribute("decl", createBareDeclRef(TT->getFoundDecl()));
612 JOS.attribute("type", createQualType(TT->desugar()));
613}
614
617 attributeOnlyIfTrue("noreturn", E.getNoReturn());
618 attributeOnlyIfTrue("producesResult", E.getProducesResult());
619 if (E.getHasRegParm())
620 JOS.attribute("regParm", E.getRegParm());
622}
623
626 attributeOnlyIfTrue("trailingReturn", E.HasTrailingReturn);
627 attributeOnlyIfTrue("const", T->isConst());
628 attributeOnlyIfTrue("volatile", T->isVolatile());
629 attributeOnlyIfTrue("restrict", T->isRestrict());
630 attributeOnlyIfTrue("variadic", E.Variadic);
631 switch (E.RefQualifier) {
632 case RQ_LValue: JOS.attribute("refQualifier", "&"); break;
633 case RQ_RValue: JOS.attribute("refQualifier", "&&"); break;
635 }
636 switch (E.ExceptionSpec.Type) {
639 JOS.attribute("exceptionSpec", "throw");
640 llvm::json::Array Types;
641 for (QualType QT : E.ExceptionSpec.Exceptions)
642 Types.push_back(createQualType(QT));
643 JOS.attribute("exceptionTypes", std::move(Types));
644 } break;
646 JOS.attribute("exceptionSpec", "throw");
647 JOS.attribute("throwsAny", true);
648 break;
650 JOS.attribute("exceptionSpec", "noexcept");
651 break;
654 JOS.attribute("exceptionSpec", "noexcept");
655 JOS.attribute("conditionEvaluatesTo",
657
658
659 break;
661 JOS.attribute("exceptionSpec", "nothrow");
662 break;
663
664
665
666
672 }
674}
675
678}
679
683 JOS.attribute("sizeModifier", "*");
684 break;
686 JOS.attribute("sizeModifier", "static");
687 break;
689 break;
690 }
691
693 if (!Str.empty())
694 JOS.attribute("indexTypeQualifiers", Str);
695}
696
698
699
702}
703
706 JOS.attributeObject(
707 "attrLoc", [VT, this] { writeSourceLocation(VT->getAttributeLoc()); });
708}
709
714 break;
716 JOS.attribute("vectorKind", "altivec");
717 break;
719 JOS.attribute("vectorKind", "altivec pixel");
720 break;
722 JOS.attribute("vectorKind", "altivec bool");
723 break;
725 JOS.attribute("vectorKind", "neon");
726 break;
728 JOS.attribute("vectorKind", "neon poly");
729 break;
731 JOS.attribute("vectorKind", "fixed-length sve data vector");
732 break;
734 JOS.attribute("vectorKind", "fixed-length sve predicate vector");
735 break;
737 JOS.attribute("vectorKind", "fixed-length rvv data vector");
738 break;
743 JOS.attribute("vectorKind", "fixed-length rvv mask vector");
744 break;
745 }
746}
747
749 JOS.attribute("decl", createBareDeclRef(UUT->getDecl()));
750}
751
754#define TRANSFORM_TYPE_TRAIT_DEF(Enum, Trait) \
755 case UnaryTransformType::Enum: \
756 JOS.attribute("transformKind", #Trait); \
757 break;
758#include "clang/Basic/TransformTypeTraits.def"
759 }
760}
761
763 JOS.attribute("decl", createBareDeclRef(TT->getDecl()));
764}
765
768 JOS.attribute("depth", TTPT->getDepth());
769 JOS.attribute("index", TTPT->getIndex());
771 JOS.attribute("decl", createBareDeclRef(TTPT->getDecl()));
772}
773
776 JOS.attribute("index", STTPT->getIndex());
778 JOS.attribute("pack_index", *PackIndex);
779}
780
783 JOS.attribute("index", T->getIndex());
784}
785
787 JOS.attribute("undeduced", !AT->isDeduced());
790 JOS.attribute("typeKeyword", "auto");
791 break;
793 JOS.attribute("typeKeyword", "decltype(auto)");
794 break;
796 JOS.attribute("typeKeyword", "__auto_type");
797 break;
798 }
799}
800
803 attributeOnlyIfTrue("isAlias", TST->isTypeAlias());
804
805 std::string Str;
806 llvm::raw_string_ostream OS(Str);
808 JOS.attribute("templateName", Str);
809}
810
813 JOS.attribute("decl", createBareDeclRef(ICNT->getDecl()));
814}
815
817 JOS.attribute("decl", createBareDeclRef(OIT->getDecl()));
818}
819
822 JOS.attribute("numExpansions", *N);
823}
824
827 std::string Str;
828 llvm::raw_string_ostream OS(Str);
829 NNS->print(OS, PrintPolicy, true);
830 JOS.attribute("qualifier", Str);
831 }
833 JOS.attribute("ownedTagDecl", createBareDeclRef(TD));
834}
835
838}
839
843}
844
848
849
851 return;
852
853
854
855
857 return;
858
859
860
861 auto *VD = dyn_cast(ND);
862 if (VD && VD->hasLocalStorage())
863 return;
864
865
866 if (isa(ND))
867 return;
868
869 std::string MangledName = ASTNameGen.getName(ND);
870 if (!MangledName.empty())
871 JOS.attribute("mangledName", MangledName);
872 }
873}
874
878}
879
883}
884
887 attributeOnlyIfTrue("isInline", ND->isInline());
888 attributeOnlyIfTrue("isNested", ND->isNested());
890 JOS.attribute("originalNamespace", createBareDeclRef(ND->getFirstDecl()));
891}
892
894 JOS.attribute("nominatedNamespace",
896}
897
900 JOS.attribute("aliasedNamespace",
902}
903
905 std::string Name;
907 llvm::raw_string_ostream SOS(Name);
909 }
911 JOS.attribute("name", Name);
912}
913
915 JOS.attribute("target", createBareDeclRef(UED->getEnumDecl()));
916}
917
919 JOS.attribute("target", createBareDeclRef(USD->getTargetDecl()));
920}
921
924 JOS.attribute("type", createQualType(VD->getType()));
925 if (const auto *P = dyn_cast(VD))
926 attributeOnlyIfTrue("explicitObjectParameter",
927 P->isExplicitObjectParameter());
928
936 }
938 attributeOnlyIfTrue("inline", VD->isInline());
939 attributeOnlyIfTrue("constexpr", VD->isConstexpr());
940 attributeOnlyIfTrue("modulePrivate", VD->isModulePrivate());
947 JOS.attribute("init", "paren-list");
948 break;
949 }
950 }
951 attributeOnlyIfTrue("isParameterPack", VD->isParameterPack());
952}
953
956 JOS.attribute("type", createQualType(FD->getType()));
957 attributeOnlyIfTrue("mutable", FD->isMutable());
958 attributeOnlyIfTrue("modulePrivate", FD->isModulePrivate());
959 attributeOnlyIfTrue("isBitfield", FD->isBitField());
961}
962
965 JOS.attribute("type", createQualType(FD->getType()));
971 attributeOnlyIfTrue("pure", FD->isPureVirtual());
973 attributeOnlyIfTrue("constexpr", FD->isConstexpr());
974 attributeOnlyIfTrue("variadic", FD->isVariadic());
976
978 JOS.attribute("explicitlyDefaulted",
979 FD->isDeleted() ? "deleted" : "default");
980
982 JOS.attribute("deletedMessage", Msg->getString());
983}
984
988 JOS.attribute("fixedUnderlyingType", createQualType(ED->getIntegerType()));
990 JOS.attribute("scopedEnumTag",
992}
995 JOS.attribute("type", createQualType(ECD->getType()));
996}
997
1002}
1005
1006
1008 return;
1009
1010 JOS.attribute("definitionData", createCXXRecordDefinitionData(RD));
1012 JOS.attributeArray("bases", [this, RD] {
1013 for (const auto &Spec : RD->bases())
1014 JOS.value(createCXXBaseSpecifier(Spec));
1015 });
1016 }
1017}
1018
1021 JOS.attribute("bufferKind", D->isCBuffer() ? "cbuffer" : "tbuffer");
1022}
1023
1026 JOS.attribute("tagUsed", D->wasDeclaredWithTypename() ? "typename" : "class");
1027 JOS.attribute("depth", D->getDepth());
1028 JOS.attribute("index", D->getIndex());
1029 attributeOnlyIfTrue("isParameterPack", D->isParameterPack());
1030
1031 if (D->hasDefaultArgument())
1032 JOS.attributeObject("defaultArg", [=] {
1034 D->getDefaultArgStorage().getInheritedFrom(),
1035 D->defaultArgumentWasInherited() ? "inherited from" : "previous");
1036 });
1037}
1038
1042 JOS.attribute("type", createQualType(D->getType()));
1043 JOS.attribute("depth", D->getDepth());
1044 JOS.attribute("index", D->getIndex());
1045 attributeOnlyIfTrue("isParameterPack", D->isParameterPack());
1046
1047 if (D->hasDefaultArgument())
1048 JOS.attributeObject("defaultArg", [=] {
1050 D->getDefaultArgStorage().getInheritedFrom(),
1051 D->defaultArgumentWasInherited() ? "inherited from" : "previous");
1052 });
1053}
1054
1058 JOS.attribute("depth", D->getDepth());
1059 JOS.attribute("index", D->getIndex());
1060 attributeOnlyIfTrue("isParameterPack", D->isParameterPack());
1061
1062 if (D->hasDefaultArgument())
1063 JOS.attributeObject("defaultArg", [=] {
1064 const auto *InheritedFrom = D->getDefaultArgStorage().getInheritedFrom();
1065 Visit(D->getDefaultArgument().getArgument(),
1067 InheritedFrom,
1068 D->defaultArgumentWasInherited() ? "inherited from" : "previous");
1069 });
1070}
1071
1073 StringRef Lang;
1076 Lang = "C";
1077 break;
1079 Lang = "C++";
1080 break;
1081 }
1082 JOS.attribute("language", Lang);
1083 attributeOnlyIfTrue("hasBraces", LSD->hasBraces());
1084}
1085
1087 JOS.attribute("access", createAccessSpecifier(ASD->getAccess()));
1088}
1089
1092 JOS.attribute("type", createQualType(T->getType()));
1093 attributeOnlyIfTrue("isPackExpansion", FD->isPackExpansion());
1094}
1095
1098 JOS.attribute("type", createQualType(D->getType()));
1099 attributeOnlyIfTrue("synthesized", D->getSynthesize());
1100 switch (D->getAccessControl()) {
1106 }
1107}
1108
1111 JOS.attribute("returnType", createQualType(D->getReturnType()));
1112 JOS.attribute("instance", D->isInstanceMethod());
1113 attributeOnlyIfTrue("variadic", D->isVariadic());
1114}
1115
1118 JOS.attribute("type", createQualType(D->getUnderlyingType()));
1119 attributeOnlyIfTrue("bounded", D->hasExplicitBound());
1120 switch (D->getVariance()) {
1122 break;
1124 JOS.attribute("variance", "covariant");
1125 break;
1127 JOS.attribute("variance", "contravariant");
1128 break;
1129 }
1130}
1131
1134 JOS.attribute("interface", createBareDeclRef(D->getClassInterface()));
1135 JOS.attribute("implementation", createBareDeclRef(D->getImplementation()));
1136
1137 llvm::json::Array Protocols;
1138 for (const auto* P : D->protocols())
1139 Protocols.push_back(createBareDeclRef(P));
1140 if (!Protocols.empty())
1141 JOS.attribute("protocols", std::move(Protocols));
1142}
1143
1146 JOS.attribute("interface", createBareDeclRef(D->getClassInterface()));
1147 JOS.attribute("categoryDecl", createBareDeclRef(D->getCategoryDecl()));
1148}
1149
1152
1153 llvm::json::Array Protocols;
1154 for (const auto *P : D->protocols())
1155 Protocols.push_back(createBareDeclRef(P));
1156 if (!Protocols.empty())
1157 JOS.attribute("protocols", std::move(Protocols));
1158}
1159
1162 JOS.attribute("super", createBareDeclRef(D->getSuperClass()));
1163 JOS.attribute("implementation", createBareDeclRef(D->getImplementation()));
1164
1165 llvm::json::Array Protocols;
1166 for (const auto* P : D->protocols())
1167 Protocols.push_back(createBareDeclRef(P));
1168 if (!Protocols.empty())
1169 JOS.attribute("protocols", std::move(Protocols));
1170}
1171
1175 JOS.attribute("super", createBareDeclRef(D->getSuperClass()));
1176 JOS.attribute("interface", createBareDeclRef(D->getClassInterface()));
1177}
1178
1182 JOS.attribute("interface", createBareDeclRef(D->getClassInterface()));
1183}
1184
1187 JOS.attribute("type", createQualType(D->getType()));
1188
1189 switch (D->getPropertyImplementation()) {
1193 }
1194
1198 JOS.attribute("getter", createBareDeclRef(D->getGetterMethodDecl()));
1200 JOS.attribute("setter", createBareDeclRef(D->getSetterMethodDecl()));
1201 attributeOnlyIfTrue("readonly",
1204 attributeOnlyIfTrue("readwrite",
1208 attributeOnlyIfTrue("nonatomic",
1213 attributeOnlyIfTrue("unsafe_unretained",
1217 attributeOnlyIfTrue("nullability",
1219 attributeOnlyIfTrue("null_resettable",
1221 }
1222}
1223
1226 JOS.attribute("implKind", D->getPropertyImplementation() ==
1228 ? "synthesize"
1229 : "dynamic");
1230 JOS.attribute("propertyDecl", createBareDeclRef(D->getPropertyDecl()));
1231 JOS.attribute("ivarDecl", createBareDeclRef(D->getPropertyIvarDecl()));
1232}
1233
1235 attributeOnlyIfTrue("variadic", D->isVariadic());
1236 attributeOnlyIfTrue("capturesThis", D->capturesCXXThis());
1237}
1238
1241}
1242
1244 JOS.attribute("encodedType", createQualType(OEE->getEncodedType()));
1245}
1246
1248 std::string Str;
1249 llvm::raw_string_ostream OS(Str);
1250
1252 JOS.attribute("selector", Str);
1253
1256 JOS.attribute("receiverKind", "instance");
1257 break;
1259 JOS.attribute("receiverKind", "class");
1261 break;
1263 JOS.attribute("receiverKind", "super (instance)");
1264 JOS.attribute("superType", createQualType(OME->getSuperType()));
1265 break;
1267 JOS.attribute("receiverKind", "super (class)");
1268 JOS.attribute("superType", createQualType(OME->getSuperType()));
1269 break;
1270 }
1271
1273 if (OME->getType() != CallReturnTy)
1274 JOS.attribute("callReturnType", createQualType(CallReturnTy));
1275}
1276
1279 std::string Str;
1280 llvm::raw_string_ostream OS(Str);
1281
1282 MD->getSelector().print(OS);
1283 JOS.attribute("selector", Str);
1284 }
1285}
1286
1288 std::string Str;
1289 llvm::raw_string_ostream OS(Str);
1290
1292 JOS.attribute("selector", Str);
1293}
1294
1296 JOS.attribute("protocol", createBareDeclRef(OPE->getProtocol()));
1297}
1298
1301 JOS.attribute("propertyKind", "implicit");
1303 JOS.attribute("getter", createBareDeclRef(MD));
1305 JOS.attribute("setter", createBareDeclRef(MD));
1306 } else {
1307 JOS.attribute("propertyKind", "explicit");
1309 }
1310
1311 attributeOnlyIfTrue("isSuperReceiver", OPRE->isSuperReceiver());
1312 attributeOnlyIfTrue("isMessagingGetter", OPRE->isMessagingGetter());
1313 attributeOnlyIfTrue("isMessagingSetter", OPRE->isMessagingSetter());
1314}
1315
1318 JOS.attribute("subscriptKind",
1320
1322 JOS.attribute("getter", createBareDeclRef(MD));
1324 JOS.attribute("setter", createBareDeclRef(MD));
1325}
1326
1328 JOS.attribute("decl", createBareDeclRef(OIRE->getDecl()));
1329 attributeOnlyIfTrue("isFreeIvar", OIRE->isFreeIvar());
1330 JOS.attribute("isArrow", OIRE->isArrow());
1331}
1332
1334 JOS.attribute("value", OBLE->getValue() ? "__objc_yes" : "__objc_no");
1335}
1336
1338 JOS.attribute("referencedDecl", createBareDeclRef(DRE->getDecl()));
1340 JOS.attribute("foundReferencedDecl",
1344 case NOUR_Unevaluated: JOS.attribute("nonOdrUseReason", "unevaluated"); break;
1345 case NOUR_Constant: JOS.attribute("nonOdrUseReason", "constant"); break;
1346 case NOUR_Discarded: JOS.attribute("nonOdrUseReason", "discarded"); break;
1347 }
1349}
1350
1353 JOS.attribute("typeSourceInfo",
1354 createQualType(E->getTypeSourceInfo()->getType()));
1355}
1356
1359
1362}
1363
1365 JOS.attribute("isPostfix", UO->isPostfix());
1368 JOS.attribute("canOverflow", false);
1369}
1370
1373}
1374
1379 JOS.attribute("computeResultType",
1381}
1382
1384
1385
1388 JOS.attribute("isArrow", ME->isArrow());
1389 JOS.attribute("referencedMemberDecl", createPointerRepresentation(VD));
1392 case NOUR_Unevaluated: JOS.attribute("nonOdrUseReason", "unevaluated"); break;
1393 case NOUR_Constant: JOS.attribute("nonOdrUseReason", "constant"); break;
1394 case NOUR_Discarded: JOS.attribute("nonOdrUseReason", "discarded"); break;
1395 }
1396}
1397
1399 attributeOnlyIfTrue("isGlobal", NE->isGlobalNew());
1400 attributeOnlyIfTrue("isArray", NE->isArray());
1401 attributeOnlyIfTrue("isPlacement", NE->getNumPlacementArgs() != 0);
1402 switch (NE->getInitializationStyle()) {
1404 break;
1406 JOS.attribute("initStyle", "call");
1407 break;
1409 JOS.attribute("initStyle", "list");
1410 break;
1411 }
1412 if (const FunctionDecl *FD = NE->getOperatorNew())
1413 JOS.attribute("operatorNewDecl", createBareDeclRef(FD));
1414 if (const FunctionDecl *FD = NE->getOperatorDelete())
1415 JOS.attribute("operatorDeleteDecl", createBareDeclRef(FD));
1416}
1418 attributeOnlyIfTrue("isGlobal", DE->isGlobalDelete());
1419 attributeOnlyIfTrue("isArray", DE->isArrayForm());
1422 JOS.attribute("operatorDeleteDecl", createBareDeclRef(FD));
1423}
1424
1426 attributeOnlyIfTrue("implicit", TE->isImplicit());
1427}
1428
1431 llvm::json::Array Path = createCastPath(CE);
1432 if (.empty())
1433 JOS.attribute("path", std::move(Path));
1434
1435
1437 JOS.attribute("conversionFunc", createBareDeclRef(ND));
1438}
1439
1443}
1444
1446 attributeOnlyIfTrue("adl", CE->usesADL());
1447}
1448
1454}
1455
1458}
1459
1464
1465 JOS.attributeArray("lookups", [this, ULE] {
1467 JOS.value(createBareDeclRef(D));
1468 });
1469}
1470
1473 JOS.attribute("labelDeclId", createPointerRepresentation(ALE->getLabel()));
1474}
1475
1480 JOS.attribute("typeArg", createQualType(Unadjusted));
1481 if (Adjusted != Unadjusted)
1482 JOS.attribute("adjustedTypeArg", createQualType(Adjusted));
1483 }
1484}
1485
1489}
1490
1493 JOS.attribute("field", createBareDeclRef(FD));
1494}
1495
1498 attributeOnlyIfTrue("resultDependent", GSE->isResultDependent());
1499}
1500
1504 JOS.attribute("typeAsWritten", createQualType(UCE->getTypeAsWritten()));
1506}
1507
1510 JOS.attribute("ctorType", createQualType(Ctor->getType()));
1511 attributeOnlyIfTrue("elidable", CE->isElidable());
1517
1520 JOS.attribute("constructionKind", "complete");
1521 break;
1523 JOS.attribute("constructionKind", "delegating");
1524 break;
1526 JOS.attribute("constructionKind", "non-virtual base");
1527 break;
1529 JOS.attribute("constructionKind", "virtual base");
1530 break;
1531 }
1532}
1533
1535 attributeOnlyIfTrue("cleanupsHaveSideEffects",
1538 JOS.attributeArray("cleanups", [this, EWC] {
1540 if (auto *BD = CO.dyn_cast<BlockDecl *>()) {
1541 JOS.value(createBareDeclRef(BD));
1543 llvm::json::Object Obj;
1544 Obj["id"] = createPointerRepresentation(CLE);
1545 Obj["kind"] = CLE->getStmtClassName();
1546 JOS.value(std::move(Obj));
1547 } else {
1548 llvm_unreachable("unexpected cleanup object type");
1549 }
1550 });
1551 }
1552}
1553
1557 JOS.attribute("temp", createPointerRepresentation(Temp));
1559 JOS.attribute("dtor", createBareDeclRef(Dtor));
1560}
1561
1565 JOS.attribute("extendingDecl", createBareDeclRef(VD));
1566
1569 JOS.attribute("storageDuration", "automatic");
1570 break;
1572 JOS.attribute("storageDuration", "dynamic");
1573 break;
1575 JOS.attribute("storageDuration", "full expression");
1576 break;
1578 JOS.attribute("storageDuration", "static");
1579 break;
1581 JOS.attribute("storageDuration", "thread");
1582 break;
1583 }
1584
1586}
1587
1589 attributeOnlyIfTrue("hasRewrittenInit", Node->hasRewrittenInit());
1590}
1591
1593 attributeOnlyIfTrue("hasRewrittenInit", Node->hasRewrittenInit());
1594}
1595
1598 JOS.attribute("isArrow", DSME->isArrow());
1600 attributeOnlyIfTrue("hasTemplateKeyword", DSME->hasTemplateKeyword());
1601 attributeOnlyIfTrue("hasExplicitTemplateArgs",
1603
1605 JOS.attributeArray("explicitTemplateArgs", [DSME, this] {
1607 JOS.object(
1608 [&TAL, this] { Visit(TAL.getArgument(), TAL.getSourceRange()); });
1609 });
1610 }
1611}
1612
1616}
1617
1620 IL->getValue().toString(Buffer,
1622 JOS.attribute("value", Buffer);
1623}
1625
1626
1627
1628
1630}
1633}
1636 FL->getValue().toString(Buffer);
1637 JOS.attribute("value", Buffer);
1638}
1640 std::string Buffer;
1641 llvm::raw_string_ostream SS(Buffer);
1643 JOS.attribute("value", Buffer);
1644}
1646 JOS.attribute("value", BLE->getValue());
1647}
1648
1650 attributeOnlyIfTrue("hasInit", IS->hasInitStorage());
1651 attributeOnlyIfTrue("hasVar", IS->hasVarStorage());
1652 attributeOnlyIfTrue("hasElse", IS->hasElseStorage());
1653 attributeOnlyIfTrue("isConstexpr", IS->isConstexpr());
1654 attributeOnlyIfTrue("isConsteval", IS->isConsteval());
1655 attributeOnlyIfTrue("constevalIsNegated", IS->isNegatedConsteval());
1656}
1657
1659 attributeOnlyIfTrue("hasInit", SS->hasInitStorage());
1660 attributeOnlyIfTrue("hasVar", SS->hasVarStorage());
1661}
1664}
1665
1667 JOS.attribute("name", LS->getName());
1668 JOS.attribute("declId", createPointerRepresentation(LS->getDecl()));
1669 attributeOnlyIfTrue("sideEntry", LS->isSideEntry());
1670}
1672 JOS.attribute("targetLabelDeclId",
1673 createPointerRepresentation(GS->getLabel()));
1674}
1675
1677 attributeOnlyIfTrue("hasVar", WS->hasVarStorage());
1678}
1679
1681
1682
1683
1684 attributeOnlyIfTrue("isCatchAll", OACS->getCatchParamDecl() == nullptr);
1685}
1686
1688 JOS.attribute("isNull", true);
1689}
1691 JOS.attribute("type", createQualType(TA.getAsType()));
1692}
1695 JOS.attribute("decl", createBareDeclRef(TA.getAsDecl()));
1696}
1698 JOS.attribute("isNullptr", true);
1699}
1702}
1704
1705
1706}
1709
1710
1711}
1714 JOS.attribute("isExpr", true);
1715}
1717 JOS.attribute("isPack", true);
1718}
1719
1720StringRef JSONNodeDumper::getCommentCommandName(unsigned CommandID) const {
1721 if (Traits)
1725 return Info->Name;
1726 return "";
1727}
1728
1731 JOS.attribute("text", C->getText());
1732}
1733
1736 JOS.attribute("name", getCommentCommandName(C->getCommandID()));
1737
1738 switch (C->getRenderKind()) {
1740 JOS.attribute("renderKind", "normal");
1741 break;
1743 JOS.attribute("renderKind", "bold");
1744 break;
1746 JOS.attribute("renderKind", "emphasized");
1747 break;
1749 JOS.attribute("renderKind", "monospaced");
1750 break;
1752 JOS.attribute("renderKind", "anchor");
1753 break;
1754 }
1755
1756 llvm::json::Array Args;
1757 for (unsigned I = 0, E = C->getNumArgs(); I < E; ++I)
1758 Args.push_back(C->getArgText(I));
1759
1760 if (!Args.empty())
1761 JOS.attribute("args", std::move(Args));
1762}
1763
1766 JOS.attribute("name", C->getTagName());
1767 attributeOnlyIfTrue("selfClosing", C->isSelfClosing());
1768 attributeOnlyIfTrue("malformed", C->isMalformed());
1769
1770 llvm::json::Array Attrs;
1771 for (unsigned I = 0, E = C->getNumAttrs(); I < E; ++I)
1772 Attrs.push_back(
1773 {{"name", C->getAttr(I).Name}, {"value", C->getAttr(I).Value}});
1774
1775 if (!Attrs.empty())
1776 JOS.attribute("attrs", std::move(Attrs));
1777}
1778
1781 JOS.attribute("name", C->getTagName());
1782}
1783
1786 JOS.attribute("name", getCommentCommandName(C->getCommandID()));
1787
1788 llvm::json::Array Args;
1789 for (unsigned I = 0, E = C->getNumArgs(); I < E; ++I)
1790 Args.push_back(C->getArgText(I));
1791
1792 if (!Args.empty())
1793 JOS.attribute("args", std::move(Args));
1794}
1795
1798 switch (C->getDirection()) {
1800 JOS.attribute("direction", "in");
1801 break;
1803 JOS.attribute("direction", "out");
1804 break;
1806 JOS.attribute("direction", "in,out");
1807 break;
1808 }
1809 attributeOnlyIfTrue("explicit", C->isDirectionExplicit());
1810
1811 if (C->hasParamName())
1812 JOS.attribute("param", C->isParamIndexValid() ? C->getParamName(FC)
1813 : C->getParamNameAsWritten());
1814
1815 if (C->isParamIndexValid() && ->isVarArgParam())
1816 JOS.attribute("paramIdx", C->getParamIndex());
1817}
1818
1821 if (C->hasParamName())
1822 JOS.attribute("param", C->isPositionValid() ? C->getParamName(FC)
1823 : C->getParamNameAsWritten());
1824 if (C->isPositionValid()) {
1825 llvm::json::Array Positions;
1826 for (unsigned I = 0, E = C->getDepth(); I < E; ++I)
1827 Positions.push_back(C->getIndex(I));
1828
1829 if (!Positions.empty())
1830 JOS.attribute("positions", std::move(Positions));
1831 }
1832}
1833
1836 JOS.attribute("name", getCommentCommandName(C->getCommandID()));
1837 JOS.attribute("closeName", C->getCloseName());
1838}
1839
1843 JOS.attribute("text", C->getText());
1844}
1845
1848 JOS.attribute("text", C->getText());
1849}
1850
1851llvm::json::Object JSONNodeDumper::createFPOptions(FPOptionsOverride FPO) {
1852 llvm::json::Object Ret;
1853#define OPTION(NAME, TYPE, WIDTH, PREVIOUS) \
1854 if (FPO.has##NAME##Override()) \
1855 Ret.try_emplace(#NAME, static_cast(FPO.get##NAME##Override()));
1856#include "clang/Basic/FPOptions.def"
1857 return Ret;
1858}
1859
1861 VisitStmt(S);
1862 if (S->hasStoredFPFeatures())
1863 JOS.attribute("fpoptions", createFPOptions(S->getStoredFPFeatures()));
1864}
static bool isTrivial(ASTContext &Ctx, const Expr *E)
Checks if the expression is constant or does not have non-trivial function calls.
static llvm::json::Object createMoveAssignmentDefinitionData(const CXXRecordDecl *RD)
#define FIELD2(Name, Flag)
static llvm::json::Object createCopyAssignmentDefinitionData(const CXXRecordDecl *RD)
static llvm::json::Object createCopyConstructorDefinitionData(const CXXRecordDecl *RD)
static llvm::json::Object createDestructorDefinitionData(const CXXRecordDecl *RD)
static llvm::json::Object createDefaultConstructorDefinitionData(const CXXRecordDecl *RD)
static llvm::json::Object createMoveConstructorDefinitionData(const CXXRecordDecl *RD)
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.
C Language Family Type Representation.
llvm::APInt getValue() const
APValue - This class implements a discriminated union of [uninitialized] [APSInt] [APFloat],...
@ None
There is no such object (it's outside its lifetime).
const LangOptions & getLangOpts() const
const clang::PrintingPolicy & getPrintingPolicy() const
std::string getName(const Decl *D)
Represents an access specifier followed by colon ':'.
AddrLabelExpr - The GNU address of label extension, representing &&label.
LabelDecl * getLabel() const
Represents an array type, per C99 6.7.5.2 - Array Declarators.
ArraySizeModifier getSizeModifier() const
Qualifiers getIndexTypeQualifiers() const
AtomicExpr - Variadic atomic builtins: __atomic_exchange, __atomic_fetch_*, __atomic_load,...
StringRef getOpAsString() const
Attr - This represents one attribute.
attr::Kind getKind() const
bool isImplicit() const
Returns true if the attribute has been implicitly created instead of explicitly written by the user.
SourceRange getRange() const
Represents a C++11 auto or C++14 decltype(auto) type, possibly constrained by a type-constraint.
AutoTypeKeyword getKeyword() const
A builtin binary operation expression such as "x + y" or "x <= y".
StringRef getOpcodeStr() const
A class which contains all the information about a particular captured value.
Represents a block literal declaration, which is like an unnamed FunctionDecl.
Represents a base class of a C++ class.
AccessSpecifier getAccessSpecifierAsWritten() const
Retrieves the access specifier as written in the source code (which may mean that no access specifier...
bool isVirtual() const
Determines whether the base class is a virtual base class (or not).
QualType getType() const
Retrieves the type of the base class.
bool isPackExpansion() const
Determine whether this base specifier is a pack expansion.
AccessSpecifier getAccessSpecifier() const
Returns the access specifier for this base specifier.
Represents binding an expression to a temporary.
CXXTemporary * getTemporary()
A boolean literal, per ([C++ lex.bool] Boolean literals).
Represents a call to a C++ constructor.
bool isElidable() const
Whether this construction is elidable.
bool hadMultipleCandidates() const
Whether the referred constructor was resolved from an overloaded set having size greater than 1.
bool isStdInitListInitialization() const
Whether this constructor call was written as list-initialization, but was interpreted as forming a st...
bool isImmediateEscalating() const
bool requiresZeroInitialization() const
Whether this construction first requires zero-initialization before the initializer is called.
CXXConstructorDecl * getConstructor() const
Get the constructor that this expression will (ultimately) call.
bool isListInitialization() const
Whether this constructor call was written as list-initialization.
CXXConstructionKind getConstructionKind() const
Determine whether this constructor is actually constructing a base class (rather than a complete obje...
Represents a C++ constructor within a class.
Represents a C++ base or member initializer.
A default argument (C++ [dcl.fct.default]).
A use of a default initializer in a constructor or in aggregate initialization.
Represents a delete expression for memory deallocation and destructor calls, e.g.
FunctionDecl * getOperatorDelete() const
bool isGlobalDelete() const
bool isArrayFormAsWritten() const
Represents a C++ member access expression where the actual member referenced could not be resolved be...
bool isArrow() const
Determine whether this member expression used the '->' operator; otherwise, it used the '.
unsigned getNumTemplateArgs() const
Retrieve the number of template arguments provided as part of this template-id.
bool hasExplicitTemplateArgs() const
Determines whether this member expression actually had a C++ template argument list explicitly specif...
DeclarationName getMember() const
Retrieve the name of the member that this expression refers to.
bool hasTemplateKeyword() const
Determines whether the member name was preceded by the template keyword.
ArrayRef< TemplateArgumentLoc > template_arguments() const
Represents a C++ destructor within a class.
Represents a new-expression for memory allocation and constructor calls, e.g: "new CXXNewExpr(foo)".
Represents a C++ struct/union/class.
unsigned getNumBases() const
Retrieves the number of base classes of this class.
bool needsOverloadResolutionForMoveConstructor() const
Determine whether we need to eagerly declare a defaulted move constructor for this class.
bool needsOverloadResolutionForDestructor() const
Determine whether we need to eagerly declare a destructor for this class.
bool needsOverloadResolutionForCopyConstructor() const
Determine whether we need to eagerly declare a defaulted copy constructor for this class.
Represents a C++ temporary.
const CXXDestructorDecl * getDestructor() const
Represents the this expression in C++.
A C++ typeid expression (C++ [expr.typeid]), which gets the type_info that corresponds to the supplie...
bool isTypeOperand() const
QualType getTypeOperand(const ASTContext &Context) const
Retrieves the type operand of this typeid() expression after various required adjustments (removing r...
TypeSourceInfo * getTypeOperandSourceInfo() const
Retrieve source information for the type operand.
Describes an explicit type conversion that uses functional notion but could not be resolved because o...
bool isListInitialization() const
Determine whether this expression models list-initialization.
QualType getTypeAsWritten() const
Retrieve the type that is being constructed, as specified in the source code.
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
CaseStmt - Represent a case statement.
bool caseStmtIsGNURange() const
True if this case statement is of the form case LHS ... RHS, which is a GNU extension.
CastExpr - Base class for type casts, including both implicit casts (ImplicitCastExpr) and explicit c...
NamedDecl * getConversionFunction() const
If this cast applies a user-defined conversion, retrieve the conversion function that it invokes.
static const char * getCastKindName(CastKind CK)
unsigned getValue() const
CompoundAssignOperator - For compound assignments (e.g.
QualType getComputationLHSType() const
QualType getComputationResultType() const
CompoundLiteralExpr - [C99 6.5.2.5].
CompoundStmt - This represents a group of statements like { stmt stmt }.
A reference to a concept and its template args, as it appears in the code.
SourceRange getSourceRange() const LLVM_READONLY
ConceptDecl * getNamedConcept() const
SourceLocation getLocation() const
const ASTTemplateArgumentListInfo * getTemplateArgsAsWritten() const
Represents the canonical version of C arrays with a specified constant size.
int64_t getSExtSize() const
Return the size sign-extended as a uint64_t.
ConstantExpr - An expression that occurs in a constant context and optionally the result of evaluatin...
APValue getAPValueResult() const
APValue::ValueKind getResultAPValueKind() const
A reference to a declared variable, function, enum, etc.
NamedDecl * getFoundDecl()
Get the NamedDecl through which this reference occurred.
NonOdrUseReason isNonOdrUse() const
Is this expression a non-odr-use reference, and if so, why?
bool isImmediateEscalating() const
Decl - This represents one declaration (or definition), e.g.
ASTContext & getASTContext() const LLVM_READONLY
bool isImplicit() const
isImplicit - Indicates whether the declaration was implicitly generated by the implementation.
bool isParameterPack() const
Whether this declaration is a parameter pack.
bool isTemplated() const
Determine whether this declaration is a templated entity (whether it is.
bool isInvalidDecl() const
SourceLocation getLocation() const
const char * getDeclKindName() const
bool isThisDeclarationReferenced() const
Whether this declaration was referenced.
bool isUsed(bool CheckUsedAttr=true) const
Whether any (re-)declaration of the entity was used, meaning that a definition is required.
DeclContext * getDeclContext()
AccessSpecifier getAccess() const
DeclContext * getLexicalDeclContext()
getLexicalDeclContext - The declaration context where this Decl was lexically declared (LexicalDC).
virtual SourceRange getSourceRange() const LLVM_READONLY
Source range that this declaration covers.
std::string getAsString() const
Retrieve the human-readable string for this name.
Represents an extended vector type where either the type or size is dependent.
SourceLocation getAttributeLoc() const
Represents a type that was referred to using an elaborated type keyword, e.g., struct S,...
TagDecl * getOwnedTagDecl() const
Return the (re)declaration of this type owned by this occurrence of this type, or nullptr if there is...
NestedNameSpecifier * getQualifier() const
Retrieve the qualification on this type.
An instance of this object exists for each enum constant that is defined.
bool isScoped() const
Returns true if this is a C++11 scoped enumeration.
bool isScopedUsingClassTag() const
Returns true if this is a C++11 scoped enumeration.
bool isFixed() const
Returns true if this is an Objective-C, C++11, or Microsoft-style enumeration with a fixed underlying...
QualType getIntegerType() const
Return the integer type this enum decl corresponds to.
Represents an expression – generally a full-expression – that introduces cleanups to be run at the en...
bool cleanupsHaveSideEffects() const
ArrayRef< CleanupObject > getObjects() const
unsigned getNumObjects() const
llvm::PointerUnion< BlockDecl *, CompoundLiteralExpr * > CleanupObject
The type of objects that are kept in the cleanup.
bool isValueDependent() const
Determines whether the value of this expression depends on.
ExprValueKind getValueKind() const
getValueKind - The value kind that this expression produces.
Represents difference between two FPOptions values.
Represents a member of a struct/union/class.
bool isMutable() const
Determines whether this field is mutable (C++ only).
bool isBitField() const
Determines whether this field is a bitfield.
bool hasInClassInitializer() const
Determine whether this member has a C++11 default member initializer.
std::string getValueAsString(unsigned Radix) const
llvm::APFloat getValue() const
FriendDecl - Represents the declaration of a friend entity, which can be a function,...
TypeSourceInfo * getFriendType() const
If this friend declaration names an (untemplated but possibly dependent) type, return the type; other...
bool isPackExpansion() const
Represents a function declaration or definition.
bool isImmediateFunction() const
StringLiteral * getDeletedMessage() const
Get the message that indicates why this function was deleted.
bool isVariadic() const
Whether this function is variadic.
bool isDeleted() const
Whether this function has been deleted.
StorageClass getStorageClass() const
Returns the storage class as written in the source.
bool isConstexpr() const
Whether this is a (C++11) constexpr function or constexpr constructor.
bool isDeletedAsWritten() const
bool isPureVirtual() const
Whether this virtual function is pure, i.e.
bool isDefaulted() const
Whether this function is defaulted.
bool isVirtualAsWritten() const
Whether this function is marked as virtual explicitly.
bool isInlineSpecified() const
Determine whether the "inline" keyword was specified for this function.
Represents a prototype with parameter type info, e.g.
ExtProtoInfo getExtProtoInfo() const
A class which abstracts out some details necessary for making a call.
FunctionType - C99 6.7.5.3 - Function Declarators.
ExtInfo getExtInfo() const
static StringRef getNameForCallConv(CallingConv CC)
Represents a C11 generic selection.
AssociationTy< true > ConstAssociation
bool isResultDependent() const
Whether this generic selection is result-dependent.
GotoStmt - This represents a direct goto.
LabelDecl * getLabel() const
HLSLBufferDecl - Represent a cbuffer or tbuffer declaration.
StringRef getName() const
Return the actual identifier string.
IfStmt - This represents an if/then/else.
bool hasElseStorage() const
True if this IfStmt has storage for an else statement.
bool hasVarStorage() const
True if this IfStmt has storage for a variable declaration.
bool hasInitStorage() const
True if this IfStmt has the storage for an init statement.
bool isNegatedConsteval() const
ImplicitCastExpr - Allows us to explicitly represent implicit type conversions, which have no direct ...
bool isPartOfExplicitCast() const
Describes an C or C++ initializer list.
FieldDecl * getInitializedFieldInUnion()
If this initializes a union, specifies which field in the union to initialize.
The injected class name of a C++ class template or class template partial specialization.
CXXRecordDecl * getDecl() const
void VisitObjCSubscriptRefExpr(const ObjCSubscriptRefExpr *OSRE)
void VisitObjCInterfaceDecl(const ObjCInterfaceDecl *D)
void VisitUnresolvedLookupExpr(const UnresolvedLookupExpr *ULE)
void VisitCleanupAttr(const CleanupAttr *CA)
void VisitCaseStmt(const CaseStmt *CS)
void VisitImplicitCastExpr(const ImplicitCastExpr *ICE)
void VisitNamespaceAliasDecl(const NamespaceAliasDecl *NAD)
void VisitFunctionProtoType(const FunctionProtoType *T)
void VisitObjCImplementationDecl(const ObjCImplementationDecl *D)
void VisitVectorType(const VectorType *VT)
void VisitFunctionDecl(const FunctionDecl *FD)
void VisitObjCProtocolExpr(const ObjCProtocolExpr *OPE)
void VisitUsingDecl(const UsingDecl *UD)
void VisitEnumConstantDecl(const EnumConstantDecl *ECD)
void VisitConstantExpr(const ConstantExpr *CE)
void VisitRequiresExpr(const RequiresExpr *RE)
void VisitExprWithCleanups(const ExprWithCleanups *EWC)
void VisitCXXBoolLiteralExpr(const CXXBoolLiteralExpr *BLE)
void VisitTagType(const TagType *TT)
void Visit(const Attr *A)
void VisitLabelStmt(const LabelStmt *LS)
void VisitRValueReferenceType(const ReferenceType *RT)
void VisitObjCInterfaceType(const ObjCInterfaceType *OIT)
void VisitCXXConstructExpr(const CXXConstructExpr *CE)
void VisitObjCEncodeExpr(const ObjCEncodeExpr *OEE)
void VisitCXXDependentScopeMemberExpr(const CXXDependentScopeMemberExpr *ME)
void VisitStringLiteral(const StringLiteral *SL)
void VisitBlockDecl(const BlockDecl *D)
void VisitCXXDefaultInitExpr(const CXXDefaultInitExpr *Node)
void VisitSizeOfPackExpr(const SizeOfPackExpr *SOPE)
void VisitCXXUnresolvedConstructExpr(const CXXUnresolvedConstructExpr *UCE)
void VisitCXXTypeidExpr(const CXXTypeidExpr *CTE)
void VisitObjCPropertyImplDecl(const ObjCPropertyImplDecl *D)
void VisitAccessSpecDecl(const AccessSpecDecl *ASD)
void VisitDeprecatedAttr(const DeprecatedAttr *DA)
void VisitMemberPointerType(const MemberPointerType *MPT)
void VisitMemberExpr(const MemberExpr *ME)
void visitBlockCommandComment(const comments::BlockCommandComment *C, const comments::FullComment *)
void VisitCXXRecordDecl(const CXXRecordDecl *RD)
void VisitTemplateTemplateParmDecl(const TemplateTemplateParmDecl *D)
void VisitSwitchStmt(const SwitchStmt *SS)
void visitHTMLEndTagComment(const comments::HTMLEndTagComment *C, const comments::FullComment *)
void VisitBinaryOperator(const BinaryOperator *BO)
void visitVerbatimBlockLineComment(const comments::VerbatimBlockLineComment *C, const comments::FullComment *)
void VisitNonTypeTemplateParmDecl(const NonTypeTemplateParmDecl *D)
void VisitTemplateTypeParmDecl(const TemplateTypeParmDecl *D)
void VisitLinkageSpecDecl(const LinkageSpecDecl *LSD)
void VisitTypedefDecl(const TypedefDecl *TD)
void VisitTypedefType(const TypedefType *TT)
void VisitUnresolvedUsingType(const UnresolvedUsingType *UUT)
void VisitSubstTemplateTypeParmPackType(const SubstTemplateTypeParmPackType *T)
void VisitElaboratedType(const ElaboratedType *ET)
void VisitUnaryTransformType(const UnaryTransformType *UTT)
void VisitCallExpr(const CallExpr *CE)
void VisitVisibilityAttr(const VisibilityAttr *VA)
void VisitCompoundAssignOperator(const CompoundAssignOperator *CAO)
void visitParamCommandComment(const comments::ParamCommandComment *C, const comments::FullComment *FC)
void visitVerbatimBlockComment(const comments::VerbatimBlockComment *C, const comments::FullComment *)
void VisitAtomicExpr(const AtomicExpr *AE)
void VisitUsingShadowDecl(const UsingShadowDecl *USD)
void VisitFloatingLiteral(const FloatingLiteral *FL)
void VisitTemplateTypeParmType(const TemplateTypeParmType *TTPT)
void VisitUsingDirectiveDecl(const UsingDirectiveDecl *UDD)
void VisitTemplateSpecializationType(const TemplateSpecializationType *TST)
void VisitWhileStmt(const WhileStmt *WS)
void VisitDeclarationTemplateArgument(const TemplateArgument &TA)
void VisitVarDecl(const VarDecl *VD)
void VisitEnumDecl(const EnumDecl *ED)
void VisitPackTemplateArgument(const TemplateArgument &TA)
void VisitTemplateExpansionTemplateArgument(const TemplateArgument &TA)
void visitTextComment(const comments::TextComment *C, const comments::FullComment *)
void VisitFieldDecl(const FieldDecl *FD)
void VisitCXXBindTemporaryExpr(const CXXBindTemporaryExpr *BTE)
void VisitIntegralTemplateArgument(const TemplateArgument &TA)
void VisitObjCSelectorExpr(const ObjCSelectorExpr *OSE)
void VisitSYCLUniqueStableNameExpr(const SYCLUniqueStableNameExpr *E)
void VisitDeclRefExpr(const DeclRefExpr *DRE)
void VisitNullPtrTemplateArgument(const TemplateArgument &TA)
void VisitNamespaceDecl(const NamespaceDecl *ND)
void VisitObjCIvarRefExpr(const ObjCIvarRefExpr *OIRE)
void visitVerbatimLineComment(const comments::VerbatimLineComment *C, const comments::FullComment *)
void VisitAutoType(const AutoType *AT)
void VisitObjCIvarDecl(const ObjCIvarDecl *D)
void VisitUnavailableAttr(const UnavailableAttr *UA)
void VisitMacroQualifiedType(const MacroQualifiedType *MQT)
void VisitObjCPropertyDecl(const ObjCPropertyDecl *D)
void VisitObjCMethodDecl(const ObjCMethodDecl *D)
void visitTParamCommandComment(const comments::TParamCommandComment *C, const comments::FullComment *FC)
void VisitAddrLabelExpr(const AddrLabelExpr *ALE)
void VisitPredefinedExpr(const PredefinedExpr *PE)
void VisitAliasAttr(const AliasAttr *AA)
void VisitObjCCategoryImplDecl(const ObjCCategoryImplDecl *D)
void VisitPackExpansionType(const PackExpansionType *PET)
void VisitDependentSizedExtVectorType(const DependentSizedExtVectorType *VT)
void visitHTMLStartTagComment(const comments::HTMLStartTagComment *C, const comments::FullComment *)
void VisitSectionAttr(const SectionAttr *SA)
void VisitUsingType(const UsingType *TT)
void VisitSubstTemplateTypeParmType(const SubstTemplateTypeParmType *STTPT)
void VisitArrayType(const ArrayType *AT)
void VisitTypeTemplateArgument(const TemplateArgument &TA)
void VisitObjCBoxedExpr(const ObjCBoxedExpr *OBE)
void VisitObjCTypeParamDecl(const ObjCTypeParamDecl *D)
void VisitGenericSelectionExpr(const GenericSelectionExpr *GSE)
void VisitTemplateTemplateArgument(const TemplateArgument &TA)
void VisitCXXDefaultArgExpr(const CXXDefaultArgExpr *Node)
void VisitObjCBoolLiteralExpr(const ObjCBoolLiteralExpr *OBLE)
void VisitFixedPointLiteral(const FixedPointLiteral *FPL)
void VisitGotoStmt(const GotoStmt *GS)
void VisitCharacterLiteral(const CharacterLiteral *CL)
void VisitInitListExpr(const InitListExpr *ILE)
void VisitObjCProtocolDecl(const ObjCProtocolDecl *D)
void VisitTLSModelAttr(const TLSModelAttr *TA)
void VisitCompoundStmt(const CompoundStmt *IS)
void VisitHLSLBufferDecl(const HLSLBufferDecl *D)
void VisitCXXThisExpr(const CXXThisExpr *TE)
void VisitObjCPropertyRefExpr(const ObjCPropertyRefExpr *OPRE)
void VisitConstantArrayType(const ConstantArrayType *CAT)
void VisitObjCCompatibleAliasDecl(const ObjCCompatibleAliasDecl *D)
void VisitCXXNewExpr(const CXXNewExpr *NE)
void VisitOpenACCAsteriskSizeExpr(const OpenACCAsteriskSizeExpr *E)
void VisitObjCAtCatchStmt(const ObjCAtCatchStmt *OACS)
void VisitNullTemplateArgument(const TemplateArgument &TA)
void VisitCastExpr(const CastExpr *CE)
void VisitInjectedClassNameType(const InjectedClassNameType *ICNT)
void VisitIfStmt(const IfStmt *IS)
void VisitUnaryOperator(const UnaryOperator *UO)
void visitInlineCommandComment(const comments::InlineCommandComment *C, const comments::FullComment *)
void VisitUnaryExprOrTypeTraitExpr(const UnaryExprOrTypeTraitExpr *TTE)
void VisitIntegerLiteral(const IntegerLiteral *IL)
void VisitUsingEnumDecl(const UsingEnumDecl *UED)
void VisitObjCMessageExpr(const ObjCMessageExpr *OME)
void VisitFunctionType(const FunctionType *T)
void VisitRecordDecl(const RecordDecl *RD)
void VisitTypeAliasDecl(const TypeAliasDecl *TAD)
void VisitExpressionTemplateArgument(const TemplateArgument &TA)
void VisitNamedDecl(const NamedDecl *ND)
void VisitObjCCategoryDecl(const ObjCCategoryDecl *D)
void VisitFriendDecl(const FriendDecl *FD)
void VisitCXXDeleteExpr(const CXXDeleteExpr *DE)
void VisitMaterializeTemporaryExpr(const MaterializeTemporaryExpr *MTE)
LabelStmt - Represents a label, which has a substatement.
LabelDecl * getDecl() const
const char * getName() const
static unsigned MeasureTokenLength(SourceLocation Loc, const SourceManager &SM, const LangOptions &LangOpts)
MeasureTokenLength - Relex the token at the specified location and return its length in bytes in the ...
Represents a linkage specification.
LinkageSpecLanguageIDs getLanguage() const
Return the language specified by this linkage specification.
bool hasBraces() const
Determines whether this linkage specification had braces in its syntactic form.
Sugar type that represents a type that was qualified by a qualifier written as a macro invocation.
const IdentifierInfo * getMacroIdentifier() const
Represents a prvalue temporary that is written into memory so that a reference can bind to it.
StorageDuration getStorageDuration() const
Retrieve the storage duration for the materialized temporary.
bool isBoundToLvalueReference() const
Determine whether this materialized temporary is bound to an lvalue reference; otherwise,...
ValueDecl * getExtendingDecl()
Get the declaration which triggered the lifetime-extension of this temporary, if any.
MemberExpr - [C99 6.5.2.3] Structure and Union Members.
ValueDecl * getMemberDecl() const
Retrieve the member declaration to which this expression refers.
NonOdrUseReason isNonOdrUse() const
Is this expression a non-odr-use reference, and if so, why? This is only meaningful if the named memb...
A pointer to member type per C++ 8.3.3 - Pointers to members.
bool isMemberFunctionPointer() const
Returns true if the member type (i.e.
bool isMemberDataPointer() const
Returns true if the member type (i.e.
This represents a decl that may have a name.
bool isModulePrivate() const
Whether this declaration was marked as being private to the module in which it was defined.
StringRef getName() const
Get the name of identifier for this declaration as a StringRef.
DeclarationName getDeclName() const
Get the actual, stored name of the declaration, which may be a special name.
std::string getNameAsString() const
Get a human-readable name for the declaration, even if it is one of the special kinds of names (C++ c...
Represents a C++ namespace alias.
NamedDecl * getAliasedNamespace() const
Retrieve the namespace that this alias refers to, which may either be a NamespaceDecl or a NamespaceA...
Represent a C++ namespace.
bool isInline() const
Returns true if this is an inline namespace declaration.
bool isNested() const
Returns true if this is a nested namespace declaration.
Represents a C++ nested name specifier, such as "\::std::vector::".
NonTypeTemplateParmDecl - Declares a non-type template parameter, e.g., "Size" in.
This is a basic class for representing single OpenMP clause.
Represents Objective-C's @catch statement.
const VarDecl * getCatchParamDecl() const
ObjCBoolLiteralExpr - Objective-C Boolean Literal.
ObjCBoxedExpr - used for generalized expression boxing.
ObjCMethodDecl * getBoxingMethod() const
ObjCCategoryDecl - Represents a category declaration.
ObjCCategoryImplDecl - An object of this class encapsulates a category @implementation declaration.
ObjCCompatibleAliasDecl - Represents alias of a class.
ObjCEncodeExpr, used for @encode in Objective-C.
QualType getEncodedType() const
ObjCImplementationDecl - Represents a class definition - this is where method definitions are specifi...
Represents an ObjC class declaration.
Interfaces are the core concept in Objective-C for object oriented design.
ObjCInterfaceDecl * getDecl() const
Get the declaration of this interface.
ObjCIvarDecl - Represents an ObjC instance variable.
ObjCIvarRefExpr - A reference to an ObjC instance variable.
An expression that sends a message to the given Objective-C object or class.
QualType getCallReturnType(ASTContext &Ctx) const
Selector getSelector() const
@ SuperInstance
The receiver is the instance of the superclass object.
@ Instance
The receiver is an object instance.
@ SuperClass
The receiver is a superclass.
@ Class
The receiver is a class.
QualType getClassReceiver() const
Returns the type of a class message send, or NULL if the message is not a class message.
QualType getSuperType() const
Retrieve the type referred to by 'super'.
ReceiverKind getReceiverKind() const
Determine the kind of receiver that this message is being sent to.
ObjCMethodDecl - Represents an instance or class method declaration.
Represents one property declaration in an Objective-C interface.
ObjCPropertyImplDecl - Represents implementation declaration of a property in a class or category imp...
ObjCPropertyRefExpr - A dot-syntax expression to access an ObjC property.
bool isMessagingGetter() const
True if the property reference will result in a message to the getter.
ObjCPropertyDecl * getExplicitProperty() const
bool isMessagingSetter() const
True if the property reference will result in a message to the setter.
ObjCMethodDecl * getImplicitPropertyGetter() const
bool isImplicitProperty() const
ObjCMethodDecl * getImplicitPropertySetter() const
bool isSuperReceiver() const
Represents an Objective-C protocol declaration.
ObjCProtocolExpr used for protocol expression in Objective-C.
ObjCProtocolDecl * getProtocol() const
ObjCSelectorExpr used for @selector in Objective-C.
Selector getSelector() const
ObjCSubscriptRefExpr - used for array and dictionary subscripting.
bool isArraySubscriptRefExpr() const
ObjCMethodDecl * getAtIndexMethodDecl() const
ObjCMethodDecl * setAtIndexMethodDecl() const
Represents the declaration of an Objective-C type parameter.
This expression type represents an asterisk in an OpenACC Size-Expr, used in the 'tile' and 'gang' cl...
This is the base type for all OpenACC Clauses.
llvm::iterator_range< decls_iterator > decls() const
DeclarationName getName() const
Gets the name looked up.
Represents a pack expansion of types.
std::optional< unsigned > getNumExpansions() const
Retrieve the number of expansions that this pack expansion will generate, if known.
[C99 6.4.2.2] - A predefined identifier such as func.
StringRef getIdentKindName() const
PredefinedIdentKind getIdentKind() const
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.
SourceLocation getIncludeLoc() const
Return the presumed include location of this location.
A (possibly-)qualified type.
bool isNull() const
Return true if this QualType doesn't point to a type yet.
SplitQualType getSplitDesugaredType() const
SplitQualType split() const
Divides a QualType into its unqualified type and a set of local qualifiers.
std::string getAsString() const
std::string getAsString() const
Represents a struct/union/class.
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
RecordDecl * getDecl() const
decl_type * getFirstDecl()
Return the first declaration of this declaration or itself if this is the only declaration.
bool isFirstDecl() const
True if this is the first declaration in its redeclaration chain.
Base for LValueReferenceType and RValueReferenceType.
bool isSpelledAsLValue() const
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.
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.
NamedDecl * getPack() const
Retrieve the parameter pack.
Encodes a location in the source.
PresumedLoc getPresumedLoc(SourceLocation Loc, bool UseLineDirectives=true) const
Returns the "presumed" location of a SourceLocation specifies.
StringRef getBufferName(SourceLocation Loc, bool *Invalid=nullptr) const
Return the filename or buffer identifier of the buffer the location is in.
bool isMacroArgExpansion(SourceLocation Loc, SourceLocation *StartLoc=nullptr) const
Tests whether the given source location represents a macro argument's expansion into the function-lik...
SourceLocation getSpellingLoc(SourceLocation Loc) const
Given a SourceLocation object, return the spelling location referenced by the ID.
unsigned getSpellingLineNumber(SourceLocation Loc, bool *Invalid=nullptr) const
unsigned getExpansionLineNumber(SourceLocation Loc, bool *Invalid=nullptr) const
std::pair< FileID, unsigned > getDecomposedLoc(SourceLocation Loc) const
Decompose the specified location into a raw FileID + Offset pair.
SourceLocation getExpansionLoc(SourceLocation Loc) const
Given a SourceLocation object Loc, return the expansion location referenced by the ID.
A trivial tuple used to represent a source range.
SourceLocation getEnd() const
SourceLocation getBegin() const
RetTy Visit(PTR(Stmt) S, ParamTys... P)
Stmt - This represents one statement.
StringLiteral - This represents a string literal expression, e.g.
void outputString(raw_ostream &OS) const
Represents the result of substituting a set of types for a template type parameter pack.
Represents the result of substituting a type for a template type parameter.
std::optional< unsigned > getPackIndex() const
unsigned getIndex() const
Returns the index of the replaced parameter in the associated declaration.
SwitchStmt - This represents a 'switch' stmt.
bool hasVarStorage() const
True if this SwitchStmt has storage for a condition variable.
bool hasInitStorage() const
True if this SwitchStmt has storage for an init statement.
Represents the declaration of a struct/union/class/enum.
StringRef getKindName() const
bool isCompleteDefinition() const
Return true if this decl has its body fully specified.
TagDecl * getDecl() const
Location wrapper for a TemplateArgument.
Represents a template argument.
QualType getAsType() const
Retrieve the type for a type template argument.
llvm::APSInt getAsIntegral() const
Retrieve the template argument as an integral value.
ValueDecl * getAsDecl() const
Retrieve the declaration for a declaration non-type template argument.
void print(raw_ostream &OS, const PrintingPolicy &Policy, Qualified Qual=Qualified::AsWritten) const
Print the template name.
Represents a type template specialization; the template must be a class template, a type alias templa...
TemplateName getTemplateName() const
Retrieve the name of the template that we are specializing.
bool isTypeAlias() const
Determine if this template specialization type is for a type alias template that has been substituted...
TemplateTemplateParmDecl - Declares a template template parameter, e.g., "T" in.
Declaration of a template type parameter.
TemplateTypeParmDecl * getDecl() const
bool isParameterPack() const
unsigned getIndex() const
unsigned getDepth() const
Represents the declaration of a typedef-name via a C++11 alias-declaration.
Base wrapper for a particular "section" of type source info.
QualType getType() const
Get the type for which this source info wrapper provides information.
SourceRange getSourceRange() const LLVM_READONLY
Get the full source range.
TypeLocClass getTypeLocClass() const
const Type * getTypePtr() const
A container of type source information.
QualType getType() const
Return the type wrapped by this type source info.
void Visit(const Type *T)
Performs the operation associated with this visitor object.
The base class of the type hierarchy.
bool isSignedIntegerType() const
Return true if this is an integer type that is signed, according to C99 6.2.5p4 [char,...
bool isInstantiationDependentType() const
Determine whether this type is an instantiation-dependent type, meaning that the type involves a temp...
bool isDependentType() const
Whether this type is a dependent type, meaning that its definition somehow depends on a template para...
bool containsUnexpandedParameterPack() const
Whether this type is or contains an unexpanded parameter pack, used to support C++0x variadic templat...
const char * getTypeClassName() const
bool containsErrors() const
Whether this type is an error type.
bool isVariablyModifiedType() const
Whether this type is a variably-modified type (C99 6.7.5).
bool isFromAST() const
Whether this type comes from an AST file.
const T * getAs() const
Member-template getAs'.
Represents the declaration of a typedef-name via the 'typedef' type specifier.
QualType getUnderlyingType() const
TypedefNameDecl * getDecl() const
bool typeMatchesDecl() const
UnaryExprOrTypeTraitExpr - expression with either a type or (unevaluated) expression operand.
QualType getArgumentType() const
bool isArgumentType() const
UnaryExprOrTypeTrait getKind() const
UnaryOperator - This represents the unary-expression's (except sizeof and alignof),...
static bool isPostfix(Opcode Op)
isPostfix - Return true if this is a postfix operation, like x++.
static StringRef getOpcodeStr(Opcode Op)
getOpcodeStr - Turn an Opcode enum value into the punctuation char it corresponds to,...
bool canOverflow() const
Returns true if the unary operator can cause an overflow.
A unary type transform, which is a type constructed from another.
UTTKind getUTTKind() const
A reference to a name which we were able to look up during parsing but could not resolve to a specifi...
bool requiresADL() const
True if this declaration should be extended by argument-dependent lookup.
Represents the dependent type named by a dependently-scoped typename using declaration,...
UnresolvedUsingTypenameDecl * getDecl() const
Represents a C++ using-declaration.
NestedNameSpecifier * getQualifier() const
Retrieve the nested-name-specifier that qualifies the name.
Represents C++ using-directive.
NamespaceDecl * getNominatedNamespace()
Returns the namespace nominated by this using-directive.
Represents a C++ using-enum-declaration.
EnumDecl * getEnumDecl() const
Represents a shadow declaration implicitly introduced into a scope by a (resolved) using-declaration ...
NamedDecl * getTargetDecl() const
Gets the underlying declaration which has been brought into the local scope.
UsingShadowDecl * getFoundDecl() const
bool typeMatchesDecl() const
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
Represents a variable declaration or definition.
bool isConstexpr() const
Whether this variable is (C++11) constexpr.
TLSKind getTLSKind() const
InitializationStyle getInitStyle() const
The style of initialization for this declaration.
static const char * getStorageClassSpecifierString(StorageClass SC)
Return the string used to specify the storage class SC.
@ ListInit
Direct list-initialization (C++11)
@ CInit
C-style initialization with assignment.
@ ParenListInit
Parenthesized list-initialization (C++20)
@ CallInit
Call-style initialization (C++98)
bool isNRVOVariable() const
Determine whether this local variable can be used with the named return value optimization (NRVO).
bool isInline() const
Whether this variable is (C++1z) inline.
@ TLS_Static
TLS with a known-constant initializer.
@ TLS_Dynamic
TLS with a dynamic initializer.
@ TLS_None
Not a TLS variable.
StorageClass getStorageClass() const
Returns the storage class as written in the source.
bool isParameterPack() const
Determine whether this variable is actually a function parameter pack or init-capture pack.
Represents a GCC generic vector type.
unsigned getNumElements() const
VectorKind getVectorKind() const
WhileStmt - This represents a 'while' stmt.
bool hasVarStorage() const
True if this WhileStmt has storage for a condition variable.
A static requirement that can be used in a requires-expression to check properties of types and expre...
RequirementKind getKind() const
bool containsUnexpandedParameterPack() const
RetTy Visit(REF(TemplateArgument) TA, ParamTys... P)
@ kind_nullability
Indicates that the nullability of the type was spelled with a property attribute rather than a type q...
bool Ret(InterpState &S, CodePtr &PC)
The JSON file list parser is used to communicate input to InstallAPI.
if(T->getSizeExpr()) TRY_TO(TraverseStmt(const_cast< Expr * >(T -> getSizeExpr())))
@ GNUAutoType
__auto_type (GNU extension)
@ DecltypeAuto
decltype(auto)
llvm::StringRef getAccessSpelling(AccessSpecifier AS)
@ RQ_None
No ref-qualifier was provided.
@ RQ_LValue
An lvalue ref-qualifier was provided (&).
@ RQ_RValue
An rvalue ref-qualifier was provided (&&).
StorageClass
Storage classes.
@ SD_Thread
Thread storage duration.
@ SD_Static
Static storage duration.
@ SD_FullExpression
Full-expression storage duration (for temporaries).
@ SD_Automatic
Automatic storage duration (most local variables).
@ SD_Dynamic
Dynamic storage duration.
@ VK_PRValue
A pr-value expression (in the C++11 taxonomy) produces a temporary value.
@ VK_XValue
An x-value expression is a reference to an object with independent storage but which can be "moved",...
@ VK_LValue
An l-value expression is a reference to an object with independent storage.
const char * getTraitSpelling(ExpressionTrait T) LLVM_READONLY
Return the spelling of the type trait TT. Never null.
const FunctionProtoType * T
@ Invariant
The parameter is invariant: must match exactly.
@ Contravariant
The parameter is contravariant, e.g., X is a subtype of X when the type parameter is covariant and...
@ Covariant
The parameter is covariant, e.g., X is a subtype of X when the type parameter is covariant and T i...
@ AltiVecBool
is AltiVec 'vector bool ...'
@ SveFixedLengthData
is AArch64 SVE fixed-length data vector
@ AltiVecVector
is AltiVec vector
@ AltiVecPixel
is AltiVec 'vector Pixel'
@ Generic
not a target-specific vector type
@ RVVFixedLengthData
is RISC-V RVV fixed-length data vector
@ RVVFixedLengthMask
is RISC-V RVV fixed-length mask vector
@ NeonPoly
is ARM Neon polynomial vector
@ SveFixedLengthPredicate
is AArch64 SVE fixed-length predicate vector
@ Parens
New-expression has a C++98 paren-delimited initializer.
@ None
New-expression has no initializer as written.
@ Braces
New-expression has a C++11 list-initializer.
@ 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)
AccessSpecifier
A C++ access specifier (public, private, protected), plus the special value "none" which means differ...
@ NOUR_Discarded
This name appears as a potential result of a discarded value expression.
@ NOUR_Unevaluated
This name appears in an unevaluated operand.
@ NOUR_None
This is an odr-use.
@ NOUR_Constant
This name appears as a potential result of an lvalue-to-rvalue conversion that is a constant expressi...
Extra information about a function prototype.
A std::pair-like structure for storing a qualified type split into its local qualifiers and its local...