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