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  void writeIncludeStack(PresumedLoc Loc, bool JustFirst = false);
146  // Writes the attributes of a SourceLocation object without.
147  void writeBareSourceLocation(SourceLocation Loc, bool IsSpelling);
149  // Writes the attributes of a SourceLocation to JSON based on its presumed
150  // spelling location. If the given location represents a macro invocation,
151  // this outputs two sub-objects: one for the spelling and one for the
152  // expansion location.
153  void writeSourceLocation(SourceLocation Loc);
154  void writeSourceRange(SourceRange R);
155  std::string createPointerRepresentation(const void *Ptr);
156  llvm::json::Object createQualType(QualType QT, bool Desugar = true);
157  llvm::json::Object createBareDeclRef(const Decl *D);
158  void writeBareDeclRef(const Decl *D);
159  llvm::json::Object createCXXRecordDefinitionData(const CXXRecordDecl *RD);
160  llvm::json::Object createCXXBaseSpecifier(const CXXBaseSpecifier &BS);
161  std::string createAccessSpecifier(AccessSpecifier AS);
162  llvm::json::Array createCastPath(const CastExpr *C);
164  void writePreviousDeclImpl(...) {}
166  template <typename T> void writePreviousDeclImpl(const Mergeable<T> *D) {
167  const T *First = D->getFirstDecl();
168  if (First != D)
169  JOS.attribute("firstRedecl", createPointerRepresentation(First));
170  }
172  template <typename T> void writePreviousDeclImpl(const Redeclarable<T> *D) {
173  const T *Prev = D->getPreviousDecl();
174  if (Prev)
175  JOS.attribute("previousDecl", createPointerRepresentation(Prev));
176  }
177  void addPreviousDeclaration(const Decl *D);
179  StringRef getCommentCommandName(unsigned CommandID) const;
181 public:
182  JSONNodeDumper(raw_ostream &OS, const SourceManager &SrcMgr, ASTContext &Ctx,
183  const PrintingPolicy &PrintPolicy,
184  const comments::CommandTraits *Traits)
185  : NodeStreamer(OS), SM(SrcMgr), Ctx(Ctx), PrintPolicy(PrintPolicy),
186  Traits(Traits), LastLocLine(0), LastLocPresumedLine(0) {}
188  void Visit(const Attr *A);
189  void Visit(const Stmt *Node);
190  void Visit(const Type *T);
191  void Visit(QualType T);
192  void Visit(const Decl *D);
194  void Visit(const comments::Comment *C, const comments::FullComment *FC);
195  void Visit(const TemplateArgument &TA, SourceRange R = {},
196  const Decl *From = nullptr, StringRef Label = {});
197  void Visit(const CXXCtorInitializer *Init);
198  void Visit(const OMPClause *C);
199  void Visit(const BlockDecl::Capture &C);
200  void Visit(const GenericSelectionExpr::ConstAssociation &A);
202  void VisitTypedefType(const TypedefType *TT);
203  void VisitFunctionType(const FunctionType *T);
204  void VisitFunctionProtoType(const FunctionProtoType *T);
205  void VisitRValueReferenceType(const ReferenceType *RT);
206  void VisitArrayType(const ArrayType *AT);
207  void VisitConstantArrayType(const ConstantArrayType *CAT);
208  void VisitDependentSizedExtVectorType(const DependentSizedExtVectorType *VT);
209  void VisitVectorType(const VectorType *VT);
210  void VisitUnresolvedUsingType(const UnresolvedUsingType *UUT);
211  void VisitUnaryTransformType(const UnaryTransformType *UTT);
212  void VisitTagType(const TagType *TT);
213  void VisitTemplateTypeParmType(const TemplateTypeParmType *TTPT);
214  void VisitAutoType(const AutoType *AT);
215  void VisitTemplateSpecializationType(const TemplateSpecializationType *TST);
216  void VisitInjectedClassNameType(const InjectedClassNameType *ICNT);
217  void VisitObjCInterfaceType(const ObjCInterfaceType *OIT);
218  void VisitPackExpansionType(const PackExpansionType *PET);
219  void VisitElaboratedType(const ElaboratedType *ET);
220  void VisitMacroQualifiedType(const MacroQualifiedType *MQT);
221  void VisitMemberPointerType(const MemberPointerType *MPT);
223  void VisitNamedDecl(const NamedDecl *ND);
224  void VisitTypedefDecl(const TypedefDecl *TD);
225  void VisitTypeAliasDecl(const TypeAliasDecl *TAD);
226  void VisitNamespaceDecl(const NamespaceDecl *ND);
227  void VisitUsingDirectiveDecl(const UsingDirectiveDecl *UDD);
228  void VisitNamespaceAliasDecl(const NamespaceAliasDecl *NAD);
229  void VisitUsingDecl(const UsingDecl *UD);
230  void VisitUsingShadowDecl(const UsingShadowDecl *USD);
231  void VisitVarDecl(const VarDecl *VD);
232  void VisitFieldDecl(const FieldDecl *FD);
233  void VisitFunctionDecl(const FunctionDecl *FD);
234  void VisitEnumDecl(const EnumDecl *ED);
235  void VisitEnumConstantDecl(const EnumConstantDecl *ECD);
236  void VisitRecordDecl(const RecordDecl *RD);
237  void VisitCXXRecordDecl(const CXXRecordDecl *RD);
238  void VisitTemplateTypeParmDecl(const TemplateTypeParmDecl *D);
239  void VisitNonTypeTemplateParmDecl(const NonTypeTemplateParmDecl *D);
240  void VisitTemplateTemplateParmDecl(const TemplateTemplateParmDecl *D);
241  void VisitLinkageSpecDecl(const LinkageSpecDecl *LSD);
242  void VisitAccessSpecDecl(const AccessSpecDecl *ASD);
243  void VisitFriendDecl(const FriendDecl *FD);
245  void VisitObjCIvarDecl(const ObjCIvarDecl *D);
246  void VisitObjCMethodDecl(const ObjCMethodDecl *D);
247  void VisitObjCTypeParamDecl(const ObjCTypeParamDecl *D);
248  void VisitObjCCategoryDecl(const ObjCCategoryDecl *D);
249  void VisitObjCCategoryImplDecl(const ObjCCategoryImplDecl *D);
250  void VisitObjCProtocolDecl(const ObjCProtocolDecl *D);
251  void VisitObjCInterfaceDecl(const ObjCInterfaceDecl *D);
252  void VisitObjCImplementationDecl(const ObjCImplementationDecl *D);
253  void VisitObjCCompatibleAliasDecl(const ObjCCompatibleAliasDecl *D);
254  void VisitObjCPropertyDecl(const ObjCPropertyDecl *D);
255  void VisitObjCPropertyImplDecl(const ObjCPropertyImplDecl *D);
256  void VisitBlockDecl(const BlockDecl *D);
258  void VisitDeclRefExpr(const DeclRefExpr *DRE);
259  void VisitPredefinedExpr(const PredefinedExpr *PE);
260  void VisitUnaryOperator(const UnaryOperator *UO);
261  void VisitBinaryOperator(const BinaryOperator *BO);
262  void VisitCompoundAssignOperator(const CompoundAssignOperator *CAO);
263  void VisitMemberExpr(const MemberExpr *ME);
264  void VisitCXXNewExpr(const CXXNewExpr *NE);
265  void VisitCXXDeleteExpr(const CXXDeleteExpr *DE);
266  void VisitCXXThisExpr(const CXXThisExpr *TE);
267  void VisitCastExpr(const CastExpr *CE);
268  void VisitImplicitCastExpr(const ImplicitCastExpr *ICE);
269  void VisitCallExpr(const CallExpr *CE);
270  void VisitUnaryExprOrTypeTraitExpr(const UnaryExprOrTypeTraitExpr *TTE);
271  void VisitSizeOfPackExpr(const SizeOfPackExpr *SOPE);
272  void VisitUnresolvedLookupExpr(const UnresolvedLookupExpr *ULE);
273  void VisitAddrLabelExpr(const AddrLabelExpr *ALE);
274  void VisitCXXTypeidExpr(const CXXTypeidExpr *CTE);
275  void VisitConstantExpr(const ConstantExpr *CE);
276  void VisitInitListExpr(const InitListExpr *ILE);
277  void VisitGenericSelectionExpr(const GenericSelectionExpr *GSE);
278  void VisitCXXUnresolvedConstructExpr(const CXXUnresolvedConstructExpr *UCE);
279  void VisitCXXConstructExpr(const CXXConstructExpr *CE);
280  void VisitExprWithCleanups(const ExprWithCleanups *EWC);
281  void VisitCXXBindTemporaryExpr(const CXXBindTemporaryExpr *BTE);
282  void VisitMaterializeTemporaryExpr(const MaterializeTemporaryExpr *MTE);
283  void VisitCXXDependentScopeMemberExpr(const CXXDependentScopeMemberExpr *ME);
285  void VisitObjCEncodeExpr(const ObjCEncodeExpr *OEE);
286  void VisitObjCMessageExpr(const ObjCMessageExpr *OME);
287  void VisitObjCBoxedExpr(const ObjCBoxedExpr *OBE);
288  void VisitObjCSelectorExpr(const ObjCSelectorExpr *OSE);
289  void VisitObjCProtocolExpr(const ObjCProtocolExpr *OPE);
290  void VisitObjCPropertyRefExpr(const ObjCPropertyRefExpr *OPRE);
291  void VisitObjCSubscriptRefExpr(const ObjCSubscriptRefExpr *OSRE);
292  void VisitObjCIvarRefExpr(const ObjCIvarRefExpr *OIRE);
293  void VisitObjCBoolLiteralExpr(const ObjCBoolLiteralExpr *OBLE);
295  void VisitIntegerLiteral(const IntegerLiteral *IL);
296  void VisitCharacterLiteral(const CharacterLiteral *CL);
297  void VisitFixedPointLiteral(const FixedPointLiteral *FPL);
298  void VisitFloatingLiteral(const FloatingLiteral *FL);
299  void VisitStringLiteral(const StringLiteral *SL);
300  void VisitCXXBoolLiteralExpr(const CXXBoolLiteralExpr *BLE);
302  void VisitIfStmt(const IfStmt *IS);
303  void VisitSwitchStmt(const SwitchStmt *SS);
304  void VisitCaseStmt(const CaseStmt *CS);
305  void VisitLabelStmt(const LabelStmt *LS);
306  void VisitGotoStmt(const GotoStmt *GS);
307  void VisitWhileStmt(const WhileStmt *WS);
308  void VisitObjCAtCatchStmt(const ObjCAtCatchStmt *OACS);
310  void VisitNullTemplateArgument(const TemplateArgument &TA);
311  void VisitTypeTemplateArgument(const TemplateArgument &TA);
312  void VisitDeclarationTemplateArgument(const TemplateArgument &TA);
313  void VisitNullPtrTemplateArgument(const TemplateArgument &TA);
314  void VisitIntegralTemplateArgument(const TemplateArgument &TA);
315  void VisitTemplateTemplateArgument(const TemplateArgument &TA);
316  void VisitTemplateExpansionTemplateArgument(const TemplateArgument &TA);
317  void VisitExpressionTemplateArgument(const TemplateArgument &TA);
318  void VisitPackTemplateArgument(const TemplateArgument &TA);
320  void visitTextComment(const comments::TextComment *C,
321  const comments::FullComment *);
322  void visitInlineCommandComment(const comments::InlineCommandComment *C,
323  const comments::FullComment *);
324  void visitHTMLStartTagComment(const comments::HTMLStartTagComment *C,
325  const comments::FullComment *);
326  void visitHTMLEndTagComment(const comments::HTMLEndTagComment *C,
327  const comments::FullComment *);
328  void visitBlockCommandComment(const comments::BlockCommandComment *C,
329  const comments::FullComment *);
330  void visitParamCommandComment(const comments::ParamCommandComment *C,
331  const comments::FullComment *FC);
332  void visitTParamCommandComment(const comments::TParamCommandComment *C,
333  const comments::FullComment *FC);
334  void visitVerbatimBlockComment(const comments::VerbatimBlockComment *C,
335  const comments::FullComment *);
336  void
337  visitVerbatimBlockLineComment(const comments::VerbatimBlockLineComment *C,
338  const comments::FullComment *);
339  void visitVerbatimLineComment(const comments::VerbatimLineComment *C,
340  const comments::FullComment *);
341 };
343 class JSONDumper : public ASTNodeTraverser<JSONDumper, JSONNodeDumper> {
344  JSONNodeDumper NodeDumper;
346  template <typename SpecializationDecl>
347  void writeTemplateDeclSpecialization(const SpecializationDecl *SD,
348  bool DumpExplicitInst,
349  bool DumpRefOnly) {
350  bool DumpedAny = false;
351  for (const auto *RedeclWithBadType : SD->redecls()) {
352  // FIXME: The redecls() range sometimes has elements of a less-specific
353  // type. (In particular, ClassTemplateSpecializationDecl::redecls() gives
354  // us TagDecls, and should give CXXRecordDecls).
355  const auto *Redecl = dyn_cast<SpecializationDecl>(RedeclWithBadType);
356  if (!Redecl) {
357  // Found the injected-class-name for a class template. This will be
358  // dumped as part of its surrounding class so we don't need to dump it
359  // here.
360  assert(isa<CXXRecordDecl>(RedeclWithBadType) &&
361  "expected an injected-class-name");
362  continue;
363  }
365  switch (Redecl->getTemplateSpecializationKind()) {
368  if (!DumpExplicitInst)
369  break;
371  case TSK_Undeclared:
373  if (DumpRefOnly)
374  NodeDumper.AddChild([=] { NodeDumper.writeBareDeclRef(Redecl); });
375  else
376  Visit(Redecl);
377  DumpedAny = true;
378  break;
380  break;
381  }
382  }
384  // Ensure we dump at least one decl for each specialization.
385  if (!DumpedAny)
386  NodeDumper.AddChild([=] { NodeDumper.writeBareDeclRef(SD); });
387  }
389  template <typename TemplateDecl>
390  void writeTemplateDecl(const TemplateDecl *TD, bool DumpExplicitInst) {
391  // FIXME: it would be nice to dump template parameters and specializations
392  // to their own named arrays rather than shoving them into the "inner"
393  // array. However, template declarations are currently being handled at the
394  // wrong "level" of the traversal hierarchy and so it is difficult to
395  // achieve without losing information elsewhere.
397  dumpTemplateParameters(TD->getTemplateParameters());
399  Visit(TD->getTemplatedDecl());
401  for (const auto *Child : TD->specializations())
402  writeTemplateDeclSpecialization(Child, DumpExplicitInst,
403  !TD->isCanonicalDecl());
404  }
406 public:
407  JSONDumper(raw_ostream &OS, const SourceManager &SrcMgr, ASTContext &Ctx,
408  const PrintingPolicy &PrintPolicy,
409  const comments::CommandTraits *Traits)
410  : NodeDumper(OS, SrcMgr, Ctx, PrintPolicy, Traits) {}
412  JSONNodeDumper &doGetNodeDelegate() { return NodeDumper; }
415  writeTemplateDecl(FTD, true);
416  }
418  writeTemplateDecl(CTD, false);
419  }
421  writeTemplateDecl(VTD, false);
422  }
423 };
425 } // 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:5205
Represents a function declaration or definition.
Definition: Decl.h:1784
A class which contains all the information about a particular captured value.
Definition: Decl.h:3957
Represents the dependent type named by a dependently-scoped typename using declaration, e.g.
Definition: Type.h:4160
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:3393
IfStmt - This represents an if/then/else.
Definition: Stmt.h:1822
An instance of this object exists for each enum constant that is defined.
Definition: Decl.h:2855
Represents the declaration of a typedef-name via the &#39;typedef&#39; type specifier.
Definition: Decl.h:3087
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:419
Represents a C++11 auto or C++14 decltype(auto) type.
Definition: Type.h:4823
The base class of the type hierarchy.
Definition: Type.h:1436
Declaration of a variable template.
Represents an array type, per C99 - Array Declarators.
Definition: Type.h:2860
Represent a C++ namespace.
Definition: Decl.h:522
Represents a call to a C++ constructor.
Definition: ExprCXX.h:1422
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: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:827
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:3306
Defines the clang::Expr interface and subclasses for C++ expressions.
LabelStmt - Represents a label, which has a substatement.
Definition: Stmt.h:1720
Represents a struct/union/class.
Definition: Decl.h:3662
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:160
Represents a member of a struct/union/class.
Definition: Decl.h:2643
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:87
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:4375
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:3275
AssociationTy< true > ConstAssociation
Definition: Expr.h:5366
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:4216
A builtin binary operation expression such as "x + y" or "x <= y".
Definition: Expr.h:3409
Any part of the comment.
Definition: Comment.h:52
CaseStmt - Represent a case statement.
Definition: Stmt.h:1488
CastExpr - Base class for type casts, including both implicit casts (ImplicitCastExpr) and explicit c...
Definition: Expr.h:3125
Represents an Objective-C protocol declaration.
Definition: DeclObjC.h:2063
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:1171
Represents a linkage specification.
Definition: DeclCXX.h:2753
Represents an extended vector type where either the type or size is dependent.
Definition: Type.h:3166
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: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:3107
Represents a prototype with parameter type info, e.g.
Definition: Type.h:3725
UnaryExprOrTypeTraitExpr - expression with either a type or (unevaluated) expression operand...
Definition: Expr.h:2347
ConstantExpr - An expression that occurs in a constant context and optionally the result of evaluatin...
Definition: Expr.h:953
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
Definition: DeclTemplate.h:406
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:3951
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: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:4363
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:2021
Represents a GCC generic vector type.
Definition: Type.h:3206
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:181
const SourceManager & SM
Definition: Format.cpp:1667
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:5814
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: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:3249
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: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:5054
Represents a pack expansion of types.
Definition: Type.h:5431
CompoundAssignOperator - For compound assignments (e.g.
Definition: Expr.h:3629
Represents a C11 generic selection.
Definition: Expr.h:5206
AddrLabelExpr - The GNU address of label extension, representing &&label.
Definition: Expr.h:3882
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:1878
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:387
bool NE(InterpState &S, CodePtr OpPC)
Definition: Interp.h:226
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:558
Represents an enum.
Definition: Decl.h:3395
A pointer to member type per C++ 8.3.3 - Pointers to members.
Definition: Type.h:2804
SwitchStmt - This represents a &#39;switch&#39; stmt.
Definition: Stmt.h:2027
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:2137
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:2721
Represents a base class of a C++ class.
Definition: DeclCXX.h:147
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:2465
llvm::json::OStream JOS
MemberExpr - [C99] Structure and Union Members.
Definition: Expr.h:2811
Represents a C++ struct/union/class.
Definition: DeclCXX.h:255
ObjCIvarDecl - Represents an ObjC instance variable.
Definition: DeclObjC.h:1944
WhileStmt - This represents a &#39;while&#39; stmt.
Definition: Stmt.h:2210
Declaration of a class template.
StringLiteral - This represents a string literal expression, e.g.
Definition: Expr.h:1686
CallExpr - Represents a function call (C99, C++ []).
Definition: Expr.h:2521
ObjCBoolLiteralExpr - Objective-C Boolean Literal.
Definition: ExprObjC.h:85
A reference to a declared variable, function, enum, etc.
Definition: Expr.h:1146
Represents a type template specialization; the template must be a class template, a type alias templa...
Definition: Type.h:4917
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:645
Represents a C++ namespace alias.
Definition: DeclCXX.h:2949
void AddChild(Fn DoAddChild)
Add a child of the current node. Calls DoAddChild without arguments.
Represents C++ using-directive.
Definition: DeclCXX.h:2845
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:2906
This class handles loading and caching of source files into memory.
Declaration of a template function.
Definition: DeclTemplate.h:961
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:3068
A full comment attached to a declaration, contains block content.
Definition: Comment.h:1091
ObjCCompatibleAliasDecl - Represents alias of a class.
Definition: DeclObjC.h:2728