clang  10.0.0svn
JSONNodeDumper.cpp
Go to the documentation of this file.
2 #include "clang/Lex/Lexer.h"
3 #include "llvm/ADT/StringSwitch.h"
4 
5 using namespace clang;
6 
7 void JSONNodeDumper::addPreviousDeclaration(const Decl *D) {
8  switch (D->getKind()) {
9 #define DECL(DERIVED, BASE) \
10  case Decl::DERIVED: \
11  return writePreviousDeclImpl(cast<DERIVED##Decl>(D));
12 #define ABSTRACT_DECL(DECL)
13 #include "clang/AST/DeclNodes.inc"
14 #undef ABSTRACT_DECL
15 #undef DECL
16  }
17  llvm_unreachable("Decl that isn't part of DeclNodes.inc!");
18 }
19 
20 void JSONNodeDumper::Visit(const Attr *A) {
21  const char *AttrName = nullptr;
22  switch (A->getKind()) {
23 #define ATTR(X) \
24  case attr::X: \
25  AttrName = #X"Attr"; \
26  break;
27 #include "clang/Basic/AttrList.inc"
28 #undef ATTR
29  }
30  JOS.attribute("id", createPointerRepresentation(A));
31  JOS.attribute("kind", AttrName);
32  JOS.attributeObject("range", [A, this] { writeSourceRange(A->getRange()); });
33  attributeOnlyIfTrue("inherited", A->isInherited());
34  attributeOnlyIfTrue("implicit", A->isImplicit());
35 
36  // FIXME: it would be useful for us to output the spelling kind as well as
37  // the actual spelling. This would allow us to distinguish between the
38  // various attribute syntaxes, but we don't currently track that information
39  // within the AST.
40  //JOS.attribute("spelling", A->getSpelling());
41 
43 }
44 
45 void JSONNodeDumper::Visit(const Stmt *S) {
46  if (!S)
47  return;
48 
49  JOS.attribute("id", createPointerRepresentation(S));
50  JOS.attribute("kind", S->getStmtClassName());
51  JOS.attributeObject("range",
52  [S, this] { writeSourceRange(S->getSourceRange()); });
53 
54  if (const auto *E = dyn_cast<Expr>(S)) {
55  JOS.attribute("type", createQualType(E->getType()));
56  const char *Category = nullptr;
57  switch (E->getValueKind()) {
58  case VK_LValue: Category = "lvalue"; break;
59  case VK_XValue: Category = "xvalue"; break;
60  case VK_RValue: Category = "rvalue"; break;
61  }
62  JOS.attribute("valueCategory", Category);
63  }
65 }
66 
67 void JSONNodeDumper::Visit(const Type *T) {
68  JOS.attribute("id", createPointerRepresentation(T));
69 
70  if (!T)
71  return;
72 
73  JOS.attribute("kind", (llvm::Twine(T->getTypeClassName()) + "Type").str());
74  JOS.attribute("type", createQualType(QualType(T, 0), /*Desugar*/ false));
75  attributeOnlyIfTrue("isDependent", T->isDependentType());
76  attributeOnlyIfTrue("isInstantiationDependent",
78  attributeOnlyIfTrue("isVariablyModified", T->isVariablyModifiedType());
79  attributeOnlyIfTrue("containsUnexpandedPack",
81  attributeOnlyIfTrue("isImported", T->isFromAST());
83 }
84 
86  JOS.attribute("id", createPointerRepresentation(T.getAsOpaquePtr()));
87  JOS.attribute("kind", "QualType");
88  JOS.attribute("type", createQualType(T));
89  JOS.attribute("qualifiers", T.split().Quals.getAsString());
90 }
91 
92 void JSONNodeDumper::Visit(const Decl *D) {
93  JOS.attribute("id", createPointerRepresentation(D));
94 
95  if (!D)
96  return;
97 
98  JOS.attribute("kind", (llvm::Twine(D->getDeclKindName()) + "Decl").str());
99  JOS.attributeObject("loc",
100  [D, this] { writeSourceLocation(D->getLocation()); });
101  JOS.attributeObject("range",
102  [D, this] { writeSourceRange(D->getSourceRange()); });
103  attributeOnlyIfTrue("isImplicit", D->isImplicit());
104  attributeOnlyIfTrue("isInvalid", D->isInvalidDecl());
105 
106  if (D->isUsed())
107  JOS.attribute("isUsed", true);
108  else if (D->isThisDeclarationReferenced())
109  JOS.attribute("isReferenced", true);
110 
111  if (const auto *ND = dyn_cast<NamedDecl>(D))
112  attributeOnlyIfTrue("isHidden", ND->isHidden());
113 
114  if (D->getLexicalDeclContext() != D->getDeclContext()) {
115  // Because of multiple inheritance, a DeclContext pointer does not produce
116  // the same pointer representation as a Decl pointer that references the
117  // same AST Node.
118  const auto *ParentDeclContextDecl = dyn_cast<Decl>(D->getDeclContext());
119  JOS.attribute("parentDeclContextId",
120  createPointerRepresentation(ParentDeclContextDecl));
121  }
122 
123  addPreviousDeclaration(D);
125 }
126 
128  const comments::FullComment *FC) {
129  if (!C)
130  return;
131 
132  JOS.attribute("id", createPointerRepresentation(C));
133  JOS.attribute("kind", C->getCommentKindName());
134  JOS.attributeObject("loc",
135  [C, this] { writeSourceLocation(C->getLocation()); });
136  JOS.attributeObject("range",
137  [C, this] { writeSourceRange(C->getSourceRange()); });
138 
140 }
141 
143  const Decl *From, StringRef Label) {
144  JOS.attribute("kind", "TemplateArgument");
145  if (R.isValid())
146  JOS.attributeObject("range", [R, this] { writeSourceRange(R); });
147 
148  if (From)
149  JOS.attribute(Label.empty() ? "fromDecl" : Label, createBareDeclRef(From));
150 
152 }
153 
155  JOS.attribute("kind", "CXXCtorInitializer");
156  if (Init->isAnyMemberInitializer())
157  JOS.attribute("anyInit", createBareDeclRef(Init->getAnyMember()));
158  else if (Init->isBaseInitializer())
159  JOS.attribute("baseInit",
160  createQualType(QualType(Init->getBaseClass(), 0)));
161  else if (Init->isDelegatingInitializer())
162  JOS.attribute("delegatingInit",
163  createQualType(Init->getTypeSourceInfo()->getType()));
164  else
165  llvm_unreachable("Unknown initializer type");
166 }
167 
169 
171  JOS.attribute("kind", "Capture");
172  attributeOnlyIfTrue("byref", C.isByRef());
173  attributeOnlyIfTrue("nested", C.isNested());
174  if (C.getVariable())
175  JOS.attribute("var", createBareDeclRef(C.getVariable()));
176 }
177 
179  JOS.attribute("associationKind", A.getTypeSourceInfo() ? "case" : "default");
180  attributeOnlyIfTrue("selected", A.isSelected());
181 }
182 
183 void JSONNodeDumper::writeBareSourceLocation(SourceLocation Loc,
184  bool IsSpelling) {
185  PresumedLoc Presumed = SM.getPresumedLoc(Loc);
186  unsigned ActualLine = IsSpelling ? SM.getSpellingLineNumber(Loc)
187  : SM.getExpansionLineNumber(Loc);
188  if (Presumed.isValid()) {
189  if (LastLocFilename != Presumed.getFilename()) {
190  JOS.attribute("file", Presumed.getFilename());
191  JOS.attribute("line", ActualLine);
192  } else if (LastLocLine != ActualLine)
193  JOS.attribute("line", ActualLine);
194 
195  unsigned PresumedLine = Presumed.getLine();
196  if (ActualLine != PresumedLine && LastLocPresumedLine != PresumedLine)
197  JOS.attribute("presumedLine", PresumedLine);
198 
199  JOS.attribute("col", Presumed.getColumn());
200  JOS.attribute("tokLen",
201  Lexer::MeasureTokenLength(Loc, SM, Ctx.getLangOpts()));
202  LastLocFilename = Presumed.getFilename();
203  LastLocPresumedLine = PresumedLine;
204  LastLocLine = ActualLine;
205  }
206 }
207 
208 void JSONNodeDumper::writeSourceLocation(SourceLocation Loc) {
209  SourceLocation Spelling = SM.getSpellingLoc(Loc);
210  SourceLocation Expansion = SM.getExpansionLoc(Loc);
211 
212  if (Expansion != Spelling) {
213  // If the expansion and the spelling are different, output subobjects
214  // describing both locations.
215  JOS.attributeObject("spellingLoc", [Spelling, this] {
216  writeBareSourceLocation(Spelling, /*IsSpelling*/ true);
217  });
218  JOS.attributeObject("expansionLoc", [Expansion, Loc, this] {
219  writeBareSourceLocation(Expansion, /*IsSpelling*/ false);
220  // If there is a macro expansion, add extra information if the interesting
221  // bit is the macro arg expansion.
222  if (SM.isMacroArgExpansion(Loc))
223  JOS.attribute("isMacroArgExpansion", true);
224  });
225  } else
226  writeBareSourceLocation(Spelling, /*IsSpelling*/ true);
227 }
228 
229 void JSONNodeDumper::writeSourceRange(SourceRange R) {
230  JOS.attributeObject("begin",
231  [R, this] { writeSourceLocation(R.getBegin()); });
232  JOS.attributeObject("end", [R, this] { writeSourceLocation(R.getEnd()); });
233 }
234 
235 std::string JSONNodeDumper::createPointerRepresentation(const void *Ptr) {
236  // Because JSON stores integer values as signed 64-bit integers, trying to
237  // represent them as such makes for very ugly pointer values in the resulting
238  // output. Instead, we convert the value to hex and treat it as a string.
239  return "0x" + llvm::utohexstr(reinterpret_cast<uint64_t>(Ptr), true);
240 }
241 
242 llvm::json::Object JSONNodeDumper::createQualType(QualType QT, bool Desugar) {
243  SplitQualType SQT = QT.split();
244  llvm::json::Object Ret{{"qualType", QualType::getAsString(SQT, PrintPolicy)}};
245 
246  if (Desugar && !QT.isNull()) {
248  if (DSQT != SQT)
249  Ret["desugaredQualType"] = QualType::getAsString(DSQT, PrintPolicy);
250  if (const auto *TT = QT->getAs<TypedefType>())
251  Ret["typeAliasDeclId"] = createPointerRepresentation(TT->getDecl());
252  }
253  return Ret;
254 }
255 
256 void JSONNodeDumper::writeBareDeclRef(const Decl *D) {
257  JOS.attribute("id", createPointerRepresentation(D));
258  if (!D)
259  return;
260 
261  JOS.attribute("kind", (llvm::Twine(D->getDeclKindName()) + "Decl").str());
262  if (const auto *ND = dyn_cast<NamedDecl>(D))
263  JOS.attribute("name", ND->getDeclName().getAsString());
264  if (const auto *VD = dyn_cast<ValueDecl>(D))
265  JOS.attribute("type", createQualType(VD->getType()));
266 }
267 
268 llvm::json::Object JSONNodeDumper::createBareDeclRef(const Decl *D) {
269  llvm::json::Object Ret{{"id", createPointerRepresentation(D)}};
270  if (!D)
271  return Ret;
272 
273  Ret["kind"] = (llvm::Twine(D->getDeclKindName()) + "Decl").str();
274  if (const auto *ND = dyn_cast<NamedDecl>(D))
275  Ret["name"] = ND->getDeclName().getAsString();
276  if (const auto *VD = dyn_cast<ValueDecl>(D))
277  Ret["type"] = createQualType(VD->getType());
278  return Ret;
279 }
280 
281 llvm::json::Array JSONNodeDumper::createCastPath(const CastExpr *C) {
282  llvm::json::Array Ret;
283  if (C->path_empty())
284  return Ret;
285 
286  for (auto I = C->path_begin(), E = C->path_end(); I != E; ++I) {
287  const CXXBaseSpecifier *Base = *I;
288  const auto *RD =
289  cast<CXXRecordDecl>(Base->getType()->castAs<RecordType>()->getDecl());
290 
291  llvm::json::Object Val{{"name", RD->getName()}};
292  if (Base->isVirtual())
293  Val["isVirtual"] = true;
294  Ret.push_back(std::move(Val));
295  }
296  return Ret;
297 }
298 
299 #define FIELD2(Name, Flag) if (RD->Flag()) Ret[Name] = true
300 #define FIELD1(Flag) FIELD2(#Flag, Flag)
301 
302 static llvm::json::Object
304  llvm::json::Object Ret;
305 
306  FIELD2("exists", hasDefaultConstructor);
307  FIELD2("trivial", hasTrivialDefaultConstructor);
308  FIELD2("nonTrivial", hasNonTrivialDefaultConstructor);
309  FIELD2("userProvided", hasUserProvidedDefaultConstructor);
310  FIELD2("isConstexpr", hasConstexprDefaultConstructor);
311  FIELD2("needsImplicit", needsImplicitDefaultConstructor);
312  FIELD2("defaultedIsConstexpr", defaultedDefaultConstructorIsConstexpr);
313 
314  return Ret;
315 }
316 
317 static llvm::json::Object
319  llvm::json::Object Ret;
320 
321  FIELD2("simple", hasSimpleCopyConstructor);
322  FIELD2("trivial", hasTrivialCopyConstructor);
323  FIELD2("nonTrivial", hasNonTrivialCopyConstructor);
324  FIELD2("userDeclared", hasUserDeclaredCopyConstructor);
325  FIELD2("hasConstParam", hasCopyConstructorWithConstParam);
326  FIELD2("implicitHasConstParam", implicitCopyConstructorHasConstParam);
327  FIELD2("needsImplicit", needsImplicitCopyConstructor);
328  FIELD2("needsOverloadResolution", needsOverloadResolutionForCopyConstructor);
330  FIELD2("defaultedIsDeleted", defaultedCopyConstructorIsDeleted);
331 
332  return Ret;
333 }
334 
335 static llvm::json::Object
337  llvm::json::Object Ret;
338 
339  FIELD2("exists", hasMoveConstructor);
340  FIELD2("simple", hasSimpleMoveConstructor);
341  FIELD2("trivial", hasTrivialMoveConstructor);
342  FIELD2("nonTrivial", hasNonTrivialMoveConstructor);
343  FIELD2("userDeclared", hasUserDeclaredMoveConstructor);
344  FIELD2("needsImplicit", needsImplicitMoveConstructor);
345  FIELD2("needsOverloadResolution", needsOverloadResolutionForMoveConstructor);
347  FIELD2("defaultedIsDeleted", defaultedMoveConstructorIsDeleted);
348 
349  return Ret;
350 }
351 
352 static llvm::json::Object
354  llvm::json::Object Ret;
355 
356  FIELD2("trivial", hasTrivialCopyAssignment);
357  FIELD2("nonTrivial", hasNonTrivialCopyAssignment);
358  FIELD2("hasConstParam", hasCopyAssignmentWithConstParam);
359  FIELD2("implicitHasConstParam", implicitCopyAssignmentHasConstParam);
360  FIELD2("userDeclared", hasUserDeclaredCopyAssignment);
361  FIELD2("needsImplicit", needsImplicitCopyAssignment);
362  FIELD2("needsOverloadResolution", needsOverloadResolutionForCopyAssignment);
363 
364  return Ret;
365 }
366 
367 static llvm::json::Object
369  llvm::json::Object Ret;
370 
371  FIELD2("exists", hasMoveAssignment);
372  FIELD2("simple", hasSimpleMoveAssignment);
373  FIELD2("trivial", hasTrivialMoveAssignment);
374  FIELD2("nonTrivial", hasNonTrivialMoveAssignment);
375  FIELD2("userDeclared", hasUserDeclaredMoveAssignment);
376  FIELD2("needsImplicit", needsImplicitMoveAssignment);
377  FIELD2("needsOverloadResolution", needsOverloadResolutionForMoveAssignment);
378 
379  return Ret;
380 }
381 
382 static llvm::json::Object
384  llvm::json::Object Ret;
385 
386  FIELD2("simple", hasSimpleDestructor);
387  FIELD2("irrelevant", hasIrrelevantDestructor);
388  FIELD2("trivial", hasTrivialDestructor);
389  FIELD2("nonTrivial", hasNonTrivialDestructor);
390  FIELD2("userDeclared", hasUserDeclaredDestructor);
391  FIELD2("needsImplicit", needsImplicitDestructor);
392  FIELD2("needsOverloadResolution", needsOverloadResolutionForDestructor);
394  FIELD2("defaultedIsDeleted", defaultedDestructorIsDeleted);
395 
396  return Ret;
397 }
398 
399 llvm::json::Object
400 JSONNodeDumper::createCXXRecordDefinitionData(const CXXRecordDecl *RD) {
401  llvm::json::Object Ret;
402 
403  // This data is common to all C++ classes.
404  FIELD1(isGenericLambda);
405  FIELD1(isLambda);
406  FIELD1(isEmpty);
407  FIELD1(isAggregate);
408  FIELD1(isStandardLayout);
409  FIELD1(isTriviallyCopyable);
410  FIELD1(isPOD);
411  FIELD1(isTrivial);
412  FIELD1(isPolymorphic);
413  FIELD1(isAbstract);
414  FIELD1(isLiteral);
416  FIELD1(hasUserDeclaredConstructor);
417  FIELD1(hasConstexprNonCopyMoveConstructor);
418  FIELD1(hasMutableFields);
419  FIELD1(hasVariantMembers);
420  FIELD2("canConstDefaultInit", allowConstDefaultInit);
421 
422  Ret["defaultCtor"] = createDefaultConstructorDefinitionData(RD);
423  Ret["copyCtor"] = createCopyConstructorDefinitionData(RD);
424  Ret["moveCtor"] = createMoveConstructorDefinitionData(RD);
425  Ret["copyAssign"] = createCopyAssignmentDefinitionData(RD);
426  Ret["moveAssign"] = createMoveAssignmentDefinitionData(RD);
427  Ret["dtor"] = createDestructorDefinitionData(RD);
428 
429  return Ret;
430 }
431 
432 #undef FIELD1
433 #undef FIELD2
434 
435 std::string JSONNodeDumper::createAccessSpecifier(AccessSpecifier AS) {
436  switch (AS) {
437  case AS_none: return "none";
438  case AS_private: return "private";
439  case AS_protected: return "protected";
440  case AS_public: return "public";
441  }
442  llvm_unreachable("Unknown access specifier");
443 }
444 
445 llvm::json::Object
446 JSONNodeDumper::createCXXBaseSpecifier(const CXXBaseSpecifier &BS) {
447  llvm::json::Object Ret;
448 
449  Ret["type"] = createQualType(BS.getType());
450  Ret["access"] = createAccessSpecifier(BS.getAccessSpecifier());
451  Ret["writtenAccess"] =
452  createAccessSpecifier(BS.getAccessSpecifierAsWritten());
453  if (BS.isVirtual())
454  Ret["isVirtual"] = true;
455  if (BS.isPackExpansion())
456  Ret["isPackExpansion"] = true;
457 
458  return Ret;
459 }
460 
462  JOS.attribute("decl", createBareDeclRef(TT->getDecl()));
463 }
464 
467  attributeOnlyIfTrue("noreturn", E.getNoReturn());
468  attributeOnlyIfTrue("producesResult", E.getProducesResult());
469  if (E.getHasRegParm())
470  JOS.attribute("regParm", E.getRegParm());
471  JOS.attribute("cc", FunctionType::getNameForCallConv(E.getCC()));
472 }
473 
476  attributeOnlyIfTrue("trailingReturn", E.HasTrailingReturn);
477  attributeOnlyIfTrue("const", T->isConst());
478  attributeOnlyIfTrue("volatile", T->isVolatile());
479  attributeOnlyIfTrue("restrict", T->isRestrict());
480  attributeOnlyIfTrue("variadic", E.Variadic);
481  switch (E.RefQualifier) {
482  case RQ_LValue: JOS.attribute("refQualifier", "&"); break;
483  case RQ_RValue: JOS.attribute("refQualifier", "&&"); break;
484  case RQ_None: break;
485  }
486  switch (E.ExceptionSpec.Type) {
487  case EST_DynamicNone:
488  case EST_Dynamic: {
489  JOS.attribute("exceptionSpec", "throw");
490  llvm::json::Array Types;
491  for (QualType QT : E.ExceptionSpec.Exceptions)
492  Types.push_back(createQualType(QT));
493  JOS.attribute("exceptionTypes", std::move(Types));
494  } break;
495  case EST_MSAny:
496  JOS.attribute("exceptionSpec", "throw");
497  JOS.attribute("throwsAny", true);
498  break;
499  case EST_BasicNoexcept:
500  JOS.attribute("exceptionSpec", "noexcept");
501  break;
502  case EST_NoexceptTrue:
503  case EST_NoexceptFalse:
504  JOS.attribute("exceptionSpec", "noexcept");
505  JOS.attribute("conditionEvaluatesTo",
507  //JOS.attributeWithCall("exceptionSpecExpr",
508  // [this, E]() { Visit(E.ExceptionSpec.NoexceptExpr); });
509  break;
510  case EST_NoThrow:
511  JOS.attribute("exceptionSpec", "nothrow");
512  break;
513  // FIXME: I cannot find a way to trigger these cases while dumping the AST. I
514  // suspect you can only run into them when executing an AST dump from within
515  // the debugger, which is not a use case we worry about for the JSON dumping
516  // feature.
518  case EST_Unevaluated:
519  case EST_Uninstantiated:
520  case EST_Unparsed:
521  case EST_None: break;
522  }
524 }
525 
527  attributeOnlyIfTrue("spelledAsLValue", RT->isSpelledAsLValue());
528 }
529 
531  switch (AT->getSizeModifier()) {
532  case ArrayType::Star:
533  JOS.attribute("sizeModifier", "*");
534  break;
535  case ArrayType::Static:
536  JOS.attribute("sizeModifier", "static");
537  break;
538  case ArrayType::Normal:
539  break;
540  }
541 
542  std::string Str = AT->getIndexTypeQualifiers().getAsString();
543  if (!Str.empty())
544  JOS.attribute("indexTypeQualifiers", Str);
545 }
546 
548  // FIXME: this should use ZExt instead of SExt, but JSON doesn't allow a
549  // narrowing conversion to int64_t so it cannot be expressed.
550  JOS.attribute("size", CAT->getSize().getSExtValue());
551  VisitArrayType(CAT);
552 }
553 
555  const DependentSizedExtVectorType *VT) {
556  JOS.attributeObject(
557  "attrLoc", [VT, this] { writeSourceLocation(VT->getAttributeLoc()); });
558 }
559 
561  JOS.attribute("numElements", VT->getNumElements());
562  switch (VT->getVectorKind()) {
564  break;
566  JOS.attribute("vectorKind", "altivec");
567  break;
569  JOS.attribute("vectorKind", "altivec pixel");
570  break;
572  JOS.attribute("vectorKind", "altivec bool");
573  break;
575  JOS.attribute("vectorKind", "neon");
576  break;
578  JOS.attribute("vectorKind", "neon poly");
579  break;
580  }
581 }
582 
584  JOS.attribute("decl", createBareDeclRef(UUT->getDecl()));
585 }
586 
588  switch (UTT->getUTTKind()) {
590  JOS.attribute("transformKind", "underlying_type");
591  break;
592  }
593 }
594 
596  JOS.attribute("decl", createBareDeclRef(TT->getDecl()));
597 }
598 
600  const TemplateTypeParmType *TTPT) {
601  JOS.attribute("depth", TTPT->getDepth());
602  JOS.attribute("index", TTPT->getIndex());
603  attributeOnlyIfTrue("isPack", TTPT->isParameterPack());
604  JOS.attribute("decl", createBareDeclRef(TTPT->getDecl()));
605 }
606 
608  JOS.attribute("undeduced", !AT->isDeduced());
609  switch (AT->getKeyword()) {
611  JOS.attribute("typeKeyword", "auto");
612  break;
614  JOS.attribute("typeKeyword", "decltype(auto)");
615  break;
617  JOS.attribute("typeKeyword", "__auto_type");
618  break;
619  }
620 }
621 
623  const TemplateSpecializationType *TST) {
624  attributeOnlyIfTrue("isAlias", TST->isTypeAlias());
625 
626  std::string Str;
627  llvm::raw_string_ostream OS(Str);
628  TST->getTemplateName().print(OS, PrintPolicy);
629  JOS.attribute("templateName", OS.str());
630 }
631 
633  const InjectedClassNameType *ICNT) {
634  JOS.attribute("decl", createBareDeclRef(ICNT->getDecl()));
635 }
636 
638  JOS.attribute("decl", createBareDeclRef(OIT->getDecl()));
639 }
640 
643  JOS.attribute("numExpansions", *N);
644 }
645 
647  if (const NestedNameSpecifier *NNS = ET->getQualifier()) {
648  std::string Str;
649  llvm::raw_string_ostream OS(Str);
650  NNS->print(OS, PrintPolicy, /*ResolveTemplateArgs*/ true);
651  JOS.attribute("qualifier", OS.str());
652  }
653  if (const TagDecl *TD = ET->getOwnedTagDecl())
654  JOS.attribute("ownedTagDecl", createBareDeclRef(TD));
655 }
656 
658  JOS.attribute("macroName", MQT->getMacroIdentifier()->getName());
659 }
660 
662  attributeOnlyIfTrue("isData", MPT->isMemberDataPointer());
663  attributeOnlyIfTrue("isFunction", MPT->isMemberFunctionPointer());
664 }
665 
667  if (ND && ND->getDeclName())
668  JOS.attribute("name", ND->getNameAsString());
669 }
670 
672  VisitNamedDecl(TD);
673  JOS.attribute("type", createQualType(TD->getUnderlyingType()));
674 }
675 
677  VisitNamedDecl(TAD);
678  JOS.attribute("type", createQualType(TAD->getUnderlyingType()));
679 }
680 
682  VisitNamedDecl(ND);
683  attributeOnlyIfTrue("isInline", ND->isInline());
684  if (!ND->isOriginalNamespace())
685  JOS.attribute("originalNamespace",
686  createBareDeclRef(ND->getOriginalNamespace()));
687 }
688 
690  JOS.attribute("nominatedNamespace",
691  createBareDeclRef(UDD->getNominatedNamespace()));
692 }
693 
695  VisitNamedDecl(NAD);
696  JOS.attribute("aliasedNamespace",
697  createBareDeclRef(NAD->getAliasedNamespace()));
698 }
699 
701  std::string Name;
702  if (const NestedNameSpecifier *NNS = UD->getQualifier()) {
703  llvm::raw_string_ostream SOS(Name);
704  NNS->print(SOS, UD->getASTContext().getPrintingPolicy());
705  }
706  Name += UD->getNameAsString();
707  JOS.attribute("name", Name);
708 }
709 
711  JOS.attribute("target", createBareDeclRef(USD->getTargetDecl()));
712 }
713 
715  VisitNamedDecl(VD);
716  JOS.attribute("type", createQualType(VD->getType()));
717 
718  StorageClass SC = VD->getStorageClass();
719  if (SC != SC_None)
720  JOS.attribute("storageClass", VarDecl::getStorageClassSpecifierString(SC));
721  switch (VD->getTLSKind()) {
722  case VarDecl::TLS_Dynamic: JOS.attribute("tls", "dynamic"); break;
723  case VarDecl::TLS_Static: JOS.attribute("tls", "static"); break;
724  case VarDecl::TLS_None: break;
725  }
726  attributeOnlyIfTrue("nrvo", VD->isNRVOVariable());
727  attributeOnlyIfTrue("inline", VD->isInline());
728  attributeOnlyIfTrue("constexpr", VD->isConstexpr());
729  attributeOnlyIfTrue("modulePrivate", VD->isModulePrivate());
730  if (VD->hasInit()) {
731  switch (VD->getInitStyle()) {
732  case VarDecl::CInit: JOS.attribute("init", "c"); break;
733  case VarDecl::CallInit: JOS.attribute("init", "call"); break;
734  case VarDecl::ListInit: JOS.attribute("init", "list"); break;
735  }
736  }
737  attributeOnlyIfTrue("isParameterPack", VD->isParameterPack());
738 }
739 
741  VisitNamedDecl(FD);
742  JOS.attribute("type", createQualType(FD->getType()));
743  attributeOnlyIfTrue("mutable", FD->isMutable());
744  attributeOnlyIfTrue("modulePrivate", FD->isModulePrivate());
745  attributeOnlyIfTrue("isBitfield", FD->isBitField());
746  attributeOnlyIfTrue("hasInClassInitializer", FD->hasInClassInitializer());
747 }
748 
750  VisitNamedDecl(FD);
751  JOS.attribute("type", createQualType(FD->getType()));
752  StorageClass SC = FD->getStorageClass();
753  if (SC != SC_None)
754  JOS.attribute("storageClass", VarDecl::getStorageClassSpecifierString(SC));
755  attributeOnlyIfTrue("inline", FD->isInlineSpecified());
756  attributeOnlyIfTrue("virtual", FD->isVirtualAsWritten());
757  attributeOnlyIfTrue("pure", FD->isPure());
758  attributeOnlyIfTrue("explicitlyDeleted", FD->isDeletedAsWritten());
759  attributeOnlyIfTrue("constexpr", FD->isConstexpr());
760  attributeOnlyIfTrue("variadic", FD->isVariadic());
761 
762  if (FD->isDefaulted())
763  JOS.attribute("explicitlyDefaulted",
764  FD->isDeleted() ? "deleted" : "default");
765 }
766 
768  VisitNamedDecl(ED);
769  if (ED->isFixed())
770  JOS.attribute("fixedUnderlyingType", createQualType(ED->getIntegerType()));
771  if (ED->isScoped())
772  JOS.attribute("scopedEnumTag",
773  ED->isScopedUsingClassTag() ? "class" : "struct");
774 }
776  VisitNamedDecl(ECD);
777  JOS.attribute("type", createQualType(ECD->getType()));
778 }
779 
781  VisitNamedDecl(RD);
782  JOS.attribute("tagUsed", RD->getKindName());
783  attributeOnlyIfTrue("completeDefinition", RD->isCompleteDefinition());
784 }
786  VisitRecordDecl(RD);
787 
788  // All other information requires a complete definition.
789  if (!RD->isCompleteDefinition())
790  return;
791 
792  JOS.attribute("definitionData", createCXXRecordDefinitionData(RD));
793  if (RD->getNumBases()) {
794  JOS.attributeArray("bases", [this, RD] {
795  for (const auto &Spec : RD->bases())
796  JOS.value(createCXXBaseSpecifier(Spec));
797  });
798  }
799 }
800 
802  VisitNamedDecl(D);
803  JOS.attribute("tagUsed", D->wasDeclaredWithTypename() ? "typename" : "class");
804  JOS.attribute("depth", D->getDepth());
805  JOS.attribute("index", D->getIndex());
806  attributeOnlyIfTrue("isParameterPack", D->isParameterPack());
807 
808  if (D->hasDefaultArgument())
809  JOS.attributeObject("defaultArg", [=] {
810  Visit(D->getDefaultArgument(), SourceRange(),
811  D->getDefaultArgStorage().getInheritedFrom(),
812  D->defaultArgumentWasInherited() ? "inherited from" : "previous");
813  });
814 }
815 
817  const NonTypeTemplateParmDecl *D) {
818  VisitNamedDecl(D);
819  JOS.attribute("type", createQualType(D->getType()));
820  JOS.attribute("depth", D->getDepth());
821  JOS.attribute("index", D->getIndex());
822  attributeOnlyIfTrue("isParameterPack", D->isParameterPack());
823 
824  if (D->hasDefaultArgument())
825  JOS.attributeObject("defaultArg", [=] {
826  Visit(D->getDefaultArgument(), SourceRange(),
827  D->getDefaultArgStorage().getInheritedFrom(),
828  D->defaultArgumentWasInherited() ? "inherited from" : "previous");
829  });
830 }
831 
833  const TemplateTemplateParmDecl *D) {
834  VisitNamedDecl(D);
835  JOS.attribute("depth", D->getDepth());
836  JOS.attribute("index", D->getIndex());
837  attributeOnlyIfTrue("isParameterPack", D->isParameterPack());
838 
839  if (D->hasDefaultArgument())
840  JOS.attributeObject("defaultArg", [=] {
841  Visit(D->getDefaultArgument().getArgument(),
842  D->getDefaultArgStorage().getInheritedFrom()->getSourceRange(),
843  D->getDefaultArgStorage().getInheritedFrom(),
844  D->defaultArgumentWasInherited() ? "inherited from" : "previous");
845  });
846 }
847 
849  StringRef Lang;
850  switch (LSD->getLanguage()) {
851  case LinkageSpecDecl::lang_c: Lang = "C"; break;
852  case LinkageSpecDecl::lang_cxx: Lang = "C++"; break;
854  Lang = "C++11";
855  break;
857  Lang = "C++14";
858  break;
859  }
860  JOS.attribute("language", Lang);
861  attributeOnlyIfTrue("hasBraces", LSD->hasBraces());
862 }
863 
865  JOS.attribute("access", createAccessSpecifier(ASD->getAccess()));
866 }
867 
869  if (const TypeSourceInfo *T = FD->getFriendType())
870  JOS.attribute("type", createQualType(T->getType()));
871 }
872 
874  VisitNamedDecl(D);
875  JOS.attribute("type", createQualType(D->getType()));
876  attributeOnlyIfTrue("synthesized", D->getSynthesize());
877  switch (D->getAccessControl()) {
878  case ObjCIvarDecl::None: JOS.attribute("access", "none"); break;
879  case ObjCIvarDecl::Private: JOS.attribute("access", "private"); break;
880  case ObjCIvarDecl::Protected: JOS.attribute("access", "protected"); break;
881  case ObjCIvarDecl::Public: JOS.attribute("access", "public"); break;
882  case ObjCIvarDecl::Package: JOS.attribute("access", "package"); break;
883  }
884 }
885 
887  VisitNamedDecl(D);
888  JOS.attribute("returnType", createQualType(D->getReturnType()));
889  JOS.attribute("instance", D->isInstanceMethod());
890  attributeOnlyIfTrue("variadic", D->isVariadic());
891 }
892 
894  VisitNamedDecl(D);
895  JOS.attribute("type", createQualType(D->getUnderlyingType()));
896  attributeOnlyIfTrue("bounded", D->hasExplicitBound());
897  switch (D->getVariance()) {
899  break;
901  JOS.attribute("variance", "covariant");
902  break;
904  JOS.attribute("variance", "contravariant");
905  break;
906  }
907 }
908 
910  VisitNamedDecl(D);
911  JOS.attribute("interface", createBareDeclRef(D->getClassInterface()));
912  JOS.attribute("implementation", createBareDeclRef(D->getImplementation()));
913 
914  llvm::json::Array Protocols;
915  for (const auto* P : D->protocols())
916  Protocols.push_back(createBareDeclRef(P));
917  if (!Protocols.empty())
918  JOS.attribute("protocols", std::move(Protocols));
919 }
920 
922  VisitNamedDecl(D);
923  JOS.attribute("interface", createBareDeclRef(D->getClassInterface()));
924  JOS.attribute("categoryDecl", createBareDeclRef(D->getCategoryDecl()));
925 }
926 
928  VisitNamedDecl(D);
929 
930  llvm::json::Array Protocols;
931  for (const auto *P : D->protocols())
932  Protocols.push_back(createBareDeclRef(P));
933  if (!Protocols.empty())
934  JOS.attribute("protocols", std::move(Protocols));
935 }
936 
938  VisitNamedDecl(D);
939  JOS.attribute("super", createBareDeclRef(D->getSuperClass()));
940  JOS.attribute("implementation", createBareDeclRef(D->getImplementation()));
941 
942  llvm::json::Array Protocols;
943  for (const auto* P : D->protocols())
944  Protocols.push_back(createBareDeclRef(P));
945  if (!Protocols.empty())
946  JOS.attribute("protocols", std::move(Protocols));
947 }
948 
950  const ObjCImplementationDecl *D) {
951  VisitNamedDecl(D);
952  JOS.attribute("super", createBareDeclRef(D->getSuperClass()));
953  JOS.attribute("interface", createBareDeclRef(D->getClassInterface()));
954 }
955 
957  const ObjCCompatibleAliasDecl *D) {
958  VisitNamedDecl(D);
959  JOS.attribute("interface", createBareDeclRef(D->getClassInterface()));
960 }
961 
963  VisitNamedDecl(D);
964  JOS.attribute("type", createQualType(D->getType()));
965 
966  switch (D->getPropertyImplementation()) {
967  case ObjCPropertyDecl::None: break;
968  case ObjCPropertyDecl::Required: JOS.attribute("control", "required"); break;
969  case ObjCPropertyDecl::Optional: JOS.attribute("control", "optional"); break;
970  }
971 
973  if (Attrs != ObjCPropertyDecl::OBJC_PR_noattr) {
975  JOS.attribute("getter", createBareDeclRef(D->getGetterMethodDecl()));
977  JOS.attribute("setter", createBareDeclRef(D->getSetterMethodDecl()));
978  attributeOnlyIfTrue("readonly", Attrs & ObjCPropertyDecl::OBJC_PR_readonly);
979  attributeOnlyIfTrue("assign", Attrs & ObjCPropertyDecl::OBJC_PR_assign);
980  attributeOnlyIfTrue("readwrite",
982  attributeOnlyIfTrue("retain", Attrs & ObjCPropertyDecl::OBJC_PR_retain);
983  attributeOnlyIfTrue("copy", Attrs & ObjCPropertyDecl::OBJC_PR_copy);
984  attributeOnlyIfTrue("nonatomic",
986  attributeOnlyIfTrue("atomic", Attrs & ObjCPropertyDecl::OBJC_PR_atomic);
987  attributeOnlyIfTrue("weak", Attrs & ObjCPropertyDecl::OBJC_PR_weak);
988  attributeOnlyIfTrue("strong", Attrs & ObjCPropertyDecl::OBJC_PR_strong);
989  attributeOnlyIfTrue("unsafe_unretained",
991  attributeOnlyIfTrue("class", Attrs & ObjCPropertyDecl::OBJC_PR_class);
992  attributeOnlyIfTrue("nullability",
994  attributeOnlyIfTrue("null_resettable",
996  }
997 }
998 
1001  JOS.attribute("implKind", D->getPropertyImplementation() ==
1003  ? "synthesize"
1004  : "dynamic");
1005  JOS.attribute("propertyDecl", createBareDeclRef(D->getPropertyDecl()));
1006  JOS.attribute("ivarDecl", createBareDeclRef(D->getPropertyIvarDecl()));
1007 }
1008 
1010  attributeOnlyIfTrue("variadic", D->isVariadic());
1011  attributeOnlyIfTrue("capturesThis", D->capturesCXXThis());
1012 }
1013 
1015  JOS.attribute("encodedType", createQualType(OEE->getEncodedType()));
1016 }
1017 
1019  std::string Str;
1020  llvm::raw_string_ostream OS(Str);
1021 
1022  OME->getSelector().print(OS);
1023  JOS.attribute("selector", OS.str());
1024 
1025  switch (OME->getReceiverKind()) {
1027  JOS.attribute("receiverKind", "instance");
1028  break;
1030  JOS.attribute("receiverKind", "class");
1031  JOS.attribute("classType", createQualType(OME->getClassReceiver()));
1032  break;
1034  JOS.attribute("receiverKind", "super (instance)");
1035  JOS.attribute("superType", createQualType(OME->getSuperType()));
1036  break;
1038  JOS.attribute("receiverKind", "super (class)");
1039  JOS.attribute("superType", createQualType(OME->getSuperType()));
1040  break;
1041  }
1042 
1043  QualType CallReturnTy = OME->getCallReturnType(Ctx);
1044  if (OME->getType() != CallReturnTy)
1045  JOS.attribute("callReturnType", createQualType(CallReturnTy));
1046 }
1047 
1049  if (const ObjCMethodDecl *MD = OBE->getBoxingMethod()) {
1050  std::string Str;
1051  llvm::raw_string_ostream OS(Str);
1052 
1053  MD->getSelector().print(OS);
1054  JOS.attribute("selector", OS.str());
1055  }
1056 }
1057 
1059  std::string Str;
1060  llvm::raw_string_ostream OS(Str);
1061 
1062  OSE->getSelector().print(OS);
1063  JOS.attribute("selector", OS.str());
1064 }
1065 
1067  JOS.attribute("protocol", createBareDeclRef(OPE->getProtocol()));
1068 }
1069 
1071  if (OPRE->isImplicitProperty()) {
1072  JOS.attribute("propertyKind", "implicit");
1073  if (const ObjCMethodDecl *MD = OPRE->getImplicitPropertyGetter())
1074  JOS.attribute("getter", createBareDeclRef(MD));
1075  if (const ObjCMethodDecl *MD = OPRE->getImplicitPropertySetter())
1076  JOS.attribute("setter", createBareDeclRef(MD));
1077  } else {
1078  JOS.attribute("propertyKind", "explicit");
1079  JOS.attribute("property", createBareDeclRef(OPRE->getExplicitProperty()));
1080  }
1081 
1082  attributeOnlyIfTrue("isSuperReceiver", OPRE->isSuperReceiver());
1083  attributeOnlyIfTrue("isMessagingGetter", OPRE->isMessagingGetter());
1084  attributeOnlyIfTrue("isMessagingSetter", OPRE->isMessagingSetter());
1085 }
1086 
1088  const ObjCSubscriptRefExpr *OSRE) {
1089  JOS.attribute("subscriptKind",
1090  OSRE->isArraySubscriptRefExpr() ? "array" : "dictionary");
1091 
1092  if (const ObjCMethodDecl *MD = OSRE->getAtIndexMethodDecl())
1093  JOS.attribute("getter", createBareDeclRef(MD));
1094  if (const ObjCMethodDecl *MD = OSRE->setAtIndexMethodDecl())
1095  JOS.attribute("setter", createBareDeclRef(MD));
1096 }
1097 
1099  JOS.attribute("decl", createBareDeclRef(OIRE->getDecl()));
1100  attributeOnlyIfTrue("isFreeIvar", OIRE->isFreeIvar());
1101  JOS.attribute("isArrow", OIRE->isArrow());
1102 }
1103 
1105  JOS.attribute("value", OBLE->getValue() ? "__objc_yes" : "__objc_no");
1106 }
1107 
1109  JOS.attribute("referencedDecl", createBareDeclRef(DRE->getDecl()));
1110  if (DRE->getDecl() != DRE->getFoundDecl())
1111  JOS.attribute("foundReferencedDecl",
1112  createBareDeclRef(DRE->getFoundDecl()));
1113  switch (DRE->isNonOdrUse()) {
1114  case NOUR_None: break;
1115  case NOUR_Unevaluated: JOS.attribute("nonOdrUseReason", "unevaluated"); break;
1116  case NOUR_Constant: JOS.attribute("nonOdrUseReason", "constant"); break;
1117  case NOUR_Discarded: JOS.attribute("nonOdrUseReason", "discarded"); break;
1118  }
1119 }
1120 
1122  JOS.attribute("name", PredefinedExpr::getIdentKindName(PE->getIdentKind()));
1123 }
1124 
1126  JOS.attribute("isPostfix", UO->isPostfix());
1127  JOS.attribute("opcode", UnaryOperator::getOpcodeStr(UO->getOpcode()));
1128  if (!UO->canOverflow())
1129  JOS.attribute("canOverflow", false);
1130 }
1131 
1133  JOS.attribute("opcode", BinaryOperator::getOpcodeStr(BO->getOpcode()));
1134 }
1135 
1137  const CompoundAssignOperator *CAO) {
1138  VisitBinaryOperator(CAO);
1139  JOS.attribute("computeLHSType", createQualType(CAO->getComputationLHSType()));
1140  JOS.attribute("computeResultType",
1141  createQualType(CAO->getComputationResultType()));
1142 }
1143 
1145  // Note, we always write this Boolean field because the information it conveys
1146  // is critical to understanding the AST node.
1147  ValueDecl *VD = ME->getMemberDecl();
1148  JOS.attribute("name", VD && VD->getDeclName() ? VD->getNameAsString() : "");
1149  JOS.attribute("isArrow", ME->isArrow());
1150  JOS.attribute("referencedMemberDecl", createPointerRepresentation(VD));
1151  switch (ME->isNonOdrUse()) {
1152  case NOUR_None: break;
1153  case NOUR_Unevaluated: JOS.attribute("nonOdrUseReason", "unevaluated"); break;
1154  case NOUR_Constant: JOS.attribute("nonOdrUseReason", "constant"); break;
1155  case NOUR_Discarded: JOS.attribute("nonOdrUseReason", "discarded"); break;
1156  }
1157 }
1158 
1160  attributeOnlyIfTrue("isGlobal", NE->isGlobalNew());
1161  attributeOnlyIfTrue("isArray", NE->isArray());
1162  attributeOnlyIfTrue("isPlacement", NE->getNumPlacementArgs() != 0);
1163  switch (NE->getInitializationStyle()) {
1164  case CXXNewExpr::NoInit: break;
1165  case CXXNewExpr::CallInit: JOS.attribute("initStyle", "call"); break;
1166  case CXXNewExpr::ListInit: JOS.attribute("initStyle", "list"); break;
1167  }
1168  if (const FunctionDecl *FD = NE->getOperatorNew())
1169  JOS.attribute("operatorNewDecl", createBareDeclRef(FD));
1170  if (const FunctionDecl *FD = NE->getOperatorDelete())
1171  JOS.attribute("operatorDeleteDecl", createBareDeclRef(FD));
1172 }
1174  attributeOnlyIfTrue("isGlobal", DE->isGlobalDelete());
1175  attributeOnlyIfTrue("isArray", DE->isArrayForm());
1176  attributeOnlyIfTrue("isArrayAsWritten", DE->isArrayFormAsWritten());
1177  if (const FunctionDecl *FD = DE->getOperatorDelete())
1178  JOS.attribute("operatorDeleteDecl", createBareDeclRef(FD));
1179 }
1180 
1182  attributeOnlyIfTrue("implicit", TE->isImplicit());
1183 }
1184 
1186  JOS.attribute("castKind", CE->getCastKindName());
1187  llvm::json::Array Path = createCastPath(CE);
1188  if (!Path.empty())
1189  JOS.attribute("path", std::move(Path));
1190  // FIXME: This may not be useful information as it can be obtusely gleaned
1191  // from the inner[] array.
1192  if (const NamedDecl *ND = CE->getConversionFunction())
1193  JOS.attribute("conversionFunc", createBareDeclRef(ND));
1194 }
1195 
1197  VisitCastExpr(ICE);
1198  attributeOnlyIfTrue("isPartOfExplicitCast", ICE->isPartOfExplicitCast());
1199 }
1200 
1202  attributeOnlyIfTrue("adl", CE->usesADL());
1203 }
1204 
1206  const UnaryExprOrTypeTraitExpr *TTE) {
1207  switch (TTE->getKind()) {
1208  case UETT_SizeOf: JOS.attribute("name", "sizeof"); break;
1209  case UETT_AlignOf: JOS.attribute("name", "alignof"); break;
1210  case UETT_VecStep: JOS.attribute("name", "vec_step"); break;
1211  case UETT_PreferredAlignOf: JOS.attribute("name", "__alignof"); break;
1213  JOS.attribute("name", "__builtin_omp_required_simd_align"); break;
1214  }
1215  if (TTE->isArgumentType())
1216  JOS.attribute("argType", createQualType(TTE->getArgumentType()));
1217 }
1218 
1220  VisitNamedDecl(SOPE->getPack());
1221 }
1222 
1224  const UnresolvedLookupExpr *ULE) {
1225  JOS.attribute("usesADL", ULE->requiresADL());
1226  JOS.attribute("name", ULE->getName().getAsString());
1227 
1228  JOS.attributeArray("lookups", [this, ULE] {
1229  for (const NamedDecl *D : ULE->decls())
1230  JOS.value(createBareDeclRef(D));
1231  });
1232 }
1233 
1235  JOS.attribute("name", ALE->getLabel()->getName());
1236  JOS.attribute("labelDeclId", createPointerRepresentation(ALE->getLabel()));
1237 }
1238 
1240  if (CTE->isTypeOperand()) {
1241  QualType Adjusted = CTE->getTypeOperand(Ctx);
1242  QualType Unadjusted = CTE->getTypeOperandSourceInfo()->getType();
1243  JOS.attribute("typeArg", createQualType(Unadjusted));
1244  if (Adjusted != Unadjusted)
1245  JOS.attribute("adjustedTypeArg", createQualType(Adjusted));
1246  }
1247 }
1248 
1250  if (CE->getResultAPValueKind() != APValue::None) {
1251  std::string Str;
1252  llvm::raw_string_ostream OS(Str);
1253  CE->getAPValueResult().printPretty(OS, Ctx, CE->getType());
1254  JOS.attribute("value", OS.str());
1255  }
1256 }
1257 
1259  if (const FieldDecl *FD = ILE->getInitializedFieldInUnion())
1260  JOS.attribute("field", createBareDeclRef(FD));
1261 }
1262 
1264  const GenericSelectionExpr *GSE) {
1265  attributeOnlyIfTrue("resultDependent", GSE->isResultDependent());
1266 }
1267 
1269  const CXXUnresolvedConstructExpr *UCE) {
1270  if (UCE->getType() != UCE->getTypeAsWritten())
1271  JOS.attribute("typeAsWritten", createQualType(UCE->getTypeAsWritten()));
1272  attributeOnlyIfTrue("list", UCE->isListInitialization());
1273 }
1274 
1276  CXXConstructorDecl *Ctor = CE->getConstructor();
1277  JOS.attribute("ctorType", createQualType(Ctor->getType()));
1278  attributeOnlyIfTrue("elidable", CE->isElidable());
1279  attributeOnlyIfTrue("list", CE->isListInitialization());
1280  attributeOnlyIfTrue("initializer_list", CE->isStdInitListInitialization());
1281  attributeOnlyIfTrue("zeroing", CE->requiresZeroInitialization());
1282  attributeOnlyIfTrue("hadMultipleCandidates", CE->hadMultipleCandidates());
1283 
1284  switch (CE->getConstructionKind()) {
1286  JOS.attribute("constructionKind", "complete");
1287  break;
1289  JOS.attribute("constructionKind", "delegating");
1290  break;
1292  JOS.attribute("constructionKind", "non-virtual base");
1293  break;
1295  JOS.attribute("constructionKind", "virtual base");
1296  break;
1297  }
1298 }
1299 
1301  attributeOnlyIfTrue("cleanupsHaveSideEffects",
1302  EWC->cleanupsHaveSideEffects());
1303  if (EWC->getNumObjects()) {
1304  JOS.attributeArray("cleanups", [this, EWC] {
1305  for (const ExprWithCleanups::CleanupObject &CO : EWC->getObjects())
1306  JOS.value(createBareDeclRef(CO));
1307  });
1308  }
1309 }
1310 
1312  const CXXBindTemporaryExpr *BTE) {
1313  const CXXTemporary *Temp = BTE->getTemporary();
1314  JOS.attribute("temp", createPointerRepresentation(Temp));
1315  if (const CXXDestructorDecl *Dtor = Temp->getDestructor())
1316  JOS.attribute("dtor", createBareDeclRef(Dtor));
1317 }
1318 
1320  const MaterializeTemporaryExpr *MTE) {
1321  if (const ValueDecl *VD = MTE->getExtendingDecl())
1322  JOS.attribute("extendingDecl", createBareDeclRef(VD));
1323 
1324  switch (MTE->getStorageDuration()) {
1325  case SD_Automatic:
1326  JOS.attribute("storageDuration", "automatic");
1327  break;
1328  case SD_Dynamic:
1329  JOS.attribute("storageDuration", "dynamic");
1330  break;
1331  case SD_FullExpression:
1332  JOS.attribute("storageDuration", "full expression");
1333  break;
1334  case SD_Static:
1335  JOS.attribute("storageDuration", "static");
1336  break;
1337  case SD_Thread:
1338  JOS.attribute("storageDuration", "thread");
1339  break;
1340  }
1341 
1342  attributeOnlyIfTrue("boundToLValueRef", MTE->isBoundToLvalueReference());
1343 }
1344 
1346  const CXXDependentScopeMemberExpr *DSME) {
1347  JOS.attribute("isArrow", DSME->isArrow());
1348  JOS.attribute("member", DSME->getMember().getAsString());
1349  attributeOnlyIfTrue("hasTemplateKeyword", DSME->hasTemplateKeyword());
1350  attributeOnlyIfTrue("hasExplicitTemplateArgs",
1351  DSME->hasExplicitTemplateArgs());
1352 
1353  if (DSME->getNumTemplateArgs()) {
1354  JOS.attributeArray("explicitTemplateArgs", [DSME, this] {
1355  for (const TemplateArgumentLoc &TAL : DSME->template_arguments())
1356  JOS.object(
1357  [&TAL, this] { Visit(TAL.getArgument(), TAL.getSourceRange()); });
1358  });
1359  }
1360 }
1361 
1363  JOS.attribute("value",
1364  IL->getValue().toString(
1365  /*Radix=*/10, IL->getType()->isSignedIntegerType()));
1366 }
1368  // FIXME: This should probably print the character literal as a string,
1369  // rather than as a numerical value. It would be nice if the behavior matched
1370  // what we do to print a string literal; right now, it is impossible to tell
1371  // the difference between 'a' and L'a' in C from the JSON output.
1372  JOS.attribute("value", CL->getValue());
1373 }
1375  JOS.attribute("value", FPL->getValueAsString(/*Radix=*/10));
1376 }
1379  FL->getValue().toString(Buffer);
1380  JOS.attribute("value", Buffer);
1381 }
1383  std::string Buffer;
1384  llvm::raw_string_ostream SS(Buffer);
1385  SL->outputString(SS);
1386  JOS.attribute("value", SS.str());
1387 }
1389  JOS.attribute("value", BLE->getValue());
1390 }
1391 
1393  attributeOnlyIfTrue("hasInit", IS->hasInitStorage());
1394  attributeOnlyIfTrue("hasVar", IS->hasVarStorage());
1395  attributeOnlyIfTrue("hasElse", IS->hasElseStorage());
1396  attributeOnlyIfTrue("isConstexpr", IS->isConstexpr());
1397 }
1398 
1400  attributeOnlyIfTrue("hasInit", SS->hasInitStorage());
1401  attributeOnlyIfTrue("hasVar", SS->hasVarStorage());
1402 }
1404  attributeOnlyIfTrue("isGNURange", CS->caseStmtIsGNURange());
1405 }
1406 
1408  JOS.attribute("name", LS->getName());
1409  JOS.attribute("declId", createPointerRepresentation(LS->getDecl()));
1410 }
1412  JOS.attribute("targetLabelDeclId",
1413  createPointerRepresentation(GS->getLabel()));
1414 }
1415 
1417  attributeOnlyIfTrue("hasVar", WS->hasVarStorage());
1418 }
1419 
1421  // FIXME: it would be nice for the ASTNodeTraverser would handle the catch
1422  // parameter the same way for C++ and ObjC rather. In this case, C++ gets a
1423  // null child node and ObjC gets no child node.
1424  attributeOnlyIfTrue("isCatchAll", OACS->getCatchParamDecl() == nullptr);
1425 }
1426 
1428  JOS.attribute("isNull", true);
1429 }
1431  JOS.attribute("type", createQualType(TA.getAsType()));
1432 }
1434  const TemplateArgument &TA) {
1435  JOS.attribute("decl", createBareDeclRef(TA.getAsDecl()));
1436 }
1438  JOS.attribute("isNullptr", true);
1439 }
1441  JOS.attribute("value", TA.getAsIntegral().getSExtValue());
1442 }
1444  // FIXME: cannot just call dump() on the argument, as that doesn't specify
1445  // the output format.
1446 }
1448  const TemplateArgument &TA) {
1449  // FIXME: cannot just call dump() on the argument, as that doesn't specify
1450  // the output format.
1451 }
1453  const TemplateArgument &TA) {
1454  JOS.attribute("isExpr", true);
1455 }
1457  JOS.attribute("isPack", true);
1458 }
1459 
1460 StringRef JSONNodeDumper::getCommentCommandName(unsigned CommandID) const {
1461  if (Traits)
1462  return Traits->getCommandInfo(CommandID)->Name;
1463  if (const comments::CommandInfo *Info =
1465  return Info->Name;
1466  return "<invalid>";
1467 }
1468 
1470  const comments::FullComment *) {
1471  JOS.attribute("text", C->getText());
1472 }
1473 
1476  JOS.attribute("name", getCommentCommandName(C->getCommandID()));
1477 
1478  switch (C->getRenderKind()) {
1480  JOS.attribute("renderKind", "normal");
1481  break;
1483  JOS.attribute("renderKind", "bold");
1484  break;
1486  JOS.attribute("renderKind", "emphasized");
1487  break;
1489  JOS.attribute("renderKind", "monospaced");
1490  break;
1491  }
1492 
1493  llvm::json::Array Args;
1494  for (unsigned I = 0, E = C->getNumArgs(); I < E; ++I)
1495  Args.push_back(C->getArgText(I));
1496 
1497  if (!Args.empty())
1498  JOS.attribute("args", std::move(Args));
1499 }
1500 
1503  JOS.attribute("name", C->getTagName());
1504  attributeOnlyIfTrue("selfClosing", C->isSelfClosing());
1505  attributeOnlyIfTrue("malformed", C->isMalformed());
1506 
1507  llvm::json::Array Attrs;
1508  for (unsigned I = 0, E = C->getNumAttrs(); I < E; ++I)
1509  Attrs.push_back(
1510  {{"name", C->getAttr(I).Name}, {"value", C->getAttr(I).Value}});
1511 
1512  if (!Attrs.empty())
1513  JOS.attribute("attrs", std::move(Attrs));
1514 }
1515 
1518  JOS.attribute("name", C->getTagName());
1519 }
1520 
1523  JOS.attribute("name", getCommentCommandName(C->getCommandID()));
1524 
1525  llvm::json::Array Args;
1526  for (unsigned I = 0, E = C->getNumArgs(); I < E; ++I)
1527  Args.push_back(C->getArgText(I));
1528 
1529  if (!Args.empty())
1530  JOS.attribute("args", std::move(Args));
1531 }
1532 
1535  switch (C->getDirection()) {
1537  JOS.attribute("direction", "in");
1538  break;
1540  JOS.attribute("direction", "out");
1541  break;
1543  JOS.attribute("direction", "in,out");
1544  break;
1545  }
1546  attributeOnlyIfTrue("explicit", C->isDirectionExplicit());
1547 
1548  if (C->hasParamName())
1549  JOS.attribute("param", C->isParamIndexValid() ? C->getParamName(FC)
1550  : C->getParamNameAsWritten());
1551 
1552  if (C->isParamIndexValid() && !C->isVarArgParam())
1553  JOS.attribute("paramIdx", C->getParamIndex());
1554 }
1555 
1558  if (C->hasParamName())
1559  JOS.attribute("param", C->isPositionValid() ? C->getParamName(FC)
1560  : C->getParamNameAsWritten());
1561  if (C->isPositionValid()) {
1562  llvm::json::Array Positions;
1563  for (unsigned I = 0, E = C->getDepth(); I < E; ++I)
1564  Positions.push_back(C->getIndex(I));
1565 
1566  if (!Positions.empty())
1567  JOS.attribute("positions", std::move(Positions));
1568  }
1569 }
1570 
1573  JOS.attribute("name", getCommentCommandName(C->getCommandID()));
1574  JOS.attribute("closeName", C->getCloseName());
1575 }
1576 
1579  const comments::FullComment *) {
1580  JOS.attribute("text", C->getText());
1581 }
1582 
1585  JOS.attribute("text", C->getText());
1586 }
void VisitFieldDecl(const FieldDecl *FD)
void VisitObjCProtocolDecl(const ObjCProtocolDecl *D)
ObjCPropertyRefExpr - A dot-syntax expression to access an ObjC property.
Definition: ExprObjC.h:614
bool isBaseInitializer() const
Determine whether this initializer is initializing a base class.
Definition: DeclCXX.h:2193
The receiver is the instance of the superclass object.
Definition: ExprObjC.h:1107
Represents a type that was referred to using an elaborated type keyword, e.g., struct S...
Definition: Type.h:5205
bool path_empty() const
Definition: Expr.h:3195
NamedDecl * getTargetDecl() const
Gets the underlying declaration which has been brought into the local scope.
Definition: DeclCXX.h:3117
const CXXDestructorDecl * getDestructor() const
Definition: ExprCXX.h:1261
Represents a function declaration or definition.
Definition: Decl.h:1784
NamedDecl * getFoundDecl()
Get the NamedDecl through which this reference occurred.
Definition: Expr.h:1259
bool isVarArgParam() const LLVM_READONLY
Definition: Comment.h:776
bool getValue() const
Definition: ExprObjC.h:97
The receiver is an object instance.
Definition: ExprObjC.h:1101
protocol_range protocols() const
Definition: DeclObjC.h:1365
no exception specification
A class which contains all the information about a particular captured value.
Definition: Decl.h:3957
Represents the dependent type named by a dependently-scoped typename using declaration, e.g.
Definition: Type.h:4160
StringRef getArgText(unsigned Idx) const
Definition: Comment.h:672
A (possibly-)qualified type.
Definition: Type.h:643
Static storage duration.
Definition: Specifiers.h:310
const char * getDeclKindName() const
Definition: DeclBase.cpp:123
base_class_range bases()
Definition: DeclCXX.h:586
void visitParamCommandComment(const comments::ParamCommandComment *C, const comments::FullComment *FC)
ValueDecl * getMemberDecl() const
Retrieve the member declaration to which this expression refers.
Definition: Expr.h:2894
void VisitObjCBoxedExpr(const ObjCBoxedExpr *OBE)
void VisitFloatingLiteral(const FloatingLiteral *FL)
ObjCMethodDecl * getAtIndexMethodDecl() const
Definition: ExprObjC.h:896
void VisitObjCSelectorExpr(const ObjCSelectorExpr *OSE)
ObjCInterfaceDecl * getClassInterface()
Definition: DeclObjC.h:2324
Selector getSelector() const
Definition: ExprObjC.cpp:337
unsigned getNumBases() const
Retrieves the number of base classes of this class.
Definition: DeclCXX.h:580
__auto_type (GNU extension)
ObjCIvarDecl * getPropertyIvarDecl() const
Definition: DeclObjC.h:2826
bool isSuperReceiver() const
Definition: ExprObjC.h:776
void VisitCXXDependentScopeMemberExpr(const CXXDependentScopeMemberExpr *ME)
bool hasVarStorage() const
True if this IfStmt has storage for a variable declaration.
Definition: Stmt.h:1882
bool isListInitialization() const
Determine whether this expression models list-initialization.
Definition: ExprCXX.h:3353
void VisitCXXNewExpr(const CXXNewExpr *NE)
bool isPositionValid() const LLVM_READONLY
Definition: Comment.h:842
void VisitInjectedClassNameType(const InjectedClassNameType *ICNT)
ObjCProtocolDecl * getProtocol() const
Definition: ExprObjC.h:519
Stmt - This represents one statement.
Definition: Stmt.h:66
FunctionType - C99 6.7.5.3 - Function Declarators.
Definition: Type.h:3393
bool isArrayFormAsWritten() const
Definition: ExprCXX.h:2296
IfStmt - This represents an if/then/else.
Definition: Stmt.h:1812
void VisitUsingDecl(const UsingDecl *UD)
ObjCMethodDecl * setAtIndexMethodDecl() const
Definition: ExprObjC.h:900
An instance of this object exists for each enum constant that is defined.
Definition: Decl.h:2855
void VisitObjCIvarRefExpr(const ObjCIvarRefExpr *OIRE)
StorageClass getStorageClass() const
Returns the storage class as written in the source.
Definition: Decl.h:1034
Represents the declaration of a typedef-name via the &#39;typedef&#39; type specifier.
Definition: Decl.h:3087
bool isConstexpr() const
Whether this is a (C++11) constexpr function or constexpr constructor.
Definition: Decl.h:2144
ArrayRef< CleanupObject > getObjects() const
Definition: ExprCXX.h:3241
static llvm::json::Object createCopyConstructorDefinitionData(const CXXRecordDecl *RD)
void VisitNamedDecl(const NamedDecl *ND)
Decl - This represents one declaration (or definition), e.g.
Definition: DeclBase.h:88
bool needsOverloadResolutionForDestructor() const
Determine whether we need to eagerly declare a destructor for this class.
Definition: DeclCXX.h:954
TagDecl * getDecl() const
Definition: Type.cpp:3293
llvm::APFloat getValue() const
Definition: Expr.h:1572
ObjCMethodDecl * getImplicitPropertySetter() const
Definition: ExprObjC.h:717
void VisitUnaryTransformType(const UnaryTransformType *UTT)
FunctionDecl * getOperatorNew() const
Definition: ExprCXX.h:2127
bool isVirtual() const
Determines whether the base class is a virtual base class (or not).
Definition: DeclCXX.h:200
A reference to a name which we were able to look up during parsing but could not resolve to a specifi...
Definition: ExprCXX.h:2946
Opcode getOpcode() const
Definition: Expr.h:3444
SourceLocation getLocation() const LLVM_READONLY
Definition: Comment.h:221
Represents a C++11 auto or C++14 decltype(auto) type.
Definition: Type.h:4823
void VisitObjCPropertyRefExpr(const ObjCPropertyRefExpr *OPRE)
The base class of the type hierarchy.
Definition: Type.h:1436
bool requiresZeroInitialization() const
Whether this construction first requires zero-initialization before the initializer is called...
Definition: ExprCXX.h:1442
The parameter is covariant, e.g., X<T> is a subtype of X<U> when the type parameter is covariant and ...
void VisitTypedefType(const TypedefType *TT)
Represents an array type, per C99 6.7.5.2 - Array Declarators.
Definition: Type.h:2860
Represent a C++ namespace.
Definition: Decl.h:522
Represents a call to a C++ constructor.
Definition: ExprCXX.h:1331
ObjCSubscriptRefExpr - used for array and dictionary subscripting.
Definition: ExprObjC.h:845
void Visit(const Type *T)
Performs the operation associated with this visitor object.
Definition: TypeVisitor.h:68
void VisitObjCMessageExpr(const ObjCMessageExpr *OME)
AccessSpecifier
A C++ access specifier (public, private, protected), plus the special value "none" which means differ...
Definition: Specifiers.h:113
StringRef getParamName(const FullComment *FC) const
Definition: Comment.cpp:371
A container of type source information.
Definition: Decl.h:86
void VisitDependentSizedExtVectorType(const DependentSizedExtVectorType *VT)
bool hasVarStorage() const
True if this SwitchStmt has storage for a condition variable.
Definition: Stmt.h:2075
IdentKind getIdentKind() const
Definition: Expr.h:1926
void VisitMemberPointerType(const MemberPointerType *MPT)
void visitTextComment(const comments::TextComment *C, const comments::FullComment *)
TemplateTypeParmDecl * getDecl() const
Definition: Type.h:4643
Represents a C++ constructor within a class.
Definition: DeclCXX.h:2352
void VisitWhileStmt(const WhileStmt *WS)
Represents a prvalue temporary that is written into memory so that a reference can bind to it...
Definition: ExprCXX.h:4328
void VisitTemplateTypeParmType(const TemplateTypeParmType *TTPT)
bool isVirtualAsWritten() const
Whether this function is marked as virtual explicitly.
Definition: Decl.h:2050
bool needsOverloadResolutionForCopyConstructor() const
Determine whether we need to eagerly declare a defaulted copy constructor for this class...
Definition: DeclCXX.h:771
bool hasInClassInitializer() const
Determine whether this member has a C++11 default member initializer.
Definition: Decl.h:2783
This name appears in an unevaluated operand.
Definition: Specifiers.h:164
bool isCompleteDefinition() const
Return true if this decl has its body fully specified.
Definition: Decl.h:3238
void VisitUnaryExprOrTypeTraitExpr(const UnaryExprOrTypeTraitExpr *TTE)
void VisitDeclRefExpr(const DeclRefExpr *DRE)
unsigned getDepth() const
Get the nesting depth of the template parameter.
void VisitTypeTemplateArgument(const TemplateArgument &TA)
FriendDecl - Represents the declaration of a friend entity, which can be a function, a type, or a templated function or type.
Definition: DeclFriend.h:53
void VisitIntegralTemplateArgument(const TemplateArgument &TA)
Represents a variable declaration or definition.
Definition: Decl.h:827
StringRef getArgText(unsigned Idx) const
Definition: Comment.h:360
bool isFixed() const
Returns true if this is an Objective-C, C++11, or Microsoft-style enumeration with a fixed underlying...
Definition: Decl.h:3598
const T * getAs() const
Member-template getAs<specific type>&#39;.
Definition: Type.h:6858
ObjCCategoryImplDecl * getImplementation() const
Definition: DeclObjC.cpp:2019
bool hasDefaultArgument() const
Determine whether this template parameter has a default argument.
Extra information about a function prototype.
Definition: Type.h:3805
ObjCMethodDecl - Represents an instance or class method declaration.
Definition: DeclObjC.h:138
static llvm::json::Object createMoveConstructorDefinitionData(const CXXRecordDecl *RD)
bool hasInitStorage() const
True if this SwitchStmt has storage for an init statement.
Definition: Stmt.h:2072
DeclarationName getName() const
Gets the name looked up.
Definition: ExprCXX.h:2862
bool isConst() const
Definition: Type.h:3668
const char * getName() const
Definition: Stmt.cpp:351
bool isInvalidDecl() const
Definition: DeclBase.h:553
unsigned getNumPlacementArgs() const
Definition: ExprCXX.h:2145
bool requiresADL() const
True if this declaration should be extended by argument-dependent lookup.
Definition: ExprCXX.h:3014
Not a TLS variable.
Definition: Decl.h:844
unsigned getIndex(unsigned Depth) const
Definition: Comment.h:851
protocol_range protocols() const
Definition: DeclObjC.h:2128
Represents an expression – generally a full-expression – that introduces cleanups to be run at the ...
Definition: ExprCXX.h:3215
noexcept(expression), value-dependent
void VisitObjCIvarDecl(const ObjCIvarDecl *D)
const ObjCInterfaceDecl * getSuperClass() const
Definition: DeclObjC.h:2688
ObjCPropertyDecl * getExplicitProperty() const
Definition: ExprObjC.h:707
void VisitCXXConstructExpr(const CXXConstructExpr *CE)
Information about a single command.
const char * getStmtClassName() const
Definition: Stmt.cpp:75
SourceLocation getAttributeLoc() const
Definition: Type.h:3183
LabelStmt - Represents a label, which has a substatement.
Definition: Stmt.h:1710
Represents a struct/union/class.
Definition: Decl.h:3662
LanguageIDs getLanguage() const
Return the language specified by this linkage specification.
Definition: DeclCXX.h:2776
DeclarationName getDeclName() const
Get the actual, stored name of the declaration, which may be a special name.
Definition: Decl.h:297
TypeSourceInfo * getFriendType() const
If this friend declaration names an (untemplated but possibly dependent) type, return the type; other...
Definition: DeclFriend.h:123
unsigned getDepth() const
Retrieve the depth of the template parameter.
void print(raw_ostream &OS, const PrintingPolicy &Policy, bool SuppressNNS=false) const
Print the template name.
bool cleanupsHaveSideEffects() const
Definition: ExprCXX.h:3253
QualType getComputationResultType() const
Definition: Expr.h:3655
unsigned getRegParm() const
Definition: Type.h:3556
bool isImplicit() const
Returns true if the attribute has been implicitly created instead of explicitly written by the user...
Definition: Attr.h:98
bool isInline() const
Returns true if this is an inline namespace declaration.
Definition: Decl.h:583
is ARM Neon vector
Definition: Type.h:3222
RenderKind getRenderKind() const
Definition: Comment.h:352
void VisitNamespaceDecl(const NamespaceDecl *ND)
Used for GCC&#39;s __alignof.
Definition: TypeTraits.h:106
The parameter is contravariant, e.g., X<T> is a subtype of X<U> when the type parameter is covariant ...
bool isSpelledAsLValue() const
Definition: Type.h:2737
Represents a member of a struct/union/class.
Definition: Decl.h:2643
TemplateName getTemplateName() const
Retrieve the name of the template that we are specializing.
Definition: Type.h:4980
TypeSourceInfo * getTypeSourceInfo() const
Returns the declarator information for a base class or delegating initializer.
Definition: DeclCXX.h:2254
StringRef getText() const LLVM_READONLY
Definition: Comment.h:883
const IdentifierInfo * getMacroIdentifier() const
Definition: Type.h:4234
void VisitDeclarationTemplateArgument(const TemplateArgument &TA)
ObjCMethodDecl * getSetterMethodDecl() const
Definition: DeclObjC.h:924
virtual SourceRange getSourceRange() const LLVM_READONLY
Source range that this declaration covers.
Definition: DeclBase.h:417
void VisitFriendDecl(const FriendDecl *FD)
TagDecl * getOwnedTagDecl() const
Return the (re)declaration of this type owned by this occurrence of this type, or nullptr if there is...
Definition: Type.h:5255
int Category
Definition: Format.cpp:1810
Represents an access specifier followed by colon &#39;:&#39;.
Definition: DeclCXX.h:87
void VisitCXXUnresolvedConstructExpr(const CXXUnresolvedConstructExpr *UCE)
void VisitObjCCompatibleAliasDecl(const ObjCCompatibleAliasDecl *D)
An r-value expression (a pr-value in the C++11 taxonomy) produces a temporary value.
Definition: Specifiers.h:125
Selector getSelector() const
Definition: ExprObjC.h:467
void VisitUnaryOperator(const UnaryOperator *UO)
void VisitExpressionTemplateArgument(const TemplateArgument &TA)
Represents Objective-C&#39;s @catch statement.
Definition: StmtObjC.h:77
void VisitAccessSpecDecl(const AccessSpecDecl *ASD)
bool getProducesResult() const
Definition: Type.h:3551
StringRef getOpcodeStr() const
Definition: Expr.h:3465
A command with word-like arguments that is considered inline content.
Definition: Comment.h:298
Describes an C or C++ initializer list.
Definition: Expr.h:4375
A C++ typeid expression (C++ [expr.typeid]), which gets the type_info that corresponds to the supplie...
Definition: ExprCXX.h:673
Represents a C++ using-declaration.
Definition: DeclCXX.h:3262
bool isArrow() const
Definition: ExprObjC.h:584
static llvm::json::Object createMoveAssignmentDefinitionData(const CXXRecordDecl *RD)
UnresolvedUsingTypenameDecl * getDecl() const
Definition: Type.h:4171
AssociationTy< true > ConstAssociation
Definition: Expr.h:5366
bool isBitField() const
Determines whether this field is a bitfield.
Definition: Decl.h:2721
void VisitSizeOfPackExpr(const SizeOfPackExpr *SOPE)
An lvalue ref-qualifier was provided (&).
Definition: Type.h:1392
A line of text contained in a verbatim block.
Definition: Comment.h:863
bool isMessagingSetter() const
True if the property reference will result in a message to the setter.
Definition: ExprObjC.h:744
FunctionDecl * getOperatorDelete() const
Definition: ExprCXX.h:2308
void VisitTemplateTypeParmDecl(const TemplateTypeParmDecl *D)
bool isElidable() const
Whether this construction is elidable.
Definition: ExprCXX.h:1409
void VisitCharacterLiteral(const CharacterLiteral *CL)
bool isGlobalNew() const
Definition: ExprCXX.h:2168
Microsoft throw(...) extension.
A verbatim line command.
Definition: Comment.h:943
AccessSpecifier getAccessSpecifier() const
Returns the access specifier for this base specifier.
Definition: DeclCXX.h:227
LabelDecl * getDecl() const
Definition: Stmt.h:1727
void VisitObjCTypeParamDecl(const ObjCTypeParamDecl *D)
An x-value expression is a reference to an object with independent storage but which can be "moved"...
Definition: Specifiers.h:134
bool isTypeAlias() const
Determine if this template specialization type is for a type alias template that has been substituted...
Definition: Type.h:4965
path_iterator path_begin()
Definition: Expr.h:3197
SourceLocation getExpansionLoc(SourceLocation Loc) const
Given a SourceLocation object Loc, return the expansion location referenced by the ID...
PropertyAttributeKind getPropertyAttributes() const
Definition: DeclObjC.h:839
Sugar type that represents a type that was qualified by a qualifier written as a macro invocation...
Definition: Type.h:4216
const clang::PrintingPolicy & getPrintingPolicy() const
Definition: ASTContext.h:670
bool isByRef() const
Whether this is a "by ref" capture, i.e.
Definition: Decl.h:3982
bool containsUnexpandedParameterPack() const
Whether this type is or contains an unexpanded parameter pack, used to support C++0x variadic templat...
Definition: Type.h:1871
void VisitObjCAtCatchStmt(const ObjCAtCatchStmt *OACS)
unsigned getNumTemplateArgs() const
Retrieve the number of template arguments provided as part of this template-id.
Definition: ExprCXX.h:3622
A builtin binary operation expression such as "x + y" or "x <= y".
Definition: Expr.h:3409
static bool isPostfix(Opcode Op)
isPostfix - Return true if this is a postfix operation, like x++.
Definition: Expr.h:2068
Any part of the comment.
Definition: Comment.h:52
unsigned getSpellingLineNumber(SourceLocation Loc, bool *Invalid=nullptr) const
bool hasElseStorage() const
True if this IfStmt has storage for an else statement.
Definition: Stmt.h:1885
CXXRecordDecl * getDecl() const
Definition: Type.cpp:3383
bool isArrow() const
Definition: Expr.h:2995
bool isConstexpr() const
Whether this variable is (C++11) constexpr.
Definition: Decl.h:1417
void VisitImplicitCastExpr(const ImplicitCastExpr *ICE)
New-expression has a C++98 paren-delimited initializer.
Definition: ExprCXX.h:2066
void VisitIntegerLiteral(const IntegerLiteral *IL)
void VisitObjCPropertyImplDecl(const ObjCPropertyImplDecl *D)
void VisitAutoType(const AutoType *AT)
CaseStmt - Represent a case statement.
Definition: Stmt.h:1478
void VisitPredefinedExpr(const PredefinedExpr *PE)
unsigned getIndex() const
Get the index of the template parameter within its parameter list.
bool isAnyMemberInitializer() const
Definition: DeclCXX.h:2201
CastExpr - Base class for type casts, including both implicit casts (ImplicitCastExpr) and explicit c...
Definition: Expr.h:3125
bool hasDefaultArgument() const
Determine whether this template parameter has a default argument.
Represents an Objective-C protocol declaration.
Definition: DeclObjC.h:2063
unsigned getParamIndex() const LLVM_READONLY
Definition: Comment.h:785
Represents binding an expression to a temporary.
Definition: ExprCXX.h:1282
DeclContext * getLexicalDeclContext()
getLexicalDeclContext - The declaration context where this Decl was lexically declared (LexicalDC)...
Definition: DeclBase.h:828
SourceLocation getSpellingLoc(SourceLocation Loc) const
Given a SourceLocation object, return the spelling location referenced by the ID. ...
CXXTemporary * getTemporary()
Definition: ExprCXX.h:1301
FieldDecl * getAnyMember() const
Definition: DeclCXX.h:2266
void VisitTemplateExpansionTemplateArgument(const TemplateArgument &TA)
PropertyControl getPropertyImplementation() const
Definition: DeclObjC.h:932
void * getAsOpaquePtr() const
Definition: Type.h:688
bool hasExplicitBound() const
Whether this type parameter has an explicitly-written type bound, e.g., "T : NSView".
Definition: DeclObjC.h:618
Represents a C++ member access expression where the actual member referenced could not be resolved be...
Definition: ExprCXX.h:3420
Represents an ObjC class declaration.
Definition: DeclObjC.h:1171
This is an odr-use.
Definition: Specifiers.h:162
Represents a linkage specification.
Definition: DeclCXX.h:2740
QualType getReturnType() const
Definition: DeclObjC.h:322
bool getNoReturn() const
Definition: Type.h:3550
void VisitIfStmt(const IfStmt *IS)
is ARM Neon polynomial vector
Definition: Type.h:3225
bool isParameterPack() const
Whether this template template parameter is a template parameter pack.
SplitQualType getSplitDesugaredType() const
Definition: Type.h:947
void VisitTypeAliasDecl(const TypeAliasDecl *TAD)
Represents an extended vector type where either the type or size is dependent.
Definition: Type.h:3166
Represents the this expression in C++.
Definition: ExprCXX.h:1006
ObjCIvarDecl * getDecl()
Definition: ExprObjC.h:576
New-expression has no initializer as written.
Definition: ExprCXX.h:2063
bool isArrayForm() const
Definition: ExprCXX.h:2295
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...
ObjCPropertyImplDecl - Represents implementation declaration of a property in a class or category imp...
Definition: DeclObjC.h:2758
A verbatim block command (e.
Definition: Comment.h:891
bool hasBraces() const
Determines whether this linkage specification had braces in its syntactic form.
Definition: DeclCXX.h:2785
void VisitPackExpansionType(const PackExpansionType *PET)
const ValueDecl * getExtendingDecl() const
Get the declaration which triggered the lifetime-extension of this temporary, if any.
Definition: ExprCXX.h:4388
StringRef getText() const LLVM_READONLY
Definition: Comment.h:282
bool isStdInitListInitialization() const
Whether this constructor call was written as list-initialization, but was interpreted as forming a st...
Definition: ExprCXX.h:1433
Represents the declaration of a typedef-name via a C++11 alias-declaration.
Definition: Decl.h:3107
void VisitArrayType(const ArrayType *AT)
Represents a prototype with parameter type info, e.g.
Definition: Type.h:3725
void VisitRecordDecl(const RecordDecl *RD)
CXXConstructorDecl * getConstructor() const
Get the constructor that this expression will (ultimately) call.
Definition: ExprCXX.h:1403
QualType getComputationLHSType() const
Definition: Expr.h:3652
void VisitCXXBindTemporaryExpr(const CXXBindTemporaryExpr *BTE)
bool isDelegatingInitializer() const
Determine whether this initializer is creating a delegating constructor.
Definition: DeclCXX.h:2221
UnaryExprOrTypeTraitExpr - expression with either a type or (unevaluated) expression operand...
Definition: Expr.h:2347
bool isParameterPack() const
Whether this parameter is a non-type template parameter pack.
bool isConstexpr() const
Definition: Stmt.h:1985
ConstantExpr - An expression that occurs in a constant context and optionally the result of evaluatin...
Definition: Expr.h:953
ValueDecl * getAsDecl() const
Retrieve the declaration for a declaration non-type template argument.
Definition: TemplateBase.h:263
void outputString(raw_ostream &OS) const
Definition: Expr.cpp:1103
void VisitNullPtrTemplateArgument(const TemplateArgument &TA)
void VisitExprWithCleanups(const ExprWithCleanups *EWC)
unsigned getValue() const
Definition: Expr.h:1539
ObjCMethodDecl * getBoxingMethod() const
Definition: ExprObjC.h:145
bool isValid() const
void VisitCompoundAssignOperator(const CompoundAssignOperator *CAO)
void VisitObjCInterfaceDecl(const ObjCInterfaceDecl *D)
bool isInlineSpecified() const
Determine whether the "inline" keyword was specified for this function.
Definition: Decl.h:2413
void visitVerbatimBlockComment(const comments::VerbatimBlockComment *C, const comments::FullComment *)
Represents a block literal declaration, which is like an unnamed FunctionDecl.
Definition: Decl.h:3951
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
Definition: Decl.h:644
StringRef getKindName() const
Definition: Decl.h:3308
void VisitCaseStmt(const CaseStmt *CS)
bool isVariadic() const
Whether this function is variadic.
Definition: Decl.cpp:2805
bool isDefaulted() const
Whether this function is defaulted per C++0x.
Definition: Decl.h:2084
std::string Label
bool isScopedUsingClassTag() const
Returns true if this is a C++11 scoped enumeration.
Definition: Decl.h:3592
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 ...
Definition: Lexer.cpp:444
Declaration of a template type parameter.
unsigned getIndex() const
Definition: Type.h:4640
bool getHasRegParm() const
Definition: Type.h:3554
const T * castAs() const
Member-template castAs<specific type>.
Definition: Type.h:6923
NonOdrUseReason isNonOdrUse() const
Is this expression a non-odr-use reference, and if so, why? This is only meaningful if the named memb...
Definition: Expr.h:3035
unsigned getLine() const
Return the presumed line number of this location.
This name appears as a potential result of an lvalue-to-rvalue conversion that is a constant expressi...
Definition: Specifiers.h:167
Represents a C++ destructor within a class.
Definition: DeclCXX.h:2616
New-expression has a C++11 list-initializer.
Definition: ExprCXX.h:2069
std::string getAsString() const
Retrieve the human-readable string for this name.
bool isImplicit() const
isImplicit - Indicates whether the declaration was implicitly generated by the implementation.
Definition: DeclBase.h:558
const char * getTypeClassName() const
Definition: Type.cpp:2754
void VisitFunctionProtoType(const FunctionProtoType *T)
QualType getArgumentType() const
Definition: Expr.h:2384
A command that has zero or more word-like arguments (number of word-like arguments depends on command...
Definition: Comment.h:596
DeclContext * getDeclContext()
Definition: DeclBase.h:438
ObjCSelectorExpr used for @selector in Objective-C.
Definition: ExprObjC.h:454
ObjCInterfaceDecl * getSuperClass() const
Definition: DeclObjC.cpp:337
TLSKind getTLSKind() const
Definition: Decl.cpp:1981
Represents an expression that computes the length of a parameter pack.
Definition: ExprCXX.h:4000
StorageClass getStorageClass() const
Returns the storage class as written in the source.
Definition: Decl.h:2402
NonTypeTemplateParmDecl - Declares a non-type template parameter, e.g., "Size" in.
static llvm::json::Object createDestructorDefinitionData(const CXXRecordDecl *RD)
void VisitElaboratedType(const ElaboratedType *ET)
A std::pair-like structure for storing a qualified type split into its local qualifiers and its local...
Definition: Type.h:582
bool isSignedIntegerType() const
Return true if this is an integer type that is signed, according to C99 6.2.5p4 [char, signed char, short, int, long..], or an enum decl which has a signed representation.
Definition: Type.cpp:1931
void VisitObjCProtocolExpr(const ObjCProtocolExpr *OPE)
void print(llvm::raw_ostream &OS) const
Prints the full selector name (e.g. "foo:bar:").
QualType getType() const
Definition: Expr.h:137
void VisitTemplateSpecializationType(const TemplateSpecializationType *TST)
StorageClass
Storage classes.
Definition: Specifiers.h:235
void VisitMaterializeTemporaryExpr(const MaterializeTemporaryExpr *MTE)
A unary type transform, which is a type constructed from another.
Definition: Type.h:4363
void VisitBinaryOperator(const BinaryOperator *BO)
Direct list-initialization (C++11)
Definition: Decl.h:838
Qualifiers Quals
The local qualifiers.
Definition: Type.h:587
bool isDirectionExplicit() const LLVM_READONLY
Definition: Comment.h:749
LabelDecl * getLabel() const
Definition: Stmt.h:2468
StorageDuration getStorageDuration() const
Retrieve the storage duration for the materialized temporary.
Definition: ExprCXX.h:4369
QualType getEncodedType() const
Definition: ExprObjC.h:428
An expression that sends a message to the given Objective-C object or class.
Definition: ExprObjC.h:950
Represents an unpacked "presumed" location which can be presented to the user.
ObjCMethodDecl * getImplicitPropertyGetter() const
Definition: ExprObjC.h:712
SourceLocation getEnd() const
UnaryOperator - This represents the unary-expression&#39;s (except sizeof and alignof), the postinc/postdec operators from postfix-expression, and various extensions.
Definition: Expr.h:2021
bool isInstanceMethod() const
Definition: DeclObjC.h:421
Represents a GCC generic vector type.
Definition: Type.h:3206
An opening HTML tag with attributes.
Definition: Comment.h:413
ReceiverKind getReceiverKind() const
Determine the kind of receiver that this message is being sent to.
Definition: ExprObjC.h:1234
ArraySizeModifier getSizeModifier() const
Definition: Type.h:2883
QualType getTypeOperand(ASTContext &Context) const
Retrieves the type operand of this typeid() expression after various required adjustments (removing r...
Definition: ExprCXX.cpp:76
QualType getCallReturnType(ASTContext &Ctx) const
Definition: ExprObjC.cpp:296
TemplateTemplateParmDecl - Declares a template template parameter, e.g., "T" in.
UTTKind getUTTKind() const
Definition: Type.h:4391
ValueDecl * getDecl()
Definition: Expr.h:1222
void VisitUnresolvedUsingType(const UnresolvedUsingType *UUT)
std::string getAsString() const
static QualType Desugar(ASTContext &Context, QualType QT, bool &ShouldAKA)
unsigned getExpansionLineNumber(SourceLocation Loc, bool *Invalid=nullptr) const
void VisitObjCCategoryDecl(const ObjCCategoryDecl *D)
bool isNull() const
Return true if this QualType doesn&#39;t point to a type yet.
Definition: Type.h:708
InitializationStyle getInitStyle() const
The style of initialization for this declaration.
Definition: Decl.h:1314
void VisitNonTypeTemplateParmDecl(const NonTypeTemplateParmDecl *D)
QualType getType() const
Definition: DeclObjC.h:828
bool getValue() const
Definition: ExprCXX.h:566
void VisitObjCEncodeExpr(const ObjCEncodeExpr *OEE)
APValue getAPValueResult() const
Definition: Expr.cpp:351
Dynamic storage duration.
Definition: Specifiers.h:311
SplitQualType split() const
Divides a QualType into its unqualified type and a set of local qualifiers.
Definition: Type.h:6156
const char * getFilename() const
Return the presumed filename of this location.
noexcept(expression), evals to &#39;false&#39;
Thread storage duration.
Definition: Specifiers.h:309
void visitInlineCommandComment(const comments::InlineCommandComment *C, const comments::FullComment *)
is AltiVec &#39;vector Pixel&#39;
Definition: Type.h:3216
static StringRef getIdentKindName(IdentKind IK)
Definition: Expr.cpp:646
not a target-specific vector type
Definition: Type.h:3210
ExceptionSpecificationType Type
The kind of exception specification this is.
Definition: Type.h:3781
bool isImplicitProperty() const
Definition: ExprObjC.h:704
ExtProtoInfo getExtProtoInfo() const
Definition: Type.h:3938
void Visit(const Attr *A)
unsigned getColumn() const
Return the presumed column number of this location.
bool isParameterPack() const
Returns whether this is a parameter pack.
Encodes a location in the source.
bool getSynthesize() const
Definition: DeclObjC.h:1990
ObjCInterfaceDecl * getDecl() const
Get the declaration of this interface.
Definition: Type.h:5827
bool isPure() const
Whether this virtual function is pure, i.e.
Definition: Decl.h:2059
bool hasVarStorage() const
True if this WhileStmt has storage for a condition variable.
Definition: Stmt.h:2247
bool isMemberDataPointer() const
Returns true if the member type (i.e.
Definition: Type.h:2834
void VisitUnresolvedLookupExpr(const UnresolvedLookupExpr *ULE)
void VisitVectorType(const VectorType *VT)
Represents a C++ temporary.
Definition: ExprCXX.h:1250
bool hasExplicitTemplateArgs() const
Determines whether this member expression actually had a C++ template argument list explicitly specif...
Definition: ExprCXX.h:3601
Interfaces are the core concept in Objective-C for object oriented design.
Definition: Type.h:5814
bool isVariablyModifiedType() const
Whether this type is a variably-modified type (C99 6.7.5).
Definition: Type.h:2137
static llvm::json::Object createDefaultConstructorDefinitionData(const CXXRecordDecl *RD)
static bool Ret(InterpState &S, CodePtr &PC, APValue &Result)
Definition: Interp.cpp:34
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...
Definition: Decl.h:291
Represents a new-expression for memory allocation and constructor calls, e.g: "new CXXNewExpr(foo)"...
Definition: ExprCXX.h:2009
void VisitCXXDeleteExpr(const CXXDeleteExpr *DE)
bool wasDeclaredWithTypename() const
Whether this template type parameter was declared with the &#39;typename&#39; keyword.
void VisitCXXBoolLiteralExpr(const CXXBoolLiteralExpr *BLE)
Represents the declaration of a struct/union/class/enum.
Definition: Decl.h:3133
SourceRange getSourceRange() const LLVM_READONLY
Definition: Comment.h:215
ASTContext & getASTContext() const LLVM_READONLY
Definition: DeclBase.cpp:377
CallingConv getCC() const
Definition: Type.h:3563
ObjCCategoryDecl * getCategoryDecl() const
Definition: DeclObjC.cpp:2063
bool isParamIndexValid() const LLVM_READONLY
Definition: Comment.h:772
static llvm::json::Object createCopyAssignmentDefinitionData(const CXXRecordDecl *RD)
const CommandInfo * getCommandInfo(StringRef Name) const
bool isRestrict() const
Definition: Type.h:3670
std::string getValueAsString(unsigned Radix) const
Definition: Expr.cpp:955
void VisitFixedPointLiteral(const FixedPointLiteral *FPL)
bool canOverflow() const
Returns true if the unary operator can cause an overflow.
Definition: Expr.h:2064
void VisitUsingDirectiveDecl(const UsingDirectiveDecl *UDD)
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
No ref-qualifier was provided.
Definition: Type.h:1389
C-style initialization with assignment.
Definition: Decl.h:832
bool isPackExpansion() const
Determine whether this base specifier is a pack expansion.
Definition: DeclCXX.h:207
bool isBoundToLvalueReference() const
Determine whether this materialized temporary is bound to an lvalue reference; otherwise, it&#39;s bound to an rvalue reference.
Definition: ExprCXX.h:4401
bool isParameterPack() const
Definition: Type.h:4641
bool isLiteral(TokenKind K)
Return true if this is a "literal" kind, like a numeric constant, string, etc.
Definition: TokenKinds.h:85
ObjCCategoryDecl - Represents a category declaration.
Definition: DeclObjC.h:2279
This is a basic class for representing single OpenMP clause.
Definition: OpenMPClause.h:50
void VisitUsingShadowDecl(const UsingShadowDecl *USD)
UnaryExprOrTypeTrait getKind() const
Definition: Expr.h:2378
bool isArray() const
Definition: ExprCXX.h:2132
bool isScoped() const
Returns true if this is a C++11 scoped enumeration.
Definition: Decl.h:3589
ObjCProtocolExpr used for protocol expression in Objective-C.
Definition: ExprObjC.h:503
StringRef getParamNameAsWritten() const
Definition: Comment.h:834
bool hasDefaultArgument() const
Determine whether this template parameter has a default argument.
is AltiVec &#39;vector bool ...&#39;
Definition: Type.h:3219
Represents one property declaration in an Objective-C interface.
Definition: DeclObjC.h:728
void VisitObjCInterfaceType(const ObjCInterfaceType *OIT)
ImplicitCastExpr - Allows us to explicitly represent implicit type conversions, which have no direct ...
Definition: Expr.h:3249
bool hasTemplateKeyword() const
Determines whether the member name was preceded by the template keyword.
Definition: ExprCXX.h:3597
NestedNameSpecifier * getQualifier() const
Retrieve the qualification on this type.
Definition: Type.h:5242
bool isMessagingGetter() const
True if the property reference will result in a message to the getter.
Definition: ExprObjC.h:737
PassDirection getDirection() const LLVM_READONLY
Definition: Comment.h:745
is AltiVec vector
Definition: Type.h:3213
AutoTypeKeyword getKeyword() const
Definition: Type.h:4838
Qualifiers getIndexTypeQualifiers() const
Definition: Type.h:2887
Used for C&#39;s _Alignof and C++&#39;s alignof.
Definition: TypeTraits.h:100
bool isUsed(bool CheckUsedAttr=true) const
Whether any (re-)declaration of the entity was used, meaning that a definition is required...
Definition: DeclBase.cpp:398
bool isOriginalNamespace() const
Return true if this declaration is an original (first) declaration of the namespace.
Definition: DeclCXX.cpp:2749
VarDecl * getVariable() const
The variable being captured.
Definition: Decl.h:3978
llvm::APSInt getAsIntegral() const
Retrieve the template argument as an integral value.
Definition: TemplateBase.h:300
void VisitVarDecl(const VarDecl *VD)
void printPretty(raw_ostream &OS, const ASTContext &Ctx, QualType Ty) const
Definition: APValue.cpp:473
Indicates that the nullability of the type was spelled with a property attribute rather than a type q...
Definition: DeclObjC.h:748
A closing HTML tag.
Definition: Comment.h:507
An rvalue ref-qualifier was provided (&&).
Definition: Type.h:1395
ObjCBoxedExpr - used for generalized expression boxing.
Definition: ExprObjC.h:124
void VisitTemplateTemplateArgument(const TemplateArgument &TA)
bool isArgumentType() const
Definition: Expr.h:2383
ArrayRef< TemplateArgumentLoc > template_arguments() const
Definition: ExprCXX.h:3629
ObjCImplementationDecl * getImplementation() const
Definition: DeclObjC.cpp:1548
Optional< unsigned > getNumExpansions() const
Retrieve the number of expansions that this pack expansion will generate, if known.
Definition: Type.h:5456
bool isPartOfExplicitCast() const
Definition: Expr.h:3268
std::string getAsString() const
FunctionDecl * getOperatorDelete() const
Definition: ExprCXX.h:2129
void VisitConstantExpr(const ConstantExpr *CE)
void visitHTMLStartTagComment(const comments::HTMLStartTagComment *C, const comments::FullComment *)
bool isInstantiationDependentType() const
Determine whether this type is an instantiation-dependent type, meaning that the type involves a temp...
Definition: Type.h:2127
void VisitFunctionType(const FunctionType *T)
Doxygen \tparam command, describes a template parameter.
Definition: Comment.h:799
protocol_range protocols() const
Definition: DeclObjC.h:2355
NonOdrUseReason isNonOdrUse() const
Is this expression a non-odr-use reference, and if so, why?
Definition: Expr.h:1346
The injected class name of a C++ class template or class template partial specialization.
Definition: Type.h:5054
Represents a pack expansion of types.
Definition: Type.h:5431
InitializationStyle getInitializationStyle() const
The kind of initializer this new-expression has.
Definition: ExprCXX.h:2176
CompoundAssignOperator - For compound assignments (e.g.
Definition: Expr.h:3629
static const char * getStorageClassSpecifierString(StorageClass SC)
Return the string used to specify the storage class SC.
Definition: Decl.cpp:1933
Represents a C11 generic selection.
Definition: Expr.h:5206
StringRef getName() const
Return the actual identifier string.
void VisitMemberExpr(const MemberExpr *ME)
void VisitMacroQualifiedType(const MacroQualifiedType *MQT)
void VisitAddrLabelExpr(const AddrLabelExpr *ALE)
AddrLabelExpr - The GNU address of label extension, representing &&label.
Definition: Expr.h:3882
#define FIELD1(Flag)
TLS with a dynamic initializer.
Definition: Decl.h:850
Represents a template argument.
Definition: TemplateBase.h:50
bool isThisDeclarationReferenced() const
Whether this declaration was referenced.
Definition: DeclBase.h:586
bool isDeduced() const
Definition: Type.h:4812
This name appears as a potential result of a discarded value expression.
Definition: Specifiers.h:170
const ObjCInterfaceDecl * getClassInterface() const
Definition: DeclObjC.h:2439
bool isTypeOperand() const
Definition: ExprCXX.h:713
NamespaceDecl * getNominatedNamespace()
Returns the namespace nominated by this using-directive.
Definition: DeclCXX.cpp:2704
void VisitGenericSelectionExpr(const GenericSelectionExpr *GSE)
Dataflow Directional Tag Classes.
bool isResultDependent() const
Whether this generic selection is result-dependent.
Definition: Expr.h:5386
ExtInfo getExtInfo() const
Definition: Type.h:3662
not evaluated yet, for special member function
[C99 6.4.2.2] - A predefined identifier such as func.
Definition: Expr.h:1878
void visitVerbatimBlockLineComment(const comments::VerbatimBlockLineComment *C, const comments::FullComment *)
void VisitInitListExpr(const InitListExpr *ILE)
Represents a delete expression for memory deallocation and destructor calls, e.g. ...
Definition: ExprCXX.h:2268
bool isNested() const
Whether this is a nested capture, i.e.
Definition: Decl.h:3994
bool isVariadic() const
Definition: Decl.h:4026
Kind getPropertyImplementation() const
Definition: DeclObjC.h:2822
void VisitSwitchStmt(const SwitchStmt *SS)
void VisitLabelStmt(const LabelStmt *LS)
bool isImplicit() const
Definition: ExprCXX.h:1027
bool NE(InterpState &S, CodePtr OpPC)
Definition: Interp.h:226
bool hasInitStorage() const
True if this IfStmt has the storage for an init statement.
Definition: Stmt.h:1879
QualType getSuperType() const
Retrieve the type referred to by &#39;super&#39;.
Definition: ExprObjC.h:1336
void VisitCXXTypeidExpr(const CXXTypeidExpr *CTE)
QualType getUnderlyingType() const
Definition: Decl.h:3040
AccessSpecifier getAccess() const
Definition: DeclBase.h:473
NamespaceDecl * getOriginalNamespace()
Get the original (first) namespace declaration.
Definition: DeclCXX.cpp:2735
unsigned getIndex() const
Retrieve the index of the template parameter.
bool usesADL() const
Definition: Expr.h:2648
DeclarationName getMember() const
Retrieve the name of the member that this expression refers to.
Definition: ExprCXX.h:3566
void VisitTypedefDecl(const TypedefDecl *TD)
Represents the declaration of an Objective-C type parameter.
Definition: DeclObjC.h:558
VectorKind getVectorKind() const
Definition: Type.h:3251
void VisitCallExpr(const CallExpr *CE)
Kind getKind() const
Definition: DeclBase.h:432
void visitTParamCommandComment(const comments::TParamCommandComment *C, const comments::FullComment *FC)
bool isListInitialization() const
Whether this constructor call was written as list-initialization.
Definition: ExprCXX.h:1422
const Type * getBaseClass() const
If this is a base class initializer, returns the type of the base class.
Definition: DeclCXX.cpp:2400
Represents an enum.
Definition: Decl.h:3395
PresumedLoc getPresumedLoc(SourceLocation Loc, bool UseLineDirectives=true) const
Returns the "presumed" location of a SourceLocation specifies.
A pointer to member type per C++ 8.3.3 - Pointers to members.
Definition: Type.h:2804
bool isParameterPack() const
Determine whether this variable is actually a function parameter pack or init-capture pack...
Definition: Decl.cpp:2447
void VisitCXXRecordDecl(const CXXRecordDecl *RD)
void VisitObjCSubscriptRefExpr(const ObjCSubscriptRefExpr *OSRE)
const ObjCInterfaceDecl * getClassInterface() const
Definition: DeclObjC.h:2746
TypeSourceInfo * getTypeOperandSourceInfo() const
Retrieve source information for the type operand.
Definition: ExprCXX.h:720
llvm::APInt getValue() const
Definition: Expr.h:1405
void VisitBlockDecl(const BlockDecl *D)
LabelDecl * getLabel() const
Definition: Expr.h:3904
QualType getClassReceiver() const
Returns the type of a class message send, or NULL if the message is not a class message.
Definition: ExprObjC.h:1279
path_iterator path_end()
Definition: Expr.h:3198
StringRef getTagName() const LLVM_READONLY
Definition: Comment.h:395
SwitchStmt - This represents a &#39;switch&#39; stmt.
Definition: Stmt.h:2017
bool needsOverloadResolutionForMoveConstructor() const
Determine whether we need to eagerly declare a defaulted move constructor for this class...
Definition: DeclCXX.h:861
ObjCImplementationDecl - Represents a class definition - this is where method definitions are specifi...
Definition: DeclObjC.h:2551
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
Definition: Type.h:4444
Location wrapper for a TemplateArgument.
Definition: TemplateBase.h:449
bool isMacroArgExpansion(SourceLocation Loc, SourceLocation *StartLoc=nullptr) const
Tests whether the given source location represents a macro argument&#39;s expansion into the function-lik...
static const CommandInfo * getBuiltinCommandInfo(StringRef Name)
Represents a C++ base or member initializer.
Definition: DeclCXX.h:2124
void VisitObjCPropertyDecl(const ObjCPropertyDecl *D)
unsigned getNumObjects() const
Definition: ExprCXX.h:3246
ObjCEncodeExpr, used for @encode in Objective-C.
Definition: ExprObjC.h:407
bool isFromAST() const
Whether this type comes from an AST file.
Definition: Type.h:1854
const llvm::APInt & getSize() const
Definition: Type.h:2929
void VisitGotoStmt(const GotoStmt *GS)
void VisitCastExpr(const CastExpr *CE)
Opcode getOpcode() const
Definition: Expr.h:2046
Base for LValueReferenceType and RValueReferenceType.
Definition: Type.h:2721
static const char * getCastKindName(CastKind CK)
Definition: Expr.cpp:1882
bool isVolatile() const
Definition: Type.h:3669
void VisitPackTemplateArgument(const TemplateArgument &TA)
void VisitEnumDecl(const EnumDecl *ED)
NamedDecl * getConversionFunction() const
If this cast applies a user-defined conversion, retrieve the conversion function that it invokes...
Definition: Expr.cpp:1930
void VisitConstantArrayType(const ConstantArrayType *CAT)
bool isArrow() const
Determine whether this member expression used the &#39;->&#39; operator; otherwise, it used the &#39;...
Definition: ExprCXX.h:3527
Represents a base class of a C++ class.
Definition: DeclCXX.h:147
ObjCIvarRefExpr - A reference to an ObjC instance variable.
Definition: ExprObjC.h:546
ArrayRef< QualType > Exceptions
Explicitly-specified list of exception types.
Definition: Type.h:3784
void visitBlockCommandComment(const comments::BlockCommandComment *C, const comments::FullComment *)
bool capturesCXXThis() const
Definition: Decl.h:4083
llvm::iterator_range< decls_iterator > decls() const
Definition: ExprCXX.h:2851
Describes an explicit type conversion that uses functional notion but could not be resolved because o...
Definition: ExprCXX.h:3299
GotoStmt - This represents a direct goto.
Definition: Stmt.h:2455
TypedefNameDecl * getDecl() const
Definition: Type.h:4206
llvm::json::OStream JOS
void VisitTagType(const TagType *TT)
unsigned getDepth() const
Definition: Type.h:4639
bool isFreeIvar() const
Definition: ExprObjC.h:585
Call-style initialization (C++98)
Definition: Decl.h:835
MemberExpr - [C99 6.5.2.3] Structure and Union Members.
Definition: Expr.h:2811
void VisitEnumConstantDecl(const EnumConstantDecl *ECD)
void VisitObjCMethodDecl(const ObjCMethodDecl *D)
bool isMutable() const
Determines whether this field is mutable (C++ only).
Definition: Decl.h:2718
static bool isTrivial(ASTContext &Ctx, const Expr *E)
Checks if the expression is constant or does not have non-trivial function calls. ...
Represents a C++ struct/union/class.
Definition: DeclCXX.h:255
void VisitRValueReferenceType(const ReferenceType *RT)
const char * getCommentKindName() const
Definition: Comment.cpp:35
bool isValid() const
bool isMemberFunctionPointer() const
Returns true if the member type (i.e.
Definition: Type.h:2828
bool isNRVOVariable() const
Determine whether this local variable can be used with the named return value optimization (NRVO)...
Definition: Decl.h:1360
ObjCIvarDecl - Represents an ObjC instance variable.
Definition: DeclObjC.h:1944
There is no such object (it&#39;s outside its lifetime).
Definition: APValue.h:121
WhileStmt - This represents a &#39;while&#39; stmt.
Definition: Stmt.h:2200
bool isInherited() const
Definition: Attr.h:94
bool isVariadic() const
Definition: DeclObjC.h:426
The receiver is a class.
Definition: ExprObjC.h:1098
SourceRange getSourceRange() const LLVM_READONLY
SourceLocation tokens are not useful in isolation - they are low level value objects created/interpre...
Definition: Stmt.cpp:262
bool isGlobalDelete() const
Definition: ExprCXX.h:2294
void VisitNamespaceAliasDecl(const NamespaceAliasDecl *NAD)
StringLiteral - This represents a string literal expression, e.g.
Definition: Expr.h:1686
Full-expression storage duration (for temporaries).
Definition: Specifiers.h:307
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
Definition: Expr.h:2521
TLS with a known-constant initializer.
Definition: Decl.h:847
QualType getIntegerType() const
Return the integer type this enum decl corresponds to.
Definition: Decl.h:3549
StringRef getName() const
Get the name of identifier for this declaration as a StringRef.
Definition: Decl.h:275
void VisitStringLiteral(const StringLiteral *SL)
StringRef getParamNameAsWritten() const
Definition: Comment.h:764
NestedNameSpecifier * getQualifier() const
Retrieve the nested-name-specifier that qualifies the name.
Definition: DeclCXX.h:3305
void VisitObjCCategoryImplDecl(const ObjCCategoryImplDecl *D)
unsigned getNumElements() const
Definition: Type.h:3242
ObjCBoolLiteralExpr - Objective-C Boolean Literal.
Definition: ExprObjC.h:85
Microsoft __declspec(nothrow) extension.
bool isDependentType() const
Whether this type is a dependent type, meaning that its definition somehow depends on a template para...
Definition: Type.h:2121
QualType getAsType() const
Retrieve the type for a type template argument.
Definition: TemplateBase.h:256
#define FIELD2(Name, Flag)
A reference to a declared variable, function, enum, etc.
Definition: Expr.h:1146
Represents a type template specialization; the template must be a class template, a type alias templa...
Definition: Type.h:4917
ObjCPropertyDecl * getPropertyDecl() const
Definition: DeclObjC.h:2817
ObjCTypeParamVariance getVariance() const
Determine the variance of this type parameter.
Definition: DeclObjC.h:601
Doxygen \param command.
Definition: Comment.h:711
bool isDeleted() const
Whether this function has been deleted.
Definition: Decl.h:2199
const VarDecl * getCatchParamDecl() const
Definition: StmtObjC.h:97
void VisitLinkageSpecDecl(const LinkageSpecDecl *LSD)
FieldDecl * getInitializedFieldInUnion()
If this initializes a union, specifies which field in the union to initialize.
Definition: Expr.h:4487
bool hadMultipleCandidates() const
Whether the referred constructor was resolved from an overloaded set having size greater than 1...
Definition: ExprCXX.h:1414
void VisitNullTemplateArgument(const TemplateArgument &TA)
bool isArraySubscriptRefExpr() const
Definition: ExprObjC.h:904
QualType getTypeAsWritten() const
Retrieve the type that is being constructed, as specified in the source code.
Definition: ExprCXX.h:3334
static StringRef getNameForCallConv(CallingConv CC)
Definition: Type.cpp:2934
void visitVerbatimLineComment(const comments::VerbatimLineComment *C, const comments::FullComment *)
QualType getType() const
Definition: Decl.h:655
AccessSpecifier getAccessSpecifierAsWritten() const
Retrieves the access specifier as written in the source code (which may mean that no access specifier...
Definition: DeclCXX.h:239
void VisitCXXThisExpr(const CXXThisExpr *TE)
An l-value expression is a reference to an object with independent storage.
Definition: Specifiers.h:129
A trivial tuple used to represent a source range.
bool isModulePrivate() const
Whether this declaration was marked as being private to the module in which it was defined...
Definition: DeclBase.h:607
static StringRef getOpcodeStr(Opcode Op)
getOpcodeStr - Turn an Opcode enum value into the punctuation char it corresponds to...
Definition: Expr.cpp:1291
ObjCMethodDecl * getGetterMethodDecl() const
Definition: DeclObjC.h:921
This represents a decl that may have a name.
Definition: Decl.h:248
A boolean literal, per ([C++ lex.bool] Boolean literals).
Definition: ExprCXX.h:554
StringRef getParamName(const FullComment *FC) const
Definition: Comment.cpp:378
void VisitTemplateTemplateParmDecl(const TemplateTemplateParmDecl *D)
Represents a C++ namespace alias.
Definition: DeclCXX.h:2936
APValue::ValueKind getResultAPValueKind() const
Definition: Expr.h:1025
Automatic storage duration (most local variables).
Definition: Specifiers.h:308
bool isInline() const
Whether this variable is (C++1z) inline.
Definition: Decl.h:1399
AccessControl getAccessControl() const
Definition: DeclObjC.h:1983
Represents C++ using-directive.
Definition: DeclCXX.h:2832
attr::Kind getKind() const
Definition: Attr.h:85
The receiver is a superclass.
Definition: ExprObjC.h:1104
bool hasInit() const
Definition: Decl.cpp:2209
SourceLocation getBegin() const
void VisitObjCImplementationDecl(const ObjCImplementationDecl *D)
void VisitFunctionDecl(const FunctionDecl *FD)
const LangOptions & getLangOpts() const
Definition: ASTContext.h:723
NamedDecl * getPack() const
Retrieve the parameter pack.
Definition: ExprCXX.h:4071
ObjCCategoryImplDecl - An object of this class encapsulates a category @implementation declaration...
Definition: DeclObjC.h:2498
bool caseStmtIsGNURange() const
True if this case statement is of the form case LHS ...
Definition: Stmt.h:1547
Represents the canonical version of C arrays with a specified constant size.
Definition: Type.h:2906
The parameter is invariant: must match exactly.
ExceptionSpecInfo ExceptionSpec
Definition: Type.h:3811
A class which abstracts out some details necessary for making a call.
Definition: Type.h:3504
Attr - This represents one attribute.
Definition: Attr.h:45
bool isDeletedAsWritten() const
Definition: Decl.h:2203
SourceLocation getLocation() const
Definition: DeclBase.h:429
Represents a shadow declaration introduced into a scope by a (resolved) using declaration.
Definition: DeclCXX.h:3055
A full comment attached to a declaration, contains block content.
Definition: Comment.h:1091
QualType getType() const
Return the type wrapped by this type source info.
Definition: Decl.h:97
noexcept(expression), evals to &#39;true&#39;
NamedDecl * getAliasedNamespace() const
Retrieve the namespace that this alias refers to, which may either be a NamespaceDecl or a NamespaceA...
Definition: DeclCXX.h:3032
ObjCCompatibleAliasDecl - Represents alias of a class.
Definition: DeclObjC.h:2728
void VisitObjCBoolLiteralExpr(const ObjCBoolLiteralExpr *OBLE)
void visitHTMLEndTagComment(const comments::HTMLEndTagComment *C, const comments::FullComment *)
ConstructionKind getConstructionKind() const
Determine whether this constructor is actually constructing a base class (rather than a complete obje...
Definition: ExprCXX.h:1451
QualType getType() const
Retrieves the type of the base class.
Definition: DeclCXX.h:246