clang  10.0.0svn
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 //===----------------------------------------------------------------------===//
18 #include "clang/AST/ASTContext.h"
21 #include "clang/AST/AttrVisitor.h"
24 #include "clang/AST/ExprCXX.h"
25 #include "llvm/Support/JSON.h"
27 namespace clang {
29 class NodeStreamer {
30  bool FirstChild = true;
31  bool TopLevel = true;
34 protected:
35  llvm::json::OStream JOS;
37 public:
38  /// Add a child of the current node. Calls DoAddChild without arguments
39  template <typename Fn> void AddChild(Fn DoAddChild) {
40  return AddChild("", DoAddChild);
41  }
43  /// Add a child of the current node with an optional label.
44  /// Calls DoAddChild without arguments.
45  template <typename Fn> void AddChild(StringRef Label, Fn DoAddChild) {
46  // If we're at the top level, there's nothing interesting to do; just
47  // run the dumper.
48  if (TopLevel) {
49  TopLevel = false;
50  JOS.objectBegin();
52  DoAddChild();
54  while (!Pending.empty()) {
55  Pending.back()(true);
56  Pending.pop_back();
57  }
59  JOS.objectEnd();
60  TopLevel = true;
61  return;
62  }
64  // We need to capture an owning-string in the lambda because the lambda
65  // is invoked in a deferred manner.
66  std::string LabelStr = !Label.empty() ? Label : "inner";
67  bool WasFirstChild = FirstChild;
68  auto DumpWithIndent = [=](bool IsLastChild) {
69  if (WasFirstChild) {
70  JOS.attributeBegin(LabelStr);
71  JOS.arrayBegin();
72  }
74  FirstChild = true;
75  unsigned Depth = Pending.size();
76  JOS.objectBegin();
78  DoAddChild();
80  // If any children are left, they're the last at their nesting level.
81  // Dump those ones out now.
82  while (Depth < Pending.size()) {
83  Pending.back()(true);
84  this->Pending.pop_back();
85  }
87  JOS.objectEnd();
89  if (IsLastChild) {
90  JOS.arrayEnd();
91  JOS.attributeEnd();
92  }
93  };
95  if (FirstChild) {
96  Pending.push_back(std::move(DumpWithIndent));
97  } else {
98  Pending.back()(false);
99  Pending.back() = std::move(DumpWithIndent);
100  }
101  FirstChild = false;
102  }
104  NodeStreamer(raw_ostream &OS) : JOS(OS, 2) {}
105 };
107 // Dumps AST nodes in JSON format. There is no implied stability for the
108 // content or format of the dump between major releases of Clang, other than it
109 // being valid JSON output. Further, there is no requirement that the
110 // information dumped is a complete representation of the AST, only that the
111 // information presented is correct.
113  : public ConstAttrVisitor<JSONNodeDumper>,
114  public comments::ConstCommentVisitor<JSONNodeDumper, void,
115  const comments::FullComment *>,
116  public ConstTemplateArgumentVisitor<JSONNodeDumper>,
117  public ConstStmtVisitor<JSONNodeDumper>,
118  public TypeVisitor<JSONNodeDumper>,
119  public ConstDeclVisitor<JSONNodeDumper>,
120  public NodeStreamer {
121  friend class JSONDumper;
123  const SourceManager &SM;
124  ASTContext& Ctx;
125  PrintingPolicy PrintPolicy;
126  const comments::CommandTraits *Traits;
127  StringRef LastLocFilename;
128  unsigned LastLocLine, LastLocPresumedLine;
131  using InnerCommentVisitor =
133  const comments::FullComment *>;
139  void attributeOnlyIfTrue(StringRef Key, bool Value) {
140  if (Value)
141  JOS.attribute(Key, Value);
142  }
144  // Writes the attributes of a SourceLocation object without.
145  void writeBareSourceLocation(SourceLocation Loc, bool IsSpelling);
147  // Writes the attributes of a SourceLocation to JSON based on its presumed
148  // spelling location. If the given location represents a macro invocation,
149  // this outputs two sub-objects: one for the spelling and one for the
150  // expansion location.
151  void writeSourceLocation(SourceLocation Loc);
152  void writeSourceRange(SourceRange R);
153  std::string createPointerRepresentation(const void *Ptr);
154  llvm::json::Object createQualType(QualType QT, bool Desugar = true);
155  llvm::json::Object createBareDeclRef(const Decl *D);
156  void writeBareDeclRef(const Decl *D);
157  llvm::json::Object createCXXRecordDefinitionData(const CXXRecordDecl *RD);
158  llvm::json::Object createCXXBaseSpecifier(const CXXBaseSpecifier &BS);
159  std::string createAccessSpecifier(AccessSpecifier AS);
160  llvm::json::Array createCastPath(const CastExpr *C);
162  void writePreviousDeclImpl(...) {}
164  template <typename T> void writePreviousDeclImpl(const Mergeable<T> *D) {
165  const T *First = D->getFirstDecl();
166  if (First != D)
167  JOS.attribute("firstRedecl", createPointerRepresentation(First));
168  }
170  template <typename T> void writePreviousDeclImpl(const Redeclarable<T> *D) {
171  const T *Prev = D->getPreviousDecl();
172  if (Prev)
173  JOS.attribute("previousDecl", createPointerRepresentation(Prev));
174  }
175  void addPreviousDeclaration(const Decl *D);
177  StringRef getCommentCommandName(unsigned CommandID) const;
179 public:
180  JSONNodeDumper(raw_ostream &OS, const SourceManager &SrcMgr, ASTContext &Ctx,
181  const PrintingPolicy &PrintPolicy,
182  const comments::CommandTraits *Traits)
183  : NodeStreamer(OS), SM(SrcMgr), Ctx(Ctx), PrintPolicy(PrintPolicy),
184  Traits(Traits), LastLocLine(0), LastLocPresumedLine(0) {}
186  void Visit(const Attr *A);
187  void Visit(const Stmt *Node);
188  void Visit(const Type *T);
189  void Visit(QualType T);
190  void Visit(const Decl *D);
192  void Visit(const comments::Comment *C, const comments::FullComment *FC);
193  void Visit(const TemplateArgument &TA, SourceRange R = {},
194  const Decl *From = nullptr, StringRef Label = {});
195  void Visit(const CXXCtorInitializer *Init);
196  void Visit(const OMPClause *C);
197  void Visit(const BlockDecl::Capture &C);
198  void Visit(const GenericSelectionExpr::ConstAssociation &A);
200  void VisitTypedefType(const TypedefType *TT);
201  void VisitFunctionType(const FunctionType *T);
202  void VisitFunctionProtoType(const FunctionProtoType *T);
203  void VisitRValueReferenceType(const ReferenceType *RT);
204  void VisitArrayType(const ArrayType *AT);
205  void VisitConstantArrayType(const ConstantArrayType *CAT);
206  void VisitDependentSizedExtVectorType(const DependentSizedExtVectorType *VT);
207  void VisitVectorType(const VectorType *VT);
208  void VisitUnresolvedUsingType(const UnresolvedUsingType *UUT);
209  void VisitUnaryTransformType(const UnaryTransformType *UTT);
210  void VisitTagType(const TagType *TT);
211  void VisitTemplateTypeParmType(const TemplateTypeParmType *TTPT);
212  void VisitAutoType(const AutoType *AT);
213  void VisitTemplateSpecializationType(const TemplateSpecializationType *TST);
214  void VisitInjectedClassNameType(const InjectedClassNameType *ICNT);
215  void VisitObjCInterfaceType(const ObjCInterfaceType *OIT);
216  void VisitPackExpansionType(const PackExpansionType *PET);
217  void VisitElaboratedType(const ElaboratedType *ET);
218  void VisitMacroQualifiedType(const MacroQualifiedType *MQT);
219  void VisitMemberPointerType(const MemberPointerType *MPT);
221  void VisitNamedDecl(const NamedDecl *ND);
222  void VisitTypedefDecl(const TypedefDecl *TD);
223  void VisitTypeAliasDecl(const TypeAliasDecl *TAD);
224  void VisitNamespaceDecl(const NamespaceDecl *ND);
225  void VisitUsingDirectiveDecl(const UsingDirectiveDecl *UDD);
226  void VisitNamespaceAliasDecl(const NamespaceAliasDecl *NAD);
227  void VisitUsingDecl(const UsingDecl *UD);
228  void VisitUsingShadowDecl(const UsingShadowDecl *USD);
229  void VisitVarDecl(const VarDecl *VD);
230  void VisitFieldDecl(const FieldDecl *FD);
231  void VisitFunctionDecl(const FunctionDecl *FD);
232  void VisitEnumDecl(const EnumDecl *ED);
233  void VisitEnumConstantDecl(const EnumConstantDecl *ECD);
234  void VisitRecordDecl(const RecordDecl *RD);
235  void VisitCXXRecordDecl(const CXXRecordDecl *RD);
236  void VisitTemplateTypeParmDecl(const TemplateTypeParmDecl *D);
237  void VisitNonTypeTemplateParmDecl(const NonTypeTemplateParmDecl *D);
238  void VisitTemplateTemplateParmDecl(const TemplateTemplateParmDecl *D);
239  void VisitLinkageSpecDecl(const LinkageSpecDecl *LSD);
240  void VisitAccessSpecDecl(const AccessSpecDecl *ASD);
241  void VisitFriendDecl(const FriendDecl *FD);
243  void VisitObjCIvarDecl(const ObjCIvarDecl *D);
244  void VisitObjCMethodDecl(const ObjCMethodDecl *D);
245  void VisitObjCTypeParamDecl(const ObjCTypeParamDecl *D);
246  void VisitObjCCategoryDecl(const ObjCCategoryDecl *D);
247  void VisitObjCCategoryImplDecl(const ObjCCategoryImplDecl *D);
248  void VisitObjCProtocolDecl(const ObjCProtocolDecl *D);
249  void VisitObjCInterfaceDecl(const ObjCInterfaceDecl *D);
250  void VisitObjCImplementationDecl(const ObjCImplementationDecl *D);
251  void VisitObjCCompatibleAliasDecl(const ObjCCompatibleAliasDecl *D);
252  void VisitObjCPropertyDecl(const ObjCPropertyDecl *D);
253  void VisitObjCPropertyImplDecl(const ObjCPropertyImplDecl *D);
254  void VisitBlockDecl(const BlockDecl *D);
256  void VisitDeclRefExpr(const DeclRefExpr *DRE);
257  void VisitPredefinedExpr(const PredefinedExpr *PE);
258  void VisitUnaryOperator(const UnaryOperator *UO);
259  void VisitBinaryOperator(const BinaryOperator *BO);
260  void VisitCompoundAssignOperator(const CompoundAssignOperator *CAO);
261  void VisitMemberExpr(const MemberExpr *ME);
262  void VisitCXXNewExpr(const CXXNewExpr *NE);
263  void VisitCXXDeleteExpr(const CXXDeleteExpr *DE);
264  void VisitCXXThisExpr(const CXXThisExpr *TE);
265  void VisitCastExpr(const CastExpr *CE);
266  void VisitImplicitCastExpr(const ImplicitCastExpr *ICE);
267  void VisitCallExpr(const CallExpr *CE);
268  void VisitUnaryExprOrTypeTraitExpr(const UnaryExprOrTypeTraitExpr *TTE);
269  void VisitSizeOfPackExpr(const SizeOfPackExpr *SOPE);
270  void VisitUnresolvedLookupExpr(const UnresolvedLookupExpr *ULE);
271  void VisitAddrLabelExpr(const AddrLabelExpr *ALE);
272  void VisitCXXTypeidExpr(const CXXTypeidExpr *CTE);
273  void VisitConstantExpr(const ConstantExpr *CE);
274  void VisitInitListExpr(const InitListExpr *ILE);
275  void VisitGenericSelectionExpr(const GenericSelectionExpr *GSE);
276  void VisitCXXUnresolvedConstructExpr(const CXXUnresolvedConstructExpr *UCE);
277  void VisitCXXConstructExpr(const CXXConstructExpr *CE);
278  void VisitExprWithCleanups(const ExprWithCleanups *EWC);
279  void VisitCXXBindTemporaryExpr(const CXXBindTemporaryExpr *BTE);
280  void VisitMaterializeTemporaryExpr(const MaterializeTemporaryExpr *MTE);
281  void VisitCXXDependentScopeMemberExpr(const CXXDependentScopeMemberExpr *ME);
283  void VisitObjCEncodeExpr(const ObjCEncodeExpr *OEE);
284  void VisitObjCMessageExpr(const ObjCMessageExpr *OME);
285  void VisitObjCBoxedExpr(const ObjCBoxedExpr *OBE);
286  void VisitObjCSelectorExpr(const ObjCSelectorExpr *OSE);
287  void VisitObjCProtocolExpr(const ObjCProtocolExpr *OPE);
288  void VisitObjCPropertyRefExpr(const ObjCPropertyRefExpr *OPRE);
289  void VisitObjCSubscriptRefExpr(const ObjCSubscriptRefExpr *OSRE);
290  void VisitObjCIvarRefExpr(const ObjCIvarRefExpr *OIRE);
291  void VisitObjCBoolLiteralExpr(const ObjCBoolLiteralExpr *OBLE);
293  void VisitIntegerLiteral(const IntegerLiteral *IL);
294  void VisitCharacterLiteral(const CharacterLiteral *CL);
295  void VisitFixedPointLiteral(const FixedPointLiteral *FPL);
296  void VisitFloatingLiteral(const FloatingLiteral *FL);
297  void VisitStringLiteral(const StringLiteral *SL);
298  void VisitCXXBoolLiteralExpr(const CXXBoolLiteralExpr *BLE);
300  void VisitIfStmt(const IfStmt *IS);
301  void VisitSwitchStmt(const SwitchStmt *SS);
302  void VisitCaseStmt(const CaseStmt *CS);
303  void VisitLabelStmt(const LabelStmt *LS);
304  void VisitGotoStmt(const GotoStmt *GS);
305  void VisitWhileStmt(const WhileStmt *WS);
306  void VisitObjCAtCatchStmt(const ObjCAtCatchStmt *OACS);
308  void VisitNullTemplateArgument(const TemplateArgument &TA);
309  void VisitTypeTemplateArgument(const TemplateArgument &TA);
310  void VisitDeclarationTemplateArgument(const TemplateArgument &TA);
311  void VisitNullPtrTemplateArgument(const TemplateArgument &TA);
312  void VisitIntegralTemplateArgument(const TemplateArgument &TA);
313  void VisitTemplateTemplateArgument(const TemplateArgument &TA);
314  void VisitTemplateExpansionTemplateArgument(const TemplateArgument &TA);
315  void VisitExpressionTemplateArgument(const TemplateArgument &TA);
316  void VisitPackTemplateArgument(const TemplateArgument &TA);
318  void visitTextComment(const comments::TextComment *C,
319  const comments::FullComment *);
320  void visitInlineCommandComment(const comments::InlineCommandComment *C,
321  const comments::FullComment *);
322  void visitHTMLStartTagComment(const comments::HTMLStartTagComment *C,
323  const comments::FullComment *);
324  void visitHTMLEndTagComment(const comments::HTMLEndTagComment *C,
325  const comments::FullComment *);
326  void visitBlockCommandComment(const comments::BlockCommandComment *C,
327  const comments::FullComment *);
328  void visitParamCommandComment(const comments::ParamCommandComment *C,
329  const comments::FullComment *FC);
330  void visitTParamCommandComment(const comments::TParamCommandComment *C,
331  const comments::FullComment *FC);
332  void visitVerbatimBlockComment(const comments::VerbatimBlockComment *C,
333  const comments::FullComment *);
334  void
335  visitVerbatimBlockLineComment(const comments::VerbatimBlockLineComment *C,
336  const comments::FullComment *);
337  void visitVerbatimLineComment(const comments::VerbatimLineComment *C,
338  const comments::FullComment *);
339 };
341 class JSONDumper : public ASTNodeTraverser<JSONDumper, JSONNodeDumper> {
342  JSONNodeDumper NodeDumper;
344  template <typename SpecializationDecl>
345  void writeTemplateDeclSpecialization(const SpecializationDecl *SD,
346  bool DumpExplicitInst,
347  bool DumpRefOnly) {
348  bool DumpedAny = false;
349  for (const auto *RedeclWithBadType : SD->redecls()) {
350  // FIXME: The redecls() range sometimes has elements of a less-specific
351  // type. (In particular, ClassTemplateSpecializationDecl::redecls() gives
352  // us TagDecls, and should give CXXRecordDecls).
353  const auto *Redecl = dyn_cast<SpecializationDecl>(RedeclWithBadType);
354  if (!Redecl) {
355  // Found the injected-class-name for a class template. This will be
356  // dumped as part of its surrounding class so we don't need to dump it
357  // here.
358  assert(isa<CXXRecordDecl>(RedeclWithBadType) &&
359  "expected an injected-class-name");
360  continue;
361  }
363  switch (Redecl->getTemplateSpecializationKind()) {
366  if (!DumpExplicitInst)
367  break;
369  case TSK_Undeclared:
371  if (DumpRefOnly)
372  NodeDumper.AddChild([=] { NodeDumper.writeBareDeclRef(Redecl); });
373  else
374  Visit(Redecl);
375  DumpedAny = true;
376  break;
378  break;
379  }
380  }
382  // Ensure we dump at least one decl for each specialization.
383  if (!DumpedAny)
384  NodeDumper.AddChild([=] { NodeDumper.writeBareDeclRef(SD); });
385  }
387  template <typename TemplateDecl>
388  void writeTemplateDecl(const TemplateDecl *TD, bool DumpExplicitInst) {
389  // FIXME: it would be nice to dump template parameters and specializations
390  // to their own named arrays rather than shoving them into the "inner"
391  // array. However, template declarations are currently being handled at the
392  // wrong "level" of the traversal hierarchy and so it is difficult to
393  // achieve without losing information elsewhere.
395  dumpTemplateParameters(TD->getTemplateParameters());
397  Visit(TD->getTemplatedDecl());
399  for (const auto *Child : TD->specializations())
400  writeTemplateDeclSpecialization(Child, DumpExplicitInst,
401  !TD->isCanonicalDecl());
402  }
404 public:
405  JSONDumper(raw_ostream &OS, const SourceManager &SrcMgr, ASTContext &Ctx,
406  const PrintingPolicy &PrintPolicy,
407  const comments::CommandTraits *Traits)
408  : NodeDumper(OS, SrcMgr, Ctx, PrintPolicy, Traits) {}
410  JSONNodeDumper &doGetNodeDelegate() { return NodeDumper; }
413  writeTemplateDecl(FTD, true);
414  }
416  writeTemplateDecl(CTD, false);
417  }
419  writeTemplateDecl(VTD, false);
420  }
421 };
423 } // namespace clang
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:5199
Represents a function declaration or definition.
Definition: Decl.h:1748
A class which contains all the information about a particular captured value.
Definition: Decl.h:3921
Represents the dependent type named by a dependently-scoped typename using declaration, e.g.
Definition: Type.h:4154
A (possibly-)qualified type.
Definition: Type.h:643
ConstStmtVisitor - This class implements a simple visitor for Stmt subclasses.
Definition: StmtVisitor.h:192
Stmt - This represents one statement.
Definition: Stmt.h:66
FunctionType - C99 - Function Declarators.
Definition: Type.h:3387
IfStmt - This represents an if/then/else.
Definition: Stmt.h:1812
An instance of this object exists for each enum constant that is defined.
Definition: Decl.h:2819
Represents the declaration of a typedef-name via the &#39;typedef&#39; type specifier.
Definition: Decl.h:3051
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:2938
NamedDecl * getTemplatedDecl() const
Get the underlying, templated declaration.
Definition: DeclTemplate.h:457
Represents a C++11 auto or C++14 decltype(auto) type.
Definition: Type.h:4817
The base class of the type hierarchy.
Definition: Type.h:1433
Declaration of a variable template.
Represents an array type, per C99 - Array Declarators.
Definition: Type.h:2844
Represent a C++ namespace.
Definition: Decl.h:514
Represents a call to a C++ constructor.
Definition: ExprCXX.h:1326
ObjCSubscriptRefExpr - used for array and dictionary subscripting.
Definition: ExprObjC.h:845
A C++ access specifier (public, private, protected), plus the special value "none" which means differ...
Definition: Specifiers.h:112
Represents a prvalue temporary that is written into memory so that a reference can bind to it...
Definition: ExprCXX.h:4320
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:812
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:37
Represents an expression – generally a full-expression – that introduces cleanups to be run at the ...
Definition: ExprCXX.h:3207
Defines the clang::Expr interface and subclasses for C++ expressions.
LabelStmt - Represents a label, which has a substatement.
Definition: Stmt.h:1710
Represents a struct/union/class.
Definition: Decl.h:3626
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:154
Represents a member of a struct/union/class.
Definition: Decl.h:2607
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:132
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:298
Describes an C or C++ initializer list.
Definition: Expr.h:4371
A C++ typeid expression (C++ [expr.typeid]), which gets the type_info that corresponds to the supplie...
Definition: ExprCXX.h:668
Represents a C++ using-declaration.
Definition: DeclCXX.h:3480
AssociationTy< true > ConstAssociation
Definition: Expr.h:5356
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:4210
A builtin binary operation expression such as "x + y" or "x <= y".
Definition: Expr.h:3405
Any part of the comment.
Definition: Comment.h:52
CaseStmt - Represent a case statement.
Definition: Stmt.h:1478
CastExpr - Base class for type casts, including both implicit casts (ImplicitCastExpr) and explicit c...
Definition: Expr.h:3121
Represents an Objective-C protocol declaration.
Definition: DeclObjC.h:2063
Represents binding an expression to a temporary.
Definition: ExprCXX.h:1277
Represents a C++ member access expression where the actual member referenced could not be resolved be...
Definition: ExprCXX.h:3412
Represents an ObjC class declaration.
Definition: DeclObjC.h:1171
Represents a linkage specification.
Definition: DeclCXX.h:2954
Represents an extended vector type where either the type or size is dependent.
Definition: Type.h:3160
Represents the this expression in C++.
Definition: ExprCXX.h:1001
ObjCPropertyImplDecl - Represents implementation declaration of a property in a class or category imp...
Definition: DeclObjC.h:2758
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:3071
Represents a prototype with parameter type info, e.g.
Definition: Type.h:3719
UnaryExprOrTypeTraitExpr - expression with either a type or (unevaluated) expression operand...
Definition: Expr.h:2342
ConstantExpr - An expression that occurs in a constant context and optionally the result of evaluatin...
Definition: Expr.h:948
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
Definition: DeclTemplate.h:436
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:3915
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: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:3992
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:4357
An expression that sends a message to the given Objective-C object or class.
Definition: ExprObjC.h:950
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:2016
Represents a GCC generic vector type.
Definition: Type.h:3200
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:180
const SourceManager & SM
Definition: Format.cpp:1572
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:5808
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:2000
ObjCCategoryDecl - Represents a category declaration.
Definition: DeclObjC.h:2279
This is a basic class for representing single OpenMP clause.
Definition: OpenMPClause.h:50
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:728
ImplicitCastExpr - Allows us to explicitly represent implicit type conversions, which have no direct ...
Definition: Expr.h:3245
This template specialization was instantiated from a template due to an explicit instantiation defini...
Definition: Specifiers.h:192
This template specialization was formed from a template-id but has not yet been declared, defined, or instantiated.
Definition: Specifiers.h:177
A closing HTML tag.
Definition: Comment.h:507
ObjCBoxedExpr - used for generalized expression boxing.
Definition: ExprObjC.h:124
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:5048
Represents a pack expansion of types.
Definition: Type.h:5425
CompoundAssignOperator - For compound assignments (e.g.
Definition: Expr.h:3625
Represents a C11 generic selection.
Definition: Expr.h:5196
AddrLabelExpr - The GNU address of label extension, representing &&label.
Definition: Expr.h:3878
ast_type_traits::DynTypedNode Node
Represents a template argument.
Definition: TemplateBase.h:50
Dataflow Directional Tag Classes.
[C99] - A predefined identifier such as func.
Definition: Expr.h:1873
Represents a delete expression for memory deallocation and destructor calls, e.g. ...
Definition: ExprCXX.h:2260
The base class of all kinds of template declarations (e.g., class, function, etc.).
Definition: DeclTemplate.h:403
This template specialization was instantiated from a template due to an explicit instantiation declar...
Definition: Specifiers.h:188
Represents the declaration of an Objective-C type parameter.
Definition: DeclObjC.h:558
Represents an enum.
Definition: Decl.h:3359
A pointer to member type per C++ 8.3.3 - Pointers to members.
Definition: Type.h:2788
SwitchStmt - This represents a &#39;switch&#39; stmt.
Definition: Stmt.h:2017
ObjCImplementationDecl - Represents a class definition - this is where method definitions are specifi...
Definition: DeclObjC.h:2551
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:2338
This template specialization was declared or defined by an explicit specialization (C++ [temp...
Definition: Specifiers.h:184
ObjCEncodeExpr, used for @encode in Objective-C.
Definition: ExprObjC.h:407
Base for LValueReferenceType and RValueReferenceType.
Definition: Type.h:2705
Represents a base class of a C++ class.
Definition: DeclCXX.h:192
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:3291
GotoStmt - This represents a direct goto.
Definition: Stmt.h:2455
llvm::json::OStream JOS
MemberExpr - [C99] Structure and Union Members.
Definition: Expr.h:2807
Represents a C++ struct/union/class.
Definition: DeclCXX.h:300
ObjCIvarDecl - Represents an ObjC instance variable.
Definition: DeclObjC.h:1944
WhileStmt - This represents a &#39;while&#39; stmt.
Definition: Stmt.h:2200
Declaration of a class template.
StringLiteral - This represents a string literal expression, e.g.
Definition: Expr.h:1681
CallExpr - Represents a function call (C99, C++ []).
Definition: Expr.h:2516
ObjCBoolLiteralExpr - Objective-C Boolean Literal.
Definition: ExprObjC.h:85
A reference to a declared variable, function, enum, etc.
Definition: Expr.h:1141
Represents a type template specialization; the template must be a class template, a type alias templa...
Definition: Type.h:4911
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:248
A boolean literal, per ([C++ lex.bool] Boolean literals).
Definition: ExprCXX.h:549
Represents a C++ namespace alias.
Definition: DeclCXX.h:3148
void AddChild(Fn DoAddChild)
Add a child of the current node. Calls DoAddChild without arguments.
Represents C++ using-directive.
Definition: DeclCXX.h:3044
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:2498
Represents the canonical version of C arrays with a specified constant size.
Definition: Type.h:2904
This class handles loading and caching of source files into memory.
Declaration of a template function.
Attr - This represents one attribute.
Definition: Attr.h:43
Represents a shadow declaration introduced into a scope by a (resolved) using declaration.
Definition: DeclCXX.h:3267
A full comment attached to a declaration, contains block content.
Definition: Comment.h:1091
ObjCCompatibleAliasDecl - Represents alias of a class.
Definition: DeclObjC.h:2728