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"
19 #include "clang/AST/ASTDumperUtils.h"
20 #include "clang/AST/ASTNodeTraverser.h"
21 #include "clang/AST/AttrVisitor.h"
22 #include "clang/AST/CommentCommandTraits.h"
23 #include "clang/AST/CommentVisitor.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;
33 llvm::SmallVector<std::function<void(bool IsLastChild)>, 32> Pending;
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.
113 class JSONNodeDumper
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
132 using InnerAttrVisitor = ConstAttrVisitor<JSONNodeDumper>;
133 using InnerCommentVisitor =
134 comments::ConstCommentVisitor<JSONNodeDumper, void,
135 const comments::FullComment *>;
136 using InnerTemplateArgVisitor = ConstTemplateArgumentVisitor<JSONNodeDumper>;
137 using InnerStmtVisitor = ConstStmtVisitor<JSONNodeDumper>;
138 using InnerTypeVisitor = TypeVisitor<JSONNodeDumper>;
139 using InnerDeclVisitor = ConstDeclVisitor<JSONNodeDumper>;
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()) {
369 case TSK_ExplicitInstantiationDeclaration:
370 case TSK_ExplicitInstantiationDefinition:
371 if (!DumpExplicitInst)
372 break;
373 LLVM_FALLTHROUGH;
374 case TSK_Undeclared:
375 case TSK_ImplicitInstantiation:
376 if (DumpRefOnly)
377 NodeDumper.AddChild([=] { NodeDumper.writeBareDeclRef(Redecl); });
378 else
379 Visit(Redecl);
380 DumpedAny = true;
381 break;
382 case TSK_ExplicitSpecialization:
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
417 void VisitFunctionTemplateDecl(const FunctionTemplateDecl *FTD) {
418 writeTemplateDecl(FTD, true);
419 }
420 void VisitClassTemplateDecl(const ClassTemplateDecl *CTD) {
421 writeTemplateDecl(CTD, false);
422 }
423 void VisitVarTemplateDecl(const VarTemplateDecl *VTD) {
424 writeTemplateDecl(VTD, false);
425 }
426 };
427
428 } // namespace clang
429
430 #endif // LLVM_CLANG_AST_JSONNODEDUMPER_H
clang::ObjCPropertyRefExpr
ObjCPropertyRefExpr - A dot-syntax expression to access an ObjC property.
Definition: ExprObjC.h:614
clang::JSONDumper::VisitFunctionTemplateDecl
void VisitFunctionTemplateDecl(const FunctionTemplateDecl *FTD)
Definition: JSONNodeDumper.h:417
ASTContext.h
Defines the clang::ASTContext interface.
clang::ElaboratedType
Represents a type that was referred to using an elaborated type keyword, e.g., struct S...
Definition: Type.h:5285
clang::FunctionDecl
Represents a function declaration or definition.
Definition: Decl.h:1783
clang::BlockDecl::Capture
A class which contains all the information about a particular captured value.
Definition: Decl.h:4043
clang::UnresolvedUsingType
Represents the dependent type named by a dependently-scoped typename using declaration, e.g.
Definition: Type.h:4210
clang::QualType
A (possibly-)qualified type.
Definition: Type.h:654
clang::ConstStmtVisitor
ConstStmtVisitor - This class implements a simple visitor for Stmt subclasses.
Definition: StmtVisitor.h:193
clang::Stmt
Stmt - This represents one statement.
Definition: Stmt.h:66
clang::FunctionType
FunctionType - C99 6.7.5.3 - Function Declarators.
Definition: Type.h:3422
clang::IfStmt
IfStmt - This represents an if/then/else.
Definition: Stmt.h:1834
clang::EnumConstantDecl
An instance of this object exists for each enum constant that is defined.
Definition: Decl.h:2941
clang::TypedefDecl
Represents the declaration of a typedef-name via the &#39;typedef&#39; type specifier.
Definition: Decl.h:3173
clang::Decl
Decl - This represents one declaration (or definition), e.g.
Definition: DeclBase.h:88
clang::UnresolvedLookupExpr
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
clang::TemplateDecl::getTemplatedDecl
NamedDecl * getTemplatedDecl() const
Get the underlying, templated declaration.
Definition: DeclTemplate.h:434
clang::AutoType
Represents a C++11 auto or C++14 decltype(auto) type, possibly constrained by a type-constraint.
Definition: Type.h:4874
clang::IntegerLiteral
Definition: Expr.h:1446
clang::Type
The base class of the type hierarchy.
Definition: Type.h:1450
clang::VarTemplateDecl
Declaration of a variable template.
Definition: DeclTemplate.h:3070
clang::ArrayType
Represents an array type, per C99 6.7.5.2 - Array Declarators.
Definition: Type.h:2889
clang::NamespaceDecl
Represent a C++ namespace.
Definition: Decl.h:497
clang::CXXConstructExpr
Represents a call to a C++ constructor.
Definition: ExprCXX.h:1422
clang::ObjCSubscriptRefExpr
ObjCSubscriptRefExpr - used for array and dictionary subscripting.
Definition: ExprObjC.h:845
clang::AccessSpecifier
AccessSpecifier
A C++ access specifier (public, private, protected), plus the special value "none" which means differ...
Definition: Specifiers.h:113
clang::MaterializeTemporaryExpr
Represents a prvalue temporary that is written into memory so that a reference can bind to it...
Definition: ExprCXX.h:4419
Value
Value
Definition: UninitializedValues.cpp:101
clang::FriendDecl
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
clang::VarDecl
Represents a variable declaration or definition.
Definition: Decl.h:820
clang::ObjCMethodDecl
ObjCMethodDecl - Represents an instance or class method declaration.
Definition: DeclObjC.h:138
clang::PrintingPolicy
Describes how types, statements, expressions, and declarations should be printed. ...
Definition: PrettyPrinter.h:47
clang::ExprWithCleanups
Represents an expression – generally a full-expression – that introduces cleanups to be run at the ...
Definition: ExprCXX.h:3306
ExprCXX.h
Defines the clang::Expr interface and subclasses for C++ expressions.
clang::LabelStmt
LabelStmt - Represents a label, which has a substatement.
Definition: Stmt.h:1732
clang::RecordDecl
Represents a struct/union/class.
Definition: Decl.h:3748
clang::Redeclarable
Provides common interface for the Decls that can be redeclared.
Definition: Redeclarable.h:84
clang::ASTContext
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:168
clang::FieldDecl
Represents a member of a struct/union/class.
Definition: Decl.h:2729
clang::ConstAttrVisitor
A simple visitor class that helps create attribute visitors.
Definition: AttrVisitor.h:69
clang::TypeVisitor
An operation on a type.
Definition: TypeVisitor.h:64
clang::NodeStreamer::AddChild
void AddChild(StringRef Label, Fn DoAddChild)
Add a child of the current node with an optional label.
Definition: JSONNodeDumper.h:46
clang::FixedPointLiteral
Definition: Expr.h:1489
clang::AccessSpecDecl
Represents an access specifier followed by colon &#39;:&#39;.
Definition: DeclCXX.h:85
clang::JSONDumper::doGetNodeDelegate
JSONNodeDumper & doGetNodeDelegate()
Definition: JSONNodeDumper.h:415
clang::ObjCAtCatchStmt
Represents Objective-C&#39;s @catch statement.
Definition: StmtObjC.h:77
clang::comments::InlineCommandComment
A command with word-like arguments that is considered inline content.
Definition: Comment.h:299
clang::InitListExpr
Describes an C or C++ initializer list.
Definition: Expr.h:4403
clang::CXXTypeidExpr
A C++ typeid expression (C++ [expr.typeid]), which gets the type_info that corresponds to the supplie...
Definition: ExprCXX.h:764
clang::UsingDecl
Represents a C++ using-declaration.
Definition: DeclCXX.h:3369
clang::GenericSelectionExpr::ConstAssociation
AssociationTy< true > ConstAssociation
Definition: Expr.h:5394
clang::comments::VerbatimBlockLineComment
A line of text contained in a verbatim block.
Definition: Comment.h:865
clang::comments::TextComment
Plain text.
Definition: Comment.h:263
clang::comments::VerbatimLineComment
A verbatim line command.
Definition: Comment.h:945
clang::ComparisonCategoryType::First
clang::ConstTemplateArgumentVisitor
A simple visitor class that helps create template argument visitors.
Definition: TemplateArgumentVisitor.h:92
clang::JSONDumper::VisitClassTemplateDecl
void VisitClassTemplateDecl(const ClassTemplateDecl *CTD)
Definition: JSONNodeDumper.h:420
clang::MacroQualifiedType
Sugar type that represents a type that was qualified by a qualifier written as a macro invocation...
Definition: Type.h:4266
CommentCommandTraits.h
clang::BinaryOperator
A builtin binary operation expression such as "x + y" or "x <= y".
Definition: Expr.h:3434
clang::comments::Comment
Any part of the comment.
Definition: Comment.h:52
clang::CaseStmt
CaseStmt - Represent a case statement.
Definition: Stmt.h:1500
clang::CastExpr
CastExpr - Base class for type casts, including both implicit casts (ImplicitCastExpr) and explicit c...
Definition: Expr.h:3150
clang::ObjCProtocolDecl
Represents an Objective-C protocol declaration.
Definition: DeclObjC.h:2078
clang::CXXBindTemporaryExpr
Represents binding an expression to a temporary.
Definition: ExprCXX.h:1373
Mangle.h
clang::CXXDependentScopeMemberExpr
Represents a C++ member access expression where the actual member referenced could not be resolved be...
Definition: ExprCXX.h:3511
clang::FloatingLiteral
Definition: Expr.h:1583
clang::ObjCInterfaceDecl
Represents an ObjC class declaration.
Definition: DeclObjC.h:1186
clang::LinkageSpecDecl
Represents a linkage specification.
Definition: DeclCXX.h:2778
clang::JSONDumper
Definition: JSONNodeDumper.h:346
clang::DependentSizedExtVectorType
Represents an extended vector type where either the type or size is dependent.
Definition: Type.h:3195
clang::CXXThisExpr
Represents the this expression in C++.
Definition: ExprCXX.h:1097
clang::ObjCPropertyImplDecl
ObjCPropertyImplDecl - Represents implementation declaration of a property in a class or category imp...
Definition: DeclObjC.h:2773
clang::Mergeable::getFirstDecl
decl_type * getFirstDecl()
Return the first declaration of this declaration or itself if this is the only declaration.
Definition: Redeclarable.h:318
clang::comments::VerbatimBlockComment
A verbatim block command (e.
Definition: Comment.h:893
clang::TypeAliasDecl
Represents the declaration of a typedef-name via a C++11 alias-declaration.
Definition: Decl.h:3193
clang::FunctionProtoType
Represents a prototype with parameter type info, e.g.
Definition: Type.h:3754
clang::UnaryExprOrTypeTraitExpr
UnaryExprOrTypeTraitExpr - expression with either a type or (unevaluated) expression operand...
Definition: Expr.h:2372
clang::ConstantExpr
ConstantExpr - An expression that occurs in a constant context and optionally the result of evaluatin...
Definition: Expr.h:978
ASTDumperUtils.h
clang::TemplateDecl::getTemplateParameters
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
Definition: DeclTemplate.h:421
clang::Decl::isCanonicalDecl
bool isCanonicalDecl() const
Whether this particular Decl is a canonical one.
Definition: DeclBase.h:883
clang::BlockDecl
Represents a block literal declaration, which is like an unnamed FunctionDecl.
Definition: Decl.h:4037
Label
std::string Label
Definition: UsingDeclarationsSorter.cpp:69
clang::TemplateTypeParmDecl
Declaration of a template type parameter.
Definition: DeclTemplate.h:1177
clang::comments::BlockCommandComment
A command that has zero or more word-like arguments (number of word-like arguments depends on command...
Definition: Comment.h:598
clang::ObjCSelectorExpr
ObjCSelectorExpr used for @selector in Objective-C.
Definition: ExprObjC.h:454
clang::SizeOfPackExpr
Represents an expression that computes the length of a parameter pack.
Definition: ExprCXX.h:4091
clang::NonTypeTemplateParmDecl
NonTypeTemplateParmDecl - Declares a non-type template parameter, e.g., "Size" in.
Definition: DeclTemplate.h:1383
Depth
int Depth
Definition: ASTDiff.cpp:190
clang::UnaryTransformType
A unary type transform, which is a type constructed from another.
Definition: Type.h:4413
clang::ObjCMessageExpr
An expression that sends a message to the given Objective-C object or class.
Definition: ExprObjC.h:950
clang::PresumedLoc
Represents an unpacked "presumed" location which can be presented to the user.
Definition: SourceLocation.h:299
clang::UnaryOperator
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
clang::VectorType
Represents a GCC generic vector type.
Definition: Type.h:3235
clang::comments::HTMLStartTagComment
An opening HTML tag with attributes.
Definition: Comment.h:415
clang::TemplateTemplateParmDecl
TemplateTemplateParmDecl - Declares a template template parameter, e.g., "T" in.
Definition: DeclTemplate.h:1600
clang::JSONNodeDumper::JSONNodeDumper
JSONNodeDumper(raw_ostream &OS, const SourceManager &SrcMgr, ASTContext &Ctx, const PrintingPolicy &PrintPolicy, const comments::CommandTraits *Traits)
Definition: JSONNodeDumper.h:184
Desugar
static QualType Desugar(ASTContext &Context, QualType QT, bool &ShouldAKA)
Definition: ASTDiagnostic.cpp:28
clang::TSK_ImplicitInstantiation
This template specialization was implicitly instantiated from a template.
Definition: Specifiers.h:181
SM
const SourceManager & SM
Definition: Format.cpp:1685
CommentVisitor.h
clang::comments::CommandTraits
This class provides information about commands that can be used in comments.
Definition: CommentCommandTraits.h:127
clang::Redeclarable::getPreviousDecl
decl_type * getPreviousDecl()
Return the previous declaration of this declaration or NULL if this is the first declaration.
Definition: Redeclarable.h:203
clang::SourceLocation
Encodes a location in the source.
Definition: SourceLocation.h:86
clang::ObjCInterfaceType
Interfaces are the core concept in Objective-C for object oriented design.
Definition: Type.h:5894
clang::JSONDumper::JSONDumper
JSONDumper(raw_ostream &OS, const SourceManager &SrcMgr, ASTContext &Ctx, const PrintingPolicy &PrintPolicy, const comments::CommandTraits *Traits)
Definition: JSONNodeDumper.h:410
clang::CXXNewExpr
Represents a new-expression for memory allocation and constructor calls, e.g: "new CXXNewExpr(foo)"...
Definition: ExprCXX.h:2100
clang::NodeStreamer
Definition: JSONNodeDumper.h:30
clang::ObjCCategoryDecl
ObjCCategoryDecl - Represents a category declaration.
Definition: DeclObjC.h:2294
clang::OMPClause
This is a basic class for representing single OpenMP clause.
Definition: OpenMPClause.h:51
clang::ObjCProtocolExpr
ObjCProtocolExpr used for protocol expression in Objective-C.
Definition: ExprObjC.h:503
llvm::SmallVector
Definition: LLVM.h:35
clang::ASTNodeTraverser
ASTNodeTraverser traverses the Clang AST for dumping purposes.
Definition: ASTNodeTraverser.h:55
clang::ObjCPropertyDecl
Represents one property declaration in an Objective-C interface.
Definition: DeclObjC.h:741
clang::ImplicitCastExpr
ImplicitCastExpr - Allows us to explicitly represent implicit type conversions, which have no direct ...
Definition: Expr.h:3274
clang::TSK_ExplicitInstantiationDefinition
This template specialization was instantiated from a template due to an explicit instantiation defini...
Definition: Specifiers.h:193
clang::TSK_Undeclared
This template specialization was formed from a template-id but has not yet been declared, defined, or instantiated.
Definition: Specifiers.h:178
clang::CharacterLiteral
Definition: Expr.h:1530
clang::comments::HTMLEndTagComment
A closing HTML tag.
Definition: Comment.h:509
clang::ASTNameGenerator
Definition: Mangle.h:249
clang::ObjCBoxedExpr
ObjCBoxedExpr - used for generalized expression boxing.
Definition: ExprObjC.h:124
clang::NodeStreamer::NodeStreamer
NodeStreamer(raw_ostream &OS)
Definition: JSONNodeDumper.h:105
clang::comments::TParamCommandComment
Doxygen \tparam command, describes a template parameter.
Definition: Comment.h:801
AttrVisitor.h
clang::InjectedClassNameType
The injected class name of a C++ class template or class template partial specialization.
Definition: Type.h:5133
clang::PackExpansionType
Represents a pack expansion of types.
Definition: Type.h:5511
clang::CompoundAssignOperator
CompoundAssignOperator - For compound assignments (e.g.
Definition: Expr.h:3654
clang::GenericSelectionExpr
Represents a C11 generic selection.
Definition: Expr.h:5234
clang::AddrLabelExpr
AddrLabelExpr - The GNU address of label extension, representing &&label.
Definition: Expr.h:3910
Node
ast_type_traits::DynTypedNode Node
Definition: ASTMatchFinder.cpp:60
clang::TemplateArgument
Represents a template argument.
Definition: TemplateBase.h:50
clang
Dataflow Directional Tag Classes.
Definition: CFGReachabilityAnalysis.h:21
clang::PredefinedExpr
[C99 6.4.2.2] - A predefined identifier such as func.
Definition: Expr.h:1903
clang::CXXDeleteExpr
Represents a delete expression for memory deallocation and destructor calls, e.g. ...
Definition: ExprCXX.h:2359
clang::TemplateDecl
The base class of all kinds of template declarations (e.g., class, function, etc.).
Definition: DeclTemplate.h:402
clang::interp::NE
bool NE(InterpState &S, CodePtr OpPC)
Definition: Interp.h:223
clang::TSK_ExplicitInstantiationDeclaration
This template specialization was instantiated from a template due to an explicit instantiation declar...
Definition: Specifiers.h:189
ASTNodeTraverser.h
clang::ObjCTypeParamDecl
Represents the declaration of an Objective-C type parameter.
Definition: DeclObjC.h:571
clang::EnumDecl
Represents an enum.
Definition: Decl.h:3481
clang::MemberPointerType
A pointer to member type per C++ 8.3.3 - Pointers to members.
Definition: Type.h:2833
clang::SwitchStmt
SwitchStmt - This represents a &#39;switch&#39; stmt.
Definition: Stmt.h:2043
clang::ObjCImplementationDecl
ObjCImplementationDecl - Represents a class definition - this is where method definitions are specifi...
Definition: DeclObjC.h:2566
clang::Mergeable
Provides common interface for the Decls that cannot be redeclared, but can be merged if the same decl...
Definition: Redeclarable.h:312
clang::CXXCtorInitializer
Represents a C++ base or member initializer.
Definition: DeclCXX.h:2155
clang::TSK_ExplicitSpecialization
This template specialization was declared or defined by an explicit specialization (C++ [temp...
Definition: Specifiers.h:185
clang::ObjCEncodeExpr
ObjCEncodeExpr, used for @encode in Objective-C.
Definition: ExprObjC.h:407
clang::ReferenceType
Base for LValueReferenceType and RValueReferenceType.
Definition: Type.h:2750
clang::CXXBaseSpecifier
Represents a base class of a C++ class.
Definition: DeclCXX.h:145
clang::ObjCIvarRefExpr
ObjCIvarRefExpr - A reference to an ObjC instance variable.
Definition: ExprObjC.h:546
clang::JSONDumper::VisitVarTemplateDecl
void VisitVarTemplateDecl(const VarTemplateDecl *VTD)
Definition: JSONNodeDumper.h:423
clang::CXXUnresolvedConstructExpr
Describes an explicit type conversion that uses functional notion but could not be resolved because o...
Definition: ExprCXX.h:3390
clang::GotoStmt
GotoStmt - This represents a direct goto.
Definition: Stmt.h:2481
clang::JSONNodeDumper
Definition: JSONNodeDumper.h:113
clang::NodeStreamer::JOS
llvm::json::OStream JOS
Definition: JSONNodeDumper.h:36
clang::MemberExpr
MemberExpr - [C99 6.5.2.3] Structure and Union Members.
Definition: Expr.h:2836
clang::CXXRecordDecl
Represents a C++ struct/union/class.
Definition: DeclCXX.h:253
clang::ObjCIvarDecl
ObjCIvarDecl - Represents an ObjC instance variable.
Definition: DeclObjC.h:1959
clang::WhileStmt
WhileStmt - This represents a &#39;while&#39; stmt.
Definition: Stmt.h:2226
clang::AttrSyntax::C
clang::ClassTemplateDecl
Declaration of a class template.
Definition: DeclTemplate.h:2238
clang::StringLiteral
StringLiteral - This represents a string literal expression, e.g.
Definition: Expr.h:1711
clang::CallExpr
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
Definition: Expr.h:2546
clang::ObjCBoolLiteralExpr
ObjCBoolLiteralExpr - Objective-C Boolean Literal.
Definition: ExprObjC.h:85
clang::DeclRefExpr
A reference to a declared variable, function, enum, etc.
Definition: Expr.h:1171
clang::TemplateSpecializationType
Represents a type template specialization; the template must be a class template, a type alias templa...
Definition: Type.h:4996
clang::comments::ParamCommandComment
Doxygen \param command.
Definition: Comment.h:713
clang::TypedefType
Definition: Type.h:4240
clang::SourceRange
A trivial tuple used to represent a source range.
Definition: SourceLocation.h:207
clang::NamedDecl
This represents a decl that may have a name.
Definition: Decl.h:223
clang::CXXBoolLiteralExpr
A boolean literal, per ([C++ lex.bool] Boolean literals).
Definition: ExprCXX.h:645
clang::TagType
Definition: Type.h:4471
clang::TemplateTypeParmType
Definition: Type.h:4647
clang::NamespaceAliasDecl
Represents a C++ namespace alias.
Definition: DeclCXX.h:2967
clang::NodeStreamer::AddChild
void AddChild(Fn DoAddChild)
Add a child of the current node. Calls DoAddChild without arguments.
Definition: JSONNodeDumper.h:40
clang::UsingDirectiveDecl
Represents C++ using-directive.
Definition: DeclCXX.h:2863
clang::comments::ConstCommentVisitor
Definition: CommentVisitor.h:62
clang::ConstDeclVisitor
A simple visitor class that helps create declaration visitors.
Definition: DeclVisitor.h:73
clang::ObjCCategoryImplDecl
ObjCCategoryImplDecl - An object of this class encapsulates a category @implementation declaration...
Definition: DeclObjC.h:2513
clang::ConstantArrayType
Represents the canonical version of C arrays with a specified constant size.
Definition: Type.h:2935
clang::SourceManager
This class handles loading and caching of source files into memory.
Definition: SourceManager.h:596
clang::FunctionTemplateDecl
Declaration of a template function.
Definition: DeclTemplate.h:977
clang::Attr
Attr - This represents one attribute.
Definition: Attr.h:45
clang::UsingShadowDecl
Represents a shadow declaration introduced into a scope by a (resolved) using declaration.
Definition: DeclCXX.h:3162
clang::comments::FullComment
A full comment attached to a declaration, contains block content.
Definition: Comment.h:1093
clang::ObjCCompatibleAliasDecl
ObjCCompatibleAliasDecl - Represents alias of a class.
Definition: DeclObjC.h:2743