clang  8.0.0svn
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"
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"
27 #include "clang/AST/TypeVisitor.h"
28 #include "clang/Basic/Builtins.h"
29 #include "clang/Basic/Module.h"
31 #include "llvm/Support/raw_ostream.h"
32 using namespace clang;
33 using namespace clang::comments;
34 
35 //===----------------------------------------------------------------------===//
36 // ASTDumper Visitor
37 //===----------------------------------------------------------------------===//
38 
39 namespace {
40 
41  class ASTDumper
42  : public ConstDeclVisitor<ASTDumper>,
43  public ConstStmtVisitor<ASTDumper>,
44  public ConstCommentVisitor<ASTDumper, void, const FullComment *>,
45  public TypeVisitor<ASTDumper> {
46 
47  TextTreeStructure TreeStructure;
48  TextNodeDumper NodeDumper;
49 
50  raw_ostream &OS;
51 
52  /// The policy to use for printing; can be defaulted.
53  PrintingPolicy PrintPolicy;
54 
55  /// Indicates whether we should trigger deserialization of nodes that had
56  /// not already been loaded.
57  bool Deserialize = false;
58 
59  const bool ShowColors;
60 
61  /// Dump a child of the current node.
62  template<typename Fn> void dumpChild(Fn doDumpChild) {
63  TreeStructure.addChild(doDumpChild);
64  }
65 
66  public:
67  ASTDumper(raw_ostream &OS, const CommandTraits *Traits,
68  const SourceManager *SM)
69  : ASTDumper(OS, Traits, SM,
70  SM && SM->getDiagnostics().getShowColors()) {}
71 
72  ASTDumper(raw_ostream &OS, const CommandTraits *Traits,
73  const SourceManager *SM, bool ShowColors)
74  : ASTDumper(OS, Traits, SM, ShowColors, LangOptions()) {}
75  ASTDumper(raw_ostream &OS, const CommandTraits *Traits,
76  const SourceManager *SM, bool ShowColors,
77  const PrintingPolicy &PrintPolicy)
78  : TreeStructure(OS, ShowColors),
79  NodeDumper(OS, ShowColors, SM, PrintPolicy, Traits), OS(OS),
80  PrintPolicy(PrintPolicy), ShowColors(ShowColors) {}
81 
82  void setDeserialize(bool D) { Deserialize = D; }
83 
84  void dumpDecl(const Decl *D);
85  void dumpStmt(const Stmt *S);
86 
87  // Utilities
88  void dumpType(QualType T) { NodeDumper.dumpType(T); }
89  void dumpTypeAsChild(QualType T);
90  void dumpTypeAsChild(const Type *T);
91  void dumpDeclRef(const Decl *Node, const char *Label = nullptr);
92  void dumpBareDeclRef(const Decl *Node) { NodeDumper.dumpBareDeclRef(Node); }
93  void dumpDeclContext(const DeclContext *DC);
94  void dumpLookups(const DeclContext *DC, bool DumpDecls);
95  void dumpAttr(const Attr *A);
96 
97  // C++ Utilities
98  void dumpCXXCtorInitializer(const CXXCtorInitializer *Init);
99  void dumpTemplateParameters(const TemplateParameterList *TPL);
100  void dumpTemplateArgumentListInfo(const TemplateArgumentListInfo &TALI);
101  void dumpTemplateArgumentLoc(const TemplateArgumentLoc &A,
102  const Decl *From = nullptr,
103  const char *Label = nullptr);
104  void dumpTemplateArgumentList(const TemplateArgumentList &TAL);
105  void dumpTemplateArgument(const TemplateArgument &A,
106  SourceRange R = SourceRange(),
107  const Decl *From = nullptr,
108  const char *Label = nullptr);
109  template <typename SpecializationDecl>
110  void dumpTemplateDeclSpecialization(const SpecializationDecl *D,
111  bool DumpExplicitInst,
112  bool DumpRefOnly);
113  template <typename TemplateDecl>
114  void dumpTemplateDecl(const TemplateDecl *D, bool DumpExplicitInst);
115 
116  // Objective-C utilities.
117  void dumpObjCTypeParamList(const ObjCTypeParamList *typeParams);
118 
119  // Types
120  void VisitComplexType(const ComplexType *T) {
121  dumpTypeAsChild(T->getElementType());
122  }
123  void VisitPointerType(const PointerType *T) {
124  dumpTypeAsChild(T->getPointeeType());
125  }
126  void VisitBlockPointerType(const BlockPointerType *T) {
127  dumpTypeAsChild(T->getPointeeType());
128  }
129  void VisitReferenceType(const ReferenceType *T) {
130  dumpTypeAsChild(T->getPointeeType());
131  }
132  void VisitRValueReferenceType(const ReferenceType *T) {
133  if (T->isSpelledAsLValue())
134  OS << " written as lvalue reference";
135  VisitReferenceType(T);
136  }
137  void VisitMemberPointerType(const MemberPointerType *T) {
138  dumpTypeAsChild(T->getClass());
139  dumpTypeAsChild(T->getPointeeType());
140  }
141  void VisitArrayType(const ArrayType *T) {
142  switch (T->getSizeModifier()) {
143  case ArrayType::Normal: break;
144  case ArrayType::Static: OS << " static"; break;
145  case ArrayType::Star: OS << " *"; break;
146  }
147  OS << " " << T->getIndexTypeQualifiers().getAsString();
148  dumpTypeAsChild(T->getElementType());
149  }
150  void VisitConstantArrayType(const ConstantArrayType *T) {
151  OS << " " << T->getSize();
152  VisitArrayType(T);
153  }
154  void VisitVariableArrayType(const VariableArrayType *T) {
155  OS << " ";
156  NodeDumper.dumpSourceRange(T->getBracketsRange());
157  VisitArrayType(T);
158  dumpStmt(T->getSizeExpr());
159  }
160  void VisitDependentSizedArrayType(const DependentSizedArrayType *T) {
161  switch (T->getSizeModifier()) {
162  case ArrayType::Normal: break;
163  case ArrayType::Static: OS << " static"; break;
164  case ArrayType::Star: OS << " *"; break;
165  }
166  OS << " " << T->getIndexTypeQualifiers().getAsString();
167  OS << " ";
168  NodeDumper.dumpSourceRange(T->getBracketsRange());
169  dumpTypeAsChild(T->getElementType());
170  dumpStmt(T->getSizeExpr());
171  }
172  void VisitDependentSizedExtVectorType(
173  const DependentSizedExtVectorType *T) {
174  OS << " ";
175  NodeDumper.dumpLocation(T->getAttributeLoc());
176  dumpTypeAsChild(T->getElementType());
177  dumpStmt(T->getSizeExpr());
178  }
179  void VisitVectorType(const VectorType *T) {
180  switch (T->getVectorKind()) {
181  case VectorType::GenericVector: break;
182  case VectorType::AltiVecVector: OS << " altivec"; break;
183  case VectorType::AltiVecPixel: OS << " altivec pixel"; break;
184  case VectorType::AltiVecBool: OS << " altivec bool"; break;
185  case VectorType::NeonVector: OS << " neon"; break;
186  case VectorType::NeonPolyVector: OS << " neon poly"; break;
187  }
188  OS << " " << T->getNumElements();
189  dumpTypeAsChild(T->getElementType());
190  }
191  void VisitFunctionType(const FunctionType *T) {
192  auto EI = T->getExtInfo();
193  if (EI.getNoReturn()) OS << " noreturn";
194  if (EI.getProducesResult()) OS << " produces_result";
195  if (EI.getHasRegParm()) OS << " regparm " << EI.getRegParm();
196  OS << " " << FunctionType::getNameForCallConv(EI.getCC());
197  dumpTypeAsChild(T->getReturnType());
198  }
199  void VisitFunctionProtoType(const FunctionProtoType *T) {
200  auto EPI = T->getExtProtoInfo();
201  if (EPI.HasTrailingReturn) OS << " trailing_return";
202 
203  if (!T->getTypeQuals().empty())
204  OS << " " << T->getTypeQuals().getAsString();
205 
206  switch (EPI.RefQualifier) {
207  case RQ_None: break;
208  case RQ_LValue: OS << " &"; break;
209  case RQ_RValue: OS << " &&"; break;
210  }
211  // FIXME: Exception specification.
212  // FIXME: Consumed parameters.
213  VisitFunctionType(T);
214  for (QualType PT : T->getParamTypes())
215  dumpTypeAsChild(PT);
216  if (EPI.Variadic)
217  dumpChild([=] { OS << "..."; });
218  }
219  void VisitUnresolvedUsingType(const UnresolvedUsingType *T) {
220  dumpDeclRef(T->getDecl());
221  }
222  void VisitTypedefType(const TypedefType *T) {
223  dumpDeclRef(T->getDecl());
224  }
225  void VisitTypeOfExprType(const TypeOfExprType *T) {
226  dumpStmt(T->getUnderlyingExpr());
227  }
228  void VisitDecltypeType(const DecltypeType *T) {
229  dumpStmt(T->getUnderlyingExpr());
230  }
231  void VisitUnaryTransformType(const UnaryTransformType *T) {
232  switch (T->getUTTKind()) {
234  OS << " underlying_type";
235  break;
236  }
237  dumpTypeAsChild(T->getBaseType());
238  }
239  void VisitTagType(const TagType *T) {
240  dumpDeclRef(T->getDecl());
241  }
242  void VisitAttributedType(const AttributedType *T) {
243  // FIXME: AttrKind
244  dumpTypeAsChild(T->getModifiedType());
245  }
246  void VisitTemplateTypeParmType(const TemplateTypeParmType *T) {
247  OS << " depth " << T->getDepth() << " index " << T->getIndex();
248  if (T->isParameterPack()) OS << " pack";
249  dumpDeclRef(T->getDecl());
250  }
251  void VisitSubstTemplateTypeParmType(const SubstTemplateTypeParmType *T) {
252  dumpTypeAsChild(T->getReplacedParameter());
253  }
254  void VisitSubstTemplateTypeParmPackType(
256  dumpTypeAsChild(T->getReplacedParameter());
257  dumpTemplateArgument(T->getArgumentPack());
258  }
259  void VisitAutoType(const AutoType *T) {
260  if (T->isDecltypeAuto()) OS << " decltype(auto)";
261  if (!T->isDeduced())
262  OS << " undeduced";
263  }
264  void VisitTemplateSpecializationType(const TemplateSpecializationType *T) {
265  if (T->isTypeAlias()) OS << " alias";
266  OS << " "; T->getTemplateName().dump(OS);
267  for (auto &Arg : *T)
268  dumpTemplateArgument(Arg);
269  if (T->isTypeAlias())
270  dumpTypeAsChild(T->getAliasedType());
271  }
272  void VisitInjectedClassNameType(const InjectedClassNameType *T) {
273  dumpDeclRef(T->getDecl());
274  }
275  void VisitObjCInterfaceType(const ObjCInterfaceType *T) {
276  dumpDeclRef(T->getDecl());
277  }
278  void VisitObjCObjectPointerType(const ObjCObjectPointerType *T) {
279  dumpTypeAsChild(T->getPointeeType());
280  }
281  void VisitAtomicType(const AtomicType *T) {
282  dumpTypeAsChild(T->getValueType());
283  }
284  void VisitPipeType(const PipeType *T) {
285  dumpTypeAsChild(T->getElementType());
286  }
287  void VisitAdjustedType(const AdjustedType *T) {
288  dumpTypeAsChild(T->getOriginalType());
289  }
290  void VisitPackExpansionType(const PackExpansionType *T) {
291  if (auto N = T->getNumExpansions()) OS << " expansions " << *N;
292  if (!T->isSugared())
293  dumpTypeAsChild(T->getPattern());
294  }
295  // FIXME: ElaboratedType, DependentNameType,
296  // DependentTemplateSpecializationType, ObjCObjectType
297 
298  // Decls
299  void VisitLabelDecl(const LabelDecl *D);
300  void VisitTypedefDecl(const TypedefDecl *D);
301  void VisitEnumDecl(const EnumDecl *D);
302  void VisitRecordDecl(const RecordDecl *D);
303  void VisitEnumConstantDecl(const EnumConstantDecl *D);
304  void VisitIndirectFieldDecl(const IndirectFieldDecl *D);
305  void VisitFunctionDecl(const FunctionDecl *D);
306  void VisitFieldDecl(const FieldDecl *D);
307  void VisitVarDecl(const VarDecl *D);
308  void VisitDecompositionDecl(const DecompositionDecl *D);
309  void VisitBindingDecl(const BindingDecl *D);
310  void VisitFileScopeAsmDecl(const FileScopeAsmDecl *D);
311  void VisitImportDecl(const ImportDecl *D);
312  void VisitPragmaCommentDecl(const PragmaCommentDecl *D);
313  void VisitPragmaDetectMismatchDecl(const PragmaDetectMismatchDecl *D);
314  void VisitCapturedDecl(const CapturedDecl *D);
315 
316  // OpenMP decls
317  void VisitOMPThreadPrivateDecl(const OMPThreadPrivateDecl *D);
318  void VisitOMPDeclareReductionDecl(const OMPDeclareReductionDecl *D);
319  void VisitOMPRequiresDecl(const OMPRequiresDecl *D);
320  void VisitOMPCapturedExprDecl(const OMPCapturedExprDecl *D);
321 
322  // C++ Decls
323  void VisitNamespaceDecl(const NamespaceDecl *D);
324  void VisitUsingDirectiveDecl(const UsingDirectiveDecl *D);
325  void VisitNamespaceAliasDecl(const NamespaceAliasDecl *D);
326  void VisitTypeAliasDecl(const TypeAliasDecl *D);
327  void VisitTypeAliasTemplateDecl(const TypeAliasTemplateDecl *D);
328  void VisitCXXRecordDecl(const CXXRecordDecl *D);
329  void VisitStaticAssertDecl(const StaticAssertDecl *D);
330  void VisitFunctionTemplateDecl(const FunctionTemplateDecl *D);
331  void VisitClassTemplateDecl(const ClassTemplateDecl *D);
332  void VisitClassTemplateSpecializationDecl(
334  void VisitClassTemplatePartialSpecializationDecl(
336  void VisitClassScopeFunctionSpecializationDecl(
338  void VisitBuiltinTemplateDecl(const BuiltinTemplateDecl *D);
339  void VisitVarTemplateDecl(const VarTemplateDecl *D);
340  void VisitVarTemplateSpecializationDecl(
342  void VisitVarTemplatePartialSpecializationDecl(
344  void VisitTemplateTypeParmDecl(const TemplateTypeParmDecl *D);
345  void VisitNonTypeTemplateParmDecl(const NonTypeTemplateParmDecl *D);
346  void VisitTemplateTemplateParmDecl(const TemplateTemplateParmDecl *D);
347  void VisitUsingDecl(const UsingDecl *D);
348  void VisitUnresolvedUsingTypenameDecl(const UnresolvedUsingTypenameDecl *D);
349  void VisitUnresolvedUsingValueDecl(const UnresolvedUsingValueDecl *D);
350  void VisitUsingShadowDecl(const UsingShadowDecl *D);
351  void VisitConstructorUsingShadowDecl(const ConstructorUsingShadowDecl *D);
352  void VisitLinkageSpecDecl(const LinkageSpecDecl *D);
353  void VisitAccessSpecDecl(const AccessSpecDecl *D);
354  void VisitFriendDecl(const FriendDecl *D);
355 
356  // ObjC Decls
357  void VisitObjCIvarDecl(const ObjCIvarDecl *D);
358  void VisitObjCMethodDecl(const ObjCMethodDecl *D);
359  void VisitObjCTypeParamDecl(const ObjCTypeParamDecl *D);
360  void VisitObjCCategoryDecl(const ObjCCategoryDecl *D);
361  void VisitObjCCategoryImplDecl(const ObjCCategoryImplDecl *D);
362  void VisitObjCProtocolDecl(const ObjCProtocolDecl *D);
363  void VisitObjCInterfaceDecl(const ObjCInterfaceDecl *D);
364  void VisitObjCImplementationDecl(const ObjCImplementationDecl *D);
365  void VisitObjCCompatibleAliasDecl(const ObjCCompatibleAliasDecl *D);
366  void VisitObjCPropertyDecl(const ObjCPropertyDecl *D);
367  void VisitObjCPropertyImplDecl(const ObjCPropertyImplDecl *D);
368  void VisitBlockDecl(const BlockDecl *D);
369 
370  // Stmts.
371  void VisitDeclStmt(const DeclStmt *Node);
372  void VisitAttributedStmt(const AttributedStmt *Node);
373  void VisitIfStmt(const IfStmt *Node);
374  void VisitSwitchStmt(const SwitchStmt *Node);
375  void VisitWhileStmt(const WhileStmt *Node);
376  void VisitLabelStmt(const LabelStmt *Node);
377  void VisitGotoStmt(const GotoStmt *Node);
378  void VisitCXXCatchStmt(const CXXCatchStmt *Node);
379  void VisitCaseStmt(const CaseStmt *Node);
380  void VisitCapturedStmt(const CapturedStmt *Node);
381 
382  // OpenMP
383  void VisitOMPExecutableDirective(const OMPExecutableDirective *Node);
384 
385  // Exprs
386  void VisitCallExpr(const CallExpr *Node);
387  void VisitCastExpr(const CastExpr *Node);
388  void VisitImplicitCastExpr(const ImplicitCastExpr *Node);
389  void VisitDeclRefExpr(const DeclRefExpr *Node);
390  void VisitPredefinedExpr(const PredefinedExpr *Node);
391  void VisitCharacterLiteral(const CharacterLiteral *Node);
392  void VisitIntegerLiteral(const IntegerLiteral *Node);
393  void VisitFixedPointLiteral(const FixedPointLiteral *Node);
394  void VisitFloatingLiteral(const FloatingLiteral *Node);
395  void VisitStringLiteral(const StringLiteral *Str);
396  void VisitInitListExpr(const InitListExpr *ILE);
397  void VisitUnaryOperator(const UnaryOperator *Node);
398  void VisitUnaryExprOrTypeTraitExpr(const UnaryExprOrTypeTraitExpr *Node);
399  void VisitMemberExpr(const MemberExpr *Node);
400  void VisitExtVectorElementExpr(const ExtVectorElementExpr *Node);
401  void VisitBinaryOperator(const BinaryOperator *Node);
402  void VisitCompoundAssignOperator(const CompoundAssignOperator *Node);
403  void VisitAddrLabelExpr(const AddrLabelExpr *Node);
404  void VisitBlockExpr(const BlockExpr *Node);
405  void VisitOpaqueValueExpr(const OpaqueValueExpr *Node);
406  void VisitGenericSelectionExpr(const GenericSelectionExpr *E);
407 
408  // C++
409  void VisitCXXNamedCastExpr(const CXXNamedCastExpr *Node);
410  void VisitCXXBoolLiteralExpr(const CXXBoolLiteralExpr *Node);
411  void VisitCXXThisExpr(const CXXThisExpr *Node);
412  void VisitCXXFunctionalCastExpr(const CXXFunctionalCastExpr *Node);
413  void VisitCXXUnresolvedConstructExpr(const CXXUnresolvedConstructExpr *Node);
414  void VisitCXXConstructExpr(const CXXConstructExpr *Node);
415  void VisitCXXBindTemporaryExpr(const CXXBindTemporaryExpr *Node);
416  void VisitCXXNewExpr(const CXXNewExpr *Node);
417  void VisitCXXDeleteExpr(const CXXDeleteExpr *Node);
418  void VisitMaterializeTemporaryExpr(const MaterializeTemporaryExpr *Node);
419  void VisitExprWithCleanups(const ExprWithCleanups *Node);
420  void VisitUnresolvedLookupExpr(const UnresolvedLookupExpr *Node);
421  void VisitLambdaExpr(const LambdaExpr *Node) {
422  dumpDecl(Node->getLambdaClass());
423  }
424  void VisitSizeOfPackExpr(const SizeOfPackExpr *Node);
425  void
426  VisitCXXDependentScopeMemberExpr(const CXXDependentScopeMemberExpr *Node);
427 
428  // ObjC
429  void VisitObjCAtCatchStmt(const ObjCAtCatchStmt *Node);
430  void VisitObjCEncodeExpr(const ObjCEncodeExpr *Node);
431  void VisitObjCMessageExpr(const ObjCMessageExpr *Node);
432  void VisitObjCBoxedExpr(const ObjCBoxedExpr *Node);
433  void VisitObjCSelectorExpr(const ObjCSelectorExpr *Node);
434  void VisitObjCProtocolExpr(const ObjCProtocolExpr *Node);
435  void VisitObjCPropertyRefExpr(const ObjCPropertyRefExpr *Node);
436  void VisitObjCSubscriptRefExpr(const ObjCSubscriptRefExpr *Node);
437  void VisitObjCIvarRefExpr(const ObjCIvarRefExpr *Node);
438  void VisitObjCBoolLiteralExpr(const ObjCBoolLiteralExpr *Node);
439 
440  // Comments.
441  void dumpComment(const Comment *C, const FullComment *FC);
442  };
443 }
444 
445 //===----------------------------------------------------------------------===//
446 // Utilities
447 //===----------------------------------------------------------------------===//
448 
449 void ASTDumper::dumpTypeAsChild(QualType T) {
450  SplitQualType SQT = T.split();
451  if (!SQT.Quals.hasQualifiers())
452  return dumpTypeAsChild(SQT.Ty);
453 
454  dumpChild([=] {
455  OS << "QualType";
456  NodeDumper.dumpPointer(T.getAsOpaquePtr());
457  OS << " ";
458  NodeDumper.dumpBareType(T, false);
459  OS << " " << T.split().Quals.getAsString();
460  dumpTypeAsChild(T.split().Ty);
461  });
462 }
463 
464 void ASTDumper::dumpTypeAsChild(const Type *T) {
465  dumpChild([=] {
466  if (!T) {
467  ColorScope Color(OS, ShowColors, NullColor);
468  OS << "<<<NULL>>>";
469  return;
470  }
471  if (const LocInfoType *LIT = llvm::dyn_cast<LocInfoType>(T)) {
472  {
473  ColorScope Color(OS, ShowColors, TypeColor);
474  OS << "LocInfo Type";
475  }
476  NodeDumper.dumpPointer(T);
477  dumpTypeAsChild(LIT->getTypeSourceInfo()->getType());
478  return;
479  }
480 
481  {
482  ColorScope Color(OS, ShowColors, TypeColor);
483  OS << T->getTypeClassName() << "Type";
484  }
485  NodeDumper.dumpPointer(T);
486  OS << " ";
487  NodeDumper.dumpBareType(QualType(T, 0), false);
488 
489  QualType SingleStepDesugar =
491  if (SingleStepDesugar != QualType(T, 0))
492  OS << " sugar";
493  if (T->isDependentType())
494  OS << " dependent";
495  else if (T->isInstantiationDependentType())
496  OS << " instantiation_dependent";
497  if (T->isVariablyModifiedType())
498  OS << " variably_modified";
500  OS << " contains_unexpanded_pack";
501  if (T->isFromAST())
502  OS << " imported";
503 
505 
506  if (SingleStepDesugar != QualType(T, 0))
507  dumpTypeAsChild(SingleStepDesugar);
508  });
509 }
510 
511 void ASTDumper::dumpDeclRef(const Decl *D, const char *Label) {
512  if (!D)
513  return;
514 
515  dumpChild([=]{
516  if (Label)
517  OS << Label << ' ';
518  dumpBareDeclRef(D);
519  });
520 }
521 
522 void ASTDumper::dumpDeclContext(const DeclContext *DC) {
523  if (!DC)
524  return;
525 
526  for (auto *D : (Deserialize ? DC->decls() : DC->noload_decls()))
527  dumpDecl(D);
528 
529  if (DC->hasExternalLexicalStorage()) {
530  dumpChild([=] {
531  ColorScope Color(OS, ShowColors, UndeserializedColor);
532  OS << "<undeserialized declarations>";
533  });
534  }
535 }
536 
537 void ASTDumper::dumpLookups(const DeclContext *DC, bool DumpDecls) {
538  dumpChild([=] {
539  OS << "StoredDeclsMap ";
540  NodeDumper.dumpBareDeclRef(cast<Decl>(DC));
541 
542  const DeclContext *Primary = DC->getPrimaryContext();
543  if (Primary != DC) {
544  OS << " primary";
545  NodeDumper.dumpPointer(cast<Decl>(Primary));
546  }
547 
548  bool HasUndeserializedLookups = Primary->hasExternalVisibleStorage();
549 
550  auto Range = Deserialize
551  ? Primary->lookups()
552  : Primary->noload_lookups(/*PreserveInternalState=*/true);
553  for (auto I = Range.begin(), E = Range.end(); I != E; ++I) {
554  DeclarationName Name = I.getLookupName();
556 
557  dumpChild([=] {
558  OS << "DeclarationName ";
559  {
560  ColorScope Color(OS, ShowColors, DeclNameColor);
561  OS << '\'' << Name << '\'';
562  }
563 
564  for (DeclContextLookupResult::iterator RI = R.begin(), RE = R.end();
565  RI != RE; ++RI) {
566  dumpChild([=] {
567  NodeDumper.dumpBareDeclRef(*RI);
568 
569  if ((*RI)->isHidden())
570  OS << " hidden";
571 
572  // If requested, dump the redecl chain for this lookup.
573  if (DumpDecls) {
574  // Dump earliest decl first.
575  std::function<void(Decl *)> DumpWithPrev = [&](Decl *D) {
576  if (Decl *Prev = D->getPreviousDecl())
577  DumpWithPrev(Prev);
578  dumpDecl(D);
579  };
580  DumpWithPrev(*RI);
581  }
582  });
583  }
584  });
585  }
586 
587  if (HasUndeserializedLookups) {
588  dumpChild([=] {
589  ColorScope Color(OS, ShowColors, UndeserializedColor);
590  OS << "<undeserialized lookups>";
591  });
592  }
593  });
594 }
595 
596 void ASTDumper::dumpAttr(const Attr *A) {
597  dumpChild([=] {
598  {
599  ColorScope Color(OS, ShowColors, AttrColor);
600 
601  switch (A->getKind()) {
602 #define ATTR(X) case attr::X: OS << #X; break;
603 #include "clang/Basic/AttrList.inc"
604  }
605  OS << "Attr";
606  }
607  NodeDumper.dumpPointer(A);
608  NodeDumper.dumpSourceRange(A->getRange());
609  if (A->isInherited())
610  OS << " Inherited";
611  if (A->isImplicit())
612  OS << " Implicit";
613 #include "clang/AST/AttrDump.inc"
614  });
615 }
616 
617 static void dumpPreviousDeclImpl(raw_ostream &OS, ...) {}
618 
619 template<typename T>
620 static void dumpPreviousDeclImpl(raw_ostream &OS, const Mergeable<T> *D) {
621  const T *First = D->getFirstDecl();
622  if (First != D)
623  OS << " first " << First;
624 }
625 
626 template<typename T>
627 static void dumpPreviousDeclImpl(raw_ostream &OS, const Redeclarable<T> *D) {
628  const T *Prev = D->getPreviousDecl();
629  if (Prev)
630  OS << " prev " << Prev;
631 }
632 
633 /// Dump the previous declaration in the redeclaration chain for a declaration,
634 /// if any.
635 static void dumpPreviousDecl(raw_ostream &OS, const Decl *D) {
636  switch (D->getKind()) {
637 #define DECL(DERIVED, BASE) \
638  case Decl::DERIVED: \
639  return dumpPreviousDeclImpl(OS, cast<DERIVED##Decl>(D));
640 #define ABSTRACT_DECL(DECL)
641 #include "clang/AST/DeclNodes.inc"
642  }
643  llvm_unreachable("Decl that isn't part of DeclNodes.inc!");
644 }
645 
646 //===----------------------------------------------------------------------===//
647 // C++ Utilities
648 //===----------------------------------------------------------------------===//
649 
650 void ASTDumper::dumpCXXCtorInitializer(const CXXCtorInitializer *Init) {
651  dumpChild([=] {
652  OS << "CXXCtorInitializer";
653  if (Init->isAnyMemberInitializer()) {
654  OS << ' ';
655  NodeDumper.dumpBareDeclRef(Init->getAnyMember());
656  } else if (Init->isBaseInitializer()) {
657  NodeDumper.dumpType(QualType(Init->getBaseClass(), 0));
658  } else if (Init->isDelegatingInitializer()) {
659  NodeDumper.dumpType(Init->getTypeSourceInfo()->getType());
660  } else {
661  llvm_unreachable("Unknown initializer type");
662  }
663  dumpStmt(Init->getInit());
664  });
665 }
666 
667 void ASTDumper::dumpTemplateParameters(const TemplateParameterList *TPL) {
668  if (!TPL)
669  return;
670 
671  for (TemplateParameterList::const_iterator I = TPL->begin(), E = TPL->end();
672  I != E; ++I)
673  dumpDecl(*I);
674 }
675 
676 void ASTDumper::dumpTemplateArgumentListInfo(
677  const TemplateArgumentListInfo &TALI) {
678  for (unsigned i = 0, e = TALI.size(); i < e; ++i)
679  dumpTemplateArgumentLoc(TALI[i]);
680 }
681 
682 void ASTDumper::dumpTemplateArgumentLoc(const TemplateArgumentLoc &A,
683  const Decl *From, const char *Label) {
684  dumpTemplateArgument(A.getArgument(), A.getSourceRange(), From, Label);
685 }
686 
687 void ASTDumper::dumpTemplateArgumentList(const TemplateArgumentList &TAL) {
688  for (unsigned i = 0, e = TAL.size(); i < e; ++i)
689  dumpTemplateArgument(TAL[i]);
690 }
691 
692 void ASTDumper::dumpTemplateArgument(const TemplateArgument &A, SourceRange R,
693  const Decl *From, const char *Label) {
694  dumpChild([=] {
695  OS << "TemplateArgument";
696  if (R.isValid())
697  NodeDumper.dumpSourceRange(R);
698 
699  if (From)
700  dumpDeclRef(From, Label);
701 
702  switch (A.getKind()) {
704  OS << " null";
705  break;
707  OS << " type";
708  NodeDumper.dumpType(A.getAsType());
709  break;
711  OS << " decl";
712  dumpDeclRef(A.getAsDecl());
713  break;
715  OS << " nullptr";
716  break;
718  OS << " integral " << A.getAsIntegral();
719  break;
721  OS << " template ";
722  A.getAsTemplate().dump(OS);
723  break;
725  OS << " template expansion ";
727  break;
729  OS << " expr";
730  dumpStmt(A.getAsExpr());
731  break;
733  OS << " pack";
735  I != E; ++I)
736  dumpTemplateArgument(*I);
737  break;
738  }
739  });
740 }
741 
742 //===----------------------------------------------------------------------===//
743 // Objective-C Utilities
744 //===----------------------------------------------------------------------===//
745 void ASTDumper::dumpObjCTypeParamList(const ObjCTypeParamList *typeParams) {
746  if (!typeParams)
747  return;
748 
749  for (auto typeParam : *typeParams) {
750  dumpDecl(typeParam);
751  }
752 }
753 
754 //===----------------------------------------------------------------------===//
755 // Decl dumping methods.
756 //===----------------------------------------------------------------------===//
757 
758 void ASTDumper::dumpDecl(const Decl *D) {
759  dumpChild([=] {
760  if (!D) {
761  ColorScope Color(OS, ShowColors, NullColor);
762  OS << "<<<NULL>>>";
763  return;
764  }
765 
766  {
767  ColorScope Color(OS, ShowColors, DeclKindNameColor);
768  OS << D->getDeclKindName() << "Decl";
769  }
770  NodeDumper.dumpPointer(D);
771  if (D->getLexicalDeclContext() != D->getDeclContext())
772  OS << " parent " << cast<Decl>(D->getDeclContext());
773  dumpPreviousDecl(OS, D);
774  NodeDumper.dumpSourceRange(D->getSourceRange());
775  OS << ' ';
776  NodeDumper.dumpLocation(D->getLocation());
777  if (D->isFromASTFile())
778  OS << " imported";
779  if (Module *M = D->getOwningModule())
780  OS << " in " << M->getFullModuleName();
781  if (auto *ND = dyn_cast<NamedDecl>(D))
783  const_cast<NamedDecl *>(ND)))
784  dumpChild([=] { OS << "also in " << M->getFullModuleName(); });
785  if (const NamedDecl *ND = dyn_cast<NamedDecl>(D))
786  if (ND->isHidden())
787  OS << " hidden";
788  if (D->isImplicit())
789  OS << " implicit";
790  if (D->isUsed())
791  OS << " used";
792  else if (D->isThisDeclarationReferenced())
793  OS << " referenced";
794  if (D->isInvalidDecl())
795  OS << " invalid";
796  if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(D))
797  if (FD->isConstexpr())
798  OS << " constexpr";
799 
800 
802 
803  for (Decl::attr_iterator I = D->attr_begin(), E = D->attr_end(); I != E;
804  ++I)
805  dumpAttr(*I);
806 
807  if (const FullComment *Comment =
809  dumpComment(Comment, Comment);
810 
811  // Decls within functions are visited by the body.
812  if (!isa<FunctionDecl>(*D) && !isa<ObjCMethodDecl>(*D)) {
813  auto DC = dyn_cast<DeclContext>(D);
814  if (DC &&
815  (DC->hasExternalLexicalStorage() ||
816  (Deserialize ? DC->decls_begin() != DC->decls_end()
817  : DC->noload_decls_begin() != DC->noload_decls_end())))
818  dumpDeclContext(DC);
819  }
820  });
821 }
822 
823 void ASTDumper::VisitLabelDecl(const LabelDecl *D) { NodeDumper.dumpName(D); }
824 
825 void ASTDumper::VisitTypedefDecl(const TypedefDecl *D) {
826  NodeDumper.dumpName(D);
827  NodeDumper.dumpType(D->getUnderlyingType());
828  if (D->isModulePrivate())
829  OS << " __module_private__";
830  dumpTypeAsChild(D->getUnderlyingType());
831 }
832 
833 void ASTDumper::VisitEnumDecl(const EnumDecl *D) {
834  if (D->isScoped()) {
835  if (D->isScopedUsingClassTag())
836  OS << " class";
837  else
838  OS << " struct";
839  }
840  NodeDumper.dumpName(D);
841  if (D->isModulePrivate())
842  OS << " __module_private__";
843  if (D->isFixed())
844  NodeDumper.dumpType(D->getIntegerType());
845 }
846 
847 void ASTDumper::VisitRecordDecl(const RecordDecl *D) {
848  OS << ' ' << D->getKindName();
849  NodeDumper.dumpName(D);
850  if (D->isModulePrivate())
851  OS << " __module_private__";
852  if (D->isCompleteDefinition())
853  OS << " definition";
854 }
855 
856 void ASTDumper::VisitEnumConstantDecl(const EnumConstantDecl *D) {
857  NodeDumper.dumpName(D);
858  NodeDumper.dumpType(D->getType());
859  if (const Expr *Init = D->getInitExpr())
860  dumpStmt(Init);
861 }
862 
863 void ASTDumper::VisitIndirectFieldDecl(const IndirectFieldDecl *D) {
864  NodeDumper.dumpName(D);
865  NodeDumper.dumpType(D->getType());
866 
867  for (auto *Child : D->chain())
868  dumpDeclRef(Child);
869 }
870 
871 void ASTDumper::VisitFunctionDecl(const FunctionDecl *D) {
872  NodeDumper.dumpName(D);
873  NodeDumper.dumpType(D->getType());
874 
875  StorageClass SC = D->getStorageClass();
876  if (SC != SC_None)
878  if (D->isInlineSpecified())
879  OS << " inline";
880  if (D->isVirtualAsWritten())
881  OS << " virtual";
882  if (D->isModulePrivate())
883  OS << " __module_private__";
884 
885  if (D->isPure())
886  OS << " pure";
887  if (D->isDefaulted()) {
888  OS << " default";
889  if (D->isDeleted())
890  OS << "_delete";
891  }
892  if (D->isDeletedAsWritten())
893  OS << " delete";
894  if (D->isTrivial())
895  OS << " trivial";
896 
897  if (const FunctionProtoType *FPT = D->getType()->getAs<FunctionProtoType>()) {
898  FunctionProtoType::ExtProtoInfo EPI = FPT->getExtProtoInfo();
899  switch (EPI.ExceptionSpec.Type) {
900  default: break;
901  case EST_Unevaluated:
902  OS << " noexcept-unevaluated " << EPI.ExceptionSpec.SourceDecl;
903  break;
904  case EST_Uninstantiated:
905  OS << " noexcept-uninstantiated " << EPI.ExceptionSpec.SourceTemplate;
906  break;
907  }
908  }
909 
910  if (const FunctionTemplateSpecializationInfo *FTSI =
912  dumpTemplateArgumentList(*FTSI->TemplateArguments);
913 
914  if (!D->param_begin() && D->getNumParams())
915  dumpChild([=] { OS << "<<NULL params x " << D->getNumParams() << ">>"; });
916  else
917  for (const ParmVarDecl *Parameter : D->parameters())
918  dumpDecl(Parameter);
919 
920  if (const CXXConstructorDecl *C = dyn_cast<CXXConstructorDecl>(D))
921  for (CXXConstructorDecl::init_const_iterator I = C->init_begin(),
922  E = C->init_end();
923  I != E; ++I)
924  dumpCXXCtorInitializer(*I);
925 
926  if (const CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(D)) {
927  if (MD->size_overridden_methods() != 0) {
928  auto dumpOverride = [=](const CXXMethodDecl *D) {
929  SplitQualType T_split = D->getType().split();
930  OS << D << " " << D->getParent()->getName()
931  << "::" << D->getNameAsString() << " '"
932  << QualType::getAsString(T_split, PrintPolicy) << "'";
933  };
934 
935  dumpChild([=] {
936  auto Overrides = MD->overridden_methods();
937  OS << "Overrides: [ ";
938  dumpOverride(*Overrides.begin());
939  for (const auto *Override :
940  llvm::make_range(Overrides.begin() + 1, Overrides.end())) {
941  OS << ", ";
942  dumpOverride(Override);
943  }
944  OS << " ]";
945  });
946  }
947  }
948 
950  dumpStmt(D->getBody());
951 }
952 
953 void ASTDumper::VisitFieldDecl(const FieldDecl *D) {
954  NodeDumper.dumpName(D);
955  NodeDumper.dumpType(D->getType());
956  if (D->isMutable())
957  OS << " mutable";
958  if (D->isModulePrivate())
959  OS << " __module_private__";
960 
961  if (D->isBitField())
962  dumpStmt(D->getBitWidth());
963  if (Expr *Init = D->getInClassInitializer())
964  dumpStmt(Init);
965 }
966 
967 void ASTDumper::VisitVarDecl(const VarDecl *D) {
968  NodeDumper.dumpName(D);
969  NodeDumper.dumpType(D->getType());
970  StorageClass SC = D->getStorageClass();
971  if (SC != SC_None)
973  switch (D->getTLSKind()) {
974  case VarDecl::TLS_None: break;
975  case VarDecl::TLS_Static: OS << " tls"; break;
976  case VarDecl::TLS_Dynamic: OS << " tls_dynamic"; break;
977  }
978  if (D->isModulePrivate())
979  OS << " __module_private__";
980  if (D->isNRVOVariable())
981  OS << " nrvo";
982  if (D->isInline())
983  OS << " inline";
984  if (D->isConstexpr())
985  OS << " constexpr";
986  if (D->hasInit()) {
987  switch (D->getInitStyle()) {
988  case VarDecl::CInit: OS << " cinit"; break;
989  case VarDecl::CallInit: OS << " callinit"; break;
990  case VarDecl::ListInit: OS << " listinit"; break;
991  }
992  dumpStmt(D->getInit());
993  }
994 }
995 
996 void ASTDumper::VisitDecompositionDecl(const DecompositionDecl *D) {
997  VisitVarDecl(D);
998  for (auto *B : D->bindings())
999  dumpDecl(B);
1000 }
1001 
1002 void ASTDumper::VisitBindingDecl(const BindingDecl *D) {
1003  NodeDumper.dumpName(D);
1004  NodeDumper.dumpType(D->getType());
1005  if (auto *E = D->getBinding())
1006  dumpStmt(E);
1007 }
1008 
1009 void ASTDumper::VisitFileScopeAsmDecl(const FileScopeAsmDecl *D) {
1010  dumpStmt(D->getAsmString());
1011 }
1012 
1013 void ASTDumper::VisitImportDecl(const ImportDecl *D) {
1014  OS << ' ' << D->getImportedModule()->getFullModuleName();
1015 }
1016 
1017 void ASTDumper::VisitPragmaCommentDecl(const PragmaCommentDecl *D) {
1018  OS << ' ';
1019  switch (D->getCommentKind()) {
1020  case PCK_Unknown: llvm_unreachable("unexpected pragma comment kind");
1021  case PCK_Compiler: OS << "compiler"; break;
1022  case PCK_ExeStr: OS << "exestr"; break;
1023  case PCK_Lib: OS << "lib"; break;
1024  case PCK_Linker: OS << "linker"; break;
1025  case PCK_User: OS << "user"; break;
1026  }
1027  StringRef Arg = D->getArg();
1028  if (!Arg.empty())
1029  OS << " \"" << Arg << "\"";
1030 }
1031 
1032 void ASTDumper::VisitPragmaDetectMismatchDecl(
1033  const PragmaDetectMismatchDecl *D) {
1034  OS << " \"" << D->getName() << "\" \"" << D->getValue() << "\"";
1035 }
1036 
1037 void ASTDumper::VisitCapturedDecl(const CapturedDecl *D) {
1038  dumpStmt(D->getBody());
1039 }
1040 
1041 //===----------------------------------------------------------------------===//
1042 // OpenMP Declarations
1043 //===----------------------------------------------------------------------===//
1044 
1045 void ASTDumper::VisitOMPThreadPrivateDecl(const OMPThreadPrivateDecl *D) {
1046  for (auto *E : D->varlists())
1047  dumpStmt(E);
1048 }
1049 
1050 void ASTDumper::VisitOMPDeclareReductionDecl(const OMPDeclareReductionDecl *D) {
1051  NodeDumper.dumpName(D);
1052  NodeDumper.dumpType(D->getType());
1053  OS << " combiner";
1054  NodeDumper.dumpPointer(D->getCombiner());
1055  if (const auto *Initializer = D->getInitializer()) {
1056  OS << " initializer";
1057  NodeDumper.dumpPointer(Initializer);
1058  switch (D->getInitializerKind()) {
1060  OS << " omp_priv = ";
1061  break;
1063  OS << " omp_priv ()";
1064  break;
1066  break;
1067  }
1068  }
1069 
1070  dumpStmt(D->getCombiner());
1071  if (const auto *Initializer = D->getInitializer())
1072  dumpStmt(Initializer);
1073 }
1074 
1075 void ASTDumper::VisitOMPRequiresDecl(const OMPRequiresDecl *D) {
1076  for (auto *C : D->clauselists()) {
1077  dumpChild([=] {
1078  if (!C) {
1079  ColorScope Color(OS, ShowColors, NullColor);
1080  OS << "<<<NULL>>> OMPClause";
1081  return;
1082  }
1083  {
1084  ColorScope Color(OS, ShowColors, AttrColor);
1085  StringRef ClauseName(getOpenMPClauseName(C->getClauseKind()));
1086  OS << "OMP" << ClauseName.substr(/*Start=*/0, /*N=*/1).upper()
1087  << ClauseName.drop_front() << "Clause";
1088  }
1089  NodeDumper.dumpPointer(C);
1090  NodeDumper.dumpSourceRange(SourceRange(C->getBeginLoc(), C->getEndLoc()));
1091  });
1092  }
1093 }
1094 
1095 void ASTDumper::VisitOMPCapturedExprDecl(const OMPCapturedExprDecl *D) {
1096  NodeDumper.dumpName(D);
1097  NodeDumper.dumpType(D->getType());
1098  dumpStmt(D->getInit());
1099 }
1100 
1101 //===----------------------------------------------------------------------===//
1102 // C++ Declarations
1103 //===----------------------------------------------------------------------===//
1104 
1105 void ASTDumper::VisitNamespaceDecl(const NamespaceDecl *D) {
1106  NodeDumper.dumpName(D);
1107  if (D->isInline())
1108  OS << " inline";
1109  if (!D->isOriginalNamespace())
1110  dumpDeclRef(D->getOriginalNamespace(), "original");
1111 }
1112 
1113 void ASTDumper::VisitUsingDirectiveDecl(const UsingDirectiveDecl *D) {
1114  OS << ' ';
1115  NodeDumper.dumpBareDeclRef(D->getNominatedNamespace());
1116 }
1117 
1118 void ASTDumper::VisitNamespaceAliasDecl(const NamespaceAliasDecl *D) {
1119  NodeDumper.dumpName(D);
1120  dumpDeclRef(D->getAliasedNamespace());
1121 }
1122 
1123 void ASTDumper::VisitTypeAliasDecl(const TypeAliasDecl *D) {
1124  NodeDumper.dumpName(D);
1125  NodeDumper.dumpType(D->getUnderlyingType());
1126  dumpTypeAsChild(D->getUnderlyingType());
1127 }
1128 
1129 void ASTDumper::VisitTypeAliasTemplateDecl(const TypeAliasTemplateDecl *D) {
1130  NodeDumper.dumpName(D);
1131  dumpTemplateParameters(D->getTemplateParameters());
1132  dumpDecl(D->getTemplatedDecl());
1133 }
1134 
1135 void ASTDumper::VisitCXXRecordDecl(const CXXRecordDecl *D) {
1136  VisitRecordDecl(D);
1137  if (!D->isCompleteDefinition())
1138  return;
1139 
1140  dumpChild([=] {
1141  {
1142  ColorScope Color(OS, ShowColors, DeclKindNameColor);
1143  OS << "DefinitionData";
1144  }
1145 #define FLAG(fn, name) if (D->fn()) OS << " " #name;
1146  FLAG(isParsingBaseSpecifiers, parsing_base_specifiers);
1147 
1148  FLAG(isGenericLambda, generic);
1149  FLAG(isLambda, lambda);
1150 
1151  FLAG(canPassInRegisters, pass_in_registers);
1152  FLAG(isEmpty, empty);
1153  FLAG(isAggregate, aggregate);
1154  FLAG(isStandardLayout, standard_layout);
1155  FLAG(isTriviallyCopyable, trivially_copyable);
1156  FLAG(isPOD, pod);
1157  FLAG(isTrivial, trivial);
1158  FLAG(isPolymorphic, polymorphic);
1159  FLAG(isAbstract, abstract);
1160  FLAG(isLiteral, literal);
1161 
1162  FLAG(hasUserDeclaredConstructor, has_user_declared_ctor);
1163  FLAG(hasConstexprNonCopyMoveConstructor, has_constexpr_non_copy_move_ctor);
1164  FLAG(hasMutableFields, has_mutable_fields);
1165  FLAG(hasVariantMembers, has_variant_members);
1166  FLAG(allowConstDefaultInit, can_const_default_init);
1167 
1168  dumpChild([=] {
1169  {
1170  ColorScope Color(OS, ShowColors, DeclKindNameColor);
1171  OS << "DefaultConstructor";
1172  }
1173  FLAG(hasDefaultConstructor, exists);
1174  FLAG(hasTrivialDefaultConstructor, trivial);
1175  FLAG(hasNonTrivialDefaultConstructor, non_trivial);
1176  FLAG(hasUserProvidedDefaultConstructor, user_provided);
1177  FLAG(hasConstexprDefaultConstructor, constexpr);
1178  FLAG(needsImplicitDefaultConstructor, needs_implicit);
1179  FLAG(defaultedDefaultConstructorIsConstexpr, defaulted_is_constexpr);
1180  });
1181 
1182  dumpChild([=] {
1183  {
1184  ColorScope Color(OS, ShowColors, DeclKindNameColor);
1185  OS << "CopyConstructor";
1186  }
1187  FLAG(hasSimpleCopyConstructor, simple);
1188  FLAG(hasTrivialCopyConstructor, trivial);
1189  FLAG(hasNonTrivialCopyConstructor, non_trivial);
1190  FLAG(hasUserDeclaredCopyConstructor, user_declared);
1191  FLAG(hasCopyConstructorWithConstParam, has_const_param);
1192  FLAG(needsImplicitCopyConstructor, needs_implicit);
1193  FLAG(needsOverloadResolutionForCopyConstructor,
1194  needs_overload_resolution);
1196  FLAG(defaultedCopyConstructorIsDeleted, defaulted_is_deleted);
1197  FLAG(implicitCopyConstructorHasConstParam, implicit_has_const_param);
1198  });
1199 
1200  dumpChild([=] {
1201  {
1202  ColorScope Color(OS, ShowColors, DeclKindNameColor);
1203  OS << "MoveConstructor";
1204  }
1205  FLAG(hasMoveConstructor, exists);
1206  FLAG(hasSimpleMoveConstructor, simple);
1207  FLAG(hasTrivialMoveConstructor, trivial);
1208  FLAG(hasNonTrivialMoveConstructor, non_trivial);
1209  FLAG(hasUserDeclaredMoveConstructor, user_declared);
1210  FLAG(needsImplicitMoveConstructor, needs_implicit);
1211  FLAG(needsOverloadResolutionForMoveConstructor,
1212  needs_overload_resolution);
1214  FLAG(defaultedMoveConstructorIsDeleted, defaulted_is_deleted);
1215  });
1216 
1217  dumpChild([=] {
1218  {
1219  ColorScope Color(OS, ShowColors, DeclKindNameColor);
1220  OS << "CopyAssignment";
1221  }
1222  FLAG(hasTrivialCopyAssignment, trivial);
1223  FLAG(hasNonTrivialCopyAssignment, non_trivial);
1224  FLAG(hasCopyAssignmentWithConstParam, has_const_param);
1225  FLAG(hasUserDeclaredCopyAssignment, user_declared);
1226  FLAG(needsImplicitCopyAssignment, needs_implicit);
1227  FLAG(needsOverloadResolutionForCopyAssignment, needs_overload_resolution);
1228  FLAG(implicitCopyAssignmentHasConstParam, implicit_has_const_param);
1229  });
1230 
1231  dumpChild([=] {
1232  {
1233  ColorScope Color(OS, ShowColors, DeclKindNameColor);
1234  OS << "MoveAssignment";
1235  }
1236  FLAG(hasMoveAssignment, exists);
1237  FLAG(hasSimpleMoveAssignment, simple);
1238  FLAG(hasTrivialMoveAssignment, trivial);
1239  FLAG(hasNonTrivialMoveAssignment, non_trivial);
1240  FLAG(hasUserDeclaredMoveAssignment, user_declared);
1241  FLAG(needsImplicitMoveAssignment, needs_implicit);
1242  FLAG(needsOverloadResolutionForMoveAssignment, needs_overload_resolution);
1243  });
1244 
1245  dumpChild([=] {
1246  {
1247  ColorScope Color(OS, ShowColors, DeclKindNameColor);
1248  OS << "Destructor";
1249  }
1250  FLAG(hasSimpleDestructor, simple);
1251  FLAG(hasIrrelevantDestructor, irrelevant);
1252  FLAG(hasTrivialDestructor, trivial);
1253  FLAG(hasNonTrivialDestructor, non_trivial);
1254  FLAG(hasUserDeclaredDestructor, user_declared);
1255  FLAG(needsImplicitDestructor, needs_implicit);
1256  FLAG(needsOverloadResolutionForDestructor, needs_overload_resolution);
1258  FLAG(defaultedDestructorIsDeleted, defaulted_is_deleted);
1259  });
1260  });
1261 
1262  for (const auto &I : D->bases()) {
1263  dumpChild([=] {
1264  if (I.isVirtual())
1265  OS << "virtual ";
1266  NodeDumper.dumpAccessSpecifier(I.getAccessSpecifier());
1267  NodeDumper.dumpType(I.getType());
1268  if (I.isPackExpansion())
1269  OS << "...";
1270  });
1271  }
1272 }
1273 
1274 void ASTDumper::VisitStaticAssertDecl(const StaticAssertDecl *D) {
1275  dumpStmt(D->getAssertExpr());
1276  dumpStmt(D->getMessage());
1277 }
1278 
1279 template <typename SpecializationDecl>
1280 void ASTDumper::dumpTemplateDeclSpecialization(const SpecializationDecl *D,
1281  bool DumpExplicitInst,
1282  bool DumpRefOnly) {
1283  bool DumpedAny = false;
1284  for (auto *RedeclWithBadType : D->redecls()) {
1285  // FIXME: The redecls() range sometimes has elements of a less-specific
1286  // type. (In particular, ClassTemplateSpecializationDecl::redecls() gives
1287  // us TagDecls, and should give CXXRecordDecls).
1288  auto *Redecl = dyn_cast<SpecializationDecl>(RedeclWithBadType);
1289  if (!Redecl) {
1290  // Found the injected-class-name for a class template. This will be dumped
1291  // as part of its surrounding class so we don't need to dump it here.
1292  assert(isa<CXXRecordDecl>(RedeclWithBadType) &&
1293  "expected an injected-class-name");
1294  continue;
1295  }
1296 
1297  switch (Redecl->getTemplateSpecializationKind()) {
1300  if (!DumpExplicitInst)
1301  break;
1302  LLVM_FALLTHROUGH;
1303  case TSK_Undeclared:
1305  if (DumpRefOnly)
1306  dumpDeclRef(Redecl);
1307  else
1308  dumpDecl(Redecl);
1309  DumpedAny = true;
1310  break;
1312  break;
1313  }
1314  }
1315 
1316  // Ensure we dump at least one decl for each specialization.
1317  if (!DumpedAny)
1318  dumpDeclRef(D);
1319 }
1320 
1321 template <typename TemplateDecl>
1322 void ASTDumper::dumpTemplateDecl(const TemplateDecl *D, bool DumpExplicitInst) {
1323  NodeDumper.dumpName(D);
1324  dumpTemplateParameters(D->getTemplateParameters());
1325 
1326  dumpDecl(D->getTemplatedDecl());
1327 
1328  for (auto *Child : D->specializations())
1329  dumpTemplateDeclSpecialization(Child, DumpExplicitInst,
1330  !D->isCanonicalDecl());
1331 }
1332 
1333 void ASTDumper::VisitFunctionTemplateDecl(const FunctionTemplateDecl *D) {
1334  // FIXME: We don't add a declaration of a function template specialization
1335  // to its context when it's explicitly instantiated, so dump explicit
1336  // instantiations when we dump the template itself.
1337  dumpTemplateDecl(D, true);
1338 }
1339 
1340 void ASTDumper::VisitClassTemplateDecl(const ClassTemplateDecl *D) {
1341  dumpTemplateDecl(D, false);
1342 }
1343 
1344 void ASTDumper::VisitClassTemplateSpecializationDecl(
1346  VisitCXXRecordDecl(D);
1347  dumpTemplateArgumentList(D->getTemplateArgs());
1348 }
1349 
1350 void ASTDumper::VisitClassTemplatePartialSpecializationDecl(
1352  VisitClassTemplateSpecializationDecl(D);
1353  dumpTemplateParameters(D->getTemplateParameters());
1354 }
1355 
1356 void ASTDumper::VisitClassScopeFunctionSpecializationDecl(
1358  dumpDecl(D->getSpecialization());
1359  if (D->hasExplicitTemplateArgs())
1360  dumpTemplateArgumentListInfo(D->templateArgs());
1361 }
1362 
1363 void ASTDumper::VisitVarTemplateDecl(const VarTemplateDecl *D) {
1364  dumpTemplateDecl(D, false);
1365 }
1366 
1367 void ASTDumper::VisitBuiltinTemplateDecl(const BuiltinTemplateDecl *D) {
1368  NodeDumper.dumpName(D);
1369  dumpTemplateParameters(D->getTemplateParameters());
1370 }
1371 
1372 void ASTDumper::VisitVarTemplateSpecializationDecl(
1373  const VarTemplateSpecializationDecl *D) {
1374  dumpTemplateArgumentList(D->getTemplateArgs());
1375  VisitVarDecl(D);
1376 }
1377 
1378 void ASTDumper::VisitVarTemplatePartialSpecializationDecl(
1380  dumpTemplateParameters(D->getTemplateParameters());
1381  VisitVarTemplateSpecializationDecl(D);
1382 }
1383 
1384 void ASTDumper::VisitTemplateTypeParmDecl(const TemplateTypeParmDecl *D) {
1385  if (D->wasDeclaredWithTypename())
1386  OS << " typename";
1387  else
1388  OS << " class";
1389  OS << " depth " << D->getDepth() << " index " << D->getIndex();
1390  if (D->isParameterPack())
1391  OS << " ...";
1392  NodeDumper.dumpName(D);
1393  if (D->hasDefaultArgument())
1394  dumpTemplateArgument(D->getDefaultArgument(), SourceRange(),
1396  D->defaultArgumentWasInherited() ? "inherited from"
1397  : "previous");
1398 }
1399 
1400 void ASTDumper::VisitNonTypeTemplateParmDecl(const NonTypeTemplateParmDecl *D) {
1401  NodeDumper.dumpType(D->getType());
1402  OS << " depth " << D->getDepth() << " index " << D->getIndex();
1403  if (D->isParameterPack())
1404  OS << " ...";
1405  NodeDumper.dumpName(D);
1406  if (D->hasDefaultArgument())
1407  dumpTemplateArgument(D->getDefaultArgument(), SourceRange(),
1409  D->defaultArgumentWasInherited() ? "inherited from"
1410  : "previous");
1411 }
1412 
1413 void ASTDumper::VisitTemplateTemplateParmDecl(
1414  const TemplateTemplateParmDecl *D) {
1415  OS << " depth " << D->getDepth() << " index " << D->getIndex();
1416  if (D->isParameterPack())
1417  OS << " ...";
1418  NodeDumper.dumpName(D);
1419  dumpTemplateParameters(D->getTemplateParameters());
1420  if (D->hasDefaultArgument())
1421  dumpTemplateArgumentLoc(
1423  D->defaultArgumentWasInherited() ? "inherited from" : "previous");
1424 }
1425 
1426 void ASTDumper::VisitUsingDecl(const UsingDecl *D) {
1427  OS << ' ';
1428  if (D->getQualifier())
1430  OS << D->getNameAsString();
1431 }
1432 
1433 void ASTDumper::VisitUnresolvedUsingTypenameDecl(
1434  const UnresolvedUsingTypenameDecl *D) {
1435  OS << ' ';
1436  if (D->getQualifier())
1438  OS << D->getNameAsString();
1439 }
1440 
1441 void ASTDumper::VisitUnresolvedUsingValueDecl(const UnresolvedUsingValueDecl *D) {
1442  OS << ' ';
1443  if (D->getQualifier())
1445  OS << D->getNameAsString();
1446  NodeDumper.dumpType(D->getType());
1447 }
1448 
1449 void ASTDumper::VisitUsingShadowDecl(const UsingShadowDecl *D) {
1450  OS << ' ';
1451  NodeDumper.dumpBareDeclRef(D->getTargetDecl());
1452  if (auto *TD = dyn_cast<TypeDecl>(D->getUnderlyingDecl()))
1453  dumpTypeAsChild(TD->getTypeForDecl());
1454 }
1455 
1456 void ASTDumper::VisitConstructorUsingShadowDecl(
1457  const ConstructorUsingShadowDecl *D) {
1458  if (D->constructsVirtualBase())
1459  OS << " virtual";
1460 
1461  dumpChild([=] {
1462  OS << "target ";
1463  NodeDumper.dumpBareDeclRef(D->getTargetDecl());
1464  });
1465 
1466  dumpChild([=] {
1467  OS << "nominated ";
1468  NodeDumper.dumpBareDeclRef(D->getNominatedBaseClass());
1469  OS << ' ';
1471  });
1472 
1473  dumpChild([=] {
1474  OS << "constructed ";
1475  NodeDumper.dumpBareDeclRef(D->getConstructedBaseClass());
1476  OS << ' ';
1478  });
1479 }
1480 
1481 void ASTDumper::VisitLinkageSpecDecl(const LinkageSpecDecl *D) {
1482  switch (D->getLanguage()) {
1483  case LinkageSpecDecl::lang_c: OS << " C"; break;
1484  case LinkageSpecDecl::lang_cxx: OS << " C++"; break;
1485  }
1486 }
1487 
1488 void ASTDumper::VisitAccessSpecDecl(const AccessSpecDecl *D) {
1489  OS << ' ';
1490  NodeDumper.dumpAccessSpecifier(D->getAccess());
1491 }
1492 
1493 void ASTDumper::VisitFriendDecl(const FriendDecl *D) {
1494  if (TypeSourceInfo *T = D->getFriendType())
1495  NodeDumper.dumpType(T->getType());
1496  else
1497  dumpDecl(D->getFriendDecl());
1498 }
1499 
1500 //===----------------------------------------------------------------------===//
1501 // Obj-C Declarations
1502 //===----------------------------------------------------------------------===//
1503 
1504 void ASTDumper::VisitObjCIvarDecl(const ObjCIvarDecl *D) {
1505  NodeDumper.dumpName(D);
1506  NodeDumper.dumpType(D->getType());
1507  if (D->getSynthesize())
1508  OS << " synthesize";
1509 
1510  switch (D->getAccessControl()) {
1511  case ObjCIvarDecl::None:
1512  OS << " none";
1513  break;
1514  case ObjCIvarDecl::Private:
1515  OS << " private";
1516  break;
1518  OS << " protected";
1519  break;
1520  case ObjCIvarDecl::Public:
1521  OS << " public";
1522  break;
1523  case ObjCIvarDecl::Package:
1524  OS << " package";
1525  break;
1526  }
1527 }
1528 
1529 void ASTDumper::VisitObjCMethodDecl(const ObjCMethodDecl *D) {
1530  if (D->isInstanceMethod())
1531  OS << " -";
1532  else
1533  OS << " +";
1534  NodeDumper.dumpName(D);
1535  NodeDumper.dumpType(D->getReturnType());
1536 
1537  if (D->isThisDeclarationADefinition()) {
1538  dumpDeclContext(D);
1539  } else {
1540  for (const ParmVarDecl *Parameter : D->parameters())
1541  dumpDecl(Parameter);
1542  }
1543 
1544  if (D->isVariadic())
1545  dumpChild([=] { OS << "..."; });
1546 
1547  if (D->hasBody())
1548  dumpStmt(D->getBody());
1549 }
1550 
1551 void ASTDumper::VisitObjCTypeParamDecl(const ObjCTypeParamDecl *D) {
1552  NodeDumper.dumpName(D);
1553  switch (D->getVariance()) {
1555  break;
1556 
1558  OS << " covariant";
1559  break;
1560 
1562  OS << " contravariant";
1563  break;
1564  }
1565 
1566  if (D->hasExplicitBound())
1567  OS << " bounded";
1568  NodeDumper.dumpType(D->getUnderlyingType());
1569 }
1570 
1571 void ASTDumper::VisitObjCCategoryDecl(const ObjCCategoryDecl *D) {
1572  NodeDumper.dumpName(D);
1573  dumpDeclRef(D->getClassInterface());
1574  dumpObjCTypeParamList(D->getTypeParamList());
1575  dumpDeclRef(D->getImplementation());
1577  E = D->protocol_end();
1578  I != E; ++I)
1579  dumpDeclRef(*I);
1580 }
1581 
1582 void ASTDumper::VisitObjCCategoryImplDecl(const ObjCCategoryImplDecl *D) {
1583  NodeDumper.dumpName(D);
1584  dumpDeclRef(D->getClassInterface());
1585  dumpDeclRef(D->getCategoryDecl());
1586 }
1587 
1588 void ASTDumper::VisitObjCProtocolDecl(const ObjCProtocolDecl *D) {
1589  NodeDumper.dumpName(D);
1590 
1591  for (auto *Child : D->protocols())
1592  dumpDeclRef(Child);
1593 }
1594 
1595 void ASTDumper::VisitObjCInterfaceDecl(const ObjCInterfaceDecl *D) {
1596  NodeDumper.dumpName(D);
1597  dumpObjCTypeParamList(D->getTypeParamListAsWritten());
1598  dumpDeclRef(D->getSuperClass(), "super");
1599 
1600  dumpDeclRef(D->getImplementation());
1601  for (auto *Child : D->protocols())
1602  dumpDeclRef(Child);
1603 }
1604 
1605 void ASTDumper::VisitObjCImplementationDecl(const ObjCImplementationDecl *D) {
1606  NodeDumper.dumpName(D);
1607  dumpDeclRef(D->getSuperClass(), "super");
1608  dumpDeclRef(D->getClassInterface());
1610  E = D->init_end();
1611  I != E; ++I)
1612  dumpCXXCtorInitializer(*I);
1613 }
1614 
1615 void ASTDumper::VisitObjCCompatibleAliasDecl(const ObjCCompatibleAliasDecl *D) {
1616  NodeDumper.dumpName(D);
1617  dumpDeclRef(D->getClassInterface());
1618 }
1619 
1620 void ASTDumper::VisitObjCPropertyDecl(const ObjCPropertyDecl *D) {
1621  NodeDumper.dumpName(D);
1622  NodeDumper.dumpType(D->getType());
1623 
1625  OS << " required";
1627  OS << " optional";
1628 
1630  if (Attrs != ObjCPropertyDecl::OBJC_PR_noattr) {
1632  OS << " readonly";
1634  OS << " assign";
1636  OS << " readwrite";
1638  OS << " retain";
1639  if (Attrs & ObjCPropertyDecl::OBJC_PR_copy)
1640  OS << " copy";
1642  OS << " nonatomic";
1644  OS << " atomic";
1645  if (Attrs & ObjCPropertyDecl::OBJC_PR_weak)
1646  OS << " weak";
1648  OS << " strong";
1650  OS << " unsafe_unretained";
1651  if (Attrs & ObjCPropertyDecl::OBJC_PR_class)
1652  OS << " class";
1654  dumpDeclRef(D->getGetterMethodDecl(), "getter");
1656  dumpDeclRef(D->getSetterMethodDecl(), "setter");
1657  }
1658 }
1659 
1660 void ASTDumper::VisitObjCPropertyImplDecl(const ObjCPropertyImplDecl *D) {
1661  NodeDumper.dumpName(D->getPropertyDecl());
1663  OS << " synthesize";
1664  else
1665  OS << " dynamic";
1666  dumpDeclRef(D->getPropertyDecl());
1667  dumpDeclRef(D->getPropertyIvarDecl());
1668 }
1669 
1670 void ASTDumper::VisitBlockDecl(const BlockDecl *D) {
1671  for (auto I : D->parameters())
1672  dumpDecl(I);
1673 
1674  if (D->isVariadic())
1675  dumpChild([=]{ OS << "..."; });
1676 
1677  if (D->capturesCXXThis())
1678  dumpChild([=]{ OS << "capture this"; });
1679 
1680  for (const auto &I : D->captures()) {
1681  dumpChild([=] {
1682  OS << "capture";
1683  if (I.isByRef())
1684  OS << " byref";
1685  if (I.isNested())
1686  OS << " nested";
1687  if (I.getVariable()) {
1688  OS << ' ';
1689  NodeDumper.dumpBareDeclRef(I.getVariable());
1690  }
1691  if (I.hasCopyExpr())
1692  dumpStmt(I.getCopyExpr());
1693  });
1694  }
1695  dumpStmt(D->getBody());
1696 }
1697 
1698 //===----------------------------------------------------------------------===//
1699 // Stmt dumping methods.
1700 //===----------------------------------------------------------------------===//
1701 
1702 void ASTDumper::dumpStmt(const Stmt *S) {
1703  dumpChild([=] {
1704  if (!S) {
1705  ColorScope Color(OS, ShowColors, NullColor);
1706  OS << "<<<NULL>>>";
1707  return;
1708  }
1709  {
1710  ColorScope Color(OS, ShowColors, StmtColor);
1711  OS << S->getStmtClassName();
1712  }
1713  NodeDumper.dumpPointer(S);
1714  NodeDumper.dumpSourceRange(S->getSourceRange());
1715 
1716  if (const auto *E = dyn_cast<Expr>(S)) {
1717  NodeDumper.dumpType(E->getType());
1718 
1719  {
1720  ColorScope Color(OS, ShowColors, ValueKindColor);
1721  switch (E->getValueKind()) {
1722  case VK_RValue:
1723  break;
1724  case VK_LValue:
1725  OS << " lvalue";
1726  break;
1727  case VK_XValue:
1728  OS << " xvalue";
1729  break;
1730  }
1731  }
1732 
1733  {
1734  ColorScope Color(OS, ShowColors, ObjectKindColor);
1735  switch (E->getObjectKind()) {
1736  case OK_Ordinary:
1737  break;
1738  case OK_BitField:
1739  OS << " bitfield";
1740  break;
1741  case OK_ObjCProperty:
1742  OS << " objcproperty";
1743  break;
1744  case OK_ObjCSubscript:
1745  OS << " objcsubscript";
1746  break;
1747  case OK_VectorComponent:
1748  OS << " vectorcomponent";
1749  break;
1750  }
1751  }
1752  }
1753 
1755 
1756  // Some statements have custom mechanisms for dumping their children.
1757  if (isa<DeclStmt>(S) || isa<GenericSelectionExpr>(S)) {
1758  return;
1759  }
1760 
1761  for (const Stmt *SubStmt : S->children())
1762  dumpStmt(SubStmt);
1763  });
1764 }
1765 
1766 void ASTDumper::VisitDeclStmt(const DeclStmt *Node) {
1767  for (DeclStmt::const_decl_iterator I = Node->decl_begin(),
1768  E = Node->decl_end();
1769  I != E; ++I)
1770  dumpDecl(*I);
1771 }
1772 
1773 void ASTDumper::VisitAttributedStmt(const AttributedStmt *Node) {
1774  for (ArrayRef<const Attr *>::iterator I = Node->getAttrs().begin(),
1775  E = Node->getAttrs().end();
1776  I != E; ++I)
1777  dumpAttr(*I);
1778 }
1779 
1780 void ASTDumper::VisitIfStmt(const IfStmt *Node) {
1781  if (Node->hasInitStorage())
1782  OS << " has_init";
1783  if (Node->hasVarStorage())
1784  OS << " has_var";
1785  if (Node->hasElseStorage())
1786  OS << " has_else";
1787 }
1788 
1789 void ASTDumper::VisitSwitchStmt(const SwitchStmt *Node) {
1790  if (Node->hasInitStorage())
1791  OS << " has_init";
1792  if (Node->hasVarStorage())
1793  OS << " has_var";
1794 }
1795 
1796 void ASTDumper::VisitWhileStmt(const WhileStmt *Node) {
1797  if (Node->hasVarStorage())
1798  OS << " has_var";
1799 }
1800 
1801 void ASTDumper::VisitLabelStmt(const LabelStmt *Node) {
1802  OS << " '" << Node->getName() << "'";
1803 }
1804 
1805 void ASTDumper::VisitGotoStmt(const GotoStmt *Node) {
1806  OS << " '" << Node->getLabel()->getName() << "'";
1807  NodeDumper.dumpPointer(Node->getLabel());
1808 }
1809 
1810 void ASTDumper::VisitCXXCatchStmt(const CXXCatchStmt *Node) {
1811  dumpDecl(Node->getExceptionDecl());
1812 }
1813 
1814 void ASTDumper::VisitCaseStmt(const CaseStmt *Node) {
1815  if (Node->caseStmtIsGNURange())
1816  OS << " gnu_range";
1817 }
1818 
1819 void ASTDumper::VisitCapturedStmt(const CapturedStmt *Node) {
1820  dumpDecl(Node->getCapturedDecl());
1821 }
1822 
1823 //===----------------------------------------------------------------------===//
1824 // OpenMP dumping methods.
1825 //===----------------------------------------------------------------------===//
1826 
1827 void ASTDumper::VisitOMPExecutableDirective(
1828  const OMPExecutableDirective *Node) {
1829  for (auto *C : Node->clauses()) {
1830  dumpChild([=] {
1831  if (!C) {
1832  ColorScope Color(OS, ShowColors, NullColor);
1833  OS << "<<<NULL>>> OMPClause";
1834  return;
1835  }
1836  {
1837  ColorScope Color(OS, ShowColors, AttrColor);
1838  StringRef ClauseName(getOpenMPClauseName(C->getClauseKind()));
1839  OS << "OMP" << ClauseName.substr(/*Start=*/0, /*N=*/1).upper()
1840  << ClauseName.drop_front() << "Clause";
1841  }
1842  NodeDumper.dumpPointer(C);
1843  NodeDumper.dumpSourceRange(SourceRange(C->getBeginLoc(), C->getEndLoc()));
1844  if (C->isImplicit())
1845  OS << " <implicit>";
1846  for (auto *S : C->children())
1847  dumpStmt(S);
1848  });
1849  }
1850 }
1851 
1852 //===----------------------------------------------------------------------===//
1853 // Expr dumping methods.
1854 //===----------------------------------------------------------------------===//
1855 
1856 static void dumpBasePath(raw_ostream &OS, const CastExpr *Node) {
1857  if (Node->path_empty())
1858  return;
1859 
1860  OS << " (";
1861  bool First = true;
1862  for (CastExpr::path_const_iterator I = Node->path_begin(),
1863  E = Node->path_end();
1864  I != E; ++I) {
1865  const CXXBaseSpecifier *Base = *I;
1866  if (!First)
1867  OS << " -> ";
1868 
1869  const CXXRecordDecl *RD =
1870  cast<CXXRecordDecl>(Base->getType()->getAs<RecordType>()->getDecl());
1871 
1872  if (Base->isVirtual())
1873  OS << "virtual ";
1874  OS << RD->getName();
1875  First = false;
1876  }
1877 
1878  OS << ')';
1879 }
1880 
1881 void ASTDumper::VisitCallExpr(const CallExpr *Node) {
1882  if (Node->usesADL())
1883  OS << " adl";
1884 }
1885 
1886 void ASTDumper::VisitCastExpr(const CastExpr *Node) {
1887  OS << " <";
1888  {
1889  ColorScope Color(OS, ShowColors, CastColor);
1890  OS << Node->getCastKindName();
1891  }
1892  dumpBasePath(OS, Node);
1893  OS << ">";
1894 }
1895 
1896 void ASTDumper::VisitImplicitCastExpr(const ImplicitCastExpr *Node) {
1897  VisitCastExpr(Node);
1898  if (Node->isPartOfExplicitCast())
1899  OS << " part_of_explicit_cast";
1900 }
1901 
1902 void ASTDumper::VisitDeclRefExpr(const DeclRefExpr *Node) {
1903  OS << " ";
1904  NodeDumper.dumpBareDeclRef(Node->getDecl());
1905  if (Node->getDecl() != Node->getFoundDecl()) {
1906  OS << " (";
1907  NodeDumper.dumpBareDeclRef(Node->getFoundDecl());
1908  OS << ")";
1909  }
1910 }
1911 
1912 void ASTDumper::VisitUnresolvedLookupExpr(const UnresolvedLookupExpr *Node) {
1913  OS << " (";
1914  if (!Node->requiresADL())
1915  OS << "no ";
1916  OS << "ADL) = '" << Node->getName() << '\'';
1917 
1919  I = Node->decls_begin(), E = Node->decls_end();
1920  if (I == E)
1921  OS << " empty";
1922  for (; I != E; ++I)
1923  NodeDumper.dumpPointer(*I);
1924 }
1925 
1926 void ASTDumper::VisitObjCIvarRefExpr(const ObjCIvarRefExpr *Node) {
1927  {
1928  ColorScope Color(OS, ShowColors, DeclKindNameColor);
1929  OS << " " << Node->getDecl()->getDeclKindName() << "Decl";
1930  }
1931  OS << "='" << *Node->getDecl() << "'";
1932  NodeDumper.dumpPointer(Node->getDecl());
1933  if (Node->isFreeIvar())
1934  OS << " isFreeIvar";
1935 }
1936 
1937 void ASTDumper::VisitPredefinedExpr(const PredefinedExpr *Node) {
1938  OS << " " << PredefinedExpr::getIdentKindName(Node->getIdentKind());
1939 }
1940 
1941 void ASTDumper::VisitCharacterLiteral(const CharacterLiteral *Node) {
1942  ColorScope Color(OS, ShowColors, ValueColor);
1943  OS << " " << Node->getValue();
1944 }
1945 
1946 void ASTDumper::VisitIntegerLiteral(const IntegerLiteral *Node) {
1947  bool isSigned = Node->getType()->isSignedIntegerType();
1948  ColorScope Color(OS, ShowColors, ValueColor);
1949  OS << " " << Node->getValue().toString(10, isSigned);
1950 }
1951 
1952 void ASTDumper::VisitFixedPointLiteral(const FixedPointLiteral *Node) {
1953  ColorScope Color(OS, ShowColors, ValueColor);
1954  OS << " " << Node->getValueAsString(/*Radix=*/10);
1955 }
1956 
1957 void ASTDumper::VisitFloatingLiteral(const FloatingLiteral *Node) {
1958  ColorScope Color(OS, ShowColors, ValueColor);
1959  OS << " " << Node->getValueAsApproximateDouble();
1960 }
1961 
1962 void ASTDumper::VisitStringLiteral(const StringLiteral *Str) {
1963  ColorScope Color(OS, ShowColors, ValueColor);
1964  OS << " ";
1965  Str->outputString(OS);
1966 }
1967 
1968 void ASTDumper::VisitInitListExpr(const InitListExpr *ILE) {
1969  if (auto *Field = ILE->getInitializedFieldInUnion()) {
1970  OS << " field ";
1971  NodeDumper.dumpBareDeclRef(Field);
1972  }
1973  if (auto *Filler = ILE->getArrayFiller()) {
1974  dumpChild([=] {
1975  OS << "array filler";
1976  dumpStmt(Filler);
1977  });
1978  }
1979 }
1980 
1981 void ASTDumper::VisitUnaryOperator(const UnaryOperator *Node) {
1982  OS << " " << (Node->isPostfix() ? "postfix" : "prefix")
1983  << " '" << UnaryOperator::getOpcodeStr(Node->getOpcode()) << "'";
1984  if (!Node->canOverflow())
1985  OS << " cannot overflow";
1986 }
1987 
1988 void ASTDumper::VisitUnaryExprOrTypeTraitExpr(
1989  const UnaryExprOrTypeTraitExpr *Node) {
1990  switch(Node->getKind()) {
1991  case UETT_SizeOf:
1992  OS << " sizeof";
1993  break;
1994  case UETT_AlignOf:
1995  OS << " alignof";
1996  break;
1997  case UETT_VecStep:
1998  OS << " vec_step";
1999  break;
2001  OS << " __builtin_omp_required_simd_align";
2002  break;
2003  case UETT_PreferredAlignOf:
2004  OS << " __alignof";
2005  break;
2006  }
2007  if (Node->isArgumentType())
2008  NodeDumper.dumpType(Node->getArgumentType());
2009 }
2010 
2011 void ASTDumper::VisitMemberExpr(const MemberExpr *Node) {
2012  OS << " " << (Node->isArrow() ? "->" : ".") << *Node->getMemberDecl();
2013  NodeDumper.dumpPointer(Node->getMemberDecl());
2014 }
2015 
2016 void ASTDumper::VisitExtVectorElementExpr(const ExtVectorElementExpr *Node) {
2017  OS << " " << Node->getAccessor().getNameStart();
2018 }
2019 
2020 void ASTDumper::VisitBinaryOperator(const BinaryOperator *Node) {
2021  OS << " '" << BinaryOperator::getOpcodeStr(Node->getOpcode()) << "'";
2022 }
2023 
2024 void ASTDumper::VisitCompoundAssignOperator(
2025  const CompoundAssignOperator *Node) {
2026  OS << " '" << BinaryOperator::getOpcodeStr(Node->getOpcode())
2027  << "' ComputeLHSTy=";
2028  NodeDumper.dumpBareType(Node->getComputationLHSType());
2029  OS << " ComputeResultTy=";
2030  NodeDumper.dumpBareType(Node->getComputationResultType());
2031 }
2032 
2033 void ASTDumper::VisitBlockExpr(const BlockExpr *Node) {
2034  dumpDecl(Node->getBlockDecl());
2035 }
2036 
2037 void ASTDumper::VisitOpaqueValueExpr(const OpaqueValueExpr *Node) {
2038  if (Expr *Source = Node->getSourceExpr())
2039  dumpStmt(Source);
2040 }
2041 
2042 void ASTDumper::VisitGenericSelectionExpr(const GenericSelectionExpr *E) {
2043  if (E->isResultDependent())
2044  OS << " result_dependent";
2045  dumpStmt(E->getControllingExpr());
2046  dumpTypeAsChild(E->getControllingExpr()->getType()); // FIXME: remove
2047 
2048  for (unsigned I = 0, N = E->getNumAssocs(); I != N; ++I) {
2049  dumpChild([=] {
2050  if (const TypeSourceInfo *TSI = E->getAssocTypeSourceInfo(I)) {
2051  OS << "case ";
2052  NodeDumper.dumpType(TSI->getType());
2053  } else {
2054  OS << "default";
2055  }
2056 
2057  if (!E->isResultDependent() && E->getResultIndex() == I)
2058  OS << " selected";
2059 
2060  if (const TypeSourceInfo *TSI = E->getAssocTypeSourceInfo(I))
2061  dumpTypeAsChild(TSI->getType());
2062  dumpStmt(E->getAssocExpr(I));
2063  });
2064  }
2065 }
2066 
2067 // GNU extensions.
2068 
2069 void ASTDumper::VisitAddrLabelExpr(const AddrLabelExpr *Node) {
2070  OS << " " << Node->getLabel()->getName();
2071  NodeDumper.dumpPointer(Node->getLabel());
2072 }
2073 
2074 //===----------------------------------------------------------------------===//
2075 // C++ Expressions
2076 //===----------------------------------------------------------------------===//
2077 
2078 void ASTDumper::VisitCXXNamedCastExpr(const CXXNamedCastExpr *Node) {
2079  OS << " " << Node->getCastName()
2080  << "<" << Node->getTypeAsWritten().getAsString() << ">"
2081  << " <" << Node->getCastKindName();
2082  dumpBasePath(OS, Node);
2083  OS << ">";
2084 }
2085 
2086 void ASTDumper::VisitCXXBoolLiteralExpr(const CXXBoolLiteralExpr *Node) {
2087  OS << " " << (Node->getValue() ? "true" : "false");
2088 }
2089 
2090 void ASTDumper::VisitCXXThisExpr(const CXXThisExpr *Node) {
2091  OS << " this";
2092 }
2093 
2094 void ASTDumper::VisitCXXFunctionalCastExpr(const CXXFunctionalCastExpr *Node) {
2095  OS << " functional cast to " << Node->getTypeAsWritten().getAsString()
2096  << " <" << Node->getCastKindName() << ">";
2097 }
2098 
2099 void ASTDumper::VisitCXXUnresolvedConstructExpr(
2100  const CXXUnresolvedConstructExpr *Node) {
2101  NodeDumper.dumpType(Node->getTypeAsWritten());
2102  if (Node->isListInitialization())
2103  OS << " list";
2104 }
2105 
2106 void ASTDumper::VisitCXXConstructExpr(const CXXConstructExpr *Node) {
2107  CXXConstructorDecl *Ctor = Node->getConstructor();
2108  NodeDumper.dumpType(Ctor->getType());
2109  if (Node->isElidable())
2110  OS << " elidable";
2111  if (Node->isListInitialization())
2112  OS << " list";
2113  if (Node->isStdInitListInitialization())
2114  OS << " std::initializer_list";
2115  if (Node->requiresZeroInitialization())
2116  OS << " zeroing";
2117 }
2118 
2119 void ASTDumper::VisitCXXBindTemporaryExpr(const CXXBindTemporaryExpr *Node) {
2120  OS << " ";
2121  NodeDumper.dumpCXXTemporary(Node->getTemporary());
2122 }
2123 
2124 void ASTDumper::VisitCXXNewExpr(const CXXNewExpr *Node) {
2125  if (Node->isGlobalNew())
2126  OS << " global";
2127  if (Node->isArray())
2128  OS << " array";
2129  if (Node->getOperatorNew()) {
2130  OS << ' ';
2131  NodeDumper.dumpBareDeclRef(Node->getOperatorNew());
2132  }
2133  // We could dump the deallocation function used in case of error, but it's
2134  // usually not that interesting.
2135 }
2136 
2137 void ASTDumper::VisitCXXDeleteExpr(const CXXDeleteExpr *Node) {
2138  if (Node->isGlobalDelete())
2139  OS << " global";
2140  if (Node->isArrayForm())
2141  OS << " array";
2142  if (Node->getOperatorDelete()) {
2143  OS << ' ';
2144  NodeDumper.dumpBareDeclRef(Node->getOperatorDelete());
2145  }
2146 }
2147 
2148 void
2149 ASTDumper::VisitMaterializeTemporaryExpr(const MaterializeTemporaryExpr *Node) {
2150  if (const ValueDecl *VD = Node->getExtendingDecl()) {
2151  OS << " extended by ";
2152  NodeDumper.dumpBareDeclRef(VD);
2153  }
2154 }
2155 
2156 void ASTDumper::VisitExprWithCleanups(const ExprWithCleanups *Node) {
2157  for (unsigned i = 0, e = Node->getNumObjects(); i != e; ++i)
2158  dumpDeclRef(Node->getObject(i), "cleanup");
2159 }
2160 
2161 void ASTDumper::VisitSizeOfPackExpr(const SizeOfPackExpr *Node) {
2162  NodeDumper.dumpPointer(Node->getPack());
2163  NodeDumper.dumpName(Node->getPack());
2164  if (Node->isPartiallySubstituted())
2165  for (const auto &A : Node->getPartialArguments())
2166  dumpTemplateArgument(A);
2167 }
2168 
2169 void ASTDumper::VisitCXXDependentScopeMemberExpr(
2170  const CXXDependentScopeMemberExpr *Node) {
2171  OS << " " << (Node->isArrow() ? "->" : ".") << Node->getMember();
2172 }
2173 
2174 //===----------------------------------------------------------------------===//
2175 // Obj-C Expressions
2176 //===----------------------------------------------------------------------===//
2177 
2178 void ASTDumper::VisitObjCMessageExpr(const ObjCMessageExpr *Node) {
2179  OS << " selector=";
2180  Node->getSelector().print(OS);
2181  switch (Node->getReceiverKind()) {
2183  break;
2184 
2186  OS << " class=";
2187  NodeDumper.dumpBareType(Node->getClassReceiver());
2188  break;
2189 
2191  OS << " super (instance)";
2192  break;
2193 
2195  OS << " super (class)";
2196  break;
2197  }
2198 }
2199 
2200 void ASTDumper::VisitObjCBoxedExpr(const ObjCBoxedExpr *Node) {
2201  if (auto *BoxingMethod = Node->getBoxingMethod()) {
2202  OS << " selector=";
2203  BoxingMethod->getSelector().print(OS);
2204  }
2205 }
2206 
2207 void ASTDumper::VisitObjCAtCatchStmt(const ObjCAtCatchStmt *Node) {
2208  if (const VarDecl *CatchParam = Node->getCatchParamDecl())
2209  dumpDecl(CatchParam);
2210  else
2211  OS << " catch all";
2212 }
2213 
2214 void ASTDumper::VisitObjCEncodeExpr(const ObjCEncodeExpr *Node) {
2215  NodeDumper.dumpType(Node->getEncodedType());
2216 }
2217 
2218 void ASTDumper::VisitObjCSelectorExpr(const ObjCSelectorExpr *Node) {
2219  OS << " ";
2220  Node->getSelector().print(OS);
2221 }
2222 
2223 void ASTDumper::VisitObjCProtocolExpr(const ObjCProtocolExpr *Node) {
2224  OS << ' ' << *Node->getProtocol();
2225 }
2226 
2227 void ASTDumper::VisitObjCPropertyRefExpr(const ObjCPropertyRefExpr *Node) {
2228  if (Node->isImplicitProperty()) {
2229  OS << " Kind=MethodRef Getter=\"";
2230  if (Node->getImplicitPropertyGetter())
2232  else
2233  OS << "(null)";
2234 
2235  OS << "\" Setter=\"";
2236  if (ObjCMethodDecl *Setter = Node->getImplicitPropertySetter())
2237  Setter->getSelector().print(OS);
2238  else
2239  OS << "(null)";
2240  OS << "\"";
2241  } else {
2242  OS << " Kind=PropertyRef Property=\"" << *Node->getExplicitProperty() <<'"';
2243  }
2244 
2245  if (Node->isSuperReceiver())
2246  OS << " super";
2247 
2248  OS << " Messaging=";
2249  if (Node->isMessagingGetter() && Node->isMessagingSetter())
2250  OS << "Getter&Setter";
2251  else if (Node->isMessagingGetter())
2252  OS << "Getter";
2253  else if (Node->isMessagingSetter())
2254  OS << "Setter";
2255 }
2256 
2257 void ASTDumper::VisitObjCSubscriptRefExpr(const ObjCSubscriptRefExpr *Node) {
2258  if (Node->isArraySubscriptRefExpr())
2259  OS << " Kind=ArraySubscript GetterForArray=\"";
2260  else
2261  OS << " Kind=DictionarySubscript GetterForDictionary=\"";
2262  if (Node->getAtIndexMethodDecl())
2263  Node->getAtIndexMethodDecl()->getSelector().print(OS);
2264  else
2265  OS << "(null)";
2266 
2267  if (Node->isArraySubscriptRefExpr())
2268  OS << "\" SetterForArray=\"";
2269  else
2270  OS << "\" SetterForDictionary=\"";
2271  if (Node->setAtIndexMethodDecl())
2272  Node->setAtIndexMethodDecl()->getSelector().print(OS);
2273  else
2274  OS << "(null)";
2275 }
2276 
2277 void ASTDumper::VisitObjCBoolLiteralExpr(const ObjCBoolLiteralExpr *Node) {
2278  OS << " " << (Node->getValue() ? "__objc_yes" : "__objc_no");
2279 }
2280 
2281 //===----------------------------------------------------------------------===//
2282 // Comments
2283 //===----------------------------------------------------------------------===//
2284 
2285 void ASTDumper::dumpComment(const Comment *C, const FullComment *FC) {
2286  dumpChild([=] {
2287  NodeDumper.Visit(C, FC);
2288  if (!C) {
2289  return;
2290  }
2292  for (Comment::child_iterator I = C->child_begin(), E = C->child_end();
2293  I != E; ++I)
2294  dumpComment(*I, FC);
2295  });
2296 }
2297 
2298 //===----------------------------------------------------------------------===//
2299 // Type method implementations
2300 //===----------------------------------------------------------------------===//
2301 
2302 void QualType::dump(const char *msg) const {
2303  if (msg)
2304  llvm::errs() << msg << ": ";
2305  dump();
2306 }
2307 
2308 LLVM_DUMP_METHOD void QualType::dump() const { dump(llvm::errs()); }
2309 
2310 LLVM_DUMP_METHOD void QualType::dump(llvm::raw_ostream &OS) const {
2311  ASTDumper Dumper(OS, nullptr, nullptr);
2312  Dumper.dumpTypeAsChild(*this);
2313 }
2314 
2315 LLVM_DUMP_METHOD void Type::dump() const { dump(llvm::errs()); }
2316 
2317 LLVM_DUMP_METHOD void Type::dump(llvm::raw_ostream &OS) const {
2318  QualType(this, 0).dump(OS);
2319 }
2320 
2321 //===----------------------------------------------------------------------===//
2322 // Decl method implementations
2323 //===----------------------------------------------------------------------===//
2324 
2325 LLVM_DUMP_METHOD void Decl::dump() const { dump(llvm::errs()); }
2326 
2327 LLVM_DUMP_METHOD void Decl::dump(raw_ostream &OS, bool Deserialize) const {
2328  const ASTContext &Ctx = getASTContext();
2329  const SourceManager &SM = Ctx.getSourceManager();
2330  ASTDumper P(OS, &Ctx.getCommentCommandTraits(), &SM,
2332  P.setDeserialize(Deserialize);
2333  P.dumpDecl(this);
2334 }
2335 
2336 LLVM_DUMP_METHOD void Decl::dumpColor() const {
2337  const ASTContext &Ctx = getASTContext();
2338  ASTDumper P(llvm::errs(), &Ctx.getCommentCommandTraits(),
2339  &Ctx.getSourceManager(), /*ShowColors*/ true,
2340  Ctx.getPrintingPolicy());
2341  P.dumpDecl(this);
2342 }
2343 
2344 LLVM_DUMP_METHOD void DeclContext::dumpLookups() const {
2345  dumpLookups(llvm::errs());
2346 }
2347 
2348 LLVM_DUMP_METHOD void DeclContext::dumpLookups(raw_ostream &OS,
2349  bool DumpDecls,
2350  bool Deserialize) const {
2351  const DeclContext *DC = this;
2352  while (!DC->isTranslationUnit())
2353  DC = DC->getParent();
2354  ASTContext &Ctx = cast<TranslationUnitDecl>(DC)->getASTContext();
2355  const SourceManager &SM = Ctx.getSourceManager();
2356  ASTDumper P(OS, &Ctx.getCommentCommandTraits(), &Ctx.getSourceManager(),
2358  P.setDeserialize(Deserialize);
2359  P.dumpLookups(this, DumpDecls);
2360 }
2361 
2362 //===----------------------------------------------------------------------===//
2363 // Stmt method implementations
2364 //===----------------------------------------------------------------------===//
2365 
2366 LLVM_DUMP_METHOD void Stmt::dump(SourceManager &SM) const {
2367  dump(llvm::errs(), SM);
2368 }
2369 
2370 LLVM_DUMP_METHOD void Stmt::dump(raw_ostream &OS, SourceManager &SM) const {
2371  ASTDumper P(OS, nullptr, &SM);
2372  P.dumpStmt(this);
2373 }
2374 
2375 LLVM_DUMP_METHOD void Stmt::dump(raw_ostream &OS) const {
2376  ASTDumper P(OS, nullptr, nullptr);
2377  P.dumpStmt(this);
2378 }
2379 
2380 LLVM_DUMP_METHOD void Stmt::dump() const {
2381  ASTDumper P(llvm::errs(), nullptr, nullptr);
2382  P.dumpStmt(this);
2383 }
2384 
2385 LLVM_DUMP_METHOD void Stmt::dumpColor() const {
2386  ASTDumper P(llvm::errs(), nullptr, nullptr, /*ShowColors*/true);
2387  P.dumpStmt(this);
2388 }
2389 
2390 //===----------------------------------------------------------------------===//
2391 // Comment method implementations
2392 //===----------------------------------------------------------------------===//
2393 
2394 LLVM_DUMP_METHOD void Comment::dump() const {
2395  dump(llvm::errs(), nullptr, nullptr);
2396 }
2397 
2398 LLVM_DUMP_METHOD void Comment::dump(const ASTContext &Context) const {
2399  dump(llvm::errs(), &Context.getCommentCommandTraits(),
2400  &Context.getSourceManager());
2401 }
2402 
2403 void Comment::dump(raw_ostream &OS, const CommandTraits *Traits,
2404  const SourceManager *SM) const {
2405  const FullComment *FC = dyn_cast<FullComment>(this);
2406  if (!FC)
2407  return;
2408  ASTDumper D(OS, Traits, SM);
2409  D.dumpComment(FC, FC);
2410 }
2411 
2412 LLVM_DUMP_METHOD void Comment::dumpColor() const {
2413  const FullComment *FC = dyn_cast<FullComment>(this);
2414  if (!FC)
2415  return;
2416  ASTDumper D(llvm::errs(), nullptr, nullptr, /*ShowColors*/true);
2417  D.dumpComment(FC, FC);
2418 }
ObjCPropertyRefExpr - A dot-syntax expression to access an ObjC property.
Definition: ExprObjC.h:577
void dump() const
Definition: ASTDumper.cpp:2315
bool isBaseInitializer() const
Determine whether this initializer is initializing a base class.
Definition: DeclCXX.h:2325
The receiver is the instance of the superclass object.
Definition: ExprObjC.h:1061
QualType getPattern() const
Retrieve the pattern of this pack expansion, which is the type that will be repeatedly instantiated w...
Definition: Type.h:5380
Defines the clang::ASTContext interface.
const BlockDecl * getBlockDecl() const
Definition: Expr.h:5152
bool path_empty() const
Definition: Expr.h:3015
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:1739
static const TerminalColor StmtColor
NamedDecl * getFoundDecl()
Get the NamedDecl through which this reference occurred.
Definition: Expr.h:1162
bool getValue() const
Definition: ExprObjC.h:94
The receiver is an object instance.
Definition: ExprObjC.h:1055
Expr * getInit() const
Get the initializer.
Definition: DeclCXX.h:2454
bool isThisDeclarationADefinition() const
Returns whether this specific method is a definition.
Definition: DeclObjC.h:507
decl_iterator noload_decls_begin() const
Definition: DeclBase.h:2008
protocol_range protocols() const
Definition: DeclObjC.h:1358
Module * getOwningModule() const
Get the module that owns this declaration (for visibility purposes).
Definition: DeclBase.h:752
PointerType - C99 6.7.5.1 - Pointer Declarators.
Definition: Type.h:2541
QualType getElementType() const
Definition: Type.h:6020
QualType getPointeeType() const
Definition: Type.h:2554
Represents the dependent type named by a dependently-scoped typename using declaration, e.g.
Definition: Type.h:4125
A (possibly-)qualified type.
Definition: Type.h:638
const char * getDeclKindName() const
Definition: DeclBase.cpp:123
base_class_range bases()
Definition: DeclCXX.h:823
ValueDecl * getMemberDecl() const
Retrieve the member declaration to which this expression refers.
Definition: Expr.h:2707
ArrayRef< OMPClause * > clauses()
Definition: StmtOpenMP.h:260
ObjCMethodDecl * getAtIndexMethodDecl() const
Definition: ExprObjC.h:854
ObjCInterfaceDecl * getClassInterface()
Definition: DeclObjC.h:2317
Selector getSelector() const
Definition: ExprObjC.cpp:312
ConstStmtVisitor - This class implements a simple visitor for Stmt subclasses.
Definition: StmtVisitor.h:193
ObjCIvarDecl * getPropertyIvarDecl() const
Definition: DeclObjC.h:2819
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:5040
bool isSuperReceiver() const
Definition: ExprObjC.h:739
bool hasVarStorage() const
True if this IfStmt has storage for a variable declaration.
Definition: Stmt.h:1540
bool isListInitialization() const
Determine whether this expression models list-initialization.
Definition: ExprCXX.h:3153
Expr * getUnderlyingExpr() const
Definition: Type.h:4260
attr_iterator attr_begin() const
Definition: DeclBase.h:494
ObjCProtocolDecl * getProtocol() const
Definition: ExprObjC.h:490
Stmt - This represents one statement.
Definition: Stmt.h:66
Expr * getBitWidth() const
Definition: Decl.h:2677
UnresolvedSetImpl::iterator decls_iterator
Definition: ExprCXX.h:2654
FunctionType - C99 6.7.5.3 - Function Declarators.
Definition: Type.h:3359
IfStmt - This represents an if/then/else.
Definition: Stmt.h:1470
ObjCMethodDecl * setAtIndexMethodDecl() const
Definition: ExprObjC.h:858
An instance of this object exists for each enum constant that is defined.
Definition: Decl.h:2795
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:3027
Defines the SourceManager interface.
The template argument is an expression, and we&#39;ve not resolved it to one of the other forms yet...
Definition: TemplateBase.h:87
unsigned size() const
Retrieve the number of template arguments in this template argument list.
Definition: DeclTemplate.h:270
bool isDecltypeAuto() const
Definition: Type.h:4764
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
TagDecl * getDecl() const
Definition: Type.cpp:3166
ObjCMethodDecl * getImplicitPropertySetter() const
Definition: ExprObjC.h:680
FunctionDecl * getOperatorNew() const
Definition: ExprCXX.h:1972
bool isVirtual() const
Determines whether the base class is a virtual base class (or not).
Definition: DeclCXX.h:245
A reference to a name which we were able to look up during parsing but could not resolve to a specifi...
Definition: ExprCXX.h:2752
Opcode getOpcode() const
Definition: Expr.h:3283
StringRef P
NamedDecl * getTemplatedDecl() const
Get the underlying, templated declaration.
Definition: DeclTemplate.h:453
Represents a C++11 auto or C++14 decltype(auto) type.
Definition: Type.h:4753
Represents an attribute applied to a statement.
Definition: Stmt.h:1416
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:1411
bool requiresZeroInitialization() const
Whether this construction first requires zero-initialization before the initializer is called...
Definition: ExprCXX.h:1351
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:2816
The template argument is a declaration that was provided for a pointer, reference, or pointer to member non-type template parameter.
Definition: TemplateBase.h:64
Represent a C++ namespace.
Definition: Decl.h:514
Represents a call to a C++ constructor.
Definition: ExprCXX.h:1261
ObjCSubscriptRefExpr - used for array and dictionary subscripting.
Definition: ExprObjC.h:803
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:86
QualType getValueType() const
Gets the type contained by this atomic type, i.e.
Definition: Type.h:5987
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
bool hasVarStorage() const
True if this SwitchStmt has storage for a condition variable.
Definition: Stmt.h:1727
IdentKind getIdentKind() const
Definition: Expr.h:1817
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
TemplateTypeParmDecl * getDecl() const
Definition: Type.h:4573
Represents a C++ constructor within a class.
Definition: DeclCXX.h:2484
Represents a prvalue temporary that is written into memory so that a reference can bind to it...
Definition: ExprCXX.h:4051
bool isVirtualAsWritten() const
Whether this function is marked as virtual explicitly.
Definition: Decl.h:2001
bool needsOverloadResolutionForCopyConstructor() const
Determine whether we need to eagerly declare a defaulted copy constructor for this class...
Definition: DeclCXX.h:1008
static const TerminalColor ObjectKindColor
QualType getElementType() const
Definition: Type.h:2851
void dumpSourceRange(SourceRange R)
bool isCompleteDefinition() const
Return true if this decl has its body fully specified.
Definition: Decl.h:3178
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:139
CXXCtorInitializer *const * init_const_iterator
init_const_iterator - Iterates through the ivar initializer list.
Definition: DeclObjC.h:2601
const CXXBaseSpecifier *const * path_const_iterator
Definition: Expr.h:3014
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
An Objective-C array/dictionary subscripting which reads an object or writes at the subscripted array...
Definition: Specifiers.h:141
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:3538
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:6734
ObjCCategoryImplDecl * getImplementation() const
Definition: DeclObjC.cpp:2020
bool hasDefaultArgument() const
Determine whether this template parameter has a default argument.
Represents an empty template argument, e.g., one that has not been deduced.
Definition: TemplateBase.h:57
Extra information about a function prototype.
Definition: Type.h:3771
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:431
bool hasInitStorage() const
True if this SwitchStmt has storage for an init statement.
Definition: Stmt.h:1724
DeclarationName getName() const
Gets the name looked up.
Definition: ExprCXX.h:2671
const char * getName() const
Definition: Stmt.cpp:348
bool isInvalidDecl() const
Definition: DeclBase.h:542
Stores a list of template parameters for a TemplateDecl and its derived classes.
Definition: DeclTemplate.h:68
bool requiresADL() const
True if this declaration should be extended by argument-dependent lookup.
Definition: ExprCXX.h:2825
Not a TLS variable.
Definition: Decl.h:829
Describes how types, statements, expressions, and declarations should be printed. ...
Definition: PrettyPrinter.h:38
protocol_range protocols() const
Definition: DeclObjC.h:2121
Represents an expression – generally a full-expression – that introduces cleanups to be run at the ...
Definition: ExprCXX.h:3016
Represents a parameter to a function.
Definition: Decl.h:1551
Represents the result of substituting a type for a template type parameter.
Definition: Type.h:4607
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:1015
const ObjCInterfaceDecl * getSuperClass() const
Definition: DeclObjC.h:2681
ObjCPropertyDecl * getExplicitProperty() const
Definition: ExprObjC.h:670
PipeType - OpenCL20.
Definition: Type.h:6006
const char * getStmtClassName() const
Definition: Stmt.cpp:75
SourceLocation getAttributeLoc() const
Definition: Type.h:3149
LabelStmt - Represents a label, which has a substatement.
Definition: Stmt.h:1376
Represents a struct/union/class.
Definition: Decl.h:3602
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:2336
const TemplateArgumentList & getTemplateArgs() const
Retrieve the template arguments of the class template specialization.
const char * getOpenMPClauseName(OpenMPClauseKind Kind)
Definition: OpenMPKinds.cpp:62
Provides common interface for the Decls that can be redeclared.
Definition: Redeclarable.h:85
QualType getOriginalType() const
Definition: Type.h:2605
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
QualType getComputationResultType() const
Definition: Expr.h:3491
unsigned getRegParm() const
Definition: Type.h:3522
DeclGroupRef::const_iterator const_decl_iterator
Definition: Stmt.h:965
bool isImplicit() const
Returns true if the attribute has been implicitly created instead of explicitly written by the user...
Definition: Attr.h:101
A vector component is an element or range of elements on a vector.
Definition: Specifiers.h:132
QualType getPointeeType() const
Definition: Type.h:2658
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:154
bool isInline() const
Returns true if this is an inline namespace declaration.
Definition: Decl.h:575
is ARM Neon vector
Definition: Type.h:3188
The results of name lookup within a DeclContext.
Definition: DeclBase.h:1187
ArrayRef< QualType > getParamTypes() const
Definition: Type.h:3899
attr_iterator attr_end() const
Definition: DeclBase.h:497
The template argument is an integral value stored in an llvm::APSInt that was provided for an integra...
Definition: TemplateBase.h:72
Used for GCC&#39;s __alignof.
Definition: TypeTraits.h:107
The parameter is contravariant, e.g., X<T> is a subtype of X<U> when the type parameter is covariant ...
bool isSpelledAsLValue() const
Definition: Type.h:2693
const DefArgStorage & getDefaultArgStorage() const
Represents a member of a struct/union/class.
Definition: Decl.h:2588
TemplateName getTemplateName() const
Retrieve the name of the template that we are specializing.
Definition: Type.h:4908
TypeSourceInfo * getTypeSourceInfo() const
Returns the declarator information for a base class or delegating initializer.
Definition: DeclCXX.h:2386
An operation on a type.
Definition: TypeVisitor.h:65
StringRef getValue() const
Definition: Decl.h:197
InitKind getInitializerKind() const
Get initializer kind.
Definition: DeclOpenMP.h:174
ObjCMethodDecl * getSetterMethodDecl() const
Definition: DeclObjC.h:917
NamedDecl * getFriendDecl() const
If this friend declaration doesn&#39;t name a type, return the inner declaration.
Definition: DeclFriend.h:139
virtual SourceRange getSourceRange() const LLVM_READONLY
Source range that this declaration covers.
Definition: DeclBase.h:406
void dumpLookups() const
Definition: ASTDumper.cpp:2344
ObjCTypeParamList * getTypeParamListAsWritten() const
Retrieve the type parameters written on this particular declaration of the class. ...
Definition: DeclObjC.h:1303
Represents the result of substituting a set of types for a template type parameter pack...
Definition: Type.h:4663
Expr * getSourceExpr() const
The source expression of an opaque value expression is the expression which originally generated the ...
Definition: Expr.h:1004
void dumpColor() const
dumpColor - same as dump(), but forces color highlighting.
Definition: ASTDumper.cpp:2385
ExtVectorElementExpr - This represents access to specific elements of a vector, and may occur on the ...
Definition: Expr.h:5077
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:3946
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
Describes a module or submodule.
Definition: Module.h:65
An r-value expression (a pr-value in the C++11 taxonomy) produces a temporary value.
Definition: Specifiers.h:110
Selector getSelector() const
Definition: ExprObjC.h:442
ArrayRef< ParmVarDecl * > parameters() const
Definition: Decl.h:2263
Represents Objective-C&#39;s @catch statement.
Definition: StmtObjC.h:74
Provides information about a function template specialization, which is a FunctionDecl that has been ...
Definition: DeclTemplate.h:508
StringRef getOpcodeStr() const
Definition: Expr.h:3304
TypeAliasDecl * getTemplatedDecl() const
Get the underlying function declaration of the template.
Describes an C or C++ initializer list.
Definition: Expr.h:4146
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:4480
ArrayRef< BindingDecl * > bindings() const
Definition: DeclCXX.h:3875
Expr * getInitializer()
Get initializer expression (if specified) of the declare reduction construct.
Definition: DeclOpenMP.h:171
UnresolvedUsingTypenameDecl * getDecl() const
Definition: Type.h:4136
bool isBitField() const
Determines whether this field is a bitfield.
Definition: Decl.h:2666
An lvalue ref-qualifier was provided (&).
Definition: Type.h:1367
bool isMessagingSetter() const
True if the property reference will result in a message to the setter.
Definition: ExprObjC.h:707
Stmt * getBody(const FunctionDecl *&Definition) const
Retrieve the body (definition) of the function.
Definition: Decl.cpp:2731
FunctionDecl * getOperatorDelete() const
Definition: ExprCXX.h:2139
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
bool isElidable() const
Whether this construction is elidable.
Definition: ExprCXX.h:1330
bool isGlobalNew() const
Definition: ExprCXX.h:2004
A convenient class for passing around template argument information.
Definition: TemplateBase.h:552
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:2856
An x-value expression is a reference to an object with independent storage but which can be "moved"...
Definition: Specifiers.h:119
path_iterator path_begin()
Definition: Expr.h:3021
bool isTypeAlias() const
Determine if this template specialization type is for a type alias template that has been substituted...
Definition: Type.h:4893
PropertyAttributeKind getPropertyAttributes() const
Definition: DeclObjC.h:832
child_range children()
Definition: Stmt.cpp:237
Represents a typeof (or typeof) expression (a GCC extension).
Definition: Type.h:4180
const clang::PrintingPolicy & getPrintingPolicy() const
Definition: ASTContext.h:653
bool containsUnexpandedParameterPack() const
Whether this type is or contains an unexpanded parameter pack, used to support C++0x variadic templat...
Definition: Type.h:1835
A builtin binary operation expression such as "x + y" or "x <= y".
Definition: Expr.h:3248
const Expr * getAssocExpr(unsigned i) const
Definition: Expr.h:5004
void dumpCXXTemporary(const CXXTemporary *Temporary)
const Type * getClass() const
Definition: Type.h:2794
static bool isPostfix(Opcode Op)
isPostfix - Return true if this is a postfix operation, like x++.
Definition: Expr.h:1954
Any part of the comment.
Definition: Comment.h:53
bool hasElseStorage() const
True if this IfStmt has storage for an else statement.
Definition: Stmt.h:1543
CXXRecordDecl * getDecl() const
Definition: Type.cpp:3255
bool isArrow() const
Definition: Expr.h:2808
bool isConstexpr() const
Whether this variable is (C++11) constexpr.
Definition: Decl.h:1383
FunctionTemplateSpecializationInfo * getTemplateSpecializationInfo() const
If this function is actually a function template specialization, retrieve information about this func...
Definition: Decl.cpp:3483
static const TerminalColor DeclNameColor
Expr * getSizeExpr() const
Definition: Type.h:2995
CaseStmt - Represent a case statement.
Definition: Stmt.h:1177
unsigned getIndex() const
Get the index of the template parameter within its parameter list.
bool isAnyMemberInitializer() const
Definition: DeclCXX.h:2333
void dumpLocation(SourceLocation Loc)
const Expr * getInitExpr() const
Definition: Decl.h:2814
DiagnosticsEngine & getDiagnostics() const
const Expr * getControllingExpr() const
Definition: Expr.h:5029
CastExpr - Base class for type casts, including both implicit casts (ImplicitCastExpr) and explicit c...
Definition: Expr.h:2932
bool hasDefaultArgument() const
Determine whether this template parameter has a default argument.
Represents an Objective-C protocol declaration.
Definition: DeclObjC.h:2056
lookups_range lookups() const
Definition: DeclLookups.h:76
Represents binding an expression to a temporary.
Definition: ExprCXX.h:1216
DeclContext * getLexicalDeclContext()
getLexicalDeclContext - The declaration context where this Decl was lexically declared (LexicalDC)...
Definition: DeclBase.h:821
CXXTemporary * getTemporary()
Definition: ExprCXX.h:1235
FieldDecl * getAnyMember() const
Definition: DeclCXX.h:2398
A C++ lambda expression, which produces a function object (of unspecified type) that can be invoked l...
Definition: ExprCXX.h:1610
decl_iterator decl_end()
Definition: Stmt.h:976
PropertyControl getPropertyImplementation() const
Definition: DeclObjC.h:925
void * getAsOpaquePtr() const
Definition: Type.h:683
An ordinary object is located at an address in memory.
Definition: Specifiers.h:126
bool hasExplicitBound() const
Whether this type parameter has an explicitly-written type bound, e.g., "T : NSView".
Definition: DeclObjC.h:611
Represents a C++ member access expression where the actual member referenced could not be resolved be...
Definition: ExprCXX.h:3217
Represents the body of a CapturedStmt, and serves as its DeclContext.
Definition: Decl.h:4053
Represents an ObjC class declaration.
Definition: DeclObjC.h:1164
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.
is ARM Neon polynomial vector
Definition: Type.h:3191
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:3757
A binding in a decomposition declaration.
Definition: DeclCXX.h:3795
Qualifiers getTypeQuals() const
Definition: Type.h:4019
Expr * getSizeExpr() const
Definition: Type.h:3052
QualType getElementType() const
Definition: Type.h:3148
Represents an extended vector type where either the type or size is dependent.
Definition: Type.h:3132
param_iterator param_begin()
Definition: Decl.h:2275
static void dumpPreviousDeclImpl(raw_ostream &OS,...)
Definition: ASTDumper.cpp:617
Represents the this expression in C++.
Definition: ExprCXX.h:975
Module * getImportedModule() const
Retrieve the module that was imported by the import declaration.
Definition: Decl.h:4202
ObjCIvarDecl * getDecl()
Definition: ExprObjC.h:543
StringRef getArg() const
Definition: Decl.h:164
bool isArrayForm() const
Definition: ExprCXX.h:2126
static bool canPassInRegisters(Sema &S, CXXRecordDecl *D, TargetInfo::CallingConvKind CCK)
Determine whether a type is permitted to be passed or returned in registers, per C++ [class...
ObjCPropertyImplDecl - Represents implementation declaration of a property in a class or category imp...
Definition: DeclObjC.h:2751
QualType getTypeAsWritten() const
getTypeAsWritten - Returns the type that this expression is casting to, as written in the source code...
Definition: Expr.h:3169
decl_type * getFirstDecl()
Return the first declaration of this declaration or itself if this is the only declaration.
Definition: Redeclarable.h:319
const ValueDecl * getExtendingDecl() const
Get the declaration which triggered the lifetime-extension of this temporary, if any.
Definition: ExprCXX.h:4114
bool isStdInitListInitialization() const
Whether this constructor call was written as list-initialization, but was interpreted as forming a st...
Definition: ExprCXX.h:1346
Represents the declaration of a typedef-name via a C++11 alias-declaration.
Definition: Decl.h:3047
ArrayRef< Module * > getModulesWithMergedDefinition(const NamedDecl *Def)
Get the additional modules in which the definition Def has been merged.
Definition: ASTContext.h:989
Represents a prototype with parameter type info, e.g.
Definition: Type.h:3691
Holds a QualType and a TypeSourceInfo* that came out of a declarator parsing.
Definition: LocInfoType.h:29
CXXConstructorDecl * getConstructor() const
Get the constructor that this expression will (ultimately) call.
Definition: ExprCXX.h:1324
QualType getComputationLHSType() const
Definition: Expr.h:3488
child_iterator child_end() const
Definition: Comment.cpp:82
bool isDelegatingInitializer() const
Determine whether this initializer is creating a delegating constructor.
Definition: DeclCXX.h:2353
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
UnaryExprOrTypeTraitExpr - expression with either a type or (unevaluated) expression operand...
Definition: Expr.h:2233
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
ValueDecl * getAsDecl() const
Retrieve the declaration for a declaration non-type template argument.
Definition: TemplateBase.h:264
void outputString(raw_ostream &OS) const
Definition: Expr.cpp:990
This represents &#39;#pragma omp requires...&#39; directive.
Definition: DeclOpenMP.h:250
CXXCtorInitializer *const * init_const_iterator
Iterates through the member/base initializer list.
Definition: DeclCXX.h:2522
unsigned getValue() const
Definition: Expr.h:1437
An Objective-C property is a logical field of an Objective-C object which is read and written via Obj...
Definition: Specifiers.h:136
Represents an array type in C++ whose size is a value-dependent expression.
Definition: Type.h:3030
ObjCMethodDecl * getBoxingMethod() const
Definition: ExprObjC.h:138
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
Definition: DeclTemplate.h:432
static const TerminalColor ValueColor
bool isCanonicalDecl() const
Whether this particular Decl is a canonical one.
Definition: DeclBase.h:876
QualType getElementType() const
Definition: Type.h:2494
bool isInlineSpecified() const
Determine whether the "inline" keyword was specified for this function.
Definition: Decl.h:2351
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:3867
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
Definition: Decl.h:636
This represents one expression.
Definition: Expr.h:106
StringRef getKindName() const
Definition: Decl.h:3248
QualType getPointeeType() const
Definition: Type.h:2698
bool isDefaulted() const
Whether this function is defaulted per C++0x.
Definition: Decl.h:2035
std::string Label
static void dumpBasePath(raw_ostream &OS, const CastExpr *Node)
Definition: ASTDumper.cpp:1856
bool isScopedUsingClassTag() const
Returns true if this is a C++11 scoped enumeration.
Definition: Decl.h:3532
Declaration of a template type parameter.
unsigned getIndex() const
Definition: Type.h:4570
The template argument is a null pointer or null pointer to member that was provided for a non-type te...
Definition: TemplateBase.h:68
const TypeSourceInfo * getAssocTypeSourceInfo(unsigned i) const
Definition: Expr.h:5014
BlockExpr - Adaptor class for mixing a BlockDecl with expressions.
Definition: Expr.h:5138
VarDecl * getExceptionDecl() const
Definition: StmtCXX.h:50
bool isImplicit() const
isImplicit - Indicates whether the declaration was implicitly generated by the implementation.
Definition: DeclBase.h:547
const char * getTypeClassName() const
Definition: Type.cpp:2646
QualType getArgumentType() const
Definition: Expr.h:2270
comments::CommandTraits & getCommentCommandTraits() const
Definition: ASTContext.h:874
DeclContext * getDeclContext()
Definition: DeclBase.h:427
QualType getBaseType() const
Definition: Type.h:4319
ObjCInterfaceDecl * getSuperClass() const
Definition: DeclObjC.cpp:338
ObjCSelectorExpr used for @selector in Objective-C.
Definition: ExprObjC.h:429
TLSKind getTLSKind() const
Definition: Decl.cpp:1936
Represents an expression that computes the length of a parameter pack.
Definition: ExprCXX.h:3739
StorageClass getStorageClass() const
Returns the storage class as written in the source.
Definition: Decl.h:2340
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
IdentifierInfo & getAccessor() const
Definition: Expr.h:5099
Represents the type decltype(expr) (C++11).
Definition: Type.h:4250
decls_iterator decls_begin() const
Definition: ExprCXX.h:2656
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
bool isSignedIntegerType() const
Return true if this is an integer type that is signed, according to C99 6.2.5p4 [char, signed char, short, int, long..], or an enum decl which has a signed representation.
Definition: Type.cpp:1844
void print(llvm::raw_ostream &OS) const
Prints the full selector name (e.g. "foo:bar:").
QualType getType() const
Definition: Expr.h:128
static const TerminalColor ValueKindColor
StorageClass
Storage classes.
Definition: Specifiers.h:206
A unary type transform, which is a type constructed from another.
Definition: Type.h:4293
void dump(raw_ostream &OS) const
Debugging aid that dumps the template name.
Direct list-initialization (C++11)
Definition: Decl.h:823
Qualifiers Quals
The local qualifiers.
Definition: Type.h:582
Declaration of an alias template.
LabelDecl * getLabel() const
Definition: Stmt.h:2100
DeclContext * getParent()
getParent - Returns the containing DeclContext.
Definition: DeclBase.h:1752
QualType getEncodedType() const
Definition: ExprObjC.h:407
An expression that sends a message to the given Objective-C object or class.
Definition: ExprObjC.h:904
ObjCMethodDecl * getImplicitPropertyGetter() const
Definition: ExprObjC.h:675
UnaryOperator - This represents the unary-expression&#39;s (except sizeof and alignof), the postinc/postdec operators from postfix-expression, and various extensions.
Definition: Expr.h:1907
bool isInstanceMethod() const
Definition: DeclObjC.h:414
void dumpBareType(QualType T, bool Desugar=true)
Represents a GCC generic vector type.
Definition: Type.h:3172
ReceiverKind getReceiverKind() const
Determine the kind of receiver that this message is being sent to.
Definition: ExprObjC.h:1188
ArraySizeModifier getSizeModifier() const
Definition: Type.h:2853
TemplateTemplateParmDecl - Declares a template template parameter, e.g., "T" in.
UTTKind getUTTKind() const
Definition: Type.h:4321
StringRef getName() const
Definition: Decl.h:196
ValueDecl * getDecl()
Definition: Expr.h:1125
Selector getSelector() const
Definition: DeclObjC.h:321
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:2027
InitializationStyle getInitStyle() const
The style of initialization for this declaration.
Definition: Decl.h:1278
QualType getType() const
Definition: DeclObjC.h:821
bool getValue() const
Definition: ExprCXX.h:573
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:4189
init_iterator init_begin()
init_begin() - Retrieve an iterator to the first initializer.
Definition: DeclObjC.h:2613
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:6084
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
is AltiVec &#39;vector Pixel&#39;
Definition: Type.h:3182
static StringRef getIdentKindName(IdentKind IK)
Definition: Expr.cpp:498
This captures a statement into a function.
Definition: Stmt.h:2888
not a target-specific vector type
Definition: Type.h:3176
ExceptionSpecificationType Type
The kind of exception specification this is.
Definition: Type.h:3747
bool isImplicitProperty() const
Definition: ExprObjC.h:667
decl_type * getPreviousDecl()
Return the previous declaration of this declaration or NULL if this is the first declaration.
Definition: Redeclarable.h:204
ExtProtoInfo getExtProtoInfo() const
Definition: Type.h:3903
bool isParameterPack() const
Returns whether this is a parameter pack.
bool getSynthesize() const
Definition: DeclObjC.h:1983
ObjCInterfaceDecl * getDecl() const
Get the declaration of this interface.
Definition: Type.h:5755
QualType getReturnType() const
Definition: Type.h:3617
bool isPure() const
Whether this virtual function is pure, i.e.
Definition: Decl.h:2010
bool hasVarStorage() const
True if this WhileStmt has storage for a condition variable.
Definition: Stmt.h:1893
ObjCProtocolList::iterator protocol_iterator
Definition: DeclObjC.h:2345
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
Interfaces are the core concept in Objective-C for object oriented design.
Definition: Type.h:5742
bool isVariablyModifiedType() const
Whether this type is a variably-modified type (C99 6.7.5).
Definition: Type.h:2099
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:2322
std::string getNameAsString() const
Get a human-readable name for the declaration, even if it is one of the special kinds of names (C++ c...
Definition: Decl.h:291
Represents a new-expression for memory allocation and constructor calls, e.g: "new CXXNewExpr(foo)"...
Definition: ExprCXX.h:1872
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:3207
DeclStmt - Adaptor class for mixing declarations with statements and expressions. ...
Definition: Stmt.h:926
Represents the declaration of a label.
Definition: Decl.h:468
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:2730
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
std::string getValueAsString(unsigned Radix) const
Definition: Expr.cpp:807
bool canOverflow() const
Returns true if the unary operator can cause an overflow.
Definition: Expr.h:1950
No ref-qualifier was provided.
Definition: Type.h:1364
C-style initialization with assignment.
Definition: Decl.h:817
const char * getNameStart() const
Return the beginning of the actual null-terminated string for this identifier.
This file defines OpenMP nodes for declarative directives.
bool isParameterPack() const
Definition: Type.h:4571
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:2272
const TemplateTypeParmType * getReplacedParameter() const
Gets the template parameter that was substituted for.
Definition: Type.h:4681
UnaryExprOrTypeTrait getKind() const
Definition: Expr.h:2264
bool hasExternalLexicalStorage() const
Whether this DeclContext has external storage containing additional declarations that are lexically i...
Definition: DeclBase.h:2312
bool isArray() const
Definition: ExprCXX.h:1977
bool isScoped() const
Returns true if this is a C++11 scoped enumeration.
Definition: Decl.h:3529
static const TerminalColor NullColor
decl_iterator decl_begin()
Definition: Stmt.h:975
ObjCProtocolExpr used for protocol expression in Objective-C.
Definition: ExprObjC.h:474
Comment *const * child_iterator
Definition: Comment.h:224
bool hasDefaultArgument() const
Determine whether this template parameter has a default argument.
is AltiVec &#39;vector bool ...&#39;
Definition: Type.h:3185
init_iterator init_end()
init_end() - Retrieve an iterator past the last initializer.
Definition: DeclObjC.h:2622
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:721
ImplicitCastExpr - Allows us to explicitly represent implicit type conversions, which have no direct ...
Definition: Expr.h:3066
bool isFromASTFile() const
Determine whether this declaration came from an AST file (such as a precompiled header or module) rat...
Definition: DeclBase.h:695
bool isMessagingGetter() const
True if the property reference will result in a message to the getter.
Definition: ExprObjC.h:700
is AltiVec vector
Definition: Type.h:3179
Qualifiers getIndexTypeQualifiers() const
Definition: Type.h:2857
Used for C&#39;s _Alignof and C++&#39;s alignof.
Definition: TypeTraits.h:101
This template specialization was instantiated from a template due to an explicit instantiation defini...
Definition: Specifiers.h:164
bool isUsed(bool CheckUsedAttr=true) const
Whether any (re-)declaration of the entity was used, meaning that a definition is required...
Definition: DeclBase.cpp:397
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
llvm::APSInt getAsIntegral() const
Retrieve the template argument as an integral value.
Definition: TemplateBase.h:301
Represents a C++11 static_assert declaration.
Definition: DeclCXX.h:3746
An rvalue ref-qualifier was provided (&&).
Definition: Type.h:1370
SourceRange getBracketsRange() const
Definition: Type.h:3058
decl_iterator noload_decls_end() const
Definition: DeclBase.h:2009
ObjCBoxedExpr - used for generalized expression boxing.
Definition: ExprObjC.h:117
bool isArgumentType() const
Definition: Expr.h:2269
ObjCImplementationDecl * getImplementation() const
Definition: DeclObjC.cpp:1549
Optional< unsigned > getNumExpansions() const
Retrieve the number of expansions that this pack expansion will generate, if known.
Definition: Type.h:5384
Expr * getArrayFiller()
If this initializer list initializes an array with more elements than there are initializers in the l...
Definition: Expr.h:4240
bool isPartOfExplicitCast() const
Definition: Expr.h:3090
std::string getAsString() const
bool isInstantiationDependentType() const
Determine whether this type is an instantiation-dependent type, meaning that the type involves a temp...
Definition: Type.h:2089
Describes a module import declaration, which makes the contents of the named module visible in the cu...
Definition: Decl.h:4158
The injected class name of a C++ class template or class template partial specialization.
Definition: Type.h:4982
Represents a pack expansion of types.
Definition: Type.h:5359
CompoundAssignOperator - For compound assignments (e.g.
Definition: Expr.h:3465
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:4971
ArrayRef< TemplateArgument > getPartialArguments() const
Get.
Definition: ExprCXX.h:3832
SourceRange getRange() const
Definition: Attr.h:94
AddrLabelExpr - The GNU address of label extension, representing &&label.
Definition: Expr.h:3718
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:51
bool isThisDeclarationReferenced() const
Whether this declaration was referenced.
Definition: DeclBase.h:575
bool isDeduced() const
Definition: Type.h:4742
Represents a type which was implicitly adjusted by the semantic engine for arbitrary reasons...
Definition: Type.h:2589
const ObjCInterfaceDecl * getClassInterface() const
Definition: DeclObjC.h:2432
NamespaceDecl * getNominatedNamespace()
Returns the namespace nominated by this using-directive.
Definition: DeclCXX.cpp:2566
unsigned getNumAssocs() const
Definition: Expr.h:4998
Dataflow Directional Tag Classes.
bool isResultDependent() const
Whether this generic selection is result-dependent.
Definition: Expr.h:5035
ExtInfo getExtInfo() const
Definition: Type.h:3628
const TemplateArgument & getArgument() const
Definition: TemplateBase.h:499
not evaluated yet, for special member function
[C99 6.4.2.2] - A predefined identifier such as func.
Definition: Expr.h:1769
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
Represents a delete expression for memory deallocation and destructor calls, e.g. ...
Definition: ExprCXX.h:2099
ArrayRef< Capture > captures() const
Definition: Decl.h:3994
The base class of all kinds of template declarations (e.g., class, function, etc.).
Definition: DeclTemplate.h:399
bool isVariadic() const
Definition: Decl.h:3942
Kind getPropertyImplementation() const
Definition: DeclObjC.h:2815
The template argument is a pack expansion of a template name that was provided for a template templat...
Definition: TemplateBase.h:80
ArrayRef< const Attr * > getAttrs() const
Definition: Stmt.h:1452
static bool isTrivial(ASTContext &Ctx, const Expr *E)
bool hasInitStorage() const
True if this IfStmt has the storage for an init statement.
Definition: Stmt.h:1537
void dump() const
Definition: ASTDumper.cpp:2308
Represents a field injected from an anonymous union/struct into the parent scope. ...
Definition: Decl.h:2834
QualType getUnderlyingType() const
Definition: Decl.h:2980
AttrVec::const_iterator attr_iterator
Definition: DeclBase.h:487
AccessSpecifier getAccess() const
Definition: DeclBase.h:462
const Expr * getInit() const
Definition: Decl.h:1219
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.
bool usesADL() const
Definition: Expr.h:2468
DeclarationName getMember() const
Retrieve the name of the member that this expression refers to.
Definition: ExprCXX.h:3349
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:551
VectorKind getVectorKind() const
Definition: Type.h:3217
static std::string getAsString(SplitQualType split, const PrintingPolicy &Policy)
Definition: Type.h:971
Kind getKind() const
Definition: DeclBase.h:421
bool isListInitialization() const
Whether this constructor call was written as list-initialization.
Definition: ExprCXX.h:1339
const Type * getBaseClass() const
If this is a base class initializer, returns the type of the base class.
Definition: DeclCXX.cpp:2266
Represents an enum.
Definition: Decl.h:3335
A pointer to member type per C++ 8.3.3 - Pointers to members.
Definition: Type.h:2760
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...
pack_iterator pack_begin() const
Iterator referencing the first argument of a template argument pack.
Definition: TemplateBase.h:340
const TemplateTypeParmType * getReplacedParameter() const
Gets the template parameter that was substituted for.
Definition: Type.h:4622
const ObjCInterfaceDecl * getClassInterface() const
Definition: DeclObjC.h:2739
llvm::APInt getValue() const
Definition: Expr.h:1303
const DefArgStorage & getDefaultArgStorage() const
QualType getModifiedType() const
Definition: Type.h:4454
LabelDecl * getLabel() const
Definition: Expr.h:3740
QualType getClassReceiver() const
Returns the type of a class message send, or NULL if the message is not a class message.
Definition: ExprObjC.h:1226
path_iterator path_end()
Definition: Expr.h:3022
Represents a pointer to an Objective C object.
Definition: Type.h:5798
SwitchStmt - This represents a &#39;switch&#39; stmt.
Definition: Stmt.h:1669
Pointer to a block type.
Definition: Type.h:2643
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:2544
FunctionDecl * SourceTemplate
The function template whose exception specification this is instantiated from, for EST_Uninstantiated...
Definition: Type.h:3761
Provides common interface for the Decls that cannot be redeclared, but can be merged if the same decl...
Definition: Redeclarable.h:313
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
Definition: Type.h:4374
Complex values, per C99 6.2.5p11.
Definition: Type.h:2481
Location wrapper for a TemplateArgument.
Definition: TemplateBase.h:450
void dump() const
Dumps the specified AST fragment and all subtrees to llvm::errs().
Definition: ASTDumper.cpp:2380
bool empty() const
Definition: Type.h:414
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
unsigned getNumObjects() const
Definition: ExprCXX.h:3047
ObjCEncodeExpr, used for @encode in Objective-C.
Definition: ExprObjC.h:386
bool isFromAST() const
Whether this type comes from an AST file.
Definition: Type.h:1818
static const TerminalColor CastColor
const llvm::APInt & getSize() const
Definition: Type.h:2894
protocol_iterator protocol_begin() const
Definition: DeclObjC.h:2352
bool hasBody() const override
Determine whether this method has a body.
Definition: DeclObjC.h:496
static const TerminalColor TypeColor
Opcode getOpcode() const
Definition: Expr.h:1932
static const TerminalColor DeclKindNameColor
Base for LValueReferenceType and RValueReferenceType.
Definition: Type.h:2677
SourceRange getBracketsRange() const
Definition: Type.h:3001
static const char * getCastKindName(CastKind CK)
Definition: Expr.cpp:1683
The template argument is a type.
Definition: TemplateBase.h:60
The template argument is actually a parameter pack.
Definition: TemplateBase.h:91
bool isArrow() const
Determine whether this member expression used the &#39;->&#39; operator; otherwise, it used the &#39;...
Definition: ExprCXX.h:3311
const TemplateArgumentLoc & getDefaultArgument() const
Retrieve the default argument, if any.
Represents a base class of a C++ class.
Definition: DeclCXX.h:192
A bitfield object is a bitfield on a C or C++ record.
Definition: Specifiers.h:129
ObjCIvarRefExpr - A reference to an ObjC instance variable.
Definition: ExprObjC.h:513
SourceManager & getSourceManager()
Definition: ASTContext.h:661
bool isPartiallySubstituted() const
Determine whether this represents a partially-substituted sizeof...
Definition: ExprCXX.h:3827
bool capturesCXXThis() const
Definition: Decl.h:3999
Describes an explicit type conversion that uses functional notion but could not be resolved because o...
Definition: ExprCXX.h:3096
GotoStmt - This represents a direct goto.
Definition: Stmt.h:2087
A template argument list.
Definition: DeclTemplate.h:210
TypedefNameDecl * getDecl() const
Definition: Type.h:4171
pack_iterator pack_end() const
Iterator referencing one past the last argument of a template argument pack.
Definition: TemplateBase.h:347
CapturedDecl * getCapturedDecl()
Retrieve the outlined function declaration.
Definition: Stmt.cpp:1265
ArgKind getKind() const
Return the kind of stored template argument.
Definition: TemplateBase.h:235
unsigned getDepth() const
Definition: Type.h:4569
An attributed type is a type to which a type attribute has been applied.
Definition: Type.h:4429
bool isFreeIvar() const
Definition: ExprObjC.h:552
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)
MemberExpr - [C99 6.5.2.3] Structure and Union Members.
Definition: Expr.h:2616
bool isMutable() const
Determines whether this field is mutable (C++ only).
Definition: Decl.h:2663
Represents a C++ struct/union/class.
Definition: DeclCXX.h:300
bool isValid() const
bool isNRVOVariable() const
Determine whether this local variable can be used with the named return value optimization (NRVO)...
Definition: Decl.h:1324
The template argument is a template name that was provided for a template template parameter...
Definition: TemplateBase.h:76
bool isSugared() const
Definition: Type.h:5390
CXXCatchStmt - This represents a C++ catch block.
Definition: StmtCXX.h:29
Represents an explicit C++ type conversion that uses "functional" notation (C++ [expr.type.conv]).
Definition: ExprCXX.h:1493
The parameter type of a method or function.
ObjCIvarDecl - Represents an ObjC instance variable.
Definition: DeclObjC.h:1937
WhileStmt - This represents a &#39;while&#39; stmt.
Definition: Stmt.h:1846
void dumpBareDeclRef(const Decl *D)
CleanupObject getObject(unsigned i) const
Definition: ExprCXX.h:3049
bool isInherited() const
Definition: Attr.h:97
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:629
static void dumpPreviousDecl(raw_ostream &OS, const Decl *D)
Dump the previous declaration in the redeclaration chain for a declaration, if any.
Definition: ASTDumper.cpp:635
bool isVariadic() const
Definition: DeclObjC.h:419
The receiver is a class.
Definition: ExprObjC.h:1052
protocol_iterator protocol_end() const
Definition: DeclObjC.h:2356
SourceRange getSourceRange() const LLVM_READONLY
SourceLocation tokens are not useful in isolation - they are low level value objects created/interpre...
Definition: Stmt.cpp:276
bool isGlobalDelete() const
Definition: ExprCXX.h:2125
StringLiteral - This represents a string literal expression, e.g.
Definition: Expr.h:1577
void dumpType(QualType T)
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
Definition: Expr.h:2407
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:3489
bool doesThisDeclarationHaveABody() const
Returns whether this specific declaration of the function has a body.
Definition: Decl.h:1990
StringRef getName() const
Get the name of identifier for this declaration as a StringRef.
Definition: Decl.h:275
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:2302
void dump() const
Definition: ASTDumper.cpp:2325
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
Abstract class common to all of the C++ "named"/"keyword" casts.
Definition: ExprCXX.h:254
unsigned getNumElements() const
Definition: Type.h:3208
ObjCBoolLiteralExpr - Objective-C Boolean Literal.
Definition: ExprObjC.h:82
bool isDependentType() const
Whether this type is a dependent type, meaning that its definition somehow depends on a template para...
Definition: Type.h:2083
QualType getAsType() const
Retrieve the type for a type template argument.
Definition: TemplateBase.h:257
A reference to a declared variable, function, enum, etc.
Definition: Expr.h:1042
Represents a type template specialization; the template must be a class template, a type alias templa...
Definition: Type.h:4845
ArrayRef< ParmVarDecl * > parameters() const
Definition: Decl.h:3953
ObjCPropertyDecl * getPropertyDecl() const
Definition: DeclObjC.h:2810
ObjCTypeParamVariance getVariance() const
Determine the variance of this type parameter.
Definition: DeclObjC.h:594
bool isDeleted() const
Whether this function has been deleted.
Definition: Decl.h:2137
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
const char * getCastName() const
getCastName - Get the name of the C++ cast being used, e.g., "static_cast", "dynamic_cast", "reinterpret_cast", or "const_cast".
Definition: ExprCXX.cpp:543
FieldDecl * getInitializedFieldInUnion()
If this initializes a union, specifies which field in the union to initialize.
Definition: Expr.h:4258
varlist_range varlists()
Definition: DeclOpenMP.h:78
QualType getDefaultArgument() const
Retrieve the default argument, if any.
bool isArraySubscriptRefExpr() const
Definition: ExprObjC.h:862
QualType getTypeAsWritten() const
Retrieve the type that is being constructed, as specified in the source code.
Definition: ExprCXX.h:3134
static StringRef getNameForCallConv(CallingConv CC)
Definition: Type.cpp:2822
QualType getType() const
Definition: Decl.h:647
An l-value expression is a reference to an object with independent storage.
Definition: Specifiers.h:114
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
static StringRef getOpcodeStr(Opcode Op)
getOpcodeStr - Turn an Opcode enum value into the punctuation char it corresponds to...
Definition: Expr.cpp:1178
ObjCMethodDecl * getGetterMethodDecl() const
Definition: DeclObjC.h:914
CXXRecordDecl * getNominatedBaseClass() const
Get the base class that was named in the using declaration.
Definition: DeclCXX.cpp:2705
This represents a decl that may have a name.
Definition: Decl.h:248
A boolean literal, per ([C++ lex.bool] Boolean literals).
Definition: ExprCXX.h:561
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:2975
Represents a C++ namespace alias.
Definition: DeclCXX.h:3020
bool isInline() const
Whether this variable is (C++1z) inline.
Definition: Decl.h:1365
TemplateName getAsTemplate() const
Retrieve the template name for a template name argument.
Definition: TemplateBase.h:281
AccessControl getAccessControl() const
Definition: DeclObjC.h:1976
Represents C++ using-directive.
Definition: DeclCXX.h:2916
Represents a #pragma detect_mismatch line.
Definition: Decl.h:173
double getValueAsApproximateDouble() const
getValueAsApproximateDouble - This returns the value as an inaccurate double.
Definition: Expr.cpp:881
attr::Kind getKind() const
Definition: Attr.h:86
The receiver is a superclass.
Definition: ExprObjC.h:1058
A simple visitor class that helps create declaration visitors.
Definition: DeclVisitor.h:74
TemplateName getAsTemplateOrTemplatePattern() const
Retrieve the template argument as a template name; if the argument is a pack expansion, return the pattern as a template name.
Definition: TemplateBase.h:288
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
NamedDecl * getPack() const
Retrieve the parameter pack.
Definition: ExprCXX.h:3810
This represents &#39;#pragma omp threadprivate ...&#39; directive.
Definition: DeclOpenMP.h:40
decls_iterator decls_end() const
Definition: ExprCXX.h:2657
ObjCCategoryImplDecl - An object of this class encapsulates a category @implementation declaration...
Definition: DeclObjC.h:2491
bool caseStmtIsGNURange() const
True if this case statement is of the form case LHS ...
Definition: Stmt.h:1246
Represents the canonical version of C arrays with a specified constant size.
Definition: Type.h:2876
This class handles loading and caching of source files into memory.
The parameter is invariant: must match exactly.
ExceptionSpecInfo ExceptionSpec
Definition: Type.h:3777
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:2141
SourceLocation getLocation() const
Definition: DeclBase.h:418
const StringLiteral * getAsmString() const
Definition: Decl.h:3856
QualType getPointeeType() const
Definition: Type.h:2780
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:97
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:162
ObjCCompatibleAliasDecl - Represents alias of a class.
Definition: DeclObjC.h:2721
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:5814
QualType getType() const
Retrieves the type of the base class.
Definition: DeclCXX.h:291