clang  8.0.0
ASTDumper.cpp
Go to the documentation of this file.
1 //===--- ASTDumper.cpp - Dumping implementation for ASTs ------------------===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file implements the AST dump methods, which dump out the
11 // AST in a form that exposes type details and other fields.
12 //
13 //===----------------------------------------------------------------------===//
14 
15 #include "clang/AST/ASTContext.h"
17 #include "clang/AST/Attr.h"
18 #include "clang/AST/AttrVisitor.h"
20 #include "clang/AST/DeclCXX.h"
21 #include "clang/AST/DeclLookups.h"
22 #include "clang/AST/DeclObjC.h"
23 #include "clang/AST/DeclOpenMP.h"
24 #include "clang/AST/DeclVisitor.h"
25 #include "clang/AST/LocInfoType.h"
26 #include "clang/AST/StmtVisitor.h"
29 #include "clang/AST/TypeVisitor.h"
30 #include "clang/Basic/Builtins.h"
31 #include "clang/Basic/Module.h"
33 #include "llvm/Support/raw_ostream.h"
34 using namespace clang;
35 using namespace clang::comments;
36 
37 //===----------------------------------------------------------------------===//
38 // ASTDumper Visitor
39 //===----------------------------------------------------------------------===//
40 
41 namespace {
42 
43  class ASTDumper
44  : public ConstDeclVisitor<ASTDumper>,
45  public ConstStmtVisitor<ASTDumper>,
46  public ConstCommentVisitor<ASTDumper, void, const FullComment *>,
47  public TypeVisitor<ASTDumper>,
48  public ConstAttrVisitor<ASTDumper>,
49  public ConstTemplateArgumentVisitor<ASTDumper> {
50 
51  TextNodeDumper NodeDumper;
52 
53  raw_ostream &OS;
54 
55  /// The policy to use for printing; can be defaulted.
56  PrintingPolicy PrintPolicy;
57 
58  /// Indicates whether we should trigger deserialization of nodes that had
59  /// not already been loaded.
60  bool Deserialize = false;
61 
62  const bool ShowColors;
63 
64  /// Dump a child of the current node.
65  template<typename Fn> void dumpChild(Fn DoDumpChild) {
66  NodeDumper.AddChild(DoDumpChild);
67  }
68  template <typename Fn> void dumpChild(StringRef Label, Fn DoDumpChild) {
69  NodeDumper.AddChild(Label, DoDumpChild);
70  }
71 
72  public:
73  ASTDumper(raw_ostream &OS, const CommandTraits *Traits,
74  const SourceManager *SM)
75  : ASTDumper(OS, Traits, SM,
76  SM && SM->getDiagnostics().getShowColors()) {}
77 
78  ASTDumper(raw_ostream &OS, const CommandTraits *Traits,
79  const SourceManager *SM, bool ShowColors)
80  : ASTDumper(OS, Traits, SM, ShowColors, LangOptions()) {}
81  ASTDumper(raw_ostream &OS, const CommandTraits *Traits,
82  const SourceManager *SM, bool ShowColors,
83  const PrintingPolicy &PrintPolicy)
84  : NodeDumper(OS, ShowColors, SM, PrintPolicy, Traits), OS(OS),
85  PrintPolicy(PrintPolicy), ShowColors(ShowColors) {}
86 
87  void setDeserialize(bool D) { Deserialize = D; }
88 
89  void dumpDecl(const Decl *D);
90  void dumpStmt(const Stmt *S, StringRef Label = {});
91 
92  // Utilities
93  void dumpTypeAsChild(QualType T);
94  void dumpTypeAsChild(const Type *T);
95  void dumpDeclContext(const DeclContext *DC);
96  void dumpLookups(const DeclContext *DC, bool DumpDecls);
97  void dumpAttr(const Attr *A);
98 
99  // C++ Utilities
100  void dumpCXXCtorInitializer(const CXXCtorInitializer *Init);
101  void dumpTemplateParameters(const TemplateParameterList *TPL);
102  void dumpTemplateArgumentListInfo(const TemplateArgumentListInfo &TALI);
103  void dumpTemplateArgumentLoc(const TemplateArgumentLoc &A,
104  const Decl *From = nullptr,
105  const char *Label = nullptr);
106  void dumpTemplateArgumentList(const TemplateArgumentList &TAL);
107  void dumpTemplateArgument(const TemplateArgument &A,
108  SourceRange R = SourceRange(),
109  const Decl *From = nullptr,
110  const char *Label = nullptr);
111  template <typename SpecializationDecl>
112  void dumpTemplateDeclSpecialization(const SpecializationDecl *D,
113  bool DumpExplicitInst,
114  bool DumpRefOnly);
115  template <typename TemplateDecl>
116  void dumpTemplateDecl(const TemplateDecl *D, bool DumpExplicitInst);
117 
118  // Objective-C utilities.
119  void dumpObjCTypeParamList(const ObjCTypeParamList *typeParams);
120 
121  // Types
122  void VisitComplexType(const ComplexType *T) {
123  dumpTypeAsChild(T->getElementType());
124  }
125  void VisitLocInfoType(const LocInfoType *T) {
126  dumpTypeAsChild(T->getTypeSourceInfo()->getType());
127  }
128  void VisitPointerType(const PointerType *T) {
129  dumpTypeAsChild(T->getPointeeType());
130  }
131  void VisitBlockPointerType(const BlockPointerType *T) {
132  dumpTypeAsChild(T->getPointeeType());
133  }
134  void VisitReferenceType(const ReferenceType *T) {
135  dumpTypeAsChild(T->getPointeeType());
136  }
137  void VisitMemberPointerType(const MemberPointerType *T) {
138  dumpTypeAsChild(T->getClass());
139  dumpTypeAsChild(T->getPointeeType());
140  }
141  void VisitArrayType(const ArrayType *T) {
142  dumpTypeAsChild(T->getElementType());
143  }
144  void VisitVariableArrayType(const VariableArrayType *T) {
145  VisitArrayType(T);
146  dumpStmt(T->getSizeExpr());
147  }
148  void VisitDependentSizedArrayType(const DependentSizedArrayType *T) {
149  dumpTypeAsChild(T->getElementType());
150  dumpStmt(T->getSizeExpr());
151  }
152  void VisitDependentSizedExtVectorType(
153  const DependentSizedExtVectorType *T) {
154  dumpTypeAsChild(T->getElementType());
155  dumpStmt(T->getSizeExpr());
156  }
157  void VisitVectorType(const VectorType *T) {
158  dumpTypeAsChild(T->getElementType());
159  }
160  void VisitFunctionType(const FunctionType *T) {
161  dumpTypeAsChild(T->getReturnType());
162  }
163  void VisitFunctionProtoType(const FunctionProtoType *T) {
164  VisitFunctionType(T);
165  for (QualType PT : T->getParamTypes())
166  dumpTypeAsChild(PT);
167  if (T->getExtProtoInfo().Variadic)
168  dumpChild([=] { OS << "..."; });
169  }
170  void VisitTypeOfExprType(const TypeOfExprType *T) {
171  dumpStmt(T->getUnderlyingExpr());
172  }
173  void VisitDecltypeType(const DecltypeType *T) {
174  dumpStmt(T->getUnderlyingExpr());
175  }
176  void VisitUnaryTransformType(const UnaryTransformType *T) {
177  dumpTypeAsChild(T->getBaseType());
178  }
179  void VisitAttributedType(const AttributedType *T) {
180  // FIXME: AttrKind
181  dumpTypeAsChild(T->getModifiedType());
182  }
183  void VisitSubstTemplateTypeParmType(const SubstTemplateTypeParmType *T) {
184  dumpTypeAsChild(T->getReplacedParameter());
185  }
186  void VisitSubstTemplateTypeParmPackType(
188  dumpTypeAsChild(T->getReplacedParameter());
189  dumpTemplateArgument(T->getArgumentPack());
190  }
191  void VisitTemplateSpecializationType(const TemplateSpecializationType *T) {
192  for (auto &Arg : *T)
193  dumpTemplateArgument(Arg);
194  if (T->isTypeAlias())
195  dumpTypeAsChild(T->getAliasedType());
196  }
197  void VisitObjCObjectPointerType(const ObjCObjectPointerType *T) {
198  dumpTypeAsChild(T->getPointeeType());
199  }
200  void VisitAtomicType(const AtomicType *T) {
201  dumpTypeAsChild(T->getValueType());
202  }
203  void VisitPipeType(const PipeType *T) {
204  dumpTypeAsChild(T->getElementType());
205  }
206  void VisitAdjustedType(const AdjustedType *T) {
207  dumpTypeAsChild(T->getOriginalType());
208  }
209  void VisitPackExpansionType(const PackExpansionType *T) {
210  if (!T->isSugared())
211  dumpTypeAsChild(T->getPattern());
212  }
213  // FIXME: ElaboratedType, DependentNameType,
214  // DependentTemplateSpecializationType, ObjCObjectType
215 
216  // Decls
217  void VisitLabelDecl(const LabelDecl *D);
218  void VisitTypedefDecl(const TypedefDecl *D);
219  void VisitEnumDecl(const EnumDecl *D);
220  void VisitRecordDecl(const RecordDecl *D);
221  void VisitEnumConstantDecl(const EnumConstantDecl *D);
222  void VisitIndirectFieldDecl(const IndirectFieldDecl *D);
223  void VisitFunctionDecl(const FunctionDecl *D);
224  void VisitFieldDecl(const FieldDecl *D);
225  void VisitVarDecl(const VarDecl *D);
226  void VisitDecompositionDecl(const DecompositionDecl *D);
227  void VisitBindingDecl(const BindingDecl *D);
228  void VisitFileScopeAsmDecl(const FileScopeAsmDecl *D);
229  void VisitImportDecl(const ImportDecl *D);
230  void VisitPragmaCommentDecl(const PragmaCommentDecl *D);
231  void VisitPragmaDetectMismatchDecl(const PragmaDetectMismatchDecl *D);
232  void VisitCapturedDecl(const CapturedDecl *D);
233 
234  // OpenMP decls
235  void VisitOMPThreadPrivateDecl(const OMPThreadPrivateDecl *D);
236  void VisitOMPDeclareReductionDecl(const OMPDeclareReductionDecl *D);
237  void VisitOMPRequiresDecl(const OMPRequiresDecl *D);
238  void VisitOMPCapturedExprDecl(const OMPCapturedExprDecl *D);
239 
240  // C++ Decls
241  void VisitNamespaceDecl(const NamespaceDecl *D);
242  void VisitUsingDirectiveDecl(const UsingDirectiveDecl *D);
243  void VisitNamespaceAliasDecl(const NamespaceAliasDecl *D);
244  void VisitTypeAliasDecl(const TypeAliasDecl *D);
245  void VisitTypeAliasTemplateDecl(const TypeAliasTemplateDecl *D);
246  void VisitCXXRecordDecl(const CXXRecordDecl *D);
247  void VisitStaticAssertDecl(const StaticAssertDecl *D);
248  void VisitFunctionTemplateDecl(const FunctionTemplateDecl *D);
249  void VisitClassTemplateDecl(const ClassTemplateDecl *D);
250  void VisitClassTemplateSpecializationDecl(
252  void VisitClassTemplatePartialSpecializationDecl(
254  void VisitClassScopeFunctionSpecializationDecl(
256  void VisitBuiltinTemplateDecl(const BuiltinTemplateDecl *D);
257  void VisitVarTemplateDecl(const VarTemplateDecl *D);
258  void VisitVarTemplateSpecializationDecl(
260  void VisitVarTemplatePartialSpecializationDecl(
262  void VisitTemplateTypeParmDecl(const TemplateTypeParmDecl *D);
263  void VisitNonTypeTemplateParmDecl(const NonTypeTemplateParmDecl *D);
264  void VisitTemplateTemplateParmDecl(const TemplateTemplateParmDecl *D);
265  void VisitUsingDecl(const UsingDecl *D);
266  void VisitUnresolvedUsingTypenameDecl(const UnresolvedUsingTypenameDecl *D);
267  void VisitUnresolvedUsingValueDecl(const UnresolvedUsingValueDecl *D);
268  void VisitUsingShadowDecl(const UsingShadowDecl *D);
269  void VisitConstructorUsingShadowDecl(const ConstructorUsingShadowDecl *D);
270  void VisitLinkageSpecDecl(const LinkageSpecDecl *D);
271  void VisitAccessSpecDecl(const AccessSpecDecl *D);
272  void VisitFriendDecl(const FriendDecl *D);
273 
274  // ObjC Decls
275  void VisitObjCIvarDecl(const ObjCIvarDecl *D);
276  void VisitObjCMethodDecl(const ObjCMethodDecl *D);
277  void VisitObjCTypeParamDecl(const ObjCTypeParamDecl *D);
278  void VisitObjCCategoryDecl(const ObjCCategoryDecl *D);
279  void VisitObjCCategoryImplDecl(const ObjCCategoryImplDecl *D);
280  void VisitObjCProtocolDecl(const ObjCProtocolDecl *D);
281  void VisitObjCInterfaceDecl(const ObjCInterfaceDecl *D);
282  void VisitObjCImplementationDecl(const ObjCImplementationDecl *D);
283  void VisitObjCCompatibleAliasDecl(const ObjCCompatibleAliasDecl *D);
284  void VisitObjCPropertyDecl(const ObjCPropertyDecl *D);
285  void VisitObjCPropertyImplDecl(const ObjCPropertyImplDecl *D);
286  void Visit(const BlockDecl::Capture &C);
287  void VisitBlockDecl(const BlockDecl *D);
288 
289  // Stmts.
290  void VisitDeclStmt(const DeclStmt *Node);
291  void VisitAttributedStmt(const AttributedStmt *Node);
292  void VisitCXXCatchStmt(const CXXCatchStmt *Node);
293  void VisitCapturedStmt(const CapturedStmt *Node);
294 
295  // OpenMP
296  void Visit(const OMPClause *C);
297  void VisitOMPExecutableDirective(const OMPExecutableDirective *Node);
298 
299  // Exprs
300  void VisitInitListExpr(const InitListExpr *ILE);
301  void VisitBlockExpr(const BlockExpr *Node);
302  void VisitOpaqueValueExpr(const OpaqueValueExpr *Node);
303  void VisitGenericSelectionExpr(const GenericSelectionExpr *E);
304 
305  // C++
306  void VisitLambdaExpr(const LambdaExpr *Node) {
307  dumpDecl(Node->getLambdaClass());
308  }
309  void VisitSizeOfPackExpr(const SizeOfPackExpr *Node);
310 
311  // ObjC
312  void VisitObjCAtCatchStmt(const ObjCAtCatchStmt *Node);
313 
314  // Comments.
315  void dumpComment(const Comment *C, const FullComment *FC);
316 
317  void VisitExpressionTemplateArgument(const TemplateArgument &TA) {
318  dumpStmt(TA.getAsExpr());
319  }
320  void VisitPackTemplateArgument(const TemplateArgument &TA) {
321  for (const auto &TArg : TA.pack_elements())
322  dumpTemplateArgument(TArg);
323  }
324 
325 // Implements Visit methods for Attrs.
326 #include "clang/AST/AttrNodeTraverse.inc"
327  };
328 }
329 
330 //===----------------------------------------------------------------------===//
331 // Utilities
332 //===----------------------------------------------------------------------===//
333 
334 void ASTDumper::dumpTypeAsChild(QualType T) {
335  SplitQualType SQT = T.split();
336  if (!SQT.Quals.hasQualifiers())
337  return dumpTypeAsChild(SQT.Ty);
338 
339  dumpChild([=] {
340  NodeDumper.Visit(T);
341  dumpTypeAsChild(T.split().Ty);
342  });
343 }
344 
345 void ASTDumper::dumpTypeAsChild(const Type *T) {
346  dumpChild([=] {
347  NodeDumper.Visit(T);
348  if (!T)
349  return;
351 
352  QualType SingleStepDesugar =
354  if (SingleStepDesugar != QualType(T, 0))
355  dumpTypeAsChild(SingleStepDesugar);
356  });
357 }
358 
359 void ASTDumper::dumpDeclContext(const DeclContext *DC) {
360  if (!DC)
361  return;
362 
363  for (auto *D : (Deserialize ? DC->decls() : DC->noload_decls()))
364  dumpDecl(D);
365 
366  if (DC->hasExternalLexicalStorage()) {
367  dumpChild([=] {
368  ColorScope Color(OS, ShowColors, UndeserializedColor);
369  OS << "<undeserialized declarations>";
370  });
371  }
372 }
373 
374 void ASTDumper::dumpLookups(const DeclContext *DC, bool DumpDecls) {
375  dumpChild([=] {
376  OS << "StoredDeclsMap ";
377  NodeDumper.dumpBareDeclRef(cast<Decl>(DC));
378 
379  const DeclContext *Primary = DC->getPrimaryContext();
380  if (Primary != DC) {
381  OS << " primary";
382  NodeDumper.dumpPointer(cast<Decl>(Primary));
383  }
384 
385  bool HasUndeserializedLookups = Primary->hasExternalVisibleStorage();
386 
387  auto Range = Deserialize
388  ? Primary->lookups()
389  : Primary->noload_lookups(/*PreserveInternalState=*/true);
390  for (auto I = Range.begin(), E = Range.end(); I != E; ++I) {
391  DeclarationName Name = I.getLookupName();
393 
394  dumpChild([=] {
395  OS << "DeclarationName ";
396  {
397  ColorScope Color(OS, ShowColors, DeclNameColor);
398  OS << '\'' << Name << '\'';
399  }
400 
401  for (DeclContextLookupResult::iterator RI = R.begin(), RE = R.end();
402  RI != RE; ++RI) {
403  dumpChild([=] {
404  NodeDumper.dumpBareDeclRef(*RI);
405 
406  if ((*RI)->isHidden())
407  OS << " hidden";
408 
409  // If requested, dump the redecl chain for this lookup.
410  if (DumpDecls) {
411  // Dump earliest decl first.
412  std::function<void(Decl *)> DumpWithPrev = [&](Decl *D) {
413  if (Decl *Prev = D->getPreviousDecl())
414  DumpWithPrev(Prev);
415  dumpDecl(D);
416  };
417  DumpWithPrev(*RI);
418  }
419  });
420  }
421  });
422  }
423 
424  if (HasUndeserializedLookups) {
425  dumpChild([=] {
426  ColorScope Color(OS, ShowColors, UndeserializedColor);
427  OS << "<undeserialized lookups>";
428  });
429  }
430  });
431 }
432 
433 void ASTDumper::dumpAttr(const Attr *A) {
434  dumpChild([=] {
435  NodeDumper.Visit(A);
437  });
438 }
439 
440 //===----------------------------------------------------------------------===//
441 // C++ Utilities
442 //===----------------------------------------------------------------------===//
443 
444 void ASTDumper::dumpCXXCtorInitializer(const CXXCtorInitializer *Init) {
445  dumpChild([=] {
446  NodeDumper.Visit(Init);
447  dumpStmt(Init->getInit());
448  });
449 }
450 
451 void ASTDumper::dumpTemplateParameters(const TemplateParameterList *TPL) {
452  if (!TPL)
453  return;
454 
455  for (TemplateParameterList::const_iterator I = TPL->begin(), E = TPL->end();
456  I != E; ++I)
457  dumpDecl(*I);
458 }
459 
460 void ASTDumper::dumpTemplateArgumentListInfo(
461  const TemplateArgumentListInfo &TALI) {
462  for (unsigned i = 0, e = TALI.size(); i < e; ++i)
463  dumpTemplateArgumentLoc(TALI[i]);
464 }
465 
466 void ASTDumper::dumpTemplateArgumentLoc(const TemplateArgumentLoc &A,
467  const Decl *From, const char *Label) {
468  dumpTemplateArgument(A.getArgument(), A.getSourceRange(), From, Label);
469 }
470 
471 void ASTDumper::dumpTemplateArgumentList(const TemplateArgumentList &TAL) {
472  for (unsigned i = 0, e = TAL.size(); i < e; ++i)
473  dumpTemplateArgument(TAL[i]);
474 }
475 
476 void ASTDumper::dumpTemplateArgument(const TemplateArgument &A, SourceRange R,
477  const Decl *From, const char *Label) {
478  dumpChild([=] {
479  NodeDumper.Visit(A, R, From, Label);
481  });
482 }
483 
484 //===----------------------------------------------------------------------===//
485 // Objective-C Utilities
486 //===----------------------------------------------------------------------===//
487 void ASTDumper::dumpObjCTypeParamList(const ObjCTypeParamList *typeParams) {
488  if (!typeParams)
489  return;
490 
491  for (auto typeParam : *typeParams) {
492  dumpDecl(typeParam);
493  }
494 }
495 
496 //===----------------------------------------------------------------------===//
497 // Decl dumping methods.
498 //===----------------------------------------------------------------------===//
499 
500 void ASTDumper::dumpDecl(const Decl *D) {
501  dumpChild([=] {
502  NodeDumper.Visit(D);
503  if (!D)
504  return;
505 
507 
508  for (Decl::attr_iterator I = D->attr_begin(), E = D->attr_end(); I != E;
509  ++I)
510  dumpAttr(*I);
511 
512  if (const FullComment *Comment =
514  dumpComment(Comment, Comment);
515 
516  // Decls within functions are visited by the body.
517  if (!isa<FunctionDecl>(*D) && !isa<ObjCMethodDecl>(*D)) {
518  auto DC = dyn_cast<DeclContext>(D);
519  if (DC &&
520  (DC->hasExternalLexicalStorage() ||
521  (Deserialize ? DC->decls_begin() != DC->decls_end()
522  : DC->noload_decls_begin() != DC->noload_decls_end())))
523  dumpDeclContext(DC);
524  }
525  });
526 }
527 
528 void ASTDumper::VisitLabelDecl(const LabelDecl *D) { NodeDumper.dumpName(D); }
529 
530 void ASTDumper::VisitTypedefDecl(const TypedefDecl *D) {
531  NodeDumper.dumpName(D);
532  NodeDumper.dumpType(D->getUnderlyingType());
533  if (D->isModulePrivate())
534  OS << " __module_private__";
535  dumpTypeAsChild(D->getUnderlyingType());
536 }
537 
538 void ASTDumper::VisitEnumDecl(const EnumDecl *D) {
539  if (D->isScoped()) {
540  if (D->isScopedUsingClassTag())
541  OS << " class";
542  else
543  OS << " struct";
544  }
545  NodeDumper.dumpName(D);
546  if (D->isModulePrivate())
547  OS << " __module_private__";
548  if (D->isFixed())
549  NodeDumper.dumpType(D->getIntegerType());
550 }
551 
552 void ASTDumper::VisitRecordDecl(const RecordDecl *D) {
553  OS << ' ' << D->getKindName();
554  NodeDumper.dumpName(D);
555  if (D->isModulePrivate())
556  OS << " __module_private__";
557  if (D->isCompleteDefinition())
558  OS << " definition";
559 }
560 
561 void ASTDumper::VisitEnumConstantDecl(const EnumConstantDecl *D) {
562  NodeDumper.dumpName(D);
563  NodeDumper.dumpType(D->getType());
564  if (const Expr *Init = D->getInitExpr())
565  dumpStmt(Init);
566 }
567 
568 void ASTDumper::VisitIndirectFieldDecl(const IndirectFieldDecl *D) {
569  NodeDumper.dumpName(D);
570  NodeDumper.dumpType(D->getType());
571 
572  for (auto *Child : D->chain())
573  NodeDumper.dumpDeclRef(Child);
574 }
575 
576 void ASTDumper::VisitFunctionDecl(const FunctionDecl *D) {
577  NodeDumper.dumpName(D);
578  NodeDumper.dumpType(D->getType());
579 
580  StorageClass SC = D->getStorageClass();
581  if (SC != SC_None)
583  if (D->isInlineSpecified())
584  OS << " inline";
585  if (D->isVirtualAsWritten())
586  OS << " virtual";
587  if (D->isModulePrivate())
588  OS << " __module_private__";
589 
590  if (D->isPure())
591  OS << " pure";
592  if (D->isDefaulted()) {
593  OS << " default";
594  if (D->isDeleted())
595  OS << "_delete";
596  }
597  if (D->isDeletedAsWritten())
598  OS << " delete";
599  if (D->isTrivial())
600  OS << " trivial";
601 
602  if (const auto *FPT = D->getType()->getAs<FunctionProtoType>()) {
603  FunctionProtoType::ExtProtoInfo EPI = FPT->getExtProtoInfo();
604  switch (EPI.ExceptionSpec.Type) {
605  default: break;
606  case EST_Unevaluated:
607  OS << " noexcept-unevaluated " << EPI.ExceptionSpec.SourceDecl;
608  break;
609  case EST_Uninstantiated:
610  OS << " noexcept-uninstantiated " << EPI.ExceptionSpec.SourceTemplate;
611  break;
612  }
613  }
614 
615  if (const auto *MD = dyn_cast<CXXMethodDecl>(D)) {
616  if (MD->size_overridden_methods() != 0) {
617  auto dumpOverride = [=](const CXXMethodDecl *D) {
618  SplitQualType T_split = D->getType().split();
619  OS << D << " " << D->getParent()->getName()
620  << "::" << D->getNameAsString() << " '"
621  << QualType::getAsString(T_split, PrintPolicy) << "'";
622  };
623 
624  dumpChild([=] {
625  auto Overrides = MD->overridden_methods();
626  OS << "Overrides: [ ";
627  dumpOverride(*Overrides.begin());
628  for (const auto *Override :
629  llvm::make_range(Overrides.begin() + 1, Overrides.end())) {
630  OS << ", ";
631  dumpOverride(Override);
632  }
633  OS << " ]";
634  });
635  }
636  }
637 
638  if (const auto *FTSI = D->getTemplateSpecializationInfo())
639  dumpTemplateArgumentList(*FTSI->TemplateArguments);
640 
641  if (!D->param_begin() && D->getNumParams())
642  dumpChild([=] { OS << "<<NULL params x " << D->getNumParams() << ">>"; });
643  else
644  for (const ParmVarDecl *Parameter : D->parameters())
645  dumpDecl(Parameter);
646 
647  if (const auto *C = dyn_cast<CXXConstructorDecl>(D))
648  for (const auto *I : C->inits())
649  dumpCXXCtorInitializer(I);
650 
652  dumpStmt(D->getBody());
653 }
654 
655 void ASTDumper::VisitFieldDecl(const FieldDecl *D) {
656  NodeDumper.dumpName(D);
657  NodeDumper.dumpType(D->getType());
658  if (D->isMutable())
659  OS << " mutable";
660  if (D->isModulePrivate())
661  OS << " __module_private__";
662 
663  if (D->isBitField())
664  dumpStmt(D->getBitWidth());
665  if (Expr *Init = D->getInClassInitializer())
666  dumpStmt(Init);
667 }
668 
669 void ASTDumper::VisitVarDecl(const VarDecl *D) {
670  NodeDumper.dumpName(D);
671  NodeDumper.dumpType(D->getType());
672  StorageClass SC = D->getStorageClass();
673  if (SC != SC_None)
675  switch (D->getTLSKind()) {
676  case VarDecl::TLS_None: break;
677  case VarDecl::TLS_Static: OS << " tls"; break;
678  case VarDecl::TLS_Dynamic: OS << " tls_dynamic"; break;
679  }
680  if (D->isModulePrivate())
681  OS << " __module_private__";
682  if (D->isNRVOVariable())
683  OS << " nrvo";
684  if (D->isInline())
685  OS << " inline";
686  if (D->isConstexpr())
687  OS << " constexpr";
688  if (D->hasInit()) {
689  switch (D->getInitStyle()) {
690  case VarDecl::CInit: OS << " cinit"; break;
691  case VarDecl::CallInit: OS << " callinit"; break;
692  case VarDecl::ListInit: OS << " listinit"; break;
693  }
694  dumpStmt(D->getInit());
695  }
696 }
697 
698 void ASTDumper::VisitDecompositionDecl(const DecompositionDecl *D) {
699  VisitVarDecl(D);
700  for (auto *B : D->bindings())
701  dumpDecl(B);
702 }
703 
704 void ASTDumper::VisitBindingDecl(const BindingDecl *D) {
705  NodeDumper.dumpName(D);
706  NodeDumper.dumpType(D->getType());
707  if (auto *E = D->getBinding())
708  dumpStmt(E);
709 }
710 
711 void ASTDumper::VisitFileScopeAsmDecl(const FileScopeAsmDecl *D) {
712  dumpStmt(D->getAsmString());
713 }
714 
715 void ASTDumper::VisitImportDecl(const ImportDecl *D) {
716  OS << ' ' << D->getImportedModule()->getFullModuleName();
717 }
718 
719 void ASTDumper::VisitPragmaCommentDecl(const PragmaCommentDecl *D) {
720  OS << ' ';
721  switch (D->getCommentKind()) {
722  case PCK_Unknown: llvm_unreachable("unexpected pragma comment kind");
723  case PCK_Compiler: OS << "compiler"; break;
724  case PCK_ExeStr: OS << "exestr"; break;
725  case PCK_Lib: OS << "lib"; break;
726  case PCK_Linker: OS << "linker"; break;
727  case PCK_User: OS << "user"; break;
728  }
729  StringRef Arg = D->getArg();
730  if (!Arg.empty())
731  OS << " \"" << Arg << "\"";
732 }
733 
734 void ASTDumper::VisitPragmaDetectMismatchDecl(
735  const PragmaDetectMismatchDecl *D) {
736  OS << " \"" << D->getName() << "\" \"" << D->getValue() << "\"";
737 }
738 
739 void ASTDumper::VisitCapturedDecl(const CapturedDecl *D) {
740  dumpStmt(D->getBody());
741 }
742 
743 //===----------------------------------------------------------------------===//
744 // OpenMP Declarations
745 //===----------------------------------------------------------------------===//
746 
747 void ASTDumper::VisitOMPThreadPrivateDecl(const OMPThreadPrivateDecl *D) {
748  for (auto *E : D->varlists())
749  dumpStmt(E);
750 }
751 
752 void ASTDumper::VisitOMPDeclareReductionDecl(const OMPDeclareReductionDecl *D) {
753  NodeDumper.dumpName(D);
754  NodeDumper.dumpType(D->getType());
755  OS << " combiner";
756  NodeDumper.dumpPointer(D->getCombiner());
757  if (const auto *Initializer = D->getInitializer()) {
758  OS << " initializer";
759  NodeDumper.dumpPointer(Initializer);
760  switch (D->getInitializerKind()) {
762  OS << " omp_priv = ";
763  break;
765  OS << " omp_priv ()";
766  break;
768  break;
769  }
770  }
771 
772  dumpStmt(D->getCombiner());
773  if (const auto *Initializer = D->getInitializer())
774  dumpStmt(Initializer);
775 }
776 
777 void ASTDumper::VisitOMPRequiresDecl(const OMPRequiresDecl *D) {
778  for (auto *C : D->clauselists()) {
779  dumpChild([=] {
780  if (!C) {
781  ColorScope Color(OS, ShowColors, NullColor);
782  OS << "<<<NULL>>> OMPClause";
783  return;
784  }
785  {
786  ColorScope Color(OS, ShowColors, AttrColor);
787  StringRef ClauseName(getOpenMPClauseName(C->getClauseKind()));
788  OS << "OMP" << ClauseName.substr(/*Start=*/0, /*N=*/1).upper()
789  << ClauseName.drop_front() << "Clause";
790  }
791  NodeDumper.dumpPointer(C);
792  NodeDumper.dumpSourceRange(SourceRange(C->getBeginLoc(), C->getEndLoc()));
793  });
794  }
795 }
796 
797 void ASTDumper::VisitOMPCapturedExprDecl(const OMPCapturedExprDecl *D) {
798  NodeDumper.dumpName(D);
799  NodeDumper.dumpType(D->getType());
800  dumpStmt(D->getInit());
801 }
802 
803 //===----------------------------------------------------------------------===//
804 // C++ Declarations
805 //===----------------------------------------------------------------------===//
806 
807 void ASTDumper::VisitNamespaceDecl(const NamespaceDecl *D) {
808  NodeDumper.dumpName(D);
809  if (D->isInline())
810  OS << " inline";
811  if (!D->isOriginalNamespace())
812  NodeDumper.dumpDeclRef(D->getOriginalNamespace(), "original");
813 }
814 
815 void ASTDumper::VisitUsingDirectiveDecl(const UsingDirectiveDecl *D) {
816  OS << ' ';
817  NodeDumper.dumpBareDeclRef(D->getNominatedNamespace());
818 }
819 
820 void ASTDumper::VisitNamespaceAliasDecl(const NamespaceAliasDecl *D) {
821  NodeDumper.dumpName(D);
822  NodeDumper.dumpDeclRef(D->getAliasedNamespace());
823 }
824 
825 void ASTDumper::VisitTypeAliasDecl(const TypeAliasDecl *D) {
826  NodeDumper.dumpName(D);
827  NodeDumper.dumpType(D->getUnderlyingType());
828  dumpTypeAsChild(D->getUnderlyingType());
829 }
830 
831 void ASTDumper::VisitTypeAliasTemplateDecl(const TypeAliasTemplateDecl *D) {
832  NodeDumper.dumpName(D);
833  dumpTemplateParameters(D->getTemplateParameters());
834  dumpDecl(D->getTemplatedDecl());
835 }
836 
837 void ASTDumper::VisitCXXRecordDecl(const CXXRecordDecl *D) {
838  VisitRecordDecl(D);
839  if (!D->isCompleteDefinition())
840  return;
841 
842  dumpChild([=] {
843  {
844  ColorScope Color(OS, ShowColors, DeclKindNameColor);
845  OS << "DefinitionData";
846  }
847 #define FLAG(fn, name) if (D->fn()) OS << " " #name;
848  FLAG(isParsingBaseSpecifiers, parsing_base_specifiers);
849 
850  FLAG(isGenericLambda, generic);
851  FLAG(isLambda, lambda);
852 
853  FLAG(canPassInRegisters, pass_in_registers);
854  FLAG(isEmpty, empty);
855  FLAG(isAggregate, aggregate);
856  FLAG(isStandardLayout, standard_layout);
857  FLAG(isTriviallyCopyable, trivially_copyable);
858  FLAG(isPOD, pod);
859  FLAG(isTrivial, trivial);
860  FLAG(isPolymorphic, polymorphic);
861  FLAG(isAbstract, abstract);
862  FLAG(isLiteral, literal);
863 
864  FLAG(hasUserDeclaredConstructor, has_user_declared_ctor);
865  FLAG(hasConstexprNonCopyMoveConstructor, has_constexpr_non_copy_move_ctor);
866  FLAG(hasMutableFields, has_mutable_fields);
867  FLAG(hasVariantMembers, has_variant_members);
868  FLAG(allowConstDefaultInit, can_const_default_init);
869 
870  dumpChild([=] {
871  {
872  ColorScope Color(OS, ShowColors, DeclKindNameColor);
873  OS << "DefaultConstructor";
874  }
875  FLAG(hasDefaultConstructor, exists);
876  FLAG(hasTrivialDefaultConstructor, trivial);
877  FLAG(hasNonTrivialDefaultConstructor, non_trivial);
878  FLAG(hasUserProvidedDefaultConstructor, user_provided);
879  FLAG(hasConstexprDefaultConstructor, constexpr);
880  FLAG(needsImplicitDefaultConstructor, needs_implicit);
881  FLAG(defaultedDefaultConstructorIsConstexpr, defaulted_is_constexpr);
882  });
883 
884  dumpChild([=] {
885  {
886  ColorScope Color(OS, ShowColors, DeclKindNameColor);
887  OS << "CopyConstructor";
888  }
889  FLAG(hasSimpleCopyConstructor, simple);
890  FLAG(hasTrivialCopyConstructor, trivial);
891  FLAG(hasNonTrivialCopyConstructor, non_trivial);
892  FLAG(hasUserDeclaredCopyConstructor, user_declared);
893  FLAG(hasCopyConstructorWithConstParam, has_const_param);
894  FLAG(needsImplicitCopyConstructor, needs_implicit);
895  FLAG(needsOverloadResolutionForCopyConstructor,
896  needs_overload_resolution);
898  FLAG(defaultedCopyConstructorIsDeleted, defaulted_is_deleted);
899  FLAG(implicitCopyConstructorHasConstParam, implicit_has_const_param);
900  });
901 
902  dumpChild([=] {
903  {
904  ColorScope Color(OS, ShowColors, DeclKindNameColor);
905  OS << "MoveConstructor";
906  }
907  FLAG(hasMoveConstructor, exists);
908  FLAG(hasSimpleMoveConstructor, simple);
909  FLAG(hasTrivialMoveConstructor, trivial);
910  FLAG(hasNonTrivialMoveConstructor, non_trivial);
911  FLAG(hasUserDeclaredMoveConstructor, user_declared);
912  FLAG(needsImplicitMoveConstructor, needs_implicit);
913  FLAG(needsOverloadResolutionForMoveConstructor,
914  needs_overload_resolution);
916  FLAG(defaultedMoveConstructorIsDeleted, defaulted_is_deleted);
917  });
918 
919  dumpChild([=] {
920  {
921  ColorScope Color(OS, ShowColors, DeclKindNameColor);
922  OS << "CopyAssignment";
923  }
924  FLAG(hasTrivialCopyAssignment, trivial);
925  FLAG(hasNonTrivialCopyAssignment, non_trivial);
926  FLAG(hasCopyAssignmentWithConstParam, has_const_param);
927  FLAG(hasUserDeclaredCopyAssignment, user_declared);
928  FLAG(needsImplicitCopyAssignment, needs_implicit);
929  FLAG(needsOverloadResolutionForCopyAssignment, needs_overload_resolution);
930  FLAG(implicitCopyAssignmentHasConstParam, implicit_has_const_param);
931  });
932 
933  dumpChild([=] {
934  {
935  ColorScope Color(OS, ShowColors, DeclKindNameColor);
936  OS << "MoveAssignment";
937  }
938  FLAG(hasMoveAssignment, exists);
939  FLAG(hasSimpleMoveAssignment, simple);
940  FLAG(hasTrivialMoveAssignment, trivial);
941  FLAG(hasNonTrivialMoveAssignment, non_trivial);
942  FLAG(hasUserDeclaredMoveAssignment, user_declared);
943  FLAG(needsImplicitMoveAssignment, needs_implicit);
944  FLAG(needsOverloadResolutionForMoveAssignment, needs_overload_resolution);
945  });
946 
947  dumpChild([=] {
948  {
949  ColorScope Color(OS, ShowColors, DeclKindNameColor);
950  OS << "Destructor";
951  }
952  FLAG(hasSimpleDestructor, simple);
953  FLAG(hasIrrelevantDestructor, irrelevant);
954  FLAG(hasTrivialDestructor, trivial);
955  FLAG(hasNonTrivialDestructor, non_trivial);
956  FLAG(hasUserDeclaredDestructor, user_declared);
957  FLAG(needsImplicitDestructor, needs_implicit);
958  FLAG(needsOverloadResolutionForDestructor, needs_overload_resolution);
960  FLAG(defaultedDestructorIsDeleted, defaulted_is_deleted);
961  });
962  });
963 
964  for (const auto &I : D->bases()) {
965  dumpChild([=] {
966  if (I.isVirtual())
967  OS << "virtual ";
968  NodeDumper.dumpAccessSpecifier(I.getAccessSpecifier());
969  NodeDumper.dumpType(I.getType());
970  if (I.isPackExpansion())
971  OS << "...";
972  });
973  }
974 }
975 
976 void ASTDumper::VisitStaticAssertDecl(const StaticAssertDecl *D) {
977  dumpStmt(D->getAssertExpr());
978  dumpStmt(D->getMessage());
979 }
980 
981 template <typename SpecializationDecl>
982 void ASTDumper::dumpTemplateDeclSpecialization(const SpecializationDecl *D,
983  bool DumpExplicitInst,
984  bool DumpRefOnly) {
985  bool DumpedAny = false;
986  for (auto *RedeclWithBadType : D->redecls()) {
987  // FIXME: The redecls() range sometimes has elements of a less-specific
988  // type. (In particular, ClassTemplateSpecializationDecl::redecls() gives
989  // us TagDecls, and should give CXXRecordDecls).
990  auto *Redecl = dyn_cast<SpecializationDecl>(RedeclWithBadType);
991  if (!Redecl) {
992  // Found the injected-class-name for a class template. This will be dumped
993  // as part of its surrounding class so we don't need to dump it here.
994  assert(isa<CXXRecordDecl>(RedeclWithBadType) &&
995  "expected an injected-class-name");
996  continue;
997  }
998 
999  switch (Redecl->getTemplateSpecializationKind()) {
1002  if (!DumpExplicitInst)
1003  break;
1004  LLVM_FALLTHROUGH;
1005  case TSK_Undeclared:
1007  if (DumpRefOnly)
1008  NodeDumper.dumpDeclRef(Redecl);
1009  else
1010  dumpDecl(Redecl);
1011  DumpedAny = true;
1012  break;
1014  break;
1015  }
1016  }
1017 
1018  // Ensure we dump at least one decl for each specialization.
1019  if (!DumpedAny)
1020  NodeDumper.dumpDeclRef(D);
1021 }
1022 
1023 template <typename TemplateDecl>
1024 void ASTDumper::dumpTemplateDecl(const TemplateDecl *D, bool DumpExplicitInst) {
1025  NodeDumper.dumpName(D);
1026  dumpTemplateParameters(D->getTemplateParameters());
1027 
1028  dumpDecl(D->getTemplatedDecl());
1029 
1030  for (auto *Child : D->specializations())
1031  dumpTemplateDeclSpecialization(Child, DumpExplicitInst,
1032  !D->isCanonicalDecl());
1033 }
1034 
1035 void ASTDumper::VisitFunctionTemplateDecl(const FunctionTemplateDecl *D) {
1036  // FIXME: We don't add a declaration of a function template specialization
1037  // to its context when it's explicitly instantiated, so dump explicit
1038  // instantiations when we dump the template itself.
1039  dumpTemplateDecl(D, true);
1040 }
1041 
1042 void ASTDumper::VisitClassTemplateDecl(const ClassTemplateDecl *D) {
1043  dumpTemplateDecl(D, false);
1044 }
1045 
1046 void ASTDumper::VisitClassTemplateSpecializationDecl(
1048  VisitCXXRecordDecl(D);
1049  dumpTemplateArgumentList(D->getTemplateArgs());
1050 }
1051 
1052 void ASTDumper::VisitClassTemplatePartialSpecializationDecl(
1054  VisitClassTemplateSpecializationDecl(D);
1055  dumpTemplateParameters(D->getTemplateParameters());
1056 }
1057 
1058 void ASTDumper::VisitClassScopeFunctionSpecializationDecl(
1060  dumpDecl(D->getSpecialization());
1061  if (D->hasExplicitTemplateArgs())
1062  dumpTemplateArgumentListInfo(D->templateArgs());
1063 }
1064 
1065 void ASTDumper::VisitVarTemplateDecl(const VarTemplateDecl *D) {
1066  dumpTemplateDecl(D, false);
1067 }
1068 
1069 void ASTDumper::VisitBuiltinTemplateDecl(const BuiltinTemplateDecl *D) {
1070  NodeDumper.dumpName(D);
1071  dumpTemplateParameters(D->getTemplateParameters());
1072 }
1073 
1074 void ASTDumper::VisitVarTemplateSpecializationDecl(
1075  const VarTemplateSpecializationDecl *D) {
1076  dumpTemplateArgumentList(D->getTemplateArgs());
1077  VisitVarDecl(D);
1078 }
1079 
1080 void ASTDumper::VisitVarTemplatePartialSpecializationDecl(
1082  dumpTemplateParameters(D->getTemplateParameters());
1083  VisitVarTemplateSpecializationDecl(D);
1084 }
1085 
1086 void ASTDumper::VisitTemplateTypeParmDecl(const TemplateTypeParmDecl *D) {
1087  if (D->wasDeclaredWithTypename())
1088  OS << " typename";
1089  else
1090  OS << " class";
1091  OS << " depth " << D->getDepth() << " index " << D->getIndex();
1092  if (D->isParameterPack())
1093  OS << " ...";
1094  NodeDumper.dumpName(D);
1095  if (D->hasDefaultArgument())
1096  dumpTemplateArgument(D->getDefaultArgument(), SourceRange(),
1098  D->defaultArgumentWasInherited() ? "inherited from"
1099  : "previous");
1100 }
1101 
1102 void ASTDumper::VisitNonTypeTemplateParmDecl(const NonTypeTemplateParmDecl *D) {
1103  NodeDumper.dumpType(D->getType());
1104  OS << " depth " << D->getDepth() << " index " << D->getIndex();
1105  if (D->isParameterPack())
1106  OS << " ...";
1107  NodeDumper.dumpName(D);
1108  if (D->hasDefaultArgument())
1109  dumpTemplateArgument(D->getDefaultArgument(), SourceRange(),
1111  D->defaultArgumentWasInherited() ? "inherited from"
1112  : "previous");
1113 }
1114 
1115 void ASTDumper::VisitTemplateTemplateParmDecl(
1116  const TemplateTemplateParmDecl *D) {
1117  OS << " depth " << D->getDepth() << " index " << D->getIndex();
1118  if (D->isParameterPack())
1119  OS << " ...";
1120  NodeDumper.dumpName(D);
1121  dumpTemplateParameters(D->getTemplateParameters());
1122  if (D->hasDefaultArgument())
1123  dumpTemplateArgumentLoc(
1125  D->defaultArgumentWasInherited() ? "inherited from" : "previous");
1126 }
1127 
1128 void ASTDumper::VisitUsingDecl(const UsingDecl *D) {
1129  OS << ' ';
1130  if (D->getQualifier())
1132  OS << D->getNameAsString();
1133 }
1134 
1135 void ASTDumper::VisitUnresolvedUsingTypenameDecl(
1136  const UnresolvedUsingTypenameDecl *D) {
1137  OS << ' ';
1138  if (D->getQualifier())
1140  OS << D->getNameAsString();
1141 }
1142 
1143 void ASTDumper::VisitUnresolvedUsingValueDecl(const UnresolvedUsingValueDecl *D) {
1144  OS << ' ';
1145  if (D->getQualifier())
1147  OS << D->getNameAsString();
1148  NodeDumper.dumpType(D->getType());
1149 }
1150 
1151 void ASTDumper::VisitUsingShadowDecl(const UsingShadowDecl *D) {
1152  OS << ' ';
1153  NodeDumper.dumpBareDeclRef(D->getTargetDecl());
1154  if (auto *TD = dyn_cast<TypeDecl>(D->getUnderlyingDecl()))
1155  dumpTypeAsChild(TD->getTypeForDecl());
1156 }
1157 
1158 void ASTDumper::VisitConstructorUsingShadowDecl(
1159  const ConstructorUsingShadowDecl *D) {
1160  if (D->constructsVirtualBase())
1161  OS << " virtual";
1162 
1163  dumpChild([=] {
1164  OS << "target ";
1165  NodeDumper.dumpBareDeclRef(D->getTargetDecl());
1166  });
1167 
1168  dumpChild([=] {
1169  OS << "nominated ";
1170  NodeDumper.dumpBareDeclRef(D->getNominatedBaseClass());
1171  OS << ' ';
1173  });
1174 
1175  dumpChild([=] {
1176  OS << "constructed ";
1177  NodeDumper.dumpBareDeclRef(D->getConstructedBaseClass());
1178  OS << ' ';
1180  });
1181 }
1182 
1183 void ASTDumper::VisitLinkageSpecDecl(const LinkageSpecDecl *D) {
1184  switch (D->getLanguage()) {
1185  case LinkageSpecDecl::lang_c: OS << " C"; break;
1186  case LinkageSpecDecl::lang_cxx: OS << " C++"; break;
1187  }
1188 }
1189 
1190 void ASTDumper::VisitAccessSpecDecl(const AccessSpecDecl *D) {
1191  OS << ' ';
1192  NodeDumper.dumpAccessSpecifier(D->getAccess());
1193 }
1194 
1195 void ASTDumper::VisitFriendDecl(const FriendDecl *D) {
1196  if (TypeSourceInfo *T = D->getFriendType())
1197  NodeDumper.dumpType(T->getType());
1198  else
1199  dumpDecl(D->getFriendDecl());
1200 }
1201 
1202 //===----------------------------------------------------------------------===//
1203 // Obj-C Declarations
1204 //===----------------------------------------------------------------------===//
1205 
1206 void ASTDumper::VisitObjCIvarDecl(const ObjCIvarDecl *D) {
1207  NodeDumper.dumpName(D);
1208  NodeDumper.dumpType(D->getType());
1209  if (D->getSynthesize())
1210  OS << " synthesize";
1211 
1212  switch (D->getAccessControl()) {
1213  case ObjCIvarDecl::None:
1214  OS << " none";
1215  break;
1216  case ObjCIvarDecl::Private:
1217  OS << " private";
1218  break;
1220  OS << " protected";
1221  break;
1222  case ObjCIvarDecl::Public:
1223  OS << " public";
1224  break;
1225  case ObjCIvarDecl::Package:
1226  OS << " package";
1227  break;
1228  }
1229 }
1230 
1231 void ASTDumper::VisitObjCMethodDecl(const ObjCMethodDecl *D) {
1232  if (D->isInstanceMethod())
1233  OS << " -";
1234  else
1235  OS << " +";
1236  NodeDumper.dumpName(D);
1237  NodeDumper.dumpType(D->getReturnType());
1238 
1239  if (D->isThisDeclarationADefinition()) {
1240  dumpDeclContext(D);
1241  } else {
1242  for (const ParmVarDecl *Parameter : D->parameters())
1243  dumpDecl(Parameter);
1244  }
1245 
1246  if (D->isVariadic())
1247  dumpChild([=] { OS << "..."; });
1248 
1249  if (D->hasBody())
1250  dumpStmt(D->getBody());
1251 }
1252 
1253 void ASTDumper::VisitObjCTypeParamDecl(const ObjCTypeParamDecl *D) {
1254  NodeDumper.dumpName(D);
1255  switch (D->getVariance()) {
1257  break;
1258 
1260  OS << " covariant";
1261  break;
1262 
1264  OS << " contravariant";
1265  break;
1266  }
1267 
1268  if (D->hasExplicitBound())
1269  OS << " bounded";
1270  NodeDumper.dumpType(D->getUnderlyingType());
1271 }
1272 
1273 void ASTDumper::VisitObjCCategoryDecl(const ObjCCategoryDecl *D) {
1274  NodeDumper.dumpName(D);
1275  NodeDumper.dumpDeclRef(D->getClassInterface());
1276  NodeDumper.dumpDeclRef(D->getImplementation());
1278  E = D->protocol_end();
1279  I != E; ++I)
1280  NodeDumper.dumpDeclRef(*I);
1281  dumpObjCTypeParamList(D->getTypeParamList());
1282 }
1283 
1284 void ASTDumper::VisitObjCCategoryImplDecl(const ObjCCategoryImplDecl *D) {
1285  NodeDumper.dumpName(D);
1286  NodeDumper.dumpDeclRef(D->getClassInterface());
1287  NodeDumper.dumpDeclRef(D->getCategoryDecl());
1288 }
1289 
1290 void ASTDumper::VisitObjCProtocolDecl(const ObjCProtocolDecl *D) {
1291  NodeDumper.dumpName(D);
1292 
1293  for (auto *Child : D->protocols())
1294  NodeDumper.dumpDeclRef(Child);
1295 }
1296 
1297 void ASTDumper::VisitObjCInterfaceDecl(const ObjCInterfaceDecl *D) {
1298  NodeDumper.dumpName(D);
1299  NodeDumper.dumpDeclRef(D->getSuperClass(), "super");
1300 
1301  NodeDumper.dumpDeclRef(D->getImplementation());
1302  for (auto *Child : D->protocols())
1303  NodeDumper.dumpDeclRef(Child);
1304  dumpObjCTypeParamList(D->getTypeParamListAsWritten());
1305 }
1306 
1307 void ASTDumper::VisitObjCImplementationDecl(const ObjCImplementationDecl *D) {
1308  NodeDumper.dumpName(D);
1309  NodeDumper.dumpDeclRef(D->getSuperClass(), "super");
1310  NodeDumper.dumpDeclRef(D->getClassInterface());
1312  E = D->init_end();
1313  I != E; ++I)
1314  dumpCXXCtorInitializer(*I);
1315 }
1316 
1317 void ASTDumper::VisitObjCCompatibleAliasDecl(const ObjCCompatibleAliasDecl *D) {
1318  NodeDumper.dumpName(D);
1319  NodeDumper.dumpDeclRef(D->getClassInterface());
1320 }
1321 
1322 void ASTDumper::VisitObjCPropertyDecl(const ObjCPropertyDecl *D) {
1323  NodeDumper.dumpName(D);
1324  NodeDumper.dumpType(D->getType());
1325 
1327  OS << " required";
1329  OS << " optional";
1330 
1332  if (Attrs != ObjCPropertyDecl::OBJC_PR_noattr) {
1334  OS << " readonly";
1336  OS << " assign";
1338  OS << " readwrite";
1340  OS << " retain";
1341  if (Attrs & ObjCPropertyDecl::OBJC_PR_copy)
1342  OS << " copy";
1344  OS << " nonatomic";
1346  OS << " atomic";
1347  if (Attrs & ObjCPropertyDecl::OBJC_PR_weak)
1348  OS << " weak";
1350  OS << " strong";
1352  OS << " unsafe_unretained";
1353  if (Attrs & ObjCPropertyDecl::OBJC_PR_class)
1354  OS << " class";
1356  NodeDumper.dumpDeclRef(D->getGetterMethodDecl(), "getter");
1358  NodeDumper.dumpDeclRef(D->getSetterMethodDecl(), "setter");
1359  }
1360 }
1361 
1362 void ASTDumper::VisitObjCPropertyImplDecl(const ObjCPropertyImplDecl *D) {
1363  NodeDumper.dumpName(D->getPropertyDecl());
1365  OS << " synthesize";
1366  else
1367  OS << " dynamic";
1368  NodeDumper.dumpDeclRef(D->getPropertyDecl());
1369  NodeDumper.dumpDeclRef(D->getPropertyIvarDecl());
1370 }
1371 
1372 void ASTDumper::Visit(const BlockDecl::Capture &C) {
1373  dumpChild([=] {
1374  NodeDumper.Visit(C);
1375  if (C.hasCopyExpr())
1376  dumpStmt(C.getCopyExpr());
1377  });
1378 }
1379 
1380 void ASTDumper::VisitBlockDecl(const BlockDecl *D) {
1381  for (auto I : D->parameters())
1382  dumpDecl(I);
1383 
1384  if (D->isVariadic())
1385  dumpChild([=]{ OS << "..."; });
1386 
1387  if (D->capturesCXXThis())
1388  dumpChild([=]{ OS << "capture this"; });
1389 
1390  for (const auto &I : D->captures())
1391  Visit(I);
1392  dumpStmt(D->getBody());
1393 }
1394 
1395 //===----------------------------------------------------------------------===//
1396 // Stmt dumping methods.
1397 //===----------------------------------------------------------------------===//
1398 
1399 void ASTDumper::dumpStmt(const Stmt *S, StringRef Label) {
1400  dumpChild(Label, [=] {
1401  NodeDumper.Visit(S);
1402 
1403  if (!S) {
1404  return;
1405  }
1406 
1408 
1409  // Some statements have custom mechanisms for dumping their children.
1410  if (isa<DeclStmt>(S) || isa<GenericSelectionExpr>(S)) {
1411  return;
1412  }
1413 
1414  for (const Stmt *SubStmt : S->children())
1415  dumpStmt(SubStmt);
1416  });
1417 }
1418 
1419 void ASTDumper::VisitDeclStmt(const DeclStmt *Node) {
1420  for (DeclStmt::const_decl_iterator I = Node->decl_begin(),
1421  E = Node->decl_end();
1422  I != E; ++I)
1423  dumpDecl(*I);
1424 }
1425 
1426 void ASTDumper::VisitAttributedStmt(const AttributedStmt *Node) {
1427  for (ArrayRef<const Attr *>::iterator I = Node->getAttrs().begin(),
1428  E = Node->getAttrs().end();
1429  I != E; ++I)
1430  dumpAttr(*I);
1431 }
1432 
1433 void ASTDumper::VisitCXXCatchStmt(const CXXCatchStmt *Node) {
1434  dumpDecl(Node->getExceptionDecl());
1435 }
1436 
1437 void ASTDumper::VisitCapturedStmt(const CapturedStmt *Node) {
1438  dumpDecl(Node->getCapturedDecl());
1439 }
1440 
1441 //===----------------------------------------------------------------------===//
1442 // OpenMP dumping methods.
1443 //===----------------------------------------------------------------------===//
1444 
1445 void ASTDumper::Visit(const OMPClause *C) {
1446  dumpChild([=] {
1447  NodeDumper.Visit(C);
1448  for (auto *S : C->children())
1449  dumpStmt(S);
1450  });
1451 }
1452 
1453 void ASTDumper::VisitOMPExecutableDirective(
1454  const OMPExecutableDirective *Node) {
1455  for (const auto *C : Node->clauses())
1456  Visit(C);
1457 }
1458 
1459 //===----------------------------------------------------------------------===//
1460 // Expr dumping methods.
1461 //===----------------------------------------------------------------------===//
1462 
1463 
1464 void ASTDumper::VisitInitListExpr(const InitListExpr *ILE) {
1465  if (auto *Filler = ILE->getArrayFiller()) {
1466  dumpStmt(Filler, "array_filler");
1467  }
1468 }
1469 
1470 void ASTDumper::VisitBlockExpr(const BlockExpr *Node) {
1471  dumpDecl(Node->getBlockDecl());
1472 }
1473 
1474 void ASTDumper::VisitOpaqueValueExpr(const OpaqueValueExpr *Node) {
1475  if (Expr *Source = Node->getSourceExpr())
1476  dumpStmt(Source);
1477 }
1478 
1479 void ASTDumper::VisitGenericSelectionExpr(const GenericSelectionExpr *E) {
1480  if (E->isResultDependent())
1481  OS << " result_dependent";
1482  dumpStmt(E->getControllingExpr());
1483  dumpTypeAsChild(E->getControllingExpr()->getType()); // FIXME: remove
1484 
1485  for (unsigned I = 0, N = E->getNumAssocs(); I != N; ++I) {
1486  dumpChild([=] {
1487  if (const TypeSourceInfo *TSI = E->getAssocTypeSourceInfo(I)) {
1488  OS << "case ";
1489  NodeDumper.dumpType(TSI->getType());
1490  } else {
1491  OS << "default";
1492  }
1493 
1494  if (!E->isResultDependent() && E->getResultIndex() == I)
1495  OS << " selected";
1496 
1497  if (const TypeSourceInfo *TSI = E->getAssocTypeSourceInfo(I))
1498  dumpTypeAsChild(TSI->getType());
1499  dumpStmt(E->getAssocExpr(I));
1500  });
1501  }
1502 }
1503 
1504 //===----------------------------------------------------------------------===//
1505 // C++ Expressions
1506 //===----------------------------------------------------------------------===//
1507 
1508 void ASTDumper::VisitSizeOfPackExpr(const SizeOfPackExpr *Node) {
1509  if (Node->isPartiallySubstituted())
1510  for (const auto &A : Node->getPartialArguments())
1511  dumpTemplateArgument(A);
1512 }
1513 
1514 //===----------------------------------------------------------------------===//
1515 // Obj-C Expressions
1516 //===----------------------------------------------------------------------===//
1517 
1518 void ASTDumper::VisitObjCAtCatchStmt(const ObjCAtCatchStmt *Node) {
1519  if (const VarDecl *CatchParam = Node->getCatchParamDecl())
1520  dumpDecl(CatchParam);
1521 }
1522 
1523 //===----------------------------------------------------------------------===//
1524 // Comments
1525 //===----------------------------------------------------------------------===//
1526 
1527 void ASTDumper::dumpComment(const Comment *C, const FullComment *FC) {
1528  dumpChild([=] {
1529  NodeDumper.Visit(C, FC);
1530  if (!C) {
1531  return;
1532  }
1534  for (Comment::child_iterator I = C->child_begin(), E = C->child_end();
1535  I != E; ++I)
1536  dumpComment(*I, FC);
1537  });
1538 }
1539 
1540 //===----------------------------------------------------------------------===//
1541 // Type method implementations
1542 //===----------------------------------------------------------------------===//
1543 
1544 void QualType::dump(const char *msg) const {
1545  if (msg)
1546  llvm::errs() << msg << ": ";
1547  dump();
1548 }
1549 
1550 LLVM_DUMP_METHOD void QualType::dump() const { dump(llvm::errs()); }
1551 
1552 LLVM_DUMP_METHOD void QualType::dump(llvm::raw_ostream &OS) const {
1553  ASTDumper Dumper(OS, nullptr, nullptr);
1554  Dumper.dumpTypeAsChild(*this);
1555 }
1556 
1557 LLVM_DUMP_METHOD void Type::dump() const { dump(llvm::errs()); }
1558 
1559 LLVM_DUMP_METHOD void Type::dump(llvm::raw_ostream &OS) const {
1560  QualType(this, 0).dump(OS);
1561 }
1562 
1563 //===----------------------------------------------------------------------===//
1564 // Decl method implementations
1565 //===----------------------------------------------------------------------===//
1566 
1567 LLVM_DUMP_METHOD void Decl::dump() const { dump(llvm::errs()); }
1568 
1569 LLVM_DUMP_METHOD void Decl::dump(raw_ostream &OS, bool Deserialize) const {
1570  const ASTContext &Ctx = getASTContext();
1571  const SourceManager &SM = Ctx.getSourceManager();
1572  ASTDumper P(OS, &Ctx.getCommentCommandTraits(), &SM,
1574  P.setDeserialize(Deserialize);
1575  P.dumpDecl(this);
1576 }
1577 
1578 LLVM_DUMP_METHOD void Decl::dumpColor() const {
1579  const ASTContext &Ctx = getASTContext();
1580  ASTDumper P(llvm::errs(), &Ctx.getCommentCommandTraits(),
1581  &Ctx.getSourceManager(), /*ShowColors*/ true,
1582  Ctx.getPrintingPolicy());
1583  P.dumpDecl(this);
1584 }
1585 
1586 LLVM_DUMP_METHOD void DeclContext::dumpLookups() const {
1587  dumpLookups(llvm::errs());
1588 }
1589 
1590 LLVM_DUMP_METHOD void DeclContext::dumpLookups(raw_ostream &OS,
1591  bool DumpDecls,
1592  bool Deserialize) const {
1593  const DeclContext *DC = this;
1594  while (!DC->isTranslationUnit())
1595  DC = DC->getParent();
1596  ASTContext &Ctx = cast<TranslationUnitDecl>(DC)->getASTContext();
1597  const SourceManager &SM = Ctx.getSourceManager();
1598  ASTDumper P(OS, &Ctx.getCommentCommandTraits(), &Ctx.getSourceManager(),
1600  P.setDeserialize(Deserialize);
1601  P.dumpLookups(this, DumpDecls);
1602 }
1603 
1604 //===----------------------------------------------------------------------===//
1605 // Stmt method implementations
1606 //===----------------------------------------------------------------------===//
1607 
1608 LLVM_DUMP_METHOD void Stmt::dump(SourceManager &SM) const {
1609  dump(llvm::errs(), SM);
1610 }
1611 
1612 LLVM_DUMP_METHOD void Stmt::dump(raw_ostream &OS, SourceManager &SM) const {
1613  ASTDumper P(OS, nullptr, &SM);
1614  P.dumpStmt(this);
1615 }
1616 
1617 LLVM_DUMP_METHOD void Stmt::dump(raw_ostream &OS) const {
1618  ASTDumper P(OS, nullptr, nullptr);
1619  P.dumpStmt(this);
1620 }
1621 
1622 LLVM_DUMP_METHOD void Stmt::dump() const {
1623  ASTDumper P(llvm::errs(), nullptr, nullptr);
1624  P.dumpStmt(this);
1625 }
1626 
1627 LLVM_DUMP_METHOD void Stmt::dumpColor() const {
1628  ASTDumper P(llvm::errs(), nullptr, nullptr, /*ShowColors*/true);
1629  P.dumpStmt(this);
1630 }
1631 
1632 //===----------------------------------------------------------------------===//
1633 // Comment method implementations
1634 //===----------------------------------------------------------------------===//
1635 
1636 LLVM_DUMP_METHOD void Comment::dump() const {
1637  dump(llvm::errs(), nullptr, nullptr);
1638 }
1639 
1640 LLVM_DUMP_METHOD void Comment::dump(const ASTContext &Context) const {
1641  dump(llvm::errs(), &Context.getCommentCommandTraits(),
1642  &Context.getSourceManager());
1643 }
1644 
1645 void Comment::dump(raw_ostream &OS, const CommandTraits *Traits,
1646  const SourceManager *SM) const {
1647  const FullComment *FC = dyn_cast<FullComment>(this);
1648  if (!FC)
1649  return;
1650  ASTDumper D(OS, Traits, SM);
1651  D.dumpComment(FC, FC);
1652 }
1653 
1654 LLVM_DUMP_METHOD void Comment::dumpColor() const {
1655  const FullComment *FC = dyn_cast<FullComment>(this);
1656  if (!FC)
1657  return;
1658  ASTDumper D(llvm::errs(), nullptr, nullptr, /*ShowColors*/true);
1659  D.dumpComment(FC, FC);
1660 }
void dump() const
Definition: ASTDumper.cpp:1557
QualType getPattern() const
Retrieve the pattern of this pack expansion, which is the type that will be repeatedly instantiated w...
Definition: Type.h:5376
Defines the clang::ASTContext interface.
const BlockDecl * getBlockDecl() const
Definition: Expr.h:5196
bool hasCopyExpr() const
Definition: Decl.h:3903
const Type * Ty
The locally-unqualified type.
Definition: Type.h:579
NamedDecl * getTargetDecl() const
Gets the underlying declaration which has been brought into the local scope.
Definition: DeclCXX.h:3201
Represents a function declaration or definition.
Definition: Decl.h:1738
Expr * getInit() const
Get the initializer.
Definition: DeclCXX.h:2454
bool isThisDeclarationADefinition() const
Returns whether this specific method is a definition.
Definition: DeclObjC.h:515
decl_iterator noload_decls_begin() const
Definition: DeclBase.h:2008
protocol_range protocols() const
Definition: DeclObjC.h:1366
Expr * getCopyExpr() const
Definition: Decl.h:3904
A class which contains all the information about a particular captured value.
Definition: Decl.h:3864
PointerType - C99 6.7.5.1 - Pointer Declarators.
Definition: Type.h:2537
QualType getElementType() const
Definition: Type.h:6016
QualType getPointeeType() const
Definition: Type.h:2550
A (possibly-)qualified type.
Definition: Type.h:638
base_class_range bases()
Definition: DeclCXX.h:823
ArrayRef< OMPClause * > clauses()
Definition: StmtOpenMP.h:260
ObjCInterfaceDecl * getClassInterface()
Definition: DeclObjC.h:2325
ConstStmtVisitor - This class implements a simple visitor for Stmt subclasses.
Definition: StmtVisitor.h:193
ObjCIvarDecl * getPropertyIvarDecl() const
Definition: DeclObjC.h:2827
unsigned getResultIndex() const
The zero-based index of the result expression&#39;s generic association in the generic selection&#39;s associ...
Definition: Expr.h:5084
Expr * getUnderlyingExpr() const
Definition: Type.h:4256
attr_iterator attr_begin() const
Definition: DeclBase.h:494
Stmt - This represents one statement.
Definition: Stmt.h:66
Expr * getBitWidth() const
Definition: Decl.h:2668
FunctionType - C99 6.7.5.3 - Function Declarators.
Definition: Type.h:3355
An instance of this object exists for each enum constant that is defined.
Definition: Decl.h:2786
StorageClass getStorageClass() const
Returns the storage class as written in the source.
Definition: Decl.h:1020
Represents the declaration of a typedef-name via the &#39;typedef&#39; type specifier.
Definition: Decl.h:3018
Defines the SourceManager interface.
unsigned size() const
Retrieve the number of template arguments in this template argument list.
Definition: DeclTemplate.h:270
Defines the clang::Module class, which describes a module in the source code.
Decl - This represents one declaration (or definition), e.g.
Definition: DeclBase.h:87
bool needsOverloadResolutionForDestructor() const
Determine whether we need to eagerly declare a destructor for this class.
Definition: DeclCXX.h:1191
StringRef P
NamedDecl * getTemplatedDecl() const
Get the underlying, templated declaration.
Definition: DeclTemplate.h:453
Represents an attribute applied to a statement.
Definition: Stmt.h:1633
Decl * getPreviousDecl()
Retrieve the previous declaration that declares the same entity as this declaration, or NULL if there is no previous declaration.
Definition: DeclBase.h:953
The base class of the type hierarchy.
Definition: Type.h:1407
The parameter is covariant, e.g., X<T> is a subtype of X<U> when the type parameter is covariant and ...
#define FLAG(fn, name)
const DefArgStorage & getDefaultArgStorage() const
Declaration of a variable template.
Represents an array type, per C99 6.7.5.2 - Array Declarators.
Definition: Type.h:2812
Represent a C++ namespace.
Definition: Decl.h:515
RetTy Visit(const Type *T)
Performs the operation associated with this visitor object.
Definition: TypeVisitor.h:69
A container of type source information.
Definition: Decl.h:87
QualType getValueType() const
Gets the type contained by this atomic type, i.e.
Definition: Type.h:5983
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
child_iterator child_begin() const
Definition: Comment.cpp:68
bool hasExternalVisibleStorage() const
Whether this DeclContext has external storage containing additional declarations that are visible in ...
Definition: DeclBase.h:2324
bool isVirtualAsWritten() const
Whether this function is marked as virtual explicitly.
Definition: Decl.h:2000
bool needsOverloadResolutionForCopyConstructor() const
Determine whether we need to eagerly declare a defaulted copy constructor for this class...
Definition: DeclCXX.h:1008
QualType getElementType() const
Definition: Type.h:2847
void dumpSourceRange(SourceRange R)
bool isCompleteDefinition() const
Return true if this decl has its body fully specified.
Definition: Decl.h:3169
bool defaultArgumentWasInherited() const
Determines whether the default argument was inherited from a previous declaration of this template...
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
lookups_range noload_lookups(bool PreserveInternalState) const
Definition: DeclLookups.h:90
Represents a #pragma comment line.
Definition: Decl.h:140
CXXCtorInitializer *const * init_const_iterator
init_const_iterator - Iterates through the ivar initializer list.
Definition: DeclObjC.h:2609
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:54
Represents a variable declaration or definition.
Definition: Decl.h:813
bool isFixed() const
Returns true if this is an Objective-C, C++11, or Microsoft-style enumeration with a fixed underlying...
Definition: Decl.h:3529
NamedDecl *const * const_iterator
Iterates through the template parameters in this list.
Definition: DeclTemplate.h:117
const T * getAs() const
Member-template getAs<specific type>&#39;.
Definition: Type.h:6748
ObjCCategoryImplDecl * getImplementation() const
Definition: DeclObjC.cpp:2020
bool hasDefaultArgument() const
Determine whether this template parameter has a default argument.
Extra information about a function prototype.
Definition: Type.h:3767
decl_range decls() const
decls_begin/decls_end - Iterate over the declarations stored in this context.
Definition: DeclBase.h:1997
Represents a variable template specialization, which refers to a variable template with a given set o...
ObjCMethodDecl - Represents an instance or class method declaration.
Definition: DeclObjC.h:139
NamedDecl * getUnderlyingDecl()
Looks through UsingDecls and ObjCCompatibleAliasDecls for the underlying named decl.
Definition: Decl.h:432
Stores a list of template parameters for a TemplateDecl and its derived classes.
Definition: DeclTemplate.h:68
Not a TLS variable.
Definition: Decl.h:830
Describes how types, statements, expressions, and declarations should be printed. ...
Definition: PrettyPrinter.h:38
protocol_range protocols() const
Definition: DeclObjC.h:2129
Represents a parameter to a function.
Definition: Decl.h:1550
Represents the result of substituting a type for a template type parameter.
Definition: Type.h:4603
Represents the builtin template declaration which is used to implement __make_integer_seq and other b...
CXXRecordDecl * getLambdaClass() const
Retrieve the class that corresponds to the lambda.
Definition: ExprCXX.cpp:1196
const ObjCInterfaceDecl * getSuperClass() const
Definition: DeclObjC.h:2689
PipeType - OpenCL20.
Definition: Type.h:6002
Represents a struct/union/class.
Definition: Decl.h:3593
clauselist_range clauselists()
Definition: DeclOpenMP.h:295
LanguageIDs getLanguage() const
Return the language specified by this linkage specification.
Definition: DeclCXX.h:2860
void dumpColor() const
Definition: ASTDumper.cpp:1578
const TemplateArgumentList & getTemplateArgs() const
Retrieve the template arguments of the class template specialization.
const char * getOpenMPClauseName(OpenMPClauseKind Kind)
Definition: OpenMPKinds.cpp:62
QualType getOriginalType() const
Definition: Type.h:2601
Represents a class template specialization, which refers to a class template with a given set of temp...
TypeSourceInfo * getFriendType() const
If this friend declaration names an (untemplated but possibly dependent) type, return the type; other...
Definition: DeclFriend.h:124
unsigned getDepth() const
Retrieve the depth of the template parameter.
StringLiteral * getMessage()
Definition: DeclCXX.h:3772
DeclGroupRef::const_iterator const_decl_iterator
Definition: Stmt.h:1182
QualType getPointeeType() const
Definition: Type.h:2654
Expr * getAsExpr() const
Retrieve the template argument as an expression.
Definition: TemplateBase.h:330
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:155
bool isInline() const
Returns true if this is an inline namespace declaration.
Definition: Decl.h:576
The results of name lookup within a DeclContext.
Definition: DeclBase.h:1187
ArrayRef< QualType > getParamTypes() const
Definition: Type.h:3895
attr_iterator attr_end() const
Definition: DeclBase.h:497
The parameter is contravariant, e.g., X<T> is a subtype of X<U> when the type parameter is covariant ...
const DefArgStorage & getDefaultArgStorage() const
Represents a member of a struct/union/class.
Definition: Decl.h:2579
A simple visitor class that helps create attribute visitors.
Definition: AttrVisitor.h:70
An operation on a type.
Definition: TypeVisitor.h:65
StringRef getValue() const
Definition: Decl.h:198
InitKind getInitializerKind() const
Get initializer kind.
Definition: DeclOpenMP.h:174
ObjCMethodDecl * getSetterMethodDecl() const
Definition: DeclObjC.h:925
NamedDecl * getFriendDecl() const
If this friend declaration doesn&#39;t name a type, return the inner declaration.
Definition: DeclFriend.h:139
void dumpLookups() const
Definition: ASTDumper.cpp:1586
ObjCTypeParamList * getTypeParamListAsWritten() const
Retrieve the type parameters written on this particular declaration of the class. ...
Definition: DeclObjC.h:1311
Represents the result of substituting a set of types for a template type parameter pack...
Definition: Type.h:4659
Expr * getSourceExpr() const
The source expression of an opaque value expression is the expression which originally generated the ...
Definition: Expr.h:1003
void dumpColor() const
dumpColor - same as dump(), but forces color highlighting.
Definition: ASTDumper.cpp:1627
Stmt * getBody() const override
getBody - If this Decl represents a declaration for a body of code, such as a function or method defi...
Definition: Decl.h:3937
Represents an access specifier followed by colon &#39;:&#39;.
Definition: DeclCXX.h:132
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
Definition: LangOptions.h:50
Declaration of a function specialization at template class scope.
SourceRange getSourceRange() const LLVM_READONLY
ArrayRef< ParmVarDecl * > parameters() const
Definition: Decl.h:2262
Represents Objective-C&#39;s @catch statement.
Definition: StmtObjC.h:74
TypeAliasDecl * getTemplatedDecl() const
Get the underlying function declaration of the template.
Describes an C or C++ initializer list.
Definition: Expr.h:4190
Represents a C++ using-declaration.
Definition: DeclCXX.h:3352
Stmt * getBody() const override
getBody - If this Decl represents a declaration for a body of code, such as a function or method defi...
Definition: Decl.cpp:4466
ArrayRef< BindingDecl * > bindings() const
Definition: DeclCXX.h:3875
Expr * getInitializer()
Get initializer expression (if specified) of the declare reduction construct.
Definition: DeclOpenMP.h:171
bool isBitField() const
Determines whether this field is a bitfield.
Definition: Decl.h:2657
Stmt * getBody(const FunctionDecl *&Definition) const
Retrieve the body (definition) of the function.
Definition: Decl.cpp:2731
std::string getFullModuleName(bool AllowStringLiterals=false) const
Retrieve the full name of this module, including the path from its top-level module.
Definition: Module.cpp:214
A convenient class for passing around template argument information.
Definition: TemplateBase.h:555
static void dump(llvm::raw_ostream &OS, StringRef FunctionName, ArrayRef< CounterExpression > Expressions, ArrayRef< CounterMappingRegion > Regions)
const TemplateArgumentList & getTemplateArgs() const
Retrieve the template arguments of the variable template specialization.
ArrayRef< NamedDecl * > chain() const
Definition: Decl.h:2847
A simple visitor class that helps create template argument visitors.
PropertyAttributeKind getPropertyAttributes() const
Definition: DeclObjC.h:840
child_range children()
Definition: Stmt.cpp:237
Represents a typeof (or typeof) expression (a GCC extension).
Definition: Type.h:4176
const clang::PrintingPolicy & getPrintingPolicy() const
Definition: ASTContext.h:654
const Expr * getAssocExpr(unsigned i) const
Definition: Expr.h:5048
const Type * getClass() const
Definition: Type.h:2790
Any part of the comment.
Definition: Comment.h:53
bool isConstexpr() const
Whether this variable is (C++11) constexpr.
Definition: Decl.h:1382
FunctionTemplateSpecializationInfo * getTemplateSpecializationInfo() const
If this function is actually a function template specialization, retrieve information about this func...
Definition: Decl.cpp:3469
static const TerminalColor DeclNameColor
Expr * getSizeExpr() const
Definition: Type.h:2991
unsigned getIndex() const
Get the index of the template parameter within its parameter list.
const Expr * getInitExpr() const
Definition: Decl.h:2805
DiagnosticsEngine & getDiagnostics() const
const Expr * getControllingExpr() const
Definition: Expr.h:5073
bool hasDefaultArgument() const
Determine whether this template parameter has a default argument.
Represents an Objective-C protocol declaration.
Definition: DeclObjC.h:2064
lookups_range lookups() const
Definition: DeclLookups.h:76
A C++ lambda expression, which produces a function object (of unspecified type) that can be invoked l...
Definition: ExprCXX.h:1649
decl_iterator decl_end()
Definition: Stmt.h:1193
PropertyControl getPropertyImplementation() const
Definition: DeclObjC.h:933
bool hasExplicitBound() const
Whether this type parameter has an explicitly-written type bound, e.g., "T : NSView".
Definition: DeclObjC.h:619
Represents the body of a CapturedStmt, and serves as its DeclContext.
Definition: Decl.h:4044
Represents an ObjC class declaration.
Definition: DeclObjC.h:1172
Represents a linkage specification.
Definition: DeclCXX.h:2826
QualType getReturnType() const
Definition: DeclObjC.h:323
void print(raw_ostream &OS, const PrintingPolicy &Policy, bool ResolveTemplateArguments=false) const
Print this nested name specifier to the given output stream.
bool isParameterPack() const
Whether this template template parameter is a template parameter pack.
FunctionDecl * SourceDecl
The function whose exception specification this is, for EST_Unevaluated and EST_Uninstantiated.
Definition: Type.h:3753
A binding in a decomposition declaration.
Definition: DeclCXX.h:3795
Expr * getSizeExpr() const
Definition: Type.h:3048
QualType getElementType() const
Definition: Type.h:3144
Represents an extended vector type where either the type or size is dependent.
Definition: Type.h:3128
param_iterator param_begin()
Definition: Decl.h:2274
Module * getImportedModule() const
Retrieve the module that was imported by the import declaration.
Definition: Decl.h:4193
StringRef getArg() const
Definition: Decl.h:165
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...
child_range children()
ObjCPropertyImplDecl - Represents implementation declaration of a property in a class or category imp...
Definition: DeclObjC.h:2759
Represents the declaration of a typedef-name via a C++11 alias-declaration.
Definition: Decl.h:3038
Represents a prototype with parameter type info, e.g.
Definition: Type.h:3687
Holds a QualType and a TypeSourceInfo* that came out of a declarator parsing.
Definition: LocInfoType.h:29
child_iterator child_end() const
Definition: Comment.cpp:82
decl_range noload_decls() const
noload_decls_begin/end - Iterate over the declarations stored in this context that are currently load...
Definition: DeclBase.h:2005
bool isParameterPack() const
Whether this parameter is a non-type template parameter pack.
Expr * getCombiner()
Get combiner expression of the declare reduction construct.
Definition: DeclOpenMP.h:153
This represents &#39;#pragma omp requires...&#39; directive.
Definition: DeclOpenMP.h:250
Represents an array type in C++ whose size is a value-dependent expression.
Definition: Type.h:3026
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
Definition: DeclTemplate.h:432
bool isCanonicalDecl() const
Whether this particular Decl is a canonical one.
Definition: DeclBase.h:876
QualType getElementType() const
Definition: Type.h:2490
bool isInlineSpecified() const
Determine whether the "inline" keyword was specified for this function.
Definition: Decl.h:2342
Represents a shadow constructor declaration introduced into a class by a C++11 using-declaration that...
Definition: DeclCXX.h:3240
Pepresents a block literal declaration, which is like an unnamed FunctionDecl.
Definition: Decl.h:3858
This represents one expression.
Definition: Expr.h:106
StringRef getKindName() const
Definition: Decl.h:3239
QualType getPointeeType() const
Definition: Type.h:2694
bool isDefaulted() const
Whether this function is defaulted per C++0x.
Definition: Decl.h:2034
std::string Label
bool isScopedUsingClassTag() const
Returns true if this is a C++11 scoped enumeration.
Definition: Decl.h:3523
Declaration of a template type parameter.
const TypeSourceInfo * getAssocTypeSourceInfo(unsigned i) const
Definition: Expr.h:5058
BlockExpr - Adaptor class for mixing a BlockDecl with expressions.
Definition: Expr.h:5182
VarDecl * getExceptionDecl() const
Definition: StmtCXX.h:50
comments::CommandTraits & getCommentCommandTraits() const
Definition: ASTContext.h:875
QualType getBaseType() const
Definition: Type.h:4315
ObjCInterfaceDecl * getSuperClass() const
Definition: DeclObjC.cpp:338
TLSKind getTLSKind() const
Definition: Decl.cpp:1936
Represents an expression that computes the length of a parameter pack.
Definition: ExprCXX.h:3844
StorageClass getStorageClass() const
Returns the storage class as written in the source.
Definition: Decl.h:2331
NonTypeTemplateParmDecl - Declares a non-type template parameter, e.g., "Size" in.
ConstructorUsingShadowDecl * getNominatedBaseClassShadowDecl() const
Get the inheriting constructor declaration for the direct base class from which this using shadow dec...
Definition: DeclCXX.h:3307
Represents the type decltype(expr) (C++11).
Definition: Type.h:4246
CXXRecordDecl * getConstructedBaseClass() const
Get the base class whose constructor or constructor shadow declaration is passed the constructor argu...
Definition: DeclCXX.h:3323
A std::pair-like structure for storing a qualified type split into its local qualifiers and its local...
Definition: Type.h:577
QualType getType() const
Definition: Expr.h:128
StorageClass
Storage classes.
Definition: Specifiers.h:206
A unary type transform, which is a type constructed from another.
Definition: Type.h:4289
Direct list-initialization (C++11)
Definition: Decl.h:824
Qualifiers Quals
The local qualifiers.
Definition: Type.h:582
Declaration of an alias template.
DeclContext * getParent()
getParent - Returns the containing DeclContext.
Definition: DeclBase.h:1752
bool isInstanceMethod() const
Definition: DeclObjC.h:422
Represents a GCC generic vector type.
Definition: Type.h:3168
TemplateTemplateParmDecl - Declares a template template parameter, e.g., "T" in.
StringRef getName() const
Definition: Decl.h:197
std::string getAsString() const
This template specialization was implicitly instantiated from a template.
Definition: Specifiers.h:152
bool isTrivial() const
Whether this function is "trivial" in some specialized C++ senses.
Definition: Decl.h:2026
InitializationStyle getInitStyle() const
The style of initialization for this declaration.
Definition: Decl.h:1279
QualType getType() const
Definition: DeclObjC.h:829
const SourceManager & SM
Definition: Format.cpp:1490
bool defaultArgumentWasInherited() const
Determines whether the default argument was inherited from a previous declaration of this template...
Expr * getUnderlyingExpr() const
Definition: Type.h:4185
init_iterator init_begin()
init_begin() - Retrieve an iterator to the first initializer.
Definition: DeclObjC.h:2621
NestedNameSpecifier * getQualifier() const
Retrieve the nested-name-specifier that qualifies the name.
Definition: DeclCXX.h:3706
bool hasQualifiers() const
Return true if the set contains any qualifiers.
Definition: Type.h:413
SplitQualType split() const
Divides a QualType into its unqualified type and a set of local qualifiers.
Definition: Type.h:6080
This class provides information about commands that can be used in comments.
OpaqueValueExpr - An expression referring to an opaque object of a fixed type and value class...
Definition: Expr.h:945
This captures a statement into a function.
Definition: Stmt.h:3105
ExceptionSpecificationType Type
The kind of exception specification this is.
Definition: Type.h:3743
ExtProtoInfo getExtProtoInfo() const
Definition: Type.h:3899
bool isParameterPack() const
Returns whether this is a parameter pack.
bool getSynthesize() const
Definition: DeclObjC.h:1991
QualType getReturnType() const
Definition: Type.h:3613
bool isPure() const
Whether this virtual function is pure, i.e.
Definition: Decl.h:2009
ObjCProtocolList::iterator protocol_iterator
Definition: DeclObjC.h:2353
This represents &#39;#pragma omp declare reduction ...&#39; directive.
Definition: DeclOpenMP.h:103
decl_iterator decls_begin() const
Definition: DeclBase.cpp:1371
NestedNameSpecifier * getQualifier() const
Retrieve the nested-name-specifier that qualifies the name.
Definition: DeclCXX.h:3616
void dumpPointer(const void *Ptr)
Pseudo declaration for capturing expressions.
Definition: DeclOpenMP.h:217
This is a basic class for representing single OpenMP executable directive.
Definition: StmtOpenMP.h:33
ObjCTypeParamList * getTypeParamList() const
Retrieve the type parameter list associated with this category or extension.
Definition: DeclObjC.h:2330
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:292
bool wasDeclaredWithTypename() const
Whether this template type parameter was declared with the &#39;typename&#39; keyword.
TemplateArgument getArgumentPack() const
Definition: Type.cpp:3272
const TemplateArgumentListInfo & templateArgs() const
ASTContext & getASTContext() const LLVM_READONLY
Definition: DeclBase.cpp:376
ObjCCategoryDecl * getCategoryDecl() const
Definition: DeclObjC.cpp:2064
QualType getElementType() const
Definition: Type.h:3203
DeclStmt - Adaptor class for mixing declarations with statements and expressions. ...
Definition: Stmt.h:1143
Represents the declaration of a label.
Definition: Decl.h:469
Represents a dependent using declaration which was not marked with typename.
Definition: DeclCXX.h:3571
Expr * getInClassInitializer() const
Get the C++11 default member initializer for this member, or null if one has not been set...
Definition: Decl.h:2721
Stmt * getBody() const override
Retrieve the body of this method, if it has one.
Definition: DeclObjC.cpp:852
Represents a static or instance method of a struct/union/class.
Definition: DeclCXX.h:2041
QualType getLocallyUnqualifiedSingleStepDesugaredType() const
Pull a single level of sugar off of this locally-unqualified type.
Definition: Type.cpp:302
C-style initialization with assignment.
Definition: Decl.h:818
This file defines OpenMP nodes for declarative directives.
bool isLiteral(TokenKind K)
Return true if this is a "literal" kind, like a numeric constant, string, etc.
Definition: TokenKinds.h:86
ObjCCategoryDecl - Represents a category declaration.
Definition: DeclObjC.h:2280
This is a basic class for representing single OpenMP clause.
Definition: OpenMPClause.h:51
const TemplateTypeParmType * getReplacedParameter() const
Gets the template parameter that was substituted for.
Definition: Type.h:4677
bool hasExternalLexicalStorage() const
Whether this DeclContext has external storage containing additional declarations that are lexically i...
Definition: DeclBase.h:2312
bool isScoped() const
Returns true if this is a C++11 scoped enumeration.
Definition: Decl.h:3520
static const TerminalColor NullColor
decl_iterator decl_begin()
Definition: Stmt.h:1192
Comment *const * child_iterator
Definition: Comment.h:224
bool hasDefaultArgument() const
Determine whether this template parameter has a default argument.
init_iterator init_end()
init_end() - Retrieve an iterator past the last initializer.
Definition: DeclObjC.h:2630
ConstructorUsingShadowDecl * getConstructedBaseClassShadowDecl() const
Get the inheriting constructor declaration for the base class for which we don&#39;t have an explicit ini...
Definition: DeclCXX.h:3313
Represents one property declaration in an Objective-C interface.
Definition: DeclObjC.h:729
void dumpDeclRef(const Decl *D, StringRef Label={})
This template specialization was instantiated from a template due to an explicit instantiation defini...
Definition: Specifiers.h:164
This template specialization was formed from a template-id but has not yet been declared, defined, or instantiated.
Definition: Specifiers.h:149
const ParmDecl * getInheritedFrom() const
Get the parameter from which we inherit the default argument, if any.
Definition: DeclTemplate.h:333
bool isOriginalNamespace() const
Return true if this declaration is an original (first) declaration of the namespace.
Definition: DeclCXX.cpp:2611
Represents a C++11 static_assert declaration.
Definition: DeclCXX.h:3746
decl_iterator noload_decls_end() const
Definition: DeclBase.h:2009
ObjCImplementationDecl * getImplementation() const
Definition: DeclObjC.cpp:1549
Expr * getArrayFiller()
If this initializer list initializes an array with more elements than there are initializers in the l...
Definition: Expr.h:4284
Describes a module import declaration, which makes the contents of the named module visible in the cu...
Definition: Decl.h:4149
Represents a pack expansion of types.
Definition: Type.h:5355
ArrayRef< TemplateArgument > pack_elements() const
Iterator range referencing all of the elements of a template argument pack.
Definition: TemplateBase.h:354
static const char * getStorageClassSpecifierString(StorageClass SC)
Return the string used to specify the storage class SC.
Definition: Decl.cpp:1888
Represents a C11 generic selection.
Definition: Expr.h:5015
ArrayRef< TemplateArgument > getPartialArguments() const
Get.
Definition: ExprCXX.h:3937
ast_type_traits::DynTypedNode Node
void dumpAccessSpecifier(AccessSpecifier AS)
TLS with a dynamic initializer.
Definition: Decl.h:836
Represents a template argument.
Definition: TemplateBase.h:51
Represents a type which was implicitly adjusted by the semantic engine for arbitrary reasons...
Definition: Type.h:2585
const ObjCInterfaceDecl * getClassInterface() const
Definition: DeclObjC.h:2440
NamespaceDecl * getNominatedNamespace()
Returns the namespace nominated by this using-directive.
Definition: DeclCXX.cpp:2566
unsigned getNumAssocs() const
Definition: Expr.h:5042
Dataflow Directional Tag Classes.
bool isResultDependent() const
Whether this generic selection is result-dependent.
Definition: Expr.h:5079
TypeSourceInfo * getTypeSourceInfo() const
Definition: LocInfoType.h:49
const TemplateArgument & getArgument() const
Definition: TemplateBase.h:499
not evaluated yet, for special member function
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
Definition: DeclBase.h:1262
static const TerminalColor AttrColor
ArrayRef< Capture > captures() const
Definition: Decl.h:3985
The base class of all kinds of template declarations (e.g., class, function, etc.).
Definition: DeclTemplate.h:399
bool isVariadic() const
Definition: Decl.h:3933
Kind getPropertyImplementation() const
Definition: DeclObjC.h:2823
ArrayRef< const Attr * > getAttrs() const
Definition: Stmt.h:1669
void dump() const
Definition: ASTDumper.cpp:1550
Represents a field injected from an anonymous union/struct into the parent scope. ...
Definition: Decl.h:2825
QualType getUnderlyingType() const
Definition: Decl.h:2971
AttrVec::const_iterator attr_iterator
Definition: DeclBase.h:487
AccessSpecifier getAccess() const
Definition: DeclBase.h:462
const Expr * getInit() const
Definition: Decl.h:1220
NamespaceDecl * getOriginalNamespace()
Get the original (first) namespace declaration.
Definition: DeclCXX.cpp:2597
A decomposition declaration.
Definition: DeclCXX.h:3843
This template specialization was instantiated from a template due to an explicit instantiation declar...
Definition: Specifiers.h:160
unsigned getIndex() const
Retrieve the index of the template parameter.
Represents a dependent using declaration which was marked with typename.
Definition: DeclCXX.h:3667
The name of a declaration.
Represents the declaration of an Objective-C type parameter.
Definition: DeclObjC.h:559
Represents an enum.
Definition: Decl.h:3326
A pointer to member type per C++ 8.3.3 - Pointers to members.
Definition: Type.h:2756
Expr * getDefaultArgument() const
Retrieve the default argument, if any.
bool defaultArgumentWasInherited() const
Determines whether the default argument was inherited from a previous declaration of this template...
const TemplateTypeParmType * getReplacedParameter() const
Gets the template parameter that was substituted for.
Definition: Type.h:4618
const ObjCInterfaceDecl * getClassInterface() const
Definition: DeclObjC.h:2747
const DefArgStorage & getDefaultArgStorage() const
QualType getModifiedType() const
Definition: Type.h:4450
Represents a pointer to an Objective C object.
Definition: Type.h:5794
Pointer to a block type.
Definition: Type.h:2639
bool needsOverloadResolutionForMoveConstructor() const
Determine whether we need to eagerly declare a defaulted move constructor for this class...
Definition: DeclCXX.h:1098
void Visit(const comments::Comment *C, const comments::FullComment *FC)
ObjCImplementationDecl - Represents a class definition - this is where method definitions are specifi...
Definition: DeclObjC.h:2552
FunctionDecl * SourceTemplate
The function template whose exception specification this is instantiated from, for EST_Uninstantiated...
Definition: Type.h:3757
Complex values, per C99 6.2.5p11.
Definition: Type.h:2477
Location wrapper for a TemplateArgument.
Definition: TemplateBase.h:450
Indicates that the tracking object is a descendant of a referenced-counted OSObject, used in the Darwin kernel.
void dump() const
Dumps the specified AST fragment and all subtrees to llvm::errs().
Definition: ASTDumper.cpp:1622
comments::FullComment * getLocalCommentForDeclUncached(const Decl *D) const
Return parsed documentation comment attached to a given declaration.
Definition: ASTContext.cpp:485
Represents a C++ base or member initializer.
Definition: DeclCXX.h:2256
This template specialization was declared or defined by an explicit specialization (C++ [temp...
Definition: Specifiers.h:156
protocol_iterator protocol_begin() const
Definition: DeclObjC.h:2360
bool hasBody() const override
Determine whether this method has a body.
Definition: DeclObjC.h:504
static const TerminalColor DeclKindNameColor
Base for LValueReferenceType and RValueReferenceType.
Definition: Type.h:2673
const TemplateArgumentLoc & getDefaultArgument() const
Retrieve the default argument, if any.
SourceManager & getSourceManager()
Definition: ASTContext.h:662
bool isPartiallySubstituted() const
Determine whether this represents a partially-substituted sizeof...
Definition: ExprCXX.h:3932
bool capturesCXXThis() const
Definition: Decl.h:3990
A template argument list.
Definition: DeclTemplate.h:210
CapturedDecl * getCapturedDecl()
Retrieve the outlined function declaration.
Definition: Stmt.cpp:1265
An attributed type is a type to which a type attribute has been applied.
Definition: Type.h:4425
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate.h) and friends (in DeclFriend.h).
Call-style initialization (C++98)
Definition: Decl.h:821
void dumpName(const NamedDecl *ND)
bool isMutable() const
Determines whether this field is mutable (C++ only).
Definition: Decl.h:2654
Represents a C++ struct/union/class.
Definition: DeclCXX.h:300
bool isNRVOVariable() const
Determine whether this local variable can be used with the named return value optimization (NRVO)...
Definition: Decl.h:1325
bool isSugared() const
Definition: Type.h:5386
CXXCatchStmt - This represents a C++ catch block.
Definition: StmtCXX.h:29
ObjCIvarDecl - Represents an ObjC instance variable.
Definition: DeclObjC.h:1945
void dumpBareDeclRef(const Decl *D)
Declaration of a class template.
Stores a list of Objective-C type parameters for a parameterized class or a category/extension thereo...
Definition: DeclObjC.h:637
bool isVariadic() const
Definition: DeclObjC.h:427
protocol_iterator protocol_end() const
Definition: DeclObjC.h:2364
void dumpType(QualType T)
TLS with a known-constant initializer.
Definition: Decl.h:833
QualType getIntegerType() const
Return the integer type this enum decl corresponds to.
Definition: Decl.h:3480
bool doesThisDeclarationHaveABody() const
Returns whether this specific declaration of the function has a body.
Definition: Decl.h:1989
NestedNameSpecifier * getQualifier() const
Retrieve the nested-name-specifier that qualifies the name.
Definition: DeclCXX.h:3395
void dump(const char *s) const
Definition: ASTDumper.cpp:1544
void dump() const
Definition: ASTDumper.cpp:1567
bool constructsVirtualBase() const
Returns true if the constructed base class is a virtual base class subobject of this declaration&#39;s cl...
Definition: DeclCXX.h:3332
Represents a type template specialization; the template must be a class template, a type alias templa...
Definition: Type.h:4841
ArrayRef< ParmVarDecl * > parameters() const
Definition: Decl.h:3944
ObjCPropertyDecl * getPropertyDecl() const
Definition: DeclObjC.h:2818
ObjCTypeParamVariance getVariance() const
Determine the variance of this type parameter.
Definition: DeclObjC.h:602
bool isDeleted() const
Whether this function has been deleted.
Definition: Decl.h:2136
Expr * getBinding() const
Get the expression to which this declaration is bound.
Definition: DeclCXX.h:3817
DeclContext * getPrimaryContext()
getPrimaryContext - There may be many different declarations of the same entity (including forward de...
Definition: DeclBase.cpp:1158
const VarDecl * getCatchParamDecl() const
Definition: StmtObjC.h:94
varlist_range varlists()
Definition: DeclOpenMP.h:78
QualType getDefaultArgument() const
Retrieve the default argument, if any.
QualType getType() const
Definition: Decl.h:648
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:596
ObjCMethodDecl * getGetterMethodDecl() const
Definition: DeclObjC.h:922
CXXRecordDecl * getNominatedBaseClass() const
Get the base class that was named in the using declaration.
Definition: DeclCXX.cpp:2705
bool isTranslationUnit() const
Definition: DeclBase.h:1823
Represents a C array with a specified size that is not an integer-constant-expression.
Definition: Type.h:2971
Represents a C++ namespace alias.
Definition: DeclCXX.h:3020
bool isInline() const
Whether this variable is (C++1z) inline.
Definition: Decl.h:1364
AccessControl getAccessControl() const
Definition: DeclObjC.h:1984
Represents C++ using-directive.
Definition: DeclCXX.h:2916
Represents a #pragma detect_mismatch line.
Definition: Decl.h:174
A simple visitor class that helps create declaration visitors.
Definition: DeclVisitor.h:74
unsigned getNumParams() const
Return the number of parameters this function must have based on its FunctionType.
Definition: Decl.cpp:3055
bool hasInit() const
Definition: Decl.cpp:2164
This represents &#39;#pragma omp threadprivate ...&#39; directive.
Definition: DeclOpenMP.h:40
ObjCCategoryImplDecl - An object of this class encapsulates a category @implementation declaration...
Definition: DeclObjC.h:2499
This class handles loading and caching of source files into memory.
The parameter is invariant: must match exactly.
ExceptionSpecInfo ExceptionSpec
Definition: Type.h:3773
Defines enum values for all the target-independent builtin functions.
Declaration of a template function.
Definition: DeclTemplate.h:969
void AddChild(Fn DoAddChild)
Add a child of the current node. Calls DoAddChild without arguments.
Attr - This represents one attribute.
Definition: Attr.h:44
bool isDeletedAsWritten() const
Definition: Decl.h:2140
const StringLiteral * getAsmString() const
Definition: Decl.h:3847
QualType getPointeeType() const
Definition: Type.h:2776
Represents a shadow declaration introduced into a scope by a (resolved) using declaration.
Definition: DeclCXX.h:3139
A full comment attached to a declaration, contains block content.
Definition: Comment.h:1092
QualType getType() const
Return the type wrapped by this type source info.
Definition: Decl.h:98
ArrayRef< ParmVarDecl * > parameters() const
Definition: DeclObjC.h:367
NamedDecl * getAliasedNamespace() const
Retrieve the namespace that this alias refers to, which may either be a NamespaceDecl or a NamespaceA...
Definition: DeclCXX.h:3116
PragmaMSCommentKind getCommentKind() const
Definition: Decl.h:163
ObjCCompatibleAliasDecl - Represents alias of a class.
Definition: DeclObjC.h:2729
decl_iterator decls_end() const
Definition: DeclBase.h:1999
static const TerminalColor UndeserializedColor
QualType getPointeeType() const
Gets the type pointed to by this ObjC pointer.
Definition: Type.h:5810