clang  3.9.0
ASTDumper.cpp
Go to the documentation of this file.
1 //===--- ASTDumper.cpp - Dumping implementation for ASTs ------------------===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file implements the AST dump methods, which dump out the
11 // AST in a form that exposes type details and other fields.
12 //
13 //===----------------------------------------------------------------------===//
14 
15 #include "clang/AST/ASTContext.h"
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  /// Pending[i] is an action to dump an entity at level i.
104 
105  /// Indicates whether we're at the top level.
106  bool TopLevel;
107 
108  /// Indicates if we're handling the first child after entering a new depth.
109  bool FirstChild;
110 
111  /// Prefix for currently-being-dumped entity.
112  std::string Prefix;
113 
114  /// Keep track of the last location we print out so that we can
115  /// print out deltas from then on out.
116  const char *LastLocFilename;
117  unsigned LastLocLine;
118 
119  /// The \c FullComment parent of the comment being dumped.
120  const FullComment *FC;
121 
122  bool ShowColors;
123 
124  /// Dump a child of the current node.
125  template<typename Fn> void dumpChild(Fn doDumpChild) {
126  // If we're at the top level, there's nothing interesting to do; just
127  // run the dumper.
128  if (TopLevel) {
129  TopLevel = false;
130  doDumpChild();
131  while (!Pending.empty()) {
132  Pending.back()(true);
133  Pending.pop_back();
134  }
135  Prefix.clear();
136  OS << "\n";
137  TopLevel = true;
138  return;
139  }
140 
141  const FullComment *OrigFC = FC;
142  auto dumpWithIndent = [this, doDumpChild, OrigFC](bool isLastChild) {
143  // Print out the appropriate tree structure and work out the prefix for
144  // children of this node. For instance:
145  //
146  // A Prefix = ""
147  // |-B Prefix = "| "
148  // | `-C Prefix = "| "
149  // `-D Prefix = " "
150  // |-E Prefix = " | "
151  // `-F Prefix = " "
152  // G Prefix = ""
153  //
154  // Note that the first level gets no prefix.
155  {
156  OS << '\n';
157  ColorScope Color(*this, IndentColor);
158  OS << Prefix << (isLastChild ? '`' : '|') << '-';
159  this->Prefix.push_back(isLastChild ? ' ' : '|');
160  this->Prefix.push_back(' ');
161  }
162 
163  FirstChild = true;
164  unsigned Depth = Pending.size();
165 
166  FC = OrigFC;
167  doDumpChild();
168 
169  // If any children are left, they're the last at their nesting level.
170  // Dump those ones out now.
171  while (Depth < Pending.size()) {
172  Pending.back()(true);
173  this->Pending.pop_back();
174  }
175 
176  // Restore the old prefix.
177  this->Prefix.resize(Prefix.size() - 2);
178  };
179 
180  if (FirstChild) {
181  Pending.push_back(std::move(dumpWithIndent));
182  } else {
183  Pending.back()(false);
184  Pending.back() = std::move(dumpWithIndent);
185  }
186  FirstChild = false;
187  }
188 
189  class ColorScope {
190  ASTDumper &Dumper;
191  public:
192  ColorScope(ASTDumper &Dumper, TerminalColor Color)
193  : Dumper(Dumper) {
194  if (Dumper.ShowColors)
195  Dumper.OS.changeColor(Color.Color, Color.Bold);
196  }
197  ~ColorScope() {
198  if (Dumper.ShowColors)
199  Dumper.OS.resetColor();
200  }
201  };
202 
203  public:
204  ASTDumper(raw_ostream &OS, const CommandTraits *Traits,
205  const SourceManager *SM)
206  : OS(OS), Traits(Traits), SM(SM), TopLevel(true), FirstChild(true),
207  LastLocFilename(""), LastLocLine(~0U), FC(nullptr),
208  ShowColors(SM && SM->getDiagnostics().getShowColors()) { }
209 
210  ASTDumper(raw_ostream &OS, const CommandTraits *Traits,
211  const SourceManager *SM, bool ShowColors)
212  : OS(OS), Traits(Traits), SM(SM), TopLevel(true), FirstChild(true),
213  LastLocFilename(""), LastLocLine(~0U),
214  ShowColors(ShowColors) { }
215 
216  void dumpDecl(const Decl *D);
217  void dumpStmt(const Stmt *S);
218  void dumpFullComment(const FullComment *C);
219 
220  // Utilities
221  void dumpPointer(const void *Ptr);
222  void dumpSourceRange(SourceRange R);
223  void dumpLocation(SourceLocation Loc);
224  void dumpBareType(QualType T, bool Desugar = true);
225  void dumpType(QualType T);
226  void dumpTypeAsChild(QualType T);
227  void dumpTypeAsChild(const Type *T);
228  void dumpBareDeclRef(const Decl *Node);
229  void dumpDeclRef(const Decl *Node, const char *Label = nullptr);
230  void dumpName(const NamedDecl *D);
231  bool hasNodes(const DeclContext *DC);
232  void dumpDeclContext(const DeclContext *DC);
233  void dumpLookups(const DeclContext *DC, bool DumpDecls);
234  void dumpAttr(const Attr *A);
235 
236  // C++ Utilities
237  void dumpAccessSpecifier(AccessSpecifier AS);
238  void dumpCXXCtorInitializer(const CXXCtorInitializer *Init);
239  void dumpTemplateParameters(const TemplateParameterList *TPL);
240  void dumpTemplateArgumentListInfo(const TemplateArgumentListInfo &TALI);
241  void dumpTemplateArgumentLoc(const TemplateArgumentLoc &A);
242  void dumpTemplateArgumentList(const TemplateArgumentList &TAL);
243  void dumpTemplateArgument(const TemplateArgument &A,
244  SourceRange R = SourceRange());
245 
246  // Objective-C utilities.
247  void dumpObjCTypeParamList(const ObjCTypeParamList *typeParams);
248 
249  // Types
250  void VisitComplexType(const ComplexType *T) {
251  dumpTypeAsChild(T->getElementType());
252  }
253  void VisitPointerType(const PointerType *T) {
254  dumpTypeAsChild(T->getPointeeType());
255  }
256  void VisitBlockPointerType(const BlockPointerType *T) {
257  dumpTypeAsChild(T->getPointeeType());
258  }
259  void VisitReferenceType(const ReferenceType *T) {
260  dumpTypeAsChild(T->getPointeeType());
261  }
262  void VisitRValueReferenceType(const ReferenceType *T) {
263  if (T->isSpelledAsLValue())
264  OS << " written as lvalue reference";
265  VisitReferenceType(T);
266  }
267  void VisitMemberPointerType(const MemberPointerType *T) {
268  dumpTypeAsChild(T->getClass());
269  dumpTypeAsChild(T->getPointeeType());
270  }
271  void VisitArrayType(const ArrayType *T) {
272  switch (T->getSizeModifier()) {
273  case ArrayType::Normal: break;
274  case ArrayType::Static: OS << " static"; break;
275  case ArrayType::Star: OS << " *"; break;
276  }
277  OS << " " << T->getIndexTypeQualifiers().getAsString();
278  dumpTypeAsChild(T->getElementType());
279  }
280  void VisitConstantArrayType(const ConstantArrayType *T) {
281  OS << " " << T->getSize();
282  VisitArrayType(T);
283  }
284  void VisitVariableArrayType(const VariableArrayType *T) {
285  OS << " ";
286  dumpSourceRange(T->getBracketsRange());
287  VisitArrayType(T);
288  dumpStmt(T->getSizeExpr());
289  }
290  void VisitDependentSizedArrayType(const DependentSizedArrayType *T) {
291  VisitArrayType(T);
292  OS << " ";
293  dumpSourceRange(T->getBracketsRange());
294  dumpStmt(T->getSizeExpr());
295  }
296  void VisitDependentSizedExtVectorType(
297  const DependentSizedExtVectorType *T) {
298  OS << " ";
299  dumpLocation(T->getAttributeLoc());
300  dumpTypeAsChild(T->getElementType());
301  dumpStmt(T->getSizeExpr());
302  }
303  void VisitVectorType(const VectorType *T) {
304  switch (T->getVectorKind()) {
305  case VectorType::GenericVector: break;
306  case VectorType::AltiVecVector: OS << " altivec"; break;
307  case VectorType::AltiVecPixel: OS << " altivec pixel"; break;
308  case VectorType::AltiVecBool: OS << " altivec bool"; break;
309  case VectorType::NeonVector: OS << " neon"; break;
310  case VectorType::NeonPolyVector: OS << " neon poly"; break;
311  }
312  OS << " " << T->getNumElements();
313  dumpTypeAsChild(T->getElementType());
314  }
315  void VisitFunctionType(const FunctionType *T) {
316  auto EI = T->getExtInfo();
317  if (EI.getNoReturn()) OS << " noreturn";
318  if (EI.getProducesResult()) OS << " produces_result";
319  if (EI.getHasRegParm()) OS << " regparm " << EI.getRegParm();
320  OS << " " << FunctionType::getNameForCallConv(EI.getCC());
321  dumpTypeAsChild(T->getReturnType());
322  }
323  void VisitFunctionProtoType(const FunctionProtoType *T) {
324  auto EPI = T->getExtProtoInfo();
325  if (EPI.HasTrailingReturn) OS << " trailing_return";
326  if (T->isConst()) OS << " const";
327  if (T->isVolatile()) OS << " volatile";
328  if (T->isRestrict()) OS << " restrict";
329  switch (EPI.RefQualifier) {
330  case RQ_None: break;
331  case RQ_LValue: OS << " &"; break;
332  case RQ_RValue: OS << " &&"; break;
333  }
334  // FIXME: Exception specification.
335  // FIXME: Consumed parameters.
336  VisitFunctionType(T);
337  for (QualType PT : T->getParamTypes())
338  dumpTypeAsChild(PT);
339  if (EPI.Variadic)
340  dumpChild([=] { OS << "..."; });
341  }
342  void VisitUnresolvedUsingType(const UnresolvedUsingType *T) {
343  dumpDeclRef(T->getDecl());
344  }
345  void VisitTypedefType(const TypedefType *T) {
346  dumpDeclRef(T->getDecl());
347  }
348  void VisitTypeOfExprType(const TypeOfExprType *T) {
349  dumpStmt(T->getUnderlyingExpr());
350  }
351  void VisitDecltypeType(const DecltypeType *T) {
352  dumpStmt(T->getUnderlyingExpr());
353  }
354  void VisitUnaryTransformType(const UnaryTransformType *T) {
355  switch (T->getUTTKind()) {
357  OS << " underlying_type";
358  break;
359  }
360  dumpTypeAsChild(T->getBaseType());
361  }
362  void VisitTagType(const TagType *T) {
363  dumpDeclRef(T->getDecl());
364  }
365  void VisitAttributedType(const AttributedType *T) {
366  // FIXME: AttrKind
367  dumpTypeAsChild(T->getModifiedType());
368  }
369  void VisitTemplateTypeParmType(const TemplateTypeParmType *T) {
370  OS << " depth " << T->getDepth() << " index " << T->getIndex();
371  if (T->isParameterPack()) OS << " pack";
372  dumpDeclRef(T->getDecl());
373  }
374  void VisitSubstTemplateTypeParmType(const SubstTemplateTypeParmType *T) {
375  dumpTypeAsChild(T->getReplacedParameter());
376  }
377  void VisitSubstTemplateTypeParmPackType(
379  dumpTypeAsChild(T->getReplacedParameter());
380  dumpTemplateArgument(T->getArgumentPack());
381  }
382  void VisitAutoType(const AutoType *T) {
383  if (T->isDecltypeAuto()) OS << " decltype(auto)";
384  if (!T->isDeduced())
385  OS << " undeduced";
386  }
387  void VisitTemplateSpecializationType(const TemplateSpecializationType *T) {
388  if (T->isTypeAlias()) OS << " alias";
389  OS << " "; T->getTemplateName().dump(OS);
390  for (auto &Arg : *T)
391  dumpTemplateArgument(Arg);
392  if (T->isTypeAlias())
393  dumpTypeAsChild(T->getAliasedType());
394  }
395  void VisitInjectedClassNameType(const InjectedClassNameType *T) {
396  dumpDeclRef(T->getDecl());
397  }
398  void VisitObjCInterfaceType(const ObjCInterfaceType *T) {
399  dumpDeclRef(T->getDecl());
400  }
401  void VisitObjCObjectPointerType(const ObjCObjectPointerType *T) {
402  dumpTypeAsChild(T->getPointeeType());
403  }
404  void VisitAtomicType(const AtomicType *T) {
405  dumpTypeAsChild(T->getValueType());
406  }
407  void VisitPipeType(const PipeType *T) {
408  dumpTypeAsChild(T->getElementType());
409  }
410  void VisitAdjustedType(const AdjustedType *T) {
411  dumpTypeAsChild(T->getOriginalType());
412  }
413  void VisitPackExpansionType(const PackExpansionType *T) {
414  if (auto N = T->getNumExpansions()) OS << " expansions " << *N;
415  if (!T->isSugared())
416  dumpTypeAsChild(T->getPattern());
417  }
418  // FIXME: ElaboratedType, DependentNameType,
419  // DependentTemplateSpecializationType, ObjCObjectType
420 
421  // Decls
422  void VisitLabelDecl(const LabelDecl *D);
423  void VisitTypedefDecl(const TypedefDecl *D);
424  void VisitEnumDecl(const EnumDecl *D);
425  void VisitRecordDecl(const RecordDecl *D);
426  void VisitEnumConstantDecl(const EnumConstantDecl *D);
427  void VisitIndirectFieldDecl(const IndirectFieldDecl *D);
428  void VisitFunctionDecl(const FunctionDecl *D);
429  void VisitFieldDecl(const FieldDecl *D);
430  void VisitVarDecl(const VarDecl *D);
431  void VisitFileScopeAsmDecl(const FileScopeAsmDecl *D);
432  void VisitImportDecl(const ImportDecl *D);
433  void VisitPragmaCommentDecl(const PragmaCommentDecl *D);
434  void VisitPragmaDetectMismatchDecl(const PragmaDetectMismatchDecl *D);
435  void VisitCapturedDecl(const CapturedDecl *D);
436 
437  // OpenMP decls
438  void VisitOMPThreadPrivateDecl(const OMPThreadPrivateDecl *D);
439  void VisitOMPDeclareReductionDecl(const OMPDeclareReductionDecl *D);
440  void VisitOMPCapturedExprDecl(const OMPCapturedExprDecl *D);
441 
442  // C++ Decls
443  void VisitNamespaceDecl(const NamespaceDecl *D);
444  void VisitUsingDirectiveDecl(const UsingDirectiveDecl *D);
445  void VisitNamespaceAliasDecl(const NamespaceAliasDecl *D);
446  void VisitTypeAliasDecl(const TypeAliasDecl *D);
447  void VisitTypeAliasTemplateDecl(const TypeAliasTemplateDecl *D);
448  void VisitCXXRecordDecl(const CXXRecordDecl *D);
449  void VisitStaticAssertDecl(const StaticAssertDecl *D);
450  template<typename SpecializationDecl>
451  void VisitTemplateDeclSpecialization(const SpecializationDecl *D,
452  bool DumpExplicitInst,
453  bool DumpRefOnly);
454  template<typename TemplateDecl>
455  void VisitTemplateDecl(const TemplateDecl *D, bool DumpExplicitInst);
456  void VisitFunctionTemplateDecl(const FunctionTemplateDecl *D);
457  void VisitClassTemplateDecl(const ClassTemplateDecl *D);
458  void VisitClassTemplateSpecializationDecl(
460  void VisitClassTemplatePartialSpecializationDecl(
462  void VisitClassScopeFunctionSpecializationDecl(
464  void VisitBuiltinTemplateDecl(const BuiltinTemplateDecl *D);
465  void VisitVarTemplateDecl(const VarTemplateDecl *D);
466  void VisitVarTemplateSpecializationDecl(
468  void VisitVarTemplatePartialSpecializationDecl(
470  void VisitTemplateTypeParmDecl(const TemplateTypeParmDecl *D);
471  void VisitNonTypeTemplateParmDecl(const NonTypeTemplateParmDecl *D);
472  void VisitTemplateTemplateParmDecl(const TemplateTemplateParmDecl *D);
473  void VisitUsingDecl(const UsingDecl *D);
474  void VisitUnresolvedUsingTypenameDecl(const UnresolvedUsingTypenameDecl *D);
475  void VisitUnresolvedUsingValueDecl(const UnresolvedUsingValueDecl *D);
476  void VisitUsingShadowDecl(const UsingShadowDecl *D);
477  void VisitConstructorUsingShadowDecl(const ConstructorUsingShadowDecl *D);
478  void VisitLinkageSpecDecl(const LinkageSpecDecl *D);
479  void VisitAccessSpecDecl(const AccessSpecDecl *D);
480  void VisitFriendDecl(const FriendDecl *D);
481 
482  // ObjC Decls
483  void VisitObjCIvarDecl(const ObjCIvarDecl *D);
484  void VisitObjCMethodDecl(const ObjCMethodDecl *D);
485  void VisitObjCTypeParamDecl(const ObjCTypeParamDecl *D);
486  void VisitObjCCategoryDecl(const ObjCCategoryDecl *D);
487  void VisitObjCCategoryImplDecl(const ObjCCategoryImplDecl *D);
488  void VisitObjCProtocolDecl(const ObjCProtocolDecl *D);
489  void VisitObjCInterfaceDecl(const ObjCInterfaceDecl *D);
490  void VisitObjCImplementationDecl(const ObjCImplementationDecl *D);
491  void VisitObjCCompatibleAliasDecl(const ObjCCompatibleAliasDecl *D);
492  void VisitObjCPropertyDecl(const ObjCPropertyDecl *D);
493  void VisitObjCPropertyImplDecl(const ObjCPropertyImplDecl *D);
494  void VisitBlockDecl(const BlockDecl *D);
495 
496  // Stmts.
497  void VisitStmt(const Stmt *Node);
498  void VisitDeclStmt(const DeclStmt *Node);
499  void VisitAttributedStmt(const AttributedStmt *Node);
500  void VisitLabelStmt(const LabelStmt *Node);
501  void VisitGotoStmt(const GotoStmt *Node);
502  void VisitCXXCatchStmt(const CXXCatchStmt *Node);
503  void VisitCapturedStmt(const CapturedStmt *Node);
504 
505  // OpenMP
506  void VisitOMPExecutableDirective(const OMPExecutableDirective *Node);
507 
508  // Exprs
509  void VisitExpr(const Expr *Node);
510  void VisitCastExpr(const CastExpr *Node);
511  void VisitDeclRefExpr(const DeclRefExpr *Node);
512  void VisitPredefinedExpr(const PredefinedExpr *Node);
513  void VisitCharacterLiteral(const CharacterLiteral *Node);
514  void VisitIntegerLiteral(const IntegerLiteral *Node);
515  void VisitFloatingLiteral(const FloatingLiteral *Node);
516  void VisitStringLiteral(const StringLiteral *Str);
517  void VisitInitListExpr(const InitListExpr *ILE);
518  void VisitUnaryOperator(const UnaryOperator *Node);
519  void VisitUnaryExprOrTypeTraitExpr(const UnaryExprOrTypeTraitExpr *Node);
520  void VisitMemberExpr(const MemberExpr *Node);
521  void VisitExtVectorElementExpr(const ExtVectorElementExpr *Node);
522  void VisitBinaryOperator(const BinaryOperator *Node);
523  void VisitCompoundAssignOperator(const CompoundAssignOperator *Node);
524  void VisitAddrLabelExpr(const AddrLabelExpr *Node);
525  void VisitBlockExpr(const BlockExpr *Node);
526  void VisitOpaqueValueExpr(const OpaqueValueExpr *Node);
527 
528  // C++
529  void VisitCXXNamedCastExpr(const CXXNamedCastExpr *Node);
530  void VisitCXXBoolLiteralExpr(const CXXBoolLiteralExpr *Node);
531  void VisitCXXThisExpr(const CXXThisExpr *Node);
532  void VisitCXXFunctionalCastExpr(const CXXFunctionalCastExpr *Node);
533  void VisitCXXConstructExpr(const CXXConstructExpr *Node);
534  void VisitCXXBindTemporaryExpr(const CXXBindTemporaryExpr *Node);
535  void VisitCXXNewExpr(const CXXNewExpr *Node);
536  void VisitCXXDeleteExpr(const CXXDeleteExpr *Node);
537  void VisitMaterializeTemporaryExpr(const MaterializeTemporaryExpr *Node);
538  void VisitExprWithCleanups(const ExprWithCleanups *Node);
539  void VisitUnresolvedLookupExpr(const UnresolvedLookupExpr *Node);
540  void dumpCXXTemporary(const CXXTemporary *Temporary);
541  void VisitLambdaExpr(const LambdaExpr *Node) {
542  VisitExpr(Node);
543  dumpDecl(Node->getLambdaClass());
544  }
545  void VisitSizeOfPackExpr(const SizeOfPackExpr *Node);
546 
547  // ObjC
548  void VisitObjCAtCatchStmt(const ObjCAtCatchStmt *Node);
549  void VisitObjCEncodeExpr(const ObjCEncodeExpr *Node);
550  void VisitObjCMessageExpr(const ObjCMessageExpr *Node);
551  void VisitObjCBoxedExpr(const ObjCBoxedExpr *Node);
552  void VisitObjCSelectorExpr(const ObjCSelectorExpr *Node);
553  void VisitObjCProtocolExpr(const ObjCProtocolExpr *Node);
554  void VisitObjCPropertyRefExpr(const ObjCPropertyRefExpr *Node);
555  void VisitObjCSubscriptRefExpr(const ObjCSubscriptRefExpr *Node);
556  void VisitObjCIvarRefExpr(const ObjCIvarRefExpr *Node);
557  void VisitObjCBoolLiteralExpr(const ObjCBoolLiteralExpr *Node);
558 
559  // Comments.
560  const char *getCommandName(unsigned CommandID);
561  void dumpComment(const Comment *C);
562 
563  // Inline comments.
564  void visitTextComment(const TextComment *C);
565  void visitInlineCommandComment(const InlineCommandComment *C);
566  void visitHTMLStartTagComment(const HTMLStartTagComment *C);
567  void visitHTMLEndTagComment(const HTMLEndTagComment *C);
568 
569  // Block comments.
570  void visitBlockCommandComment(const BlockCommandComment *C);
571  void visitParamCommandComment(const ParamCommandComment *C);
572  void visitTParamCommandComment(const TParamCommandComment *C);
573  void visitVerbatimBlockComment(const VerbatimBlockComment *C);
574  void visitVerbatimBlockLineComment(const VerbatimBlockLineComment *C);
575  void visitVerbatimLineComment(const VerbatimLineComment *C);
576  };
577 }
578 
579 //===----------------------------------------------------------------------===//
580 // Utilities
581 //===----------------------------------------------------------------------===//
582 
583 void ASTDumper::dumpPointer(const void *Ptr) {
584  ColorScope Color(*this, AddressColor);
585  OS << ' ' << Ptr;
586 }
587 
588 void ASTDumper::dumpLocation(SourceLocation Loc) {
589  if (!SM)
590  return;
591 
592  ColorScope Color(*this, LocationColor);
593  SourceLocation SpellingLoc = SM->getSpellingLoc(Loc);
594 
595  // The general format we print out is filename:line:col, but we drop pieces
596  // that haven't changed since the last loc printed.
597  PresumedLoc PLoc = SM->getPresumedLoc(SpellingLoc);
598 
599  if (PLoc.isInvalid()) {
600  OS << "<invalid sloc>";
601  return;
602  }
603 
604  if (strcmp(PLoc.getFilename(), LastLocFilename) != 0) {
605  OS << PLoc.getFilename() << ':' << PLoc.getLine()
606  << ':' << PLoc.getColumn();
607  LastLocFilename = PLoc.getFilename();
608  LastLocLine = PLoc.getLine();
609  } else if (PLoc.getLine() != LastLocLine) {
610  OS << "line" << ':' << PLoc.getLine()
611  << ':' << PLoc.getColumn();
612  LastLocLine = PLoc.getLine();
613  } else {
614  OS << "col" << ':' << PLoc.getColumn();
615  }
616 }
617 
618 void ASTDumper::dumpSourceRange(SourceRange R) {
619  // Can't translate locations if a SourceManager isn't available.
620  if (!SM)
621  return;
622 
623  OS << " <";
624  dumpLocation(R.getBegin());
625  if (R.getBegin() != R.getEnd()) {
626  OS << ", ";
627  dumpLocation(R.getEnd());
628  }
629  OS << ">";
630 
631  // <t2.c:123:421[blah], t2.c:412:321>
632 
633 }
634 
635 void ASTDumper::dumpBareType(QualType T, bool Desugar) {
636  ColorScope Color(*this, TypeColor);
637 
638  SplitQualType T_split = T.split();
639  OS << "'" << QualType::getAsString(T_split) << "'";
640 
641  if (Desugar && !T.isNull()) {
642  // If the type is sugared, also dump a (shallow) desugared type.
643  SplitQualType D_split = T.getSplitDesugaredType();
644  if (T_split != D_split)
645  OS << ":'" << QualType::getAsString(D_split) << "'";
646  }
647 }
648 
649 void ASTDumper::dumpType(QualType T) {
650  OS << ' ';
651  dumpBareType(T);
652 }
653 
654 void ASTDumper::dumpTypeAsChild(QualType T) {
655  SplitQualType SQT = T.split();
656  if (!SQT.Quals.hasQualifiers())
657  return dumpTypeAsChild(SQT.Ty);
658 
659  dumpChild([=] {
660  OS << "QualType";
661  dumpPointer(T.getAsOpaquePtr());
662  OS << " ";
663  dumpBareType(T, false);
664  OS << " " << T.split().Quals.getAsString();
665  dumpTypeAsChild(T.split().Ty);
666  });
667 }
668 
669 void ASTDumper::dumpTypeAsChild(const Type *T) {
670  dumpChild([=] {
671  if (!T) {
672  ColorScope Color(*this, NullColor);
673  OS << "<<<NULL>>>";
674  return;
675  }
676  if (const LocInfoType *LIT = llvm::dyn_cast<LocInfoType>(T)) {
677  {
678  ColorScope Color(*this, TypeColor);
679  OS << "LocInfo Type";
680  }
681  dumpPointer(T);
682  dumpTypeAsChild(LIT->getTypeSourceInfo()->getType());
683  return;
684  }
685 
686  {
687  ColorScope Color(*this, TypeColor);
688  OS << T->getTypeClassName() << "Type";
689  }
690  dumpPointer(T);
691  OS << " ";
692  dumpBareType(QualType(T, 0), false);
693 
694  QualType SingleStepDesugar =
696  if (SingleStepDesugar != QualType(T, 0))
697  OS << " sugar";
698  if (T->isDependentType())
699  OS << " dependent";
700  else if (T->isInstantiationDependentType())
701  OS << " instantiation_dependent";
702  if (T->isVariablyModifiedType())
703  OS << " variably_modified";
705  OS << " contains_unexpanded_pack";
706  if (T->isFromAST())
707  OS << " imported";
708 
710 
711  if (SingleStepDesugar != QualType(T, 0))
712  dumpTypeAsChild(SingleStepDesugar);
713  });
714 }
715 
716 void ASTDumper::dumpBareDeclRef(const Decl *D) {
717  if (!D) {
718  ColorScope Color(*this, NullColor);
719  OS << "<<<NULL>>>";
720  return;
721  }
722 
723  {
724  ColorScope Color(*this, DeclKindNameColor);
725  OS << D->getDeclKindName();
726  }
727  dumpPointer(D);
728 
729  if (const NamedDecl *ND = dyn_cast<NamedDecl>(D)) {
730  ColorScope Color(*this, DeclNameColor);
731  OS << " '" << ND->getDeclName() << '\'';
732  }
733 
734  if (const ValueDecl *VD = dyn_cast<ValueDecl>(D))
735  dumpType(VD->getType());
736 }
737 
738 void ASTDumper::dumpDeclRef(const Decl *D, const char *Label) {
739  if (!D)
740  return;
741 
742  dumpChild([=]{
743  if (Label)
744  OS << Label << ' ';
745  dumpBareDeclRef(D);
746  });
747 }
748 
749 void ASTDumper::dumpName(const NamedDecl *ND) {
750  if (ND->getDeclName()) {
751  ColorScope Color(*this, DeclNameColor);
752  OS << ' ' << ND->getNameAsString();
753  }
754 }
755 
756 bool ASTDumper::hasNodes(const DeclContext *DC) {
757  if (!DC)
758  return false;
759 
760  return DC->hasExternalLexicalStorage() ||
761  DC->noload_decls_begin() != DC->noload_decls_end();
762 }
763 
764 void ASTDumper::dumpDeclContext(const DeclContext *DC) {
765  if (!DC)
766  return;
767 
768  for (auto *D : DC->noload_decls())
769  dumpDecl(D);
770 
771  if (DC->hasExternalLexicalStorage()) {
772  dumpChild([=]{
773  ColorScope Color(*this, UndeserializedColor);
774  OS << "<undeserialized declarations>";
775  });
776  }
777 }
778 
779 void ASTDumper::dumpLookups(const DeclContext *DC, bool DumpDecls) {
780  dumpChild([=] {
781  OS << "StoredDeclsMap ";
782  dumpBareDeclRef(cast<Decl>(DC));
783 
784  const DeclContext *Primary = DC->getPrimaryContext();
785  if (Primary != DC) {
786  OS << " primary";
787  dumpPointer(cast<Decl>(Primary));
788  }
789 
790  bool HasUndeserializedLookups = Primary->hasExternalVisibleStorage();
791 
793  E = Primary->noload_lookups_end();
794  while (I != E) {
796  DeclContextLookupResult R = *I++;
797 
798  dumpChild([=] {
799  OS << "DeclarationName ";
800  {
801  ColorScope Color(*this, DeclNameColor);
802  OS << '\'' << Name << '\'';
803  }
804 
805  for (DeclContextLookupResult::iterator RI = R.begin(), RE = R.end();
806  RI != RE; ++RI) {
807  dumpChild([=] {
808  dumpBareDeclRef(*RI);
809 
810  if ((*RI)->isHidden())
811  OS << " hidden";
812 
813  // If requested, dump the redecl chain for this lookup.
814  if (DumpDecls) {
815  // Dump earliest decl first.
816  std::function<void(Decl *)> DumpWithPrev = [&](Decl *D) {
817  if (Decl *Prev = D->getPreviousDecl())
818  DumpWithPrev(Prev);
819  dumpDecl(D);
820  };
821  DumpWithPrev(*RI);
822  }
823  });
824  }
825  });
826  }
827 
828  if (HasUndeserializedLookups) {
829  dumpChild([=] {
830  ColorScope Color(*this, UndeserializedColor);
831  OS << "<undeserialized lookups>";
832  });
833  }
834  });
835 }
836 
837 void ASTDumper::dumpAttr(const Attr *A) {
838  dumpChild([=] {
839  {
840  ColorScope Color(*this, AttrColor);
841 
842  switch (A->getKind()) {
843 #define ATTR(X) case attr::X: OS << #X; break;
844 #include "clang/Basic/AttrList.inc"
845  }
846  OS << "Attr";
847  }
848  dumpPointer(A);
849  dumpSourceRange(A->getRange());
850  if (A->isInherited())
851  OS << " Inherited";
852  if (A->isImplicit())
853  OS << " Implicit";
854 #include "clang/AST/AttrDump.inc"
855  });
856 }
857 
858 static void dumpPreviousDeclImpl(raw_ostream &OS, ...) {}
859 
860 template<typename T>
861 static void dumpPreviousDeclImpl(raw_ostream &OS, const Mergeable<T> *D) {
862  const T *First = D->getFirstDecl();
863  if (First != D)
864  OS << " first " << First;
865 }
866 
867 template<typename T>
868 static void dumpPreviousDeclImpl(raw_ostream &OS, const Redeclarable<T> *D) {
869  const T *Prev = D->getPreviousDecl();
870  if (Prev)
871  OS << " prev " << Prev;
872 }
873 
874 /// Dump the previous declaration in the redeclaration chain for a declaration,
875 /// if any.
876 static void dumpPreviousDecl(raw_ostream &OS, const Decl *D) {
877  switch (D->getKind()) {
878 #define DECL(DERIVED, BASE) \
879  case Decl::DERIVED: \
880  return dumpPreviousDeclImpl(OS, cast<DERIVED##Decl>(D));
881 #define ABSTRACT_DECL(DECL)
882 #include "clang/AST/DeclNodes.inc"
883  }
884  llvm_unreachable("Decl that isn't part of DeclNodes.inc!");
885 }
886 
887 //===----------------------------------------------------------------------===//
888 // C++ Utilities
889 //===----------------------------------------------------------------------===//
890 
891 void ASTDumper::dumpAccessSpecifier(AccessSpecifier AS) {
892  switch (AS) {
893  case AS_none:
894  break;
895  case AS_public:
896  OS << "public";
897  break;
898  case AS_protected:
899  OS << "protected";
900  break;
901  case AS_private:
902  OS << "private";
903  break;
904  }
905 }
906 
907 void ASTDumper::dumpCXXCtorInitializer(const CXXCtorInitializer *Init) {
908  dumpChild([=] {
909  OS << "CXXCtorInitializer";
910  if (Init->isAnyMemberInitializer()) {
911  OS << ' ';
912  dumpBareDeclRef(Init->getAnyMember());
913  } else if (Init->isBaseInitializer()) {
914  dumpType(QualType(Init->getBaseClass(), 0));
915  } else if (Init->isDelegatingInitializer()) {
916  dumpType(Init->getTypeSourceInfo()->getType());
917  } else {
918  llvm_unreachable("Unknown initializer type");
919  }
920  dumpStmt(Init->getInit());
921  });
922 }
923 
924 void ASTDumper::dumpTemplateParameters(const TemplateParameterList *TPL) {
925  if (!TPL)
926  return;
927 
928  for (TemplateParameterList::const_iterator I = TPL->begin(), E = TPL->end();
929  I != E; ++I)
930  dumpDecl(*I);
931 }
932 
933 void ASTDumper::dumpTemplateArgumentListInfo(
934  const TemplateArgumentListInfo &TALI) {
935  for (unsigned i = 0, e = TALI.size(); i < e; ++i)
936  dumpTemplateArgumentLoc(TALI[i]);
937 }
938 
939 void ASTDumper::dumpTemplateArgumentLoc(const TemplateArgumentLoc &A) {
940  dumpTemplateArgument(A.getArgument(), A.getSourceRange());
941 }
942 
943 void ASTDumper::dumpTemplateArgumentList(const TemplateArgumentList &TAL) {
944  for (unsigned i = 0, e = TAL.size(); i < e; ++i)
945  dumpTemplateArgument(TAL[i]);
946 }
947 
948 void ASTDumper::dumpTemplateArgument(const TemplateArgument &A, SourceRange R) {
949  dumpChild([=] {
950  OS << "TemplateArgument";
951  if (R.isValid())
952  dumpSourceRange(R);
953 
954  switch (A.getKind()) {
956  OS << " null";
957  break;
959  OS << " type";
960  dumpType(A.getAsType());
961  break;
963  OS << " decl";
964  dumpDeclRef(A.getAsDecl());
965  break;
967  OS << " nullptr";
968  break;
970  OS << " integral " << A.getAsIntegral();
971  break;
973  OS << " template ";
974  A.getAsTemplate().dump(OS);
975  break;
977  OS << " template expansion";
979  break;
981  OS << " expr";
982  dumpStmt(A.getAsExpr());
983  break;
985  OS << " pack";
987  I != E; ++I)
988  dumpTemplateArgument(*I);
989  break;
990  }
991  });
992 }
993 
994 //===----------------------------------------------------------------------===//
995 // Objective-C Utilities
996 //===----------------------------------------------------------------------===//
997 void ASTDumper::dumpObjCTypeParamList(const ObjCTypeParamList *typeParams) {
998  if (!typeParams)
999  return;
1000 
1001  for (auto typeParam : *typeParams) {
1002  dumpDecl(typeParam);
1003  }
1004 }
1005 
1006 //===----------------------------------------------------------------------===//
1007 // Decl dumping methods.
1008 //===----------------------------------------------------------------------===//
1009 
1010 void ASTDumper::dumpDecl(const Decl *D) {
1011  dumpChild([=] {
1012  if (!D) {
1013  ColorScope Color(*this, NullColor);
1014  OS << "<<<NULL>>>";
1015  return;
1016  }
1017 
1018  {
1019  ColorScope Color(*this, DeclKindNameColor);
1020  OS << D->getDeclKindName() << "Decl";
1021  }
1022  dumpPointer(D);
1023  if (D->getLexicalDeclContext() != D->getDeclContext())
1024  OS << " parent " << cast<Decl>(D->getDeclContext());
1025  dumpPreviousDecl(OS, D);
1026  dumpSourceRange(D->getSourceRange());
1027  OS << ' ';
1028  dumpLocation(D->getLocation());
1029  if (Module *M = D->getImportedOwningModule())
1030  OS << " in " << M->getFullModuleName();
1031  else if (Module *M = D->getLocalOwningModule())
1032  OS << " in (local) " << M->getFullModuleName();
1033  if (auto *ND = dyn_cast<NamedDecl>(D))
1034  for (Module *M : D->getASTContext().getModulesWithMergedDefinition(
1035  const_cast<NamedDecl *>(ND)))
1036  dumpChild([=] { OS << "also in " << M->getFullModuleName(); });
1037  if (const NamedDecl *ND = dyn_cast<NamedDecl>(D))
1038  if (ND->isHidden())
1039  OS << " hidden";
1040  if (D->isImplicit())
1041  OS << " implicit";
1042  if (D->isUsed())
1043  OS << " used";
1044  else if (D->isThisDeclarationReferenced())
1045  OS << " referenced";
1046  if (D->isInvalidDecl())
1047  OS << " invalid";
1048  if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(D))
1049  if (FD->isConstexpr())
1050  OS << " constexpr";
1051 
1052 
1054 
1055  for (Decl::attr_iterator I = D->attr_begin(), E = D->attr_end(); I != E;
1056  ++I)
1057  dumpAttr(*I);
1058 
1059  if (const FullComment *Comment =
1060  D->getASTContext().getLocalCommentForDeclUncached(D))
1061  dumpFullComment(Comment);
1062 
1063  // Decls within functions are visited by the body.
1064  if (!isa<FunctionDecl>(*D) && !isa<ObjCMethodDecl>(*D) &&
1065  hasNodes(dyn_cast<DeclContext>(D)))
1066  dumpDeclContext(cast<DeclContext>(D));
1067  });
1068 }
1069 
1070 void ASTDumper::VisitLabelDecl(const LabelDecl *D) {
1071  dumpName(D);
1072 }
1073 
1074 void ASTDumper::VisitTypedefDecl(const TypedefDecl *D) {
1075  dumpName(D);
1076  dumpType(D->getUnderlyingType());
1077  if (D->isModulePrivate())
1078  OS << " __module_private__";
1079  dumpTypeAsChild(D->getUnderlyingType());
1080 }
1081 
1082 void ASTDumper::VisitEnumDecl(const EnumDecl *D) {
1083  if (D->isScoped()) {
1084  if (D->isScopedUsingClassTag())
1085  OS << " class";
1086  else
1087  OS << " struct";
1088  }
1089  dumpName(D);
1090  if (D->isModulePrivate())
1091  OS << " __module_private__";
1092  if (D->isFixed())
1093  dumpType(D->getIntegerType());
1094 }
1095 
1096 void ASTDumper::VisitRecordDecl(const RecordDecl *D) {
1097  OS << ' ' << D->getKindName();
1098  dumpName(D);
1099  if (D->isModulePrivate())
1100  OS << " __module_private__";
1101  if (D->isCompleteDefinition())
1102  OS << " definition";
1103 }
1104 
1105 void ASTDumper::VisitEnumConstantDecl(const EnumConstantDecl *D) {
1106  dumpName(D);
1107  dumpType(D->getType());
1108  if (const Expr *Init = D->getInitExpr())
1109  dumpStmt(Init);
1110 }
1111 
1112 void ASTDumper::VisitIndirectFieldDecl(const IndirectFieldDecl *D) {
1113  dumpName(D);
1114  dumpType(D->getType());
1115 
1116  for (auto *Child : D->chain())
1117  dumpDeclRef(Child);
1118 }
1119 
1120 void ASTDumper::VisitFunctionDecl(const FunctionDecl *D) {
1121  dumpName(D);
1122  dumpType(D->getType());
1123 
1124  StorageClass SC = D->getStorageClass();
1125  if (SC != SC_None)
1126  OS << ' ' << VarDecl::getStorageClassSpecifierString(SC);
1127  if (D->isInlineSpecified())
1128  OS << " inline";
1129  if (D->isVirtualAsWritten())
1130  OS << " virtual";
1131  if (D->isModulePrivate())
1132  OS << " __module_private__";
1133 
1134  if (D->isPure())
1135  OS << " pure";
1136  else if (D->isDeletedAsWritten())
1137  OS << " delete";
1138 
1139  if (const FunctionProtoType *FPT = D->getType()->getAs<FunctionProtoType>()) {
1140  FunctionProtoType::ExtProtoInfo EPI = FPT->getExtProtoInfo();
1141  switch (EPI.ExceptionSpec.Type) {
1142  default: break;
1143  case EST_Unevaluated:
1144  OS << " noexcept-unevaluated " << EPI.ExceptionSpec.SourceDecl;
1145  break;
1146  case EST_Uninstantiated:
1147  OS << " noexcept-uninstantiated " << EPI.ExceptionSpec.SourceTemplate;
1148  break;
1149  }
1150  }
1151 
1152  if (const FunctionTemplateSpecializationInfo *FTSI =
1154  dumpTemplateArgumentList(*FTSI->TemplateArguments);
1155 
1157  I = D->getDeclsInPrototypeScope().begin(),
1158  E = D->getDeclsInPrototypeScope().end(); I != E; ++I)
1159  dumpDecl(*I);
1160 
1161  if (!D->param_begin() && D->getNumParams())
1162  dumpChild([=] { OS << "<<NULL params x " << D->getNumParams() << ">>"; });
1163  else
1164  for (const ParmVarDecl *Parameter : D->parameters())
1165  dumpDecl(Parameter);
1166 
1167  if (const CXXConstructorDecl *C = dyn_cast<CXXConstructorDecl>(D))
1168  for (CXXConstructorDecl::init_const_iterator I = C->init_begin(),
1169  E = C->init_end();
1170  I != E; ++I)
1171  dumpCXXCtorInitializer(*I);
1172 
1174  dumpStmt(D->getBody());
1175 }
1176 
1177 void ASTDumper::VisitFieldDecl(const FieldDecl *D) {
1178  dumpName(D);
1179  dumpType(D->getType());
1180  if (D->isMutable())
1181  OS << " mutable";
1182  if (D->isModulePrivate())
1183  OS << " __module_private__";
1184 
1185  if (D->isBitField())
1186  dumpStmt(D->getBitWidth());
1187  if (Expr *Init = D->getInClassInitializer())
1188  dumpStmt(Init);
1189 }
1190 
1191 void ASTDumper::VisitVarDecl(const VarDecl *D) {
1192  dumpName(D);
1193  dumpType(D->getType());
1194  StorageClass SC = D->getStorageClass();
1195  if (SC != SC_None)
1196  OS << ' ' << VarDecl::getStorageClassSpecifierString(SC);
1197  switch (D->getTLSKind()) {
1198  case VarDecl::TLS_None: break;
1199  case VarDecl::TLS_Static: OS << " tls"; break;
1200  case VarDecl::TLS_Dynamic: OS << " tls_dynamic"; break;
1201  }
1202  if (D->isModulePrivate())
1203  OS << " __module_private__";
1204  if (D->isNRVOVariable())
1205  OS << " nrvo";
1206  if (D->isInline())
1207  OS << " inline";
1208  if (D->isConstexpr())
1209  OS << " constexpr";
1210  if (D->hasInit()) {
1211  switch (D->getInitStyle()) {
1212  case VarDecl::CInit: OS << " cinit"; break;
1213  case VarDecl::CallInit: OS << " callinit"; break;
1214  case VarDecl::ListInit: OS << " listinit"; break;
1215  }
1216  dumpStmt(D->getInit());
1217  }
1218 }
1219 
1220 void ASTDumper::VisitFileScopeAsmDecl(const FileScopeAsmDecl *D) {
1221  dumpStmt(D->getAsmString());
1222 }
1223 
1224 void ASTDumper::VisitImportDecl(const ImportDecl *D) {
1225  OS << ' ' << D->getImportedModule()->getFullModuleName();
1226 }
1227 
1228 void ASTDumper::VisitPragmaCommentDecl(const PragmaCommentDecl *D) {
1229  OS << ' ';
1230  switch (D->getCommentKind()) {
1231  case PCK_Unknown: llvm_unreachable("unexpected pragma comment kind");
1232  case PCK_Compiler: OS << "compiler"; break;
1233  case PCK_ExeStr: OS << "exestr"; break;
1234  case PCK_Lib: OS << "lib"; break;
1235  case PCK_Linker: OS << "linker"; break;
1236  case PCK_User: OS << "user"; break;
1237  }
1238  StringRef Arg = D->getArg();
1239  if (!Arg.empty())
1240  OS << " \"" << Arg << "\"";
1241 }
1242 
1243 void ASTDumper::VisitPragmaDetectMismatchDecl(
1244  const PragmaDetectMismatchDecl *D) {
1245  OS << " \"" << D->getName() << "\" \"" << D->getValue() << "\"";
1246 }
1247 
1248 void ASTDumper::VisitCapturedDecl(const CapturedDecl *D) {
1249  dumpStmt(D->getBody());
1250 }
1251 
1252 //===----------------------------------------------------------------------===//
1253 // OpenMP Declarations
1254 //===----------------------------------------------------------------------===//
1255 
1256 void ASTDumper::VisitOMPThreadPrivateDecl(const OMPThreadPrivateDecl *D) {
1257  for (auto *E : D->varlists())
1258  dumpStmt(E);
1259 }
1260 
1261 void ASTDumper::VisitOMPDeclareReductionDecl(const OMPDeclareReductionDecl *D) {
1262  dumpName(D);
1263  dumpType(D->getType());
1264  OS << " combiner";
1265  dumpStmt(D->getCombiner());
1266  if (auto *Initializer = D->getInitializer()) {
1267  OS << " initializer";
1268  dumpStmt(Initializer);
1269  }
1270 }
1271 
1272 void ASTDumper::VisitOMPCapturedExprDecl(const OMPCapturedExprDecl *D) {
1273  dumpName(D);
1274  dumpType(D->getType());
1275  dumpStmt(D->getInit());
1276 }
1277 
1278 //===----------------------------------------------------------------------===//
1279 // C++ Declarations
1280 //===----------------------------------------------------------------------===//
1281 
1282 void ASTDumper::VisitNamespaceDecl(const NamespaceDecl *D) {
1283  dumpName(D);
1284  if (D->isInline())
1285  OS << " inline";
1286  if (!D->isOriginalNamespace())
1287  dumpDeclRef(D->getOriginalNamespace(), "original");
1288 }
1289 
1290 void ASTDumper::VisitUsingDirectiveDecl(const UsingDirectiveDecl *D) {
1291  OS << ' ';
1292  dumpBareDeclRef(D->getNominatedNamespace());
1293 }
1294 
1295 void ASTDumper::VisitNamespaceAliasDecl(const NamespaceAliasDecl *D) {
1296  dumpName(D);
1297  dumpDeclRef(D->getAliasedNamespace());
1298 }
1299 
1300 void ASTDumper::VisitTypeAliasDecl(const TypeAliasDecl *D) {
1301  dumpName(D);
1302  dumpType(D->getUnderlyingType());
1303  dumpTypeAsChild(D->getUnderlyingType());
1304 }
1305 
1306 void ASTDumper::VisitTypeAliasTemplateDecl(const TypeAliasTemplateDecl *D) {
1307  dumpName(D);
1308  dumpTemplateParameters(D->getTemplateParameters());
1309  dumpDecl(D->getTemplatedDecl());
1310 }
1311 
1312 void ASTDumper::VisitCXXRecordDecl(const CXXRecordDecl *D) {
1313  VisitRecordDecl(D);
1314  if (!D->isCompleteDefinition())
1315  return;
1316 
1317  for (const auto &I : D->bases()) {
1318  dumpChild([=] {
1319  if (I.isVirtual())
1320  OS << "virtual ";
1321  dumpAccessSpecifier(I.getAccessSpecifier());
1322  dumpType(I.getType());
1323  if (I.isPackExpansion())
1324  OS << "...";
1325  });
1326  }
1327 }
1328 
1329 void ASTDumper::VisitStaticAssertDecl(const StaticAssertDecl *D) {
1330  dumpStmt(D->getAssertExpr());
1331  dumpStmt(D->getMessage());
1332 }
1333 
1334 template<typename SpecializationDecl>
1335 void ASTDumper::VisitTemplateDeclSpecialization(const SpecializationDecl *D,
1336  bool DumpExplicitInst,
1337  bool DumpRefOnly) {
1338  bool DumpedAny = false;
1339  for (auto *RedeclWithBadType : D->redecls()) {
1340  // FIXME: The redecls() range sometimes has elements of a less-specific
1341  // type. (In particular, ClassTemplateSpecializationDecl::redecls() gives
1342  // us TagDecls, and should give CXXRecordDecls).
1343  auto *Redecl = dyn_cast<SpecializationDecl>(RedeclWithBadType);
1344  if (!Redecl) {
1345  // Found the injected-class-name for a class template. This will be dumped
1346  // as part of its surrounding class so we don't need to dump it here.
1347  assert(isa<CXXRecordDecl>(RedeclWithBadType) &&
1348  "expected an injected-class-name");
1349  continue;
1350  }
1351 
1352  switch (Redecl->getTemplateSpecializationKind()) {
1355  if (!DumpExplicitInst)
1356  break;
1357  // Fall through.
1358  case TSK_Undeclared:
1360  if (DumpRefOnly)
1361  dumpDeclRef(Redecl);
1362  else
1363  dumpDecl(Redecl);
1364  DumpedAny = true;
1365  break;
1367  break;
1368  }
1369  }
1370 
1371  // Ensure we dump at least one decl for each specialization.
1372  if (!DumpedAny)
1373  dumpDeclRef(D);
1374 }
1375 
1376 template<typename TemplateDecl>
1377 void ASTDumper::VisitTemplateDecl(const TemplateDecl *D,
1378  bool DumpExplicitInst) {
1379  dumpName(D);
1380  dumpTemplateParameters(D->getTemplateParameters());
1381 
1382  dumpDecl(D->getTemplatedDecl());
1383 
1384  for (auto *Child : D->specializations())
1385  VisitTemplateDeclSpecialization(Child, DumpExplicitInst,
1386  !D->isCanonicalDecl());
1387 }
1388 
1389 void ASTDumper::VisitFunctionTemplateDecl(const FunctionTemplateDecl *D) {
1390  // FIXME: We don't add a declaration of a function template specialization
1391  // to its context when it's explicitly instantiated, so dump explicit
1392  // instantiations when we dump the template itself.
1393  VisitTemplateDecl(D, true);
1394 }
1395 
1396 void ASTDumper::VisitClassTemplateDecl(const ClassTemplateDecl *D) {
1397  VisitTemplateDecl(D, false);
1398 }
1399 
1400 void ASTDumper::VisitClassTemplateSpecializationDecl(
1402  VisitCXXRecordDecl(D);
1403  dumpTemplateArgumentList(D->getTemplateArgs());
1404 }
1405 
1406 void ASTDumper::VisitClassTemplatePartialSpecializationDecl(
1408  VisitClassTemplateSpecializationDecl(D);
1409  dumpTemplateParameters(D->getTemplateParameters());
1410 }
1411 
1412 void ASTDumper::VisitClassScopeFunctionSpecializationDecl(
1414  dumpDeclRef(D->getSpecialization());
1415  if (D->hasExplicitTemplateArgs())
1416  dumpTemplateArgumentListInfo(D->templateArgs());
1417 }
1418 
1419 void ASTDumper::VisitVarTemplateDecl(const VarTemplateDecl *D) {
1420  VisitTemplateDecl(D, false);
1421 }
1422 
1423 void ASTDumper::VisitBuiltinTemplateDecl(const BuiltinTemplateDecl *D) {
1424  dumpName(D);
1425  dumpTemplateParameters(D->getTemplateParameters());
1426 }
1427 
1428 void ASTDumper::VisitVarTemplateSpecializationDecl(
1429  const VarTemplateSpecializationDecl *D) {
1430  dumpTemplateArgumentList(D->getTemplateArgs());
1431  VisitVarDecl(D);
1432 }
1433 
1434 void ASTDumper::VisitVarTemplatePartialSpecializationDecl(
1436  dumpTemplateParameters(D->getTemplateParameters());
1437  VisitVarTemplateSpecializationDecl(D);
1438 }
1439 
1440 void ASTDumper::VisitTemplateTypeParmDecl(const TemplateTypeParmDecl *D) {
1441  if (D->wasDeclaredWithTypename())
1442  OS << " typename";
1443  else
1444  OS << " class";
1445  if (D->isParameterPack())
1446  OS << " ...";
1447  dumpName(D);
1448  if (D->hasDefaultArgument())
1449  dumpTemplateArgument(D->getDefaultArgument());
1450 }
1451 
1452 void ASTDumper::VisitNonTypeTemplateParmDecl(const NonTypeTemplateParmDecl *D) {
1453  dumpType(D->getType());
1454  if (D->isParameterPack())
1455  OS << " ...";
1456  dumpName(D);
1457  if (D->hasDefaultArgument())
1458  dumpTemplateArgument(D->getDefaultArgument());
1459 }
1460 
1461 void ASTDumper::VisitTemplateTemplateParmDecl(
1462  const TemplateTemplateParmDecl *D) {
1463  if (D->isParameterPack())
1464  OS << " ...";
1465  dumpName(D);
1466  dumpTemplateParameters(D->getTemplateParameters());
1467  if (D->hasDefaultArgument())
1468  dumpTemplateArgumentLoc(D->getDefaultArgument());
1469 }
1470 
1471 void ASTDumper::VisitUsingDecl(const UsingDecl *D) {
1472  OS << ' ';
1473  if (D->getQualifier())
1474  D->getQualifier()->print(OS, D->getASTContext().getPrintingPolicy());
1475  OS << D->getNameAsString();
1476 }
1477 
1478 void ASTDumper::VisitUnresolvedUsingTypenameDecl(
1479  const UnresolvedUsingTypenameDecl *D) {
1480  OS << ' ';
1481  if (D->getQualifier())
1482  D->getQualifier()->print(OS, D->getASTContext().getPrintingPolicy());
1483  OS << D->getNameAsString();
1484 }
1485 
1486 void ASTDumper::VisitUnresolvedUsingValueDecl(const UnresolvedUsingValueDecl *D) {
1487  OS << ' ';
1488  if (D->getQualifier())
1489  D->getQualifier()->print(OS, D->getASTContext().getPrintingPolicy());
1490  OS << D->getNameAsString();
1491  dumpType(D->getType());
1492 }
1493 
1494 void ASTDumper::VisitUsingShadowDecl(const UsingShadowDecl *D) {
1495  OS << ' ';
1496  dumpBareDeclRef(D->getTargetDecl());
1497  if (auto *TD = dyn_cast<TypeDecl>(D->getUnderlyingDecl()))
1498  dumpTypeAsChild(TD->getTypeForDecl());
1499 }
1500 
1501 void ASTDumper::VisitConstructorUsingShadowDecl(
1502  const ConstructorUsingShadowDecl *D) {
1503  if (D->constructsVirtualBase())
1504  OS << " virtual";
1505 
1506  dumpChild([=] {
1507  OS << "target ";
1508  dumpBareDeclRef(D->getTargetDecl());
1509  });
1510 
1511  dumpChild([=] {
1512  OS << "nominated ";
1513  dumpBareDeclRef(D->getNominatedBaseClass());
1514  OS << ' ';
1515  dumpBareDeclRef(D->getNominatedBaseClassShadowDecl());
1516  });
1517 
1518  dumpChild([=] {
1519  OS << "constructed ";
1520  dumpBareDeclRef(D->getConstructedBaseClass());
1521  OS << ' ';
1522  dumpBareDeclRef(D->getConstructedBaseClassShadowDecl());
1523  });
1524 }
1525 
1526 void ASTDumper::VisitLinkageSpecDecl(const LinkageSpecDecl *D) {
1527  switch (D->getLanguage()) {
1528  case LinkageSpecDecl::lang_c: OS << " C"; break;
1529  case LinkageSpecDecl::lang_cxx: OS << " C++"; break;
1530  }
1531 }
1532 
1533 void ASTDumper::VisitAccessSpecDecl(const AccessSpecDecl *D) {
1534  OS << ' ';
1535  dumpAccessSpecifier(D->getAccess());
1536 }
1537 
1538 void ASTDumper::VisitFriendDecl(const FriendDecl *D) {
1539  if (TypeSourceInfo *T = D->getFriendType())
1540  dumpType(T->getType());
1541  else
1542  dumpDecl(D->getFriendDecl());
1543 }
1544 
1545 //===----------------------------------------------------------------------===//
1546 // Obj-C Declarations
1547 //===----------------------------------------------------------------------===//
1548 
1549 void ASTDumper::VisitObjCIvarDecl(const ObjCIvarDecl *D) {
1550  dumpName(D);
1551  dumpType(D->getType());
1552  if (D->getSynthesize())
1553  OS << " synthesize";
1554 
1555  switch (D->getAccessControl()) {
1556  case ObjCIvarDecl::None:
1557  OS << " none";
1558  break;
1559  case ObjCIvarDecl::Private:
1560  OS << " private";
1561  break;
1563  OS << " protected";
1564  break;
1565  case ObjCIvarDecl::Public:
1566  OS << " public";
1567  break;
1568  case ObjCIvarDecl::Package:
1569  OS << " package";
1570  break;
1571  }
1572 }
1573 
1574 void ASTDumper::VisitObjCMethodDecl(const ObjCMethodDecl *D) {
1575  if (D->isInstanceMethod())
1576  OS << " -";
1577  else
1578  OS << " +";
1579  dumpName(D);
1580  dumpType(D->getReturnType());
1581 
1582  if (D->isThisDeclarationADefinition()) {
1583  dumpDeclContext(D);
1584  } else {
1585  for (const ParmVarDecl *Parameter : D->parameters())
1586  dumpDecl(Parameter);
1587  }
1588 
1589  if (D->isVariadic())
1590  dumpChild([=] { OS << "..."; });
1591 
1592  if (D->hasBody())
1593  dumpStmt(D->getBody());
1594 }
1595 
1596 void ASTDumper::VisitObjCTypeParamDecl(const ObjCTypeParamDecl *D) {
1597  dumpName(D);
1598  switch (D->getVariance()) {
1600  break;
1601 
1603  OS << " covariant";
1604  break;
1605 
1607  OS << " contravariant";
1608  break;
1609  }
1610 
1611  if (D->hasExplicitBound())
1612  OS << " bounded";
1613  dumpType(D->getUnderlyingType());
1614 }
1615 
1616 void ASTDumper::VisitObjCCategoryDecl(const ObjCCategoryDecl *D) {
1617  dumpName(D);
1618  dumpDeclRef(D->getClassInterface());
1619  dumpObjCTypeParamList(D->getTypeParamList());
1620  dumpDeclRef(D->getImplementation());
1622  E = D->protocol_end();
1623  I != E; ++I)
1624  dumpDeclRef(*I);
1625 }
1626 
1627 void ASTDumper::VisitObjCCategoryImplDecl(const ObjCCategoryImplDecl *D) {
1628  dumpName(D);
1629  dumpDeclRef(D->getClassInterface());
1630  dumpDeclRef(D->getCategoryDecl());
1631 }
1632 
1633 void ASTDumper::VisitObjCProtocolDecl(const ObjCProtocolDecl *D) {
1634  dumpName(D);
1635 
1636  for (auto *Child : D->protocols())
1637  dumpDeclRef(Child);
1638 }
1639 
1640 void ASTDumper::VisitObjCInterfaceDecl(const ObjCInterfaceDecl *D) {
1641  dumpName(D);
1642  dumpObjCTypeParamList(D->getTypeParamListAsWritten());
1643  dumpDeclRef(D->getSuperClass(), "super");
1644 
1645  dumpDeclRef(D->getImplementation());
1646  for (auto *Child : D->protocols())
1647  dumpDeclRef(Child);
1648 }
1649 
1650 void ASTDumper::VisitObjCImplementationDecl(const ObjCImplementationDecl *D) {
1651  dumpName(D);
1652  dumpDeclRef(D->getSuperClass(), "super");
1653  dumpDeclRef(D->getClassInterface());
1655  E = D->init_end();
1656  I != E; ++I)
1657  dumpCXXCtorInitializer(*I);
1658 }
1659 
1660 void ASTDumper::VisitObjCCompatibleAliasDecl(const ObjCCompatibleAliasDecl *D) {
1661  dumpName(D);
1662  dumpDeclRef(D->getClassInterface());
1663 }
1664 
1665 void ASTDumper::VisitObjCPropertyDecl(const ObjCPropertyDecl *D) {
1666  dumpName(D);
1667  dumpType(D->getType());
1668 
1670  OS << " required";
1672  OS << " optional";
1673 
1675  if (Attrs != ObjCPropertyDecl::OBJC_PR_noattr) {
1677  OS << " readonly";
1679  OS << " assign";
1681  OS << " readwrite";
1683  OS << " retain";
1684  if (Attrs & ObjCPropertyDecl::OBJC_PR_copy)
1685  OS << " copy";
1687  OS << " nonatomic";
1689  OS << " atomic";
1690  if (Attrs & ObjCPropertyDecl::OBJC_PR_weak)
1691  OS << " weak";
1693  OS << " strong";
1695  OS << " unsafe_unretained";
1696  if (Attrs & ObjCPropertyDecl::OBJC_PR_class)
1697  OS << " class";
1699  dumpDeclRef(D->getGetterMethodDecl(), "getter");
1701  dumpDeclRef(D->getSetterMethodDecl(), "setter");
1702  }
1703 }
1704 
1705 void ASTDumper::VisitObjCPropertyImplDecl(const ObjCPropertyImplDecl *D) {
1706  dumpName(D->getPropertyDecl());
1708  OS << " synthesize";
1709  else
1710  OS << " dynamic";
1711  dumpDeclRef(D->getPropertyDecl());
1712  dumpDeclRef(D->getPropertyIvarDecl());
1713 }
1714 
1715 void ASTDumper::VisitBlockDecl(const BlockDecl *D) {
1716  for (auto I : D->parameters())
1717  dumpDecl(I);
1718 
1719  if (D->isVariadic())
1720  dumpChild([=]{ OS << "..."; });
1721 
1722  if (D->capturesCXXThis())
1723  dumpChild([=]{ OS << "capture this"; });
1724 
1725  for (const auto &I : D->captures()) {
1726  dumpChild([=] {
1727  OS << "capture";
1728  if (I.isByRef())
1729  OS << " byref";
1730  if (I.isNested())
1731  OS << " nested";
1732  if (I.getVariable()) {
1733  OS << ' ';
1734  dumpBareDeclRef(I.getVariable());
1735  }
1736  if (I.hasCopyExpr())
1737  dumpStmt(I.getCopyExpr());
1738  });
1739  }
1740  dumpStmt(D->getBody());
1741 }
1742 
1743 //===----------------------------------------------------------------------===//
1744 // Stmt dumping methods.
1745 //===----------------------------------------------------------------------===//
1746 
1747 void ASTDumper::dumpStmt(const Stmt *S) {
1748  dumpChild([=] {
1749  if (!S) {
1750  ColorScope Color(*this, NullColor);
1751  OS << "<<<NULL>>>";
1752  return;
1753  }
1754 
1755  if (const DeclStmt *DS = dyn_cast<DeclStmt>(S)) {
1756  VisitDeclStmt(DS);
1757  return;
1758  }
1759 
1761 
1762  for (const Stmt *SubStmt : S->children())
1763  dumpStmt(SubStmt);
1764  });
1765 }
1766 
1767 void ASTDumper::VisitStmt(const Stmt *Node) {
1768  {
1769  ColorScope Color(*this, StmtColor);
1770  OS << Node->getStmtClassName();
1771  }
1772  dumpPointer(Node);
1773  dumpSourceRange(Node->getSourceRange());
1774 }
1775 
1776 void ASTDumper::VisitDeclStmt(const DeclStmt *Node) {
1777  VisitStmt(Node);
1778  for (DeclStmt::const_decl_iterator I = Node->decl_begin(),
1779  E = Node->decl_end();
1780  I != E; ++I)
1781  dumpDecl(*I);
1782 }
1783 
1784 void ASTDumper::VisitAttributedStmt(const AttributedStmt *Node) {
1785  VisitStmt(Node);
1786  for (ArrayRef<const Attr *>::iterator I = Node->getAttrs().begin(),
1787  E = Node->getAttrs().end();
1788  I != E; ++I)
1789  dumpAttr(*I);
1790 }
1791 
1792 void ASTDumper::VisitLabelStmt(const LabelStmt *Node) {
1793  VisitStmt(Node);
1794  OS << " '" << Node->getName() << "'";
1795 }
1796 
1797 void ASTDumper::VisitGotoStmt(const GotoStmt *Node) {
1798  VisitStmt(Node);
1799  OS << " '" << Node->getLabel()->getName() << "'";
1800  dumpPointer(Node->getLabel());
1801 }
1802 
1803 void ASTDumper::VisitCXXCatchStmt(const CXXCatchStmt *Node) {
1804  VisitStmt(Node);
1805  dumpDecl(Node->getExceptionDecl());
1806 }
1807 
1808 void ASTDumper::VisitCapturedStmt(const CapturedStmt *Node) {
1809  VisitStmt(Node);
1810  dumpDecl(Node->getCapturedDecl());
1811 }
1812 
1813 //===----------------------------------------------------------------------===//
1814 // OpenMP dumping methods.
1815 //===----------------------------------------------------------------------===//
1816 
1817 void ASTDumper::VisitOMPExecutableDirective(
1818  const OMPExecutableDirective *Node) {
1819  VisitStmt(Node);
1820  for (auto *C : Node->clauses()) {
1821  dumpChild([=] {
1822  if (!C) {
1823  ColorScope Color(*this, NullColor);
1824  OS << "<<<NULL>>> OMPClause";
1825  return;
1826  }
1827  {
1828  ColorScope Color(*this, AttrColor);
1829  StringRef ClauseName(getOpenMPClauseName(C->getClauseKind()));
1830  OS << "OMP" << ClauseName.substr(/*Start=*/0, /*N=*/1).upper()
1831  << ClauseName.drop_front() << "Clause";
1832  }
1833  dumpPointer(C);
1834  dumpSourceRange(SourceRange(C->getLocStart(), C->getLocEnd()));
1835  if (C->isImplicit())
1836  OS << " <implicit>";
1837  for (auto *S : C->children())
1838  dumpStmt(S);
1839  });
1840  }
1841 }
1842 
1843 //===----------------------------------------------------------------------===//
1844 // Expr dumping methods.
1845 //===----------------------------------------------------------------------===//
1846 
1847 void ASTDumper::VisitExpr(const Expr *Node) {
1848  VisitStmt(Node);
1849  dumpType(Node->getType());
1850 
1851  {
1852  ColorScope Color(*this, ValueKindColor);
1853  switch (Node->getValueKind()) {
1854  case VK_RValue:
1855  break;
1856  case VK_LValue:
1857  OS << " lvalue";
1858  break;
1859  case VK_XValue:
1860  OS << " xvalue";
1861  break;
1862  }
1863  }
1864 
1865  {
1866  ColorScope Color(*this, ObjectKindColor);
1867  switch (Node->getObjectKind()) {
1868  case OK_Ordinary:
1869  break;
1870  case OK_BitField:
1871  OS << " bitfield";
1872  break;
1873  case OK_ObjCProperty:
1874  OS << " objcproperty";
1875  break;
1876  case OK_ObjCSubscript:
1877  OS << " objcsubscript";
1878  break;
1879  case OK_VectorComponent:
1880  OS << " vectorcomponent";
1881  break;
1882  }
1883  }
1884 }
1885 
1886 static void dumpBasePath(raw_ostream &OS, const CastExpr *Node) {
1887  if (Node->path_empty())
1888  return;
1889 
1890  OS << " (";
1891  bool First = true;
1892  for (CastExpr::path_const_iterator I = Node->path_begin(),
1893  E = Node->path_end();
1894  I != E; ++I) {
1895  const CXXBaseSpecifier *Base = *I;
1896  if (!First)
1897  OS << " -> ";
1898 
1899  const CXXRecordDecl *RD =
1900  cast<CXXRecordDecl>(Base->getType()->getAs<RecordType>()->getDecl());
1901 
1902  if (Base->isVirtual())
1903  OS << "virtual ";
1904  OS << RD->getName();
1905  First = false;
1906  }
1907 
1908  OS << ')';
1909 }
1910 
1911 void ASTDumper::VisitCastExpr(const CastExpr *Node) {
1912  VisitExpr(Node);
1913  OS << " <";
1914  {
1915  ColorScope Color(*this, CastColor);
1916  OS << Node->getCastKindName();
1917  }
1918  dumpBasePath(OS, Node);
1919  OS << ">";
1920 }
1921 
1922 void ASTDumper::VisitDeclRefExpr(const DeclRefExpr *Node) {
1923  VisitExpr(Node);
1924 
1925  OS << " ";
1926  dumpBareDeclRef(Node->getDecl());
1927  if (Node->getDecl() != Node->getFoundDecl()) {
1928  OS << " (";
1929  dumpBareDeclRef(Node->getFoundDecl());
1930  OS << ")";
1931  }
1932 }
1933 
1934 void ASTDumper::VisitUnresolvedLookupExpr(const UnresolvedLookupExpr *Node) {
1935  VisitExpr(Node);
1936  OS << " (";
1937  if (!Node->requiresADL())
1938  OS << "no ";
1939  OS << "ADL) = '" << Node->getName() << '\'';
1940 
1942  I = Node->decls_begin(), E = Node->decls_end();
1943  if (I == E)
1944  OS << " empty";
1945  for (; I != E; ++I)
1946  dumpPointer(*I);
1947 }
1948 
1949 void ASTDumper::VisitObjCIvarRefExpr(const ObjCIvarRefExpr *Node) {
1950  VisitExpr(Node);
1951 
1952  {
1953  ColorScope Color(*this, DeclKindNameColor);
1954  OS << " " << Node->getDecl()->getDeclKindName() << "Decl";
1955  }
1956  OS << "='" << *Node->getDecl() << "'";
1957  dumpPointer(Node->getDecl());
1958  if (Node->isFreeIvar())
1959  OS << " isFreeIvar";
1960 }
1961 
1962 void ASTDumper::VisitPredefinedExpr(const PredefinedExpr *Node) {
1963  VisitExpr(Node);
1964  OS << " " << PredefinedExpr::getIdentTypeName(Node->getIdentType());
1965 }
1966 
1967 void ASTDumper::VisitCharacterLiteral(const CharacterLiteral *Node) {
1968  VisitExpr(Node);
1969  ColorScope Color(*this, ValueColor);
1970  OS << " " << Node->getValue();
1971 }
1972 
1973 void ASTDumper::VisitIntegerLiteral(const IntegerLiteral *Node) {
1974  VisitExpr(Node);
1975 
1976  bool isSigned = Node->getType()->isSignedIntegerType();
1977  ColorScope Color(*this, ValueColor);
1978  OS << " " << Node->getValue().toString(10, isSigned);
1979 }
1980 
1981 void ASTDumper::VisitFloatingLiteral(const FloatingLiteral *Node) {
1982  VisitExpr(Node);
1983  ColorScope Color(*this, ValueColor);
1984  OS << " " << Node->getValueAsApproximateDouble();
1985 }
1986 
1987 void ASTDumper::VisitStringLiteral(const StringLiteral *Str) {
1988  VisitExpr(Str);
1989  ColorScope Color(*this, ValueColor);
1990  OS << " ";
1991  Str->outputString(OS);
1992 }
1993 
1994 void ASTDumper::VisitInitListExpr(const InitListExpr *ILE) {
1995  VisitExpr(ILE);
1996  if (auto *Filler = ILE->getArrayFiller()) {
1997  dumpChild([=] {
1998  OS << "array filler";
1999  dumpStmt(Filler);
2000  });
2001  }
2002  if (auto *Field = ILE->getInitializedFieldInUnion()) {
2003  OS << " field ";
2004  dumpBareDeclRef(Field);
2005  }
2006 }
2007 
2008 void ASTDumper::VisitUnaryOperator(const UnaryOperator *Node) {
2009  VisitExpr(Node);
2010  OS << " " << (Node->isPostfix() ? "postfix" : "prefix")
2011  << " '" << UnaryOperator::getOpcodeStr(Node->getOpcode()) << "'";
2012 }
2013 
2014 void ASTDumper::VisitUnaryExprOrTypeTraitExpr(
2015  const UnaryExprOrTypeTraitExpr *Node) {
2016  VisitExpr(Node);
2017  switch(Node->getKind()) {
2018  case UETT_SizeOf:
2019  OS << " sizeof";
2020  break;
2021  case UETT_AlignOf:
2022  OS << " alignof";
2023  break;
2024  case UETT_VecStep:
2025  OS << " vec_step";
2026  break;
2028  OS << " __builtin_omp_required_simd_align";
2029  break;
2030  }
2031  if (Node->isArgumentType())
2032  dumpType(Node->getArgumentType());
2033 }
2034 
2035 void ASTDumper::VisitMemberExpr(const MemberExpr *Node) {
2036  VisitExpr(Node);
2037  OS << " " << (Node->isArrow() ? "->" : ".") << *Node->getMemberDecl();
2038  dumpPointer(Node->getMemberDecl());
2039 }
2040 
2041 void ASTDumper::VisitExtVectorElementExpr(const ExtVectorElementExpr *Node) {
2042  VisitExpr(Node);
2043  OS << " " << Node->getAccessor().getNameStart();
2044 }
2045 
2046 void ASTDumper::VisitBinaryOperator(const BinaryOperator *Node) {
2047  VisitExpr(Node);
2048  OS << " '" << BinaryOperator::getOpcodeStr(Node->getOpcode()) << "'";
2049 }
2050 
2051 void ASTDumper::VisitCompoundAssignOperator(
2052  const CompoundAssignOperator *Node) {
2053  VisitExpr(Node);
2054  OS << " '" << BinaryOperator::getOpcodeStr(Node->getOpcode())
2055  << "' ComputeLHSTy=";
2056  dumpBareType(Node->getComputationLHSType());
2057  OS << " ComputeResultTy=";
2058  dumpBareType(Node->getComputationResultType());
2059 }
2060 
2061 void ASTDumper::VisitBlockExpr(const BlockExpr *Node) {
2062  VisitExpr(Node);
2063  dumpDecl(Node->getBlockDecl());
2064 }
2065 
2066 void ASTDumper::VisitOpaqueValueExpr(const OpaqueValueExpr *Node) {
2067  VisitExpr(Node);
2068 
2069  if (Expr *Source = Node->getSourceExpr())
2070  dumpStmt(Source);
2071 }
2072 
2073 // GNU extensions.
2074 
2075 void ASTDumper::VisitAddrLabelExpr(const AddrLabelExpr *Node) {
2076  VisitExpr(Node);
2077  OS << " " << Node->getLabel()->getName();
2078  dumpPointer(Node->getLabel());
2079 }
2080 
2081 //===----------------------------------------------------------------------===//
2082 // C++ Expressions
2083 //===----------------------------------------------------------------------===//
2084 
2085 void ASTDumper::VisitCXXNamedCastExpr(const CXXNamedCastExpr *Node) {
2086  VisitExpr(Node);
2087  OS << " " << Node->getCastName()
2088  << "<" << Node->getTypeAsWritten().getAsString() << ">"
2089  << " <" << Node->getCastKindName();
2090  dumpBasePath(OS, Node);
2091  OS << ">";
2092 }
2093 
2094 void ASTDumper::VisitCXXBoolLiteralExpr(const CXXBoolLiteralExpr *Node) {
2095  VisitExpr(Node);
2096  OS << " " << (Node->getValue() ? "true" : "false");
2097 }
2098 
2099 void ASTDumper::VisitCXXThisExpr(const CXXThisExpr *Node) {
2100  VisitExpr(Node);
2101  OS << " this";
2102 }
2103 
2104 void ASTDumper::VisitCXXFunctionalCastExpr(const CXXFunctionalCastExpr *Node) {
2105  VisitExpr(Node);
2106  OS << " functional cast to " << Node->getTypeAsWritten().getAsString()
2107  << " <" << Node->getCastKindName() << ">";
2108 }
2109 
2110 void ASTDumper::VisitCXXConstructExpr(const CXXConstructExpr *Node) {
2111  VisitExpr(Node);
2112  CXXConstructorDecl *Ctor = Node->getConstructor();
2113  dumpType(Ctor->getType());
2114  if (Node->isElidable())
2115  OS << " elidable";
2116  if (Node->requiresZeroInitialization())
2117  OS << " zeroing";
2118 }
2119 
2120 void ASTDumper::VisitCXXBindTemporaryExpr(const CXXBindTemporaryExpr *Node) {
2121  VisitExpr(Node);
2122  OS << " ";
2123  dumpCXXTemporary(Node->getTemporary());
2124 }
2125 
2126 void ASTDumper::VisitCXXNewExpr(const CXXNewExpr *Node) {
2127  VisitExpr(Node);
2128  if (Node->isGlobalNew())
2129  OS << " global";
2130  if (Node->isArray())
2131  OS << " array";
2132  if (Node->getOperatorNew()) {
2133  OS << ' ';
2134  dumpBareDeclRef(Node->getOperatorNew());
2135  }
2136  // We could dump the deallocation function used in case of error, but it's
2137  // usually not that interesting.
2138 }
2139 
2140 void ASTDumper::VisitCXXDeleteExpr(const CXXDeleteExpr *Node) {
2141  VisitExpr(Node);
2142  if (Node->isGlobalDelete())
2143  OS << " global";
2144  if (Node->isArrayForm())
2145  OS << " array";
2146  if (Node->getOperatorDelete()) {
2147  OS << ' ';
2148  dumpBareDeclRef(Node->getOperatorDelete());
2149  }
2150 }
2151 
2152 void
2153 ASTDumper::VisitMaterializeTemporaryExpr(const MaterializeTemporaryExpr *Node) {
2154  VisitExpr(Node);
2155  if (const ValueDecl *VD = Node->getExtendingDecl()) {
2156  OS << " extended by ";
2157  dumpBareDeclRef(VD);
2158  }
2159 }
2160 
2161 void ASTDumper::VisitExprWithCleanups(const ExprWithCleanups *Node) {
2162  VisitExpr(Node);
2163  for (unsigned i = 0, e = Node->getNumObjects(); i != e; ++i)
2164  dumpDeclRef(Node->getObject(i), "cleanup");
2165 }
2166 
2167 void ASTDumper::dumpCXXTemporary(const CXXTemporary *Temporary) {
2168  OS << "(CXXTemporary";
2169  dumpPointer(Temporary);
2170  OS << ")";
2171 }
2172 
2173 void ASTDumper::VisitSizeOfPackExpr(const SizeOfPackExpr *Node) {
2174  VisitExpr(Node);
2175  dumpPointer(Node->getPack());
2176  dumpName(Node->getPack());
2177  if (Node->isPartiallySubstituted())
2178  for (const auto &A : Node->getPartialArguments())
2179  dumpTemplateArgument(A);
2180 }
2181 
2182 
2183 //===----------------------------------------------------------------------===//
2184 // Obj-C Expressions
2185 //===----------------------------------------------------------------------===//
2186 
2187 void ASTDumper::VisitObjCMessageExpr(const ObjCMessageExpr *Node) {
2188  VisitExpr(Node);
2189  OS << " selector=";
2190  Node->getSelector().print(OS);
2191  switch (Node->getReceiverKind()) {
2193  break;
2194 
2196  OS << " class=";
2197  dumpBareType(Node->getClassReceiver());
2198  break;
2199 
2201  OS << " super (instance)";
2202  break;
2203 
2205  OS << " super (class)";
2206  break;
2207  }
2208 }
2209 
2210 void ASTDumper::VisitObjCBoxedExpr(const ObjCBoxedExpr *Node) {
2211  VisitExpr(Node);
2212  if (auto *BoxingMethod = Node->getBoxingMethod()) {
2213  OS << " selector=";
2214  BoxingMethod->getSelector().print(OS);
2215  }
2216 }
2217 
2218 void ASTDumper::VisitObjCAtCatchStmt(const ObjCAtCatchStmt *Node) {
2219  VisitStmt(Node);
2220  if (const VarDecl *CatchParam = Node->getCatchParamDecl())
2221  dumpDecl(CatchParam);
2222  else
2223  OS << " catch all";
2224 }
2225 
2226 void ASTDumper::VisitObjCEncodeExpr(const ObjCEncodeExpr *Node) {
2227  VisitExpr(Node);
2228  dumpType(Node->getEncodedType());
2229 }
2230 
2231 void ASTDumper::VisitObjCSelectorExpr(const ObjCSelectorExpr *Node) {
2232  VisitExpr(Node);
2233 
2234  OS << " ";
2235  Node->getSelector().print(OS);
2236 }
2237 
2238 void ASTDumper::VisitObjCProtocolExpr(const ObjCProtocolExpr *Node) {
2239  VisitExpr(Node);
2240 
2241  OS << ' ' << *Node->getProtocol();
2242 }
2243 
2244 void ASTDumper::VisitObjCPropertyRefExpr(const ObjCPropertyRefExpr *Node) {
2245  VisitExpr(Node);
2246  if (Node->isImplicitProperty()) {
2247  OS << " Kind=MethodRef Getter=\"";
2248  if (Node->getImplicitPropertyGetter())
2250  else
2251  OS << "(null)";
2252 
2253  OS << "\" Setter=\"";
2254  if (ObjCMethodDecl *Setter = Node->getImplicitPropertySetter())
2255  Setter->getSelector().print(OS);
2256  else
2257  OS << "(null)";
2258  OS << "\"";
2259  } else {
2260  OS << " Kind=PropertyRef Property=\"" << *Node->getExplicitProperty() <<'"';
2261  }
2262 
2263  if (Node->isSuperReceiver())
2264  OS << " super";
2265 
2266  OS << " Messaging=";
2267  if (Node->isMessagingGetter() && Node->isMessagingSetter())
2268  OS << "Getter&Setter";
2269  else if (Node->isMessagingGetter())
2270  OS << "Getter";
2271  else if (Node->isMessagingSetter())
2272  OS << "Setter";
2273 }
2274 
2275 void ASTDumper::VisitObjCSubscriptRefExpr(const ObjCSubscriptRefExpr *Node) {
2276  VisitExpr(Node);
2277  if (Node->isArraySubscriptRefExpr())
2278  OS << " Kind=ArraySubscript GetterForArray=\"";
2279  else
2280  OS << " Kind=DictionarySubscript GetterForDictionary=\"";
2281  if (Node->getAtIndexMethodDecl())
2282  Node->getAtIndexMethodDecl()->getSelector().print(OS);
2283  else
2284  OS << "(null)";
2285 
2286  if (Node->isArraySubscriptRefExpr())
2287  OS << "\" SetterForArray=\"";
2288  else
2289  OS << "\" SetterForDictionary=\"";
2290  if (Node->setAtIndexMethodDecl())
2291  Node->setAtIndexMethodDecl()->getSelector().print(OS);
2292  else
2293  OS << "(null)";
2294 }
2295 
2296 void ASTDumper::VisitObjCBoolLiteralExpr(const ObjCBoolLiteralExpr *Node) {
2297  VisitExpr(Node);
2298  OS << " " << (Node->getValue() ? "__objc_yes" : "__objc_no");
2299 }
2300 
2301 //===----------------------------------------------------------------------===//
2302 // Comments
2303 //===----------------------------------------------------------------------===//
2304 
2305 const char *ASTDumper::getCommandName(unsigned CommandID) {
2306  if (Traits)
2307  return Traits->getCommandInfo(CommandID)->Name;
2308  const CommandInfo *Info = CommandTraits::getBuiltinCommandInfo(CommandID);
2309  if (Info)
2310  return Info->Name;
2311  return "<not a builtin command>";
2312 }
2313 
2314 void ASTDumper::dumpFullComment(const FullComment *C) {
2315  if (!C)
2316  return;
2317 
2318  FC = C;
2319  dumpComment(C);
2320  FC = nullptr;
2321 }
2322 
2323 void ASTDumper::dumpComment(const Comment *C) {
2324  dumpChild([=] {
2325  if (!C) {
2326  ColorScope Color(*this, NullColor);
2327  OS << "<<<NULL>>>";
2328  return;
2329  }
2330 
2331  {
2332  ColorScope Color(*this, CommentColor);
2333  OS << C->getCommentKindName();
2334  }
2335  dumpPointer(C);
2336  dumpSourceRange(C->getSourceRange());
2338  for (Comment::child_iterator I = C->child_begin(), E = C->child_end();
2339  I != E; ++I)
2340  dumpComment(*I);
2341  });
2342 }
2343 
2344 void ASTDumper::visitTextComment(const TextComment *C) {
2345  OS << " Text=\"" << C->getText() << "\"";
2346 }
2347 
2348 void ASTDumper::visitInlineCommandComment(const InlineCommandComment *C) {
2349  OS << " Name=\"" << getCommandName(C->getCommandID()) << "\"";
2350  switch (C->getRenderKind()) {
2352  OS << " RenderNormal";
2353  break;
2355  OS << " RenderBold";
2356  break;
2358  OS << " RenderMonospaced";
2359  break;
2361  OS << " RenderEmphasized";
2362  break;
2363  }
2364 
2365  for (unsigned i = 0, e = C->getNumArgs(); i != e; ++i)
2366  OS << " Arg[" << i << "]=\"" << C->getArgText(i) << "\"";
2367 }
2368 
2369 void ASTDumper::visitHTMLStartTagComment(const HTMLStartTagComment *C) {
2370  OS << " Name=\"" << C->getTagName() << "\"";
2371  if (C->getNumAttrs() != 0) {
2372  OS << " Attrs: ";
2373  for (unsigned i = 0, e = C->getNumAttrs(); i != e; ++i) {
2375  OS << " \"" << Attr.Name << "=\"" << Attr.Value << "\"";
2376  }
2377  }
2378  if (C->isSelfClosing())
2379  OS << " SelfClosing";
2380 }
2381 
2382 void ASTDumper::visitHTMLEndTagComment(const HTMLEndTagComment *C) {
2383  OS << " Name=\"" << C->getTagName() << "\"";
2384 }
2385 
2386 void ASTDumper::visitBlockCommandComment(const BlockCommandComment *C) {
2387  OS << " Name=\"" << getCommandName(C->getCommandID()) << "\"";
2388  for (unsigned i = 0, e = C->getNumArgs(); i != e; ++i)
2389  OS << " Arg[" << i << "]=\"" << C->getArgText(i) << "\"";
2390 }
2391 
2392 void ASTDumper::visitParamCommandComment(const ParamCommandComment *C) {
2394 
2395  if (C->isDirectionExplicit())
2396  OS << " explicitly";
2397  else
2398  OS << " implicitly";
2399 
2400  if (C->hasParamName()) {
2401  if (C->isParamIndexValid())
2402  OS << " Param=\"" << C->getParamName(FC) << "\"";
2403  else
2404  OS << " Param=\"" << C->getParamNameAsWritten() << "\"";
2405  }
2406 
2407  if (C->isParamIndexValid() && !C->isVarArgParam())
2408  OS << " ParamIndex=" << C->getParamIndex();
2409 }
2410 
2411 void ASTDumper::visitTParamCommandComment(const TParamCommandComment *C) {
2412  if (C->hasParamName()) {
2413  if (C->isPositionValid())
2414  OS << " Param=\"" << C->getParamName(FC) << "\"";
2415  else
2416  OS << " Param=\"" << C->getParamNameAsWritten() << "\"";
2417  }
2418 
2419  if (C->isPositionValid()) {
2420  OS << " Position=<";
2421  for (unsigned i = 0, e = C->getDepth(); i != e; ++i) {
2422  OS << C->getIndex(i);
2423  if (i != e - 1)
2424  OS << ", ";
2425  }
2426  OS << ">";
2427  }
2428 }
2429 
2430 void ASTDumper::visitVerbatimBlockComment(const VerbatimBlockComment *C) {
2431  OS << " Name=\"" << getCommandName(C->getCommandID()) << "\""
2432  " CloseName=\"" << C->getCloseName() << "\"";
2433 }
2434 
2435 void ASTDumper::visitVerbatimBlockLineComment(
2436  const VerbatimBlockLineComment *C) {
2437  OS << " Text=\"" << C->getText() << "\"";
2438 }
2439 
2440 void ASTDumper::visitVerbatimLineComment(const VerbatimLineComment *C) {
2441  OS << " Text=\"" << C->getText() << "\"";
2442 }
2443 
2444 //===----------------------------------------------------------------------===//
2445 // Type method implementations
2446 //===----------------------------------------------------------------------===//
2447 
2448 void QualType::dump(const char *msg) const {
2449  if (msg)
2450  llvm::errs() << msg << ": ";
2451  dump();
2452 }
2453 
2454 LLVM_DUMP_METHOD void QualType::dump() const {
2455  ASTDumper Dumper(llvm::errs(), nullptr, nullptr);
2456  Dumper.dumpTypeAsChild(*this);
2457 }
2458 
2459 LLVM_DUMP_METHOD void Type::dump() const { QualType(this, 0).dump(); }
2460 
2461 //===----------------------------------------------------------------------===//
2462 // Decl method implementations
2463 //===----------------------------------------------------------------------===//
2464 
2465 LLVM_DUMP_METHOD void Decl::dump() const { dump(llvm::errs()); }
2466 
2467 LLVM_DUMP_METHOD void Decl::dump(raw_ostream &OS) const {
2468  ASTDumper P(OS, &getASTContext().getCommentCommandTraits(),
2469  &getASTContext().getSourceManager());
2470  P.dumpDecl(this);
2471 }
2472 
2473 LLVM_DUMP_METHOD void Decl::dumpColor() const {
2474  ASTDumper P(llvm::errs(), &getASTContext().getCommentCommandTraits(),
2475  &getASTContext().getSourceManager(), /*ShowColors*/true);
2476  P.dumpDecl(this);
2477 }
2478 
2479 LLVM_DUMP_METHOD void DeclContext::dumpLookups() const {
2480  dumpLookups(llvm::errs());
2481 }
2482 
2483 LLVM_DUMP_METHOD void DeclContext::dumpLookups(raw_ostream &OS,
2484  bool DumpDecls) const {
2485  const DeclContext *DC = this;
2486  while (!DC->isTranslationUnit())
2487  DC = DC->getParent();
2488  ASTContext &Ctx = cast<TranslationUnitDecl>(DC)->getASTContext();
2489  ASTDumper P(OS, &Ctx.getCommentCommandTraits(), &Ctx.getSourceManager());
2490  P.dumpLookups(this, DumpDecls);
2491 }
2492 
2493 //===----------------------------------------------------------------------===//
2494 // Stmt method implementations
2495 //===----------------------------------------------------------------------===//
2496 
2497 LLVM_DUMP_METHOD void Stmt::dump(SourceManager &SM) const {
2498  dump(llvm::errs(), SM);
2499 }
2500 
2501 LLVM_DUMP_METHOD void Stmt::dump(raw_ostream &OS, SourceManager &SM) const {
2502  ASTDumper P(OS, nullptr, &SM);
2503  P.dumpStmt(this);
2504 }
2505 
2506 LLVM_DUMP_METHOD void Stmt::dump(raw_ostream &OS) const {
2507  ASTDumper P(OS, nullptr, nullptr);
2508  P.dumpStmt(this);
2509 }
2510 
2511 LLVM_DUMP_METHOD void Stmt::dump() const {
2512  ASTDumper P(llvm::errs(), nullptr, nullptr);
2513  P.dumpStmt(this);
2514 }
2515 
2516 LLVM_DUMP_METHOD void Stmt::dumpColor() const {
2517  ASTDumper P(llvm::errs(), nullptr, nullptr, /*ShowColors*/true);
2518  P.dumpStmt(this);
2519 }
2520 
2521 //===----------------------------------------------------------------------===//
2522 // Comment method implementations
2523 //===----------------------------------------------------------------------===//
2524 
2525 LLVM_DUMP_METHOD void Comment::dump() const {
2526  dump(llvm::errs(), nullptr, nullptr);
2527 }
2528 
2529 LLVM_DUMP_METHOD void Comment::dump(const ASTContext &Context) const {
2530  dump(llvm::errs(), &Context.getCommentCommandTraits(),
2531  &Context.getSourceManager());
2532 }
2533 
2534 void Comment::dump(raw_ostream &OS, const CommandTraits *Traits,
2535  const SourceManager *SM) const {
2536  const FullComment *FC = dyn_cast<FullComment>(this);
2537  ASTDumper D(OS, Traits, SM);
2538  D.dumpFullComment(FC);
2539 }
2540 
2541 LLVM_DUMP_METHOD void Comment::dumpColor() const {
2542  const FullComment *FC = dyn_cast<FullComment>(this);
2543  ASTDumper D(llvm::errs(), nullptr, nullptr, /*ShowColors*/true);
2544  D.dumpFullComment(FC);
2545 }
decl_iterator noload_decls_end() const
Definition: DeclBase.h:1465
ObjCPropertyRefExpr - A dot-syntax expression to access an ObjC property.
Definition: ExprObjC.h:539
unsigned getNumElements() const
Definition: Type.h:2781
The receiver is the instance of the superclass object.
Definition: ExprObjC.h:1009
ValueDecl * getMemberDecl() const
Retrieve the member declaration to which this expression refers.
Definition: Expr.h:2411
Defines the clang::ASTContext interface.
SourceLocation getEnd() const
Expr * getSizeExpr() const
Definition: Type.h:2731
const Type * Ty
The locally-unqualified type.
Definition: Type.h:543
ObjCInterfaceDecl * getDecl() const
Get the declaration of this interface.
Definition: Type.h:4948
ExprObjectKind getObjectKind() const
getObjectKind - The object kind that this expression produces.
Definition: Expr.h:408
FunctionDecl - An instance of this class is created to represent a function declaration or definition...
Definition: Decl.h:1561
NamedDecl * getFoundDecl()
Get the NamedDecl through which this reference occurred.
Definition: Expr.h:1054
bool isVarArgParam() const LLVM_READONLY
Definition: Comment.h:782
The receiver is an object instance.
Definition: ExprObjC.h:1005
iterator begin() const
Definition: DeclBase.h:1103
StringRef getName() const
getName - Get the name of identifier for this declaration as a StringRef.
Definition: Decl.h:237
unsigned getDepth() const
Definition: Type.h:3945
protocol_range protocols() const
Definition: DeclObjC.h:2025
PointerType - C99 6.7.5.1 - Pointer Declarators.
Definition: Type.h:2179
Represents the dependent type named by a dependently-scoped typename using declaration, e.g.
Definition: Type.h:3473
A (possibly-)qualified type.
Definition: Type.h:598
ArrayRef< Capture > captures() const
Definition: Decl.h:3581
bool isVirtual() const
Determines whether the base class is a virtual base class (or not).
Definition: DeclCXX.h:208
base_class_range bases()
Definition: DeclCXX.h:718
SourceRange getBracketsRange() const
Definition: Type.h:2628
unsigned getColumn() const
Return the presumed column number of this location.
ArrayRef< OMPClause * > clauses()
Definition: StmtOpenMP.h:215
bool getValue() const
Definition: ExprCXX.h:483
llvm::APSInt getAsIntegral() const
Retrieve the template argument as an integral value.
Definition: TemplateBase.h:282
ObjCInterfaceDecl * getClassInterface()
Definition: DeclObjC.h:2214
bool isVariadic() const
Definition: Decl.h:3532
bool isBitField() const
Determines whether this field is a bitfield.
Definition: Decl.h:2361
QualType getType() const
Retrieves the type of the base class.
Definition: DeclCXX.h:254
bool isElidable() const
Whether this construction is elidable.
Definition: ExprCXX.h:1231
ConstStmtVisitor - This class implements a simple visitor for Stmt subclasses.
Definition: StmtVisitor.h:187
QualType getClassReceiver() const
Returns the type of a class message send, or NULL if the message is not a class message.
Definition: ExprObjC.h:1174
QualType getBaseType() const
Definition: Type.h:3653
bool isInstantiationDependentType() const
Determine whether this type is an instantiation-dependent type, meaning that the type involves a temp...
Definition: Type.h:1780
bool isPositionValid() const LLVM_READONLY
Definition: Comment.h:848
PropertyControl getPropertyImplementation() const
Definition: DeclObjC.h:870
CXXMethodDecl * getSpecialization() const
SourceLocation getSpellingLoc(SourceLocation Loc) const
Given a SourceLocation object, return the spelling location referenced by the ID. ...
bool isFixed() const
Returns true if this is an Objective-C, C++11, or Microsoft-style enumeration with a fixed underlying...
Definition: Decl.h:3199
bool isParameterPack() const
Returns whether this is a parameter pack.
FunctionType - C99 6.7.5.3 - Function Declarators.
Definition: Type.h:2879
bool isInvalid() const
Return true if this object is invalid or uninitialized.
const Expr * getInitExpr() const
Definition: Decl.h:2498
bool isArgumentType() const
Definition: Expr.h:2010
EnumConstantDecl - An instance of this object exists for each enum constant that is defined...
Definition: Decl.h:2481
bool isGlobalDelete() const
Definition: ExprCXX.h:2041
bool isMessagingGetter() const
True if the property reference will result in a message to the getter.
Definition: ExprObjC.h:663
TypedefDecl - Represents the declaration of a typedef-name via the 'typedef' type specifier...
Definition: Decl.h:2681
Defines the SourceManager interface.
The template argument is an expression, and we've not resolved it to one of the other forms yet...
Definition: TemplateBase.h:69
CXXRecordDecl * getDecl() const
Definition: Type.cpp:3065
QualType getUnderlyingType() const
Definition: Decl.h:2649
CXXCtorInitializer *const * init_const_iterator
init_const_iterator - Iterates through the ivar initializer list.
Definition: DeclObjC.h:2511
Defines the clang::Module class, which describes a module in the source code.
ObjCMethodDecl * getAtIndexMethodDecl() const
Definition: ExprObjC.h:813
A reference to a name which we were able to look up during parsing but could not resolve to a specifi...
Definition: ExprCXX.h:2671
StringRef P
Represents a C++11 auto or C++14 decltype(auto) type.
Definition: Type.h:4084
Represents an attribute applied to a statement.
Definition: Stmt.h:830
std::string getAsString() const
Definition: Type.h:924
pack_iterator pack_begin() const
Iterator referencing the first argument of a template argument pack.
Definition: TemplateBase.h:315
const char * getCastKindName() const
Definition: Expr.cpp:1597
QualType getPointeeType() const
Definition: Type.h:2420
The base class of the type hierarchy.
Definition: Type.h:1281
The parameter is covariant, e.g., X<T> is a subtype of X<U> when the type parameter is covariant and ...
Declaration of a variable template.
Represents an array type, per C99 6.7.5.2 - Array Declarators.
Definition: Type.h:2456
const Expr * getInit() const
Definition: Decl.h:1139
The template argument is a declaration that was provided for a pointer, reference, or pointer to member non-type template parameter.
Definition: TemplateBase.h:51
NamespaceDecl - Represent a C++ namespace.
Definition: Decl.h:471
Represents a call to a C++ constructor.
Definition: ExprCXX.h:1162
ObjCSubscriptRefExpr - used for array and dictionary subscripting.
Definition: ExprObjC.h:760
RetTy Visit(const Type *T)
Performs the operation associated with this visitor object.
Definition: TypeVisitor.h:69
bool isDecltypeAuto() const
Definition: Type.h:4099
AccessSpecifier
A C++ access specifier (public, private, protected), plus the special value "none" which means differ...
Definition: Specifiers.h:93
bool isMessagingSetter() const
True if the property reference will result in a message to the setter.
Definition: ExprObjC.h:670
A container of type source information.
Definition: Decl.h:62
unsigned getIndex() const
Definition: Type.h:3946
Expr * getAsExpr() const
Retrieve the template argument as an expression.
Definition: TemplateBase.h:305
Represents a C++ constructor within a class.
Definition: DeclCXX.h:2187
Represents a prvalue temporary that is written into memory so that a reference can bind to it...
Definition: ExprCXX.h:3962
bool isSpelledAsLValue() const
Definition: Type.h:2336
Expr * getInClassInitializer() const
getInClassInitializer - Get the C++11 in-class initializer for this member, or null if one has not be...
Definition: Decl.h:2416
NamedDecl *const * const_iterator
Iterates through the template parameters in this list.
Definition: DeclTemplate.h:85
IdentType getIdentType() const
Definition: Expr.h:1187
const llvm::APInt & getSize() const
Definition: Type.h:2527
Represents a #pragma comment line.
Definition: Decl.h:109
ObjCTypeParamVariance getVariance() const
Determine the variance of this type parameter.
Definition: DeclObjC.h:572
void * getAsOpaquePtr() const
Definition: Type.h:646
const CXXBaseSpecifier *const * path_const_iterator
Definition: Expr.h:2697
const TemplateArgumentListInfo & templateArgs() const
FriendDecl - Represents the declaration of a friend entity, which can be a function, a type, or a templated function or type.
Definition: DeclFriend.h:40
An Objective-C array/dictionary subscripting which reads an object or writes at the subscripted array...
Definition: Specifiers.h:136
ArrayRef< TemplateArgument > getPartialArguments() const
Get.
Definition: ExprCXX.h:3746
VarDecl - An instance of this class is created to represent a variable declaration or definition...
Definition: Decl.h:768
Expr * getInit() const
Get the initializer.
Definition: DeclCXX.h:2155
bool capturesCXXThis() const
Definition: Decl.h:3586
TLSKind getTLSKind() const
Definition: Decl.cpp:1818
Represents an empty template argument, e.g., one that has not been deduced.
Definition: TemplateBase.h:46
Extra information about a function prototype.
Definition: Type.h:3167
std::string getAsString() const
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:113
NamedDecl * getUnderlyingDecl()
Looks through UsingDecls and ObjCCompatibleAliasDecls for the underlying named decl.
Definition: Decl.h:387
TemplateTypeParmDecl * getDecl() const
Definition: Type.h:3949
QualType getOriginalType() const
Definition: Type.h:2243
UnaryExprOrTypeTrait getKind() const
Definition: Expr.h:2005
Stores a list of template parameters for a TemplateDecl and its derived classes.
Definition: DeclTemplate.h:49
Not a TLS variable.
Definition: Decl.h:785
Qualifiers getIndexTypeQualifiers() const
Definition: Type.h:2494
unsigned getValue() const
Definition: Expr.h:1338
Represents an expression – generally a full-expression – that introduces cleanups to be run at the en...
Definition: ExprCXX.h:2936
bool containsUnexpandedParameterPack() const
Whether this type is or contains an unexpanded parameter pack, used to support C++0x variadic templat...
Definition: Type.h:1553
ParmVarDecl - Represents a parameter to a function.
Definition: Decl.h:1377
Represents the result of substituting a type for a template type parameter.
Definition: Type.h:3983
void dump(const char *s) const
Definition: ASTDumper.cpp:2448
bool isBaseInitializer() const
Determine whether this initializer is initializing a base class.
Definition: DeclCXX.h:2002
Represents the builtin template declaration which is used to implement __make_integer_seq and other b...
QualType getType() const
Definition: DeclObjC.h:781
NamedDecl * getTargetDecl() const
Gets the underlying declaration which has been brought into the local scope.
Definition: DeclCXX.h:2889
TypeSourceInfo * getFriendType() const
If this friend declaration names an (untemplated but possibly dependent) type, return the type; other...
Definition: DeclFriend.h:107
PipeType - OpenCL20.
Definition: Type.h:5190
StringRef getArgText(unsigned Idx) const
Definition: Comment.h:678
Information about a single command.
LabelStmt - Represents a label, which has a substatement.
Definition: Stmt.h:789
Kind getPropertyImplementation() const
Definition: DeclObjC.h:2717
RecordDecl - Represents a struct/union/class.
Definition: Decl.h:3253
std::string getFullModuleName() const
Retrieve the full name of this module, including the path from its top-level module.
ObjCTypeParamList * getTypeParamListAsWritten() const
Retrieve the type parameters written on this particular declaration of the class. ...
Definition: DeclObjC.h:1224
ConstructorUsingShadowDecl * getConstructedBaseClassShadowDecl() const
Get the inheriting constructor declaration for the base class for which we don't have an explicit ini...
Definition: DeclCXX.h:2997
const char * getOpenMPClauseName(OpenMPClauseKind Kind)
Definition: OpenMPKinds.cpp:62
Provides common interface for the Decls that can be redeclared.
Definition: Redeclarable.h:27
QualType getElementType() const
Definition: Type.h:2732
Represents a class template specialization, which refers to a class template with a given set of temp...
bool isScopedUsingClassTag() const
Returns true if this is a C++11 scoped enumeration.
Definition: Decl.h:3193
ObjCProtocolDecl * getProtocol() const
Definition: ExprObjC.h:453
comments::CommandTraits & getCommentCommandTraits() const
Definition: ASTContext.h:768
StringRef getParamNameAsWritten() const
Definition: Comment.h:770
StringLiteral * getMessage()
Definition: DeclCXX.h:3350
class LLVM_ALIGNAS(8) DependentTemplateSpecializationType const IdentifierInfo * Name
Represents a template specialization type whose template cannot be resolved, e.g. ...
Definition: Type.h:4549
A vector component is an element or range of elements on a vector.
Definition: Specifiers.h:127
Expr * getSizeExpr() const
Definition: Type.h:2623
bool isVariablyModifiedType() const
Whether this type is a variably-modified type (C99 6.7.5).
Definition: Type.h:1789
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:92
is ARM Neon vector
Definition: Type.h:2763
The results of name lookup within a DeclContext.
Definition: DeclBase.h:1067
bool hasExternalLexicalStorage() const
Whether this DeclContext has external storage containing additional declarations that are lexically i...
Definition: DeclBase.h:1756
ArrayRef< QualType > getParamTypes() const
Definition: Type.h:3276
The template argument is an integral value stored in an llvm::APSInt that was provided for an integra...
Definition: TemplateBase.h:57
The parameter is contravariant, e.g., X<T> is a subtype of X<U> when the type parameter is covariant ...
protocol_iterator protocol_begin() const
Definition: DeclObjC.h:2248
FieldDecl - An instance of this class is created by Sema::ActOnField to represent a member of a struc...
Definition: Decl.h:2293
bool isCompleteDefinition() const
isCompleteDefinition - Return true if this decl has its body fully specified.
Definition: Decl.h:2871
StringRef getArg() const
Definition: Decl.h:134
An operation on a type.
Definition: TypeVisitor.h:65
bool isPure() const
Whether this virtual function is pure, i.e.
Definition: Decl.h:1837
StringRef getText() const LLVM_READONLY
Definition: Comment.h:889
bool isTranslationUnit() const
Definition: DeclBase.h:1283
unsigned size() const
Retrieve the number of template arguments in this template argument list.
Definition: DeclTemplate.h:231
Represents the result of substituting a set of types for a template type parameter pack...
Definition: Type.h:4038
StringRef getParamNameAsWritten() const
Definition: Comment.h:840
IdentifierInfo & getAccessor() const
Definition: Expr.h:4531
ExtVectorElementExpr - This represents access to specific elements of a vector, and may occur on the ...
Definition: Expr.h:4509
Stmt * getBody() const override
Definition: Decl.h:3536
Represents an access specifier followed by colon ':'.
Definition: DeclCXX.h:103
unsigned getRegParm() const
Definition: Type.h:2948
Declaration of a function specialization at template class scope.
SourceRange getSourceRange() const LLVM_READONLY
Fetches the full source range of the argument.
Describes a module or submodule.
Definition: Basic/Module.h:47
StorageClass getStorageClass() const
Returns the storage class as written in the source.
Definition: Decl.h:947
Expr * getUnderlyingExpr() const
Definition: Type.h:3598
An r-value expression (a pr-value in the C++11 taxonomy) produces a temporary value.
Definition: Specifiers.h:105
const VarDecl * getCatchParamDecl() const
Definition: StmtObjC.h:94
Represents Objective-C's @catch statement.
Definition: StmtObjC.h:74
Provides information about a function template specialization, which is a FunctionDecl that has been ...
Definition: DeclTemplate.h:399
bool hasDefaultArgument() const
Determine whether this template parameter has a default argument.
A command with word-like arguments that is considered inline content.
Definition: Comment.h:303
Describes an C or C++ initializer list.
Definition: Expr.h:3746
Represents a C++ using-declaration.
Definition: DeclCXX.h:3039
Stmt * getBody() const override
Definition: Decl.cpp:4074
bool isThisDeclarationADefinition() const
Returns whether this specific method is a definition.
Definition: DeclObjC.h:492
Expr * getInitializer()
Get initializer expression (if specified) of the declare reduction construct.
Definition: DeclOpenMP.h:143
TemplateArgument getArgumentPack() const
Definition: Type.cpp:3083
ConstructorUsingShadowDecl * getNominatedBaseClassShadowDecl() const
Get the inheriting constructor declaration for the direct base class from which this using shadow dec...
Definition: DeclCXX.h:2991
ObjCMethodDecl * getBoxingMethod() const
Definition: ExprObjC.h:111
bool isParameterPack() const
Whether this parameter is a non-type template parameter pack.
An lvalue ref-qualifier was provided (&).
Definition: Type.h:1240
A line of text contained in a verbatim block.
Definition: Comment.h:869
bool isInline() const
Returns true if this is an inline namespace declaration.
Definition: Decl.h:526
ObjCTypeParamList * getTypeParamList() const
Retrieve the type parameter list associated with this category or extension.
Definition: DeclObjC.h:2219
A verbatim line command.
Definition: Comment.h:949
A convenient class for passing around template argument information.
Definition: TemplateBase.h:523
const ValueDecl * getExtendingDecl() const
Get the declaration which triggered the lifetime-extension of this temporary, if any.
Definition: ExprCXX.h:4019
static void dump(llvm::raw_ostream &OS, StringRef FunctionName, ArrayRef< CounterExpression > Expressions, ArrayRef< CounterMappingRegion > Regions)
NamedDecl * getAliasedNamespace() const
Retrieve the namespace that this alias refers to, which may either be a NamespaceDecl or a NamespaceA...
Definition: DeclCXX.h:2812
protocol_iterator protocol_end() const
Definition: DeclObjC.h:2251
QualType getReturnType() const
Definition: Type.h:3009
bool isSuperReceiver() const
Definition: ExprObjC.h:700
UnresolvedUsingTypenameDecl * getDecl() const
Definition: Type.h:3483
bool hasDefaultArgument() const
Determine whether this template parameter has a default argument.
An x-value expression is a reference to an object with independent storage but which can be "moved"...
Definition: Specifiers.h:114
path_iterator path_begin()
Definition: Expr.h:2700
Represents a typeof (or typeof) expression (a GCC extension).
Definition: Type.h:3525
A builtin binary operation expression such as "x + y" or "x <= y".
Definition: Expr.h:2897
Selector getSelector() const
Definition: ExprObjC.cpp:306
bool requiresADL() const
True if this declaration should be extended by argument-dependent lookup.
Definition: ExprCXX.h:2747
static bool isPostfix(Opcode Op)
isPostfix - Return true if this is a postfix operation, like x++.
Definition: Expr.h:1703
Any part of the comment.
Definition: Comment.h:53
std::string getNameAsString() const
getNameAsString - Get a human-readable name for the declaration, even if it is one of the special kin...
Definition: Decl.h:252
QualType getDefaultArgument() const
Retrieve the default argument, if any.
QualType getTypeAsWritten() const
getTypeAsWritten - Returns the type that this expression is casting to, as written in the source code...
Definition: Expr.h:2823
const Type * getBaseClass() const
If this is a base class initializer, returns the type of the base class.
Definition: DeclCXX.cpp:1788
bool isDelegatingInitializer() const
Determine whether this initializer is creating a delegating constructor.
Definition: DeclCXX.h:2030
CastExpr - Base class for type casts, including both implicit casts (ImplicitCastExpr) and explicit c...
Definition: Expr.h:2632
Represents an Objective-C protocol declaration.
Definition: DeclObjC.h:1968
unsigned getParamIndex() const LLVM_READONLY
Definition: Comment.h:791
Represents binding an expression to a temporary.
Definition: ExprCXX.h:1119
CXXTemporary * getTemporary()
Definition: ExprCXX.h:1139
void print(llvm::raw_ostream &OS) const
Prints the full selector name (e.g. "foo:bar:").
A C++ lambda expression, which produces a function object (of unspecified type) that can be invoked l...
Definition: ExprCXX.h:1503
unsigned getLine() const
Return the presumed line number of this location.
decl_iterator decl_end()
Definition: Stmt.h:496
An ordinary object is located at an address in memory.
Definition: Specifiers.h:121
This represents the body of a CapturedStmt, and serves as its DeclContext.
Definition: Decl.h:3625
Represents an ObjC class declaration.
Definition: DeclObjC.h:1091
CleanupObject getObject(unsigned i) const
Definition: ExprCXX.h:2971
Represents a linkage specification.
Definition: DeclCXX.h:2523
unsigned getCommandID() const
Definition: Comment.h:656
CXXRecordDecl * getNominatedBaseClass() const
Get the base class that was named in the using declaration.
Definition: DeclCXX.cpp:2200
ObjCMethodDecl * setAtIndexMethodDecl() const
Definition: ExprObjC.h:817
detail::InMemoryDirectory::const_iterator I
is ARM Neon polynomial vector
Definition: Type.h:2764
PropertyAttributeKind getPropertyAttributes() const
Definition: DeclObjC.h:792
FunctionDecl * SourceDecl
The function whose exception specification this is, for EST_Unevaluated and EST_Uninstantiated.
Definition: Type.h:3160
bool isFromAST() const
Whether this type comes from an AST file.
Definition: Type.h:1536
QualType getType() const
Definition: Decl.h:599
bool hasExplicitBound() const
Whether this type parameter has an explicitly-written type bound, e.g., "T : NSView".
Definition: DeclObjC.h:589
Represents an extended vector type where either the type or size is dependent.
Definition: Type.h:2718
const TemplateTypeParmType * getReplacedParameter() const
Gets the template parameter that was substituted for.
Definition: Type.h:4059
param_iterator param_begin()
Definition: Decl.h:2000
static void dumpPreviousDeclImpl(raw_ostream &OS,...)
Definition: ASTDumper.cpp:858
Represents the this expression in C++.
Definition: ExprCXX.h:873
ObjCIvarDecl * getDecl()
Definition: ExprObjC.h:505
ObjCPropertyImplDecl - Represents implementation declaration of a property in a class or category imp...
Definition: DeclObjC.h:2655
FunctionDecl * getOperatorDelete() const
Definition: ExprCXX.h:2053
decl_type * getFirstDecl()
Return the first declaration of this declaration or itself if this is the only declaration.
Definition: Redeclarable.h:263
A verbatim block command (e.
Definition: Comment.h:897
QualType getValueType() const
Gets the type contained by this atomic type, i.e.
Definition: Type.h:5173
FunctionTemplateSpecializationInfo * getTemplateSpecializationInfo() const
If this function is actually a function template specialization, retrieve information about this func...
Definition: Decl.cpp:3183
ExtInfo getExtInfo() const
Definition: Type.h:3018
StringRef getText() const LLVM_READONLY
Definition: Comment.h:287
llvm::APInt getValue() const
Definition: Expr.h:1248
TypeAliasDecl - Represents the declaration of a typedef-name via a C++0x alias-declaration.
Definition: Decl.h:2701
Represents a prototype with parameter type info, e.g.
Definition: Type.h:3073
Holds a QualType and a TypeSourceInfo* that came out of a declarator parsing.
Definition: LocInfoType.h:29
unsigned getNumObjects() const
Definition: ExprCXX.h:2969
UnaryExprOrTypeTraitExpr - expression with either a type or (unevaluated) expression operand...
Definition: Expr.h:1974
decl_range noload_decls() const
noload_decls_begin/end - Iterate over the declarations stored in this context that are currently load...
Definition: DeclBase.h:1461
ASTContext * Context
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
ArrayRef< NamedDecl * > getDeclsInPrototypeScope() const
Definition: Decl.h:2023
Expr * getCombiner()
Get combiner expression of the declare reduction construct.
Definition: DeclOpenMP.h:136
SourceRange getRange() const
Definition: Attr.h:95
StorageClass getStorageClass() const
Returns the storage class as written in the source.
Definition: Decl.h:2063
bool requiresZeroInitialization() const
Whether this construction first requires zero-initialization before the initializer is called...
Definition: ExprCXX.h:1252
An Objective-C property is a logical field of an Objective-C object which is read and written via Obj...
Definition: Specifiers.h:131
Represents an array type in C++ whose size is a value-dependent expression.
Definition: Type.h:2659
int * Depth
SplitQualType split() const
Divides a QualType into its unqualified type and a set of local qualifiers.
Definition: Type.h:5267
bool hasDefaultArgument() const
Determine whether this template parameter has a default argument.
Represents a shadow constructor declaration introduced into a class by a C++11 using-declaration that...
Definition: DeclCXX.h:2927
BlockDecl - This represents a block literal declaration, which is like an unnamed FunctionDecl...
Definition: Decl.h:3456
QualType getPointeeType() const
Definition: Type.h:2300
ValueDecl - Represent the declaration of a variable (in which case it is an lvalue) a function (in wh...
Definition: Decl.h:590
Expr - This represents one expression.
Definition: Expr.h:105
bool isSugared() const
Definition: Type.h:4679
void outputString(raw_ostream &OS) const
Definition: Expr.cpp:863
static void dumpBasePath(raw_ostream &OS, const CastExpr *Node)
Definition: ASTDumper.cpp:1886
bool isDeletedAsWritten() const
Definition: Decl.h:1910
decls_iterator decls_end() const
Definition: ExprCXX.h:2573
Declaration of a template type parameter.
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
bool wasDeclaredWithTypename() const
Whether this template type parameter was declared with the 'typename' keyword.
ObjCIvarDecl * getPropertyIvarDecl() const
Definition: DeclObjC.h:2721
double getValueAsApproximateDouble() const
getValueAsApproximateDouble - This returns the value as an inaccurate double.
Definition: Expr.cpp:794
QualType getLocallyUnqualifiedSingleStepDesugaredType() const
Pull a single level of sugar off of this locally-unqualified type.
Definition: Type.cpp:224
The template argument is a null pointer or null pointer to member that was provided for a non-type te...
Definition: TemplateBase.h:54
Expr * getBitWidth() const
Definition: Decl.h:2375
ArrayRef< NamedDecl * > chain() const
Definition: Decl.h:2540
BlockExpr - Adaptor class for mixing a BlockDecl with expressions.
Definition: Expr.h:4567
child_iterator child_end() const
Definition: Comment.cpp:83
Expr * getUnderlyingExpr() const
Definition: Type.h:3532
bool isInherited() const
Definition: Attr.h:98
ObjCMethodDecl * getImplicitPropertyGetter() const
Definition: ExprObjC.h:638
ArgKind getKind() const
Return the kind of stored template argument.
Definition: TemplateBase.h:216
ExtProtoInfo getExtProtoInfo() const
Definition: Type.h:3280
A command that has zero or more word-like arguments (number of word-like arguments depends on command...
Definition: Comment.h:602
ObjCSelectorExpr used for @selector in Objective-C.
Definition: ExprObjC.h:397
Represents an expression that computes the length of a parameter pack.
Definition: ExprCXX.h:3653
CXXRecordDecl * getConstructedBaseClass() const
Get the base class whose constructor or constructor shadow declaration is passed the constructor argu...
Definition: DeclCXX.h:3007
NonTypeTemplateParmDecl - Declares a non-type template parameter, e.g., "Size" in.
Represents the type decltype(expr) (C++11).
Definition: Type.h:3590
Selector getSelector() const
Definition: ExprObjC.h:409
A std::pair-like structure for storing a qualified type split into its local qualifiers and its local...
Definition: Type.h:541
bool isParameterPack() const
Whether this template template parameter is a template parameter pack.
SourceLocation getAttributeLoc() const
Definition: Type.h:2733
bool isScoped() const
Returns true if this is a C++11 scoped enumeration.
Definition: Decl.h:3188
StorageClass
Storage classes.
Definition: Specifiers.h:201
A unary type transform, which is a type constructed from another.
Definition: Type.h:3631
bool isDependentType() const
Whether this type is a dependent type, meaning that its definition somehow depends on a template para...
Definition: Type.h:1774
bool isInstanceMethod() const
Definition: DeclObjC.h:414
Direct list-initialization (C++11)
Definition: Decl.h:780
Qualifiers Quals
The local qualifiers.
Definition: Type.h:546
bool isDirectionExplicit() const LLVM_READONLY
Definition: Comment.h:755
Declaration of an alias template.
DeclContext * getParent()
getParent - Returns the containing DeclContext.
Definition: DeclBase.h:1214
StringRef getParamName(const FullComment *FC) const
Definition: Comment.cpp:331
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:269
An expression that sends a message to the given Objective-C object or class.
Definition: ExprObjC.h:860
Represents an unpacked "presumed" location which can be presented to the user.
UnaryOperator - This represents the unary-expression's (except sizeof and alignof), the postinc/postdec operators from postfix-expression, and various extensions.
Definition: Expr.h:1668
ArrayRef< ParmVarDecl * > parameters() const
Definition: Decl.h:3543
Represents a GCC generic vector type.
Definition: Type.h:2756
An opening HTML tag with attributes.
Definition: Comment.h:419
DeclarationName getDeclName() const
getDeclName - Get the actual, stored name of the declaration, which may be a special name...
Definition: Decl.h:258
TemplateTemplateParmDecl - Declares a template template parameter, e.g., "T" in.
const TemplateArgumentLoc & getDefaultArgument() const
Retrieve the default argument, if any.
ValueDecl * getDecl()
Definition: Expr.h:1017
QualType getElementType() const
Definition: Type.h:2780
QualType getComputationLHSType() const
Definition: Expr.h:3115
static QualType Desugar(ASTContext &Context, QualType QT, bool &ShouldAKA)
This template specialization was implicitly instantiated from a template.
Definition: Specifiers.h:147
DeclarationName getLookupName() const
Definition: DeclLookups.h:40
UnresolvedSetImpl::iterator decls_iterator
Definition: ExprCXX.h:2571
const SourceManager & SM
Definition: Format.cpp:1184
child_iterator child_begin() const
Definition: Comment.cpp:69
static const char * getDirectionAsString(PassDirection D)
Definition: Comment.cpp:117
init_iterator init_begin()
init_begin() - Retrieve an iterator to the first initializer.
Definition: DeclObjC.h:2522
bool isVirtualAsWritten() const
Whether this function is marked as virtual explicitly.
Definition: Decl.h:1832
ObjCCategoryDecl * getCategoryDecl() const
Definition: DeclObjC.cpp:1999
SourceRange getBracketsRange() const
Definition: Type.h:2684
QualType getComputationResultType() const
Definition: Expr.h:3118
LabelDecl * getLabel() const
Definition: Stmt.h:1235
This class provides information about commands that can be used in comments.
decls_iterator decls_begin() const
Definition: ExprCXX.h:2572
ArrayRef< ParmVarDecl * > parameters() const
Definition: DeclObjC.h:371
const TemplateTypeParmType * getReplacedParameter() const
Gets the template parameter that was substituted for.
Definition: Type.h:3998
Stmt * getBody(const FunctionDecl *&Definition) const
getBody - Retrieve the body (definition) of the function.
Definition: Decl.cpp:2491
bool isArray() const
Definition: ExprCXX.h:1894
bool isArrayForm() const
Definition: ExprCXX.h:2042
bool doesThisDeclarationHaveABody() const
doesThisDeclarationHaveABody - Returns whether this specific declaration of the function has a body -...
Definition: Decl.h:1821
StringRef getValue() const
Definition: Decl.h:167
OpaqueValueExpr - An expression referring to an opaque object of a fixed type and value class...
Definition: Expr.h:848
is AltiVec 'vector Pixel'
Definition: Type.h:2761
This captures a statement into a function.
Definition: Stmt.h:2006
not a target-specific vector type
Definition: Type.h:2759
RenderKind getRenderKind() const
Definition: Comment.h:358
ExceptionSpecificationType Type
The kind of exception specification this is.
Definition: Type.h:3153
decl_type * getPreviousDecl()
Return the previous declaration of this declaration or NULL if this is the first declaration.
Definition: Redeclarable.h:144
bool getValue() const
Definition: ExprObjC.h:71
const char * getFilename() const
Return the presumed filename of this location.
Encodes a location in the source.
const char * getNameStart() const
Return the beginning of the actual null-terminated string for this identifier.
unsigned getNumParams() const
getNumParams - Return the number of parameters this function must have based on its FunctionType...
Definition: Decl.cpp:2742
TemplateName getAsTemplate() const
Retrieve the template name for a template name argument.
Definition: TemplateBase.h:262
all_lookups_iterator - An iterator that provides a view over the results of looking up every possible...
Definition: DeclLookups.h:26
This represents '#pragma omp declare reduction ...' directive.
Definition: DeclOpenMP.h:102
QualType getElementType() const
Definition: Type.h:2131
Expr * getSourceExpr() const
The source expression of an opaque value expression is the expression which originally generated the ...
Definition: Expr.h:902
Pseudo declaration for capturing expressions.
Definition: DeclOpenMP.h:171
Represents a C++ temporary.
Definition: ExprCXX.h:1088
Interfaces are the core concept in Objective-C for object oriented design.
Definition: Type.h:4936
const ObjCInterfaceDecl * getClassInterface() const
Definition: DeclObjC.h:2642
FieldDecl * getAnyMember() const
Definition: DeclCXX.h:2074
This is a basic class for representing single OpenMP executable directive.
Definition: StmtOpenMP.h:33
NestedNameSpecifier * getQualifier() const
Retrieve the nested-name-specifier that qualifies the name.
Definition: DeclCXX.h:3302
Represents a new-expression for memory allocation and constructor calls, e.g: "new CXXNewExpr(foo)"...
Definition: ExprCXX.h:1804
SourceRange getSourceRange() const LLVM_READONLY
Definition: Comment.h:216
bool isValid() const
decl_iterator noload_decls_begin() const
Definition: DeclBase.h:1464
bool isFreeIvar() const
Definition: ExprObjC.h:514
bool isParamIndexValid() const LLVM_READONLY
Definition: Comment.h:778
DeclStmt - Adaptor class for mixing declarations with statements and expressions. ...
Definition: Stmt.h:443
LabelDecl - Represents the declaration of a label.
Definition: Decl.h:424
bool isVariadic() const
Definition: DeclObjC.h:416
VectorKind getVectorKind() const
Definition: Type.h:2789
Represents a dependent using declaration which was not marked with typename.
Definition: DeclCXX.h:3185
TypeAliasDecl * getTemplatedDecl() const
Get the underlying function declaration of the template.
Stmt * getBody() const override
Retrieve the body of this method, if it has one.
Definition: DeclObjC.cpp:784
bool getSynthesize() const
Definition: DeclObjC.h:1895
bool isRestrict() const
Definition: Type.h:3021
const Attribute & getAttr(unsigned Idx) const
Definition: Comment.h:482
No ref-qualifier was provided.
Definition: Type.h:1238
C-style initialization with assignment.
Definition: Decl.h:778
ArrayRef< ParmVarDecl * > parameters() const
Definition: Decl.h:1989
all_lookups_iterator noload_lookups_end() const
Definition: DeclLookups.h:109
Expr * getDefaultArgument() const
Retrieve the default argument, if any.
This file defines OpenMP nodes for declarative directives.
all_lookups_iterator noload_lookups_begin() const
Iterators over all possible lookups within this context that are currently loaded; don't attempt to r...
Definition: DeclLookups.h:104
ObjCCategoryDecl - Represents a category declaration.
Definition: DeclObjC.h:2171
Module * getImportedModule() const
Retrieve the module that was imported by the import declaration.
Definition: Decl.h:3772
const ObjCInterfaceDecl * getClassInterface() const
Definition: DeclObjC.h:2325
NamedDecl * getPack() const
Retrieve the parameter pack.
Definition: ExprCXX.h:3724
unsigned getIndex(unsigned Depth) const
Definition: Comment.h:857
decl_iterator decl_begin()
Definition: Stmt.h:495
ObjCProtocolExpr used for protocol expression in Objective-C.
Definition: ExprObjC.h:441
Comment *const * child_iterator
Definition: Comment.h:228
SplitQualType getSplitDesugaredType() const
Definition: Type.h:896
is AltiVec 'vector bool ...'
Definition: Type.h:2762
init_iterator init_end()
init_end() - Retrieve an iterator past the last initializer.
Definition: DeclObjC.h:2530
Represents one property declaration in an Objective-C interface.
Definition: DeclObjC.h:699
TypedefNameDecl * getDecl() const
Definition: Type.h:3516
PassDirection getDirection() const LLVM_READONLY
Definition: Comment.h:751
is AltiVec vector
Definition: Type.h:2760
QualType getReturnType() const
Definition: DeclObjC.h:330
SourceLocation getBegin() const
This template specialization was instantiated from a template due to an explicit instantiation defini...
Definition: Specifiers.h:159
This template specialization was formed from a template-id but has not yet been declared, defined, or instantiated.
Definition: Specifiers.h:144
void dump() const
Definition: ASTDumper.cpp:2454
Represents a C++11 static_assert declaration.
Definition: DeclCXX.h:3327
A closing HTML tag.
Definition: Comment.h:513
bool isInlineSpecified() const
Determine whether the "inline" keyword was specified for this function.
Definition: Decl.h:2067
An rvalue ref-qualifier was provided (&&).
Definition: Type.h:1242
ObjCBoxedExpr - used for generalized expression boxing.
Definition: ExprObjC.h:94
UTTKind getUTTKind() const
Definition: Type.h:3655
Expr * getArrayFiller()
If this initializer list initializes an array with more elements than there are initializers in the l...
Definition: Expr.h:3831
const BlockDecl * getBlockDecl() const
Definition: Expr.h:4581
QualType getType() const
Return the type wrapped by this type source info.
Definition: Decl.h:70
Opcode getOpcode() const
Definition: Expr.h:1692
ValueDecl * getAsDecl() const
Retrieve the declaration for a declaration non-type template argument.
Definition: TemplateBase.h:245
NestedNameSpecifier * getQualifier() const
Retrieve the nested-name-specifier that qualifies the name.
Definition: DeclCXX.h:3224
Describes a module import declaration, which makes the contents of the named module visible in the cu...
Definition: Decl.h:3728
Doxygen \tparam command, describes a template parameter.
Definition: Comment.h:805
The injected class name of a C++ class template or class template partial specialization.
Definition: Type.h:4294
QualType getPointeeType() const
Definition: Type.h:2193
Represents a pack expansion of types.
Definition: Type.h:4641
CompoundAssignOperator - For compound assignments (e.g.
Definition: Expr.h:3092
bool isPartiallySubstituted() const
Determine whether this represents a partially-substituted sizeof...
Definition: ExprCXX.h:3741
static const char * getStorageClassSpecifierString(StorageClass SC)
getStorageClassSpecifierString - Return the string used to specify the storage class SC...
Definition: Decl.cpp:1770
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:500
const char * getTypeClassName() const
Definition: Type.cpp:2509
Expr * getSizeExpr() const
Definition: Type.h:2679
bool isArrow() const
Definition: Expr.h:2510
AddrLabelExpr - The GNU address of label extension, representing &&label.
Definition: Expr.h:3339
attr::Kind getKind() const
Definition: Attr.h:87
ast_type_traits::DynTypedNode Node
QualType getType() const
Definition: Expr.h:126
TLS with a dynamic initializer.
Definition: Decl.h:787
Represents a template argument.
Definition: TemplateBase.h:40
Represents a type which was implicitly adjusted by the semantic engine for arbitrary reasons...
Definition: Type.h:2227
QualType getAsType() const
Retrieve the type for a type template argument.
Definition: TemplateBase.h:238
TypeSourceInfo * getTypeSourceInfo() const
Returns the declarator information for a base class or delegating initializer.
Definition: DeclCXX.h:2063
NamespaceDecl * getNominatedNamespace()
Returns the namespace nominated by this using-directive.
Definition: DeclCXX.cpp:2063
void print(raw_ostream &OS, const PrintingPolicy &Policy) const
Print this nested name specifier to the given output stream.
bool isImplicitProperty() const
Definition: ExprObjC.h:630
StringRef getOpcodeStr() const
Definition: Expr.h:2959
ObjCCategoryImplDecl * getImplementation() const
Definition: DeclObjC.cpp:1954
not evaluated yet, for special member function
[C99 6.4.2.2] - A predefined identifier such as func.
Definition: Expr.h:1160
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
Definition: DeclBase.h:1135
Represents a delete expression for memory deallocation and destructor calls, e.g. ...
Definition: ExprCXX.h:2008
The base class of all kinds of template declarations (e.g., class, function, etc.).
Definition: DeclTemplate.h:330
const TemplateArgumentList & getTemplateArgs() const
Retrieve the template arguments of the variable template specialization.
The template argument is a pack expansion of a template name that was provided for a template templat...
Definition: TemplateBase.h:63
PragmaMSCommentKind getCommentKind() const
Definition: Decl.h:132
bool isImplicit() const
Returns true if the attribute has been implicitly created instead of explicitly written by the user...
Definition: Attr.h:102
IndirectFieldDecl - An instance of this class is created to represent a field injected from an anonym...
Definition: Decl.h:2521
NamespaceDecl * getOriginalNamespace()
Get the original (first) namespace declaration.
Definition: DeclCXX.cpp:2095
void dump() const
Definition: ASTDumper.cpp:2459
This template specialization was instantiated from a template due to an explicit instantiation declar...
Definition: Specifiers.h:155
bool isParameterPack() const
Definition: Type.h:3947
LanguageIDs getLanguage() const
Return the language specified by this linkage specification.
Definition: DeclCXX.h:2564
Represents a dependent using declaration which was marked with typename.
Definition: DeclCXX.h:3268
DeclarationName - The name of a declaration.
Represents the declaration of an Objective-C type parameter.
Definition: DeclObjC.h:532
Selector getSelector() const
Definition: DeclObjC.h:328
EnumDecl - Represents an enum.
Definition: Decl.h:3013
bool path_empty() const
Definition: Expr.h:2698
detail::InMemoryDirectory::const_iterator E
A pointer to member type per C++ 8.3.3 - Pointers to members.
Definition: Type.h:2401
const char * getCommentKindName() const
Definition: Comment.cpp:22
QualType getModifiedType() const
Definition: Type.h:3831
QualType getPointeeType() const
Gets the type pointed to by this ObjC pointer.
Definition: Type.h:5006
path_iterator path_end()
Definition: Expr.h:2701
Represents a pointer to an Objective C object.
Definition: Type.h:4991
StringRef getTagName() const LLVM_READONLY
Definition: Comment.h:401
StringRef getName() const
Definition: Decl.h:166
Pointer to a block type.
Definition: Type.h:2286
ObjCImplementationDecl - Represents a class definition - this is where method definitions are specifi...
Definition: DeclObjC.h:2461
ObjCMethodDecl * getGetterMethodDecl() const
Definition: DeclObjC.h:860
FunctionDecl * SourceTemplate
The function template whose exception specification this is instantiated from, for EST_Uninstantiated...
Definition: Type.h:3163
Provides common interface for the Decls that cannot be redeclared, but can be merged if the same decl...
Definition: Redeclarable.h:257
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
Definition: Type.h:3707
Complex values, per C99 6.2.5p11.
Definition: Type.h:2119
Location wrapper for a TemplateArgument.
Definition: TemplateBase.h:427
FunctionDecl * getOperatorNew() const
Definition: ExprCXX.h:1889
static const CommandInfo * getBuiltinCommandInfo(StringRef Name)
const T * getAs() const
Member-template getAs<specific type>'.
Definition: Type.h:5818
NamedDecl * getFriendDecl() const
If this friend declaration doesn't name a type, return the inner declaration.
Definition: DeclFriend.h:120
Represents a C++ base or member initializer.
Definition: DeclCXX.h:1922
static StringRef getIdentTypeName(IdentType IT)
Definition: Expr.cpp:450
This template specialization was declared or defined by an explicit specialization (C++ [temp...
Definition: Specifiers.h:151
void dump(raw_ostream &OS) const
Debugging aid that dumps the template name.
ObjCMethodDecl * getSetterMethodDecl() const
Definition: DeclObjC.h:863
ObjCEncodeExpr, used for @encode in Objective-C.
Definition: ExprObjC.h:355
bool isDeduced() const
Definition: Type.h:4114
ObjCProtocolList::iterator protocol_iterator
Definition: DeclObjC.h:2242
QualType getIntegerType() const
getIntegerType - Return the integer type this enum decl corresponds to.
Definition: Decl.h:3137
bool hasBody() const override
Determine whether this method has a body.
Definition: DeclObjC.h:481
DeclGroupRef::const_iterator const_decl_iterator
Definition: Stmt.h:487
StringRef getParamName(const FullComment *FC) const
Definition: Comment.cpp:324
Base for LValueReferenceType and RValueReferenceType.
Definition: Type.h:2319
CXXConstructorDecl * getConstructor() const
Get the constructor that this expression will (ultimately) call.
Definition: ExprCXX.h:1225
bool isNRVOVariable() const
Determine whether this local variable can be used with the named return value optimization (NRVO)...
Definition: Decl.h:1227
bool isOriginalNamespace() const
Return true if this declaration is an original (first) declaration of the namespace.
Definition: DeclCXX.cpp:2109
InitializationStyle getInitStyle() const
The style of initialization for this declaration.
Definition: Decl.h:1198
The template argument is a type.
Definition: TemplateBase.h:48
protocol_range protocols() const
Definition: DeclObjC.h:1278
ObjCImplementationDecl * getImplementation() const
Definition: DeclObjC.cpp:1481
The template argument is actually a parameter pack.
Definition: TemplateBase.h:72
LabelDecl * getLabel() const
Definition: Expr.h:3361
Represents a base class of a C++ class.
Definition: DeclCXX.h:159
ObjCPropertyDecl * getExplicitProperty() const
Definition: ExprObjC.h:633
A bitfield object is a bitfield on a C or C++ record.
Definition: Specifiers.h:124
bool isAnyMemberInitializer() const
Definition: DeclCXX.h:2010
QualType getPointeeType() const
Definition: Type.h:2340
ObjCIvarRefExpr - A reference to an ObjC instance variable.
Definition: ExprObjC.h:479
SourceManager & getSourceManager()
Definition: ASTContext.h:561
GotoStmt - This represents a direct goto.
Definition: Stmt.h:1224
ArrayRef< const Attr * > getAttrs() const
Definition: Stmt.h:862
NestedNameSpecifier * getQualifier() const
Retrieve the nested-name-specifier that qualifies the name.
Definition: DeclCXX.h:3079
A template argument list.
Definition: DeclTemplate.h:173
const TemplateArgumentList & getTemplateArgs() const
Retrieve the template arguments of the class template specialization.
const Type * getClass() const
Definition: Type.h:2434
ObjCPropertyDecl * getPropertyDecl() const
Definition: DeclObjC.h:2712
AccessControl getAccessControl() const
Definition: DeclObjC.h:1888
CapturedDecl * getCapturedDecl()
Retrieve the outlined function declaration.
Definition: Stmt.cpp:1084
An attributed type is a type to which a type attribute has been applied.
Definition: Type.h:3761
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:779
MemberExpr - [C99 6.5.2.3] Structure and Union Members.
Definition: Expr.h:2315
NamedDecl * getTemplatedDecl() const
Get the underlying, templated declaration.
Definition: DeclTemplate.h:358
Represents a C++ struct/union/class.
Definition: DeclCXX.h:263
bool hasQualifiers() const
Return true if the set contains any qualifiers.
Definition: Type.h:376
The template argument is a template name that was provided for a template template parameter...
Definition: TemplateBase.h:60
bool isGlobalNew() const
Definition: ExprCXX.h:1919
Opcode getOpcode() const
Definition: Expr.h:2940
QualType getEncodedType() const
Definition: ExprObjC.h:376
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:1395
ObjCIvarDecl - Represents an ObjC instance variable.
Definition: DeclObjC.h:1849
ArraySizeModifier getSizeModifier() const
Definition: Type.h:2491
bool isInline() const
Whether this variable is (C++1z) inline.
Definition: Decl.h:1258
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:610
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:876
bool isConstexpr() const
Whether this variable is (C++11) constexpr.
Definition: Decl.h:1276
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
Definition: DeclTemplate.h:353
pack_iterator pack_end() const
Iterator referencing one past the last argument of a template argument pack.
Definition: TemplateBase.h:322
The receiver is a class.
Definition: ExprObjC.h:1003
StringRef getArgText(unsigned Idx) const
Definition: Comment.h:366
StringLiteral - This represents a string literal expression, e.g.
Definition: Expr.h:1466
DeclarationName getName() const
Gets the name looked up.
Definition: ExprCXX.h:2587
QualType getPattern() const
Retrieve the pattern of this pack expansion, which is the type that will be repeatedly instantiated w...
Definition: Type.h:4668
TLS with a known-constant initializer.
Definition: Decl.h:786
ObjCInterfaceDecl * getSuperClass() const
Definition: DeclObjC.cpp:314
TagDecl * getDecl() const
Definition: Type.cpp:2960
Abstract class common to all of the C++ "named"/"keyword" casts.
Definition: ExprCXX.h:203
ObjCBoolLiteralExpr - Objective-C Boolean Literal.
Definition: ExprObjC.h:60
VarDecl * getExceptionDecl() const
Definition: StmtCXX.h:50
A reference to a declared variable, function, enum, etc.
Definition: Expr.h:932
ExprValueKind getValueKind() const
getValueKind - The value kind that this expression produces.
Definition: Expr.h:401
bool constructsVirtualBase() const
Returns true if the constructed base class is a virtual base class subobject of this declaration's cl...
Definition: DeclCXX.h:3016
StringRef getCloseName() const
Definition: Comment.h:933
Doxygen \param command.
Definition: Comment.h:717
QualType getElementType() const
Definition: Type.h:5203
QualType getElementType() const
Definition: Type.h:2490
CXXCtorInitializer *const * init_const_iterator
Iterates through the member/base initializer list.
Definition: DeclCXX.h:2246
DeclContext * getPrimaryContext()
getPrimaryContext - There may be many different declarations of the same entity (including forward de...
Definition: DeclBase.cpp:991
bool isArraySubscriptRefExpr() const
Definition: ExprObjC.h:821
FieldDecl * getInitializedFieldInUnion()
If this initializes a union, specifies which field in the union to initialize.
Definition: Expr.h:3849
varlist_range varlists()
Definition: DeclOpenMP.h:77
static StringRef getNameForCallConv(CallingConv CC)
Definition: Type.cpp:2631
#define true
Definition: stdbool.h:32
An l-value expression is a reference to an object with independent storage.
Definition: Specifiers.h:109
StringRef getKindName() const
Definition: Decl.h:2926
A trivial tuple used to represent a source range.
static StringRef getOpcodeStr(Opcode Op)
getOpcodeStr - Turn an Opcode enum value into the punctuation char it corresponds to...
Definition: Expr.cpp:1085
bool isVolatile() const
Definition: Type.h:3020
NamedDecl - This represents a decl with a name.
Definition: Decl.h:213
A boolean literal, per ([C++ lex.bool] Boolean literals).
Definition: ExprCXX.h:471
Represents a C array with a specified size that is not an integer-constant-expression.
Definition: Type.h:2607
Represents a C++ namespace alias.
Definition: DeclCXX.h:2718
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:1706
Represents C++ using-directive.
Definition: DeclCXX.h:2615
Represents a #pragma detect_mismatch line.
Definition: Decl.h:143
bool isNull() const
Return true if this QualType doesn't point to a type yet.
Definition: Type.h:665
The receiver is a superclass.
Definition: ExprObjC.h:1007
const char * getName() const
Definition: Stmt.cpp:309
A simple visitor class that helps create declaration visitors.
Definition: DeclVisitor.h:74
const TemplateArgument & getArgument() const
Definition: TemplateBase.h:470
ReceiverKind getReceiverKind() const
Determine the kind of receiver that this message is being sent to.
Definition: ExprObjC.h:1136
This represents '#pragma omp threadprivate ...' directive.
Definition: DeclOpenMP.h:39
TemplateSpecializationType(TemplateName T, ArrayRef< TemplateArgument > Args, QualType Canon, QualType Aliased)
ObjCCategoryImplDecl - An object of this class encapsulates a category @implementation declaration...
Definition: DeclObjC.h:2380
Optional< unsigned > getNumExpansions() const
Retrieve the number of expansions that this pack expansion will generate, if known.
Definition: Type.h:4672
Represents the canonical version of C arrays with a specified constant size.
Definition: Type.h:2512
This class handles loading and caching of source files into memory.
The parameter is invariant: must match exactly.
ExceptionSpecInfo ExceptionSpec
Definition: Type.h:3187
Defines enum values for all the target-independent builtin functions.
Declaration of a template function.
Definition: DeclTemplate.h:838
ObjCMethodDecl * getImplicitPropertySetter() const
Definition: ExprObjC.h:643
CXXRecordDecl * getLambdaClass() const
Retrieve the class that corresponds to the lambda.
Definition: ExprCXX.cpp:995
Attr - This represents one attribute.
Definition: Attr.h:45
Represents a shadow declaration introduced into a scope by a (resolved) using declaration.
Definition: DeclCXX.h:2835
A full comment attached to a declaration, contains block content.
Definition: Comment.h:1097
ObjCCompatibleAliasDecl - Represents alias of a class.
Definition: DeclObjC.h:2626
void dumpLookups() const
Definition: ASTDumper.cpp:2479
bool isMutable() const
isMutable - Determines whether this field is mutable (C++ only).
Definition: Decl.h:2358
bool isHidden() const
Determine whether this declaration is hidden from name lookup.
Definition: Decl.h:305
bool isConst() const
Definition: Type.h:3019
bool hasExternalVisibleStorage() const
Whether this DeclContext has external storage containing additional declarations that are visible in ...
Definition: DeclBase.h:1766
const ObjCInterfaceDecl * getSuperClass() const
Definition: DeclObjC.h:2587
const StringLiteral * getAsmString() const
Definition: Decl.h:3444
bool hasInit() const
Definition: Decl.cpp:2040
QualType getArgumentType() const
Definition: Expr.h:2011
PresumedLoc getPresumedLoc(SourceLocation Loc, bool UseLineDirectives=true) const
Returns the "presumed" location of a SourceLocation specifies.