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"
16 #include "clang/AST/Attr.h"
18 #include "clang/AST/DeclCXX.h"
19 #include "clang/AST/DeclLookups.h"
20 #include "clang/AST/DeclObjC.h"
21 #include "clang/AST/DeclOpenMP.h"
22 #include "clang/AST/DeclVisitor.h"
23 #include "clang/AST/LocInfoType.h"
24 #include "clang/AST/StmtVisitor.h"
25 #include "clang/AST/TypeVisitor.h"
26 #include "clang/Basic/Builtins.h"
27 #include "clang/Basic/Module.h"
29 #include "llvm/Support/raw_ostream.h"
30 using namespace clang;
31 using namespace clang::comments;
32 
33 //===----------------------------------------------------------------------===//
34 // ASTDumper Visitor
35 //===----------------------------------------------------------------------===//
36 
37 namespace {
38  // Colors used for various parts of the AST dump
39  // Do not use bold yellow for any text. It is hard to read on white screens.
40 
41  struct TerminalColor {
42  raw_ostream::Colors Color;
43  bool Bold;
44  };
45 
46  // Red - CastColor
47  // Green - TypeColor
48  // Bold Green - DeclKindNameColor, UndeserializedColor
49  // Yellow - AddressColor, LocationColor
50  // Blue - CommentColor, NullColor, IndentColor
51  // Bold Blue - AttrColor
52  // Bold Magenta - StmtColor
53  // Cyan - ValueKindColor, ObjectKindColor
54  // Bold Cyan - ValueColor, DeclNameColor
55 
56  // Decl kind names (VarDecl, FunctionDecl, etc)
57  static const TerminalColor DeclKindNameColor = { raw_ostream::GREEN, true };
58  // Attr names (CleanupAttr, GuardedByAttr, etc)
59  static const TerminalColor AttrColor = { raw_ostream::BLUE, true };
60  // Statement names (DeclStmt, ImplicitCastExpr, etc)
61  static const TerminalColor StmtColor = { raw_ostream::MAGENTA, true };
62  // Comment names (FullComment, ParagraphComment, TextComment, etc)
63  static const TerminalColor CommentColor = { raw_ostream::BLUE, false };
64 
65  // Type names (int, float, etc, plus user defined types)
66  static const TerminalColor TypeColor = { raw_ostream::GREEN, false };
67 
68  // Pointer address
69  static const TerminalColor AddressColor = { raw_ostream::YELLOW, false };
70  // Source locations
71  static const TerminalColor LocationColor = { raw_ostream::YELLOW, false };
72 
73  // lvalue/xvalue
74  static const TerminalColor ValueKindColor = { raw_ostream::CYAN, false };
75  // bitfield/objcproperty/objcsubscript/vectorcomponent
76  static const TerminalColor ObjectKindColor = { raw_ostream::CYAN, false };
77 
78  // Null statements
79  static const TerminalColor NullColor = { raw_ostream::BLUE, false };
80 
81  // Undeserialized entities
82  static const TerminalColor UndeserializedColor = { raw_ostream::GREEN, true };
83 
84  // CastKind from CastExpr's
85  static const TerminalColor CastColor = { raw_ostream::RED, false };
86 
87  // Value of the statement
88  static const TerminalColor ValueColor = { raw_ostream::CYAN, true };
89  // Decl names
90  static const TerminalColor DeclNameColor = { raw_ostream::CYAN, true };
91 
92  // Indents ( `, -. | )
93  static const TerminalColor IndentColor = { raw_ostream::BLUE, false };
94 
95  class ASTDumper
96  : public ConstDeclVisitor<ASTDumper>, public ConstStmtVisitor<ASTDumper>,
97  public ConstCommentVisitor<ASTDumper>, public TypeVisitor<ASTDumper> {
98  raw_ostream &OS;
99  const CommandTraits *Traits;
100  const SourceManager *SM;
101 
102  /// The policy to use for printing; can be defaulted.
103  PrintingPolicy PrintPolicy;
104 
105  /// Pending[i] is an action to dump an entity at level i.
107 
108  /// Indicates whether we should trigger deserialization of nodes that had
109  /// not already been loaded.
110  bool Deserialize = false;
111 
112  /// Indicates whether we're at the top level.
113  bool TopLevel = true;
114 
115  /// Indicates if we're handling the first child after entering a new depth.
116  bool FirstChild = true;
117 
118  /// Prefix for currently-being-dumped entity.
119  std::string Prefix;
120 
121  /// Keep track of the last location we print out so that we can
122  /// print out deltas from then on out.
123  const char *LastLocFilename = "";
124  unsigned LastLocLine = ~0U;
125 
126  /// The \c FullComment parent of the comment being dumped.
127  const FullComment *FC = nullptr;
128 
129  bool ShowColors;
130 
131  /// Dump a child of the current node.
132  template<typename Fn> void dumpChild(Fn doDumpChild) {
133  // If we're at the top level, there's nothing interesting to do; just
134  // run the dumper.
135  if (TopLevel) {
136  TopLevel = false;
137  doDumpChild();
138  while (!Pending.empty()) {
139  Pending.back()(true);
140  Pending.pop_back();
141  }
142  Prefix.clear();
143  OS << "\n";
144  TopLevel = true;
145  return;
146  }
147 
148  const FullComment *OrigFC = FC;
149  auto dumpWithIndent = [this, doDumpChild, OrigFC](bool isLastChild) {
150  // Print out the appropriate tree structure and work out the prefix for
151  // children of this node. For instance:
152  //
153  // A Prefix = ""
154  // |-B Prefix = "| "
155  // | `-C Prefix = "| "
156  // `-D Prefix = " "
157  // |-E Prefix = " | "
158  // `-F Prefix = " "
159  // G Prefix = ""
160  //
161  // Note that the first level gets no prefix.
162  {
163  OS << '\n';
164  ColorScope Color(*this, IndentColor);
165  OS << Prefix << (isLastChild ? '`' : '|') << '-';
166  this->Prefix.push_back(isLastChild ? ' ' : '|');
167  this->Prefix.push_back(' ');
168  }
169 
170  FirstChild = true;
171  unsigned Depth = Pending.size();
172 
173  FC = OrigFC;
174  doDumpChild();
175 
176  // If any children are left, they're the last at their nesting level.
177  // Dump those ones out now.
178  while (Depth < Pending.size()) {
179  Pending.back()(true);
180  this->Pending.pop_back();
181  }
182 
183  // Restore the old prefix.
184  this->Prefix.resize(Prefix.size() - 2);
185  };
186 
187  if (FirstChild) {
188  Pending.push_back(std::move(dumpWithIndent));
189  } else {
190  Pending.back()(false);
191  Pending.back() = std::move(dumpWithIndent);
192  }
193  FirstChild = false;
194  }
195 
196  class ColorScope {
197  ASTDumper &Dumper;
198  public:
199  ColorScope(ASTDumper &Dumper, TerminalColor Color)
200  : Dumper(Dumper) {
201  if (Dumper.ShowColors)
202  Dumper.OS.changeColor(Color.Color, Color.Bold);
203  }
204  ~ColorScope() {
205  if (Dumper.ShowColors)
206  Dumper.OS.resetColor();
207  }
208  };
209 
210  public:
211  ASTDumper(raw_ostream &OS, const CommandTraits *Traits,
212  const SourceManager *SM)
213  : ASTDumper(OS, Traits, SM,
214  SM && SM->getDiagnostics().getShowColors()) {}
215 
216  ASTDumper(raw_ostream &OS, const CommandTraits *Traits,
217  const SourceManager *SM, bool ShowColors)
218  : ASTDumper(OS, Traits, SM, ShowColors, LangOptions()) {}
219  ASTDumper(raw_ostream &OS, const CommandTraits *Traits,
220  const SourceManager *SM, bool ShowColors,
221  const PrintingPolicy &PrintPolicy)
222  : OS(OS), Traits(Traits), SM(SM), PrintPolicy(PrintPolicy),
223  ShowColors(ShowColors) {}
224 
225  void setDeserialize(bool D) { Deserialize = D; }
226 
227  void dumpDecl(const Decl *D);
228  void dumpStmt(const Stmt *S);
229  void dumpFullComment(const FullComment *C);
230 
231  // Utilities
232  void dumpPointer(const void *Ptr);
233  void dumpSourceRange(SourceRange R);
234  void dumpLocation(SourceLocation Loc);
235  void dumpBareType(QualType T, bool Desugar = true);
236  void dumpType(QualType T);
237  void dumpTypeAsChild(QualType T);
238  void dumpTypeAsChild(const Type *T);
239  void dumpBareDeclRef(const Decl *Node);
240  void dumpDeclRef(const Decl *Node, const char *Label = nullptr);
241  void dumpName(const NamedDecl *D);
242  bool hasNodes(const DeclContext *DC);
243  void dumpDeclContext(const DeclContext *DC);
244  void dumpLookups(const DeclContext *DC, bool DumpDecls);
245  void dumpAttr(const Attr *A);
246 
247  // C++ Utilities
248  void dumpAccessSpecifier(AccessSpecifier AS);
249  void dumpCXXCtorInitializer(const CXXCtorInitializer *Init);
250  void dumpTemplateParameters(const TemplateParameterList *TPL);
251  void dumpTemplateArgumentListInfo(const TemplateArgumentListInfo &TALI);
252  void dumpTemplateArgumentLoc(const TemplateArgumentLoc &A);
253  void dumpTemplateArgumentList(const TemplateArgumentList &TAL);
254  void dumpTemplateArgument(const TemplateArgument &A,
255  SourceRange R = SourceRange());
256 
257  // Objective-C utilities.
258  void dumpObjCTypeParamList(const ObjCTypeParamList *typeParams);
259 
260  // Types
261  void VisitComplexType(const ComplexType *T) {
262  dumpTypeAsChild(T->getElementType());
263  }
264  void VisitPointerType(const PointerType *T) {
265  dumpTypeAsChild(T->getPointeeType());
266  }
267  void VisitBlockPointerType(const BlockPointerType *T) {
268  dumpTypeAsChild(T->getPointeeType());
269  }
270  void VisitReferenceType(const ReferenceType *T) {
271  dumpTypeAsChild(T->getPointeeType());
272  }
273  void VisitRValueReferenceType(const ReferenceType *T) {
274  if (T->isSpelledAsLValue())
275  OS << " written as lvalue reference";
276  VisitReferenceType(T);
277  }
278  void VisitMemberPointerType(const MemberPointerType *T) {
279  dumpTypeAsChild(T->getClass());
280  dumpTypeAsChild(T->getPointeeType());
281  }
282  void VisitArrayType(const ArrayType *T) {
283  switch (T->getSizeModifier()) {
284  case ArrayType::Normal: break;
285  case ArrayType::Static: OS << " static"; break;
286  case ArrayType::Star: OS << " *"; break;
287  }
288  OS << " " << T->getIndexTypeQualifiers().getAsString();
289  dumpTypeAsChild(T->getElementType());
290  }
291  void VisitConstantArrayType(const ConstantArrayType *T) {
292  OS << " " << T->getSize();
293  VisitArrayType(T);
294  }
295  void VisitVariableArrayType(const VariableArrayType *T) {
296  OS << " ";
297  dumpSourceRange(T->getBracketsRange());
298  VisitArrayType(T);
299  dumpStmt(T->getSizeExpr());
300  }
301  void VisitDependentSizedArrayType(const DependentSizedArrayType *T) {
302  VisitArrayType(T);
303  OS << " ";
304  dumpSourceRange(T->getBracketsRange());
305  dumpStmt(T->getSizeExpr());
306  }
307  void VisitDependentSizedExtVectorType(
308  const DependentSizedExtVectorType *T) {
309  OS << " ";
310  dumpLocation(T->getAttributeLoc());
311  dumpTypeAsChild(T->getElementType());
312  dumpStmt(T->getSizeExpr());
313  }
314  void VisitVectorType(const VectorType *T) {
315  switch (T->getVectorKind()) {
316  case VectorType::GenericVector: break;
317  case VectorType::AltiVecVector: OS << " altivec"; break;
318  case VectorType::AltiVecPixel: OS << " altivec pixel"; break;
319  case VectorType::AltiVecBool: OS << " altivec bool"; break;
320  case VectorType::NeonVector: OS << " neon"; break;
321  case VectorType::NeonPolyVector: OS << " neon poly"; break;
322  }
323  OS << " " << T->getNumElements();
324  dumpTypeAsChild(T->getElementType());
325  }
326  void VisitFunctionType(const FunctionType *T) {
327  auto EI = T->getExtInfo();
328  if (EI.getNoReturn()) OS << " noreturn";
329  if (EI.getProducesResult()) OS << " produces_result";
330  if (EI.getHasRegParm()) OS << " regparm " << EI.getRegParm();
331  OS << " " << FunctionType::getNameForCallConv(EI.getCC());
332  dumpTypeAsChild(T->getReturnType());
333  }
334  void VisitFunctionProtoType(const FunctionProtoType *T) {
335  auto EPI = T->getExtProtoInfo();
336  if (EPI.HasTrailingReturn) OS << " trailing_return";
337  if (T->isConst()) OS << " const";
338  if (T->isVolatile()) OS << " volatile";
339  if (T->isRestrict()) OS << " restrict";
340  switch (EPI.RefQualifier) {
341  case RQ_None: break;
342  case RQ_LValue: OS << " &"; break;
343  case RQ_RValue: OS << " &&"; break;
344  }
345  // FIXME: Exception specification.
346  // FIXME: Consumed parameters.
347  VisitFunctionType(T);
348  for (QualType PT : T->getParamTypes())
349  dumpTypeAsChild(PT);
350  if (EPI.Variadic)
351  dumpChild([=] { OS << "..."; });
352  }
353  void VisitUnresolvedUsingType(const UnresolvedUsingType *T) {
354  dumpDeclRef(T->getDecl());
355  }
356  void VisitTypedefType(const TypedefType *T) {
357  dumpDeclRef(T->getDecl());
358  }
359  void VisitTypeOfExprType(const TypeOfExprType *T) {
360  dumpStmt(T->getUnderlyingExpr());
361  }
362  void VisitDecltypeType(const DecltypeType *T) {
363  dumpStmt(T->getUnderlyingExpr());
364  }
365  void VisitUnaryTransformType(const UnaryTransformType *T) {
366  switch (T->getUTTKind()) {
368  OS << " underlying_type";
369  break;
370  }
371  dumpTypeAsChild(T->getBaseType());
372  }
373  void VisitTagType(const TagType *T) {
374  dumpDeclRef(T->getDecl());
375  }
376  void VisitAttributedType(const AttributedType *T) {
377  // FIXME: AttrKind
378  dumpTypeAsChild(T->getModifiedType());
379  }
380  void VisitTemplateTypeParmType(const TemplateTypeParmType *T) {
381  OS << " depth " << T->getDepth() << " index " << T->getIndex();
382  if (T->isParameterPack()) OS << " pack";
383  dumpDeclRef(T->getDecl());
384  }
385  void VisitSubstTemplateTypeParmType(const SubstTemplateTypeParmType *T) {
386  dumpTypeAsChild(T->getReplacedParameter());
387  }
388  void VisitSubstTemplateTypeParmPackType(
390  dumpTypeAsChild(T->getReplacedParameter());
391  dumpTemplateArgument(T->getArgumentPack());
392  }
393  void VisitAutoType(const AutoType *T) {
394  if (T->isDecltypeAuto()) OS << " decltype(auto)";
395  if (!T->isDeduced())
396  OS << " undeduced";
397  }
398  void VisitTemplateSpecializationType(const TemplateSpecializationType *T) {
399  if (T->isTypeAlias()) OS << " alias";
400  OS << " "; T->getTemplateName().dump(OS);
401  for (auto &Arg : *T)
402  dumpTemplateArgument(Arg);
403  if (T->isTypeAlias())
404  dumpTypeAsChild(T->getAliasedType());
405  }
406  void VisitInjectedClassNameType(const InjectedClassNameType *T) {
407  dumpDeclRef(T->getDecl());
408  }
409  void VisitObjCInterfaceType(const ObjCInterfaceType *T) {
410  dumpDeclRef(T->getDecl());
411  }
412  void VisitObjCObjectPointerType(const ObjCObjectPointerType *T) {
413  dumpTypeAsChild(T->getPointeeType());
414  }
415  void VisitAtomicType(const AtomicType *T) {
416  dumpTypeAsChild(T->getValueType());
417  }
418  void VisitPipeType(const PipeType *T) {
419  dumpTypeAsChild(T->getElementType());
420  }
421  void VisitAdjustedType(const AdjustedType *T) {
422  dumpTypeAsChild(T->getOriginalType());
423  }
424  void VisitPackExpansionType(const PackExpansionType *T) {
425  if (auto N = T->getNumExpansions()) OS << " expansions " << *N;
426  if (!T->isSugared())
427  dumpTypeAsChild(T->getPattern());
428  }
429  // FIXME: ElaboratedType, DependentNameType,
430  // DependentTemplateSpecializationType, ObjCObjectType
431 
432  // Decls
433  void VisitLabelDecl(const LabelDecl *D);
434  void VisitTypedefDecl(const TypedefDecl *D);
435  void VisitEnumDecl(const EnumDecl *D);
436  void VisitRecordDecl(const RecordDecl *D);
437  void VisitEnumConstantDecl(const EnumConstantDecl *D);
438  void VisitIndirectFieldDecl(const IndirectFieldDecl *D);
439  void VisitFunctionDecl(const FunctionDecl *D);
440  void VisitFieldDecl(const FieldDecl *D);
441  void VisitVarDecl(const VarDecl *D);
442  void VisitDecompositionDecl(const DecompositionDecl *D);
443  void VisitBindingDecl(const BindingDecl *D);
444  void VisitFileScopeAsmDecl(const FileScopeAsmDecl *D);
445  void VisitImportDecl(const ImportDecl *D);
446  void VisitPragmaCommentDecl(const PragmaCommentDecl *D);
447  void VisitPragmaDetectMismatchDecl(const PragmaDetectMismatchDecl *D);
448  void VisitCapturedDecl(const CapturedDecl *D);
449 
450  // OpenMP decls
451  void VisitOMPThreadPrivateDecl(const OMPThreadPrivateDecl *D);
452  void VisitOMPDeclareReductionDecl(const OMPDeclareReductionDecl *D);
453  void VisitOMPCapturedExprDecl(const OMPCapturedExprDecl *D);
454 
455  // C++ Decls
456  void VisitNamespaceDecl(const NamespaceDecl *D);
457  void VisitUsingDirectiveDecl(const UsingDirectiveDecl *D);
458  void VisitNamespaceAliasDecl(const NamespaceAliasDecl *D);
459  void VisitTypeAliasDecl(const TypeAliasDecl *D);
460  void VisitTypeAliasTemplateDecl(const TypeAliasTemplateDecl *D);
461  void VisitCXXRecordDecl(const CXXRecordDecl *D);
462  void VisitStaticAssertDecl(const StaticAssertDecl *D);
463  template<typename SpecializationDecl>
464  void VisitTemplateDeclSpecialization(const SpecializationDecl *D,
465  bool DumpExplicitInst,
466  bool DumpRefOnly);
467  template<typename TemplateDecl>
468  void VisitTemplateDecl(const TemplateDecl *D, bool DumpExplicitInst);
469  void VisitFunctionTemplateDecl(const FunctionTemplateDecl *D);
470  void VisitClassTemplateDecl(const ClassTemplateDecl *D);
471  void VisitClassTemplateSpecializationDecl(
473  void VisitClassTemplatePartialSpecializationDecl(
475  void VisitClassScopeFunctionSpecializationDecl(
477  void VisitBuiltinTemplateDecl(const BuiltinTemplateDecl *D);
478  void VisitVarTemplateDecl(const VarTemplateDecl *D);
479  void VisitVarTemplateSpecializationDecl(
481  void VisitVarTemplatePartialSpecializationDecl(
483  void VisitTemplateTypeParmDecl(const TemplateTypeParmDecl *D);
484  void VisitNonTypeTemplateParmDecl(const NonTypeTemplateParmDecl *D);
485  void VisitTemplateTemplateParmDecl(const TemplateTemplateParmDecl *D);
486  void VisitUsingDecl(const UsingDecl *D);
487  void VisitUnresolvedUsingTypenameDecl(const UnresolvedUsingTypenameDecl *D);
488  void VisitUnresolvedUsingValueDecl(const UnresolvedUsingValueDecl *D);
489  void VisitUsingShadowDecl(const UsingShadowDecl *D);
490  void VisitConstructorUsingShadowDecl(const ConstructorUsingShadowDecl *D);
491  void VisitLinkageSpecDecl(const LinkageSpecDecl *D);
492  void VisitAccessSpecDecl(const AccessSpecDecl *D);
493  void VisitFriendDecl(const FriendDecl *D);
494 
495  // ObjC Decls
496  void VisitObjCIvarDecl(const ObjCIvarDecl *D);
497  void VisitObjCMethodDecl(const ObjCMethodDecl *D);
498  void VisitObjCTypeParamDecl(const ObjCTypeParamDecl *D);
499  void VisitObjCCategoryDecl(const ObjCCategoryDecl *D);
500  void VisitObjCCategoryImplDecl(const ObjCCategoryImplDecl *D);
501  void VisitObjCProtocolDecl(const ObjCProtocolDecl *D);
502  void VisitObjCInterfaceDecl(const ObjCInterfaceDecl *D);
503  void VisitObjCImplementationDecl(const ObjCImplementationDecl *D);
504  void VisitObjCCompatibleAliasDecl(const ObjCCompatibleAliasDecl *D);
505  void VisitObjCPropertyDecl(const ObjCPropertyDecl *D);
506  void VisitObjCPropertyImplDecl(const ObjCPropertyImplDecl *D);
507  void VisitBlockDecl(const BlockDecl *D);
508 
509  // Stmts.
510  void VisitStmt(const Stmt *Node);
511  void VisitDeclStmt(const DeclStmt *Node);
512  void VisitAttributedStmt(const AttributedStmt *Node);
513  void VisitLabelStmt(const LabelStmt *Node);
514  void VisitGotoStmt(const GotoStmt *Node);
515  void VisitCXXCatchStmt(const CXXCatchStmt *Node);
516  void VisitCapturedStmt(const CapturedStmt *Node);
517 
518  // OpenMP
519  void VisitOMPExecutableDirective(const OMPExecutableDirective *Node);
520 
521  // Exprs
522  void VisitExpr(const Expr *Node);
523  void VisitCastExpr(const CastExpr *Node);
524  void VisitImplicitCastExpr(const ImplicitCastExpr *Node);
525  void VisitDeclRefExpr(const DeclRefExpr *Node);
526  void VisitPredefinedExpr(const PredefinedExpr *Node);
527  void VisitCharacterLiteral(const CharacterLiteral *Node);
528  void VisitIntegerLiteral(const IntegerLiteral *Node);
529  void VisitFixedPointLiteral(const FixedPointLiteral *Node);
530  void VisitFloatingLiteral(const FloatingLiteral *Node);
531  void VisitStringLiteral(const StringLiteral *Str);
532  void VisitInitListExpr(const InitListExpr *ILE);
533  void VisitArrayInitLoopExpr(const ArrayInitLoopExpr *ILE);
534  void VisitArrayInitIndexExpr(const ArrayInitIndexExpr *ILE);
535  void VisitUnaryOperator(const UnaryOperator *Node);
536  void VisitUnaryExprOrTypeTraitExpr(const UnaryExprOrTypeTraitExpr *Node);
537  void VisitMemberExpr(const MemberExpr *Node);
538  void VisitExtVectorElementExpr(const ExtVectorElementExpr *Node);
539  void VisitBinaryOperator(const BinaryOperator *Node);
540  void VisitCompoundAssignOperator(const CompoundAssignOperator *Node);
541  void VisitAddrLabelExpr(const AddrLabelExpr *Node);
542  void VisitBlockExpr(const BlockExpr *Node);
543  void VisitOpaqueValueExpr(const OpaqueValueExpr *Node);
544  void VisitGenericSelectionExpr(const GenericSelectionExpr *E);
545 
546  // C++
547  void VisitCXXNamedCastExpr(const CXXNamedCastExpr *Node);
548  void VisitCXXBoolLiteralExpr(const CXXBoolLiteralExpr *Node);
549  void VisitCXXThisExpr(const CXXThisExpr *Node);
550  void VisitCXXFunctionalCastExpr(const CXXFunctionalCastExpr *Node);
551  void VisitCXXUnresolvedConstructExpr(const CXXUnresolvedConstructExpr *Node);
552  void VisitCXXConstructExpr(const CXXConstructExpr *Node);
553  void VisitCXXBindTemporaryExpr(const CXXBindTemporaryExpr *Node);
554  void VisitCXXNewExpr(const CXXNewExpr *Node);
555  void VisitCXXDeleteExpr(const CXXDeleteExpr *Node);
556  void VisitMaterializeTemporaryExpr(const MaterializeTemporaryExpr *Node);
557  void VisitExprWithCleanups(const ExprWithCleanups *Node);
558  void VisitUnresolvedLookupExpr(const UnresolvedLookupExpr *Node);
559  void dumpCXXTemporary(const CXXTemporary *Temporary);
560  void VisitLambdaExpr(const LambdaExpr *Node) {
561  VisitExpr(Node);
562  dumpDecl(Node->getLambdaClass());
563  }
564  void VisitSizeOfPackExpr(const SizeOfPackExpr *Node);
565  void
566  VisitCXXDependentScopeMemberExpr(const CXXDependentScopeMemberExpr *Node);
567 
568  // ObjC
569  void VisitObjCAtCatchStmt(const ObjCAtCatchStmt *Node);
570  void VisitObjCEncodeExpr(const ObjCEncodeExpr *Node);
571  void VisitObjCMessageExpr(const ObjCMessageExpr *Node);
572  void VisitObjCBoxedExpr(const ObjCBoxedExpr *Node);
573  void VisitObjCSelectorExpr(const ObjCSelectorExpr *Node);
574  void VisitObjCProtocolExpr(const ObjCProtocolExpr *Node);
575  void VisitObjCPropertyRefExpr(const ObjCPropertyRefExpr *Node);
576  void VisitObjCSubscriptRefExpr(const ObjCSubscriptRefExpr *Node);
577  void VisitObjCIvarRefExpr(const ObjCIvarRefExpr *Node);
578  void VisitObjCBoolLiteralExpr(const ObjCBoolLiteralExpr *Node);
579 
580  // Comments.
581  const char *getCommandName(unsigned CommandID);
582  void dumpComment(const Comment *C);
583 
584  // Inline comments.
585  void visitTextComment(const TextComment *C);
586  void visitInlineCommandComment(const InlineCommandComment *C);
587  void visitHTMLStartTagComment(const HTMLStartTagComment *C);
588  void visitHTMLEndTagComment(const HTMLEndTagComment *C);
589 
590  // Block comments.
591  void visitBlockCommandComment(const BlockCommandComment *C);
592  void visitParamCommandComment(const ParamCommandComment *C);
593  void visitTParamCommandComment(const TParamCommandComment *C);
594  void visitVerbatimBlockComment(const VerbatimBlockComment *C);
595  void visitVerbatimBlockLineComment(const VerbatimBlockLineComment *C);
596  void visitVerbatimLineComment(const VerbatimLineComment *C);
597  };
598 }
599 
600 //===----------------------------------------------------------------------===//
601 // Utilities
602 //===----------------------------------------------------------------------===//
603 
604 void ASTDumper::dumpPointer(const void *Ptr) {
605  ColorScope Color(*this, AddressColor);
606  OS << ' ' << Ptr;
607 }
608 
609 void ASTDumper::dumpLocation(SourceLocation Loc) {
610  if (!SM)
611  return;
612 
613  ColorScope Color(*this, LocationColor);
614  SourceLocation SpellingLoc = SM->getSpellingLoc(Loc);
615 
616  // The general format we print out is filename:line:col, but we drop pieces
617  // that haven't changed since the last loc printed.
618  PresumedLoc PLoc = SM->getPresumedLoc(SpellingLoc);
619 
620  if (PLoc.isInvalid()) {
621  OS << "<invalid sloc>";
622  return;
623  }
624 
625  if (strcmp(PLoc.getFilename(), LastLocFilename) != 0) {
626  OS << PLoc.getFilename() << ':' << PLoc.getLine()
627  << ':' << PLoc.getColumn();
628  LastLocFilename = PLoc.getFilename();
629  LastLocLine = PLoc.getLine();
630  } else if (PLoc.getLine() != LastLocLine) {
631  OS << "line" << ':' << PLoc.getLine()
632  << ':' << PLoc.getColumn();
633  LastLocLine = PLoc.getLine();
634  } else {
635  OS << "col" << ':' << PLoc.getColumn();
636  }
637 }
638 
639 void ASTDumper::dumpSourceRange(SourceRange R) {
640  // Can't translate locations if a SourceManager isn't available.
641  if (!SM)
642  return;
643 
644  OS << " <";
645  dumpLocation(R.getBegin());
646  if (R.getBegin() != R.getEnd()) {
647  OS << ", ";
648  dumpLocation(R.getEnd());
649  }
650  OS << ">";
651 
652  // <t2.c:123:421[blah], t2.c:412:321>
653 
654 }
655 
656 void ASTDumper::dumpBareType(QualType T, bool Desugar) {
657  ColorScope Color(*this, TypeColor);
658 
659  SplitQualType T_split = T.split();
660  OS << "'" << QualType::getAsString(T_split, PrintPolicy) << "'";
661 
662  if (Desugar && !T.isNull()) {
663  // If the type is sugared, also dump a (shallow) desugared type.
664  SplitQualType D_split = T.getSplitDesugaredType();
665  if (T_split != D_split)
666  OS << ":'" << QualType::getAsString(D_split, PrintPolicy) << "'";
667  }
668 }
669 
670 void ASTDumper::dumpType(QualType T) {
671  OS << ' ';
672  dumpBareType(T);
673 }
674 
675 void ASTDumper::dumpTypeAsChild(QualType T) {
676  SplitQualType SQT = T.split();
677  if (!SQT.Quals.hasQualifiers())
678  return dumpTypeAsChild(SQT.Ty);
679 
680  dumpChild([=] {
681  OS << "QualType";
682  dumpPointer(T.getAsOpaquePtr());
683  OS << " ";
684  dumpBareType(T, false);
685  OS << " " << T.split().Quals.getAsString();
686  dumpTypeAsChild(T.split().Ty);
687  });
688 }
689 
690 void ASTDumper::dumpTypeAsChild(const Type *T) {
691  dumpChild([=] {
692  if (!T) {
693  ColorScope Color(*this, NullColor);
694  OS << "<<<NULL>>>";
695  return;
696  }
697  if (const LocInfoType *LIT = llvm::dyn_cast<LocInfoType>(T)) {
698  {
699  ColorScope Color(*this, TypeColor);
700  OS << "LocInfo Type";
701  }
702  dumpPointer(T);
703  dumpTypeAsChild(LIT->getTypeSourceInfo()->getType());
704  return;
705  }
706 
707  {
708  ColorScope Color(*this, TypeColor);
709  OS << T->getTypeClassName() << "Type";
710  }
711  dumpPointer(T);
712  OS << " ";
713  dumpBareType(QualType(T, 0), false);
714 
715  QualType SingleStepDesugar =
717  if (SingleStepDesugar != QualType(T, 0))
718  OS << " sugar";
719  if (T->isDependentType())
720  OS << " dependent";
721  else if (T->isInstantiationDependentType())
722  OS << " instantiation_dependent";
723  if (T->isVariablyModifiedType())
724  OS << " variably_modified";
726  OS << " contains_unexpanded_pack";
727  if (T->isFromAST())
728  OS << " imported";
729 
731 
732  if (SingleStepDesugar != QualType(T, 0))
733  dumpTypeAsChild(SingleStepDesugar);
734  });
735 }
736 
737 void ASTDumper::dumpBareDeclRef(const Decl *D) {
738  if (!D) {
739  ColorScope Color(*this, NullColor);
740  OS << "<<<NULL>>>";
741  return;
742  }
743 
744  {
745  ColorScope Color(*this, DeclKindNameColor);
746  OS << D->getDeclKindName();
747  }
748  dumpPointer(D);
749 
750  if (const NamedDecl *ND = dyn_cast<NamedDecl>(D)) {
751  ColorScope Color(*this, DeclNameColor);
752  OS << " '" << ND->getDeclName() << '\'';
753  }
754 
755  if (const ValueDecl *VD = dyn_cast<ValueDecl>(D))
756  dumpType(VD->getType());
757 }
758 
759 void ASTDumper::dumpDeclRef(const Decl *D, const char *Label) {
760  if (!D)
761  return;
762 
763  dumpChild([=]{
764  if (Label)
765  OS << Label << ' ';
766  dumpBareDeclRef(D);
767  });
768 }
769 
770 void ASTDumper::dumpName(const NamedDecl *ND) {
771  if (ND->getDeclName()) {
772  ColorScope Color(*this, DeclNameColor);
773  OS << ' ' << ND->getNameAsString();
774  }
775 }
776 
777 bool ASTDumper::hasNodes(const DeclContext *DC) {
778  if (!DC)
779  return false;
780 
781  return DC->hasExternalLexicalStorage() ||
782  (Deserialize ? DC->decls_begin() != DC->decls_end()
783  : DC->noload_decls_begin() != DC->noload_decls_end());
784 }
785 
786 void ASTDumper::dumpDeclContext(const DeclContext *DC) {
787  if (!DC)
788  return;
789 
790  for (auto *D : (Deserialize ? DC->decls() : DC->noload_decls()))
791  dumpDecl(D);
792 
793  if (DC->hasExternalLexicalStorage()) {
794  dumpChild([=]{
795  ColorScope Color(*this, UndeserializedColor);
796  OS << "<undeserialized declarations>";
797  });
798  }
799 }
800 
801 void ASTDumper::dumpLookups(const DeclContext *DC, bool DumpDecls) {
802  dumpChild([=] {
803  OS << "StoredDeclsMap ";
804  dumpBareDeclRef(cast<Decl>(DC));
805 
806  const DeclContext *Primary = DC->getPrimaryContext();
807  if (Primary != DC) {
808  OS << " primary";
809  dumpPointer(cast<Decl>(Primary));
810  }
811 
812  bool HasUndeserializedLookups = Primary->hasExternalVisibleStorage();
813 
814  auto Range = Deserialize
815  ? Primary->lookups()
816  : Primary->noload_lookups(/*PreserveInternalState=*/true);
817  for (auto I = Range.begin(), E = Range.end(); I != E; ++I) {
818  DeclarationName Name = I.getLookupName();
820 
821  dumpChild([=] {
822  OS << "DeclarationName ";
823  {
824  ColorScope Color(*this, DeclNameColor);
825  OS << '\'' << Name << '\'';
826  }
827 
828  for (DeclContextLookupResult::iterator RI = R.begin(), RE = R.end();
829  RI != RE; ++RI) {
830  dumpChild([=] {
831  dumpBareDeclRef(*RI);
832 
833  if ((*RI)->isHidden())
834  OS << " hidden";
835 
836  // If requested, dump the redecl chain for this lookup.
837  if (DumpDecls) {
838  // Dump earliest decl first.
839  std::function<void(Decl *)> DumpWithPrev = [&](Decl *D) {
840  if (Decl *Prev = D->getPreviousDecl())
841  DumpWithPrev(Prev);
842  dumpDecl(D);
843  };
844  DumpWithPrev(*RI);
845  }
846  });
847  }
848  });
849  }
850 
851  if (HasUndeserializedLookups) {
852  dumpChild([=] {
853  ColorScope Color(*this, UndeserializedColor);
854  OS << "<undeserialized lookups>";
855  });
856  }
857  });
858 }
859 
860 void ASTDumper::dumpAttr(const Attr *A) {
861  dumpChild([=] {
862  {
863  ColorScope Color(*this, AttrColor);
864 
865  switch (A->getKind()) {
866 #define ATTR(X) case attr::X: OS << #X; break;
867 #include "clang/Basic/AttrList.inc"
868  }
869  OS << "Attr";
870  }
871  dumpPointer(A);
872  dumpSourceRange(A->getRange());
873  if (A->isInherited())
874  OS << " Inherited";
875  if (A->isImplicit())
876  OS << " Implicit";
877 #include "clang/AST/AttrDump.inc"
878  });
879 }
880 
881 static void dumpPreviousDeclImpl(raw_ostream &OS, ...) {}
882 
883 template<typename T>
884 static void dumpPreviousDeclImpl(raw_ostream &OS, const Mergeable<T> *D) {
885  const T *First = D->getFirstDecl();
886  if (First != D)
887  OS << " first " << First;
888 }
889 
890 template<typename T>
891 static void dumpPreviousDeclImpl(raw_ostream &OS, const Redeclarable<T> *D) {
892  const T *Prev = D->getPreviousDecl();
893  if (Prev)
894  OS << " prev " << Prev;
895 }
896 
897 /// Dump the previous declaration in the redeclaration chain for a declaration,
898 /// if any.
899 static void dumpPreviousDecl(raw_ostream &OS, const Decl *D) {
900  switch (D->getKind()) {
901 #define DECL(DERIVED, BASE) \
902  case Decl::DERIVED: \
903  return dumpPreviousDeclImpl(OS, cast<DERIVED##Decl>(D));
904 #define ABSTRACT_DECL(DECL)
905 #include "clang/AST/DeclNodes.inc"
906  }
907  llvm_unreachable("Decl that isn't part of DeclNodes.inc!");
908 }
909 
910 //===----------------------------------------------------------------------===//
911 // C++ Utilities
912 //===----------------------------------------------------------------------===//
913 
914 void ASTDumper::dumpAccessSpecifier(AccessSpecifier AS) {
915  switch (AS) {
916  case AS_none:
917  break;
918  case AS_public:
919  OS << "public";
920  break;
921  case AS_protected:
922  OS << "protected";
923  break;
924  case AS_private:
925  OS << "private";
926  break;
927  }
928 }
929 
930 void ASTDumper::dumpCXXCtorInitializer(const CXXCtorInitializer *Init) {
931  dumpChild([=] {
932  OS << "CXXCtorInitializer";
933  if (Init->isAnyMemberInitializer()) {
934  OS << ' ';
935  dumpBareDeclRef(Init->getAnyMember());
936  } else if (Init->isBaseInitializer()) {
937  dumpType(QualType(Init->getBaseClass(), 0));
938  } else if (Init->isDelegatingInitializer()) {
939  dumpType(Init->getTypeSourceInfo()->getType());
940  } else {
941  llvm_unreachable("Unknown initializer type");
942  }
943  dumpStmt(Init->getInit());
944  });
945 }
946 
947 void ASTDumper::dumpTemplateParameters(const TemplateParameterList *TPL) {
948  if (!TPL)
949  return;
950 
951  for (TemplateParameterList::const_iterator I = TPL->begin(), E = TPL->end();
952  I != E; ++I)
953  dumpDecl(*I);
954 }
955 
956 void ASTDumper::dumpTemplateArgumentListInfo(
957  const TemplateArgumentListInfo &TALI) {
958  for (unsigned i = 0, e = TALI.size(); i < e; ++i)
959  dumpTemplateArgumentLoc(TALI[i]);
960 }
961 
962 void ASTDumper::dumpTemplateArgumentLoc(const TemplateArgumentLoc &A) {
963  dumpTemplateArgument(A.getArgument(), A.getSourceRange());
964 }
965 
966 void ASTDumper::dumpTemplateArgumentList(const TemplateArgumentList &TAL) {
967  for (unsigned i = 0, e = TAL.size(); i < e; ++i)
968  dumpTemplateArgument(TAL[i]);
969 }
970 
971 void ASTDumper::dumpTemplateArgument(const TemplateArgument &A, SourceRange R) {
972  dumpChild([=] {
973  OS << "TemplateArgument";
974  if (R.isValid())
975  dumpSourceRange(R);
976 
977  switch (A.getKind()) {
979  OS << " null";
980  break;
982  OS << " type";
983  dumpType(A.getAsType());
984  break;
986  OS << " decl";
987  dumpDeclRef(A.getAsDecl());
988  break;
990  OS << " nullptr";
991  break;
993  OS << " integral " << A.getAsIntegral();
994  break;
996  OS << " template ";
997  A.getAsTemplate().dump(OS);
998  break;
1000  OS << " template expansion ";
1002  break;
1004  OS << " expr";
1005  dumpStmt(A.getAsExpr());
1006  break;
1008  OS << " pack";
1009  for (TemplateArgument::pack_iterator I = A.pack_begin(), E = A.pack_end();
1010  I != E; ++I)
1011  dumpTemplateArgument(*I);
1012  break;
1013  }
1014  });
1015 }
1016 
1017 //===----------------------------------------------------------------------===//
1018 // Objective-C Utilities
1019 //===----------------------------------------------------------------------===//
1020 void ASTDumper::dumpObjCTypeParamList(const ObjCTypeParamList *typeParams) {
1021  if (!typeParams)
1022  return;
1023 
1024  for (auto typeParam : *typeParams) {
1025  dumpDecl(typeParam);
1026  }
1027 }
1028 
1029 //===----------------------------------------------------------------------===//
1030 // Decl dumping methods.
1031 //===----------------------------------------------------------------------===//
1032 
1033 void ASTDumper::dumpDecl(const Decl *D) {
1034  dumpChild([=] {
1035  if (!D) {
1036  ColorScope Color(*this, NullColor);
1037  OS << "<<<NULL>>>";
1038  return;
1039  }
1040 
1041  {
1042  ColorScope Color(*this, DeclKindNameColor);
1043  OS << D->getDeclKindName() << "Decl";
1044  }
1045  dumpPointer(D);
1046  if (D->getLexicalDeclContext() != D->getDeclContext())
1047  OS << " parent " << cast<Decl>(D->getDeclContext());
1048  dumpPreviousDecl(OS, D);
1049  dumpSourceRange(D->getSourceRange());
1050  OS << ' ';
1051  dumpLocation(D->getLocation());
1052  if (D->isFromASTFile())
1053  OS << " imported";
1054  if (Module *M = D->getOwningModule())
1055  OS << " in " << M->getFullModuleName();
1056  if (auto *ND = dyn_cast<NamedDecl>(D))
1058  const_cast<NamedDecl *>(ND)))
1059  dumpChild([=] { OS << "also in " << M->getFullModuleName(); });
1060  if (const NamedDecl *ND = dyn_cast<NamedDecl>(D))
1061  if (ND->isHidden())
1062  OS << " hidden";
1063  if (D->isImplicit())
1064  OS << " implicit";
1065  if (D->isUsed())
1066  OS << " used";
1067  else if (D->isThisDeclarationReferenced())
1068  OS << " referenced";
1069  if (D->isInvalidDecl())
1070  OS << " invalid";
1071  if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(D))
1072  if (FD->isConstexpr())
1073  OS << " constexpr";
1074 
1075 
1077 
1078  for (Decl::attr_iterator I = D->attr_begin(), E = D->attr_end(); I != E;
1079  ++I)
1080  dumpAttr(*I);
1081 
1082  if (const FullComment *Comment =
1084  dumpFullComment(Comment);
1085 
1086  // Decls within functions are visited by the body.
1087  if (!isa<FunctionDecl>(*D) && !isa<ObjCMethodDecl>(*D) &&
1088  hasNodes(dyn_cast<DeclContext>(D)))
1089  dumpDeclContext(cast<DeclContext>(D));
1090  });
1091 }
1092 
1093 void ASTDumper::VisitLabelDecl(const LabelDecl *D) {
1094  dumpName(D);
1095 }
1096 
1097 void ASTDumper::VisitTypedefDecl(const TypedefDecl *D) {
1098  dumpName(D);
1099  dumpType(D->getUnderlyingType());
1100  if (D->isModulePrivate())
1101  OS << " __module_private__";
1102  dumpTypeAsChild(D->getUnderlyingType());
1103 }
1104 
1105 void ASTDumper::VisitEnumDecl(const EnumDecl *D) {
1106  if (D->isScoped()) {
1107  if (D->isScopedUsingClassTag())
1108  OS << " class";
1109  else
1110  OS << " struct";
1111  }
1112  dumpName(D);
1113  if (D->isModulePrivate())
1114  OS << " __module_private__";
1115  if (D->isFixed())
1116  dumpType(D->getIntegerType());
1117 }
1118 
1119 void ASTDumper::VisitRecordDecl(const RecordDecl *D) {
1120  OS << ' ' << D->getKindName();
1121  dumpName(D);
1122  if (D->isModulePrivate())
1123  OS << " __module_private__";
1124  if (D->isCompleteDefinition())
1125  OS << " definition";
1126 }
1127 
1128 void ASTDumper::VisitEnumConstantDecl(const EnumConstantDecl *D) {
1129  dumpName(D);
1130  dumpType(D->getType());
1131  if (const Expr *Init = D->getInitExpr())
1132  dumpStmt(Init);
1133 }
1134 
1135 void ASTDumper::VisitIndirectFieldDecl(const IndirectFieldDecl *D) {
1136  dumpName(D);
1137  dumpType(D->getType());
1138 
1139  for (auto *Child : D->chain())
1140  dumpDeclRef(Child);
1141 }
1142 
1143 void ASTDumper::VisitFunctionDecl(const FunctionDecl *D) {
1144  dumpName(D);
1145  dumpType(D->getType());
1146 
1147  StorageClass SC = D->getStorageClass();
1148  if (SC != SC_None)
1149  OS << ' ' << VarDecl::getStorageClassSpecifierString(SC);
1150  if (D->isInlineSpecified())
1151  OS << " inline";
1152  if (D->isVirtualAsWritten())
1153  OS << " virtual";
1154  if (D->isModulePrivate())
1155  OS << " __module_private__";
1156 
1157  if (D->isPure())
1158  OS << " pure";
1159  if (D->isDefaulted()) {
1160  OS << " default";
1161  if (D->isDeleted())
1162  OS << "_delete";
1163  }
1164  if (D->isDeletedAsWritten())
1165  OS << " delete";
1166  if (D->isTrivial())
1167  OS << " trivial";
1168 
1169  if (const FunctionProtoType *FPT = D->getType()->getAs<FunctionProtoType>()) {
1170  FunctionProtoType::ExtProtoInfo EPI = FPT->getExtProtoInfo();
1171  switch (EPI.ExceptionSpec.Type) {
1172  default: break;
1173  case EST_Unevaluated:
1174  OS << " noexcept-unevaluated " << EPI.ExceptionSpec.SourceDecl;
1175  break;
1176  case EST_Uninstantiated:
1177  OS << " noexcept-uninstantiated " << EPI.ExceptionSpec.SourceTemplate;
1178  break;
1179  }
1180  }
1181 
1182  if (const FunctionTemplateSpecializationInfo *FTSI =
1184  dumpTemplateArgumentList(*FTSI->TemplateArguments);
1185 
1186  if (!D->param_begin() && D->getNumParams())
1187  dumpChild([=] { OS << "<<NULL params x " << D->getNumParams() << ">>"; });
1188  else
1189  for (const ParmVarDecl *Parameter : D->parameters())
1190  dumpDecl(Parameter);
1191 
1192  if (const CXXConstructorDecl *C = dyn_cast<CXXConstructorDecl>(D))
1193  for (CXXConstructorDecl::init_const_iterator I = C->init_begin(),
1194  E = C->init_end();
1195  I != E; ++I)
1196  dumpCXXCtorInitializer(*I);
1197 
1198  if (const CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(D)) {
1199  if (MD->size_overridden_methods() != 0) {
1200  auto dumpOverride = [=](const CXXMethodDecl *D) {
1201  SplitQualType T_split = D->getType().split();
1202  OS << D << " " << D->getParent()->getName()
1203  << "::" << D->getNameAsString() << " '"
1204  << QualType::getAsString(T_split, PrintPolicy) << "'";
1205  };
1206 
1207  dumpChild([=] {
1208  auto Overrides = MD->overridden_methods();
1209  OS << "Overrides: [ ";
1210  dumpOverride(*Overrides.begin());
1211  for (const auto *Override :
1212  llvm::make_range(Overrides.begin() + 1, Overrides.end())) {
1213  OS << ", ";
1214  dumpOverride(Override);
1215  }
1216  OS << " ]";
1217  });
1218  }
1219  }
1220 
1222  dumpStmt(D->getBody());
1223 }
1224 
1225 void ASTDumper::VisitFieldDecl(const FieldDecl *D) {
1226  dumpName(D);
1227  dumpType(D->getType());
1228  if (D->isMutable())
1229  OS << " mutable";
1230  if (D->isModulePrivate())
1231  OS << " __module_private__";
1232 
1233  if (D->isBitField())
1234  dumpStmt(D->getBitWidth());
1235  if (Expr *Init = D->getInClassInitializer())
1236  dumpStmt(Init);
1237 }
1238 
1239 void ASTDumper::VisitVarDecl(const VarDecl *D) {
1240  dumpName(D);
1241  dumpType(D->getType());
1242  StorageClass SC = D->getStorageClass();
1243  if (SC != SC_None)
1244  OS << ' ' << VarDecl::getStorageClassSpecifierString(SC);
1245  switch (D->getTLSKind()) {
1246  case VarDecl::TLS_None: break;
1247  case VarDecl::TLS_Static: OS << " tls"; break;
1248  case VarDecl::TLS_Dynamic: OS << " tls_dynamic"; break;
1249  }
1250  if (D->isModulePrivate())
1251  OS << " __module_private__";
1252  if (D->isNRVOVariable())
1253  OS << " nrvo";
1254  if (D->isInline())
1255  OS << " inline";
1256  if (D->isConstexpr())
1257  OS << " constexpr";
1258  if (D->hasInit()) {
1259  switch (D->getInitStyle()) {
1260  case VarDecl::CInit: OS << " cinit"; break;
1261  case VarDecl::CallInit: OS << " callinit"; break;
1262  case VarDecl::ListInit: OS << " listinit"; break;
1263  }
1264  dumpStmt(D->getInit());
1265  }
1266 }
1267 
1268 void ASTDumper::VisitDecompositionDecl(const DecompositionDecl *D) {
1269  VisitVarDecl(D);
1270  for (auto *B : D->bindings())
1271  dumpDecl(B);
1272 }
1273 
1274 void ASTDumper::VisitBindingDecl(const BindingDecl *D) {
1275  dumpName(D);
1276  dumpType(D->getType());
1277  if (auto *E = D->getBinding())
1278  dumpStmt(E);
1279 }
1280 
1281 void ASTDumper::VisitFileScopeAsmDecl(const FileScopeAsmDecl *D) {
1282  dumpStmt(D->getAsmString());
1283 }
1284 
1285 void ASTDumper::VisitImportDecl(const ImportDecl *D) {
1286  OS << ' ' << D->getImportedModule()->getFullModuleName();
1287 }
1288 
1289 void ASTDumper::VisitPragmaCommentDecl(const PragmaCommentDecl *D) {
1290  OS << ' ';
1291  switch (D->getCommentKind()) {
1292  case PCK_Unknown: llvm_unreachable("unexpected pragma comment kind");
1293  case PCK_Compiler: OS << "compiler"; break;
1294  case PCK_ExeStr: OS << "exestr"; break;
1295  case PCK_Lib: OS << "lib"; break;
1296  case PCK_Linker: OS << "linker"; break;
1297  case PCK_User: OS << "user"; break;
1298  }
1299  StringRef Arg = D->getArg();
1300  if (!Arg.empty())
1301  OS << " \"" << Arg << "\"";
1302 }
1303 
1304 void ASTDumper::VisitPragmaDetectMismatchDecl(
1305  const PragmaDetectMismatchDecl *D) {
1306  OS << " \"" << D->getName() << "\" \"" << D->getValue() << "\"";
1307 }
1308 
1309 void ASTDumper::VisitCapturedDecl(const CapturedDecl *D) {
1310  dumpStmt(D->getBody());
1311 }
1312 
1313 //===----------------------------------------------------------------------===//
1314 // OpenMP Declarations
1315 //===----------------------------------------------------------------------===//
1316 
1317 void ASTDumper::VisitOMPThreadPrivateDecl(const OMPThreadPrivateDecl *D) {
1318  for (auto *E : D->varlists())
1319  dumpStmt(E);
1320 }
1321 
1322 void ASTDumper::VisitOMPDeclareReductionDecl(const OMPDeclareReductionDecl *D) {
1323  dumpName(D);
1324  dumpType(D->getType());
1325  OS << " combiner";
1326  dumpStmt(D->getCombiner());
1327  if (auto *Initializer = D->getInitializer()) {
1328  OS << " initializer";
1329  switch (D->getInitializerKind()) {
1331  OS << " omp_priv = ";
1332  break;
1334  OS << " omp_priv ()";
1335  break;
1337  break;
1338  }
1339  dumpStmt(Initializer);
1340  }
1341 }
1342 
1343 void ASTDumper::VisitOMPCapturedExprDecl(const OMPCapturedExprDecl *D) {
1344  dumpName(D);
1345  dumpType(D->getType());
1346  dumpStmt(D->getInit());
1347 }
1348 
1349 //===----------------------------------------------------------------------===//
1350 // C++ Declarations
1351 //===----------------------------------------------------------------------===//
1352 
1353 void ASTDumper::VisitNamespaceDecl(const NamespaceDecl *D) {
1354  dumpName(D);
1355  if (D->isInline())
1356  OS << " inline";
1357  if (!D->isOriginalNamespace())
1358  dumpDeclRef(D->getOriginalNamespace(), "original");
1359 }
1360 
1361 void ASTDumper::VisitUsingDirectiveDecl(const UsingDirectiveDecl *D) {
1362  OS << ' ';
1363  dumpBareDeclRef(D->getNominatedNamespace());
1364 }
1365 
1366 void ASTDumper::VisitNamespaceAliasDecl(const NamespaceAliasDecl *D) {
1367  dumpName(D);
1368  dumpDeclRef(D->getAliasedNamespace());
1369 }
1370 
1371 void ASTDumper::VisitTypeAliasDecl(const TypeAliasDecl *D) {
1372  dumpName(D);
1373  dumpType(D->getUnderlyingType());
1374  dumpTypeAsChild(D->getUnderlyingType());
1375 }
1376 
1377 void ASTDumper::VisitTypeAliasTemplateDecl(const TypeAliasTemplateDecl *D) {
1378  dumpName(D);
1379  dumpTemplateParameters(D->getTemplateParameters());
1380  dumpDecl(D->getTemplatedDecl());
1381 }
1382 
1383 void ASTDumper::VisitCXXRecordDecl(const CXXRecordDecl *D) {
1384  VisitRecordDecl(D);
1385  if (!D->isCompleteDefinition())
1386  return;
1387 
1388  dumpChild([=] {
1389  {
1390  ColorScope Color(*this, DeclKindNameColor);
1391  OS << "DefinitionData";
1392  }
1393 #define FLAG(fn, name) if (D->fn()) OS << " " #name;
1394  FLAG(isParsingBaseSpecifiers, parsing_base_specifiers);
1395 
1396  FLAG(isGenericLambda, generic);
1397  FLAG(isLambda, lambda);
1398 
1399  FLAG(canPassInRegisters, pass_in_registers);
1400  FLAG(isEmpty, empty);
1401  FLAG(isAggregate, aggregate);
1402  FLAG(isStandardLayout, standard_layout);
1403  FLAG(isTriviallyCopyable, trivially_copyable);
1404  FLAG(isPOD, pod);
1405  FLAG(isTrivial, trivial);
1406  FLAG(isPolymorphic, polymorphic);
1407  FLAG(isAbstract, abstract);
1408  FLAG(isLiteral, literal);
1409 
1410  FLAG(hasUserDeclaredConstructor, has_user_declared_ctor);
1411  FLAG(hasConstexprNonCopyMoveConstructor, has_constexpr_non_copy_move_ctor);
1412  FLAG(hasMutableFields, has_mutable_fields);
1413  FLAG(hasVariantMembers, has_variant_members);
1414  FLAG(allowConstDefaultInit, can_const_default_init);
1415 
1416  dumpChild([=] {
1417  {
1418  ColorScope Color(*this, DeclKindNameColor);
1419  OS << "DefaultConstructor";
1420  }
1421  FLAG(hasDefaultConstructor, exists);
1422  FLAG(hasTrivialDefaultConstructor, trivial);
1423  FLAG(hasNonTrivialDefaultConstructor, non_trivial);
1424  FLAG(hasUserProvidedDefaultConstructor, user_provided);
1425  FLAG(hasConstexprDefaultConstructor, constexpr);
1426  FLAG(needsImplicitDefaultConstructor, needs_implicit);
1427  FLAG(defaultedDefaultConstructorIsConstexpr, defaulted_is_constexpr);
1428  });
1429 
1430  dumpChild([=] {
1431  {
1432  ColorScope Color(*this, DeclKindNameColor);
1433  OS << "CopyConstructor";
1434  }
1435  FLAG(hasSimpleCopyConstructor, simple);
1436  FLAG(hasTrivialCopyConstructor, trivial);
1437  FLAG(hasNonTrivialCopyConstructor, non_trivial);
1438  FLAG(hasUserDeclaredCopyConstructor, user_declared);
1439  FLAG(hasCopyConstructorWithConstParam, has_const_param);
1440  FLAG(needsImplicitCopyConstructor, needs_implicit);
1441  FLAG(needsOverloadResolutionForCopyConstructor,
1442  needs_overload_resolution);
1444  FLAG(defaultedCopyConstructorIsDeleted, defaulted_is_deleted);
1445  FLAG(implicitCopyConstructorHasConstParam, implicit_has_const_param);
1446  });
1447 
1448  dumpChild([=] {
1449  {
1450  ColorScope Color(*this, DeclKindNameColor);
1451  OS << "MoveConstructor";
1452  }
1453  FLAG(hasMoveConstructor, exists);
1454  FLAG(hasSimpleMoveConstructor, simple);
1455  FLAG(hasTrivialMoveConstructor, trivial);
1456  FLAG(hasNonTrivialMoveConstructor, non_trivial);
1457  FLAG(hasUserDeclaredMoveConstructor, user_declared);
1458  FLAG(needsImplicitMoveConstructor, needs_implicit);
1459  FLAG(needsOverloadResolutionForMoveConstructor,
1460  needs_overload_resolution);
1462  FLAG(defaultedMoveConstructorIsDeleted, defaulted_is_deleted);
1463  });
1464 
1465  dumpChild([=] {
1466  {
1467  ColorScope Color(*this, DeclKindNameColor);
1468  OS << "CopyAssignment";
1469  }
1470  FLAG(hasTrivialCopyAssignment, trivial);
1471  FLAG(hasNonTrivialCopyAssignment, non_trivial);
1472  FLAG(hasCopyAssignmentWithConstParam, has_const_param);
1473  FLAG(hasUserDeclaredCopyAssignment, user_declared);
1474  FLAG(needsImplicitCopyAssignment, needs_implicit);
1475  FLAG(needsOverloadResolutionForCopyAssignment, needs_overload_resolution);
1476  FLAG(implicitCopyAssignmentHasConstParam, implicit_has_const_param);
1477  });
1478 
1479  dumpChild([=] {
1480  {
1481  ColorScope Color(*this, DeclKindNameColor);
1482  OS << "MoveAssignment";
1483  }
1484  FLAG(hasMoveAssignment, exists);
1485  FLAG(hasSimpleMoveAssignment, simple);
1486  FLAG(hasTrivialMoveAssignment, trivial);
1487  FLAG(hasNonTrivialMoveAssignment, non_trivial);
1488  FLAG(hasUserDeclaredMoveAssignment, user_declared);
1489  FLAG(needsImplicitMoveAssignment, needs_implicit);
1490  FLAG(needsOverloadResolutionForMoveAssignment, needs_overload_resolution);
1491  });
1492 
1493  dumpChild([=] {
1494  {
1495  ColorScope Color(*this, DeclKindNameColor);
1496  OS << "Destructor";
1497  }
1498  FLAG(hasSimpleDestructor, simple);
1499  FLAG(hasIrrelevantDestructor, irrelevant);
1500  FLAG(hasTrivialDestructor, trivial);
1501  FLAG(hasNonTrivialDestructor, non_trivial);
1502  FLAG(hasUserDeclaredDestructor, user_declared);
1503  FLAG(needsImplicitDestructor, needs_implicit);
1504  FLAG(needsOverloadResolutionForDestructor, needs_overload_resolution);
1506  FLAG(defaultedDestructorIsDeleted, defaulted_is_deleted);
1507  });
1508  });
1509 
1510  for (const auto &I : D->bases()) {
1511  dumpChild([=] {
1512  if (I.isVirtual())
1513  OS << "virtual ";
1514  dumpAccessSpecifier(I.getAccessSpecifier());
1515  dumpType(I.getType());
1516  if (I.isPackExpansion())
1517  OS << "...";
1518  });
1519  }
1520 }
1521 
1522 void ASTDumper::VisitStaticAssertDecl(const StaticAssertDecl *D) {
1523  dumpStmt(D->getAssertExpr());
1524  dumpStmt(D->getMessage());
1525 }
1526 
1527 template<typename SpecializationDecl>
1528 void ASTDumper::VisitTemplateDeclSpecialization(const SpecializationDecl *D,
1529  bool DumpExplicitInst,
1530  bool DumpRefOnly) {
1531  bool DumpedAny = false;
1532  for (auto *RedeclWithBadType : D->redecls()) {
1533  // FIXME: The redecls() range sometimes has elements of a less-specific
1534  // type. (In particular, ClassTemplateSpecializationDecl::redecls() gives
1535  // us TagDecls, and should give CXXRecordDecls).
1536  auto *Redecl = dyn_cast<SpecializationDecl>(RedeclWithBadType);
1537  if (!Redecl) {
1538  // Found the injected-class-name for a class template. This will be dumped
1539  // as part of its surrounding class so we don't need to dump it here.
1540  assert(isa<CXXRecordDecl>(RedeclWithBadType) &&
1541  "expected an injected-class-name");
1542  continue;
1543  }
1544 
1545  switch (Redecl->getTemplateSpecializationKind()) {
1548  if (!DumpExplicitInst)
1549  break;
1550  LLVM_FALLTHROUGH;
1551  case TSK_Undeclared:
1553  if (DumpRefOnly)
1554  dumpDeclRef(Redecl);
1555  else
1556  dumpDecl(Redecl);
1557  DumpedAny = true;
1558  break;
1560  break;
1561  }
1562  }
1563 
1564  // Ensure we dump at least one decl for each specialization.
1565  if (!DumpedAny)
1566  dumpDeclRef(D);
1567 }
1568 
1569 template<typename TemplateDecl>
1570 void ASTDumper::VisitTemplateDecl(const TemplateDecl *D,
1571  bool DumpExplicitInst) {
1572  dumpName(D);
1573  dumpTemplateParameters(D->getTemplateParameters());
1574 
1575  dumpDecl(D->getTemplatedDecl());
1576 
1577  for (auto *Child : D->specializations())
1578  VisitTemplateDeclSpecialization(Child, DumpExplicitInst,
1579  !D->isCanonicalDecl());
1580 }
1581 
1582 void ASTDumper::VisitFunctionTemplateDecl(const FunctionTemplateDecl *D) {
1583  // FIXME: We don't add a declaration of a function template specialization
1584  // to its context when it's explicitly instantiated, so dump explicit
1585  // instantiations when we dump the template itself.
1586  VisitTemplateDecl(D, true);
1587 }
1588 
1589 void ASTDumper::VisitClassTemplateDecl(const ClassTemplateDecl *D) {
1590  VisitTemplateDecl(D, false);
1591 }
1592 
1593 void ASTDumper::VisitClassTemplateSpecializationDecl(
1595  VisitCXXRecordDecl(D);
1596  dumpTemplateArgumentList(D->getTemplateArgs());
1597 }
1598 
1599 void ASTDumper::VisitClassTemplatePartialSpecializationDecl(
1601  VisitClassTemplateSpecializationDecl(D);
1602  dumpTemplateParameters(D->getTemplateParameters());
1603 }
1604 
1605 void ASTDumper::VisitClassScopeFunctionSpecializationDecl(
1607  dumpDecl(D->getSpecialization());
1608  if (D->hasExplicitTemplateArgs())
1609  dumpTemplateArgumentListInfo(D->templateArgs());
1610 }
1611 
1612 void ASTDumper::VisitVarTemplateDecl(const VarTemplateDecl *D) {
1613  VisitTemplateDecl(D, false);
1614 }
1615 
1616 void ASTDumper::VisitBuiltinTemplateDecl(const BuiltinTemplateDecl *D) {
1617  dumpName(D);
1618  dumpTemplateParameters(D->getTemplateParameters());
1619 }
1620 
1621 void ASTDumper::VisitVarTemplateSpecializationDecl(
1622  const VarTemplateSpecializationDecl *D) {
1623  dumpTemplateArgumentList(D->getTemplateArgs());
1624  VisitVarDecl(D);
1625 }
1626 
1627 void ASTDumper::VisitVarTemplatePartialSpecializationDecl(
1629  dumpTemplateParameters(D->getTemplateParameters());
1630  VisitVarTemplateSpecializationDecl(D);
1631 }
1632 
1633 void ASTDumper::VisitTemplateTypeParmDecl(const TemplateTypeParmDecl *D) {
1634  if (D->wasDeclaredWithTypename())
1635  OS << " typename";
1636  else
1637  OS << " class";
1638  OS << " depth " << D->getDepth() << " index " << D->getIndex();
1639  if (D->isParameterPack())
1640  OS << " ...";
1641  dumpName(D);
1642  if (D->hasDefaultArgument())
1643  dumpTemplateArgument(D->getDefaultArgument());
1644  if (auto *From = D->getDefaultArgStorage().getInheritedFrom())
1645  dumpDeclRef(From, D->defaultArgumentWasInherited() ? "inherited from"
1646  : "previous");
1647 }
1648 
1649 void ASTDumper::VisitNonTypeTemplateParmDecl(const NonTypeTemplateParmDecl *D) {
1650  dumpType(D->getType());
1651  OS << " depth " << D->getDepth() << " index " << D->getIndex();
1652  if (D->isParameterPack())
1653  OS << " ...";
1654  dumpName(D);
1655  if (D->hasDefaultArgument())
1656  dumpTemplateArgument(D->getDefaultArgument());
1657  if (auto *From = D->getDefaultArgStorage().getInheritedFrom())
1658  dumpDeclRef(From, D->defaultArgumentWasInherited() ? "inherited from"
1659  : "previous");
1660 }
1661 
1662 void ASTDumper::VisitTemplateTemplateParmDecl(
1663  const TemplateTemplateParmDecl *D) {
1664  OS << " depth " << D->getDepth() << " index " << D->getIndex();
1665  if (D->isParameterPack())
1666  OS << " ...";
1667  dumpName(D);
1668  dumpTemplateParameters(D->getTemplateParameters());
1669  if (D->hasDefaultArgument())
1670  dumpTemplateArgumentLoc(D->getDefaultArgument());
1671  if (auto *From = D->getDefaultArgStorage().getInheritedFrom())
1672  dumpDeclRef(From, D->defaultArgumentWasInherited() ? "inherited from"
1673  : "previous");
1674 }
1675 
1676 void ASTDumper::VisitUsingDecl(const UsingDecl *D) {
1677  OS << ' ';
1678  if (D->getQualifier())
1680  OS << D->getNameAsString();
1681 }
1682 
1683 void ASTDumper::VisitUnresolvedUsingTypenameDecl(
1684  const UnresolvedUsingTypenameDecl *D) {
1685  OS << ' ';
1686  if (D->getQualifier())
1688  OS << D->getNameAsString();
1689 }
1690 
1691 void ASTDumper::VisitUnresolvedUsingValueDecl(const UnresolvedUsingValueDecl *D) {
1692  OS << ' ';
1693  if (D->getQualifier())
1695  OS << D->getNameAsString();
1696  dumpType(D->getType());
1697 }
1698 
1699 void ASTDumper::VisitUsingShadowDecl(const UsingShadowDecl *D) {
1700  OS << ' ';
1701  dumpBareDeclRef(D->getTargetDecl());
1702  if (auto *TD = dyn_cast<TypeDecl>(D->getUnderlyingDecl()))
1703  dumpTypeAsChild(TD->getTypeForDecl());
1704 }
1705 
1706 void ASTDumper::VisitConstructorUsingShadowDecl(
1707  const ConstructorUsingShadowDecl *D) {
1708  if (D->constructsVirtualBase())
1709  OS << " virtual";
1710 
1711  dumpChild([=] {
1712  OS << "target ";
1713  dumpBareDeclRef(D->getTargetDecl());
1714  });
1715 
1716  dumpChild([=] {
1717  OS << "nominated ";
1718  dumpBareDeclRef(D->getNominatedBaseClass());
1719  OS << ' ';
1720  dumpBareDeclRef(D->getNominatedBaseClassShadowDecl());
1721  });
1722 
1723  dumpChild([=] {
1724  OS << "constructed ";
1725  dumpBareDeclRef(D->getConstructedBaseClass());
1726  OS << ' ';
1727  dumpBareDeclRef(D->getConstructedBaseClassShadowDecl());
1728  });
1729 }
1730 
1731 void ASTDumper::VisitLinkageSpecDecl(const LinkageSpecDecl *D) {
1732  switch (D->getLanguage()) {
1733  case LinkageSpecDecl::lang_c: OS << " C"; break;
1734  case LinkageSpecDecl::lang_cxx: OS << " C++"; break;
1735  }
1736 }
1737 
1738 void ASTDumper::VisitAccessSpecDecl(const AccessSpecDecl *D) {
1739  OS << ' ';
1740  dumpAccessSpecifier(D->getAccess());
1741 }
1742 
1743 void ASTDumper::VisitFriendDecl(const FriendDecl *D) {
1744  if (TypeSourceInfo *T = D->getFriendType())
1745  dumpType(T->getType());
1746  else
1747  dumpDecl(D->getFriendDecl());
1748 }
1749 
1750 //===----------------------------------------------------------------------===//
1751 // Obj-C Declarations
1752 //===----------------------------------------------------------------------===//
1753 
1754 void ASTDumper::VisitObjCIvarDecl(const ObjCIvarDecl *D) {
1755  dumpName(D);
1756  dumpType(D->getType());
1757  if (D->getSynthesize())
1758  OS << " synthesize";
1759 
1760  switch (D->getAccessControl()) {
1761  case ObjCIvarDecl::None:
1762  OS << " none";
1763  break;
1764  case ObjCIvarDecl::Private:
1765  OS << " private";
1766  break;
1768  OS << " protected";
1769  break;
1770  case ObjCIvarDecl::Public:
1771  OS << " public";
1772  break;
1773  case ObjCIvarDecl::Package:
1774  OS << " package";
1775  break;
1776  }
1777 }
1778 
1779 void ASTDumper::VisitObjCMethodDecl(const ObjCMethodDecl *D) {
1780  if (D->isInstanceMethod())
1781  OS << " -";
1782  else
1783  OS << " +";
1784  dumpName(D);
1785  dumpType(D->getReturnType());
1786 
1787  if (D->isThisDeclarationADefinition()) {
1788  dumpDeclContext(D);
1789  } else {
1790  for (const ParmVarDecl *Parameter : D->parameters())
1791  dumpDecl(Parameter);
1792  }
1793 
1794  if (D->isVariadic())
1795  dumpChild([=] { OS << "..."; });
1796 
1797  if (D->hasBody())
1798  dumpStmt(D->getBody());
1799 }
1800 
1801 void ASTDumper::VisitObjCTypeParamDecl(const ObjCTypeParamDecl *D) {
1802  dumpName(D);
1803  switch (D->getVariance()) {
1805  break;
1806 
1808  OS << " covariant";
1809  break;
1810 
1812  OS << " contravariant";
1813  break;
1814  }
1815 
1816  if (D->hasExplicitBound())
1817  OS << " bounded";
1818  dumpType(D->getUnderlyingType());
1819 }
1820 
1821 void ASTDumper::VisitObjCCategoryDecl(const ObjCCategoryDecl *D) {
1822  dumpName(D);
1823  dumpDeclRef(D->getClassInterface());
1824  dumpObjCTypeParamList(D->getTypeParamList());
1825  dumpDeclRef(D->getImplementation());
1827  E = D->protocol_end();
1828  I != E; ++I)
1829  dumpDeclRef(*I);
1830 }
1831 
1832 void ASTDumper::VisitObjCCategoryImplDecl(const ObjCCategoryImplDecl *D) {
1833  dumpName(D);
1834  dumpDeclRef(D->getClassInterface());
1835  dumpDeclRef(D->getCategoryDecl());
1836 }
1837 
1838 void ASTDumper::VisitObjCProtocolDecl(const ObjCProtocolDecl *D) {
1839  dumpName(D);
1840 
1841  for (auto *Child : D->protocols())
1842  dumpDeclRef(Child);
1843 }
1844 
1845 void ASTDumper::VisitObjCInterfaceDecl(const ObjCInterfaceDecl *D) {
1846  dumpName(D);
1847  dumpObjCTypeParamList(D->getTypeParamListAsWritten());
1848  dumpDeclRef(D->getSuperClass(), "super");
1849 
1850  dumpDeclRef(D->getImplementation());
1851  for (auto *Child : D->protocols())
1852  dumpDeclRef(Child);
1853 }
1854 
1855 void ASTDumper::VisitObjCImplementationDecl(const ObjCImplementationDecl *D) {
1856  dumpName(D);
1857  dumpDeclRef(D->getSuperClass(), "super");
1858  dumpDeclRef(D->getClassInterface());
1860  E = D->init_end();
1861  I != E; ++I)
1862  dumpCXXCtorInitializer(*I);
1863 }
1864 
1865 void ASTDumper::VisitObjCCompatibleAliasDecl(const ObjCCompatibleAliasDecl *D) {
1866  dumpName(D);
1867  dumpDeclRef(D->getClassInterface());
1868 }
1869 
1870 void ASTDumper::VisitObjCPropertyDecl(const ObjCPropertyDecl *D) {
1871  dumpName(D);
1872  dumpType(D->getType());
1873 
1875  OS << " required";
1877  OS << " optional";
1878 
1880  if (Attrs != ObjCPropertyDecl::OBJC_PR_noattr) {
1882  OS << " readonly";
1884  OS << " assign";
1886  OS << " readwrite";
1888  OS << " retain";
1889  if (Attrs & ObjCPropertyDecl::OBJC_PR_copy)
1890  OS << " copy";
1892  OS << " nonatomic";
1894  OS << " atomic";
1895  if (Attrs & ObjCPropertyDecl::OBJC_PR_weak)
1896  OS << " weak";
1898  OS << " strong";
1900  OS << " unsafe_unretained";
1901  if (Attrs & ObjCPropertyDecl::OBJC_PR_class)
1902  OS << " class";
1904  dumpDeclRef(D->getGetterMethodDecl(), "getter");
1906  dumpDeclRef(D->getSetterMethodDecl(), "setter");
1907  }
1908 }
1909 
1910 void ASTDumper::VisitObjCPropertyImplDecl(const ObjCPropertyImplDecl *D) {
1911  dumpName(D->getPropertyDecl());
1913  OS << " synthesize";
1914  else
1915  OS << " dynamic";
1916  dumpDeclRef(D->getPropertyDecl());
1917  dumpDeclRef(D->getPropertyIvarDecl());
1918 }
1919 
1920 void ASTDumper::VisitBlockDecl(const BlockDecl *D) {
1921  for (auto I : D->parameters())
1922  dumpDecl(I);
1923 
1924  if (D->isVariadic())
1925  dumpChild([=]{ OS << "..."; });
1926 
1927  if (D->capturesCXXThis())
1928  dumpChild([=]{ OS << "capture this"; });
1929 
1930  for (const auto &I : D->captures()) {
1931  dumpChild([=] {
1932  OS << "capture";
1933  if (I.isByRef())
1934  OS << " byref";
1935  if (I.isNested())
1936  OS << " nested";
1937  if (I.getVariable()) {
1938  OS << ' ';
1939  dumpBareDeclRef(I.getVariable());
1940  }
1941  if (I.hasCopyExpr())
1942  dumpStmt(I.getCopyExpr());
1943  });
1944  }
1945  dumpStmt(D->getBody());
1946 }
1947 
1948 //===----------------------------------------------------------------------===//
1949 // Stmt dumping methods.
1950 //===----------------------------------------------------------------------===//
1951 
1952 void ASTDumper::dumpStmt(const Stmt *S) {
1953  dumpChild([=] {
1954  if (!S) {
1955  ColorScope Color(*this, NullColor);
1956  OS << "<<<NULL>>>";
1957  return;
1958  }
1959 
1960  // Some statements have custom mechanisms for dumping their children.
1961  if (const DeclStmt *DS = dyn_cast<DeclStmt>(S)) {
1962  VisitDeclStmt(DS);
1963  return;
1964  }
1965  if (const GenericSelectionExpr *GSE = dyn_cast<GenericSelectionExpr>(S)) {
1966  VisitGenericSelectionExpr(GSE);
1967  return;
1968  }
1969 
1971 
1972  for (const Stmt *SubStmt : S->children())
1973  dumpStmt(SubStmt);
1974  });
1975 }
1976 
1977 void ASTDumper::VisitStmt(const Stmt *Node) {
1978  {
1979  ColorScope Color(*this, StmtColor);
1980  OS << Node->getStmtClassName();
1981  }
1982  dumpPointer(Node);
1983  dumpSourceRange(Node->getSourceRange());
1984 }
1985 
1986 void ASTDumper::VisitDeclStmt(const DeclStmt *Node) {
1987  VisitStmt(Node);
1988  for (DeclStmt::const_decl_iterator I = Node->decl_begin(),
1989  E = Node->decl_end();
1990  I != E; ++I)
1991  dumpDecl(*I);
1992 }
1993 
1994 void ASTDumper::VisitAttributedStmt(const AttributedStmt *Node) {
1995  VisitStmt(Node);
1996  for (ArrayRef<const Attr *>::iterator I = Node->getAttrs().begin(),
1997  E = Node->getAttrs().end();
1998  I != E; ++I)
1999  dumpAttr(*I);
2000 }
2001 
2002 void ASTDumper::VisitLabelStmt(const LabelStmt *Node) {
2003  VisitStmt(Node);
2004  OS << " '" << Node->getName() << "'";
2005 }
2006 
2007 void ASTDumper::VisitGotoStmt(const GotoStmt *Node) {
2008  VisitStmt(Node);
2009  OS << " '" << Node->getLabel()->getName() << "'";
2010  dumpPointer(Node->getLabel());
2011 }
2012 
2013 void ASTDumper::VisitCXXCatchStmt(const CXXCatchStmt *Node) {
2014  VisitStmt(Node);
2015  dumpDecl(Node->getExceptionDecl());
2016 }
2017 
2018 void ASTDumper::VisitCapturedStmt(const CapturedStmt *Node) {
2019  VisitStmt(Node);
2020  dumpDecl(Node->getCapturedDecl());
2021 }
2022 
2023 //===----------------------------------------------------------------------===//
2024 // OpenMP dumping methods.
2025 //===----------------------------------------------------------------------===//
2026 
2027 void ASTDumper::VisitOMPExecutableDirective(
2028  const OMPExecutableDirective *Node) {
2029  VisitStmt(Node);
2030  for (auto *C : Node->clauses()) {
2031  dumpChild([=] {
2032  if (!C) {
2033  ColorScope Color(*this, NullColor);
2034  OS << "<<<NULL>>> OMPClause";
2035  return;
2036  }
2037  {
2038  ColorScope Color(*this, AttrColor);
2039  StringRef ClauseName(getOpenMPClauseName(C->getClauseKind()));
2040  OS << "OMP" << ClauseName.substr(/*Start=*/0, /*N=*/1).upper()
2041  << ClauseName.drop_front() << "Clause";
2042  }
2043  dumpPointer(C);
2044  dumpSourceRange(SourceRange(C->getBeginLoc(), C->getEndLoc()));
2045  if (C->isImplicit())
2046  OS << " <implicit>";
2047  for (auto *S : C->children())
2048  dumpStmt(S);
2049  });
2050  }
2051 }
2052 
2053 //===----------------------------------------------------------------------===//
2054 // Expr dumping methods.
2055 //===----------------------------------------------------------------------===//
2056 
2057 void ASTDumper::VisitExpr(const Expr *Node) {
2058  VisitStmt(Node);
2059  dumpType(Node->getType());
2060 
2061  {
2062  ColorScope Color(*this, ValueKindColor);
2063  switch (Node->getValueKind()) {
2064  case VK_RValue:
2065  break;
2066  case VK_LValue:
2067  OS << " lvalue";
2068  break;
2069  case VK_XValue:
2070  OS << " xvalue";
2071  break;
2072  }
2073  }
2074 
2075  {
2076  ColorScope Color(*this, ObjectKindColor);
2077  switch (Node->getObjectKind()) {
2078  case OK_Ordinary:
2079  break;
2080  case OK_BitField:
2081  OS << " bitfield";
2082  break;
2083  case OK_ObjCProperty:
2084  OS << " objcproperty";
2085  break;
2086  case OK_ObjCSubscript:
2087  OS << " objcsubscript";
2088  break;
2089  case OK_VectorComponent:
2090  OS << " vectorcomponent";
2091  break;
2092  }
2093  }
2094 }
2095 
2096 static void dumpBasePath(raw_ostream &OS, const CastExpr *Node) {
2097  if (Node->path_empty())
2098  return;
2099 
2100  OS << " (";
2101  bool First = true;
2102  for (CastExpr::path_const_iterator I = Node->path_begin(),
2103  E = Node->path_end();
2104  I != E; ++I) {
2105  const CXXBaseSpecifier *Base = *I;
2106  if (!First)
2107  OS << " -> ";
2108 
2109  const CXXRecordDecl *RD =
2110  cast<CXXRecordDecl>(Base->getType()->getAs<RecordType>()->getDecl());
2111 
2112  if (Base->isVirtual())
2113  OS << "virtual ";
2114  OS << RD->getName();
2115  First = false;
2116  }
2117 
2118  OS << ')';
2119 }
2120 
2121 void ASTDumper::VisitCastExpr(const CastExpr *Node) {
2122  VisitExpr(Node);
2123  OS << " <";
2124  {
2125  ColorScope Color(*this, CastColor);
2126  OS << Node->getCastKindName();
2127  }
2128  dumpBasePath(OS, Node);
2129  OS << ">";
2130 }
2131 
2132 void ASTDumper::VisitImplicitCastExpr(const ImplicitCastExpr *Node) {
2133  VisitCastExpr(Node);
2134  if (Node->isPartOfExplicitCast())
2135  OS << " part_of_explicit_cast";
2136 }
2137 
2138 void ASTDumper::VisitDeclRefExpr(const DeclRefExpr *Node) {
2139  VisitExpr(Node);
2140 
2141  OS << " ";
2142  dumpBareDeclRef(Node->getDecl());
2143  if (Node->getDecl() != Node->getFoundDecl()) {
2144  OS << " (";
2145  dumpBareDeclRef(Node->getFoundDecl());
2146  OS << ")";
2147  }
2148 }
2149 
2150 void ASTDumper::VisitUnresolvedLookupExpr(const UnresolvedLookupExpr *Node) {
2151  VisitExpr(Node);
2152  OS << " (";
2153  if (!Node->requiresADL())
2154  OS << "no ";
2155  OS << "ADL) = '" << Node->getName() << '\'';
2156 
2158  I = Node->decls_begin(), E = Node->decls_end();
2159  if (I == E)
2160  OS << " empty";
2161  for (; I != E; ++I)
2162  dumpPointer(*I);
2163 }
2164 
2165 void ASTDumper::VisitObjCIvarRefExpr(const ObjCIvarRefExpr *Node) {
2166  VisitExpr(Node);
2167 
2168  {
2169  ColorScope Color(*this, DeclKindNameColor);
2170  OS << " " << Node->getDecl()->getDeclKindName() << "Decl";
2171  }
2172  OS << "='" << *Node->getDecl() << "'";
2173  dumpPointer(Node->getDecl());
2174  if (Node->isFreeIvar())
2175  OS << " isFreeIvar";
2176 }
2177 
2178 void ASTDumper::VisitPredefinedExpr(const PredefinedExpr *Node) {
2179  VisitExpr(Node);
2180  OS << " " << PredefinedExpr::getIdentTypeName(Node->getIdentType());
2181 }
2182 
2183 void ASTDumper::VisitCharacterLiteral(const CharacterLiteral *Node) {
2184  VisitExpr(Node);
2185  ColorScope Color(*this, ValueColor);
2186  OS << " " << Node->getValue();
2187 }
2188 
2189 void ASTDumper::VisitIntegerLiteral(const IntegerLiteral *Node) {
2190  VisitExpr(Node);
2191 
2192  bool isSigned = Node->getType()->isSignedIntegerType();
2193  ColorScope Color(*this, ValueColor);
2194  OS << " " << Node->getValue().toString(10, isSigned);
2195 }
2196 
2197 void ASTDumper::VisitFixedPointLiteral(const FixedPointLiteral *Node) {
2198  VisitExpr(Node);
2199 
2200  ColorScope Color(*this, ValueColor);
2201  OS << " " << Node->getValueAsString(/*Radix=*/10);
2202 }
2203 
2204 void ASTDumper::VisitFloatingLiteral(const FloatingLiteral *Node) {
2205  VisitExpr(Node);
2206  ColorScope Color(*this, ValueColor);
2207  OS << " " << Node->getValueAsApproximateDouble();
2208 }
2209 
2210 void ASTDumper::VisitStringLiteral(const StringLiteral *Str) {
2211  VisitExpr(Str);
2212  ColorScope Color(*this, ValueColor);
2213  OS << " ";
2214  Str->outputString(OS);
2215 }
2216 
2217 void ASTDumper::VisitInitListExpr(const InitListExpr *ILE) {
2218  VisitExpr(ILE);
2219  if (auto *Filler = ILE->getArrayFiller()) {
2220  dumpChild([=] {
2221  OS << "array filler";
2222  dumpStmt(Filler);
2223  });
2224  }
2225  if (auto *Field = ILE->getInitializedFieldInUnion()) {
2226  OS << " field ";
2227  dumpBareDeclRef(Field);
2228  }
2229 }
2230 
2231 void ASTDumper::VisitArrayInitLoopExpr(const ArrayInitLoopExpr *E) {
2232  VisitExpr(E);
2233 }
2234 
2235 void ASTDumper::VisitArrayInitIndexExpr(const ArrayInitIndexExpr *E) {
2236  VisitExpr(E);
2237 }
2238 
2239 void ASTDumper::VisitUnaryOperator(const UnaryOperator *Node) {
2240  VisitExpr(Node);
2241  OS << " " << (Node->isPostfix() ? "postfix" : "prefix")
2242  << " '" << UnaryOperator::getOpcodeStr(Node->getOpcode()) << "'";
2243  if (!Node->canOverflow())
2244  OS << " cannot overflow";
2245 }
2246 
2247 void ASTDumper::VisitUnaryExprOrTypeTraitExpr(
2248  const UnaryExprOrTypeTraitExpr *Node) {
2249  VisitExpr(Node);
2250  switch(Node->getKind()) {
2251  case UETT_SizeOf:
2252  OS << " sizeof";
2253  break;
2254  case UETT_AlignOf:
2255  OS << " alignof";
2256  break;
2257  case UETT_VecStep:
2258  OS << " vec_step";
2259  break;
2261  OS << " __builtin_omp_required_simd_align";
2262  break;
2263  }
2264  if (Node->isArgumentType())
2265  dumpType(Node->getArgumentType());
2266 }
2267 
2268 void ASTDumper::VisitMemberExpr(const MemberExpr *Node) {
2269  VisitExpr(Node);
2270  OS << " " << (Node->isArrow() ? "->" : ".") << *Node->getMemberDecl();
2271  dumpPointer(Node->getMemberDecl());
2272 }
2273 
2274 void ASTDumper::VisitExtVectorElementExpr(const ExtVectorElementExpr *Node) {
2275  VisitExpr(Node);
2276  OS << " " << Node->getAccessor().getNameStart();
2277 }
2278 
2279 void ASTDumper::VisitBinaryOperator(const BinaryOperator *Node) {
2280  VisitExpr(Node);
2281  OS << " '" << BinaryOperator::getOpcodeStr(Node->getOpcode()) << "'";
2282 }
2283 
2284 void ASTDumper::VisitCompoundAssignOperator(
2285  const CompoundAssignOperator *Node) {
2286  VisitExpr(Node);
2287  OS << " '" << BinaryOperator::getOpcodeStr(Node->getOpcode())
2288  << "' ComputeLHSTy=";
2289  dumpBareType(Node->getComputationLHSType());
2290  OS << " ComputeResultTy=";
2291  dumpBareType(Node->getComputationResultType());
2292 }
2293 
2294 void ASTDumper::VisitBlockExpr(const BlockExpr *Node) {
2295  VisitExpr(Node);
2296  dumpDecl(Node->getBlockDecl());
2297 }
2298 
2299 void ASTDumper::VisitOpaqueValueExpr(const OpaqueValueExpr *Node) {
2300  VisitExpr(Node);
2301 
2302  if (Expr *Source = Node->getSourceExpr())
2303  dumpStmt(Source);
2304 }
2305 
2306 void ASTDumper::VisitGenericSelectionExpr(const GenericSelectionExpr *E) {
2307  VisitExpr(E);
2308  if (E->isResultDependent())
2309  OS << " result_dependent";
2310  dumpStmt(E->getControllingExpr());
2311  dumpTypeAsChild(E->getControllingExpr()->getType()); // FIXME: remove
2312 
2313  for (unsigned I = 0, N = E->getNumAssocs(); I != N; ++I) {
2314  dumpChild([=] {
2315  if (const TypeSourceInfo *TSI = E->getAssocTypeSourceInfo(I)) {
2316  OS << "case ";
2317  dumpType(TSI->getType());
2318  } else {
2319  OS << "default";
2320  }
2321 
2322  if (!E->isResultDependent() && E->getResultIndex() == I)
2323  OS << " selected";
2324 
2325  if (const TypeSourceInfo *TSI = E->getAssocTypeSourceInfo(I))
2326  dumpTypeAsChild(TSI->getType());
2327  dumpStmt(E->getAssocExpr(I));
2328  });
2329  }
2330 }
2331 
2332 // GNU extensions.
2333 
2334 void ASTDumper::VisitAddrLabelExpr(const AddrLabelExpr *Node) {
2335  VisitExpr(Node);
2336  OS << " " << Node->getLabel()->getName();
2337  dumpPointer(Node->getLabel());
2338 }
2339 
2340 //===----------------------------------------------------------------------===//
2341 // C++ Expressions
2342 //===----------------------------------------------------------------------===//
2343 
2344 void ASTDumper::VisitCXXNamedCastExpr(const CXXNamedCastExpr *Node) {
2345  VisitExpr(Node);
2346  OS << " " << Node->getCastName()
2347  << "<" << Node->getTypeAsWritten().getAsString() << ">"
2348  << " <" << Node->getCastKindName();
2349  dumpBasePath(OS, Node);
2350  OS << ">";
2351 }
2352 
2353 void ASTDumper::VisitCXXBoolLiteralExpr(const CXXBoolLiteralExpr *Node) {
2354  VisitExpr(Node);
2355  OS << " " << (Node->getValue() ? "true" : "false");
2356 }
2357 
2358 void ASTDumper::VisitCXXThisExpr(const CXXThisExpr *Node) {
2359  VisitExpr(Node);
2360  OS << " this";
2361 }
2362 
2363 void ASTDumper::VisitCXXFunctionalCastExpr(const CXXFunctionalCastExpr *Node) {
2364  VisitExpr(Node);
2365  OS << " functional cast to " << Node->getTypeAsWritten().getAsString()
2366  << " <" << Node->getCastKindName() << ">";
2367 }
2368 
2369 void ASTDumper::VisitCXXUnresolvedConstructExpr(
2370  const CXXUnresolvedConstructExpr *Node) {
2371  VisitExpr(Node);
2372  dumpType(Node->getTypeAsWritten());
2373  if (Node->isListInitialization())
2374  OS << " list";
2375 }
2376 
2377 void ASTDumper::VisitCXXConstructExpr(const CXXConstructExpr *Node) {
2378  VisitExpr(Node);
2379  CXXConstructorDecl *Ctor = Node->getConstructor();
2380  dumpType(Ctor->getType());
2381  if (Node->isElidable())
2382  OS << " elidable";
2383  if (Node->isListInitialization())
2384  OS << " list";
2385  if (Node->isStdInitListInitialization())
2386  OS << " std::initializer_list";
2387  if (Node->requiresZeroInitialization())
2388  OS << " zeroing";
2389 }
2390 
2391 void ASTDumper::VisitCXXBindTemporaryExpr(const CXXBindTemporaryExpr *Node) {
2392  VisitExpr(Node);
2393  OS << " ";
2394  dumpCXXTemporary(Node->getTemporary());
2395 }
2396 
2397 void ASTDumper::VisitCXXNewExpr(const CXXNewExpr *Node) {
2398  VisitExpr(Node);
2399  if (Node->isGlobalNew())
2400  OS << " global";
2401  if (Node->isArray())
2402  OS << " array";
2403  if (Node->getOperatorNew()) {
2404  OS << ' ';
2405  dumpBareDeclRef(Node->getOperatorNew());
2406  }
2407  // We could dump the deallocation function used in case of error, but it's
2408  // usually not that interesting.
2409 }
2410 
2411 void ASTDumper::VisitCXXDeleteExpr(const CXXDeleteExpr *Node) {
2412  VisitExpr(Node);
2413  if (Node->isGlobalDelete())
2414  OS << " global";
2415  if (Node->isArrayForm())
2416  OS << " array";
2417  if (Node->getOperatorDelete()) {
2418  OS << ' ';
2419  dumpBareDeclRef(Node->getOperatorDelete());
2420  }
2421 }
2422 
2423 void
2424 ASTDumper::VisitMaterializeTemporaryExpr(const MaterializeTemporaryExpr *Node) {
2425  VisitExpr(Node);
2426  if (const ValueDecl *VD = Node->getExtendingDecl()) {
2427  OS << " extended by ";
2428  dumpBareDeclRef(VD);
2429  }
2430 }
2431 
2432 void ASTDumper::VisitExprWithCleanups(const ExprWithCleanups *Node) {
2433  VisitExpr(Node);
2434  for (unsigned i = 0, e = Node->getNumObjects(); i != e; ++i)
2435  dumpDeclRef(Node->getObject(i), "cleanup");
2436 }
2437 
2438 void ASTDumper::dumpCXXTemporary(const CXXTemporary *Temporary) {
2439  OS << "(CXXTemporary";
2440  dumpPointer(Temporary);
2441  OS << ")";
2442 }
2443 
2444 void ASTDumper::VisitSizeOfPackExpr(const SizeOfPackExpr *Node) {
2445  VisitExpr(Node);
2446  dumpPointer(Node->getPack());
2447  dumpName(Node->getPack());
2448  if (Node->isPartiallySubstituted())
2449  for (const auto &A : Node->getPartialArguments())
2450  dumpTemplateArgument(A);
2451 }
2452 
2453 void ASTDumper::VisitCXXDependentScopeMemberExpr(
2454  const CXXDependentScopeMemberExpr *Node) {
2455  VisitExpr(Node);
2456  OS << " " << (Node->isArrow() ? "->" : ".") << Node->getMember();
2457 }
2458 
2459 //===----------------------------------------------------------------------===//
2460 // Obj-C Expressions
2461 //===----------------------------------------------------------------------===//
2462 
2463 void ASTDumper::VisitObjCMessageExpr(const ObjCMessageExpr *Node) {
2464  VisitExpr(Node);
2465  OS << " selector=";
2466  Node->getSelector().print(OS);
2467  switch (Node->getReceiverKind()) {
2469  break;
2470 
2472  OS << " class=";
2473  dumpBareType(Node->getClassReceiver());
2474  break;
2475 
2477  OS << " super (instance)";
2478  break;
2479 
2481  OS << " super (class)";
2482  break;
2483  }
2484 }
2485 
2486 void ASTDumper::VisitObjCBoxedExpr(const ObjCBoxedExpr *Node) {
2487  VisitExpr(Node);
2488  if (auto *BoxingMethod = Node->getBoxingMethod()) {
2489  OS << " selector=";
2490  BoxingMethod->getSelector().print(OS);
2491  }
2492 }
2493 
2494 void ASTDumper::VisitObjCAtCatchStmt(const ObjCAtCatchStmt *Node) {
2495  VisitStmt(Node);
2496  if (const VarDecl *CatchParam = Node->getCatchParamDecl())
2497  dumpDecl(CatchParam);
2498  else
2499  OS << " catch all";
2500 }
2501 
2502 void ASTDumper::VisitObjCEncodeExpr(const ObjCEncodeExpr *Node) {
2503  VisitExpr(Node);
2504  dumpType(Node->getEncodedType());
2505 }
2506 
2507 void ASTDumper::VisitObjCSelectorExpr(const ObjCSelectorExpr *Node) {
2508  VisitExpr(Node);
2509 
2510  OS << " ";
2511  Node->getSelector().print(OS);
2512 }
2513 
2514 void ASTDumper::VisitObjCProtocolExpr(const ObjCProtocolExpr *Node) {
2515  VisitExpr(Node);
2516 
2517  OS << ' ' << *Node->getProtocol();
2518 }
2519 
2520 void ASTDumper::VisitObjCPropertyRefExpr(const ObjCPropertyRefExpr *Node) {
2521  VisitExpr(Node);
2522  if (Node->isImplicitProperty()) {
2523  OS << " Kind=MethodRef Getter=\"";
2524  if (Node->getImplicitPropertyGetter())
2526  else
2527  OS << "(null)";
2528 
2529  OS << "\" Setter=\"";
2530  if (ObjCMethodDecl *Setter = Node->getImplicitPropertySetter())
2531  Setter->getSelector().print(OS);
2532  else
2533  OS << "(null)";
2534  OS << "\"";
2535  } else {
2536  OS << " Kind=PropertyRef Property=\"" << *Node->getExplicitProperty() <<'"';
2537  }
2538 
2539  if (Node->isSuperReceiver())
2540  OS << " super";
2541 
2542  OS << " Messaging=";
2543  if (Node->isMessagingGetter() && Node->isMessagingSetter())
2544  OS << "Getter&Setter";
2545  else if (Node->isMessagingGetter())
2546  OS << "Getter";
2547  else if (Node->isMessagingSetter())
2548  OS << "Setter";
2549 }
2550 
2551 void ASTDumper::VisitObjCSubscriptRefExpr(const ObjCSubscriptRefExpr *Node) {
2552  VisitExpr(Node);
2553  if (Node->isArraySubscriptRefExpr())
2554  OS << " Kind=ArraySubscript GetterForArray=\"";
2555  else
2556  OS << " Kind=DictionarySubscript GetterForDictionary=\"";
2557  if (Node->getAtIndexMethodDecl())
2558  Node->getAtIndexMethodDecl()->getSelector().print(OS);
2559  else
2560  OS << "(null)";
2561 
2562  if (Node->isArraySubscriptRefExpr())
2563  OS << "\" SetterForArray=\"";
2564  else
2565  OS << "\" SetterForDictionary=\"";
2566  if (Node->setAtIndexMethodDecl())
2567  Node->setAtIndexMethodDecl()->getSelector().print(OS);
2568  else
2569  OS << "(null)";
2570 }
2571 
2572 void ASTDumper::VisitObjCBoolLiteralExpr(const ObjCBoolLiteralExpr *Node) {
2573  VisitExpr(Node);
2574  OS << " " << (Node->getValue() ? "__objc_yes" : "__objc_no");
2575 }
2576 
2577 //===----------------------------------------------------------------------===//
2578 // Comments
2579 //===----------------------------------------------------------------------===//
2580 
2581 const char *ASTDumper::getCommandName(unsigned CommandID) {
2582  if (Traits)
2583  return Traits->getCommandInfo(CommandID)->Name;
2584  const CommandInfo *Info = CommandTraits::getBuiltinCommandInfo(CommandID);
2585  if (Info)
2586  return Info->Name;
2587  return "<not a builtin command>";
2588 }
2589 
2590 void ASTDumper::dumpFullComment(const FullComment *C) {
2591  if (!C)
2592  return;
2593 
2594  FC = C;
2595  dumpComment(C);
2596  FC = nullptr;
2597 }
2598 
2599 void ASTDumper::dumpComment(const Comment *C) {
2600  dumpChild([=] {
2601  if (!C) {
2602  ColorScope Color(*this, NullColor);
2603  OS << "<<<NULL>>>";
2604  return;
2605  }
2606 
2607  {
2608  ColorScope Color(*this, CommentColor);
2609  OS << C->getCommentKindName();
2610  }
2611  dumpPointer(C);
2612  dumpSourceRange(C->getSourceRange());
2614  for (Comment::child_iterator I = C->child_begin(), E = C->child_end();
2615  I != E; ++I)
2616  dumpComment(*I);
2617  });
2618 }
2619 
2620 void ASTDumper::visitTextComment(const TextComment *C) {
2621  OS << " Text=\"" << C->getText() << "\"";
2622 }
2623 
2624 void ASTDumper::visitInlineCommandComment(const InlineCommandComment *C) {
2625  OS << " Name=\"" << getCommandName(C->getCommandID()) << "\"";
2626  switch (C->getRenderKind()) {
2628  OS << " RenderNormal";
2629  break;
2631  OS << " RenderBold";
2632  break;
2634  OS << " RenderMonospaced";
2635  break;
2637  OS << " RenderEmphasized";
2638  break;
2639  }
2640 
2641  for (unsigned i = 0, e = C->getNumArgs(); i != e; ++i)
2642  OS << " Arg[" << i << "]=\"" << C->getArgText(i) << "\"";
2643 }
2644 
2645 void ASTDumper::visitHTMLStartTagComment(const HTMLStartTagComment *C) {
2646  OS << " Name=\"" << C->getTagName() << "\"";
2647  if (C->getNumAttrs() != 0) {
2648  OS << " Attrs: ";
2649  for (unsigned i = 0, e = C->getNumAttrs(); i != e; ++i) {
2651  OS << " \"" << Attr.Name << "=\"" << Attr.Value << "\"";
2652  }
2653  }
2654  if (C->isSelfClosing())
2655  OS << " SelfClosing";
2656 }
2657 
2658 void ASTDumper::visitHTMLEndTagComment(const HTMLEndTagComment *C) {
2659  OS << " Name=\"" << C->getTagName() << "\"";
2660 }
2661 
2662 void ASTDumper::visitBlockCommandComment(const BlockCommandComment *C) {
2663  OS << " Name=\"" << getCommandName(C->getCommandID()) << "\"";
2664  for (unsigned i = 0, e = C->getNumArgs(); i != e; ++i)
2665  OS << " Arg[" << i << "]=\"" << C->getArgText(i) << "\"";
2666 }
2667 
2668 void ASTDumper::visitParamCommandComment(const ParamCommandComment *C) {
2670 
2671  if (C->isDirectionExplicit())
2672  OS << " explicitly";
2673  else
2674  OS << " implicitly";
2675 
2676  if (C->hasParamName()) {
2677  if (C->isParamIndexValid())
2678  OS << " Param=\"" << C->getParamName(FC) << "\"";
2679  else
2680  OS << " Param=\"" << C->getParamNameAsWritten() << "\"";
2681  }
2682 
2683  if (C->isParamIndexValid() && !C->isVarArgParam())
2684  OS << " ParamIndex=" << C->getParamIndex();
2685 }
2686 
2687 void ASTDumper::visitTParamCommandComment(const TParamCommandComment *C) {
2688  if (C->hasParamName()) {
2689  if (C->isPositionValid())
2690  OS << " Param=\"" << C->getParamName(FC) << "\"";
2691  else
2692  OS << " Param=\"" << C->getParamNameAsWritten() << "\"";
2693  }
2694 
2695  if (C->isPositionValid()) {
2696  OS << " Position=<";
2697  for (unsigned i = 0, e = C->getDepth(); i != e; ++i) {
2698  OS << C->getIndex(i);
2699  if (i != e - 1)
2700  OS << ", ";
2701  }
2702  OS << ">";
2703  }
2704 }
2705 
2706 void ASTDumper::visitVerbatimBlockComment(const VerbatimBlockComment *C) {
2707  OS << " Name=\"" << getCommandName(C->getCommandID()) << "\""
2708  " CloseName=\"" << C->getCloseName() << "\"";
2709 }
2710 
2711 void ASTDumper::visitVerbatimBlockLineComment(
2712  const VerbatimBlockLineComment *C) {
2713  OS << " Text=\"" << C->getText() << "\"";
2714 }
2715 
2716 void ASTDumper::visitVerbatimLineComment(const VerbatimLineComment *C) {
2717  OS << " Text=\"" << C->getText() << "\"";
2718 }
2719 
2720 //===----------------------------------------------------------------------===//
2721 // Type method implementations
2722 //===----------------------------------------------------------------------===//
2723 
2724 void QualType::dump(const char *msg) const {
2725  if (msg)
2726  llvm::errs() << msg << ": ";
2727  dump();
2728 }
2729 
2730 LLVM_DUMP_METHOD void QualType::dump() const { dump(llvm::errs()); }
2731 
2732 LLVM_DUMP_METHOD void QualType::dump(llvm::raw_ostream &OS) const {
2733  ASTDumper Dumper(OS, nullptr, nullptr);
2734  Dumper.dumpTypeAsChild(*this);
2735 }
2736 
2737 LLVM_DUMP_METHOD void Type::dump() const { dump(llvm::errs()); }
2738 
2739 LLVM_DUMP_METHOD void Type::dump(llvm::raw_ostream &OS) const {
2740  QualType(this, 0).dump(OS);
2741 }
2742 
2743 //===----------------------------------------------------------------------===//
2744 // Decl method implementations
2745 //===----------------------------------------------------------------------===//
2746 
2747 LLVM_DUMP_METHOD void Decl::dump() const { dump(llvm::errs()); }
2748 
2749 LLVM_DUMP_METHOD void Decl::dump(raw_ostream &OS, bool Deserialize) const {
2750  const ASTContext &Ctx = getASTContext();
2751  const SourceManager &SM = Ctx.getSourceManager();
2752  ASTDumper P(OS, &Ctx.getCommentCommandTraits(), &SM,
2754  P.setDeserialize(Deserialize);
2755  P.dumpDecl(this);
2756 }
2757 
2758 LLVM_DUMP_METHOD void Decl::dumpColor() const {
2759  const ASTContext &Ctx = getASTContext();
2760  ASTDumper P(llvm::errs(), &Ctx.getCommentCommandTraits(),
2761  &Ctx.getSourceManager(), /*ShowColors*/ true,
2762  Ctx.getPrintingPolicy());
2763  P.dumpDecl(this);
2764 }
2765 
2766 LLVM_DUMP_METHOD void DeclContext::dumpLookups() const {
2767  dumpLookups(llvm::errs());
2768 }
2769 
2770 LLVM_DUMP_METHOD void DeclContext::dumpLookups(raw_ostream &OS,
2771  bool DumpDecls,
2772  bool Deserialize) const {
2773  const DeclContext *DC = this;
2774  while (!DC->isTranslationUnit())
2775  DC = DC->getParent();
2776  ASTContext &Ctx = cast<TranslationUnitDecl>(DC)->getASTContext();
2777  const SourceManager &SM = Ctx.getSourceManager();
2778  ASTDumper P(OS, &Ctx.getCommentCommandTraits(), &Ctx.getSourceManager(),
2780  P.setDeserialize(Deserialize);
2781  P.dumpLookups(this, DumpDecls);
2782 }
2783 
2784 //===----------------------------------------------------------------------===//
2785 // Stmt method implementations
2786 //===----------------------------------------------------------------------===//
2787 
2788 LLVM_DUMP_METHOD void Stmt::dump(SourceManager &SM) const {
2789  dump(llvm::errs(), SM);
2790 }
2791 
2792 LLVM_DUMP_METHOD void Stmt::dump(raw_ostream &OS, SourceManager &SM) const {
2793  ASTDumper P(OS, nullptr, &SM);
2794  P.dumpStmt(this);
2795 }
2796 
2797 LLVM_DUMP_METHOD void Stmt::dump(raw_ostream &OS) const {
2798  ASTDumper P(OS, nullptr, nullptr);
2799  P.dumpStmt(this);
2800 }
2801 
2802 LLVM_DUMP_METHOD void Stmt::dump() const {
2803  ASTDumper P(llvm::errs(), nullptr, nullptr);
2804  P.dumpStmt(this);
2805 }
2806 
2807 LLVM_DUMP_METHOD void Stmt::dumpColor() const {
2808  ASTDumper P(llvm::errs(), nullptr, nullptr, /*ShowColors*/true);
2809  P.dumpStmt(this);
2810 }
2811 
2812 //===----------------------------------------------------------------------===//
2813 // Comment method implementations
2814 //===----------------------------------------------------------------------===//
2815 
2816 LLVM_DUMP_METHOD void Comment::dump() const {
2817  dump(llvm::errs(), nullptr, nullptr);
2818 }
2819 
2820 LLVM_DUMP_METHOD void Comment::dump(const ASTContext &Context) const {
2821  dump(llvm::errs(), &Context.getCommentCommandTraits(),
2822  &Context.getSourceManager());
2823 }
2824 
2825 void Comment::dump(raw_ostream &OS, const CommandTraits *Traits,
2826  const SourceManager *SM) const {
2827  const FullComment *FC = dyn_cast<FullComment>(this);
2828  ASTDumper D(OS, Traits, SM);
2829  D.dumpFullComment(FC);
2830 }
2831 
2832 LLVM_DUMP_METHOD void Comment::dumpColor() const {
2833  const FullComment *FC = dyn_cast<FullComment>(this);
2834  ASTDumper D(llvm::errs(), nullptr, nullptr, /*ShowColors*/true);
2835  D.dumpFullComment(FC);
2836 }
ObjCPropertyRefExpr - A dot-syntax expression to access an ObjC property.
Definition: ExprObjC.h:577
void dump() const
Definition: ASTDumper.cpp:2737
bool isBaseInitializer() const
Determine whether this initializer is initializing a base class.
Definition: DeclCXX.h:2316
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:5257
Defines the clang::ASTContext interface.
const BlockDecl * getBlockDecl() const
Definition: Expr.h:4988
bool path_empty() const
Definition: Expr.h:2873
const Type * Ty
The locally-unqualified type.
Definition: Type.h:583
NamedDecl * getTargetDecl() const
Gets the underlying declaration which has been brought into the local scope.
Definition: DeclCXX.h:3192
Represents a function declaration or definition.
Definition: Decl.h:1717
NamedDecl * getFoundDecl()
Get the NamedDecl through which this reference occurred.
Definition: Expr.h:1093
bool isVarArgParam() const LLVM_READONLY
Definition: Comment.h:777
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:2445
bool isThisDeclarationADefinition() const
Returns whether this specific method is a definition.
Definition: DeclObjC.h:507
decl_iterator noload_decls_begin() const
Definition: DeclBase.h:2020
protocol_range protocols() const
Definition: DeclObjC.h:1358
Module * getOwningModule() const
Get the module that owns this declaration (for visibility purposes).
Definition: DeclBase.h:757
PointerType - C99 6.7.5.1 - Pointer Declarators.
Definition: Type.h:2511
QualType getElementType() const
Definition: Type.h:5897
QualType getPointeeType() const
Definition: Type.h:2524
Represents the dependent type named by a dependently-scoped typename using declaration, e.g.
Definition: Type.h:4004
StringRef getArgText(unsigned Idx) const
Definition: Comment.h:673
A (possibly-)qualified type.
Definition: Type.h:642
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:2563
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:195
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:4876
bool isSuperReceiver() const
Definition: ExprObjC.h:739
bool isListInitialization() const
Determine whether this expression models list-initialization.
Definition: ExprCXX.h:3179
bool isPositionValid() const LLVM_READONLY
Definition: Comment.h:843
Expr * getUnderlyingExpr() const
Definition: Type.h:4139
attr_iterator attr_begin() const
Definition: DeclBase.h:499
ObjCProtocolDecl * getProtocol() const
Definition: ExprObjC.h:490
Stmt - This represents one statement.
Definition: Stmt.h:66
Expr * getBitWidth() const
Definition: Decl.h:2645
UnresolvedSetImpl::iterator decls_iterator
Definition: ExprCXX.h:2671
FunctionType - C99 6.7.5.3 - Function Declarators.
Definition: Type.h:3329
ObjCMethodDecl * setAtIndexMethodDecl() const
Definition: ExprObjC.h:858
An instance of this object exists for each enum constant that is defined.
Definition: Decl.h:2763
StorageClass getStorageClass() const
Returns the storage class as written in the source.
Definition: Decl.h:1017
Represents the declaration of a typedef-name via the &#39;typedef&#39; type specifier.
Definition: Decl.h:2995
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:4643
Defines the clang::Module class, which describes a module in the source code.
Decl - This represents one declaration (or definition), e.g.
Definition: DeclBase.h:86
bool needsOverloadResolutionForDestructor() const
Determine whether we need to eagerly declare a destructor for this class.
Definition: DeclCXX.h:1197
TagDecl * getDecl() const
Definition: Type.cpp:3137
ObjCMethodDecl * getImplicitPropertySetter() const
Definition: ExprObjC.h:680
Represents the index of the current element of an array being initialized by an ArrayInitLoopExpr.
Definition: Expr.h:4668
FunctionDecl * getOperatorNew() const
Definition: ExprCXX.h:1973
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:2769
Opcode getOpcode() const
Definition: Expr.h:3143
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:4632
Represents an attribute applied to a statement.
Definition: Stmt.h:905
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:958
The base class of the type hierarchy.
Definition: Type.h:1415
bool requiresZeroInitialization() const
Whether this construction first requires zero-initialization before the initializer is called...
Definition: ExprCXX.h:1352
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:2786
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:1262
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
AccessSpecifier
A C++ access specifier (public, private, protected), plus the special value "none" which means differ...
Definition: Specifiers.h:98
StringRef getParamName(const FullComment *FC) const
Definition: Comment.cpp:357
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:5864
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
child_iterator child_begin() const
Definition: Comment.cpp:68
bool hasExternalVisibleStorage() const
Whether this DeclContext has external storage containing additional declarations that are visible in ...
Definition: DeclBase.h:2336
TemplateTypeParmDecl * getDecl() const
Definition: Type.h:4452
Represents a C++ constructor within a class.
Definition: DeclCXX.h:2475
Represents a prvalue temporary that is written into memory so that a reference can bind to it...
Definition: ExprCXX.h:4077
bool isVirtualAsWritten() const
Whether this function is marked as virtual explicitly.
Definition: Decl.h:1979
bool needsOverloadResolutionForCopyConstructor() const
Determine whether we need to eagerly declare a defaulted copy constructor for this class...
Definition: DeclCXX.h:1011
QualType getElementType() const
Definition: Type.h:2821
bool isCompleteDefinition() const
Return true if this decl has its body fully specified.
Definition: Decl.h:3146
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:2872
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
StringRef getArgText(unsigned Idx) const
Definition: Comment.h:361
bool isFixed() const
Returns true if this is an Objective-C, C++11, or Microsoft-style enumeration with a fixed underlying...
Definition: Decl.h:3506
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:6590
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:3669
decl_range decls() const
decls_begin/decls_end - Iterate over the declarations stored in this context.
Definition: DeclBase.h:2009
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
DeclarationName getName() const
Gets the name looked up.
Definition: ExprCXX.h:2688
bool isConst() const
Definition: Type.h:3495
const char * getName() const
Definition: Stmt.cpp:342
bool isInvalidDecl() const
Definition: DeclBase.h:547
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:2842
Not a TLS variable.
Definition: Decl.h:829
Describes how types, statements, expressions, and declarations should be printed. ...
Definition: PrettyPrinter.h:38
unsigned getIndex(unsigned Depth) const
Definition: Comment.h:852
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:3033
Represents a parameter to a function.
Definition: Decl.h:1536
Represents the result of substituting a type for a template type parameter.
Definition: Type.h:4486
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:1014
const ObjCInterfaceDecl * getSuperClass() const
Definition: DeclObjC.h:2681
ObjCPropertyDecl * getExplicitProperty() const
Definition: ExprObjC.h:670
PipeType - OpenCL20.
Definition: Type.h:5883
Information about a single command.
const char * getStmtClassName() const
Definition: Stmt.cpp:75
SourceLocation getAttributeLoc() const
Definition: Type.h:3119
LabelStmt - Represents a label, which has a substatement.
Definition: Stmt.h:864
Represents a struct/union/class.
Definition: Decl.h:3570
LanguageIDs getLanguage() const
Return the language specified by this linkage specification.
Definition: DeclCXX.h:2851
void dumpColor() const
Definition: ASTDumper.cpp:2758
const TemplateArgumentList & getTemplateArgs() const
Retrieve the template arguments of the class template specialization.
const char * getOpenMPClauseName(OpenMPClauseKind Kind)
Definition: OpenMPKinds.cpp:62
DeclarationName getDeclName() const
Get the actual, stored name of the declaration, which may be a special name.
Definition: Decl.h:297
Provides common interface for the Decls that can be redeclared.
Definition: Redeclarable.h:85
QualType getOriginalType() const
Definition: Type.h:2575
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:3763
QualType getComputationResultType() const
Definition: Expr.h:3340
unsigned getRegParm() const
Definition: Type.h:3406
DeclGroupRef::const_iterator const_decl_iterator
Definition: Stmt.h:546
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:2628
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:3158
The results of name lookup within a DeclContext.
Definition: DeclBase.h:1191
ArrayRef< QualType > getParamTypes() const
Definition: Type.h:3793
attr_iterator attr_end() const
Definition: DeclBase.h:502
RenderKind getRenderKind() const
Definition: Comment.h:353
The template argument is an integral value stored in an llvm::APSInt that was provided for an integra...
Definition: TemplateBase.h:72
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:2663
const DefArgStorage & getDefaultArgStorage() const
Represents a member of a struct/union/class.
Definition: Decl.h:2556
TemplateName getTemplateName() const
Retrieve the name of the template that we are specializing.
Definition: Type.h:4787
TypeSourceInfo * getTypeSourceInfo() const
Returns the declarator information for a base class or delegating initializer.
Definition: DeclCXX.h:2377
An operation on a type.
Definition: TypeVisitor.h:65
StringRef getText() const LLVM_READONLY
Definition: Comment.h:884
StringRef getValue() const
Definition: Decl.h:197
InitKind getInitializerKind() const
Get initializer kind.
Definition: DeclOpenMP.h:173
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:405
void dumpLookups() const
Definition: ASTDumper.cpp:2766
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:4542
Expr * getSourceExpr() const
The source expression of an opaque value expression is the expression which originally generated the ...
Definition: Expr.h:933
void dumpColor() const
dumpColor - same as dump(), but forces color highlighting.
Definition: ASTDumper.cpp:2807
ExtVectorElementExpr - This represents access to specific elements of a vector, and may occur on the ...
Definition: Expr.h:4913
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:3906
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:2231
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:3162
TypeAliasDecl * getTemplatedDecl() const
Get the underlying function declaration of the template.
A command with word-like arguments that is considered inline content.
Definition: Comment.h:299
Describes an C or C++ initializer list.
Definition: Expr.h:3995
Represents a C++ using-declaration.
Definition: DeclCXX.h:3343
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:4444
ArrayRef< BindingDecl * > bindings() const
Definition: DeclCXX.h:3866
Expr * getInitializer()
Get initializer expression (if specified) of the declare reduction construct.
Definition: DeclOpenMP.h:170
UnresolvedUsingTypenameDecl * getDecl() const
Definition: Type.h:4015
bool isBitField() const
Determines whether this field is a bitfield.
Definition: Decl.h:2634
An lvalue ref-qualifier was provided (&).
Definition: Type.h:1371
A line of text contained in a verbatim block.
Definition: Comment.h:864
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:2710
FunctionDecl * getOperatorDelete() const
Definition: ExprCXX.h:2152
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:1331
bool isGlobalNew() const
Definition: ExprCXX.h:2005
A verbatim line command.
Definition: Comment.h:944
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:2824
An x-value expression is a reference to an object with independent storage but which can be "moved"...
Definition: Specifiers.h:119
ExprValueKind getValueKind() const
getValueKind - The value kind that this expression produces.
Definition: Expr.h:404
path_iterator path_begin()
Definition: Expr.h:2879
bool isTypeAlias() const
Determine if this template specialization type is for a type alias template that has been substituted...
Definition: Type.h:4772
PropertyAttributeKind getPropertyAttributes() const
Definition: DeclObjC.h:832
child_range children()
Definition: Stmt.cpp:229
Represents a typeof (or typeof) expression (a GCC extension).
Definition: Type.h:4059
const clang::PrintingPolicy & getPrintingPolicy() const
Definition: ASTContext.h:663
bool containsUnexpandedParameterPack() const
Whether this type is or contains an unexpanded parameter pack, used to support C++0x variadic templat...
Definition: Type.h:1816
A builtin binary operation expression such as "x + y" or "x <= y".
Definition: Expr.h:3102
const Expr * getAssocExpr(unsigned i) const
Definition: Expr.h:4840
const Type * getClass() const
Definition: Type.h:2764
static bool isPostfix(Opcode Op)
isPostfix - Return true if this is a postfix operation, like x++.
Definition: Expr.h:1828
Any part of the comment.
Definition: Comment.h:53
CXXRecordDecl * getDecl() const
Definition: Type.cpp:3216
bool isArrow() const
Definition: Expr.h:2662
bool isConstexpr() const
Whether this variable is (C++11) constexpr.
Definition: Decl.h:1381
FunctionTemplateSpecializationInfo * getTemplateSpecializationInfo() const
If this function is actually a function template specialization, retrieve information about this func...
Definition: Decl.cpp:3447
Expr * getSizeExpr() const
Definition: Type.h:2965
unsigned getIndex() const
Get the index of the template parameter within its parameter list.
bool isAnyMemberInitializer() const
Definition: DeclCXX.h:2324
const Expr * getInitExpr() const
Definition: Decl.h:2782
DiagnosticsEngine & getDiagnostics() const
const Expr * getControllingExpr() const
Definition: Expr.h:4865
CastExpr - Base class for type casts, including both implicit casts (ImplicitCastExpr) and explicit c...
Definition: Expr.h:2790
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
unsigned getParamIndex() const LLVM_READONLY
Definition: Comment.h:786
Represents binding an expression to a temporary.
Definition: ExprCXX.h:1217
DeclContext * getLexicalDeclContext()
getLexicalDeclContext - The declaration context where this Decl was lexically declared (LexicalDC)...
Definition: DeclBase.h:826
SourceLocation getSpellingLoc(SourceLocation Loc) const
Given a SourceLocation object, return the spelling location referenced by the ID. ...
CXXTemporary * getTemporary()
Definition: ExprCXX.h:1236
FieldDecl * getAnyMember() const
Definition: DeclCXX.h:2389
A C++ lambda expression, which produces a function object (of unspecified type) that can be invoked l...
Definition: ExprCXX.h:1611
decl_iterator decl_end()
Definition: Stmt.h:557
PropertyControl getPropertyImplementation() const
Definition: DeclObjC.h:925
void * getAsOpaquePtr() const
Definition: Type.h:687
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:3243
Represents the body of a CapturedStmt, and serves as its DeclContext.
Definition: Decl.h:4013
Represents an ObjC class declaration.
Definition: DeclObjC.h:1164
Represents a linkage specification.
Definition: DeclCXX.h:2817
QualType getReturnType() const
Definition: DeclObjC.h:323
is ARM Neon polynomial vector
Definition: Type.h:3161
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:3657
SplitQualType getSplitDesugaredType() const
Definition: Type.h:946
A binding in a decomposition declaration.
Definition: DeclCXX.h:3786
Expr * getSizeExpr() const
Definition: Type.h:3022
QualType getElementType() const
Definition: Type.h:3118
Represents an extended vector type where either the type or size is dependent.
Definition: Type.h:3102
param_iterator param_begin()
Definition: Decl.h:2243
static void dumpPreviousDeclImpl(raw_ostream &OS,...)
Definition: ASTDumper.cpp:881
Represents the this expression in C++.
Definition: ExprCXX.h:966
Module * getImportedModule() const
Retrieve the module that was imported by the import declaration.
Definition: Decl.h:4162
ObjCIvarDecl * getDecl()
Definition: ExprObjC.h:543
StringRef getArg() const
Definition: Decl.h:164
bool isArrayForm() const
Definition: ExprCXX.h:2141
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:3023
decl_type * getFirstDecl()
Return the first declaration of this declaration or itself if this is the only declaration.
Definition: Redeclarable.h:319
A verbatim block command (e.
Definition: Comment.h:892
const ValueDecl * getExtendingDecl() const
Get the declaration which triggered the lifetime-extension of this temporary, if any.
Definition: ExprCXX.h:4140
StringRef getText() const LLVM_READONLY
Definition: Comment.h:283
bool isStdInitListInitialization() const
Whether this constructor call was written as list-initialization, but was interpreted as forming a st...
Definition: ExprCXX.h:1347
Represents the declaration of a typedef-name via a C++11 alias-declaration.
Definition: Decl.h:3015
ArrayRef< Module * > getModulesWithMergedDefinition(const NamedDecl *Def)
Get the additional modules in which the definition Def has been merged.
Definition: ASTContext.h:999
Represents a prototype with parameter type info, e.g.
Definition: Type.h:3550
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:1325
QualType getComputationLHSType() const
Definition: Expr.h:3337
child_iterator child_end() const
Definition: Comment.cpp:82
bool isDelegatingInitializer() const
Determine whether this initializer is creating a delegating constructor.
Definition: DeclCXX.h:2344
decl_range noload_decls() const
noload_decls_begin/end - Iterate over the declarations stored in this context that are currently load...
Definition: DeclBase.h:2017
UnaryExprOrTypeTraitExpr - expression with either a type or (unevaluated) expression operand...
Definition: Expr.h:2107
bool isParameterPack() const
Whether this parameter is a non-type template parameter pack.
Expr * getCombiner()
Get combiner expression of the declare reduction construct.
Definition: DeclOpenMP.h:152
ValueDecl * getAsDecl() const
Retrieve the declaration for a declaration non-type template argument.
Definition: TemplateBase.h:264
void print(raw_ostream &OS, const PrintingPolicy &Policy) const
Print this nested name specifier to the given output stream.
void outputString(raw_ostream &OS) const
Definition: Expr.cpp:926
CXXCtorInitializer *const * init_const_iterator
Iterates through the member/base initializer list.
Definition: DeclCXX.h:2513
unsigned getValue() const
Definition: Expr.h:1429
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:3000
ObjCMethodDecl * getBoxingMethod() const
Definition: ExprObjC.h:138
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
Definition: DeclTemplate.h:432
bool isCanonicalDecl() const
Whether this particular Decl is a canonical one.
Definition: DeclBase.h:881
QualType getElementType() const
Definition: Type.h:2464
bool isInlineSpecified() const
Determine whether the "inline" keyword was specified for this function.
Definition: Decl.h:2319
Represents a shadow constructor declaration introduced into a class by a C++11 using-declaration that...
Definition: DeclCXX.h:3231
Pepresents a block literal declaration, which is like an unnamed FunctionDecl.
Definition: Decl.h:3835
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:105
StringRef getKindName() const
Definition: Decl.h:3216
QualType getPointeeType() const
Definition: Type.h:2668
bool isDefaulted() const
Whether this function is defaulted per C++0x.
Definition: Decl.h:2013
bool isInvalid() const
Return true if this object is invalid or uninitialized.
std::string Label
static void dumpBasePath(raw_ostream &OS, const CastExpr *Node)
Definition: ASTDumper.cpp:2096
bool isScopedUsingClassTag() const
Returns true if this is a C++11 scoped enumeration.
Definition: Decl.h:3500
Declaration of a template type parameter.
unsigned getIndex() const
Definition: Type.h:4449
The template argument is a null pointer or null pointer to member that was provided for a non-type te...
Definition: TemplateBase.h:68
unsigned getLine() const
Return the presumed line number of this location.
const TypeSourceInfo * getAssocTypeSourceInfo(unsigned i) const
Definition: Expr.h:4850
BlockExpr - Adaptor class for mixing a BlockDecl with expressions.
Definition: Expr.h:4974
VarDecl * getExceptionDecl() const
Definition: StmtCXX.h:50
bool isImplicit() const
isImplicit - Indicates whether the declaration was implicitly generated by the implementation.
Definition: DeclBase.h:552
const char * getTypeClassName() const
Definition: Type.cpp:2637
QualType getArgumentType() const
Definition: Expr.h:2144
comments::CommandTraits & getCommentCommandTraits() const
Definition: ASTContext.h:884
A command that has zero or more word-like arguments (number of word-like arguments depends on command...
Definition: Comment.h:597
DeclContext * getDeclContext()
Definition: DeclBase.h:426
QualType getBaseType() const
Definition: Type.h:4198
ObjCInterfaceDecl * getSuperClass() const
Definition: DeclObjC.cpp:338
ObjCSelectorExpr used for @selector in Objective-C.
Definition: ExprObjC.h:429
TLSKind getTLSKind() const
Definition: Decl.cpp:1926
Represents an expression that computes the length of a parameter pack.
Definition: ExprCXX.h:3765
StorageClass getStorageClass() const
Returns the storage class as written in the source.
Definition: Decl.h:2308
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:3298
IdentifierInfo & getAccessor() const
Definition: Expr.h:4935
Represents the type decltype(expr) (C++11).
Definition: Type.h:4129
decls_iterator decls_begin() const
Definition: ExprCXX.h:2673
int Depth
Definition: ASTDiff.cpp:191
CXXRecordDecl * getConstructedBaseClass() const
Get the base class whose constructor or constructor shadow declaration is passed the constructor argu...
Definition: DeclCXX.h:3314
A std::pair-like structure for storing a qualified type split into its local qualifiers and its local...
Definition: Type.h:581
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:1836
void print(llvm::raw_ostream &OS) const
Prints the full selector name (e.g. "foo:bar:").
QualType getType() const
Definition: Expr.h:127
StorageClass
Storage classes.
Definition: Specifiers.h:206
A unary type transform, which is a type constructed from another.
Definition: Type.h:4172
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:586
bool isDirectionExplicit() const LLVM_READONLY
Definition: Comment.h:750
Declaration of an alias template.
LabelDecl * getLabel() const
Definition: Stmt.h:1317
DeclContext * getParent()
getParent - Returns the containing DeclContext.
Definition: DeclBase.h:1764
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
Represents an unpacked "presumed" location which can be presented to the user.
ObjCMethodDecl * getImplicitPropertyGetter() const
Definition: ExprObjC.h:675
SourceLocation getEnd() const
UnaryOperator - This represents the unary-expression&#39;s (except sizeof and alignof), the postinc/postdec operators from postfix-expression, and various extensions.
Definition: Expr.h:1784
bool isInstanceMethod() const
Definition: DeclObjC.h:414
Represents a GCC generic vector type.
Definition: Type.h:3142
ReceiverKind getReceiverKind() const
Determine the kind of receiver that this message is being sent to.
Definition: ExprObjC.h:1188
An opening HTML tag with attributes.
Definition: Comment.h:414
ArraySizeModifier getSizeModifier() const
Definition: Type.h:2823
TemplateTemplateParmDecl - Declares a template template parameter, e.g., "T" in.
UTTKind getUTTKind() const
Definition: Type.h:4200
StringRef getName() const
Definition: Decl.h:196
ValueDecl * getDecl()
Definition: Expr.h:1056
Selector getSelector() const
Definition: DeclObjC.h:321
std::string getAsString() const
static QualType Desugar(ASTContext &Context, QualType QT, bool &ShouldAKA)
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:2005
bool isNull() const
Return true if this QualType doesn&#39;t point to a type yet.
Definition: Type.h:707
InitializationStyle getInitStyle() const
The style of initialization for this declaration.
Definition: Decl.h:1276
QualType getType() const
Definition: DeclObjC.h:821
bool getValue() const
Definition: ExprCXX.h:563
const SourceManager & SM
Definition: Format.cpp:1472
static const char * getDirectionAsString(PassDirection D)
Definition: Comment.cpp:178
bool defaultArgumentWasInherited() const
Determines whether the default argument was inherited from a previous declaration of this template...
Expr * getUnderlyingExpr() const
Definition: Type.h:4068
init_iterator init_begin()
init_begin() - Retrieve an iterator to the first initializer.
Definition: DeclObjC.h:2613
ExprObjectKind getObjectKind() const
getObjectKind - The object kind that this expression produces.
Definition: Expr.h:411
NestedNameSpecifier * getQualifier() const
Retrieve the nested-name-specifier that qualifies the name.
Definition: DeclCXX.h:3697
bool hasQualifiers() const
Return true if the set contains any qualifiers.
Definition: Type.h:417
SplitQualType split() const
Divides a QualType into its unqualified type and a set of local qualifiers.
Definition: Type.h:5961
const char * getFilename() const
Return the presumed filename of this location.
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:874
is AltiVec &#39;vector Pixel&#39;
Definition: Type.h:3152
This captures a statement into a function.
Definition: Stmt.h:2077
not a target-specific vector type
Definition: Type.h:3146
ExceptionSpecificationType Type
The kind of exception specification this is.
Definition: Type.h:3647
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:3797
unsigned getColumn() const
Return the presumed column number of this location.
bool isParameterPack() const
Returns whether this is a parameter pack.
Encodes a location in the source.
bool getSynthesize() const
Definition: DeclObjC.h:1983
ObjCInterfaceDecl * getDecl() const
Get the declaration of this interface.
Definition: Type.h:5632
QualType getReturnType() const
Definition: Type.h:3483
bool isPure() const
Whether this virtual function is pure, i.e.
Definition: Decl.h:1988
ObjCProtocolList::iterator protocol_iterator
Definition: DeclObjC.h:2345
This represents &#39;#pragma omp declare reduction ...&#39; directive.
Definition: DeclOpenMP.h:102
decl_iterator decls_begin() const
Definition: DeclBase.cpp:1350
NestedNameSpecifier * getQualifier() const
Retrieve the nested-name-specifier that qualifies the name.
Definition: DeclCXX.h:3607
Pseudo declaration for capturing expressions.
Definition: DeclOpenMP.h:216
Represents a C++ temporary.
Definition: ExprCXX.h:1185
Interfaces are the core concept in Objective-C for object oriented design.
Definition: Type.h:5619
bool isVariablyModifiedType() const
Whether this type is a variably-modified type (C99 6.7.5).
Definition: Type.h:2072
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:1873
bool wasDeclaredWithTypename() const
Whether this template type parameter was declared with the &#39;typename&#39; keyword.
ArrayRef< const Attr * > getAttrs() const
Definition: Stmt.h:939
TemplateArgument getArgumentPack() const
Definition: Type.cpp:3233
SourceRange getSourceRange() const LLVM_READONLY
Definition: Comment.h:216
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:3177
bool isParamIndexValid() const LLVM_READONLY
Definition: Comment.h:773
DeclStmt - Adaptor class for mixing declarations with statements and expressions. ...
Definition: Stmt.h:505
Represents the declaration of a label.
Definition: Decl.h:468
Represents a dependent using declaration which was not marked with typename.
Definition: DeclCXX.h:3562
Expr * getInClassInitializer() const
Get the C++11 default member initializer for this member, or null if one has not been set...
Definition: Decl.h:2698
Stmt * getBody() const override
Retrieve the body of this method, if it has one.
Definition: DeclObjC.cpp:852
const CommandInfo * getCommandInfo(StringRef Name) const
bool isRestrict() const
Definition: Type.h:3497
Represents a static or instance method of a struct/union/class.
Definition: DeclCXX.h:2043
QualType getLocallyUnqualifiedSingleStepDesugaredType() const
Pull a single level of sugar off of this locally-unqualified type.
Definition: Type.cpp:294
std::string getValueAsString(unsigned Radix) const
Definition: Expr.cpp:782
bool canOverflow() const
Returns true if the unary operator can cause an overflow.
Definition: Expr.h:1824
No ref-qualifier was provided.
Definition: Type.h:1368
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:4450
bool isLiteral(TokenKind K)
Return true if this is a "literal" kind, like a numeric constant, string, etc.
Definition: TokenKinds.h:87
ObjCCategoryDecl - Represents a category declaration.
Definition: DeclObjC.h:2272
const TemplateTypeParmType * getReplacedParameter() const
Gets the template parameter that was substituted for.
Definition: Type.h:4560
UnaryExprOrTypeTrait getKind() const
Definition: Expr.h:2138
bool hasExternalLexicalStorage() const
Whether this DeclContext has external storage containing additional declarations that are lexically i...
Definition: DeclBase.h:2324
bool isArray() const
Definition: ExprCXX.h:1978
bool isScoped() const
Returns true if this is a C++11 scoped enumeration.
Definition: Decl.h:3497
decl_iterator decl_begin()
Definition: Stmt.h:556
ObjCProtocolExpr used for protocol expression in Objective-C.
Definition: ExprObjC.h:474
Comment *const * child_iterator
Definition: Comment.h:224
StringRef getParamNameAsWritten() const
Definition: Comment.h:835
bool hasDefaultArgument() const
Determine whether this template parameter has a default argument.
is AltiVec &#39;vector bool ...&#39;
Definition: Type.h:3155
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:3304
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:2924
bool isFromASTFile() const
Determine whether this declaration came from an AST file (such as a precompiled header or module) rat...
Definition: DeclBase.h:700
bool isMessagingGetter() const
True if the property reference will result in a message to the getter.
Definition: ExprObjC.h:700
PassDirection getDirection() const LLVM_READONLY
Definition: Comment.h:746
is AltiVec vector
Definition: Type.h:3149
Qualifiers getIndexTypeQualifiers() const
Definition: Type.h:2827
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
IdentType getIdentType() const
Definition: Expr.h:1231
bool isOriginalNamespace() const
Return true if this declaration is an original (first) declaration of the namespace.
Definition: DeclCXX.cpp:2574
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:3737
A closing HTML tag.
Definition: Comment.h:508
An rvalue ref-qualifier was provided (&&).
Definition: Type.h:1374
SourceRange getBracketsRange() const
Definition: Type.h:3028
decl_iterator noload_decls_end() const
Definition: DeclBase.h:2021
ObjCBoxedExpr - used for generalized expression boxing.
Definition: ExprObjC.h:117
bool isArgumentType() const
Definition: Expr.h:2143
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:5261
Expr * getArrayFiller()
If this initializer list initializes an array with more elements than there are initializers in the l...
Definition: Expr.h:4089
bool isPartOfExplicitCast() const
Definition: Expr.h:2949
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:2062
Describes a module import declaration, which makes the contents of the named module visible in the cu...
Definition: Decl.h:4118
Doxygen \tparam command, describes a template parameter.
Definition: Comment.h:800
The injected class name of a C++ class template or class template partial specialization.
Definition: Type.h:4859
Represents a pack expansion of types.
Definition: Type.h:5236
CompoundAssignOperator - For compound assignments (e.g.
Definition: Expr.h:3314
static const char * getStorageClassSpecifierString(StorageClass SC)
Return the string used to specify the storage class SC.
Definition: Decl.cpp:1878
Represents a C11 generic selection.
Definition: Expr.h:4807
ArrayRef< TemplateArgument > getPartialArguments() const
Get.
Definition: ExprCXX.h:3858
SourceRange getRange() const
Definition: Attr.h:94
AddrLabelExpr - The GNU address of label extension, representing &&label.
Definition: Expr.h:3567
ast_type_traits::DynTypedNode Node
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:580
bool isDeduced() const
Definition: Type.h:4621
Represents a type which was implicitly adjusted by the semantic engine for arbitrary reasons...
Definition: Type.h:2559
const ObjCInterfaceDecl * getClassInterface() const
Definition: DeclObjC.h:2432
NamespaceDecl * getNominatedNamespace()
Returns the namespace nominated by this using-directive.
Definition: DeclCXX.cpp:2529
unsigned getNumAssocs() const
Definition: Expr.h:4834
Dataflow Directional Tag Classes.
bool isResultDependent() const
Whether this generic selection is result-dependent.
Definition: Expr.h:4871
ExtInfo getExtInfo() const
Definition: Type.h:3494
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:1203
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
Definition: DeclBase.h:1267
Represents a delete expression for memory deallocation and destructor calls, e.g. ...
Definition: ExprCXX.h:2100
ArrayRef< Capture > captures() const
Definition: Decl.h:3954
The base class of all kinds of template declarations (e.g., class, function, etc.).
Definition: DeclTemplate.h:399
bool isVariadic() const
Definition: Decl.h:3902
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
void dump() const
Definition: ASTDumper.cpp:2730
Represents a field injected from an anonymous union/struct into the parent scope. ...
Definition: Decl.h:2802
QualType getUnderlyingType() const
Definition: Decl.h:2948
AttrVec::const_iterator attr_iterator
Definition: DeclBase.h:492
AccessSpecifier getAccess() const
Definition: DeclBase.h:461
const Expr * getInit() const
Definition: Decl.h:1217
NamespaceDecl * getOriginalNamespace()
Get the original (first) namespace declaration.
Definition: DeclCXX.cpp:2560
A decomposition declaration.
Definition: DeclCXX.h:3834
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.
DeclarationName getMember() const
Retrieve the name of the member that this expression refers to.
Definition: ExprCXX.h:3375
Represents a dependent using declaration which was marked with typename.
Definition: DeclCXX.h:3658
DeclarationName - The name of a declaration.
Represents the declaration of an Objective-C type parameter.
Definition: DeclObjC.h:551
VectorKind getVectorKind() const
Definition: Type.h:3187
static std::string getAsString(SplitQualType split, const PrintingPolicy &Policy)
Definition: Type.h:975
Kind getKind() const
Definition: DeclBase.h:420
bool isListInitialization() const
Whether this constructor call was written as list-initialization.
Definition: ExprCXX.h:1340
const Type * getBaseClass() const
If this is a base class initializer, returns the type of the base class.
Definition: DeclCXX.cpp:2229
Represents an enum.
Definition: Decl.h:3303
PresumedLoc getPresumedLoc(SourceLocation Loc, bool UseLineDirectives=true) const
Returns the "presumed" location of a SourceLocation specifies.
A pointer to member type per C++ 8.3.3 - Pointers to members.
Definition: Type.h:2730
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:4501
const ObjCInterfaceDecl * getClassInterface() const
Definition: DeclObjC.h:2739
bool isHidden() const
Determine whether this declaration might be hidden from name lookup.
Definition: DeclBase.h:772
llvm::APInt getValue() const
Definition: Expr.h:1295
const DefArgStorage & getDefaultArgStorage() const
QualType getModifiedType() const
Definition: Type.h:4333
LabelDecl * getLabel() const
Definition: Expr.h:3589
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:2880
Represents a pointer to an Objective C object.
Definition: Type.h:5675
StringRef getTagName() const LLVM_READONLY
Definition: Comment.h:396
Pointer to a block type.
Definition: Type.h:2613
bool needsOverloadResolutionForMoveConstructor() const
Determine whether we need to eagerly declare a defaulted move constructor for this class...
Definition: DeclCXX.h:1101
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:3661
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:4253
Complex values, per C99 6.2.5p11.
Definition: Type.h:2451
Location wrapper for a TemplateArgument.
Definition: TemplateBase.h:450
static const CommandInfo * getBuiltinCommandInfo(StringRef Name)
void dump() const
Dumps the specified AST fragment and all subtrees to llvm::errs().
Definition: ASTDumper.cpp:2802
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:2250
static StringRef getIdentTypeName(IdentType IT)
Definition: Expr.cpp:473
This template specialization was declared or defined by an explicit specialization (C++ [temp...
Definition: Specifiers.h:156
unsigned getNumObjects() const
Definition: ExprCXX.h:3066
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:1799
const llvm::APInt & getSize() const
Definition: Type.h:2864
protocol_iterator protocol_begin() const
Definition: DeclObjC.h:2352
bool hasBody() const override
Determine whether this method has a body.
Definition: DeclObjC.h:496
Opcode getOpcode() const
Definition: Expr.h:1808
Base for LValueReferenceType and RValueReferenceType.
Definition: Type.h:2647
SourceRange getBracketsRange() const
Definition: Type.h:2971
static const char * getCastKindName(CastKind CK)
Definition: Expr.cpp:1671
bool isVolatile() const
Definition: Type.h:3496
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:3337
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:671
bool isPartiallySubstituted() const
Determine whether this represents a partially-substituted sizeof...
Definition: ExprCXX.h:3853
bool capturesCXXThis() const
Definition: Decl.h:3959
Describes an explicit type conversion that uses functional notion but could not be resolved because o...
Definition: ExprCXX.h:3122
GotoStmt - This represents a direct goto.
Definition: Stmt.h:1305
A template argument list.
Definition: DeclTemplate.h:210
TypedefNameDecl * getDecl() const
Definition: Type.h:4050
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:1109
ArgKind getKind() const
Return the kind of stored template argument.
Definition: TemplateBase.h:235
unsigned getDepth() const
Definition: Type.h:4448
An attributed type is a type to which a type attribute has been applied.
Definition: Type.h:4308
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
MemberExpr - [C99 6.5.2.3] Structure and Union Members.
Definition: Expr.h:2467
bool isMutable() const
Determines whether this field is mutable (C++ only).
Definition: Decl.h:2631
Represents a C++ struct/union/class.
Definition: DeclCXX.h:300
const char * getCommentKindName() const
Definition: Comment.cpp:21
bool isValid() const
bool isNRVOVariable() const
Determine whether this local variable can be used with the named return value optimization (NRVO)...
Definition: Decl.h:1322
Represents a loop initializing the elements of an array.
Definition: Expr.h:4613
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:5267
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:1494
The parameter type of a method or function.
ObjCIvarDecl - Represents an ObjC instance variable.
Definition: DeclObjC.h:1937
CleanupObject getObject(unsigned i) const
Definition: ExprCXX.h:3068
bool isInherited() const
Definition: Attr.h:97
const Attribute & getAttr(unsigned Idx) const
Definition: Comment.h:477
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:899
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:268
bool isGlobalDelete() const
Definition: ExprCXX.h:2140
StringLiteral - This represents a string literal expression, e.g.
Definition: Expr.h:1568
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:3457
bool doesThisDeclarationHaveABody() const
Returns whether this specific declaration of the function has a body.
Definition: Decl.h:1968
StringRef getName() const
Get the name of identifier for this declaration as a StringRef.
Definition: Decl.h:275
StringRef getParamNameAsWritten() const
Definition: Comment.h:765
NestedNameSpecifier * getQualifier() const
Retrieve the nested-name-specifier that qualifies the name.
Definition: DeclCXX.h:3386
void dump(const char *s) const
Definition: ASTDumper.cpp:2724
void dump() const
Definition: ASTDumper.cpp:2747
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:3323
Abstract class common to all of the C++ "named"/"keyword" casts.
Definition: ExprCXX.h:246
unsigned getNumElements() const
Definition: Type.h:3178
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:2056
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:971
Represents a type template specialization; the template must be a class template, a type alias templa...
Definition: Type.h:4724
ArrayRef< ParmVarDecl * > parameters() const
Definition: Decl.h:3913
ObjCPropertyDecl * getPropertyDecl() const
Definition: DeclObjC.h:2810
ObjCTypeParamVariance getVariance() const
Determine the variance of this type parameter.
Definition: DeclObjC.h:594
Doxygen \param command.
Definition: Comment.h:712
bool isDeleted() const
Whether this function has been deleted.
Definition: Decl.h:2115
Expr * getBinding() const
Get the expression to which this declaration is bound.
Definition: DeclCXX.h:3808
DeclContext * getPrimaryContext()
getPrimaryContext - There may be many different declarations of the same entity (including forward de...
Definition: DeclBase.cpp:1137
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:4107
varlist_range varlists()
Definition: DeclOpenMP.h:77
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:3160
static StringRef getNameForCallConv(CallingConv CC)
Definition: Type.cpp:2809
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:601
static StringRef getOpcodeStr(Opcode Op)
getOpcodeStr - Turn an Opcode enum value into the punctuation char it corresponds to...
Definition: Expr.cpp:1151
ObjCMethodDecl * getGetterMethodDecl() const
Definition: DeclObjC.h:914
CXXRecordDecl * getNominatedBaseClass() const
Get the base class that was named in the using declaration.
Definition: DeclCXX.cpp:2668
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:550
bool isTranslationUnit() const
Definition: DeclBase.h:1835
StringRef getParamName(const FullComment *FC) const
Definition: Comment.cpp:364
Represents a C array with a specified size that is not an integer-constant-expression.
Definition: Type.h:2945
Represents a C++ namespace alias.
Definition: DeclCXX.h:3011
bool isInline() const
Whether this variable is (C++1z) inline.
Definition: Decl.h:1363
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:2907
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:856
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:77
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:3019
bool hasInit() const
Definition: Decl.cpp:2154
SourceLocation getBegin() const
NamedDecl * getPack() const
Retrieve the parameter pack.
Definition: ExprCXX.h:3836
This represents &#39;#pragma omp threadprivate ...&#39; directive.
Definition: DeclOpenMP.h:39
decls_iterator decls_end() const
Definition: ExprCXX.h:2674
ObjCCategoryImplDecl - An object of this class encapsulates a category @implementation declaration...
Definition: DeclObjC.h:2491
Represents the canonical version of C arrays with a specified constant size.
Definition: Type.h:2846
This class handles loading and caching of source files into memory.
The parameter is invariant: must match exactly.
ExceptionSpecInfo ExceptionSpec
Definition: Type.h:3675
Defines enum values for all the target-independent builtin functions.
Declaration of a template function.
Definition: DeclTemplate.h:968
Attr - This represents one attribute.
Definition: Attr.h:43
bool isDeletedAsWritten() const
Definition: Decl.h:2119
SourceLocation getLocation() const
Definition: DeclBase.h:417
const StringLiteral * getAsmString() const
Definition: Decl.h:3824
QualType getPointeeType() const
Definition: Type.h:2750
Represents a shadow declaration introduced into a scope by a (resolved) using declaration.
Definition: DeclCXX.h:3130
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:3107
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:2011
QualType getPointeeType() const
Gets the type pointed to by this ObjC pointer.
Definition: Type.h:5691
QualType getType() const
Retrieves the type of the base class.
Definition: DeclCXX.h:291