Go to the documentation of this file.
5 #include "llvm/ADT/StringSwitch.h"
9 void JSONNodeDumper::addPreviousDeclaration(
const Decl *D) {
11 #define DECL(DERIVED, BASE) \
13 return writePreviousDeclImpl(cast<DERIVED##Decl>(D));
14 #define ABSTRACT_DECL(DECL)
15 #include "clang/AST/DeclNodes.inc"
19 llvm_unreachable(
"Decl that isn't part of DeclNodes.inc!");
23 const char *AttrName =
nullptr;
27 AttrName = #X"Attr"; \
29 #include "clang/Basic/AttrList.inc"
32 JOS.attribute(
"id", createPointerRepresentation(A));
33 JOS.attribute(
"kind", AttrName);
34 JOS.attributeObject(
"range", [A,
this] { writeSourceRange(A->
getRange()); });
36 attributeOnlyIfTrue(
"implicit", A->
isImplicit());
51 JOS.attribute(
"id", createPointerRepresentation(S));
52 JOS.attribute(
"kind", S->getStmtClassName());
53 JOS.attributeObject(
"range",
54 [S,
this] { writeSourceRange(S->getSourceRange()); });
56 if (
const auto *E = dyn_cast<Expr>(S)) {
57 JOS.attribute(
"type", createQualType(E->getType()));
59 switch (E->getValueKind()) {
72 JOS.attribute(
"id", createPointerRepresentation(T));
78 JOS.attribute(
"type", createQualType(
QualType(T, 0),
false));
81 attributeOnlyIfTrue(
"isInstantiationDependent",
84 attributeOnlyIfTrue(
"containsUnexpandedPack",
86 attributeOnlyIfTrue(
"isImported", T->
isFromAST());
92 JOS.attribute(
"kind",
"QualType");
93 JOS.attribute(
"type", createQualType(T));
98 JOS.attribute(
"id", createPointerRepresentation(D));
104 JOS.attributeObject(
"loc",
105 [D,
this] { writeSourceLocation(D->
getLocation()); });
106 JOS.attributeObject(
"range",
108 attributeOnlyIfTrue(
"isImplicit", D->
isImplicit());
112 JOS.attribute(
"isUsed",
true);
114 JOS.attribute(
"isReferenced",
true);
116 if (
const auto *ND = dyn_cast<NamedDecl>(D))
117 attributeOnlyIfTrue(
"isHidden", !ND->isUnconditionallyVisible());
123 const auto *ParentDeclContextDecl = dyn_cast<Decl>(D->
getDeclContext());
124 JOS.attribute(
"parentDeclContextId",
125 createPointerRepresentation(ParentDeclContextDecl));
128 addPreviousDeclaration(D);
137 JOS.attribute(
"id", createPointerRepresentation(C));
138 JOS.attribute(
"kind", C->getCommentKindName());
139 JOS.attributeObject(
"loc",
140 [C,
this] { writeSourceLocation(C->getLocation()); });
141 JOS.attributeObject(
"range",
142 [C,
this] { writeSourceRange(C->getSourceRange()); });
149 JOS.attribute(
"kind",
"TemplateArgument");
151 JOS.attributeObject(
"range", [R,
this] { writeSourceRange(R); });
154 JOS.attribute(
Label.empty() ?
"fromDecl" :
Label, createBareDeclRef(From));
160 JOS.attribute(
"kind",
"CXXCtorInitializer");
161 if (Init->isAnyMemberInitializer())
162 JOS.attribute(
"anyInit", createBareDeclRef(Init->getAnyMember()));
163 else if (Init->isBaseInitializer())
164 JOS.attribute(
"baseInit",
165 createQualType(
QualType(Init->getBaseClass(), 0)));
166 else if (Init->isDelegatingInitializer())
167 JOS.attribute(
"delegatingInit",
168 createQualType(Init->getTypeSourceInfo()->getType()));
170 llvm_unreachable(
"Unknown initializer type");
176 JOS.attribute(
"kind",
"Capture");
177 attributeOnlyIfTrue(
"byref", C.isByRef());
178 attributeOnlyIfTrue(
"nested", C.isNested());
180 JOS.attribute(
"var", createBareDeclRef(C.getVariable()));
184 JOS.attribute(
"associationKind", A.getTypeSourceInfo() ?
"case" :
"default");
185 attributeOnlyIfTrue(
"selected", A.isSelected());
194 JOS.attribute(
"kind",
"TypeRequirement");
197 JOS.attribute(
"kind",
"SimpleRequirement");
200 JOS.attribute(
"kind",
"CompoundRequirement");
203 JOS.attribute(
"kind",
"NestedRequirement");
207 if (
auto *ER = dyn_cast<concepts::ExprRequirement>(R))
208 attributeOnlyIfTrue(
"noexcept", ER->hasNoexceptRequirement());
210 attributeOnlyIfTrue(
"isDependent", R->
isDependent());
213 attributeOnlyIfTrue(
"containsUnexpandedPack",
219 llvm::raw_string_ostream OS(Str);
220 Value.printPretty(OS, Ctx, Ty);
221 JOS.attribute(
"value", OS.str());
224 void JSONNodeDumper::writeIncludeStack(
PresumedLoc Loc,
bool JustFirst) {
228 JOS.attributeBegin(
"includedFrom");
250 if (LastLocFilename != ActualFile) {
251 JOS.attribute(
"file", ActualFile);
252 JOS.attribute(
"line", ActualLine);
253 }
else if (LastLocLine != ActualLine)
254 JOS.attribute(
"line", ActualLine);
257 if (PresumedFile != ActualFile && LastLocPresumedFilename != PresumedFile)
258 JOS.attribute(
"presumedFile", PresumedFile);
260 unsigned PresumedLine = Presumed.
getLine();
261 if (ActualLine != PresumedLine && LastLocPresumedLine != PresumedLine)
262 JOS.attribute(
"presumedLine", PresumedLine);
265 JOS.attribute(
"tokLen",
267 LastLocFilename = ActualFile;
268 LastLocPresumedFilename = PresumedFile;
269 LastLocPresumedLine = PresumedLine;
270 LastLocLine = ActualLine;
284 if (Expansion != Spelling) {
287 JOS.attributeObject(
"spellingLoc", [Spelling,
this] {
288 writeBareSourceLocation(Spelling,
true);
290 JOS.attributeObject(
"expansionLoc", [Expansion, Loc,
this] {
291 writeBareSourceLocation(Expansion,
false);
295 JOS.attribute(
"isMacroArgExpansion",
true);
298 writeBareSourceLocation(Spelling,
true);
301 void JSONNodeDumper::writeSourceRange(
SourceRange R) {
302 JOS.attributeObject(
"begin",
303 [R,
this] { writeSourceLocation(R.
getBegin()); });
304 JOS.attributeObject(
"end", [R,
this] { writeSourceLocation(R.
getEnd()); });
307 std::string JSONNodeDumper::createPointerRepresentation(
const void *Ptr) {
311 return "0x" + llvm::utohexstr(
reinterpret_cast<uint64_t>(Ptr),
true);
314 llvm::json::Object JSONNodeDumper::createQualType(
QualType QT,
bool Desugar) {
318 if (Desugar && !QT.
isNull()) {
323 Ret[
"typeAliasDeclId"] = createPointerRepresentation(TT->getDecl());
328 void JSONNodeDumper::writeBareDeclRef(
const Decl *D) {
329 JOS.attribute(
"id", createPointerRepresentation(D));
334 if (
const auto *ND = dyn_cast<NamedDecl>(D))
335 JOS.attribute(
"name", ND->getDeclName().getAsString());
336 if (
const auto *VD = dyn_cast<ValueDecl>(D))
337 JOS.attribute(
"type", createQualType(VD->getType()));
340 llvm::json::Object JSONNodeDumper::createBareDeclRef(
const Decl *D) {
341 llvm::json::Object
Ret{{
"id", createPointerRepresentation(D)}};
346 if (
const auto *ND = dyn_cast<NamedDecl>(D))
347 Ret[
"name"] = ND->getDeclName().getAsString();
348 if (
const auto *VD = dyn_cast<ValueDecl>(D))
349 Ret[
"type"] = createQualType(VD->getType());
353 llvm::json::Array JSONNodeDumper::createCastPath(
const CastExpr *C) {
354 llvm::json::Array
Ret;
358 for (
auto I =
C->path_begin(), E =
C->path_end(); I != E; ++I) {
363 llvm::json::Object Val{{
"name", RD->getName()}};
364 if (
Base->isVirtual())
365 Val[
"isVirtual"] =
true;
366 Ret.push_back(std::move(Val));
371 #define FIELD2(Name, Flag) if (RD->Flag()) Ret[Name] = true
372 #define FIELD1(Flag) FIELD2(#Flag, Flag)
374 static llvm::json::Object
376 llvm::json::Object
Ret;
378 FIELD2(
"exists", hasDefaultConstructor);
379 FIELD2(
"trivial", hasTrivialDefaultConstructor);
380 FIELD2(
"nonTrivial", hasNonTrivialDefaultConstructor);
381 FIELD2(
"userProvided", hasUserProvidedDefaultConstructor);
382 FIELD2(
"isConstexpr", hasConstexprDefaultConstructor);
383 FIELD2(
"needsImplicit", needsImplicitDefaultConstructor);
384 FIELD2(
"defaultedIsConstexpr", defaultedDefaultConstructorIsConstexpr);
389 static llvm::json::Object
391 llvm::json::Object
Ret;
393 FIELD2(
"simple", hasSimpleCopyConstructor);
394 FIELD2(
"trivial", hasTrivialCopyConstructor);
395 FIELD2(
"nonTrivial", hasNonTrivialCopyConstructor);
396 FIELD2(
"userDeclared", hasUserDeclaredCopyConstructor);
397 FIELD2(
"hasConstParam", hasCopyConstructorWithConstParam);
398 FIELD2(
"implicitHasConstParam", implicitCopyConstructorHasConstParam);
399 FIELD2(
"needsImplicit", needsImplicitCopyConstructor);
400 FIELD2(
"needsOverloadResolution", needsOverloadResolutionForCopyConstructor);
402 FIELD2(
"defaultedIsDeleted", defaultedCopyConstructorIsDeleted);
407 static llvm::json::Object
409 llvm::json::Object
Ret;
411 FIELD2(
"exists", hasMoveConstructor);
412 FIELD2(
"simple", hasSimpleMoveConstructor);
413 FIELD2(
"trivial", hasTrivialMoveConstructor);
414 FIELD2(
"nonTrivial", hasNonTrivialMoveConstructor);
415 FIELD2(
"userDeclared", hasUserDeclaredMoveConstructor);
416 FIELD2(
"needsImplicit", needsImplicitMoveConstructor);
417 FIELD2(
"needsOverloadResolution", needsOverloadResolutionForMoveConstructor);
419 FIELD2(
"defaultedIsDeleted", defaultedMoveConstructorIsDeleted);
424 static llvm::json::Object
426 llvm::json::Object
Ret;
428 FIELD2(
"simple", hasSimpleCopyAssignment);
429 FIELD2(
"trivial", hasTrivialCopyAssignment);
430 FIELD2(
"nonTrivial", hasNonTrivialCopyAssignment);
431 FIELD2(
"hasConstParam", hasCopyAssignmentWithConstParam);
432 FIELD2(
"implicitHasConstParam", implicitCopyAssignmentHasConstParam);
433 FIELD2(
"userDeclared", hasUserDeclaredCopyAssignment);
434 FIELD2(
"needsImplicit", needsImplicitCopyAssignment);
435 FIELD2(
"needsOverloadResolution", needsOverloadResolutionForCopyAssignment);
440 static llvm::json::Object
442 llvm::json::Object
Ret;
444 FIELD2(
"exists", hasMoveAssignment);
445 FIELD2(
"simple", hasSimpleMoveAssignment);
446 FIELD2(
"trivial", hasTrivialMoveAssignment);
447 FIELD2(
"nonTrivial", hasNonTrivialMoveAssignment);
448 FIELD2(
"userDeclared", hasUserDeclaredMoveAssignment);
449 FIELD2(
"needsImplicit", needsImplicitMoveAssignment);
450 FIELD2(
"needsOverloadResolution", needsOverloadResolutionForMoveAssignment);
455 static llvm::json::Object
457 llvm::json::Object
Ret;
459 FIELD2(
"simple", hasSimpleDestructor);
460 FIELD2(
"irrelevant", hasIrrelevantDestructor);
461 FIELD2(
"trivial", hasTrivialDestructor);
462 FIELD2(
"nonTrivial", hasNonTrivialDestructor);
463 FIELD2(
"userDeclared", hasUserDeclaredDestructor);
464 FIELD2(
"needsImplicit", needsImplicitDestructor);
465 FIELD2(
"needsOverloadResolution", needsOverloadResolutionForDestructor);
467 FIELD2(
"defaultedIsDeleted", defaultedDestructorIsDeleted);
473 JSONNodeDumper::createCXXRecordDefinitionData(
const CXXRecordDecl *RD) {
474 llvm::json::Object
Ret;
482 FIELD1(isTriviallyCopyable);
489 FIELD1(hasUserDeclaredConstructor);
490 FIELD1(hasConstexprNonCopyMoveConstructor);
492 FIELD1(hasVariantMembers);
493 FIELD2(
"canConstDefaultInit", allowConstDefaultInit);
510 if (AccessSpelling.empty())
512 return AccessSpelling.str();
517 llvm::json::Object
Ret;
521 Ret[
"writtenAccess"] =
524 Ret[
"isVirtual"] =
true;
526 Ret[
"isPackExpansion"] =
true;
532 JOS.attribute(
"decl", createBareDeclRef(TT->
getDecl()));
547 attributeOnlyIfTrue(
"const", T->
isConst());
548 attributeOnlyIfTrue(
"volatile", T->
isVolatile());
549 attributeOnlyIfTrue(
"restrict", T->
isRestrict());
550 attributeOnlyIfTrue(
"variadic", E.
Variadic);
552 case RQ_LValue:
JOS.attribute(
"refQualifier",
"&");
break;
553 case RQ_RValue:
JOS.attribute(
"refQualifier",
"&&");
break;
559 JOS.attribute(
"exceptionSpec",
"throw");
560 llvm::json::Array Types;
562 Types.push_back(createQualType(QT));
563 JOS.attribute(
"exceptionTypes", std::move(Types));
566 JOS.attribute(
"exceptionSpec",
"throw");
567 JOS.attribute(
"throwsAny",
true);
570 JOS.attribute(
"exceptionSpec",
"noexcept");
574 JOS.attribute(
"exceptionSpec",
"noexcept");
575 JOS.attribute(
"conditionEvaluatesTo",
581 JOS.attribute(
"exceptionSpec",
"nothrow");
603 JOS.attribute(
"sizeModifier",
"*");
606 JOS.attribute(
"sizeModifier",
"static");
614 JOS.attribute(
"indexTypeQualifiers", Str);
620 JOS.attribute(
"size", CAT->
getSize().getSExtValue());
627 "attrLoc", [VT,
this] { writeSourceLocation(VT->
getAttributeLoc()); });
636 JOS.attribute(
"vectorKind",
"altivec");
639 JOS.attribute(
"vectorKind",
"altivec pixel");
642 JOS.attribute(
"vectorKind",
"altivec bool");
645 JOS.attribute(
"vectorKind",
"neon");
648 JOS.attribute(
"vectorKind",
"neon poly");
651 JOS.attribute(
"vectorKind",
"fixed-length sve data vector");
654 JOS.attribute(
"vectorKind",
"fixed-length sve predicate vector");
660 JOS.attribute(
"decl", createBareDeclRef(UUT->
getDecl()));
666 JOS.attribute(
"transformKind",
"underlying_type");
672 JOS.attribute(
"decl", createBareDeclRef(TT->
getDecl()));
680 JOS.attribute(
"decl", createBareDeclRef(TTPT->
getDecl()));
687 JOS.attribute(
"typeKeyword",
"auto");
690 JOS.attribute(
"typeKeyword",
"decltype(auto)");
693 JOS.attribute(
"typeKeyword",
"__auto_type");
700 attributeOnlyIfTrue(
"isAlias", TST->
isTypeAlias());
703 llvm::raw_string_ostream OS(Str);
705 JOS.attribute(
"templateName", OS.str());
710 JOS.attribute(
"decl", createBareDeclRef(ICNT->
getDecl()));
714 JOS.attribute(
"decl", createBareDeclRef(OIT->
getDecl()));
719 JOS.attribute(
"numExpansions", *N);
725 llvm::raw_string_ostream OS(Str);
726 NNS->print(OS, PrintPolicy,
true);
727 JOS.attribute(
"qualifier", OS.str());
730 JOS.attribute(
"ownedTagDecl", createBareDeclRef(TD));
752 auto *VD = dyn_cast<VarDecl>(ND);
753 if (VD && VD->hasLocalStorage())
757 if (!MangledName.empty())
758 JOS.attribute(
"mangledName", MangledName);
774 attributeOnlyIfTrue(
"isInline", ND->
isInline());
776 JOS.attribute(
"originalNamespace",
781 JOS.attribute(
"nominatedNamespace",
787 JOS.attribute(
"aliasedNamespace",
794 llvm::raw_string_ostream SOS(Name);
798 JOS.attribute(
"name", Name);
811 JOS.attribute(
"type", createQualType(VD->
getType()));
822 attributeOnlyIfTrue(
"inline", VD->
isInline());
823 attributeOnlyIfTrue(
"constexpr", VD->
isConstexpr());
837 JOS.attribute(
"type", createQualType(FD->
getType()));
838 attributeOnlyIfTrue(
"mutable", FD->
isMutable());
840 attributeOnlyIfTrue(
"isBitfield", FD->
isBitField());
846 JOS.attribute(
"type", createQualType(FD->
getType()));
852 attributeOnlyIfTrue(
"pure", FD->
isPure());
854 attributeOnlyIfTrue(
"constexpr", FD->
isConstexpr());
855 attributeOnlyIfTrue(
"variadic", FD->
isVariadic());
858 JOS.attribute(
"explicitlyDefaulted",
859 FD->
isDeleted() ?
"deleted" :
"default");
867 JOS.attribute(
"scopedEnumTag",
872 JOS.attribute(
"type", createQualType(ECD->
getType()));
887 JOS.attribute(
"definitionData", createCXXRecordDefinitionData(RD));
889 JOS.attributeArray(
"bases", [
this, RD] {
890 for (
const auto &Spec : RD->
bases())
891 JOS.value(createCXXBaseSpecifier(Spec));
904 JOS.attributeObject(
"defaultArg", [=] {
914 JOS.attribute(
"type", createQualType(D->
getType()));
920 JOS.attributeObject(
"defaultArg", [=] {
935 JOS.attributeObject(
"defaultArg", [=] {
938 InheritedFrom ? InheritedFrom->getSourceRange() :
SourceLocation{},
950 JOS.attribute(
"language", Lang);
951 attributeOnlyIfTrue(
"hasBraces", LSD->
hasBraces());
955 JOS.attribute(
"access", createAccessSpecifier(ASD->
getAccess()));
960 JOS.attribute(
"type", createQualType(T->getType()));
965 JOS.attribute(
"type", createQualType(D->
getType()));
980 attributeOnlyIfTrue(
"variadic", D->
isVariadic());
991 JOS.attribute(
"variance",
"covariant");
994 JOS.attribute(
"variance",
"contravariant");
1004 llvm::json::Array Protocols;
1006 Protocols.push_back(createBareDeclRef(
P));
1007 if (!Protocols.empty())
1008 JOS.attribute(
"protocols", std::move(Protocols));
1020 llvm::json::Array Protocols;
1022 Protocols.push_back(createBareDeclRef(
P));
1023 if (!Protocols.empty())
1024 JOS.attribute(
"protocols", std::move(Protocols));
1032 llvm::json::Array Protocols;
1034 Protocols.push_back(createBareDeclRef(
P));
1035 if (!Protocols.empty())
1036 JOS.attribute(
"protocols", std::move(Protocols));
1054 JOS.attribute(
"type", createQualType(D->
getType()));
1068 attributeOnlyIfTrue(
"readonly",
1071 attributeOnlyIfTrue(
"readwrite",
1075 attributeOnlyIfTrue(
"nonatomic",
1080 attributeOnlyIfTrue(
"unsafe_unretained",
1084 attributeOnlyIfTrue(
"nullability",
1086 attributeOnlyIfTrue(
"null_resettable",
1102 attributeOnlyIfTrue(
"variadic", D->
isVariadic());
1112 llvm::raw_string_ostream OS(Str);
1115 JOS.attribute(
"selector", OS.str());
1119 JOS.attribute(
"receiverKind",
"instance");
1122 JOS.attribute(
"receiverKind",
"class");
1126 JOS.attribute(
"receiverKind",
"super (instance)");
1130 JOS.attribute(
"receiverKind",
"super (class)");
1136 if (OME->
getType() != CallReturnTy)
1137 JOS.attribute(
"callReturnType", createQualType(CallReturnTy));
1143 llvm::raw_string_ostream OS(Str);
1145 MD->getSelector().print(OS);
1146 JOS.attribute(
"selector", OS.str());
1152 llvm::raw_string_ostream OS(Str);
1155 JOS.attribute(
"selector", OS.str());
1159 JOS.attribute(
"protocol", createBareDeclRef(OPE->
getProtocol()));
1164 JOS.attribute(
"propertyKind",
"implicit");
1166 JOS.attribute(
"getter", createBareDeclRef(MD));
1168 JOS.attribute(
"setter", createBareDeclRef(MD));
1170 JOS.attribute(
"propertyKind",
"explicit");
1181 JOS.attribute(
"subscriptKind",
1185 JOS.attribute(
"getter", createBareDeclRef(MD));
1187 JOS.attribute(
"setter", createBareDeclRef(MD));
1191 JOS.attribute(
"decl", createBareDeclRef(OIRE->
getDecl()));
1192 attributeOnlyIfTrue(
"isFreeIvar", OIRE->
isFreeIvar());
1197 JOS.attribute(
"value", OBLE->
getValue() ?
"__objc_yes" :
"__objc_no");
1201 JOS.attribute(
"referencedDecl", createBareDeclRef(DRE->
getDecl()));
1203 JOS.attribute(
"foundReferencedDecl",
1215 JOS.attribute(
"typeSourceInfo",
1227 JOS.attribute(
"canOverflow",
false);
1238 JOS.attribute(
"computeResultType",
1248 JOS.attribute(
"referencedMemberDecl", createPointerRepresentation(VD));
1258 attributeOnlyIfTrue(
"isGlobal",
NE->isGlobalNew());
1259 attributeOnlyIfTrue(
"isArray",
NE->isArray());
1260 attributeOnlyIfTrue(
"isPlacement",
NE->getNumPlacementArgs() != 0);
1261 switch (
NE->getInitializationStyle()) {
1267 JOS.attribute(
"operatorNewDecl", createBareDeclRef(FD));
1269 JOS.attribute(
"operatorDeleteDecl", createBareDeclRef(FD));
1273 attributeOnlyIfTrue(
"isArray", DE->
isArrayForm());
1276 JOS.attribute(
"operatorDeleteDecl", createBareDeclRef(FD));
1280 attributeOnlyIfTrue(
"implicit", TE->
isImplicit());
1285 llvm::json::Array Path = createCastPath(CE);
1287 JOS.attribute(
"path", std::move(Path));
1291 JOS.attribute(
"conversionFunc", createBareDeclRef(ND));
1300 attributeOnlyIfTrue(
"adl", CE->
usesADL());
1319 JOS.attributeArray(
"lookups", [
this, ULE] {
1321 JOS.value(createBareDeclRef(D));
1327 JOS.attribute(
"labelDeclId", createPointerRepresentation(ALE->
getLabel()));
1334 JOS.attribute(
"typeArg", createQualType(Unadjusted));
1335 if (Adjusted != Unadjusted)
1336 JOS.attribute(
"adjustedTypeArg", createQualType(Adjusted));
1347 JOS.attribute(
"field", createBareDeclRef(FD));
1364 JOS.attribute(
"ctorType", createQualType(Ctor->
getType()));
1365 attributeOnlyIfTrue(
"elidable", CE->
isElidable());
1373 JOS.attribute(
"constructionKind",
"complete");
1376 JOS.attribute(
"constructionKind",
"delegating");
1379 JOS.attribute(
"constructionKind",
"non-virtual base");
1382 JOS.attribute(
"constructionKind",
"virtual base");
1388 attributeOnlyIfTrue(
"cleanupsHaveSideEffects",
1391 JOS.attributeArray(
"cleanups", [
this, EWC] {
1394 JOS.value(createBareDeclRef(BD));
1396 llvm::json::Object Obj;
1397 Obj[
"id"] = createPointerRepresentation(CLE);
1398 Obj[
"kind"] = CLE->getStmtClassName();
1399 JOS.value(std::move(Obj));
1401 llvm_unreachable(
"unexpected cleanup object type");
1410 JOS.attribute(
"temp", createPointerRepresentation(Temp));
1412 JOS.attribute(
"dtor", createBareDeclRef(Dtor));
1418 JOS.attribute(
"extendingDecl", createBareDeclRef(VD));
1422 JOS.attribute(
"storageDuration",
"automatic");
1425 JOS.attribute(
"storageDuration",
"dynamic");
1428 JOS.attribute(
"storageDuration",
"full expression");
1431 JOS.attribute(
"storageDuration",
"static");
1434 JOS.attribute(
"storageDuration",
"thread");
1446 attributeOnlyIfTrue(
"hasExplicitTemplateArgs",
1450 JOS.attributeArray(
"explicitTemplateArgs", [DSME,
this] {
1453 [&TAL,
this] { Visit(TAL.getArgument(), TAL.getSourceRange()); });
1467 JOS.attribute(
"value", Buffer);
1482 JOS.attribute(
"value", Buffer);
1486 llvm::raw_string_ostream SS(Buffer);
1488 JOS.attribute(
"value", SS.str());
1498 attributeOnlyIfTrue(
"isConstexpr", IS->
isConstexpr());
1499 attributeOnlyIfTrue(
"isConsteval", IS->
isConsteval());
1513 JOS.attribute(
"declId", createPointerRepresentation(LS->
getDecl()));
1514 attributeOnlyIfTrue(
"sideEntry", LS->
isSideEntry());
1517 JOS.attribute(
"targetLabelDeclId",
1518 createPointerRepresentation(GS->
getLabel()));
1533 JOS.attribute(
"isNull",
true);
1540 JOS.attribute(
"decl", createBareDeclRef(TA.
getAsDecl()));
1543 JOS.attribute(
"isNullptr",
true);
1559 JOS.attribute(
"isExpr",
true);
1562 JOS.attribute(
"isPack",
true);
1565 StringRef JSONNodeDumper::getCommentCommandName(
unsigned CommandID)
const {
1576 JOS.attribute(
"text", C->getText());
1581 JOS.attribute(
"name", getCommentCommandName(C->getCommandID()));
1583 switch (C->getRenderKind()) {
1585 JOS.attribute(
"renderKind",
"normal");
1588 JOS.attribute(
"renderKind",
"bold");
1591 JOS.attribute(
"renderKind",
"emphasized");
1594 JOS.attribute(
"renderKind",
"monospaced");
1597 JOS.attribute(
"renderKind",
"anchor");
1601 llvm::json::Array Args;
1602 for (
unsigned I = 0, E = C->getNumArgs(); I < E; ++I)
1603 Args.push_back(C->getArgText(I));
1606 JOS.attribute(
"args", std::move(Args));
1611 JOS.attribute(
"name", C->getTagName());
1612 attributeOnlyIfTrue(
"selfClosing", C->isSelfClosing());
1613 attributeOnlyIfTrue(
"malformed", C->isMalformed());
1615 llvm::json::Array Attrs;
1616 for (
unsigned I = 0, E = C->getNumAttrs(); I < E; ++I)
1618 {{
"name", C->getAttr(I).Name}, {
"value", C->getAttr(I).
Value}});
1621 JOS.attribute(
"attrs", std::move(Attrs));
1626 JOS.attribute(
"name", C->getTagName());
1631 JOS.attribute(
"name", getCommentCommandName(C->getCommandID()));
1633 llvm::json::Array Args;
1634 for (
unsigned I = 0, E = C->getNumArgs(); I < E; ++I)
1635 Args.push_back(C->getArgText(I));
1638 JOS.attribute(
"args", std::move(Args));
1643 switch (C->getDirection()) {
1645 JOS.attribute(
"direction",
"in");
1648 JOS.attribute(
"direction",
"out");
1651 JOS.attribute(
"direction",
"in,out");
1654 attributeOnlyIfTrue(
"explicit", C->isDirectionExplicit());
1656 if (C->hasParamName())
1657 JOS.attribute(
"param", C->isParamIndexValid() ? C->getParamName(FC)
1658 : C->getParamNameAsWritten());
1660 if (C->isParamIndexValid() && !C->isVarArgParam())
1661 JOS.attribute(
"paramIdx", C->getParamIndex());
1666 if (C->hasParamName())
1667 JOS.attribute(
"param", C->isPositionValid() ? C->getParamName(FC)
1668 : C->getParamNameAsWritten());
1669 if (C->isPositionValid()) {
1670 llvm::json::Array Positions;
1671 for (
unsigned I = 0, E = C->getDepth(); I < E; ++I)
1672 Positions.push_back(C->getIndex(I));
1674 if (!Positions.empty())
1675 JOS.attribute(
"positions", std::move(Positions));
1681 JOS.attribute(
"name", getCommentCommandName(C->getCommandID()));
1682 JOS.attribute(
"closeName", C->getCloseName());
1688 JOS.attribute(
"text", C->getText());
1693 JOS.attribute(
"text", C->getText());
ObjCMethodDecl * setAtIndexMethodDecl() const
bool hasVarStorage() const
True if this SwitchStmt has storage for a condition variable.
LabelStmt - Represents a label, which has a substatement.
@ SuperInstance
The receiver is the instance of the superclass object.
StringRef getKindName() const
Represents an ObjC class declaration.
QualType getComputationLHSType() const
void VisitUnaryTransformType(const UnaryTransformType *UTT)
bool hasExplicitBound() const
Whether this type parameter has an explicitly-written type bound, e.g., "T : NSView".
bool isArraySubscriptRefExpr() const
void VisitLinkageSpecDecl(const LinkageSpecDecl *LSD)
NamedDecl * getFoundDecl()
Get the NamedDecl through which this reference occurred.
bool isListInitialization() const
Determine whether this expression models list-initialization.
ObjCIvarDecl * getPropertyIvarDecl() const
CaseStmt - Represent a case statement.
ObjCCompatibleAliasDecl - Represents alias of a class.
QualType getCallReturnType(ASTContext &Ctx) const
ASTContext & getASTContext() const LLVM_READONLY
Represents an access specifier followed by colon ':'.
bool isDefaulted() const
Whether this function is defaulted.
ObjCMethodDecl * getImplicitPropertySetter() const
void VisitFieldDecl(const FieldDecl *FD)
void VisitObjCIvarRefExpr(const ObjCIvarRefExpr *OIRE)
void VisitObjCBoolLiteralExpr(const ObjCBoolLiteralExpr *OBLE)
NamedDecl * getPack() const
Retrieve the parameter pack.
bool requiresADL() const
True if this declaration should be extended by argument-dependent lookup.
Represents a C++ constructor within a class.
QualType getType() const
Retrieves the type of the base class.
void visitVerbatimLineComment(const comments::VerbatimLineComment *C, const comments::FullComment *)
ObjCProtocolDecl * getProtocol() const
ObjCBoxedExpr - used for generalized expression boxing.
bool caseStmtIsGNURange() const
True if this case statement is of the form case LHS ...
A boolean literal, per ([C++ lex.bool] Boolean literals).
protocol_range protocols() const
TLSKind getTLSKind() const
void VisitObjCSelectorExpr(const ObjCSelectorExpr *OSE)
const DefArgStorage & getDefaultArgStorage() const
@ GNUAutoType
__auto_type (GNU extension)
bool isImplicit() const
Returns true if the attribute has been implicitly created instead of explicitly written by the user.
void visitParamCommandComment(const comments::ParamCommandComment *C, const comments::FullComment *FC)
QualType getType() const
Return the type wrapped by this type source info.
bool hasDefaultArgument() const
Determine whether this template parameter has a default argument.
bool defaultArgumentWasInherited() const
Determines whether the default argument was inherited from a previous declaration of this template.
unsigned getIndex() const
Retrieve the index of the template parameter.
TemplateTypeParmDecl * getDecl() const
@ SveFixedLengthPredicateVector
is AArch64 SVE fixed-length predicate vector
const char * getTypeClassName() const
SwitchStmt - This represents a 'switch' stmt.
AssociationTy< true > ConstAssociation
void VisitObjCProtocolDecl(const ObjCProtocolDecl *D)
Represents a linkage specification.
void VisitObjCBoxedExpr(const ObjCBoxedExpr *OBE)
A trivial tuple used to represent a source range.
bool hasVarStorage() const
True if this IfStmt has storage for a variable declaration.
WhileStmt - This represents a 'while' stmt.
void VisitUsingDecl(const UsingDecl *UD)
static bool Ret(InterpState &S, CodePtr &PC, APValue &Result)
unsigned getLine() const
Return the presumed line number of this location.
void VisitTemplateTypeParmType(const TemplateTypeParmType *TTPT)
QualType getDefaultArgument() const
Retrieve the default argument, if any.
ObjCMethodDecl * getGetterMethodDecl() const
void VisitFloatingLiteral(const FloatingLiteral *FL)
void VisitObjCMessageExpr(const ObjCMessageExpr *OME)
unsigned getIndex() const
Get the index of the template parameter within its parameter list.
Represents a C++ namespace alias.
ObjCImplementationDecl - Represents a class definition - this is where method definitions are specifi...
Represents the canonical version of C arrays with a specified constant size.
bool isConstexpr() const
Whether this is a (C++11) constexpr function or constexpr constructor.
Selector getSelector() const
@ Invariant
The parameter is invariant: must match exactly.
llvm::APFloat getValue() const
void VisitObjCPropertyRefExpr(const ObjCPropertyRefExpr *OPRE)
bool isDeleted() const
Whether this function has been deleted.
NestedNameSpecifier * getQualifier() const
Retrieve the nested-name-specifier that qualifies the name.
static llvm::json::Object createCopyConstructorDefinitionData(const CXXRecordDecl *RD)
bool isTypeAlias() const
Determine if this template specialization type is for a type alias template that has been substituted...
Represents C++ using-directive.
void VisitCXXNewExpr(const CXXNewExpr *NE)
void VisitTypedefType(const TypedefType *TT)
const llvm::APInt & getSize() const
void VisitInjectedClassNameType(const InjectedClassNameType *ICNT)
ObjCMethodDecl * getAtIndexMethodDecl() const
if(T->getSizeExpr()) TRY_TO(TraverseStmt(T -> getSizeExpr()))
Encodes a location in the source.
void VisitDependentSizedExtVectorType(const DependentSizedExtVectorType *VT)
void VisitObjCIvarDecl(const ObjCIvarDecl *D)
@ CallInit
New-expression has a C++98 paren-delimited initializer.
unsigned getIndex() const
Get the index of the template parameter within its parameter list.
This represents a decl that may have a name.
unsigned getValue() const
SourceLocation getBegin() const
unsigned getNumObjects() const
@ NOUR_Discarded
This name appears as a potential result of a discarded value expression.
void VisitDeclRefExpr(const DeclRefExpr *DRE)
void VisitIntegralTemplateArgument(const TemplateArgument &TA)
APValue getAPValueResult() const
bool hasVarStorage() const
True if this WhileStmt has storage for a condition variable.
void VisitCXXDependentScopeMemberExpr(const CXXDependentScopeMemberExpr *ME)
bool requiresZeroInitialization() const
Whether this construction first requires zero-initialization before the initializer is called.
@ TLS_Static
TLS with a known-constant initializer.
A (possibly-)qualified type.
bool isFixed() const
Returns true if this is an Objective-C, C++11, or Microsoft-style enumeration with a fixed underlying...
NonTypeTemplateParmDecl - Declares a non-type template parameter, e.g., "Size" in.
std::string getAsString() const
@ EST_None
no exception specification
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
const DefArgStorage & getDefaultArgStorage() const
AccessControl getAccessControl() const
A C++ typeid expression (C++ [expr.typeid]), which gets the type_info that corresponds to the supplie...
Represents a member of a struct/union/class.
@ NeonVector
is ARM Neon vector
RefQualifierKind RefQualifier
ObjCTypeParamVariance getVariance() const
Determine the variance of this type parameter.
C++2a [expr.prim.req]: A requires-expression provides a concise way to express requirements on templa...
@ EST_Dynamic
throw(T1, T2)
void VisitUnaryExprOrTypeTraitExpr(const UnaryExprOrTypeTraitExpr *TTE)
void VisitNamedDecl(const NamedDecl *ND)
NonOdrUseReason isNonOdrUse() const
Is this expression a non-odr-use reference, and if so, why?
ObjCInterfaceDecl * getClassInterface()
@ VK_XValue
An x-value expression is a reference to an object with independent storage but which can be "moved",...
bool isUsed(bool CheckUsedAttr=true) const
Whether any (re-)declaration of the entity was used, meaning that a definition is required.
void VisitNamespaceDecl(const NamespaceDecl *ND)
void VisitTypeTemplateArgument(const TemplateArgument &TA)
StringRef getOpcodeStr() const
void VisitCXXUnresolvedConstructExpr(const CXXUnresolvedConstructExpr *UCE)
Represents a shadow declaration implicitly introduced into a scope by a (resolved) using-declaration ...
Represents a new-expression for memory allocation and constructor calls, e.g: "new CXXNewExpr(foo)".
Represents a type template specialization; the template must be a class template, a type alias templa...
bool containsUnexpandedParameterPack() const
Whether this type is or contains an unexpanded parameter pack, used to support C++0x variadic templat...
IfStmt - This represents an if/then/else.
@ Covariant
The parameter is covariant, e.g., X<T> is a subtype of X when the type parameter is covariant and T i...
bool hasElseStorage() const
True if this IfStmt has storage for an else statement.
void VisitFriendDecl(const FriendDecl *FD)
void VisitAccessSpecDecl(const AccessSpecDecl *ASD)
ExtInfo getExtInfo() const
GotoStmt - This represents a direct goto.
static llvm::json::Object createMoveConstructorDefinitionData(const CXXRecordDecl *RD)
Describes an C or C++ initializer list.
ObjCPropertyImplDecl - Represents implementation declaration of a property in a class or category imp...
void VisitExpressionTemplateArgument(const TemplateArgument &TA)
SourceLocation getIncludeLoc() const
Return the presumed include location of this location.
@ RQ_RValue
An rvalue ref-qualifier was provided (&&).
void visitTextComment(const comments::TextComment *C, const comments::FullComment *)
UnaryOperator - This represents the unary-expression's (except sizeof and alignof),...
bool isMemberFunctionPointer() const
Returns true if the member type (i.e.
bool hasInitStorage() const
True if this IfStmt has the storage for an init statement.
bool hasDefaultArgument() const
Determine whether this template parameter has a default argument.
StorageDuration getStorageDuration() const
Retrieve the storage duration for the materialized temporary.
PresumedLoc getPresumedLoc(SourceLocation Loc, bool UseLineDirectives=true) const
Returns the "presumed" location of a SourceLocation specifies.
@ EST_Unparsed
not parsed yet
@ None
There is no such object (it's outside its lifetime).
bool isSuperReceiver() const
@ NeonPolyVector
is ARM Neon polynomial vector
bool isBoundToLvalueReference() const
Determine whether this materialized temporary is bound to an lvalue reference; otherwise,...
PropertyControl getPropertyImplementation() const
ObjCInterfaceDecl * getDecl() const
Get the declaration of this interface.
bool isInlineSpecified() const
Determine whether the "inline" keyword was specified for this function.
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 ...
void VisitSizeOfPackExpr(const SizeOfPackExpr *SOPE)
void VisitMemberPointerType(const MemberPointerType *MPT)
NamedDecl * getAliasedNamespace() const
Retrieve the namespace that this alias refers to, which may either be a NamespaceDecl or a NamespaceA...
void VisitDeclarationTemplateArgument(const TemplateArgument &TA)
FunctionType - C99 6.7.5.3 - Function Declarators.
@ SD_Automatic
Automatic storage duration (most local variables).
void VisitWhileStmt(const WhileStmt *WS)
CXXTemporary * getTemporary()
void VisitCXXConstructExpr(const CXXConstructExpr *CE)
@ SuperClass
The receiver is a superclass.
bool isImplicitProperty() const
AccessSpecifier getAccessSpecifierAsWritten() const
Retrieves the access specifier as written in the source code (which may mean that no access specifier...
bool isMacroArgExpansion(SourceLocation Loc, SourceLocation *StartLoc=nullptr) const
Tests whether the given source location represents a macro argument's expansion into the function-lik...
bool containsUnexpandedParameterPack() const
void VisitUnaryOperator(const UnaryOperator *UO)
@ SD_Dynamic
Dynamic storage duration.
const ObjCInterfaceDecl * getClassInterface() const
llvm::APSInt getAsIntegral() const
Retrieve the template argument as an integral value.
void VisitTemplateExpansionTemplateArgument(const TemplateArgument &TA)
bool isSatisfied() const
Whether or not the requires clause is satisfied.
const char * getTraitSpelling(ExpressionTrait T) LLVM_READONLY
Return the spelling of the type trait TT. Never null.
The base class of the type hierarchy.
NamedDecl * getTargetDecl() const
Gets the underlying declaration which has been brought into the local scope.
ObjCPropertyDecl * getExplicitProperty() const
ObjCSubscriptRefExpr - used for array and dictionary subscripting.
ObjCBoolLiteralExpr - Objective-C Boolean Literal.
IdentKind getIdentKind() const
bool hasDefaultArgument() const
Determine whether this template parameter has a default argument.
bool containsErrors() const
Whether this type is an error type.
bool isVirtualAsWritten() const
Whether this function is marked as virtual explicitly.
NamespaceDecl * getOriginalNamespace()
Get the original (first) namespace declaration.
ObjCPropertyRefExpr - A dot-syntax expression to access an ObjC property.
@ EST_DependentNoexcept
noexcept(expression), value-dependent
@ EST_Unevaluated
not evaluated yet, for special member function
bool isThisDeclarationReferenced() const
Whether this declaration was referenced.
void VisitUsingEnumDecl(const UsingEnumDecl *UED)
@ EST_NoexceptTrue
noexcept(expression), evals to 'true'
DeclContext * getLexicalDeclContext()
getLexicalDeclContext - The declaration context where this Decl was lexically declared (LexicalDC).
bool isInline() const
Whether this variable is (C++1z) inline.
bool isParameterPack() const
Determine whether this variable is actually a function parameter pack or init-capture pack.
void VisitTemplateTypeParmDecl(const TemplateTypeParmDecl *D)
void VisitImplicitCastExpr(const ImplicitCastExpr *ICE)
void VisitSYCLUniqueStableNameExpr(const SYCLUniqueStableNameExpr *E)
bool defaultArgumentWasInherited() const
Determines whether the default argument was inherited from a previous declaration of this template.
Represents Objective-C's @catch statement.
UnaryExprOrTypeTraitExpr - expression with either a type or (unevaluated) expression operand.
Represents a type that was referred to using an elaborated type keyword, e.g., struct S,...
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
void VisitPredefinedExpr(const PredefinedExpr *PE)
ObjCSelectorExpr used for @selector in Objective-C.
DeclarationName getName() const
Gets the name looked up.
@ Contravariant
The parameter is contravariant, e.g., X<T> is a subtype of X when the type parameter is covariant and...
Represents a pack expansion of types.
@ SveFixedLengthDataVector
is AArch64 SVE fixed-length data vector
A reference to a name which we were able to look up during parsing but could not resolve to a specifi...
static const char * getStorageClassSpecifierString(StorageClass SC)
Return the string used to specify the storage class SC.
AccessSpecifier getAccess() const
Represents an expression that computes the length of a parameter pack.
void VisitObjCAtCatchStmt(const ObjCAtCatchStmt *OACS)
void VisitCompoundAssignOperator(const CompoundAssignOperator *CAO)
Represents binding an expression to a temporary.
llvm::iterator_range< decls_iterator > decls() const
DeclarationName getMember() const
Retrieve the name of the member that this expression refers to.
Represents a block literal declaration, which is like an unnamed FunctionDecl.
void VisitAutoType(const AutoType *AT)
ObjCImplementationDecl * getImplementation() const
static llvm::json::Object createDefaultConstructorDefinitionData(const CXXRecordDecl *RD)
A builtin binary operation expression such as "x + y" or "x <= y".
This is a basic class for representing single OpenMP clause.
unsigned getIndex() const
void VisitObjCTypeParamDecl(const ObjCTypeParamDecl *D)
protocol_range protocols() const
bool isFromAST() const
Whether this type comes from an AST file.
const IdentifierInfo * getMacroIdentifier() const
void VisitPackExpansionType(const PackExpansionType *PET)
const char * getFilename() const
Return the presumed filename of this location.
static llvm::json::Object createCopyAssignmentDefinitionData(const CXXRecordDecl *RD)
SourceLocation getEnd() const
ArrayRef< TemplateArgumentLoc > template_arguments() const
void VisitCharacterLiteral(const CharacterLiteral *CL)
void VisitObjCCompatibleAliasDecl(const ObjCCompatibleAliasDecl *D)
Represents a GCC generic vector type.
void VisitObjCPropertyImplDecl(const ObjCPropertyImplDecl *D)
ValueDecl * getExtendingDecl()
Get the declaration which triggered the lifetime-extension of this temporary, if any.
Represents a prvalue temporary that is written into memory so that a reference can bind to it.
bool isSpelledAsLValue() const
Represents an array type, per C99 6.7.5.2 - Array Declarators.
ObjCMethodDecl * getSetterMethodDecl() const
static StringRef getOpcodeStr(Opcode Op)
getOpcodeStr - Turn an Opcode enum value into the punctuation char it corresponds to,...
std::string getAsString() const
Retrieve the human-readable string for this name.
LabelDecl * getLabel() const
ArrayRef< CleanupObject > getObjects() const
const T * getAs() const
Member-template getAs<specific type>'.
AccessSpecifier getAccessSpecifier() const
Returns the access specifier for this base specifier.
ArrayRef< QualType > Exceptions
Explicitly-specified list of exception types.
unsigned getNumBases() const
Retrieves the number of base classes of this class.
bool isInvalidDecl() const
llvm::PointerUnion< BlockDecl *, CompoundLiteralExpr * > CleanupObject
The type of objects that are kept in the cleanup.
static llvm::json::Object createMoveAssignmentDefinitionData(const CXXRecordDecl *RD)
AutoTypeKeyword getKeyword() const
Represents a template argument.
void VisitObjCProtocolExpr(const ObjCProtocolExpr *OPE)
ObjCCategoryImplDecl * getImplementation() const
A static requirement that can be used in a requires-expression to check properties of types and expre...
void VisitIntegerLiteral(const IntegerLiteral *IL)
bool isNRVOVariable() const
Determine whether this local variable can be used with the named return value optimization (NRVO).
void Visit(PTR(Stmt) S, ParamTys... P)
void VisitCXXBindTemporaryExpr(const CXXBindTemporaryExpr *BTE)
attr::Kind getKind() const
void VisitObjCInterfaceDecl(const ObjCInterfaceDecl *D)
bool needsOverloadResolutionForMoveConstructor() const
Determine whether we need to eagerly declare a defaulted move constructor for this class.
SplitQualType getSplitDesugaredType() const
ReceiverKind getReceiverKind() const
Determine the kind of receiver that this message is being sent to.
Sugar type that represents a type that was qualified by a qualifier written as a macro invocation.
bool isMessagingSetter() const
True if the property reference will result in a message to the setter.
QualType getUnderlyingType() const
StringRef getBufferName(SourceLocation Loc, bool *Invalid=nullptr) const
Return the filename or buffer identifier of the buffer the location is in.
NonOdrUseReason isNonOdrUse() const
Is this expression a non-odr-use reference, and if so, why? This is only meaningful if the named memb...
bool getSynthesize() const
Represents a C++ destructor within a class.
void VisitIfStmt(const IfStmt *IS)
Represents a C++11 auto or C++14 decltype(auto) type, possibly constrained by a type-constraint.
bool isVirtual() const
Determines whether the base class is a virtual base class (or not).
Location wrapper for a TemplateArgument.
void print(llvm::raw_ostream &OS) const
Prints the full selector name (e.g. "foo:bar:").
@ Class
The receiver is a class.
bool hasInClassInitializer() const
Determine whether this member has a C++11 default member initializer.
void VisitNonTypeTemplateParmDecl(const NonTypeTemplateParmDecl *D)
FriendDecl - Represents the declaration of a friend entity, which can be a function,...
TemplateTemplateParmDecl - Declares a template template parameter, e.g., "T" in.
void VisitExprWithCleanups(const ExprWithCleanups *EWC)
bool isPartOfExplicitCast() const
void VisitMaterializeTemporaryExpr(const MaterializeTemporaryExpr *MTE)
void VisitElaboratedType(const ElaboratedType *ET)
Represents a variable declaration or definition.
const TemplateArgument & getArgument() const
QualType getReturnType() const
QualType getComputationResultType() const
Represents the dependent type named by a dependently-scoped typename using declaration,...
std::string getAsString() const
void VisitObjCEncodeExpr(const ObjCEncodeExpr *OEE)
Represents the declaration of a struct/union/class/enum.
FunctionDecl * getOperatorDelete() const
StringLiteral - This represents a string literal expression, e.g.
@ SD_FullExpression
Full-expression storage duration (for temporaries).
QualType getTypeOperand(ASTContext &Context) const
Retrieves the type operand of this typeid() expression after various required adjustments (removing r...
void VisitTypeAliasDecl(const TypeAliasDecl *TAD)
CXXConstructorDecl * getConstructor() const
Get the constructor that this expression will (ultimately) call.
Represents an expression – generally a full-expression – that introduces cleanups to be run at the en...
ObjCCategoryImplDecl - An object of this class encapsulates a category @implementation declaration.
unsigned getColumn() const
Return the presumed column number of this location.
bool isModulePrivate() const
Whether this declaration was marked as being private to the module in which it was defined.
@ RQ_None
No ref-qualifier was provided.
bool isVariablyModifiedType() const
Whether this type is a variably-modified type (C99 6.7.5).
bool canOverflow() const
Returns true if the unary operator can cause an overflow.
void VisitObjCCategoryDecl(const ObjCCategoryDecl *D)
bool isMemberDataPointer() const
Returns true if the member type (i.e.
Represents a C++ temporary.
void VisitCaseStmt(const CaseStmt *CS)
An instance of this object exists for each enum constant that is defined.
SourceLocation getAttributeLoc() const
void visitVerbatimBlockComment(const comments::VerbatimBlockComment *C, const comments::FullComment *)
bool isScopedUsingClassTag() const
Returns true if this is a C++11 scoped enumeration.
void VisitArrayType(const ArrayType *AT)
ObjCEncodeExpr, used for @encode in Objective-C.
bool isCompleteDefinition() const
Return true if this decl has its body fully specified.
void VisitRecordDecl(const RecordDecl *RD)
NestedNameSpecifier * getQualifier() const
Retrieve the qualification on this type.
@ GenericVector
not a target-specific vector type
void VisitNullPtrTemplateArgument(const TemplateArgument &TA)
bool hadMultipleCandidates() const
Whether the referred constructor was resolved from an overloaded set having size greater than 1.
@ TLS_None
Not a TLS variable.
@ AltiVecPixel
is AltiVec 'vector Pixel'
bool isOriginalNamespace() const
Return true if this declaration is an original (first) declaration of the namespace.
ConstantExpr - An expression that occurs in a constant context and optionally the result of evaluatin...
Declaration of a template type parameter.
An expression that sends a message to the given Objective-C object or class.
void VisitFunctionProtoType(const FunctionProtoType *T)
std::pair< FileID, unsigned > getDecomposedLoc(SourceLocation Loc) const
Decompose the specified location into a raw FileID + Offset pair.
bool isImplicit() const
isImplicit - Indicates whether the declaration was implicitly generated by the implementation.
const ObjCInterfaceDecl * getSuperClass() const
ValueDecl * getMemberDecl() const
Retrieve the member declaration to which this expression refers.
bool isMutable() const
Determines whether this field is mutable (C++ only).
SplitQualType split() const
Divides a QualType into its unqualified type and a set of local qualifiers.
TagDecl * getDecl() const
VectorKind getVectorKind() const
llvm::APInt getValue() const
Represents a C++ using-declaration.
void VisitTemplateSpecializationType(const TemplateSpecializationType *TST)
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....
bool isResultDependent() const
Whether this generic selection is result-dependent.
ObjCCategoryDecl - Represents a category declaration.
StringRef getIdentKindName() const
std::string getValueAsString(unsigned Radix) const
Qualifiers getIndexTypeQualifiers() const
bool wasDeclaredWithTypename() const
Whether this template type parameter was declared with the 'typename' keyword.
@ VK_LValue
An l-value expression is a reference to an object with independent storage.
ArraySizeModifier getSizeModifier() const
CompoundLiteralExpr - [C99 6.5.2.5].
AccessSpecifier
A C++ access specifier (public, private, protected), plus the special value "none" which means differ...
void VisitCXXBoolLiteralExpr(const CXXBoolLiteralExpr *BLE)
virtual SourceRange getSourceRange() const LLVM_READONLY
Source range that this declaration covers.
bool isArgumentType() const
bool isInvalid() const
Return true if this object is invalid or uninitialized.
Represents a C++ using-enum-declaration.
@ ListInit
Direct list-initialization (C++11)
void VisitFixedPointLiteral(const FixedPointLiteral *FPL)
bool defaultArgumentWasInherited() const
Determines whether the default argument was inherited from a previous declaration of this template.
Represents a C++ struct/union/class.
LanguageIDs getLanguage() const
Return the language specified by this linkage specification.
bool getHasRegParm() const
@ EST_Uninstantiated
not instantiated yet
bool isDependentType() const
Whether this type is a dependent type, meaning that its definition somehow depends on a template para...
bool isInstantiationDependentType() const
Determine whether this type is an instantiation-dependent type, meaning that the type involves a temp...
@ VK_PRValue
A pr-value expression (in the C++11 taxonomy) produces a temporary value.
void VisitObjCInterfaceType(const ObjCInterfaceType *OIT)
static StringRef getNameForCallConv(CallingConv CC)
@ AltiVecVector
is AltiVec vector
bool isNegatedConsteval() const
bool needsOverloadResolutionForCopyConstructor() const
Determine whether we need to eagerly declare a defaulted copy constructor for this class.
SourceRange getRange() const
QualType getArgumentType() const
bool isBitField() const
Determines whether this field is a bitfield.
bool isScoped() const
Returns true if this is a C++11 scoped enumeration.
QualType getEncodedType() const
const CXXDestructorDecl * getDestructor() const
Expr * getDefaultArgument() const
Retrieve the default argument, if any.
void VisitVectorType(const VectorType *VT)
void VisitBinaryOperator(const BinaryOperator *BO)
TypedefNameDecl * getDecl() const
static llvm::json::Object createDestructorDefinitionData(const CXXRecordDecl *RD)
CallingConv getCC() const
void Visit(const Attr *A)
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
StorageClass getStorageClass() const
Returns the storage class as written in the source.
bool needsOverloadResolutionForDestructor() const
Determine whether we need to eagerly declare a destructor for this class.
void VisitUsingDirectiveDecl(const UsingDirectiveDecl *UDD)
void VisitUnresolvedUsingType(const UnresolvedUsingType *UUT)
void visitHTMLStartTagComment(const comments::HTMLStartTagComment *C, const comments::FullComment *)
Represents a prototype with parameter type info, e.g.
ObjCProtocolExpr used for protocol expression in Objective-C.
protocol_range protocols() const
const ObjCInterfaceDecl * getClassInterface() const
const clang::PrintingPolicy & getPrintingPolicy() const
const char * getName() const
@ NOUR_None
This is an odr-use.
void VisitUsingShadowDecl(const UsingShadowDecl *USD)
void VisitMemberExpr(const MemberExpr *ME)
Represents a delete expression for memory deallocation and destructor calls, e.g.
bool isNull() const
Return true if this QualType doesn't point to a type yet.
Decl - This represents one declaration (or definition), e.g.
void VisitVarDecl(const VarDecl *VD)
bool isTypeOperand() const
bool isPure() const
Whether this virtual function is pure, i.e.
AddrLabelExpr - The GNU address of label extension, representing &&label.
Represents one property declaration in an Objective-C interface.
void VisitUnresolvedLookupExpr(const UnresolvedLookupExpr *ULE)
bool isInstanceMethod() const
void visitInlineCommandComment(const comments::InlineCommandComment *C, const comments::FullComment *)
APValue::ValueKind getResultAPValueKind() const
void VisitTemplateTemplateArgument(const TemplateArgument &TA)
ObjCCategoryDecl * getCategoryDecl() const
void VisitCXXDeleteExpr(const CXXDeleteExpr *DE)
@ SD_Static
Static storage duration.
unsigned getDepth() const
Get the nesting depth of the template parameter.
@ EST_MSAny
Microsoft throw(...) extension.
ObjCInterfaceDecl * getSuperClass() const
bool isSignedIntegerType() const
Return true if this is an integer type that is signed, according to C99 6.2.5p4 [char,...
ObjCMethodDecl * getBoxingMethod() const
The injected class name of a C++ class template or class template partial specialization.
Represents a C++ member access expression where the actual member referenced could not be resolved be...
TagDecl * getOwnedTagDecl() const
Return the (re)declaration of this type owned by this occurrence of this type, or nullptr if there is...
void Visit(REF(TemplateArgument) TA, ParamTys... P)
Kind getPropertyImplementation() const
CompoundAssignOperator - For compound assignments (e.g.
TypeSourceInfo * getTypeOperandSourceInfo() const
Retrieve source information for the type operand.
@ NOUR_Unevaluated
This name appears in an unevaluated operand.
A class which abstracts out some details necessary for making a call.
A std::pair-like structure for storing a qualified type split into its local qualifiers and its local...
bool isValueDependent() const
Determines whether the value of this expression depends on.
Describes an explicit type conversion that uses functional notion but could not be resolved because o...
@ EST_NoThrow
Microsoft __declspec(nothrow) extension.
void VisitBlockDecl(const BlockDecl *D)
Represents the declaration of a typedef-name via the 'typedef' type specifier.
void VisitObjCSubscriptRefExpr(const ObjCSubscriptRefExpr *OSRE)
@ AltiVecBool
is AltiVec 'vector bool ...'
void VisitTypedefDecl(const TypedefDecl *TD)
ObjCPropertyDecl * getPropertyDecl() const
void VisitFunctionType(const FunctionType *T)
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...
bool isParameterPack() const
Returns whether this is a parameter pack.
A pointer to member type per C++ 8.3.3 - Pointers to members.
const DefArgStorage & getDefaultArgStorage() const
Represents the declaration of an Objective-C type parameter.
bool hasInitStorage() const
True if this SwitchStmt has storage for an init statement.
void visitTParamCommandComment(const comments::TParamCommandComment *C, const comments::FullComment *FC)
ExceptionSpecificationType Type
The kind of exception specification this is.
void VisitAddrLabelExpr(const AddrLabelExpr *ALE)
void VisitLabelStmt(const LabelStmt *LS)
ExceptionSpecInfo ExceptionSpec
Represents the this expression in C++.
ValueDecl * getAsDecl() const
Retrieve the declaration for a declaration non-type template argument.
UnresolvedUsingTypenameDecl * getDecl() const
void VisitConstantExpr(const ConstantExpr *CE)
ObjCMethodDecl - Represents an instance or class method declaration.
[C99 6.4.2.2] - A predefined identifier such as func.
bool hasBraces() const
Determines whether this linkage specification had braces in its syntactic form.
void VisitInitListExpr(const InitListExpr *ILE)
void VisitGotoStmt(const GotoStmt *GS)
bool NE(InterpState &S, CodePtr OpPC)
Selector getSelector() const
@ Instance
The receiver is an object instance.
bool isPackExpansion() const
Determine whether this base specifier is a pack expansion.
UnaryExprOrTypeTrait getKind() const
@ CInit
C-style initialization with assignment.
void print(raw_ostream &OS, const PrintingPolicy &Policy, Qualified Qual=Qualified::AsWritten) const
Print the template name.
@ TLS_Dynamic
TLS with a dynamic initializer.
unsigned getRegParm() const
StringRef getName() const
Return the actual identifier string.
Extra information about a function prototype.
const TemplateArgumentLoc & getDefaultArgument() const
Retrieve the default argument, if any.
unsigned getDepth() const
void VisitCastExpr(const CastExpr *CE)
ObjCMethodDecl * getImplicitPropertyGetter() const
void VisitRValueReferenceType(const ReferenceType *RT)
FieldDecl * getInitializedFieldInUnion()
If this initializes a union, specifies which field in the union to initialize.
static bool isPostfix(Opcode Op)
isPostfix - Return true if this is a postfix operation, like x++.
void VisitGenericSelectionExpr(const GenericSelectionExpr *GSE)
void VisitSwitchStmt(const SwitchStmt *SS)
void visitVerbatimBlockLineComment(const comments::VerbatimBlockLineComment *C, const comments::FullComment *)
bool isParameterPack() const
Whether this parameter is a non-type template parameter pack.
Stmt - This represents one statement.
@ EST_BasicNoexcept
noexcept
ObjCIvarDecl - Represents an ObjC instance variable.
void VisitPackTemplateArgument(const TemplateArgument &TA)
bool isMessagingGetter() const
True if the property reference will result in a message to the getter.
bool isConstexpr() const
Whether this variable is (C++11) constexpr.
void VisitMacroQualifiedType(const MacroQualifiedType *MQT)
Represents a C11 generic selection.
QualType getIntegerType() const
Return the integer type this enum decl corresponds to.
Represents an Objective-C protocol declaration.
void VisitRequiresExpr(const RequiresExpr *RE)
bool isLiteral(TokenKind K)
Return true if this is a "literal" kind, like a numeric constant, string, etc.
Represents a base class of a C++ class.
Attr - This represents one attribute.
A container of type source information.
unsigned getNumTemplateArgs() const
Retrieve the number of template arguments provided as part of this template-id.
DeclarationName getDeclName() const
Get the actual, stored name of the declaration, which may be a special name.
void visitBlockCommandComment(const comments::BlockCommandComment *C, const comments::FullComment *)
const VarDecl * getCatchParamDecl() const
@ ListInit
New-expression has a C++11 list-initializer.
@ RQ_LValue
An lvalue ref-qualifier was provided (&).
@ SD_Thread
Thread storage duration.
void VisitTagType(const TagType *TT)
void VisitObjCCategoryImplDecl(const ObjCCategoryImplDecl *D)
@ NoInit
New-expression has no initializer as written.
void VisitObjCPropertyDecl(const ObjCPropertyDecl *D)
void VisitCXXTypeidExpr(const CXXTypeidExpr *CTE)
#define FIELD2(Name, Flag)
bool isVariadic() const
Whether this function is variadic.
void VisitEnumConstantDecl(const EnumConstantDecl *ECD)
void Visit(const Type *T)
Performs the operation associated with this visitor object.
LabelDecl * getDecl() const
TypeSourceInfo * getTypeSourceInfo()
void VisitCallExpr(const CallExpr *CE)
ImplicitCastExpr - Allows us to explicitly represent implicit type conversions, which have no direct ...
@ kind_nullability
Indicates that the nullability of the type was spelled with a property attribute rather than a type q...
MemberExpr - [C99 6.5.2.3] Structure and Union Members.
void VisitCXXRecordDecl(const CXXRecordDecl *RD)
RecordDecl * getDecl() const
void * getAsOpaquePtr() const
bool isArrow() const
Determine whether this member expression used the '->' operator; otherwise, it used the '.
Base for LValueReferenceType and RValueReferenceType.
RequirementKind getKind() const
SourceLocation getExpansionLoc(SourceLocation Loc) const
Given a SourceLocation object Loc, return the expansion location referenced by the ID.
bool isGlobalDelete() const
unsigned getNumElements() const
void VisitTemplateTemplateParmDecl(const TemplateTemplateParmDecl *D)
bool hasExplicitTemplateArgs() const
Determines whether this member expression actually had a C++ template argument list explicitly specif...
llvm::StringRef getAccessSpelling(AccessSpecifier AS)
void VisitNamespaceAliasDecl(const NamespaceAliasDecl *NAD)
APValue - This class implements a discriminated union of [uninitialized] [APSInt] [APFloat],...
void outputString(raw_ostream &OS) const
static bool isTrivial(ASTContext &Ctx, const Expr *E)
Checks if the expression is constant or does not have non-trivial function calls.
Represents an unpacked "presumed" location which can be presented to the user.
void VisitEnumDecl(const EnumDecl *ED)
const ParmDecl * getInheritedFrom() const
Get the parameter from which we inherit the default argument, if any.
unsigned getSpellingLineNumber(SourceLocation Loc, bool *Invalid=nullptr) const
void VisitConstantArrayType(const ConstantArrayType *CAT)
QualType getClassReceiver() const
Returns the type of a class message send, or NULL if the message is not a class message.
InitializationStyle getInitStyle() const
The style of initialization for this declaration.
Represents the declaration of a typedef-name via a C++11 alias-declaration.
QualType getSuperType() const
Retrieve the type referred to by 'super'.
@ EST_NoexceptFalse
noexcept(expression), evals to 'false'
bool cleanupsHaveSideEffects() const
CXXRecordDecl * getDecl() const
NamedDecl * getConversionFunction() const
If this cast applies a user-defined conversion, retrieve the conversion function that it invokes.
Optional< unsigned > getNumExpansions() const
Retrieve the number of expansions that this pack expansion will generate, if known.
unsigned getExpansionLineNumber(SourceLocation Loc, bool *Invalid=nullptr) const
bool isListInitialization() const
Whether this constructor call was written as list-initialization.
bool isParameterPack() const
bool isArrayFormAsWritten() const
Represents a C++ base or member initializer.
void visitHTMLEndTagComment(const comments::HTMLEndTagComment *C, const comments::FullComment *)
A class which contains all the information about a particular captured value.
void VisitObjCMethodDecl(const ObjCMethodDecl *D)
bool isDeletedAsWritten() const
static const char * getCastKindName(CastKind CK)
ExtProtoInfo getExtProtoInfo() const
ObjCPropertyAttribute::Kind getPropertyAttributes() const
CastExpr - Base class for type casts, including both implicit casts (ImplicitCastExpr) and explicit c...
Represents an extended vector type where either the type or size is dependent.
unsigned getDepth() const
Get the nesting depth of the template parameter.
SourceLocation getLocation() const
Qualifiers Quals
The local qualifiers.
std::string getName(const Decl *D)
A reference to a declared variable, function, enum, etc.
LabelDecl * getLabel() const
Represent a C++ namespace.
Represents a function declaration or definition.
void VisitNullTemplateArgument(const TemplateArgument &TA)
unsigned getDepth() const
Retrieve the depth of the template parameter.
bool capturesCXXThis() const
Represents a struct/union/class.
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
bool getProducesResult() const
StorageClass getStorageClass() const
Returns the storage class as written in the source.
Interfaces are the core concept in Objective-C for object oriented design.
bool isInline() const
Returns true if this is an inline namespace declaration.
Represents a call to a C++ constructor.
ObjCIvarRefExpr - A reference to an ObjC instance variable.
ConstructionKind getConstructionKind() const
Determine whether this constructor is actually constructing a base class (rather than a complete obje...
@ NOUR_Constant
This name appears as a potential result of an lvalue-to-rvalue conversion that is a constant expressi...
void VisitCXXThisExpr(const CXXThisExpr *TE)
const LangOptions & getLangOpts() const
void VisitObjCImplementationDecl(const ObjCImplementationDecl *D)
void VisitFunctionDecl(const FunctionDecl *FD)
NamespaceDecl * getNominatedNamespace()
Returns the namespace nominated by this using-directive.
void VisitStringLiteral(const StringLiteral *SL)
bool isElidable() const
Whether this construction is elidable.
TypeSourceInfo * getFriendType() const
If this friend declaration names an (untemplated but possibly dependent) type, return the type; other...
EnumDecl * getEnumDecl() const
bool hasTemplateKeyword() const
Determines whether the member name was preceded by the template keyword.
bool isStdInitListInitialization() const
Whether this constructor call was written as list-initialization, but was interpreted as forming a st...
QualType getTypeAsWritten() const
Retrieve the type that is being constructed, as specified in the source code.
QualType getAsType() const
Retrieve the type for a type template argument.
@ CallInit
Call-style initialization (C++98)
const char * getDeclKindName() const
bool isParameterPack() const
Whether this template template parameter is a template parameter pack.
DeclContext * getDeclContext()
TemplateName getTemplateName() const
Retrieve the name of the template that we are specializing.
SourceLocation getSpellingLoc(SourceLocation Loc) const
Given a SourceLocation object, return the spelling location referenced by the ID.
StorageClass
Storage classes.
StringRef getName() const
Get the name of identifier for this declaration as a StringRef.
@ DecltypeAuto
decltype(auto)