clang  12.0.0git
JSONNodeDumper.h
Go to the documentation of this file.
1 //===--- JSONNodeDumper.h - Printing of AST nodes to JSON -----------------===//
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 AST dumping of components of individual AST nodes to
11 // a JSON.
12 //
13 //===----------------------------------------------------------------------===//
14 
15 #ifndef LLVM_CLANG_AST_JSONNODEDUMPER_H
16 #define LLVM_CLANG_AST_JSONNODEDUMPER_H
17 
18 #include "clang/AST/ASTContext.h"
21 #include "clang/AST/AttrVisitor.h"
24 #include "clang/AST/ExprCXX.h"
25 #include "clang/AST/Mangle.h"
26 #include "clang/AST/Type.h"
27 #include "llvm/Support/JSON.h"
28 
29 namespace clang {
30 
31 class APValue;
32 
33 class NodeStreamer {
34  bool FirstChild = true;
35  bool TopLevel = true;
37 
38 protected:
39  llvm::json::OStream JOS;
40 
41 public:
42  /// Add a child of the current node. Calls DoAddChild without arguments
43  template <typename Fn> void AddChild(Fn DoAddChild) {
44  return AddChild("", DoAddChild);
45  }
46 
47  /// Add a child of the current node with an optional label.
48  /// Calls DoAddChild without arguments.
49  template <typename Fn> void AddChild(StringRef Label, Fn DoAddChild) {
50  // If we're at the top level, there's nothing interesting to do; just
51  // run the dumper.
52  if (TopLevel) {
53  TopLevel = false;
54  JOS.objectBegin();
55 
56  DoAddChild();
57 
58  while (!Pending.empty()) {
59  Pending.back()(true);
60  Pending.pop_back();
61  }
62 
63  JOS.objectEnd();
64  TopLevel = true;
65  return;
66  }
67 
68  // We need to capture an owning-string in the lambda because the lambda
69  // is invoked in a deferred manner.
70  std::string LabelStr(!Label.empty() ? Label : "inner");
71  bool WasFirstChild = FirstChild;
72  auto DumpWithIndent = [=](bool IsLastChild) {
73  if (WasFirstChild) {
74  JOS.attributeBegin(LabelStr);
75  JOS.arrayBegin();
76  }
77 
78  FirstChild = true;
79  unsigned Depth = Pending.size();
80  JOS.objectBegin();
81 
82  DoAddChild();
83 
84  // If any children are left, they're the last at their nesting level.
85  // Dump those ones out now.
86  while (Depth < Pending.size()) {
87  Pending.back()(true);
88  this->Pending.pop_back();
89  }
90 
91  JOS.objectEnd();
92 
93  if (IsLastChild) {
94  JOS.arrayEnd();
95  JOS.attributeEnd();
96  }
97  };
98 
99  if (FirstChild) {
100  Pending.push_back(std::move(DumpWithIndent));
101  } else {
102  Pending.back()(false);
103  Pending.back() = std::move(DumpWithIndent);
104  }
105  FirstChild = false;
106  }
107 
108  NodeStreamer(raw_ostream &OS) : JOS(OS, 2) {}
109 };
110 
111 // Dumps AST nodes in JSON format. There is no implied stability for the
112 // content or format of the dump between major releases of Clang, other than it
113 // being valid JSON output. Further, there is no requirement that the
114 // information dumped is a complete representation of the AST, only that the
115 // information presented is correct.
117  : public ConstAttrVisitor<JSONNodeDumper>,
118  public comments::ConstCommentVisitor<JSONNodeDumper, void,
119  const comments::FullComment *>,
120  public ConstTemplateArgumentVisitor<JSONNodeDumper>,
121  public ConstStmtVisitor<JSONNodeDumper>,
122  public TypeVisitor<JSONNodeDumper>,
123  public ConstDeclVisitor<JSONNodeDumper>,
124  public NodeStreamer {
125  friend class JSONDumper;
126 
127  const SourceManager &SM;
128  ASTContext& Ctx;
129  ASTNameGenerator ASTNameGen;
130  PrintingPolicy PrintPolicy;
131  const comments::CommandTraits *Traits;
132  StringRef LastLocFilename, LastLocPresumedFilename;
133  unsigned LastLocLine, LastLocPresumedLine;
134 
136  using InnerCommentVisitor =
138  const comments::FullComment *>;
143 
144  void attributeOnlyIfTrue(StringRef Key, bool Value) {
145  if (Value)
146  JOS.attribute(Key, Value);
147  }
148 
149  void writeIncludeStack(PresumedLoc Loc, bool JustFirst = false);
150 
151  // Writes the attributes of a SourceLocation object without.
152  void writeBareSourceLocation(SourceLocation Loc, bool IsSpelling);
153 
154  // Writes the attributes of a SourceLocation to JSON based on its presumed
155  // spelling location. If the given location represents a macro invocation,
156  // this outputs two sub-objects: one for the spelling and one for the
157  // expansion location.
158  void writeSourceLocation(SourceLocation Loc);
159  void writeSourceRange(SourceRange R);
160  std::string createPointerRepresentation(const void *Ptr);
161  llvm::json::Object createQualType(QualType QT, bool Desugar = true);
162  llvm::json::Object createBareDeclRef(const Decl *D);
163  void writeBareDeclRef(const Decl *D);
164  llvm::json::Object createCXXRecordDefinitionData(const CXXRecordDecl *RD);
165  llvm::json::Object createCXXBaseSpecifier(const CXXBaseSpecifier &BS);
166  std::string createAccessSpecifier(AccessSpecifier AS);
167  llvm::json::Array createCastPath(const CastExpr *C);
168 
169  void writePreviousDeclImpl(...) {}
170 
171  template <typename T> void writePreviousDeclImpl(const Mergeable<T> *D) {
172  const T *First = D->getFirstDecl();
173  if (First != D)
174  JOS.attribute("firstRedecl", createPointerRepresentation(First));
175  }
176 
177  template <typename T> void writePreviousDeclImpl(const Redeclarable<T> *D) {
178  const T *Prev = D->getPreviousDecl();
179  if (Prev)
180  JOS.attribute("previousDecl", createPointerRepresentation(Prev));
181  }
182  void addPreviousDeclaration(const Decl *D);
183 
184  StringRef getCommentCommandName(unsigned CommandID) const;
185 
186 public:
187  JSONNodeDumper(raw_ostream &OS, const SourceManager &SrcMgr, ASTContext &Ctx,
188  const PrintingPolicy &PrintPolicy,
189  const comments::CommandTraits *Traits)
190  : NodeStreamer(OS), SM(SrcMgr), Ctx(Ctx), ASTNameGen(Ctx),
191  PrintPolicy(PrintPolicy), Traits(Traits), LastLocLine(0),
192  LastLocPresumedLine(0) {}
193 
194  void Visit(const Attr *A);
195  void Visit(const Stmt *Node);
196  void Visit(const Type *T);
197  void Visit(QualType T);
198  void Visit(const Decl *D);
199 
200  void Visit(const comments::Comment *C, const comments::FullComment *FC);
201  void Visit(const TemplateArgument &TA, SourceRange R = {},
202  const Decl *From = nullptr, StringRef Label = {});
203  void Visit(const CXXCtorInitializer *Init);
204  void Visit(const OMPClause *C);
205  void Visit(const BlockDecl::Capture &C);
206  void Visit(const GenericSelectionExpr::ConstAssociation &A);
207  void Visit(const APValue &Value, QualType Ty);
208 
209  void VisitTypedefType(const TypedefType *TT);
210  void VisitFunctionType(const FunctionType *T);
211  void VisitFunctionProtoType(const FunctionProtoType *T);
212  void VisitRValueReferenceType(const ReferenceType *RT);
213  void VisitArrayType(const ArrayType *AT);
214  void VisitConstantArrayType(const ConstantArrayType *CAT);
215  void VisitDependentSizedExtVectorType(const DependentSizedExtVectorType *VT);
216  void VisitVectorType(const VectorType *VT);
217  void VisitUnresolvedUsingType(const UnresolvedUsingType *UUT);
218  void VisitUnaryTransformType(const UnaryTransformType *UTT);
219  void VisitTagType(const TagType *TT);
220  void VisitTemplateTypeParmType(const TemplateTypeParmType *TTPT);
221  void VisitAutoType(const AutoType *AT);
222  void VisitTemplateSpecializationType(const TemplateSpecializationType *TST);
223  void VisitInjectedClassNameType(const InjectedClassNameType *ICNT);
224  void VisitObjCInterfaceType(const ObjCInterfaceType *OIT);
225  void VisitPackExpansionType(const PackExpansionType *PET);
226  void VisitElaboratedType(const ElaboratedType *ET);
227  void VisitMacroQualifiedType(const MacroQualifiedType *MQT);
228  void VisitMemberPointerType(const MemberPointerType *MPT);
229 
230  void VisitNamedDecl(const NamedDecl *ND);
231  void VisitTypedefDecl(const TypedefDecl *TD);
232  void VisitTypeAliasDecl(const TypeAliasDecl *TAD);
233  void VisitNamespaceDecl(const NamespaceDecl *ND);
234  void VisitUsingDirectiveDecl(const UsingDirectiveDecl *UDD);
235  void VisitNamespaceAliasDecl(const NamespaceAliasDecl *NAD);
236  void VisitUsingDecl(const UsingDecl *UD);
237  void VisitUsingShadowDecl(const UsingShadowDecl *USD);
238  void VisitVarDecl(const VarDecl *VD);
239  void VisitFieldDecl(const FieldDecl *FD);
240  void VisitFunctionDecl(const FunctionDecl *FD);
241  void VisitEnumDecl(const EnumDecl *ED);
242  void VisitEnumConstantDecl(const EnumConstantDecl *ECD);
243  void VisitRecordDecl(const RecordDecl *RD);
244  void VisitCXXRecordDecl(const CXXRecordDecl *RD);
245  void VisitTemplateTypeParmDecl(const TemplateTypeParmDecl *D);
246  void VisitNonTypeTemplateParmDecl(const NonTypeTemplateParmDecl *D);
247  void VisitTemplateTemplateParmDecl(const TemplateTemplateParmDecl *D);
248  void VisitLinkageSpecDecl(const LinkageSpecDecl *LSD);
249  void VisitAccessSpecDecl(const AccessSpecDecl *ASD);
250  void VisitFriendDecl(const FriendDecl *FD);
251 
252  void VisitObjCIvarDecl(const ObjCIvarDecl *D);
253  void VisitObjCMethodDecl(const ObjCMethodDecl *D);
254  void VisitObjCTypeParamDecl(const ObjCTypeParamDecl *D);
255  void VisitObjCCategoryDecl(const ObjCCategoryDecl *D);
256  void VisitObjCCategoryImplDecl(const ObjCCategoryImplDecl *D);
257  void VisitObjCProtocolDecl(const ObjCProtocolDecl *D);
258  void VisitObjCInterfaceDecl(const ObjCInterfaceDecl *D);
259  void VisitObjCImplementationDecl(const ObjCImplementationDecl *D);
260  void VisitObjCCompatibleAliasDecl(const ObjCCompatibleAliasDecl *D);
261  void VisitObjCPropertyDecl(const ObjCPropertyDecl *D);
262  void VisitObjCPropertyImplDecl(const ObjCPropertyImplDecl *D);
263  void VisitBlockDecl(const BlockDecl *D);
264 
265  void VisitDeclRefExpr(const DeclRefExpr *DRE);
266  void VisitPredefinedExpr(const PredefinedExpr *PE);
267  void VisitUnaryOperator(const UnaryOperator *UO);
268  void VisitBinaryOperator(const BinaryOperator *BO);
269  void VisitCompoundAssignOperator(const CompoundAssignOperator *CAO);
270  void VisitMemberExpr(const MemberExpr *ME);
271  void VisitCXXNewExpr(const CXXNewExpr *NE);
272  void VisitCXXDeleteExpr(const CXXDeleteExpr *DE);
273  void VisitCXXThisExpr(const CXXThisExpr *TE);
274  void VisitCastExpr(const CastExpr *CE);
275  void VisitImplicitCastExpr(const ImplicitCastExpr *ICE);
276  void VisitCallExpr(const CallExpr *CE);
277  void VisitUnaryExprOrTypeTraitExpr(const UnaryExprOrTypeTraitExpr *TTE);
278  void VisitSizeOfPackExpr(const SizeOfPackExpr *SOPE);
279  void VisitUnresolvedLookupExpr(const UnresolvedLookupExpr *ULE);
280  void VisitAddrLabelExpr(const AddrLabelExpr *ALE);
281  void VisitCXXTypeidExpr(const CXXTypeidExpr *CTE);
282  void VisitConstantExpr(const ConstantExpr *CE);
283  void VisitInitListExpr(const InitListExpr *ILE);
284  void VisitGenericSelectionExpr(const GenericSelectionExpr *GSE);
285  void VisitCXXUnresolvedConstructExpr(const CXXUnresolvedConstructExpr *UCE);
286  void VisitCXXConstructExpr(const CXXConstructExpr *CE);
287  void VisitExprWithCleanups(const ExprWithCleanups *EWC);
288  void VisitCXXBindTemporaryExpr(const CXXBindTemporaryExpr *BTE);
289  void VisitMaterializeTemporaryExpr(const MaterializeTemporaryExpr *MTE);
290  void VisitCXXDependentScopeMemberExpr(const CXXDependentScopeMemberExpr *ME);
291 
292  void VisitObjCEncodeExpr(const ObjCEncodeExpr *OEE);
293  void VisitObjCMessageExpr(const ObjCMessageExpr *OME);
294  void VisitObjCBoxedExpr(const ObjCBoxedExpr *OBE);
295  void VisitObjCSelectorExpr(const ObjCSelectorExpr *OSE);
296  void VisitObjCProtocolExpr(const ObjCProtocolExpr *OPE);
297  void VisitObjCPropertyRefExpr(const ObjCPropertyRefExpr *OPRE);
298  void VisitObjCSubscriptRefExpr(const ObjCSubscriptRefExpr *OSRE);
299  void VisitObjCIvarRefExpr(const ObjCIvarRefExpr *OIRE);
300  void VisitObjCBoolLiteralExpr(const ObjCBoolLiteralExpr *OBLE);
301 
302  void VisitIntegerLiteral(const IntegerLiteral *IL);
303  void VisitCharacterLiteral(const CharacterLiteral *CL);
304  void VisitFixedPointLiteral(const FixedPointLiteral *FPL);
305  void VisitFloatingLiteral(const FloatingLiteral *FL);
306  void VisitStringLiteral(const StringLiteral *SL);
307  void VisitCXXBoolLiteralExpr(const CXXBoolLiteralExpr *BLE);
308 
309  void VisitIfStmt(const IfStmt *IS);
310  void VisitSwitchStmt(const SwitchStmt *SS);
311  void VisitCaseStmt(const CaseStmt *CS);
312  void VisitLabelStmt(const LabelStmt *LS);
313  void VisitGotoStmt(const GotoStmt *GS);
314  void VisitWhileStmt(const WhileStmt *WS);
315  void VisitObjCAtCatchStmt(const ObjCAtCatchStmt *OACS);
316 
317  void VisitNullTemplateArgument(const TemplateArgument &TA);
318  void VisitTypeTemplateArgument(const TemplateArgument &TA);
319  void VisitDeclarationTemplateArgument(const TemplateArgument &TA);
320  void VisitNullPtrTemplateArgument(const TemplateArgument &TA);
321  void VisitIntegralTemplateArgument(const TemplateArgument &TA);
322  void VisitTemplateTemplateArgument(const TemplateArgument &TA);
323  void VisitTemplateExpansionTemplateArgument(const TemplateArgument &TA);
324  void VisitExpressionTemplateArgument(const TemplateArgument &TA);
325  void VisitPackTemplateArgument(const TemplateArgument &TA);
326 
327  void visitTextComment(const comments::TextComment *C,
328  const comments::FullComment *);
329  void visitInlineCommandComment(const comments::InlineCommandComment *C,
330  const comments::FullComment *);
331  void visitHTMLStartTagComment(const comments::HTMLStartTagComment *C,
332  const comments::FullComment *);
333  void visitHTMLEndTagComment(const comments::HTMLEndTagComment *C,
334  const comments::FullComment *);
335  void visitBlockCommandComment(const comments::BlockCommandComment *C,
336  const comments::FullComment *);
337  void visitParamCommandComment(const comments::ParamCommandComment *C,
338  const comments::FullComment *FC);
339  void visitTParamCommandComment(const comments::TParamCommandComment *C,
340  const comments::FullComment *FC);
341  void visitVerbatimBlockComment(const comments::VerbatimBlockComment *C,
342  const comments::FullComment *);
343  void
344  visitVerbatimBlockLineComment(const comments::VerbatimBlockLineComment *C,
345  const comments::FullComment *);
346  void visitVerbatimLineComment(const comments::VerbatimLineComment *C,
347  const comments::FullComment *);
348 };
349 
350 class JSONDumper : public ASTNodeTraverser<JSONDumper, JSONNodeDumper> {
351  JSONNodeDumper NodeDumper;
352 
353  template <typename SpecializationDecl>
354  void writeTemplateDeclSpecialization(const SpecializationDecl *SD,
355  bool DumpExplicitInst,
356  bool DumpRefOnly) {
357  bool DumpedAny = false;
358  for (const auto *RedeclWithBadType : SD->redecls()) {
359  // FIXME: The redecls() range sometimes has elements of a less-specific
360  // type. (In particular, ClassTemplateSpecializationDecl::redecls() gives
361  // us TagDecls, and should give CXXRecordDecls).
362  const auto *Redecl = dyn_cast<SpecializationDecl>(RedeclWithBadType);
363  if (!Redecl) {
364  // Found the injected-class-name for a class template. This will be
365  // dumped as part of its surrounding class so we don't need to dump it
366  // here.
367  assert(isa<CXXRecordDecl>(RedeclWithBadType) &&
368  "expected an injected-class-name");
369  continue;
370  }
371 
372  switch (Redecl->getTemplateSpecializationKind()) {
375  if (!DumpExplicitInst)
376  break;
377  LLVM_FALLTHROUGH;
378  case TSK_Undeclared:
380  if (DumpRefOnly)
381  NodeDumper.AddChild([=] { NodeDumper.writeBareDeclRef(Redecl); });
382  else
383  Visit(Redecl);
384  DumpedAny = true;
385  break;
387  break;
388  }
389  }
390 
391  // Ensure we dump at least one decl for each specialization.
392  if (!DumpedAny)
393  NodeDumper.AddChild([=] { NodeDumper.writeBareDeclRef(SD); });
394  }
395 
396  template <typename TemplateDecl>
397  void writeTemplateDecl(const TemplateDecl *TD, bool DumpExplicitInst) {
398  // FIXME: it would be nice to dump template parameters and specializations
399  // to their own named arrays rather than shoving them into the "inner"
400  // array. However, template declarations are currently being handled at the
401  // wrong "level" of the traversal hierarchy and so it is difficult to
402  // achieve without losing information elsewhere.
403 
404  dumpTemplateParameters(TD->getTemplateParameters());
405 
406  Visit(TD->getTemplatedDecl());
407 
408  for (const auto *Child : TD->specializations())
409  writeTemplateDeclSpecialization(Child, DumpExplicitInst,
410  !TD->isCanonicalDecl());
411  }
412 
413 public:
414  JSONDumper(raw_ostream &OS, const SourceManager &SrcMgr, ASTContext &Ctx,
415  const PrintingPolicy &PrintPolicy,
416  const comments::CommandTraits *Traits)
417  : NodeDumper(OS, SrcMgr, Ctx, PrintPolicy, Traits) {}
418 
419  JSONNodeDumper &doGetNodeDelegate() { return NodeDumper; }
420 
422  writeTemplateDecl(FTD, true);
423  }
425  writeTemplateDecl(CTD, false);
426  }
428  writeTemplateDecl(VTD, false);
429  }
430 };
431 
432 } // namespace clang
433 
434 #endif // LLVM_CLANG_AST_JSONNODEDUMPER_H
ObjCPropertyRefExpr - A dot-syntax expression to access an ObjC property.
Definition: ExprObjC.h:614
void VisitFunctionTemplateDecl(const FunctionTemplateDecl *FTD)
Defines the clang::ASTContext interface.
Represents a type that was referred to using an elaborated type keyword, e.g., struct S...
Definition: Type.h:5388
Represents a function declaration or definition.
Definition: Decl.h:1783
A class which contains all the information about a particular captured value.
Definition: Decl.h:4070
Represents the dependent type named by a dependently-scoped typename using declaration, e.g.
Definition: Type.h:4342
A (possibly-)qualified type.
Definition: Type.h:655
ConstStmtVisitor - This class implements a simple visitor for Stmt subclasses.
Definition: StmtVisitor.h:193
Stmt - This represents one statement.
Definition: Stmt.h:68
FunctionType - C99 6.7.5.3 - Function Declarators.
Definition: Type.h:3547
IfStmt - This represents an if/then/else.
Definition: Stmt.h:1866
An instance of this object exists for each enum constant that is defined.
Definition: Decl.h:2961
Represents the declaration of a typedef-name via the &#39;typedef&#39; type specifier.
Definition: Decl.h:3193
C Language Family Type Representation.
Decl - This represents one declaration (or definition), e.g.
Definition: DeclBase.h:89
A reference to a name which we were able to look up during parsing but could not resolve to a specifi...
Definition: ExprCXX.h:3027
NamedDecl * getTemplatedDecl() const
Get the underlying, templated declaration.
Definition: DeclTemplate.h:434
Represents a C++11 auto or C++14 decltype(auto) type, possibly constrained by a type-constraint.
Definition: Type.h:4981
The base class of the type hierarchy.
Definition: Type.h:1472
Declaration of a variable template.
Represents an array type, per C99 6.7.5.2 - Array Declarators.
Definition: Type.h:2888
Represent a C++ namespace.
Definition: Decl.h:497
Represents a call to a C++ constructor.
Definition: ExprCXX.h:1426
ObjCSubscriptRefExpr - used for array and dictionary subscripting.
Definition: ExprObjC.h:841
AccessSpecifier
A C++ access specifier (public, private, protected), plus the special value "none" which means differ...
Definition: Specifiers.h:115
Represents a prvalue temporary that is written into memory so that a reference can bind to it...
Definition: ExprCXX.h:4406
FriendDecl - Represents the declaration of a friend entity, which can be a function, a type, or a templated function or type.
Definition: DeclFriend.h:53
Represents a variable declaration or definition.
Definition: Decl.h:820
ObjCMethodDecl - Represents an instance or class method declaration.
Definition: DeclObjC.h:139
Describes how types, statements, expressions, and declarations should be printed. ...
Definition: PrettyPrinter.h:49
Represents an expression – generally a full-expression – that introduces cleanups to be run at the ...
Definition: ExprCXX.h:3296
Defines the clang::Expr interface and subclasses for C++ expressions.
LabelStmt - Represents a label, which has a substatement.
Definition: Stmt.h:1764
Represents a struct/union/class.
Definition: Decl.h:3770
Provides common interface for the Decls that can be redeclared.
Definition: Redeclarable.h:84
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:174
Represents a member of a struct/union/class.
Definition: Decl.h:2746
A simple visitor class that helps create attribute visitors.
Definition: AttrVisitor.h:69
An operation on a type.
Definition: TypeVisitor.h:64
void AddChild(StringRef Label, Fn DoAddChild)
Add a child of the current node with an optional label.
Represents an access specifier followed by colon &#39;:&#39;.
Definition: DeclCXX.h:86
JSONNodeDumper & doGetNodeDelegate()
Represents Objective-C&#39;s @catch statement.
Definition: StmtObjC.h:77
A command with word-like arguments that is considered inline content.
Definition: Comment.h:297
Describes an C or C++ initializer list.
Definition: Expr.h:4627
A C++ typeid expression (C++ [expr.typeid]), which gets the type_info that corresponds to the supplie...
Definition: ExprCXX.h:809
Represents a C++ using-declaration.
Definition: DeclCXX.h:3398
AssociationTy< true > ConstAssociation
Definition: Expr.h:5612
A line of text contained in a verbatim block.
Definition: Comment.h:863
A verbatim line command.
Definition: Comment.h:943
A simple visitor class that helps create template argument visitors.
void VisitClassTemplateDecl(const ClassTemplateDecl *CTD)
Sugar type that represents a type that was qualified by a qualifier written as a macro invocation...
Definition: Type.h:4395
A builtin binary operation expression such as "x + y" or "x <= y".
Definition: Expr.h:3644
Any part of the comment.
Definition: Comment.h:52
CaseStmt - Represent a case statement.
Definition: Stmt.h:1532
CastExpr - Base class for type casts, including both implicit casts (ImplicitCastExpr) and explicit c...
Definition: Expr.h:3373
Represents an Objective-C protocol declaration.
Definition: DeclObjC.h:2055
Represents binding an expression to a temporary.
Definition: ExprCXX.h:1378
Represents a C++ member access expression where the actual member referenced could not be resolved be...
Definition: ExprCXX.h:3503
Represents an ObjC class declaration.
Definition: DeclObjC.h:1163
Represents a linkage specification.
Definition: DeclCXX.h:2807
Represents an extended vector type where either the type or size is dependent.
Definition: Type.h:3194
Represents the this expression in C++.
Definition: ExprCXX.h:1108
ObjCPropertyImplDecl - Represents implementation declaration of a property in a class or category imp...
Definition: DeclObjC.h:2748
decl_type * getFirstDecl()
Return the first declaration of this declaration or itself if this is the only declaration.
Definition: Redeclarable.h:318
A verbatim block command (e.
Definition: Comment.h:891
Represents the declaration of a typedef-name via a C++11 alias-declaration.
Definition: Decl.h:3213
Represents a prototype with parameter type info, e.g.
Definition: Type.h:3886
UnaryExprOrTypeTraitExpr - expression with either a type or (unevaluated) expression operand...
Definition: Expr.h:2517
ConstantExpr - An expression that occurs in a constant context and optionally the result of evaluatin...
Definition: Expr.h:999
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
Definition: DeclTemplate.h:421
bool isCanonicalDecl() const
Whether this particular Decl is a canonical one.
Definition: DeclBase.h:907
Represents a block literal declaration, which is like an unnamed FunctionDecl.
Definition: Decl.h:4064
std::string Label
Declaration of a template type parameter.
DynTypedNode Node
A command that has zero or more word-like arguments (number of word-like arguments depends on command...
Definition: Comment.h:596
ObjCSelectorExpr used for @selector in Objective-C.
Definition: ExprObjC.h:454
Represents an expression that computes the length of a parameter pack.
Definition: ExprCXX.h:4080
NonTypeTemplateParmDecl - Declares a non-type template parameter, e.g., "Size" in.
int Depth
Definition: ASTDiff.cpp:191
A unary type transform, which is a type constructed from another.
Definition: Type.h:4535
An expression that sends a message to the given Objective-C object or class.
Definition: ExprObjC.h:940
Represents an unpacked "presumed" location which can be presented to the user.
UnaryOperator - This represents the unary-expression&#39;s (except sizeof and alignof), the postinc/postdec operators from postfix-expression, and various extensions.
Definition: Expr.h:2131
#define SM(sm)
Definition: Cuda.cpp:62
Represents a GCC generic vector type.
Definition: Type.h:3234
An opening HTML tag with attributes.
Definition: Comment.h:413
TemplateTemplateParmDecl - Declares a template template parameter, e.g., "T" in.
JSONNodeDumper(raw_ostream &OS, const SourceManager &SrcMgr, ASTContext &Ctx, const PrintingPolicy &PrintPolicy, const comments::CommandTraits *Traits)
static QualType Desugar(ASTContext &Context, QualType QT, bool &ShouldAKA)
This template specialization was implicitly instantiated from a template.
Definition: Specifiers.h:186
This class provides information about commands that can be used in comments.
decl_type * getPreviousDecl()
Return the previous declaration of this declaration or NULL if this is the first declaration.
Definition: Redeclarable.h:203
Encodes a location in the source.
Interfaces are the core concept in Objective-C for object oriented design.
Definition: Type.h:5993
JSONDumper(raw_ostream &OS, const SourceManager &SrcMgr, ASTContext &Ctx, const PrintingPolicy &PrintPolicy, const comments::CommandTraits *Traits)
Represents a new-expression for memory allocation and constructor calls, e.g: "new CXXNewExpr(foo)"...
Definition: ExprCXX.h:2093
ObjCCategoryDecl - Represents a category declaration.
Definition: DeclObjC.h:2271
This is a basic class for representing single OpenMP clause.
Definition: OpenMPClause.h:52
ObjCProtocolExpr used for protocol expression in Objective-C.
Definition: ExprObjC.h:504
ASTNodeTraverser traverses the Clang AST for dumping purposes.
Represents one property declaration in an Objective-C interface.
Definition: DeclObjC.h:742
ImplicitCastExpr - Allows us to explicitly represent implicit type conversions, which have no direct ...
Definition: Expr.h:3484
This template specialization was instantiated from a template due to an explicit instantiation defini...
Definition: Specifiers.h:198
This template specialization was formed from a template-id but has not yet been declared, defined, or instantiated.
Definition: Specifiers.h:183
A closing HTML tag.
Definition: Comment.h:507
ObjCBoxedExpr - used for generalized expression boxing.
Definition: ExprObjC.h:128
NodeStreamer(raw_ostream &OS)
Doxygen \tparam command, describes a template parameter.
Definition: Comment.h:799
The injected class name of a C++ class template or class template partial specialization.
Definition: Type.h:5241
Represents a pack expansion of types.
Definition: Type.h:5610
CompoundAssignOperator - For compound assignments (e.g.
Definition: Expr.h:3891
Represents a C11 generic selection.
Definition: Expr.h:5454
AddrLabelExpr - The GNU address of label extension, representing &&label.
Definition: Expr.h:4141
Represents a template argument.
Definition: TemplateBase.h:51
Dataflow Directional Tag Classes.
[C99 6.4.2.2] - A predefined identifier such as func.
Definition: Expr.h:1924
Represents a delete expression for memory deallocation and destructor calls, e.g. ...
Definition: ExprCXX.h:2352
The base class of all kinds of template declarations (e.g., class, function, etc.).
Definition: DeclTemplate.h:402
bool NE(InterpState &S, CodePtr OpPC)
Definition: Interp.h:223
This template specialization was instantiated from a template due to an explicit instantiation declar...
Definition: Specifiers.h:194
Represents the declaration of an Objective-C type parameter.
Definition: DeclObjC.h:572
Represents an enum.
Definition: Decl.h:3501
A pointer to member type per C++ 8.3.3 - Pointers to members.
Definition: Type.h:2836
SwitchStmt - This represents a &#39;switch&#39; stmt.
Definition: Stmt.h:2075
ObjCImplementationDecl - Represents a class definition - this is where method definitions are specifi...
Definition: DeclObjC.h:2543
Provides common interface for the Decls that cannot be redeclared, but can be merged if the same decl...
Definition: Redeclarable.h:312
Represents a C++ base or member initializer.
Definition: DeclCXX.h:2185
This template specialization was declared or defined by an explicit specialization (C++ [temp...
Definition: Specifiers.h:190
ObjCEncodeExpr, used for @encode in Objective-C.
Definition: ExprObjC.h:409
Base for LValueReferenceType and RValueReferenceType.
Definition: Type.h:2756
APValue - This class implements a discriminated union of [uninitialized] [APSInt] [APFloat]...
Definition: APValue.h:115
Represents a base class of a C++ class.
Definition: DeclCXX.h:146
ObjCIvarRefExpr - A reference to an ObjC instance variable.
Definition: ExprObjC.h:548
void VisitVarTemplateDecl(const VarTemplateDecl *VTD)
Describes an explicit type conversion that uses functional notion but could not be resolved because o...
Definition: ExprCXX.h:3382
GotoStmt - This represents a direct goto.
Definition: Stmt.h:2522
llvm::json::OStream JOS
MemberExpr - [C99 6.5.2.3] Structure and Union Members.
Definition: Expr.h:3062
Represents a C++ struct/union/class.
Definition: DeclCXX.h:254
ObjCIvarDecl - Represents an ObjC instance variable.
Definition: DeclObjC.h:1936
WhileStmt - This represents a &#39;while&#39; stmt.
Definition: Stmt.h:2258
Declaration of a class template.
StringLiteral - This represents a string literal expression, e.g.
Definition: Expr.h:1732
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
Definition: Expr.h:2768
ObjCBoolLiteralExpr - Objective-C Boolean Literal.
Definition: ExprObjC.h:88
A reference to a declared variable, function, enum, etc.
Definition: Expr.h:1190
Represents a type template specialization; the template must be a class template, a type alias templa...
Definition: Type.h:5104
Doxygen \param command.
Definition: Comment.h:711
A trivial tuple used to represent a source range.
This represents a decl that may have a name.
Definition: Decl.h:223
A boolean literal, per ([C++ lex.bool] Boolean literals).
Definition: ExprCXX.h:691
Represents a C++ namespace alias.
Definition: DeclCXX.h:2996
void AddChild(Fn DoAddChild)
Add a child of the current node. Calls DoAddChild without arguments.
Represents C++ using-directive.
Definition: DeclCXX.h:2892
A simple visitor class that helps create declaration visitors.
Definition: DeclVisitor.h:73
ObjCCategoryImplDecl - An object of this class encapsulates a category @implementation declaration...
Definition: DeclObjC.h:2490
Represents the canonical version of C arrays with a specified constant size.
Definition: Type.h:2934
This class handles loading and caching of source files into memory.
Declaration of a template function.
Definition: DeclTemplate.h:977
Attr - This represents one attribute.
Definition: Attr.h:46
Represents a shadow declaration introduced into a scope by a (resolved) using declaration.
Definition: DeclCXX.h:3191
A full comment attached to a declaration, contains block content.
Definition: Comment.h:1091
ObjCCompatibleAliasDecl - Represents alias of a class.
Definition: DeclObjC.h:2718