clang  10.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 "llvm/Support/JSON.h"
27 
28 namespace clang {
29 
30 class NodeStreamer {
31  bool FirstChild = true;
32  bool TopLevel = true;
34 
35 protected:
36  llvm::json::OStream JOS;
37 
38 public:
39  /// Add a child of the current node. Calls DoAddChild without arguments
40  template <typename Fn> void AddChild(Fn DoAddChild) {
41  return AddChild("", DoAddChild);
42  }
43 
44  /// Add a child of the current node with an optional label.
45  /// Calls DoAddChild without arguments.
46  template <typename Fn> void AddChild(StringRef Label, Fn DoAddChild) {
47  // If we're at the top level, there's nothing interesting to do; just
48  // run the dumper.
49  if (TopLevel) {
50  TopLevel = false;
51  JOS.objectBegin();
52 
53  DoAddChild();
54 
55  while (!Pending.empty()) {
56  Pending.back()(true);
57  Pending.pop_back();
58  }
59 
60  JOS.objectEnd();
61  TopLevel = true;
62  return;
63  }
64 
65  // We need to capture an owning-string in the lambda because the lambda
66  // is invoked in a deferred manner.
67  std::string LabelStr = !Label.empty() ? Label : "inner";
68  bool WasFirstChild = FirstChild;
69  auto DumpWithIndent = [=](bool IsLastChild) {
70  if (WasFirstChild) {
71  JOS.attributeBegin(LabelStr);
72  JOS.arrayBegin();
73  }
74 
75  FirstChild = true;
76  unsigned Depth = Pending.size();
77  JOS.objectBegin();
78 
79  DoAddChild();
80 
81  // If any children are left, they're the last at their nesting level.
82  // Dump those ones out now.
83  while (Depth < Pending.size()) {
84  Pending.back()(true);
85  this->Pending.pop_back();
86  }
87 
88  JOS.objectEnd();
89 
90  if (IsLastChild) {
91  JOS.arrayEnd();
92  JOS.attributeEnd();
93  }
94  };
95 
96  if (FirstChild) {
97  Pending.push_back(std::move(DumpWithIndent));
98  } else {
99  Pending.back()(false);
100  Pending.back() = std::move(DumpWithIndent);
101  }
102  FirstChild = false;
103  }
104 
105  NodeStreamer(raw_ostream &OS) : JOS(OS, 2) {}
106 };
107 
108 // Dumps AST nodes in JSON format. There is no implied stability for the
109 // content or format of the dump between major releases of Clang, other than it
110 // being valid JSON output. Further, there is no requirement that the
111 // information dumped is a complete representation of the AST, only that the
112 // information presented is correct.
114  : public ConstAttrVisitor<JSONNodeDumper>,
115  public comments::ConstCommentVisitor<JSONNodeDumper, void,
116  const comments::FullComment *>,
117  public ConstTemplateArgumentVisitor<JSONNodeDumper>,
118  public ConstStmtVisitor<JSONNodeDumper>,
119  public TypeVisitor<JSONNodeDumper>,
120  public ConstDeclVisitor<JSONNodeDumper>,
121  public NodeStreamer {
122  friend class JSONDumper;
123 
124  const SourceManager &SM;
125  ASTContext& Ctx;
126  ASTNameGenerator ASTNameGen;
127  PrintingPolicy PrintPolicy;
128  const comments::CommandTraits *Traits;
129  StringRef LastLocFilename, LastLocPresumedFilename;
130  unsigned LastLocLine, LastLocPresumedLine;
131 
133  using InnerCommentVisitor =
135  const comments::FullComment *>;
140 
141  void attributeOnlyIfTrue(StringRef Key, bool Value) {
142  if (Value)
143  JOS.attribute(Key, Value);
144  }
145 
146  void writeIncludeStack(PresumedLoc Loc, bool JustFirst = false);
147 
148  // Writes the attributes of a SourceLocation object without.
149  void writeBareSourceLocation(SourceLocation Loc, bool IsSpelling);
150 
151  // Writes the attributes of a SourceLocation to JSON based on its presumed
152  // spelling location. If the given location represents a macro invocation,
153  // this outputs two sub-objects: one for the spelling and one for the
154  // expansion location.
155  void writeSourceLocation(SourceLocation Loc);
156  void writeSourceRange(SourceRange R);
157  std::string createPointerRepresentation(const void *Ptr);
158  llvm::json::Object createQualType(QualType QT, bool Desugar = true);
159  llvm::json::Object createBareDeclRef(const Decl *D);
160  void writeBareDeclRef(const Decl *D);
161  llvm::json::Object createCXXRecordDefinitionData(const CXXRecordDecl *RD);
162  llvm::json::Object createCXXBaseSpecifier(const CXXBaseSpecifier &BS);
163  std::string createAccessSpecifier(AccessSpecifier AS);
164  llvm::json::Array createCastPath(const CastExpr *C);
165 
166  void writePreviousDeclImpl(...) {}
167 
168  template <typename T> void writePreviousDeclImpl(const Mergeable<T> *D) {
169  const T *First = D->getFirstDecl();
170  if (First != D)
171  JOS.attribute("firstRedecl", createPointerRepresentation(First));
172  }
173 
174  template <typename T> void writePreviousDeclImpl(const Redeclarable<T> *D) {
175  const T *Prev = D->getPreviousDecl();
176  if (Prev)
177  JOS.attribute("previousDecl", createPointerRepresentation(Prev));
178  }
179  void addPreviousDeclaration(const Decl *D);
180 
181  StringRef getCommentCommandName(unsigned CommandID) const;
182 
183 public:
184  JSONNodeDumper(raw_ostream &OS, const SourceManager &SrcMgr, ASTContext &Ctx,
185  const PrintingPolicy &PrintPolicy,
186  const comments::CommandTraits *Traits)
187  : NodeStreamer(OS), SM(SrcMgr), Ctx(Ctx), ASTNameGen(Ctx),
188  PrintPolicy(PrintPolicy), Traits(Traits), LastLocLine(0),
189  LastLocPresumedLine(0) {}
190 
191  void Visit(const Attr *A);
192  void Visit(const Stmt *Node);
193  void Visit(const Type *T);
194  void Visit(QualType T);
195  void Visit(const Decl *D);
196 
197  void Visit(const comments::Comment *C, const comments::FullComment *FC);
198  void Visit(const TemplateArgument &TA, SourceRange R = {},
199  const Decl *From = nullptr, StringRef Label = {});
200  void Visit(const CXXCtorInitializer *Init);
201  void Visit(const OMPClause *C);
202  void Visit(const BlockDecl::Capture &C);
203  void Visit(const GenericSelectionExpr::ConstAssociation &A);
204 
205  void VisitTypedefType(const TypedefType *TT);
206  void VisitFunctionType(const FunctionType *T);
207  void VisitFunctionProtoType(const FunctionProtoType *T);
208  void VisitRValueReferenceType(const ReferenceType *RT);
209  void VisitArrayType(const ArrayType *AT);
210  void VisitConstantArrayType(const ConstantArrayType *CAT);
211  void VisitDependentSizedExtVectorType(const DependentSizedExtVectorType *VT);
212  void VisitVectorType(const VectorType *VT);
213  void VisitUnresolvedUsingType(const UnresolvedUsingType *UUT);
214  void VisitUnaryTransformType(const UnaryTransformType *UTT);
215  void VisitTagType(const TagType *TT);
216  void VisitTemplateTypeParmType(const TemplateTypeParmType *TTPT);
217  void VisitAutoType(const AutoType *AT);
218  void VisitTemplateSpecializationType(const TemplateSpecializationType *TST);
219  void VisitInjectedClassNameType(const InjectedClassNameType *ICNT);
220  void VisitObjCInterfaceType(const ObjCInterfaceType *OIT);
221  void VisitPackExpansionType(const PackExpansionType *PET);
222  void VisitElaboratedType(const ElaboratedType *ET);
223  void VisitMacroQualifiedType(const MacroQualifiedType *MQT);
224  void VisitMemberPointerType(const MemberPointerType *MPT);
225 
226  void VisitNamedDecl(const NamedDecl *ND);
227  void VisitTypedefDecl(const TypedefDecl *TD);
228  void VisitTypeAliasDecl(const TypeAliasDecl *TAD);
229  void VisitNamespaceDecl(const NamespaceDecl *ND);
230  void VisitUsingDirectiveDecl(const UsingDirectiveDecl *UDD);
231  void VisitNamespaceAliasDecl(const NamespaceAliasDecl *NAD);
232  void VisitUsingDecl(const UsingDecl *UD);
233  void VisitUsingShadowDecl(const UsingShadowDecl *USD);
234  void VisitVarDecl(const VarDecl *VD);
235  void VisitFieldDecl(const FieldDecl *FD);
236  void VisitFunctionDecl(const FunctionDecl *FD);
237  void VisitEnumDecl(const EnumDecl *ED);
238  void VisitEnumConstantDecl(const EnumConstantDecl *ECD);
239  void VisitRecordDecl(const RecordDecl *RD);
240  void VisitCXXRecordDecl(const CXXRecordDecl *RD);
241  void VisitTemplateTypeParmDecl(const TemplateTypeParmDecl *D);
242  void VisitNonTypeTemplateParmDecl(const NonTypeTemplateParmDecl *D);
243  void VisitTemplateTemplateParmDecl(const TemplateTemplateParmDecl *D);
244  void VisitLinkageSpecDecl(const LinkageSpecDecl *LSD);
245  void VisitAccessSpecDecl(const AccessSpecDecl *ASD);
246  void VisitFriendDecl(const FriendDecl *FD);
247 
248  void VisitObjCIvarDecl(const ObjCIvarDecl *D);
249  void VisitObjCMethodDecl(const ObjCMethodDecl *D);
250  void VisitObjCTypeParamDecl(const ObjCTypeParamDecl *D);
251  void VisitObjCCategoryDecl(const ObjCCategoryDecl *D);
252  void VisitObjCCategoryImplDecl(const ObjCCategoryImplDecl *D);
253  void VisitObjCProtocolDecl(const ObjCProtocolDecl *D);
254  void VisitObjCInterfaceDecl(const ObjCInterfaceDecl *D);
255  void VisitObjCImplementationDecl(const ObjCImplementationDecl *D);
256  void VisitObjCCompatibleAliasDecl(const ObjCCompatibleAliasDecl *D);
257  void VisitObjCPropertyDecl(const ObjCPropertyDecl *D);
258  void VisitObjCPropertyImplDecl(const ObjCPropertyImplDecl *D);
259  void VisitBlockDecl(const BlockDecl *D);
260 
261  void VisitDeclRefExpr(const DeclRefExpr *DRE);
262  void VisitPredefinedExpr(const PredefinedExpr *PE);
263  void VisitUnaryOperator(const UnaryOperator *UO);
264  void VisitBinaryOperator(const BinaryOperator *BO);
265  void VisitCompoundAssignOperator(const CompoundAssignOperator *CAO);
266  void VisitMemberExpr(const MemberExpr *ME);
267  void VisitCXXNewExpr(const CXXNewExpr *NE);
268  void VisitCXXDeleteExpr(const CXXDeleteExpr *DE);
269  void VisitCXXThisExpr(const CXXThisExpr *TE);
270  void VisitCastExpr(const CastExpr *CE);
271  void VisitImplicitCastExpr(const ImplicitCastExpr *ICE);
272  void VisitCallExpr(const CallExpr *CE);
273  void VisitUnaryExprOrTypeTraitExpr(const UnaryExprOrTypeTraitExpr *TTE);
274  void VisitSizeOfPackExpr(const SizeOfPackExpr *SOPE);
275  void VisitUnresolvedLookupExpr(const UnresolvedLookupExpr *ULE);
276  void VisitAddrLabelExpr(const AddrLabelExpr *ALE);
277  void VisitCXXTypeidExpr(const CXXTypeidExpr *CTE);
278  void VisitConstantExpr(const ConstantExpr *CE);
279  void VisitInitListExpr(const InitListExpr *ILE);
280  void VisitGenericSelectionExpr(const GenericSelectionExpr *GSE);
281  void VisitCXXUnresolvedConstructExpr(const CXXUnresolvedConstructExpr *UCE);
282  void VisitCXXConstructExpr(const CXXConstructExpr *CE);
283  void VisitExprWithCleanups(const ExprWithCleanups *EWC);
284  void VisitCXXBindTemporaryExpr(const CXXBindTemporaryExpr *BTE);
285  void VisitMaterializeTemporaryExpr(const MaterializeTemporaryExpr *MTE);
286  void VisitCXXDependentScopeMemberExpr(const CXXDependentScopeMemberExpr *ME);
287 
288  void VisitObjCEncodeExpr(const ObjCEncodeExpr *OEE);
289  void VisitObjCMessageExpr(const ObjCMessageExpr *OME);
290  void VisitObjCBoxedExpr(const ObjCBoxedExpr *OBE);
291  void VisitObjCSelectorExpr(const ObjCSelectorExpr *OSE);
292  void VisitObjCProtocolExpr(const ObjCProtocolExpr *OPE);
293  void VisitObjCPropertyRefExpr(const ObjCPropertyRefExpr *OPRE);
294  void VisitObjCSubscriptRefExpr(const ObjCSubscriptRefExpr *OSRE);
295  void VisitObjCIvarRefExpr(const ObjCIvarRefExpr *OIRE);
296  void VisitObjCBoolLiteralExpr(const ObjCBoolLiteralExpr *OBLE);
297 
298  void VisitIntegerLiteral(const IntegerLiteral *IL);
299  void VisitCharacterLiteral(const CharacterLiteral *CL);
300  void VisitFixedPointLiteral(const FixedPointLiteral *FPL);
301  void VisitFloatingLiteral(const FloatingLiteral *FL);
302  void VisitStringLiteral(const StringLiteral *SL);
303  void VisitCXXBoolLiteralExpr(const CXXBoolLiteralExpr *BLE);
304 
305  void VisitIfStmt(const IfStmt *IS);
306  void VisitSwitchStmt(const SwitchStmt *SS);
307  void VisitCaseStmt(const CaseStmt *CS);
308  void VisitLabelStmt(const LabelStmt *LS);
309  void VisitGotoStmt(const GotoStmt *GS);
310  void VisitWhileStmt(const WhileStmt *WS);
311  void VisitObjCAtCatchStmt(const ObjCAtCatchStmt *OACS);
312 
313  void VisitNullTemplateArgument(const TemplateArgument &TA);
314  void VisitTypeTemplateArgument(const TemplateArgument &TA);
315  void VisitDeclarationTemplateArgument(const TemplateArgument &TA);
316  void VisitNullPtrTemplateArgument(const TemplateArgument &TA);
317  void VisitIntegralTemplateArgument(const TemplateArgument &TA);
318  void VisitTemplateTemplateArgument(const TemplateArgument &TA);
319  void VisitTemplateExpansionTemplateArgument(const TemplateArgument &TA);
320  void VisitExpressionTemplateArgument(const TemplateArgument &TA);
321  void VisitPackTemplateArgument(const TemplateArgument &TA);
322 
323  void visitTextComment(const comments::TextComment *C,
324  const comments::FullComment *);
325  void visitInlineCommandComment(const comments::InlineCommandComment *C,
326  const comments::FullComment *);
327  void visitHTMLStartTagComment(const comments::HTMLStartTagComment *C,
328  const comments::FullComment *);
329  void visitHTMLEndTagComment(const comments::HTMLEndTagComment *C,
330  const comments::FullComment *);
331  void visitBlockCommandComment(const comments::BlockCommandComment *C,
332  const comments::FullComment *);
333  void visitParamCommandComment(const comments::ParamCommandComment *C,
334  const comments::FullComment *FC);
335  void visitTParamCommandComment(const comments::TParamCommandComment *C,
336  const comments::FullComment *FC);
337  void visitVerbatimBlockComment(const comments::VerbatimBlockComment *C,
338  const comments::FullComment *);
339  void
340  visitVerbatimBlockLineComment(const comments::VerbatimBlockLineComment *C,
341  const comments::FullComment *);
342  void visitVerbatimLineComment(const comments::VerbatimLineComment *C,
343  const comments::FullComment *);
344 };
345 
346 class JSONDumper : public ASTNodeTraverser<JSONDumper, JSONNodeDumper> {
347  JSONNodeDumper NodeDumper;
348 
349  template <typename SpecializationDecl>
350  void writeTemplateDeclSpecialization(const SpecializationDecl *SD,
351  bool DumpExplicitInst,
352  bool DumpRefOnly) {
353  bool DumpedAny = false;
354  for (const auto *RedeclWithBadType : SD->redecls()) {
355  // FIXME: The redecls() range sometimes has elements of a less-specific
356  // type. (In particular, ClassTemplateSpecializationDecl::redecls() gives
357  // us TagDecls, and should give CXXRecordDecls).
358  const auto *Redecl = dyn_cast<SpecializationDecl>(RedeclWithBadType);
359  if (!Redecl) {
360  // Found the injected-class-name for a class template. This will be
361  // dumped as part of its surrounding class so we don't need to dump it
362  // here.
363  assert(isa<CXXRecordDecl>(RedeclWithBadType) &&
364  "expected an injected-class-name");
365  continue;
366  }
367 
368  switch (Redecl->getTemplateSpecializationKind()) {
371  if (!DumpExplicitInst)
372  break;
373  LLVM_FALLTHROUGH;
374  case TSK_Undeclared:
376  if (DumpRefOnly)
377  NodeDumper.AddChild([=] { NodeDumper.writeBareDeclRef(Redecl); });
378  else
379  Visit(Redecl);
380  DumpedAny = true;
381  break;
383  break;
384  }
385  }
386 
387  // Ensure we dump at least one decl for each specialization.
388  if (!DumpedAny)
389  NodeDumper.AddChild([=] { NodeDumper.writeBareDeclRef(SD); });
390  }
391 
392  template <typename TemplateDecl>
393  void writeTemplateDecl(const TemplateDecl *TD, bool DumpExplicitInst) {
394  // FIXME: it would be nice to dump template parameters and specializations
395  // to their own named arrays rather than shoving them into the "inner"
396  // array. However, template declarations are currently being handled at the
397  // wrong "level" of the traversal hierarchy and so it is difficult to
398  // achieve without losing information elsewhere.
399 
400  dumpTemplateParameters(TD->getTemplateParameters());
401 
402  Visit(TD->getTemplatedDecl());
403 
404  for (const auto *Child : TD->specializations())
405  writeTemplateDeclSpecialization(Child, DumpExplicitInst,
406  !TD->isCanonicalDecl());
407  }
408 
409 public:
410  JSONDumper(raw_ostream &OS, const SourceManager &SrcMgr, ASTContext &Ctx,
411  const PrintingPolicy &PrintPolicy,
412  const comments::CommandTraits *Traits)
413  : NodeDumper(OS, SrcMgr, Ctx, PrintPolicy, Traits) {}
414 
415  JSONNodeDumper &doGetNodeDelegate() { return NodeDumper; }
416 
418  writeTemplateDecl(FTD, true);
419  }
421  writeTemplateDecl(CTD, false);
422  }
424  writeTemplateDecl(VTD, false);
425  }
426 };
427 
428 } // namespace clang
429 
430 #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:5285
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:4043
Represents the dependent type named by a dependently-scoped typename using declaration, e.g.
Definition: Type.h:4210
A (possibly-)qualified type.
Definition: Type.h:654
ConstStmtVisitor - This class implements a simple visitor for Stmt subclasses.
Definition: StmtVisitor.h:193
Stmt - This represents one statement.
Definition: Stmt.h:66
FunctionType - C99 6.7.5.3 - Function Declarators.
Definition: Type.h:3422
IfStmt - This represents an if/then/else.
Definition: Stmt.h:1834
An instance of this object exists for each enum constant that is defined.
Definition: Decl.h:2941
Represents the declaration of a typedef-name via the &#39;typedef&#39; type specifier.
Definition: Decl.h:3173
Decl - This represents one declaration (or definition), e.g.
Definition: DeclBase.h:88
A reference to a name which we were able to look up during parsing but could not resolve to a specifi...
Definition: ExprCXX.h:3037
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:4874
The base class of the type hierarchy.
Definition: Type.h:1450
Declaration of a variable template.
Represents an array type, per C99 6.7.5.2 - Array Declarators.
Definition: Type.h:2889
Represent a C++ namespace.
Definition: Decl.h:497
Represents a call to a C++ constructor.
Definition: ExprCXX.h:1422
ObjCSubscriptRefExpr - used for array and dictionary subscripting.
Definition: ExprObjC.h:845
AccessSpecifier
A C++ access specifier (public, private, protected), plus the special value "none" which means differ...
Definition: Specifiers.h:113
Represents a prvalue temporary that is written into memory so that a reference can bind to it...
Definition: ExprCXX.h:4419
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:138
Describes how types, statements, expressions, and declarations should be printed. ...
Definition: PrettyPrinter.h:47
Represents an expression – generally a full-expression – that introduces cleanups to be run at the ...
Definition: ExprCXX.h:3306
Defines the clang::Expr interface and subclasses for C++ expressions.
LabelStmt - Represents a label, which has a substatement.
Definition: Stmt.h:1732
Represents a struct/union/class.
Definition: Decl.h:3748
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:168
Represents a member of a struct/union/class.
Definition: Decl.h:2729
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:85
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:299
Describes an C or C++ initializer list.
Definition: Expr.h:4403
A C++ typeid expression (C++ [expr.typeid]), which gets the type_info that corresponds to the supplie...
Definition: ExprCXX.h:764
Represents a C++ using-declaration.
Definition: DeclCXX.h:3369
AssociationTy< true > ConstAssociation
Definition: Expr.h:5394
A line of text contained in a verbatim block.
Definition: Comment.h:865
A verbatim line command.
Definition: Comment.h:945
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:4266
A builtin binary operation expression such as "x + y" or "x <= y".
Definition: Expr.h:3434
Any part of the comment.
Definition: Comment.h:52
CaseStmt - Represent a case statement.
Definition: Stmt.h:1500
CastExpr - Base class for type casts, including both implicit casts (ImplicitCastExpr) and explicit c...
Definition: Expr.h:3150
Represents an Objective-C protocol declaration.
Definition: DeclObjC.h:2078
Represents binding an expression to a temporary.
Definition: ExprCXX.h:1373
Represents a C++ member access expression where the actual member referenced could not be resolved be...
Definition: ExprCXX.h:3511
Represents an ObjC class declaration.
Definition: DeclObjC.h:1186
Represents a linkage specification.
Definition: DeclCXX.h:2778
Represents an extended vector type where either the type or size is dependent.
Definition: Type.h:3195
Represents the this expression in C++.
Definition: ExprCXX.h:1097
ObjCPropertyImplDecl - Represents implementation declaration of a property in a class or category imp...
Definition: DeclObjC.h:2773
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:893
Represents the declaration of a typedef-name via a C++11 alias-declaration.
Definition: Decl.h:3193
Represents a prototype with parameter type info, e.g.
Definition: Type.h:3754
UnaryExprOrTypeTraitExpr - expression with either a type or (unevaluated) expression operand...
Definition: Expr.h:2372
ConstantExpr - An expression that occurs in a constant context and optionally the result of evaluatin...
Definition: Expr.h:978
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:883
Represents a block literal declaration, which is like an unnamed FunctionDecl.
Definition: Decl.h:4037
std::string Label
Declaration of a template type parameter.
A command that has zero or more word-like arguments (number of word-like arguments depends on command...
Definition: Comment.h:598
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:4091
NonTypeTemplateParmDecl - Declares a non-type template parameter, e.g., "Size" in.
int Depth
Definition: ASTDiff.cpp:190
A unary type transform, which is a type constructed from another.
Definition: Type.h:4413
An expression that sends a message to the given Objective-C object or class.
Definition: ExprObjC.h:950
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:2046
Represents a GCC generic vector type.
Definition: Type.h:3235
An opening HTML tag with attributes.
Definition: Comment.h:415
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:181
const SourceManager & SM
Definition: Format.cpp:1685
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:5894
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:2100
ObjCCategoryDecl - Represents a category declaration.
Definition: DeclObjC.h:2294
This is a basic class for representing single OpenMP clause.
Definition: OpenMPClause.h:51
ObjCProtocolExpr used for protocol expression in Objective-C.
Definition: ExprObjC.h:503
ASTNodeTraverser traverses the Clang AST for dumping purposes.
Represents one property declaration in an Objective-C interface.
Definition: DeclObjC.h:741
ImplicitCastExpr - Allows us to explicitly represent implicit type conversions, which have no direct ...
Definition: Expr.h:3274
This template specialization was instantiated from a template due to an explicit instantiation defini...
Definition: Specifiers.h:193
This template specialization was formed from a template-id but has not yet been declared, defined, or instantiated.
Definition: Specifiers.h:178
A closing HTML tag.
Definition: Comment.h:509
ObjCBoxedExpr - used for generalized expression boxing.
Definition: ExprObjC.h:124
NodeStreamer(raw_ostream &OS)
Doxygen \tparam command, describes a template parameter.
Definition: Comment.h:801
The injected class name of a C++ class template or class template partial specialization.
Definition: Type.h:5133
Represents a pack expansion of types.
Definition: Type.h:5511
CompoundAssignOperator - For compound assignments (e.g.
Definition: Expr.h:3654
Represents a C11 generic selection.
Definition: Expr.h:5234
AddrLabelExpr - The GNU address of label extension, representing &&label.
Definition: Expr.h:3910
ast_type_traits::DynTypedNode Node
Represents a template argument.
Definition: TemplateBase.h:50
Dataflow Directional Tag Classes.
[C99 6.4.2.2] - A predefined identifier such as func.
Definition: Expr.h:1903
Represents a delete expression for memory deallocation and destructor calls, e.g. ...
Definition: ExprCXX.h:2359
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:189
Represents the declaration of an Objective-C type parameter.
Definition: DeclObjC.h:571
Represents an enum.
Definition: Decl.h:3481
A pointer to member type per C++ 8.3.3 - Pointers to members.
Definition: Type.h:2833
SwitchStmt - This represents a &#39;switch&#39; stmt.
Definition: Stmt.h:2043
ObjCImplementationDecl - Represents a class definition - this is where method definitions are specifi...
Definition: DeclObjC.h:2566
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:2155
This template specialization was declared or defined by an explicit specialization (C++ [temp...
Definition: Specifiers.h:185
ObjCEncodeExpr, used for @encode in Objective-C.
Definition: ExprObjC.h:407
Base for LValueReferenceType and RValueReferenceType.
Definition: Type.h:2750
Represents a base class of a C++ class.
Definition: DeclCXX.h:145
ObjCIvarRefExpr - A reference to an ObjC instance variable.
Definition: ExprObjC.h:546
void VisitVarTemplateDecl(const VarTemplateDecl *VTD)
Describes an explicit type conversion that uses functional notion but could not be resolved because o...
Definition: ExprCXX.h:3390
GotoStmt - This represents a direct goto.
Definition: Stmt.h:2481
llvm::json::OStream JOS
MemberExpr - [C99 6.5.2.3] Structure and Union Members.
Definition: Expr.h:2836
Represents a C++ struct/union/class.
Definition: DeclCXX.h:253
ObjCIvarDecl - Represents an ObjC instance variable.
Definition: DeclObjC.h:1959
WhileStmt - This represents a &#39;while&#39; stmt.
Definition: Stmt.h:2226
Declaration of a class template.
StringLiteral - This represents a string literal expression, e.g.
Definition: Expr.h:1711
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
Definition: Expr.h:2546
ObjCBoolLiteralExpr - Objective-C Boolean Literal.
Definition: ExprObjC.h:85
A reference to a declared variable, function, enum, etc.
Definition: Expr.h:1171
Represents a type template specialization; the template must be a class template, a type alias templa...
Definition: Type.h:4996
Doxygen \param command.
Definition: Comment.h:713
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:645
Represents a C++ namespace alias.
Definition: DeclCXX.h:2967
void AddChild(Fn DoAddChild)
Add a child of the current node. Calls DoAddChild without arguments.
Represents C++ using-directive.
Definition: DeclCXX.h:2863
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:2513
Represents the canonical version of C arrays with a specified constant size.
Definition: Type.h:2935
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:45
Represents a shadow declaration introduced into a scope by a (resolved) using declaration.
Definition: DeclCXX.h:3162
A full comment attached to a declaration, contains block content.
Definition: Comment.h:1093
ObjCCompatibleAliasDecl - Represents alias of a class.
Definition: DeclObjC.h:2743