clang  9.0.0svn
JSONNodeDumper.cpp
Go to the documentation of this file.
2 #include "llvm/ADT/StringSwitch.h"
3 
4 using namespace clang;
5 
6 void JSONNodeDumper::addPreviousDeclaration(const Decl *D) {
7  switch (D->getKind()) {
8 #define DECL(DERIVED, BASE) \
9  case Decl::DERIVED: \
10  return writePreviousDeclImpl(cast<DERIVED##Decl>(D));
11 #define ABSTRACT_DECL(DECL)
12 #include "clang/AST/DeclNodes.inc"
13 #undef ABSTRACT_DECL
14 #undef DECL
15  }
16  llvm_unreachable("Decl that isn't part of DeclNodes.inc!");
17 }
18 
19 void JSONNodeDumper::Visit(const Attr *A) {
20  const char *AttrName = nullptr;
21  switch (A->getKind()) {
22 #define ATTR(X) \
23  case attr::X: \
24  AttrName = #X"Attr"; \
25  break;
26 #include "clang/Basic/AttrList.inc"
27 #undef ATTR
28  }
29  JOS.attribute("id", createPointerRepresentation(A));
30  JOS.attribute("kind", AttrName);
31  JOS.attribute("range", createSourceRange(A->getRange()));
32  attributeOnlyIfTrue("inherited", A->isInherited());
33  attributeOnlyIfTrue("implicit", A->isImplicit());
34 
35  // FIXME: it would be useful for us to output the spelling kind as well as
36  // the actual spelling. This would allow us to distinguish between the
37  // various attribute syntaxes, but we don't currently track that information
38  // within the AST.
39  //JOS.attribute("spelling", A->getSpelling());
40 
42 }
43 
44 void JSONNodeDumper::Visit(const Stmt *S) {
45  if (!S)
46  return;
47 
48  JOS.attribute("id", createPointerRepresentation(S));
49  JOS.attribute("kind", S->getStmtClassName());
50  JOS.attribute("range", createSourceRange(S->getSourceRange()));
51 
52  if (const auto *E = dyn_cast<Expr>(S)) {
53  JOS.attribute("type", createQualType(E->getType()));
54  const char *Category = nullptr;
55  switch (E->getValueKind()) {
56  case VK_LValue: Category = "lvalue"; break;
57  case VK_XValue: Category = "xvalue"; break;
58  case VK_RValue: Category = "rvalue"; break;
59  }
60  JOS.attribute("valueCategory", Category);
61  }
63 }
64 
65 void JSONNodeDumper::Visit(const Type *T) {
66  JOS.attribute("id", createPointerRepresentation(T));
67  JOS.attribute("kind", (llvm::Twine(T->getTypeClassName()) + "Type").str());
68  JOS.attribute("type", createQualType(QualType(T, 0), /*Desugar*/ false));
69  attributeOnlyIfTrue("isDependent", T->isDependentType());
70  attributeOnlyIfTrue("isInstantiationDependent",
72  attributeOnlyIfTrue("isVariablyModified", T->isVariablyModifiedType());
73  attributeOnlyIfTrue("containsUnexpandedPack",
75  attributeOnlyIfTrue("isImported", T->isFromAST());
77 }
78 
80  JOS.attribute("id", createPointerRepresentation(T.getAsOpaquePtr()));
81  JOS.attribute("type", createQualType(T));
82  JOS.attribute("qualifiers", T.split().Quals.getAsString());
83 }
84 
85 void JSONNodeDumper::Visit(const Decl *D) {
86  JOS.attribute("id", createPointerRepresentation(D));
87 
88  if (!D)
89  return;
90 
91  JOS.attribute("kind", (llvm::Twine(D->getDeclKindName()) + "Decl").str());
92  JOS.attribute("loc", createSourceLocation(D->getLocation()));
93  JOS.attribute("range", createSourceRange(D->getSourceRange()));
94  attributeOnlyIfTrue("isImplicit", D->isImplicit());
95  attributeOnlyIfTrue("isInvalid", D->isInvalidDecl());
96 
97  if (D->isUsed())
98  JOS.attribute("isUsed", true);
99  else if (D->isThisDeclarationReferenced())
100  JOS.attribute("isReferenced", true);
101 
102  if (const auto *ND = dyn_cast<NamedDecl>(D))
103  attributeOnlyIfTrue("isHidden", ND->isHidden());
104 
105  if (D->getLexicalDeclContext() != D->getDeclContext())
106  JOS.attribute("parentDeclContext",
107  createPointerRepresentation(D->getDeclContext()));
108 
109  addPreviousDeclaration(D);
111 }
112 
114  const comments::FullComment *FC) {
115  if (!C)
116  return;
117 
118  JOS.attribute("id", createPointerRepresentation(C));
119  JOS.attribute("kind", C->getCommentKindName());
120  JOS.attribute("loc", createSourceLocation(C->getLocation()));
121  JOS.attribute("range", createSourceRange(C->getSourceRange()));
122 
124 }
125 
127  const Decl *From, StringRef Label) {
128  JOS.attribute("kind", "TemplateArgument");
129  if (R.isValid())
130  JOS.attribute("range", createSourceRange(R));
131 
132  if (From)
133  JOS.attribute(Label.empty() ? "fromDecl" : Label, createBareDeclRef(From));
134 
136 }
137 
139  JOS.attribute("kind", "CXXCtorInitializer");
140  if (Init->isAnyMemberInitializer())
141  JOS.attribute("anyInit", createBareDeclRef(Init->getAnyMember()));
142  else if (Init->isBaseInitializer())
143  JOS.attribute("baseInit",
144  createQualType(QualType(Init->getBaseClass(), 0)));
145  else if (Init->isDelegatingInitializer())
146  JOS.attribute("delegatingInit",
147  createQualType(Init->getTypeSourceInfo()->getType()));
148  else
149  llvm_unreachable("Unknown initializer type");
150 }
151 
153 
155  JOS.attribute("kind", "Capture");
156  attributeOnlyIfTrue("byref", C.isByRef());
157  attributeOnlyIfTrue("nested", C.isNested());
158  if (C.getVariable())
159  JOS.attribute("var", createBareDeclRef(C.getVariable()));
160 }
161 
163  JOS.attribute("associationKind", A.getTypeSourceInfo() ? "case" : "default");
164  attributeOnlyIfTrue("selected", A.isSelected());
165 }
166 
167 llvm::json::Object
168 JSONNodeDumper::createBareSourceLocation(SourceLocation Loc) {
169  PresumedLoc Presumed = SM.getPresumedLoc(Loc);
170 
171  if (Presumed.isInvalid())
172  return llvm::json::Object{};
173 
174  return llvm::json::Object{{"file", Presumed.getFilename()},
175  {"line", Presumed.getLine()},
176  {"col", Presumed.getColumn()}};
177 }
178 
179 llvm::json::Object JSONNodeDumper::createSourceLocation(SourceLocation Loc) {
180  SourceLocation Spelling = SM.getSpellingLoc(Loc);
181  SourceLocation Expansion = SM.getExpansionLoc(Loc);
182 
183  llvm::json::Object SLoc = createBareSourceLocation(Spelling);
184  if (Expansion != Spelling) {
185  // If the expansion and the spelling are different, output subobjects
186  // describing both locations.
187  llvm::json::Object ELoc = createBareSourceLocation(Expansion);
188 
189  // If there is a macro expansion, add extra information if the interesting
190  // bit is the macro arg expansion.
191  if (SM.isMacroArgExpansion(Loc))
192  ELoc["isMacroArgExpansion"] = true;
193 
194  return llvm::json::Object{{"spellingLoc", std::move(SLoc)},
195  {"expansionLoc", std::move(ELoc)}};
196  }
197 
198  return SLoc;
199 }
200 
201 llvm::json::Object JSONNodeDumper::createSourceRange(SourceRange R) {
202  return llvm::json::Object{{"begin", createSourceLocation(R.getBegin())},
203  {"end", createSourceLocation(R.getEnd())}};
204 }
205 
206 std::string JSONNodeDumper::createPointerRepresentation(const void *Ptr) {
207  // Because JSON stores integer values as signed 64-bit integers, trying to
208  // represent them as such makes for very ugly pointer values in the resulting
209  // output. Instead, we convert the value to hex and treat it as a string.
210  return "0x" + llvm::utohexstr(reinterpret_cast<uint64_t>(Ptr), true);
211 }
212 
213 llvm::json::Object JSONNodeDumper::createQualType(QualType QT, bool Desugar) {
214  SplitQualType SQT = QT.split();
215  llvm::json::Object Ret{{"qualType", QualType::getAsString(SQT, PrintPolicy)}};
216 
217  if (Desugar && !QT.isNull()) {
219  if (DSQT != SQT)
220  Ret["desugaredQualType"] = QualType::getAsString(DSQT, PrintPolicy);
221  }
222  return Ret;
223 }
224 
225 llvm::json::Object JSONNodeDumper::createBareDeclRef(const Decl *D) {
226  llvm::json::Object Ret{{"id", createPointerRepresentation(D)}};
227  if (!D)
228  return Ret;
229 
230  Ret["kind"] = (llvm::Twine(D->getDeclKindName()) + "Decl").str();
231  if (const auto *ND = dyn_cast<NamedDecl>(D))
232  Ret["name"] = ND->getDeclName().getAsString();
233  if (const auto *VD = dyn_cast<ValueDecl>(D))
234  Ret["type"] = createQualType(VD->getType());
235  return Ret;
236 }
237 
238 llvm::json::Array JSONNodeDumper::createCastPath(const CastExpr *C) {
239  llvm::json::Array Ret;
240  if (C->path_empty())
241  return Ret;
242 
243  for (auto I = C->path_begin(), E = C->path_end(); I != E; ++I) {
244  const CXXBaseSpecifier *Base = *I;
245  const auto *RD =
246  cast<CXXRecordDecl>(Base->getType()->getAs<RecordType>()->getDecl());
247 
248  llvm::json::Object Val{{"name", RD->getName()}};
249  if (Base->isVirtual())
250  Val["isVirtual"] = true;
251  Ret.push_back(std::move(Val));
252  }
253  return Ret;
254 }
255 
256 #define FIELD2(Name, Flag) if (RD->Flag()) Ret[Name] = true
257 #define FIELD1(Flag) FIELD2(#Flag, Flag)
258 
259 static llvm::json::Object
261  llvm::json::Object Ret;
262 
263  FIELD2("exists", hasDefaultConstructor);
264  FIELD2("trivial", hasTrivialDefaultConstructor);
265  FIELD2("nonTrivial", hasNonTrivialDefaultConstructor);
266  FIELD2("userProvided", hasUserProvidedDefaultConstructor);
267  FIELD2("isConstexpr", hasConstexprDefaultConstructor);
268  FIELD2("needsImplicit", needsImplicitDefaultConstructor);
269  FIELD2("defaultedIsConstexpr", defaultedDefaultConstructorIsConstexpr);
270 
271  return Ret;
272 }
273 
274 static llvm::json::Object
276  llvm::json::Object Ret;
277 
278  FIELD2("simple", hasSimpleCopyConstructor);
279  FIELD2("trivial", hasTrivialCopyConstructor);
280  FIELD2("nonTrivial", hasNonTrivialCopyConstructor);
281  FIELD2("userDeclared", hasUserDeclaredCopyConstructor);
282  FIELD2("hasConstParam", hasCopyConstructorWithConstParam);
283  FIELD2("implicitHasConstParam", implicitCopyConstructorHasConstParam);
284  FIELD2("needsImplicit", needsImplicitCopyConstructor);
285  FIELD2("needsOverloadResolution", needsOverloadResolutionForCopyConstructor);
287  FIELD2("defaultedIsDeleted", defaultedCopyConstructorIsDeleted);
288 
289  return Ret;
290 }
291 
292 static llvm::json::Object
294  llvm::json::Object Ret;
295 
296  FIELD2("exists", hasMoveConstructor);
297  FIELD2("simple", hasSimpleMoveConstructor);
298  FIELD2("trivial", hasTrivialMoveConstructor);
299  FIELD2("nonTrivial", hasNonTrivialMoveConstructor);
300  FIELD2("userDeclared", hasUserDeclaredMoveConstructor);
301  FIELD2("needsImplicit", needsImplicitMoveConstructor);
302  FIELD2("needsOverloadResolution", needsOverloadResolutionForMoveConstructor);
304  FIELD2("defaultedIsDeleted", defaultedMoveConstructorIsDeleted);
305 
306  return Ret;
307 }
308 
309 static llvm::json::Object
311  llvm::json::Object Ret;
312 
313  FIELD2("trivial", hasTrivialCopyAssignment);
314  FIELD2("nonTrivial", hasNonTrivialCopyAssignment);
315  FIELD2("hasConstParam", hasCopyAssignmentWithConstParam);
316  FIELD2("implicitHasConstParam", implicitCopyAssignmentHasConstParam);
317  FIELD2("userDeclared", hasUserDeclaredCopyAssignment);
318  FIELD2("needsImplicit", needsImplicitCopyAssignment);
319  FIELD2("needsOverloadResolution", needsOverloadResolutionForCopyAssignment);
320 
321  return Ret;
322 }
323 
324 static llvm::json::Object
326  llvm::json::Object Ret;
327 
328  FIELD2("exists", hasMoveAssignment);
329  FIELD2("simple", hasSimpleMoveAssignment);
330  FIELD2("trivial", hasTrivialMoveAssignment);
331  FIELD2("nonTrivial", hasNonTrivialMoveAssignment);
332  FIELD2("userDeclared", hasUserDeclaredMoveAssignment);
333  FIELD2("needsImplicit", needsImplicitMoveAssignment);
334  FIELD2("needsOverloadResolution", needsOverloadResolutionForMoveAssignment);
335 
336  return Ret;
337 }
338 
339 static llvm::json::Object
341  llvm::json::Object Ret;
342 
343  FIELD2("simple", hasSimpleDestructor);
344  FIELD2("irrelevant", hasIrrelevantDestructor);
345  FIELD2("trivial", hasTrivialDestructor);
346  FIELD2("nonTrivial", hasNonTrivialDestructor);
347  FIELD2("userDeclared", hasUserDeclaredDestructor);
348  FIELD2("needsImplicit", needsImplicitDestructor);
349  FIELD2("needsOverloadResolution", needsOverloadResolutionForDestructor);
351  FIELD2("defaultedIsDeleted", defaultedDestructorIsDeleted);
352 
353  return Ret;
354 }
355 
356 llvm::json::Object
357 JSONNodeDumper::createCXXRecordDefinitionData(const CXXRecordDecl *RD) {
358  llvm::json::Object Ret;
359 
360  // This data is common to all C++ classes.
361  FIELD1(isGenericLambda);
362  FIELD1(isLambda);
363  FIELD1(isEmpty);
364  FIELD1(isAggregate);
365  FIELD1(isStandardLayout);
366  FIELD1(isTriviallyCopyable);
367  FIELD1(isPOD);
368  FIELD1(isTrivial);
369  FIELD1(isPolymorphic);
370  FIELD1(isAbstract);
371  FIELD1(isLiteral);
373  FIELD1(hasUserDeclaredConstructor);
374  FIELD1(hasConstexprNonCopyMoveConstructor);
375  FIELD1(hasMutableFields);
376  FIELD1(hasVariantMembers);
377  FIELD2("canConstDefaultInit", allowConstDefaultInit);
378 
379  Ret["defaultCtor"] = createDefaultConstructorDefinitionData(RD);
380  Ret["copyCtor"] = createCopyConstructorDefinitionData(RD);
381  Ret["moveCtor"] = createMoveConstructorDefinitionData(RD);
382  Ret["copyAssign"] = createCopyAssignmentDefinitionData(RD);
383  Ret["moveAssign"] = createMoveAssignmentDefinitionData(RD);
384  Ret["dtor"] = createDestructorDefinitionData(RD);
385 
386  return Ret;
387 }
388 
389 #undef FIELD1
390 #undef FIELD2
391 
392 std::string JSONNodeDumper::createAccessSpecifier(AccessSpecifier AS) {
393  switch (AS) {
394  case AS_none: return "none";
395  case AS_private: return "private";
396  case AS_protected: return "protected";
397  case AS_public: return "public";
398  }
399  llvm_unreachable("Unknown access specifier");
400 }
401 
402 llvm::json::Object
403 JSONNodeDumper::createCXXBaseSpecifier(const CXXBaseSpecifier &BS) {
404  llvm::json::Object Ret;
405 
406  Ret["type"] = createQualType(BS.getType());
407  Ret["access"] = createAccessSpecifier(BS.getAccessSpecifier());
408  Ret["writtenAccess"] =
409  createAccessSpecifier(BS.getAccessSpecifierAsWritten());
410  if (BS.isVirtual())
411  Ret["isVirtual"] = true;
412  if (BS.isPackExpansion())
413  Ret["isPackExpansion"] = true;
414 
415  return Ret;
416 }
417 
419  JOS.attribute("decl", createBareDeclRef(TT->getDecl()));
420 }
421 
424  attributeOnlyIfTrue("noreturn", E.getNoReturn());
425  attributeOnlyIfTrue("producesResult", E.getProducesResult());
426  if (E.getHasRegParm())
427  JOS.attribute("regParm", E.getRegParm());
428  JOS.attribute("cc", FunctionType::getNameForCallConv(E.getCC()));
429 }
430 
433  attributeOnlyIfTrue("trailingReturn", E.HasTrailingReturn);
434  attributeOnlyIfTrue("const", T->isConst());
435  attributeOnlyIfTrue("volatile", T->isVolatile());
436  attributeOnlyIfTrue("restrict", T->isRestrict());
437  attributeOnlyIfTrue("variadic", E.Variadic);
438  switch (E.RefQualifier) {
439  case RQ_LValue: JOS.attribute("refQualifier", "&"); break;
440  case RQ_RValue: JOS.attribute("refQualifier", "&&"); break;
441  case RQ_None: break;
442  }
443  switch (E.ExceptionSpec.Type) {
444  case EST_DynamicNone:
445  case EST_Dynamic: {
446  JOS.attribute("exceptionSpec", "throw");
447  llvm::json::Array Types;
448  for (QualType QT : E.ExceptionSpec.Exceptions)
449  Types.push_back(createQualType(QT));
450  JOS.attribute("exceptionTypes", std::move(Types));
451  } break;
452  case EST_MSAny:
453  JOS.attribute("exceptionSpec", "throw");
454  JOS.attribute("throwsAny", true);
455  break;
456  case EST_BasicNoexcept:
457  JOS.attribute("exceptionSpec", "noexcept");
458  break;
459  case EST_NoexceptTrue:
460  case EST_NoexceptFalse:
461  JOS.attribute("exceptionSpec", "noexcept");
462  JOS.attribute("conditionEvaluatesTo",
464  //JOS.attributeWithCall("exceptionSpecExpr",
465  // [this, E]() { Visit(E.ExceptionSpec.NoexceptExpr); });
466  break;
467  case EST_NoThrow:
468  JOS.attribute("exceptionSpec", "nothrow");
469  break;
470  // FIXME: I cannot find a way to trigger these cases while dumping the AST. I
471  // suspect you can only run into them when executing an AST dump from within
472  // the debugger, which is not a use case we worry about for the JSON dumping
473  // feature.
475  case EST_Unevaluated:
476  case EST_Uninstantiated:
477  case EST_Unparsed:
478  case EST_None: break;
479  }
481 }
482 
484  if (ND && ND->getDeclName())
485  JOS.attribute("name", ND->getNameAsString());
486 }
487 
489  VisitNamedDecl(TD);
490  JOS.attribute("type", createQualType(TD->getUnderlyingType()));
491 }
492 
494  VisitNamedDecl(TAD);
495  JOS.attribute("type", createQualType(TAD->getUnderlyingType()));
496 }
497 
499  VisitNamedDecl(ND);
500  attributeOnlyIfTrue("isInline", ND->isInline());
501  if (!ND->isOriginalNamespace())
502  JOS.attribute("originalNamespace",
503  createBareDeclRef(ND->getOriginalNamespace()));
504 }
505 
507  JOS.attribute("nominatedNamespace",
508  createBareDeclRef(UDD->getNominatedNamespace()));
509 }
510 
512  VisitNamedDecl(NAD);
513  JOS.attribute("aliasedNamespace",
514  createBareDeclRef(NAD->getAliasedNamespace()));
515 }
516 
518  std::string Name;
519  if (const NestedNameSpecifier *NNS = UD->getQualifier()) {
520  llvm::raw_string_ostream SOS(Name);
521  NNS->print(SOS, UD->getASTContext().getPrintingPolicy());
522  }
523  Name += UD->getNameAsString();
524  JOS.attribute("name", Name);
525 }
526 
528  JOS.attribute("target", createBareDeclRef(USD->getTargetDecl()));
529 }
530 
532  VisitNamedDecl(VD);
533  JOS.attribute("type", createQualType(VD->getType()));
534 
535  StorageClass SC = VD->getStorageClass();
536  if (SC != SC_None)
537  JOS.attribute("storageClass", VarDecl::getStorageClassSpecifierString(SC));
538  switch (VD->getTLSKind()) {
539  case VarDecl::TLS_Dynamic: JOS.attribute("tls", "dynamic"); break;
540  case VarDecl::TLS_Static: JOS.attribute("tls", "static"); break;
541  case VarDecl::TLS_None: break;
542  }
543  attributeOnlyIfTrue("nrvo", VD->isNRVOVariable());
544  attributeOnlyIfTrue("inline", VD->isInline());
545  attributeOnlyIfTrue("constexpr", VD->isConstexpr());
546  attributeOnlyIfTrue("modulePrivate", VD->isModulePrivate());
547  if (VD->hasInit()) {
548  switch (VD->getInitStyle()) {
549  case VarDecl::CInit: JOS.attribute("init", "c"); break;
550  case VarDecl::CallInit: JOS.attribute("init", "call"); break;
551  case VarDecl::ListInit: JOS.attribute("init", "list"); break;
552  }
553  }
554  attributeOnlyIfTrue("isParameterPack", VD->isParameterPack());
555 }
556 
558  VisitNamedDecl(FD);
559  JOS.attribute("type", createQualType(FD->getType()));
560  attributeOnlyIfTrue("mutable", FD->isMutable());
561  attributeOnlyIfTrue("modulePrivate", FD->isModulePrivate());
562  attributeOnlyIfTrue("isBitfield", FD->isBitField());
563  attributeOnlyIfTrue("hasInClassInitializer", FD->hasInClassInitializer());
564 }
565 
567  VisitNamedDecl(FD);
568  JOS.attribute("type", createQualType(FD->getType()));
569  StorageClass SC = FD->getStorageClass();
570  if (SC != SC_None)
571  JOS.attribute("storageClass", VarDecl::getStorageClassSpecifierString(SC));
572  attributeOnlyIfTrue("inline", FD->isInlineSpecified());
573  attributeOnlyIfTrue("virtual", FD->isVirtualAsWritten());
574  attributeOnlyIfTrue("pure", FD->isPure());
575  attributeOnlyIfTrue("explicitlyDeleted", FD->isDeletedAsWritten());
576  attributeOnlyIfTrue("constexpr", FD->isConstexpr());
577  attributeOnlyIfTrue("variadic", FD->isVariadic());
578 
579  if (FD->isDefaulted())
580  JOS.attribute("explicitlyDefaulted",
581  FD->isDeleted() ? "deleted" : "default");
582 }
583 
585  VisitNamedDecl(ED);
586  if (ED->isFixed())
587  JOS.attribute("fixedUnderlyingType", createQualType(ED->getIntegerType()));
588  if (ED->isScoped())
589  JOS.attribute("scopedEnumTag",
590  ED->isScopedUsingClassTag() ? "class" : "struct");
591 }
593  VisitNamedDecl(ECD);
594  JOS.attribute("type", createQualType(ECD->getType()));
595 }
596 
598  VisitNamedDecl(RD);
599  JOS.attribute("tagUsed", RD->getKindName());
600  attributeOnlyIfTrue("completeDefinition", RD->isCompleteDefinition());
601 }
603  VisitRecordDecl(RD);
604 
605  // All other information requires a complete definition.
606  if (!RD->isCompleteDefinition())
607  return;
608 
609  JOS.attribute("definitionData", createCXXRecordDefinitionData(RD));
610  if (RD->getNumBases()) {
611  JOS.attributeArray("bases", [this, RD] {
612  for (const auto &Spec : RD->bases())
613  JOS.value(createCXXBaseSpecifier(Spec));
614  });
615  }
616 }
617 
619  VisitNamedDecl(D);
620  JOS.attribute("tagUsed", D->wasDeclaredWithTypename() ? "typename" : "class");
621  JOS.attribute("depth", D->getDepth());
622  JOS.attribute("index", D->getIndex());
623  attributeOnlyIfTrue("isParameterPack", D->isParameterPack());
624 }
625 
627  const NonTypeTemplateParmDecl *D) {
628  VisitNamedDecl(D);
629  JOS.attribute("type", createQualType(D->getType()));
630  JOS.attribute("depth", D->getDepth());
631  JOS.attribute("index", D->getIndex());
632  attributeOnlyIfTrue("isParameterPack", D->isParameterPack());
633 }
634 
636  const TemplateTemplateParmDecl *D) {
637  VisitNamedDecl(D);
638  JOS.attribute("depth", D->getDepth());
639  JOS.attribute("index", D->getIndex());
640  attributeOnlyIfTrue("isParameterPack", D->isParameterPack());
641 }
642 
644  StringRef Lang;
645  switch (LSD->getLanguage()) {
646  case LinkageSpecDecl::lang_c: Lang = "C"; break;
647  case LinkageSpecDecl::lang_cxx: Lang = "C++"; break;
648  }
649  JOS.attribute("language", Lang);
650  attributeOnlyIfTrue("hasBraces", LSD->hasBraces());
651 }
652 
654  JOS.attribute("access", createAccessSpecifier(ASD->getAccess()));
655 }
656 
658  if (const TypeSourceInfo *T = FD->getFriendType())
659  JOS.attribute("type", createQualType(T->getType()));
660 }
661 
663  VisitNamedDecl(D);
664  JOS.attribute("type", createQualType(D->getType()));
665  attributeOnlyIfTrue("synthesized", D->getSynthesize());
666  switch (D->getAccessControl()) {
667  case ObjCIvarDecl::None: JOS.attribute("access", "none"); break;
668  case ObjCIvarDecl::Private: JOS.attribute("access", "private"); break;
669  case ObjCIvarDecl::Protected: JOS.attribute("access", "protected"); break;
670  case ObjCIvarDecl::Public: JOS.attribute("access", "public"); break;
671  case ObjCIvarDecl::Package: JOS.attribute("access", "package"); break;
672  }
673 }
674 
676  VisitNamedDecl(D);
677  JOS.attribute("returnType", createQualType(D->getReturnType()));
678  JOS.attribute("instance", D->isInstanceMethod());
679  attributeOnlyIfTrue("variadic", D->isVariadic());
680 }
681 
683  VisitNamedDecl(D);
684  JOS.attribute("type", createQualType(D->getUnderlyingType()));
685  attributeOnlyIfTrue("bounded", D->hasExplicitBound());
686  switch (D->getVariance()) {
688  break;
690  JOS.attribute("variance", "covariant");
691  break;
693  JOS.attribute("variance", "contravariant");
694  break;
695  }
696 }
697 
699  VisitNamedDecl(D);
700  JOS.attribute("interface", createBareDeclRef(D->getClassInterface()));
701  JOS.attribute("implementation", createBareDeclRef(D->getImplementation()));
702 
703  llvm::json::Array Protocols;
704  for (const auto* P : D->protocols())
705  Protocols.push_back(createBareDeclRef(P));
706  if (!Protocols.empty())
707  JOS.attribute("protocols", std::move(Protocols));
708 }
709 
711  VisitNamedDecl(D);
712  JOS.attribute("interface", createBareDeclRef(D->getClassInterface()));
713  JOS.attribute("categoryDecl", createBareDeclRef(D->getCategoryDecl()));
714 }
715 
717  VisitNamedDecl(D);
718 
719  llvm::json::Array Protocols;
720  for (const auto *P : D->protocols())
721  Protocols.push_back(createBareDeclRef(P));
722  if (!Protocols.empty())
723  JOS.attribute("protocols", std::move(Protocols));
724 }
725 
727  VisitNamedDecl(D);
728  JOS.attribute("super", createBareDeclRef(D->getSuperClass()));
729  JOS.attribute("implementation", createBareDeclRef(D->getImplementation()));
730 
731  llvm::json::Array Protocols;
732  for (const auto* P : D->protocols())
733  Protocols.push_back(createBareDeclRef(P));
734  if (!Protocols.empty())
735  JOS.attribute("protocols", std::move(Protocols));
736 }
737 
739  const ObjCImplementationDecl *D) {
740  VisitNamedDecl(D);
741  JOS.attribute("super", createBareDeclRef(D->getSuperClass()));
742  JOS.attribute("interface", createBareDeclRef(D->getClassInterface()));
743 }
744 
746  const ObjCCompatibleAliasDecl *D) {
747  VisitNamedDecl(D);
748  JOS.attribute("interface", createBareDeclRef(D->getClassInterface()));
749 }
750 
752  VisitNamedDecl(D);
753  JOS.attribute("type", createQualType(D->getType()));
754 
755  switch (D->getPropertyImplementation()) {
756  case ObjCPropertyDecl::None: break;
757  case ObjCPropertyDecl::Required: JOS.attribute("control", "required"); break;
758  case ObjCPropertyDecl::Optional: JOS.attribute("control", "optional"); break;
759  }
760 
762  if (Attrs != ObjCPropertyDecl::OBJC_PR_noattr) {
764  JOS.attribute("getter", createBareDeclRef(D->getGetterMethodDecl()));
766  JOS.attribute("setter", createBareDeclRef(D->getSetterMethodDecl()));
767  attributeOnlyIfTrue("readonly", Attrs & ObjCPropertyDecl::OBJC_PR_readonly);
768  attributeOnlyIfTrue("assign", Attrs & ObjCPropertyDecl::OBJC_PR_assign);
769  attributeOnlyIfTrue("readwrite",
771  attributeOnlyIfTrue("retain", Attrs & ObjCPropertyDecl::OBJC_PR_retain);
772  attributeOnlyIfTrue("copy", Attrs & ObjCPropertyDecl::OBJC_PR_copy);
773  attributeOnlyIfTrue("nonatomic",
775  attributeOnlyIfTrue("atomic", Attrs & ObjCPropertyDecl::OBJC_PR_atomic);
776  attributeOnlyIfTrue("weak", Attrs & ObjCPropertyDecl::OBJC_PR_weak);
777  attributeOnlyIfTrue("strong", Attrs & ObjCPropertyDecl::OBJC_PR_strong);
778  attributeOnlyIfTrue("unsafe_unretained",
780  attributeOnlyIfTrue("class", Attrs & ObjCPropertyDecl::OBJC_PR_class);
781  attributeOnlyIfTrue("nullability",
783  attributeOnlyIfTrue("null_resettable",
785  }
786 }
787 
790  JOS.attribute("implKind", D->getPropertyImplementation() ==
792  ? "synthesize"
793  : "dynamic");
794  JOS.attribute("propertyDecl", createBareDeclRef(D->getPropertyDecl()));
795  JOS.attribute("ivarDecl", createBareDeclRef(D->getPropertyIvarDecl()));
796 }
797 
799  attributeOnlyIfTrue("variadic", D->isVariadic());
800  attributeOnlyIfTrue("capturesThis", D->capturesCXXThis());
801 }
802 
804  JOS.attribute("referencedDecl", createBareDeclRef(DRE->getDecl()));
805  if (DRE->getDecl() != DRE->getFoundDecl())
806  JOS.attribute("foundReferencedDecl",
807  createBareDeclRef(DRE->getFoundDecl()));
808  switch (DRE->isNonOdrUse()) {
809  case NOUR_None: break;
810  case NOUR_Unevaluated: JOS.attribute("nonOdrUseReason", "unevaluated"); break;
811  case NOUR_Constant: JOS.attribute("nonOdrUseReason", "constant"); break;
812  case NOUR_Discarded: JOS.attribute("nonOdrUseReason", "discarded"); break;
813  }
814 }
815 
817  JOS.attribute("name", PredefinedExpr::getIdentKindName(PE->getIdentKind()));
818 }
819 
821  JOS.attribute("isPostfix", UO->isPostfix());
822  JOS.attribute("opcode", UnaryOperator::getOpcodeStr(UO->getOpcode()));
823  if (!UO->canOverflow())
824  JOS.attribute("canOverflow", false);
825 }
826 
828  JOS.attribute("opcode", BinaryOperator::getOpcodeStr(BO->getOpcode()));
829 }
830 
832  const CompoundAssignOperator *CAO) {
833  VisitBinaryOperator(CAO);
834  JOS.attribute("computeLHSType", createQualType(CAO->getComputationLHSType()));
835  JOS.attribute("computeResultType",
836  createQualType(CAO->getComputationResultType()));
837 }
838 
840  // Note, we always write this Boolean field because the information it conveys
841  // is critical to understanding the AST node.
842  ValueDecl *VD = ME->getMemberDecl();
843  JOS.attribute("name", VD && VD->getDeclName() ? VD->getNameAsString() : "");
844  JOS.attribute("isArrow", ME->isArrow());
845  JOS.attribute("referencedMemberDecl", createPointerRepresentation(VD));
846  switch (ME->isNonOdrUse()) {
847  case NOUR_None: break;
848  case NOUR_Unevaluated: JOS.attribute("nonOdrUseReason", "unevaluated"); break;
849  case NOUR_Constant: JOS.attribute("nonOdrUseReason", "constant"); break;
850  case NOUR_Discarded: JOS.attribute("nonOdrUseReason", "discarded"); break;
851  }
852 }
853 
855  attributeOnlyIfTrue("isGlobal", NE->isGlobalNew());
856  attributeOnlyIfTrue("isArray", NE->isArray());
857  attributeOnlyIfTrue("isPlacement", NE->getNumPlacementArgs() != 0);
858  switch (NE->getInitializationStyle()) {
859  case CXXNewExpr::NoInit: break;
860  case CXXNewExpr::CallInit: JOS.attribute("initStyle", "call"); break;
861  case CXXNewExpr::ListInit: JOS.attribute("initStyle", "list"); break;
862  }
863  if (const FunctionDecl *FD = NE->getOperatorNew())
864  JOS.attribute("operatorNewDecl", createBareDeclRef(FD));
865  if (const FunctionDecl *FD = NE->getOperatorDelete())
866  JOS.attribute("operatorDeleteDecl", createBareDeclRef(FD));
867 }
869  attributeOnlyIfTrue("isGlobal", DE->isGlobalDelete());
870  attributeOnlyIfTrue("isArray", DE->isArrayForm());
871  attributeOnlyIfTrue("isArrayAsWritten", DE->isArrayFormAsWritten());
872  if (const FunctionDecl *FD = DE->getOperatorDelete())
873  JOS.attribute("operatorDeleteDecl", createBareDeclRef(FD));
874 }
875 
877  attributeOnlyIfTrue("implicit", TE->isImplicit());
878 }
879 
881  JOS.attribute("castKind", CE->getCastKindName());
882  llvm::json::Array Path = createCastPath(CE);
883  if (!Path.empty())
884  JOS.attribute("path", std::move(Path));
885  // FIXME: This may not be useful information as it can be obtusely gleaned
886  // from the inner[] array.
887  if (const NamedDecl *ND = CE->getConversionFunction())
888  JOS.attribute("conversionFunc", createBareDeclRef(ND));
889 }
890 
892  VisitCastExpr(ICE);
893  attributeOnlyIfTrue("isPartOfExplicitCast", ICE->isPartOfExplicitCast());
894 }
895 
897  attributeOnlyIfTrue("adl", CE->usesADL());
898 }
899 
901  const UnaryExprOrTypeTraitExpr *TTE) {
902  switch (TTE->getKind()) {
903  case UETT_SizeOf: JOS.attribute("name", "sizeof"); break;
904  case UETT_AlignOf: JOS.attribute("name", "alignof"); break;
905  case UETT_VecStep: JOS.attribute("name", "vec_step"); break;
906  case UETT_PreferredAlignOf: JOS.attribute("name", "__alignof"); break;
908  JOS.attribute("name", "__builtin_omp_required_simd_align"); break;
909  }
910  if (TTE->isArgumentType())
911  JOS.attribute("argType", createQualType(TTE->getArgumentType()));
912 }
913 
915  VisitNamedDecl(SOPE->getPack());
916 }
917 
919  const UnresolvedLookupExpr *ULE) {
920  JOS.attribute("usesADL", ULE->requiresADL());
921  JOS.attribute("name", ULE->getName().getAsString());
922 
923  JOS.attributeArray("lookups", [this, ULE] {
924  for (const NamedDecl *D : ULE->decls())
925  JOS.value(createBareDeclRef(D));
926  });
927 }
928 
930  JOS.attribute("name", ALE->getLabel()->getName());
931  JOS.attribute("labelDeclId", createPointerRepresentation(ALE->getLabel()));
932 }
933 
935  if (CTE->isTypeOperand()) {
936  QualType Adjusted = CTE->getTypeOperand(Ctx);
937  QualType Unadjusted = CTE->getTypeOperandSourceInfo()->getType();
938  JOS.attribute("typeArg", createQualType(Unadjusted));
939  if (Adjusted != Unadjusted)
940  JOS.attribute("adjustedTypeArg", createQualType(Adjusted));
941  }
942 }
943 
945  JOS.attribute("value",
946  IL->getValue().toString(
947  /*Radix=*/10, IL->getType()->isSignedIntegerType()));
948 }
950  // FIXME: This should probably print the character literal as a string,
951  // rather than as a numerical value. It would be nice if the behavior matched
952  // what we do to print a string literal; right now, it is impossible to tell
953  // the difference between 'a' and L'a' in C from the JSON output.
954  JOS.attribute("value", CL->getValue());
955 }
957  JOS.attribute("value", FPL->getValueAsString(/*Radix=*/10));
958 }
960  JOS.attribute("value", FL->getValueAsApproximateDouble());
961 }
963  std::string Buffer;
964  llvm::raw_string_ostream SS(Buffer);
965  SL->outputString(SS);
966  JOS.attribute("value", SS.str());
967 }
969  JOS.attribute("value", BLE->getValue());
970 }
971 
973  attributeOnlyIfTrue("hasInit", IS->hasInitStorage());
974  attributeOnlyIfTrue("hasVar", IS->hasVarStorage());
975  attributeOnlyIfTrue("hasElse", IS->hasElseStorage());
976  attributeOnlyIfTrue("isConstexpr", IS->isConstexpr());
977 }
978 
980  attributeOnlyIfTrue("hasInit", SS->hasInitStorage());
981  attributeOnlyIfTrue("hasVar", SS->hasVarStorage());
982 }
984  attributeOnlyIfTrue("isGNURange", CS->caseStmtIsGNURange());
985 }
986 
988  JOS.attribute("name", LS->getName());
989  JOS.attribute("declId", createPointerRepresentation(LS->getDecl()));
990 }
992  JOS.attribute("targetLabelDeclId",
993  createPointerRepresentation(GS->getLabel()));
994 }
995 
997  attributeOnlyIfTrue("hasVar", WS->hasVarStorage());
998 }
999 
1001  // FIXME: it would be nice for the ASTNodeTraverser would handle the catch
1002  // parameter the same way for C++ and ObjC rather. In this case, C++ gets a
1003  // null child node and ObjC gets no child node.
1004  attributeOnlyIfTrue("isCatchAll", OACS->getCatchParamDecl() == nullptr);
1005 }
1006 
1007 StringRef JSONNodeDumper::getCommentCommandName(unsigned CommandID) const {
1008  if (Traits)
1009  return Traits->getCommandInfo(CommandID)->Name;
1010  if (const comments::CommandInfo *Info =
1012  return Info->Name;
1013  return "<invalid>";
1014 }
1015 
1017  const comments::FullComment *) {
1018  JOS.attribute("text", C->getText());
1019 }
1020 
1023  JOS.attribute("name", getCommentCommandName(C->getCommandID()));
1024 
1025  switch (C->getRenderKind()) {
1027  JOS.attribute("renderKind", "normal");
1028  break;
1030  JOS.attribute("renderKind", "bold");
1031  break;
1033  JOS.attribute("renderKind", "emphasized");
1034  break;
1036  JOS.attribute("renderKind", "monospaced");
1037  break;
1038  }
1039 
1040  llvm::json::Array Args;
1041  for (unsigned I = 0, E = C->getNumArgs(); I < E; ++I)
1042  Args.push_back(C->getArgText(I));
1043 
1044  if (!Args.empty())
1045  JOS.attribute("args", std::move(Args));
1046 }
1047 
1050  JOS.attribute("name", C->getTagName());
1051  attributeOnlyIfTrue("selfClosing", C->isSelfClosing());
1052  attributeOnlyIfTrue("malformed", C->isMalformed());
1053 
1054  llvm::json::Array Attrs;
1055  for (unsigned I = 0, E = C->getNumAttrs(); I < E; ++I)
1056  Attrs.push_back(
1057  {{"name", C->getAttr(I).Name}, {"value", C->getAttr(I).Value}});
1058 
1059  if (!Attrs.empty())
1060  JOS.attribute("attrs", std::move(Attrs));
1061 }
1062 
1065  JOS.attribute("name", C->getTagName());
1066 }
1067 
1070  JOS.attribute("name", getCommentCommandName(C->getCommandID()));
1071 
1072  llvm::json::Array Args;
1073  for (unsigned I = 0, E = C->getNumArgs(); I < E; ++I)
1074  Args.push_back(C->getArgText(I));
1075 
1076  if (!Args.empty())
1077  JOS.attribute("args", std::move(Args));
1078 }
1079 
1082  switch (C->getDirection()) {
1084  JOS.attribute("direction", "in");
1085  break;
1087  JOS.attribute("direction", "out");
1088  break;
1090  JOS.attribute("direction", "in,out");
1091  break;
1092  }
1093  attributeOnlyIfTrue("explicit", C->isDirectionExplicit());
1094 
1095  if (C->hasParamName())
1096  JOS.attribute("param", C->isParamIndexValid() ? C->getParamName(FC)
1097  : C->getParamNameAsWritten());
1098 
1099  if (C->isParamIndexValid() && !C->isVarArgParam())
1100  JOS.attribute("paramIdx", C->getParamIndex());
1101 }
1102 
1105  if (C->hasParamName())
1106  JOS.attribute("param", C->isPositionValid() ? C->getParamName(FC)
1107  : C->getParamNameAsWritten());
1108  if (C->isPositionValid()) {
1109  llvm::json::Array Positions;
1110  for (unsigned I = 0, E = C->getDepth(); I < E; ++I)
1111  Positions.push_back(C->getIndex(I));
1112 
1113  if (!Positions.empty())
1114  JOS.attribute("positions", std::move(Positions));
1115  }
1116 }
1117 
1120  JOS.attribute("name", getCommentCommandName(C->getCommandID()));
1121  JOS.attribute("closeName", C->getCloseName());
1122 }
1123 
1126  const comments::FullComment *) {
1127  JOS.attribute("text", C->getText());
1128 }
1129 
1132  JOS.attribute("text", C->getText());
1133 }
void VisitFieldDecl(const FieldDecl *FD)
void VisitObjCProtocolDecl(const ObjCProtocolDecl *D)
bool isBaseInitializer() const
Determine whether this initializer is initializing a base class.
Definition: DeclCXX.h:2402
bool path_empty() const
Definition: Expr.h:3193
NamedDecl * getTargetDecl() const
Gets the underlying declaration which has been brought into the local scope.
Definition: DeclCXX.h:3324
Represents a function declaration or definition.
Definition: Decl.h:1748
NamedDecl * getFoundDecl()
Get the NamedDecl through which this reference occurred.
Definition: Expr.h:1256
bool isVarArgParam() const LLVM_READONLY
Definition: Comment.h:776
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:3890
StringRef getArgText(unsigned Idx) const
Definition: Comment.h:672
A (possibly-)qualified type.
Definition: Type.h:643
const char * getDeclKindName() const
Definition: DeclBase.cpp:122
base_class_range bases()
Definition: DeclCXX.h:823
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:2892
void VisitFloatingLiteral(const FloatingLiteral *FL)
ObjCInterfaceDecl * getClassInterface()
Definition: DeclObjC.h:2324
unsigned getNumBases() const
Retrieves the number of base classes of this class.
Definition: DeclCXX.h:817
ObjCIvarDecl * getPropertyIvarDecl() const
Definition: DeclObjC.h:2826
bool hasVarStorage() const
True if this IfStmt has storage for a variable declaration.
Definition: Stmt.h:1860
void VisitCXXNewExpr(const CXXNewExpr *NE)
bool isPositionValid() const LLVM_READONLY
Definition: Comment.h:842
Stmt - This represents one statement.
Definition: Stmt.h:66
FunctionType - C99 6.7.5.3 - Function Declarators.
Definition: Type.h:3372
bool isArrayFormAsWritten() const
Definition: ExprCXX.h:2288
IfStmt - This represents an if/then/else.
Definition: Stmt.h:1790
void VisitUsingDecl(const UsingDecl *UD)
An instance of this object exists for each enum constant that is defined.
Definition: Decl.h:2812
StorageClass getStorageClass() const
Returns the storage class as written in the source.
Definition: Decl.h:1019
Represents the declaration of a typedef-name via the &#39;typedef&#39; type specifier.
Definition: Decl.h:3044
bool isConstexpr() const
Whether this is a (C++11) constexpr function or constexpr constructor.
Definition: Decl.h:2108
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:1191
FunctionDecl * getOperatorNew() const
Definition: ExprCXX.h:2119
bool isVirtual() const
Determines whether the base class is a virtual base class (or not).
Definition: DeclCXX.h:245
A reference to a name which we were able to look up during parsing but could not resolve to a specifi...
Definition: ExprCXX.h:2938
Opcode getOpcode() const
Definition: Expr.h:3442
SourceLocation getLocation() const LLVM_READONLY
Definition: Comment.h:221
The base class of the type hierarchy.
Definition: Type.h:1418
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)
Represent a C++ namespace.
Definition: Decl.h:514
void Visit(const Type *T)
Performs the operation associated with this visitor object.
Definition: TypeVisitor.h:68
AccessSpecifier
A C++ access specifier (public, private, protected), plus the special value "none" which means differ...
Definition: Specifiers.h:112
StringRef getParamName(const FullComment *FC) const
Definition: Comment.cpp:356
A container of type source information.
Definition: Decl.h:86
bool hasVarStorage() const
True if this SwitchStmt has storage for a condition variable.
Definition: Stmt.h:2053
IdentKind getIdentKind() const
Definition: Expr.h:1923
void visitTextComment(const comments::TextComment *C, const comments::FullComment *)
void VisitWhileStmt(const WhileStmt *WS)
bool isVirtualAsWritten() const
Whether this function is marked as virtual explicitly.
Definition: Decl.h:2014
bool needsOverloadResolutionForCopyConstructor() const
Determine whether we need to eagerly declare a defaulted copy constructor for this class...
Definition: DeclCXX.h:1008
bool hasInClassInitializer() const
Determine whether this member has a C++11 default member initializer.
Definition: Decl.h:2740
This name appears in an unevaluated operand.
Definition: Specifiers.h:163
bool isCompleteDefinition() const
Return true if this decl has its body fully specified.
Definition: Decl.h:3195
void VisitUnaryExprOrTypeTraitExpr(const UnaryExprOrTypeTraitExpr *TTE)
void VisitDeclRefExpr(const DeclRefExpr *DRE)
unsigned getDepth() const
Get the nesting depth of the template parameter.
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
Represents a variable declaration or definition.
Definition: Decl.h:812
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:3555
const T * getAs() const
Member-template getAs<specific type>&#39;.
Definition: Type.h:6818
ObjCCategoryImplDecl * getImplementation() const
Definition: DeclObjC.cpp:2019
Extra information about a function prototype.
Definition: Type.h:3784
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:2050
DeclarationName getName() const
Gets the name looked up.
Definition: ExprCXX.h:2854
bool isConst() const
Definition: Type.h:3647
const char * getName() const
Definition: Stmt.cpp:340
bool isInvalidDecl() const
Definition: DeclBase.h:553
unsigned getNumPlacementArgs() const
Definition: ExprCXX.h:2137
bool requiresADL() const
True if this declaration should be extended by argument-dependent lookup.
Definition: ExprCXX.h:3006
Not a TLS variable.
Definition: Decl.h:829
unsigned getIndex(unsigned Depth) const
Definition: Comment.h:851
protocol_range protocols() const
Definition: DeclObjC.h:2128
noexcept(expression), value-dependent
void VisitObjCIvarDecl(const ObjCIvarDecl *D)
const ObjCInterfaceDecl * getSuperClass() const
Definition: DeclObjC.h:2688
Information about a single command.
const char * getStmtClassName() const
Definition: Stmt.cpp:74
LabelStmt - Represents a label, which has a substatement.
Definition: Stmt.h:1688
Represents a struct/union/class.
Definition: Decl.h:3619
LanguageIDs getLanguage() const
Return the language specified by this linkage specification.
Definition: DeclCXX.h:2983
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.
QualType getComputationResultType() const
Definition: Expr.h:3653
unsigned getRegParm() const
Definition: Type.h:3535
bool isImplicit() const
Returns true if the attribute has been implicitly created instead of explicitly written by the user...
Definition: Attr.h:101
bool isInline() const
Returns true if this is an inline namespace declaration.
Definition: Decl.h:575
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 ...
Represents a member of a struct/union/class.
Definition: Decl.h:2605
TypeSourceInfo * getTypeSourceInfo() const
Returns the declarator information for a base class or delegating initializer.
Definition: DeclCXX.h:2463
StringRef getText() const LLVM_READONLY
Definition: Comment.h:883
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)
int Category
Definition: Format.cpp:1712
Represents an access specifier followed by colon &#39;:&#39;.
Definition: DeclCXX.h:132
void VisitObjCCompatibleAliasDecl(const ObjCCompatibleAliasDecl *D)
An r-value expression (a pr-value in the C++11 taxonomy) produces a temporary value.
Definition: Specifiers.h:124
void VisitUnaryOperator(const UnaryOperator *UO)
Represents Objective-C&#39;s @catch statement.
Definition: StmtObjC.h:77
void VisitAccessSpecDecl(const AccessSpecDecl *ASD)
bool getProducesResult() const
Definition: Type.h:3530
StringRef getOpcodeStr() const
Definition: Expr.h:3463
A command with word-like arguments that is considered inline content.
Definition: Comment.h:298
A C++ typeid expression (C++ [expr.typeid]), which gets the type_info that corresponds to the supplie...
Definition: ExprCXX.h:668
Represents a C++ using-declaration.
Definition: DeclCXX.h:3475
static llvm::json::Object createMoveAssignmentDefinitionData(const CXXRecordDecl *RD)
AssociationTy< true > ConstAssociation
Definition: Expr.h:5358
bool isBitField() const
Determines whether this field is a bitfield.
Definition: Decl.h:2683
void VisitSizeOfPackExpr(const SizeOfPackExpr *SOPE)
An lvalue ref-qualifier was provided (&).
Definition: Type.h:1374
A line of text contained in a verbatim block.
Definition: Comment.h:863
FunctionDecl * getOperatorDelete() const
Definition: ExprCXX.h:2300
void VisitTemplateTypeParmDecl(const TemplateTypeParmDecl *D)
void VisitCharacterLiteral(const CharacterLiteral *CL)
bool isGlobalNew() const
Definition: ExprCXX.h:2160
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:272
LabelDecl * getDecl() const
Definition: Stmt.h:1705
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:133
path_iterator path_begin()
Definition: Expr.h:3195
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
const clang::PrintingPolicy & getPrintingPolicy() const
Definition: ASTContext.h:657
bool isByRef() const
Whether this is a "by ref" capture, i.e.
Definition: Decl.h:3915
bool containsUnexpandedParameterPack() const
Whether this type is or contains an unexpanded parameter pack, used to support C++0x variadic templat...
Definition: Type.h:1844
void VisitObjCAtCatchStmt(const ObjCAtCatchStmt *OACS)
A builtin binary operation expression such as "x + y" or "x <= y".
Definition: Expr.h:3407
static bool isPostfix(Opcode Op)
isPostfix - Return true if this is a postfix operation, like x++.
Definition: Expr.h:2065
Any part of the comment.
Definition: Comment.h:52
bool hasElseStorage() const
True if this IfStmt has storage for an else statement.
Definition: Stmt.h:1863
bool isArrow() const
Definition: Expr.h:2993
bool isConstexpr() const
Whether this variable is (C++11) constexpr.
Definition: Decl.h:1386
void VisitImplicitCastExpr(const ImplicitCastExpr *ICE)
New-expression has a C++98 paren-delimited initializer.
Definition: ExprCXX.h:2057
void VisitIntegerLiteral(const IntegerLiteral *IL)
void VisitObjCPropertyImplDecl(const ObjCPropertyImplDecl *D)
CaseStmt - Represent a case statement.
Definition: Stmt.h:1456
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:2410
CastExpr - Base class for type casts, including both implicit casts (ImplicitCastExpr) and explicit c...
Definition: Expr.h:3123
Represents an Objective-C protocol declaration.
Definition: DeclObjC.h:2063
unsigned getParamIndex() const LLVM_READONLY
Definition: Comment.h:785
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. ...
FieldDecl * getAnyMember() const
Definition: DeclCXX.h:2475
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 an ObjC class declaration.
Definition: DeclObjC.h:1171
This is an odr-use.
Definition: Specifiers.h:161
Represents a linkage specification.
Definition: DeclCXX.h:2949
QualType getReturnType() const
Definition: DeclObjC.h:322
bool getNoReturn() const
Definition: Type.h:3529
void VisitIfStmt(const IfStmt *IS)
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 the this expression in C++.
Definition: ExprCXX.h:1001
New-expression has no initializer as written.
Definition: ExprCXX.h:2054
bool isArrayForm() const
Definition: ExprCXX.h:2287
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:2992
StringRef getText() const LLVM_READONLY
Definition: Comment.h:282
Represents the declaration of a typedef-name via a C++11 alias-declaration.
Definition: Decl.h:3064
Represents a prototype with parameter type info, e.g.
Definition: Type.h:3704
void VisitRecordDecl(const RecordDecl *RD)
QualType getComputationLHSType() const
Definition: Expr.h:3650
bool isDelegatingInitializer() const
Determine whether this initializer is creating a delegating constructor.
Definition: DeclCXX.h:2430
UnaryExprOrTypeTraitExpr - expression with either a type or (unevaluated) expression operand...
Definition: Expr.h:2344
bool isParameterPack() const
Whether this parameter is a non-type template parameter pack.
bool isConstexpr() const
Definition: Stmt.h:1963
void outputString(raw_ostream &OS) const
Definition: Expr.cpp:1074
unsigned getValue() const
Definition: Expr.h:1536
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:2377
void visitVerbatimBlockComment(const comments::VerbatimBlockComment *C, const comments::FullComment *)
Represents a block literal declaration, which is like an unnamed FunctionDecl.
Definition: Decl.h:3884
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
Definition: Decl.h:636
StringRef getKindName() const
Definition: Decl.h:3265
void VisitCaseStmt(const CaseStmt *CS)
bool isVariadic() const
Whether this function is variadic.
Definition: Decl.cpp:2766
bool isDefaulted() const
Whether this function is defaulted per C++0x.
Definition: Decl.h:2048
bool isInvalid() const
Return true if this object is invalid or uninitialized.
std::string Label
bool isScopedUsingClassTag() const
Returns true if this is a C++11 scoped enumeration.
Definition: Decl.h:3549
Declaration of a template type parameter.
bool getHasRegParm() const
Definition: Type.h:3533
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:3033
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:166
New-expression has a C++11 list-initializer.
Definition: ExprCXX.h:2060
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:2733
void VisitFunctionProtoType(const FunctionProtoType *T)
QualType getArgumentType() const
Definition: Expr.h:2381
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
ObjCInterfaceDecl * getSuperClass() const
Definition: DeclObjC.cpp:337
TLSKind getTLSKind() const
Definition: Decl.cpp:1970
Represents an expression that computes the length of a parameter pack.
Definition: ExprCXX.h:3992
StorageClass getStorageClass() const
Returns the storage class as written in the source.
Definition: Decl.h:2366
NonTypeTemplateParmDecl - Declares a non-type template parameter, e.g., "Size" in.
static llvm::json::Object createDestructorDefinitionData(const CXXRecordDecl *RD)
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:1875
QualType getType() const
Definition: Expr.h:137
StorageClass
Storage classes.
Definition: Specifiers.h:234
void VisitBinaryOperator(const BinaryOperator *BO)
Direct list-initialization (C++11)
Definition: Decl.h:823
Qualifiers Quals
The local qualifiers.
Definition: Type.h:587
bool isDirectionExplicit() const LLVM_READONLY
Definition: Comment.h:749
LabelDecl * getLabel() const
Definition: Stmt.h:2446
Represents an unpacked "presumed" location which can be presented to the user.
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:2018
bool isInstanceMethod() const
Definition: DeclObjC.h:421
An opening HTML tag with attributes.
Definition: Comment.h:413
QualType getTypeOperand(ASTContext &Context) const
Retrieves the type operand of this typeid() expression after various required adjustments (removing r...
Definition: ExprCXX.cpp:76
TemplateTemplateParmDecl - Declares a template template parameter, e.g., "T" in.
ValueDecl * getDecl()
Definition: Expr.h:1219
std::string getAsString() const
static QualType Desugar(ASTContext &Context, QualType QT, bool &ShouldAKA)
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:1283
void VisitNonTypeTemplateParmDecl(const NonTypeTemplateParmDecl *D)
QualType getType() const
Definition: DeclObjC.h:828
bool getValue() const
Definition: ExprCXX.h:561
SplitQualType split() const
Divides a QualType into its unqualified type and a set of local qualifiers.
Definition: Type.h:6135
const char * getFilename() const
Return the presumed filename of this location.
noexcept(expression), evals to &#39;false&#39;
void visitInlineCommandComment(const comments::InlineCommandComment *C, const comments::FullComment *)
static StringRef getIdentKindName(IdentKind IK)
Definition: Expr.cpp:617
ExceptionSpecificationType Type
The kind of exception specification this is.
Definition: Type.h:3760
ExtProtoInfo getExtProtoInfo() const
Definition: Type.h:3917
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
bool isPure() const
Whether this virtual function is pure, i.e.
Definition: Decl.h:2023
bool hasVarStorage() const
True if this WhileStmt has storage for a condition variable.
Definition: Stmt.h:2225
void VisitUnresolvedLookupExpr(const UnresolvedLookupExpr *ULE)
bool isVariablyModifiedType() const
Whether this type is a variably-modified type (C99 6.7.5).
Definition: Type.h:2109
static llvm::json::Object createDefaultConstructorDefinitionData(const CXXRecordDecl *RD)
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:2000
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)
SourceRange getSourceRange() const LLVM_READONLY
Definition: Comment.h:215
ASTContext & getASTContext() const LLVM_READONLY
Definition: DeclBase.cpp:376
CallingConv getCC() const
Definition: Type.h:3542
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:3649
std::string getValueAsString(unsigned Radix) const
Definition: Expr.cpp:926
void VisitFixedPointLiteral(const FixedPointLiteral *FPL)
bool canOverflow() const
Returns true if the unary operator can cause an overflow.
Definition: Expr.h:2061
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
void VisitUsingDirectiveDecl(const UsingDirectiveDecl *UDD)
No ref-qualifier was provided.
Definition: Type.h:1371
C-style initialization with assignment.
Definition: Decl.h:817
bool isPackExpansion() const
Determine whether this base specifier is a pack expansion.
Definition: DeclCXX.h:252
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:2375
bool isArray() const
Definition: ExprCXX.h:2124
bool isScoped() const
Returns true if this is a C++11 scoped enumeration.
Definition: Decl.h:3546
StringRef getParamNameAsWritten() const
Definition: Comment.h:834
Represents one property declaration in an Objective-C interface.
Definition: DeclObjC.h:728
ImplicitCastExpr - Allows us to explicitly represent implicit type conversions, which have no direct ...
Definition: Expr.h:3247
PassDirection getDirection() const LLVM_READONLY
Definition: Comment.h:745
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:397
bool isOriginalNamespace() const
Return true if this declaration is an original (first) declaration of the namespace.
Definition: DeclCXX.cpp:2685
VarDecl * getVariable() const
The variable being captured.
Definition: Decl.h:3911
void VisitVarDecl(const VarDecl *VD)
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:1377
bool isArgumentType() const
Definition: Expr.h:2380
ObjCImplementationDecl * getImplementation() const
Definition: DeclObjC.cpp:1548
bool isPartOfExplicitCast() const
Definition: Expr.h:3266
std::string getAsString() const
FunctionDecl * getOperatorDelete() const
Definition: ExprCXX.h:2121
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:2099
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:1343
InitializationStyle getInitializationStyle() const
The kind of initializer this new-expression has.
Definition: ExprCXX.h:2168
CompoundAssignOperator - For compound assignments (e.g.
Definition: Expr.h:3627
static const char * getStorageClassSpecifierString(StorageClass SC)
Return the string used to specify the storage class SC.
Definition: Decl.cpp:1922
void VisitMemberExpr(const MemberExpr *ME)
SourceRange getRange() const
Definition: Attr.h:94
void VisitAddrLabelExpr(const AddrLabelExpr *ALE)
AddrLabelExpr - The GNU address of label extension, representing &&label.
Definition: Expr.h:3880
#define FIELD1(Flag)
TLS with a dynamic initializer.
Definition: Decl.h:835
Represents a template argument.
Definition: TemplateBase.h:50
bool isThisDeclarationReferenced() const
Whether this declaration was referenced.
Definition: DeclBase.h:586
This name appears as a potential result of a discarded value expression.
Definition: Specifiers.h:169
const ObjCInterfaceDecl * getClassInterface() const
Definition: DeclObjC.h:2439
bool isTypeOperand() const
Definition: ExprCXX.h:708
NamespaceDecl * getNominatedNamespace()
Returns the namespace nominated by this using-directive.
Definition: DeclCXX.cpp:2640
Dataflow Directional Tag Classes.
ExtInfo getExtInfo() const
Definition: Type.h:3641
not evaluated yet, for special member function
[C99 6.4.2.2] - A predefined identifier such as func.
Definition: Expr.h:1875
void visitVerbatimBlockLineComment(const comments::VerbatimBlockLineComment *C, const comments::FullComment *)
Represents a delete expression for memory deallocation and destructor calls, e.g. ...
Definition: ExprCXX.h:2260
bool isNested() const
Whether this is a nested capture, i.e.
Definition: Decl.h:3927
bool isVariadic() const
Definition: Decl.h:3959
Kind getPropertyImplementation() const
Definition: DeclObjC.h:2822
void VisitSwitchStmt(const SwitchStmt *SS)
void VisitLabelStmt(const LabelStmt *LS)
bool isImplicit() const
Definition: ExprCXX.h:1022
bool hasInitStorage() const
True if this IfStmt has the storage for an init statement.
Definition: Stmt.h:1857
void VisitCXXTypeidExpr(const CXXTypeidExpr *CTE)
QualType getUnderlyingType() const
Definition: Decl.h:2997
AccessSpecifier getAccess() const
Definition: DeclBase.h:473
NamespaceDecl * getOriginalNamespace()
Get the original (first) namespace declaration.
Definition: DeclCXX.cpp:2671
unsigned getIndex() const
Retrieve the index of the template parameter.
bool usesADL() const
Definition: Expr.h:2646
void VisitTypedefDecl(const TypedefDecl *TD)
Represents the declaration of an Objective-C type parameter.
Definition: DeclObjC.h:558
void VisitCallExpr(const CallExpr *CE)
Kind getKind() const
Definition: DeclBase.h:432
void visitTParamCommandComment(const comments::TParamCommandComment *C, const comments::FullComment *FC)
const Type * getBaseClass() const
If this is a base class initializer, returns the type of the base class.
Definition: DeclCXX.cpp:2335
Represents an enum.
Definition: Decl.h:3352
PresumedLoc getPresumedLoc(SourceLocation Loc, bool UseLineDirectives=true) const
Returns the "presumed" location of a SourceLocation specifies.
bool isParameterPack() const
Determine whether this variable is actually a function parameter pack or init-capture pack...
Definition: Decl.cpp:2420
void VisitCXXRecordDecl(const CXXRecordDecl *RD)
const ObjCInterfaceDecl * getClassInterface() const
Definition: DeclObjC.h:2746
TypeSourceInfo * getTypeOperandSourceInfo() const
Retrieve source information for the type operand.
Definition: ExprCXX.h:715
llvm::APInt getValue() const
Definition: Expr.h:1402
void VisitBlockDecl(const BlockDecl *D)
LabelDecl * getLabel() const
Definition: Expr.h:3902
path_iterator path_end()
Definition: Expr.h:3196
StringRef getTagName() const LLVM_READONLY
Definition: Comment.h:395
SwitchStmt - This represents a &#39;switch&#39; stmt.
Definition: Stmt.h:1995
bool needsOverloadResolutionForMoveConstructor() const
Determine whether we need to eagerly declare a defaulted move constructor for this class...
Definition: DeclCXX.h:1098
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:4423
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:2333
void VisitObjCPropertyDecl(const ObjCPropertyDecl *D)
bool isFromAST() const
Whether this type comes from an AST file.
Definition: Type.h:1827
void VisitGotoStmt(const GotoStmt *GS)
void VisitCastExpr(const CastExpr *CE)
Opcode getOpcode() const
Definition: Expr.h:2043
static const char * getCastKindName(CastKind CK)
Definition: Expr.cpp:1852
bool isVolatile() const
Definition: Type.h:3648
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:1900
Represents a base class of a C++ class.
Definition: DeclCXX.h:192
ArrayRef< QualType > Exceptions
Explicitly-specified list of exception types.
Definition: Type.h:3763
void visitBlockCommandComment(const comments::BlockCommandComment *C, const comments::FullComment *)
bool capturesCXXThis() const
Definition: Decl.h:4016
llvm::iterator_range< decls_iterator > decls() const
Definition: ExprCXX.h:2843
GotoStmt - This represents a direct goto.
Definition: Stmt.h:2433
TypedefNameDecl * getDecl() const
Definition: Type.h:4185
llvm::json::OStream JOS
Call-style initialization (C++98)
Definition: Decl.h:820
MemberExpr - [C99 6.5.2.3] Structure and Union Members.
Definition: Expr.h:2809
void VisitEnumConstantDecl(const EnumConstantDecl *ECD)
void VisitObjCMethodDecl(const ObjCMethodDecl *D)
bool isMutable() const
Determines whether this field is mutable (C++ only).
Definition: Decl.h:2680
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:300
const char * getCommentKindName() const
Definition: Comment.cpp:20
bool isValid() const
bool isNRVOVariable() const
Determine whether this local variable can be used with the named return value optimization (NRVO)...
Definition: Decl.h:1329
ObjCIvarDecl - Represents an ObjC instance variable.
Definition: DeclObjC.h:1944
WhileStmt - This represents a &#39;while&#39; stmt.
Definition: Stmt.h:2178
bool isInherited() const
Definition: Attr.h:97
bool isVariadic() const
Definition: DeclObjC.h:426
SourceRange getSourceRange() const LLVM_READONLY
SourceLocation tokens are not useful in isolation - they are low level value objects created/interpre...
Definition: Stmt.cpp:251
bool isGlobalDelete() const
Definition: ExprCXX.h:2286
void VisitNamespaceAliasDecl(const NamespaceAliasDecl *NAD)
StringLiteral - This represents a string literal expression, e.g.
Definition: Expr.h:1683
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
Definition: Expr.h:2518
TLS with a known-constant initializer.
Definition: Decl.h:832
QualType getIntegerType() const
Return the integer type this enum decl corresponds to.
Definition: Decl.h:3506
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:3518
void VisitObjCCategoryImplDecl(const ObjCCategoryImplDecl *D)
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:2093
#define FIELD2(Name, Flag)
A reference to a declared variable, function, enum, etc.
Definition: Expr.h:1143
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:2163
const VarDecl * getCatchParamDecl() const
Definition: StmtObjC.h:97
void VisitLinkageSpecDecl(const LinkageSpecDecl *LSD)
static StringRef getNameForCallConv(CallingConv CC)
Definition: Type.cpp:2909
void visitVerbatimLineComment(const comments::VerbatimLineComment *C, const comments::FullComment *)
QualType getType() const
Definition: Decl.h:647
AccessSpecifier getAccessSpecifierAsWritten() const
Retrieves the access specifier as written in the source code (which may mean that no access specifier...
Definition: DeclCXX.h:284
void VisitCXXThisExpr(const CXXThisExpr *TE)
An l-value expression is a reference to an object with independent storage.
Definition: Specifiers.h:128
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:1262
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:549
StringRef getParamName(const FullComment *FC) const
Definition: Comment.cpp:363
void VisitTemplateTemplateParmDecl(const TemplateTemplateParmDecl *D)
Represents a C++ namespace alias.
Definition: DeclCXX.h:3143
bool isInline() const
Whether this variable is (C++1z) inline.
Definition: Decl.h:1368
AccessControl getAccessControl() const
Definition: DeclObjC.h:1983
Represents C++ using-directive.
Definition: DeclCXX.h:3039
double getValueAsApproximateDouble() const
getValueAsApproximateDouble - This returns the value as an inaccurate double.
Definition: Expr.cpp:965
attr::Kind getKind() const
Definition: Attr.h:86
bool hasInit() const
Definition: Decl.cpp:2198
SourceLocation getBegin() const
void VisitObjCImplementationDecl(const ObjCImplementationDecl *D)
void VisitFunctionDecl(const FunctionDecl *FD)
NamedDecl * getPack() const
Retrieve the parameter pack.
Definition: ExprCXX.h:4063
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:1525
The parameter is invariant: must match exactly.
ExceptionSpecInfo ExceptionSpec
Definition: Type.h:3790
A class which abstracts out some details necessary for making a call.
Definition: Type.h:3483
Attr - This represents one attribute.
Definition: Attr.h:43
bool isDeletedAsWritten() const
Definition: Decl.h:2167
SourceLocation getLocation() const
Definition: DeclBase.h:429
Represents a shadow declaration introduced into a scope by a (resolved) using declaration.
Definition: DeclCXX.h:3262
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:3239
ObjCCompatibleAliasDecl - Represents alias of a class.
Definition: DeclObjC.h:2728
void visitHTMLEndTagComment(const comments::HTMLEndTagComment *C, const comments::FullComment *)
QualType getType() const
Retrieves the type of the base class.
Definition: DeclCXX.h:291