clang 23.0.0git
JSONNodeDumper.h
Go to the documentation of this file.
1//===--- JSONNodeDumper.h - Printing of AST nodes to JSON -----------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file implements AST dumping of components of individual AST nodes to
10// a JSON.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_CLANG_AST_JSONNODEDUMPER_H
15#define LLVM_CLANG_AST_JSONNODEDUMPER_H
16
23#include "clang/AST/ExprCXX.h"
25#include "clang/AST/Mangle.h"
27#include "clang/AST/Type.h"
28#include "llvm/Support/JSON.h"
29
30namespace clang {
31
32class APValue;
33
35 bool FirstChild = true;
36 bool TopLevel = true;
37 llvm::SmallVector<std::function<void(bool IsLastChild)>, 32> Pending;
38
39protected:
40 llvm::json::OStream JOS;
41
42public:
43 /// Add a child of the current node. Calls DoAddChild without arguments
44 template <typename Fn> void AddChild(Fn DoAddChild) {
45 return AddChild("", DoAddChild);
46 }
47
48 /// Add a child of the current node with an optional label.
49 /// Calls DoAddChild without arguments.
50 template <typename Fn> void AddChild(StringRef Label, Fn DoAddChild) {
51 // If we're at the top level, there's nothing interesting to do; just
52 // run the dumper.
53 if (TopLevel) {
54 TopLevel = false;
55 JOS.objectBegin();
56
57 DoAddChild();
58
59 while (!Pending.empty()) {
60 Pending.back()(true);
61 Pending.pop_back();
62 }
63
64 JOS.objectEnd();
65 TopLevel = true;
66 return;
67 }
68
69 // We need to capture an owning-string in the lambda because the lambda
70 // is invoked in a deferred manner.
71 std::string LabelStr(!Label.empty() ? Label : "inner");
72 bool WasFirstChild = FirstChild;
73 auto DumpWithIndent = [=](bool IsLastChild) {
74 if (WasFirstChild) {
75 JOS.attributeBegin(LabelStr);
76 JOS.arrayBegin();
77 }
78
79 FirstChild = true;
80 unsigned Depth = Pending.size();
81 JOS.objectBegin();
82
83 DoAddChild();
84
85 // If any children are left, they're the last at their nesting level.
86 // Dump those ones out now.
87 while (Depth < Pending.size()) {
88 Pending.back()(true);
89 this->Pending.pop_back();
90 }
91
92 JOS.objectEnd();
93
94 if (IsLastChild) {
95 JOS.arrayEnd();
96 JOS.attributeEnd();
97 }
98 };
99
100 if (FirstChild) {
101 Pending.push_back(std::move(DumpWithIndent));
102 } else {
103 Pending.back()(false);
104 Pending.back() = std::move(DumpWithIndent);
105 }
106 FirstChild = false;
107 }
108
109 NodeStreamer(raw_ostream &OS) : JOS(OS, 2) {}
110};
111
112// Dumps AST nodes in JSON format. There is no implied stability for the
113// content or format of the dump between major releases of Clang, other than it
114// being valid JSON output. Further, there is no requirement that the
115// information dumped is a complete representation of the AST, only that the
116// information presented is correct.
118 : public ConstAttrVisitor<JSONNodeDumper>,
119 public comments::ConstCommentVisitor<JSONNodeDumper, void,
120 const comments::FullComment *>,
121 public ConstTemplateArgumentVisitor<JSONNodeDumper>,
122 public ConstStmtVisitor<JSONNodeDumper>,
123 public TypeVisitor<JSONNodeDumper>,
124 public ConstDeclVisitor<JSONNodeDumper>,
125 public NodeStreamer {
126 friend class JSONDumper;
127
128 const SourceManager &SM;
129 ASTContext& Ctx;
130 ASTNameGenerator ASTNameGen;
131 PrintingPolicy PrintPolicy;
132 const comments::CommandTraits *Traits;
133 StringRef LastLocFilename, LastLocPresumedFilename;
134 unsigned LastLocLine, LastLocPresumedLine;
135
136 using InnerAttrVisitor = ConstAttrVisitor<JSONNodeDumper>;
137 using InnerCommentVisitor =
139 const comments::FullComment *>;
140 using InnerTemplateArgVisitor = ConstTemplateArgumentVisitor<JSONNodeDumper>;
141 using InnerStmtVisitor = ConstStmtVisitor<JSONNodeDumper>;
142 using InnerTypeVisitor = TypeVisitor<JSONNodeDumper>;
143 using InnerDeclVisitor = ConstDeclVisitor<JSONNodeDumper>;
144
145 void attributeOnlyIfTrue(StringRef Key, bool Value) {
146 if (Value)
147 JOS.attribute(Key, Value);
148 }
149
150 void writeIncludeStack(PresumedLoc Loc, bool JustFirst = false);
151
152 // Writes the attributes of a SourceLocation object without.
153 void writeBareSourceLocation(SourceLocation Loc);
154
155 // Writes the attributes of a SourceLocation to JSON based on its presumed
156 // spelling location. If the given location represents a macro invocation,
157 // this outputs two sub-objects: one for the spelling and one for the
158 // expansion location.
159 void writeSourceLocation(SourceLocation Loc);
160 void writeSourceRange(SourceRange R);
161 std::string createPointerRepresentation(const void *Ptr);
162 llvm::json::Object createQualType(QualType QT, bool Desugar = true);
163 llvm::json::Object createBareDeclRef(const Decl *D);
164 llvm::json::Object createFPOptions(FPOptionsOverride FPO);
165 void writeBareDeclRef(const Decl *D);
166 llvm::json::Object createCXXRecordDefinitionData(const CXXRecordDecl *RD);
167 llvm::json::Object createCXXBaseSpecifier(const CXXBaseSpecifier &BS);
168 std::string createAccessSpecifier(AccessSpecifier AS);
169 llvm::json::Array createCastPath(const CastExpr *C);
170
171 void writePreviousDeclImpl(...) {}
172
173 template <typename T> void writePreviousDeclImpl(const Mergeable<T> *D) {
174 const T *First = D->getFirstDecl();
175 if (First != D)
176 JOS.attribute("firstRedecl", createPointerRepresentation(First));
177 }
178
179 template <typename T> void writePreviousDeclImpl(const Redeclarable<T> *D) {
180 const T *Prev = D->getPreviousDecl();
181 if (Prev)
182 JOS.attribute("previousDecl", createPointerRepresentation(Prev));
183 }
184 void addPreviousDeclaration(const Decl *D);
185
186 StringRef getCommentCommandName(unsigned CommandID) const;
187
188public:
189 JSONNodeDumper(raw_ostream &OS, const SourceManager &SrcMgr, ASTContext &Ctx,
190 const PrintingPolicy &PrintPolicy,
191 const comments::CommandTraits *Traits)
192 : NodeStreamer(OS), SM(SrcMgr), Ctx(Ctx), ASTNameGen(Ctx),
193 PrintPolicy(PrintPolicy), Traits(Traits), LastLocLine(0),
194 LastLocPresumedLine(0) {}
195
196 void Visit(const Attr *A);
197 void Visit(const Stmt *Node);
198 void Visit(const Type *T);
199 void Visit(QualType T);
200 void Visit(const Decl *D);
201 void Visit(TypeLoc TL);
202
203 void Visit(const comments::Comment *C, const comments::FullComment *FC);
204 void Visit(const TemplateArgument &TA, SourceRange R = {},
205 const Decl *From = nullptr, StringRef Label = {});
206 void Visit(const CXXCtorInitializer *Init);
207 void Visit(const OpenACCClause *C);
208 void Visit(const OMPClause *C);
209 void Visit(const BlockDecl::Capture &C);
211 void Visit(const concepts::Requirement *R);
212 void Visit(const APValue &Value, QualType Ty);
213 void Visit(const ConceptReference *);
214
215 void VisitAliasAttr(const AliasAttr *AA);
216 void VisitCleanupAttr(const CleanupAttr *CA);
217 void VisitDeprecatedAttr(const DeprecatedAttr *DA);
218 void VisitUnavailableAttr(const UnavailableAttr *UA);
219 void VisitSectionAttr(const SectionAttr *SA);
220 void VisitVisibilityAttr(const VisibilityAttr *VA);
221 void VisitTLSModelAttr(const TLSModelAttr *TA);
222 void VisitAvailabilityAttr(const AvailabilityAttr *AA);
223
224 void VisitTypedefType(const TypedefType *TT);
225 void VisitUsingType(const UsingType *TT);
226 void VisitFunctionType(const FunctionType *T);
227 void VisitFunctionProtoType(const FunctionProtoType *T);
228 void VisitRValueReferenceType(const ReferenceType *RT);
229 void VisitArrayType(const ArrayType *AT);
230 void VisitConstantArrayType(const ConstantArrayType *CAT);
231 void VisitDependentSizedExtVectorType(const DependentSizedExtVectorType *VT);
232 void VisitVectorType(const VectorType *VT);
233 void VisitUnresolvedUsingType(const UnresolvedUsingType *UUT);
234 void VisitUnaryTransformType(const UnaryTransformType *UTT);
235 void VisitTagType(const TagType *TT);
236 void VisitTemplateTypeParmType(const TemplateTypeParmType *TTPT);
237 void VisitSubstTemplateTypeParmType(const SubstTemplateTypeParmType *STTPT);
238 void
239 VisitSubstTemplateTypeParmPackType(const SubstTemplateTypeParmPackType *T);
240 void VisitAutoType(const AutoType *AT);
241 void VisitTemplateSpecializationType(const TemplateSpecializationType *TST);
242 void VisitInjectedClassNameType(const InjectedClassNameType *ICNT);
243 void VisitObjCInterfaceType(const ObjCInterfaceType *OIT);
244 void VisitPackExpansionType(const PackExpansionType *PET);
245 void VisitMacroQualifiedType(const MacroQualifiedType *MQT);
246 void VisitMemberPointerType(const MemberPointerType *MPT);
247
248 void VisitNamedDecl(const NamedDecl *ND);
249 void VisitTypedefDecl(const TypedefDecl *TD);
250 void VisitTypeAliasDecl(const TypeAliasDecl *TAD);
251 void VisitNamespaceDecl(const NamespaceDecl *ND);
252 void VisitUsingDirectiveDecl(const UsingDirectiveDecl *UDD);
253 void VisitNamespaceAliasDecl(const NamespaceAliasDecl *NAD);
254 void VisitUsingDecl(const UsingDecl *UD);
255 void VisitUsingEnumDecl(const UsingEnumDecl *UED);
256 void VisitUsingShadowDecl(const UsingShadowDecl *USD);
257 void VisitVarDecl(const VarDecl *VD);
258 void VisitFieldDecl(const FieldDecl *FD);
259 void VisitFunctionDecl(const FunctionDecl *FD);
260 void VisitEnumDecl(const EnumDecl *ED);
261 void VisitEnumConstantDecl(const EnumConstantDecl *ECD);
262 void VisitRecordDecl(const RecordDecl *RD);
263 void VisitCXXRecordDecl(const CXXRecordDecl *RD);
264 void VisitHLSLBufferDecl(const HLSLBufferDecl *D);
265 void VisitTemplateTypeParmDecl(const TemplateTypeParmDecl *D);
266 void VisitNonTypeTemplateParmDecl(const NonTypeTemplateParmDecl *D);
267 void VisitTemplateTemplateParmDecl(const TemplateTemplateParmDecl *D);
268 void VisitLinkageSpecDecl(const LinkageSpecDecl *LSD);
269 void VisitAccessSpecDecl(const AccessSpecDecl *ASD);
270 void VisitFriendDecl(const FriendDecl *FD);
271
272 void VisitObjCIvarDecl(const ObjCIvarDecl *D);
273 void VisitObjCMethodDecl(const ObjCMethodDecl *D);
274 void VisitObjCTypeParamDecl(const ObjCTypeParamDecl *D);
275 void VisitObjCCategoryDecl(const ObjCCategoryDecl *D);
276 void VisitObjCCategoryImplDecl(const ObjCCategoryImplDecl *D);
277 void VisitObjCProtocolDecl(const ObjCProtocolDecl *D);
278 void VisitObjCInterfaceDecl(const ObjCInterfaceDecl *D);
279 void VisitObjCImplementationDecl(const ObjCImplementationDecl *D);
280 void VisitObjCCompatibleAliasDecl(const ObjCCompatibleAliasDecl *D);
281 void VisitObjCPropertyDecl(const ObjCPropertyDecl *D);
282 void VisitObjCPropertyImplDecl(const ObjCPropertyImplDecl *D);
283 void VisitBlockDecl(const BlockDecl *D);
284
285 void VisitOpenACCDeclareDecl(const OpenACCDeclareDecl *D);
286 void VisitOpenACCRoutineDecl(const OpenACCRoutineDecl *D);
287
288 void VisitDeclRefExpr(const DeclRefExpr *DRE);
289 void VisitSYCLUniqueStableNameExpr(const SYCLUniqueStableNameExpr *E);
290 void VisitOpenACCAsteriskSizeExpr(const OpenACCAsteriskSizeExpr *E);
291 void VisitPredefinedExpr(const PredefinedExpr *PE);
292 void VisitUnaryOperator(const UnaryOperator *UO);
293 void VisitBinaryOperator(const BinaryOperator *BO);
294 void VisitCompoundAssignOperator(const CompoundAssignOperator *CAO);
295 void VisitMemberExpr(const MemberExpr *ME);
296 void VisitAtomicExpr(const AtomicExpr *AE);
297 void VisitCXXNewExpr(const CXXNewExpr *NE);
298 void VisitCXXDeleteExpr(const CXXDeleteExpr *DE);
299 void VisitCXXThisExpr(const CXXThisExpr *TE);
300 void VisitCastExpr(const CastExpr *CE);
301 void VisitImplicitCastExpr(const ImplicitCastExpr *ICE);
302 void VisitCallExpr(const CallExpr *CE);
303 void VisitUnaryExprOrTypeTraitExpr(const UnaryExprOrTypeTraitExpr *TTE);
304 void VisitSizeOfPackExpr(const SizeOfPackExpr *SOPE);
305 void VisitUnresolvedLookupExpr(const UnresolvedLookupExpr *ULE);
306 void VisitAddrLabelExpr(const AddrLabelExpr *ALE);
307 void VisitCXXTypeidExpr(const CXXTypeidExpr *CTE);
308 void VisitConstantExpr(const ConstantExpr *CE);
309 void VisitInitListExpr(const InitListExpr *ILE);
310 void VisitGenericSelectionExpr(const GenericSelectionExpr *GSE);
311 void VisitCXXUnresolvedConstructExpr(const CXXUnresolvedConstructExpr *UCE);
312 void VisitCXXConstructExpr(const CXXConstructExpr *CE);
313 void VisitExprWithCleanups(const ExprWithCleanups *EWC);
314 void VisitCXXBindTemporaryExpr(const CXXBindTemporaryExpr *BTE);
315 void VisitMaterializeTemporaryExpr(const MaterializeTemporaryExpr *MTE);
316 void VisitCXXDependentScopeMemberExpr(const CXXDependentScopeMemberExpr *ME);
317 void VisitRequiresExpr(const RequiresExpr *RE);
318 void VisitCXXDefaultArgExpr(const CXXDefaultArgExpr *Node);
319 void VisitCXXDefaultInitExpr(const CXXDefaultInitExpr *Node);
320 void VisitLambdaExpr(const LambdaExpr *LE);
321
322 void VisitObjCEncodeExpr(const ObjCEncodeExpr *OEE);
323 void VisitObjCMessageExpr(const ObjCMessageExpr *OME);
324 void VisitObjCBoxedExpr(const ObjCBoxedExpr *OBE);
325 void VisitObjCSelectorExpr(const ObjCSelectorExpr *OSE);
326 void VisitObjCProtocolExpr(const ObjCProtocolExpr *OPE);
327 void VisitObjCPropertyRefExpr(const ObjCPropertyRefExpr *OPRE);
328 void VisitObjCSubscriptRefExpr(const ObjCSubscriptRefExpr *OSRE);
329 void VisitObjCIvarRefExpr(const ObjCIvarRefExpr *OIRE);
330 void VisitObjCBoolLiteralExpr(const ObjCBoolLiteralExpr *OBLE);
331
332 void VisitIntegerLiteral(const IntegerLiteral *IL);
333 void VisitCharacterLiteral(const CharacterLiteral *CL);
334 void VisitFixedPointLiteral(const FixedPointLiteral *FPL);
335 void VisitFloatingLiteral(const FloatingLiteral *FL);
336 void VisitStringLiteral(const StringLiteral *SL);
337 void VisitCXXBoolLiteralExpr(const CXXBoolLiteralExpr *BLE);
338
339 void VisitLoopControlStmt(const LoopControlStmt *LS);
340 void VisitIfStmt(const IfStmt *IS);
341 void VisitSwitchStmt(const SwitchStmt *SS);
342 void VisitCaseStmt(const CaseStmt *CS);
343 void VisitLabelStmt(const LabelStmt *LS);
344 void VisitGotoStmt(const GotoStmt *GS);
345 void VisitWhileStmt(const WhileStmt *WS);
346 void VisitObjCAtCatchStmt(const ObjCAtCatchStmt *OACS);
347 void VisitCompoundStmt(const CompoundStmt *IS);
348
349 void VisitNullTemplateArgument(const TemplateArgument &TA);
350 void VisitTypeTemplateArgument(const TemplateArgument &TA);
351 void VisitDeclarationTemplateArgument(const TemplateArgument &TA);
352 void VisitNullPtrTemplateArgument(const TemplateArgument &TA);
353 void VisitIntegralTemplateArgument(const TemplateArgument &TA);
354 void VisitStructuralValueTemplateArgument(const TemplateArgument &TA);
355 void VisitTemplateTemplateArgument(const TemplateArgument &TA);
356 void VisitTemplateExpansionTemplateArgument(const TemplateArgument &TA);
357 void VisitExpressionTemplateArgument(const TemplateArgument &TA);
358 void VisitPackTemplateArgument(const TemplateArgument &TA);
359
360 void visitTextComment(const comments::TextComment *C,
361 const comments::FullComment *);
362 void visitInlineCommandComment(const comments::InlineCommandComment *C,
363 const comments::FullComment *);
364 void visitHTMLStartTagComment(const comments::HTMLStartTagComment *C,
365 const comments::FullComment *);
366 void visitHTMLEndTagComment(const comments::HTMLEndTagComment *C,
367 const comments::FullComment *);
368 void visitBlockCommandComment(const comments::BlockCommandComment *C,
369 const comments::FullComment *);
370 void visitParamCommandComment(const comments::ParamCommandComment *C,
371 const comments::FullComment *FC);
372 void visitTParamCommandComment(const comments::TParamCommandComment *C,
373 const comments::FullComment *FC);
374 void visitVerbatimBlockComment(const comments::VerbatimBlockComment *C,
375 const comments::FullComment *);
376 void
377 visitVerbatimBlockLineComment(const comments::VerbatimBlockLineComment *C,
378 const comments::FullComment *);
379 void visitVerbatimLineComment(const comments::VerbatimLineComment *C,
380 const comments::FullComment *);
381};
382
383class JSONDumper : public ASTNodeTraverser<JSONDumper, JSONNodeDumper> {
384 JSONNodeDumper NodeDumper;
385
386 template <typename SpecializationDecl>
387 void writeTemplateDeclSpecialization(const SpecializationDecl *SD,
388 bool DumpExplicitInst,
389 bool DumpRefOnly) {
390 bool DumpedAny = false;
391 for (const auto *RedeclWithBadType : SD->redecls()) {
392 // FIXME: The redecls() range sometimes has elements of a less-specific
393 // type. (In particular, ClassTemplateSpecializationDecl::redecls() gives
394 // us TagDecls, and should give CXXRecordDecls).
395 const auto *Redecl = dyn_cast<SpecializationDecl>(RedeclWithBadType);
396 if (!Redecl) {
397 // Found the injected-class-name for a class template. This will be
398 // dumped as part of its surrounding class so we don't need to dump it
399 // here.
400 assert(isa<CXXRecordDecl>(RedeclWithBadType) &&
401 "expected an injected-class-name");
402 continue;
403 }
404
405 switch (Redecl->getTemplateSpecializationKind()) {
408 if (!DumpExplicitInst)
409 break;
410 [[fallthrough]];
411 case TSK_Undeclared:
413 if (DumpRefOnly)
414 NodeDumper.AddChild([=] { NodeDumper.writeBareDeclRef(Redecl); });
415 else
416 Visit(Redecl);
417 DumpedAny = true;
418 break;
420 break;
421 }
422 }
423
424 // Ensure we dump at least one decl for each specialization.
425 if (!DumpedAny)
426 NodeDumper.AddChild([=] { NodeDumper.writeBareDeclRef(SD); });
427 }
428
429 template <typename TemplateDecl>
430 void writeTemplateDecl(const TemplateDecl *TD, bool DumpExplicitInst) {
431 // FIXME: it would be nice to dump template parameters and specializations
432 // to their own named arrays rather than shoving them into the "inner"
433 // array. However, template declarations are currently being handled at the
434 // wrong "level" of the traversal hierarchy and so it is difficult to
435 // achieve without losing information elsewhere.
436
438
439 Visit(TD->getTemplatedDecl());
440
441 for (const auto *Child : TD->specializations())
442 writeTemplateDeclSpecialization(Child, DumpExplicitInst,
443 !TD->isCanonicalDecl());
444 }
445
446public:
447 JSONDumper(raw_ostream &OS, const SourceManager &SrcMgr, ASTContext &Ctx,
448 const PrintingPolicy &PrintPolicy,
449 const comments::CommandTraits *Traits)
450 : NodeDumper(OS, SrcMgr, Ctx, PrintPolicy, Traits) {}
451
452 JSONNodeDumper &doGetNodeDelegate() { return NodeDumper; }
453
455 writeTemplateDecl(FTD, true);
456 }
458 writeTemplateDecl(CTD, false);
459 }
461 writeTemplateDecl(VTD, false);
462 }
463};
464
465} // namespace clang
466
467#endif // LLVM_CLANG_AST_JSONNODEDUMPER_H
Defines the clang::ASTContext interface.
Defines the clang::Expr interface and subclasses for C++ expressions.
Defines Expressions and AST nodes for C++2a concepts.
C Language Family Type Representation.
APValue - This class implements a discriminated union of [uninitialized] [APSInt] [APFloat],...
Definition APValue.h:122
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition ASTContext.h:226
ASTNodeTraverser traverses the Clang AST for dumping purposes.
void Visit(const Decl *D, bool VisitLocs=false)
void dumpTemplateParameters(const TemplateParameterList *TPL)
Attr - This represents one attribute.
Definition Attr.h:46
Represents a base class of a C++ class.
Definition DeclCXX.h:146
Represents a C++ struct/union/class.
Definition DeclCXX.h:258
CastExpr - Base class for type casts, including both implicit casts (ImplicitCastExpr) and explicit c...
Definition Expr.h:3679
Declaration of a class template.
A simple visitor class that helps create attribute visitors.
Definition AttrVisitor.h:71
A simple visitor class that helps create declaration visitors.
Definition DeclVisitor.h:75
ConstStmtVisitor - This class implements a simple visitor for Stmt subclasses.
A simple visitor class that helps create template argument visitors.
Decl - This represents one declaration (or definition), e.g.
Definition DeclBase.h:86
bool isCanonicalDecl() const
Whether this particular Decl is a canonical one.
Definition DeclBase.h:984
Represents difference between two FPOptions values.
Declaration of a template function.
AssociationTy< true > ConstAssociation
Definition Expr.h:6415
void VisitClassTemplateDecl(const ClassTemplateDecl *CTD)
void VisitVarTemplateDecl(const VarTemplateDecl *VTD)
JSONNodeDumper & doGetNodeDelegate()
void VisitFunctionTemplateDecl(const FunctionTemplateDecl *FTD)
JSONDumper(raw_ostream &OS, const SourceManager &SrcMgr, ASTContext &Ctx, const PrintingPolicy &PrintPolicy, const comments::CommandTraits *Traits)
void VisitObjCSubscriptRefExpr(const ObjCSubscriptRefExpr *OSRE)
void VisitObjCInterfaceDecl(const ObjCInterfaceDecl *D)
void VisitUnresolvedLookupExpr(const UnresolvedLookupExpr *ULE)
void VisitCleanupAttr(const CleanupAttr *CA)
void VisitCaseStmt(const CaseStmt *CS)
void VisitImplicitCastExpr(const ImplicitCastExpr *ICE)
void VisitNamespaceAliasDecl(const NamespaceAliasDecl *NAD)
void VisitFunctionProtoType(const FunctionProtoType *T)
void VisitAvailabilityAttr(const AvailabilityAttr *AA)
void VisitObjCImplementationDecl(const ObjCImplementationDecl *D)
void VisitVectorType(const VectorType *VT)
void VisitFunctionDecl(const FunctionDecl *FD)
void VisitObjCProtocolExpr(const ObjCProtocolExpr *OPE)
void VisitUsingDecl(const UsingDecl *UD)
void VisitEnumConstantDecl(const EnumConstantDecl *ECD)
void VisitOpenACCRoutineDecl(const OpenACCRoutineDecl *D)
void VisitConstantExpr(const ConstantExpr *CE)
void VisitRequiresExpr(const RequiresExpr *RE)
void VisitExprWithCleanups(const ExprWithCleanups *EWC)
void VisitCXXBoolLiteralExpr(const CXXBoolLiteralExpr *BLE)
void VisitTagType(const TagType *TT)
void Visit(const Attr *A)
void VisitLabelStmt(const LabelStmt *LS)
void VisitRValueReferenceType(const ReferenceType *RT)
void VisitObjCInterfaceType(const ObjCInterfaceType *OIT)
void VisitCXXConstructExpr(const CXXConstructExpr *CE)
void VisitObjCEncodeExpr(const ObjCEncodeExpr *OEE)
void VisitCXXDependentScopeMemberExpr(const CXXDependentScopeMemberExpr *ME)
void VisitStringLiteral(const StringLiteral *SL)
void VisitBlockDecl(const BlockDecl *D)
void VisitCXXDefaultInitExpr(const CXXDefaultInitExpr *Node)
void VisitSizeOfPackExpr(const SizeOfPackExpr *SOPE)
void VisitCXXUnresolvedConstructExpr(const CXXUnresolvedConstructExpr *UCE)
void VisitCXXTypeidExpr(const CXXTypeidExpr *CTE)
void VisitObjCPropertyImplDecl(const ObjCPropertyImplDecl *D)
void VisitAccessSpecDecl(const AccessSpecDecl *ASD)
void VisitDeprecatedAttr(const DeprecatedAttr *DA)
void VisitMemberPointerType(const MemberPointerType *MPT)
void VisitMemberExpr(const MemberExpr *ME)
void visitBlockCommandComment(const comments::BlockCommandComment *C, const comments::FullComment *)
void VisitCXXRecordDecl(const CXXRecordDecl *RD)
void VisitTemplateTemplateParmDecl(const TemplateTemplateParmDecl *D)
void VisitSwitchStmt(const SwitchStmt *SS)
void visitHTMLEndTagComment(const comments::HTMLEndTagComment *C, const comments::FullComment *)
void VisitBinaryOperator(const BinaryOperator *BO)
void visitVerbatimBlockLineComment(const comments::VerbatimBlockLineComment *C, const comments::FullComment *)
void VisitNonTypeTemplateParmDecl(const NonTypeTemplateParmDecl *D)
void VisitTemplateTypeParmDecl(const TemplateTypeParmDecl *D)
void VisitLinkageSpecDecl(const LinkageSpecDecl *LSD)
void VisitTypedefDecl(const TypedefDecl *TD)
void VisitTypedefType(const TypedefType *TT)
void VisitUnresolvedUsingType(const UnresolvedUsingType *UUT)
void VisitSubstTemplateTypeParmPackType(const SubstTemplateTypeParmPackType *T)
void VisitUnaryTransformType(const UnaryTransformType *UTT)
void VisitCallExpr(const CallExpr *CE)
void VisitVisibilityAttr(const VisibilityAttr *VA)
void VisitOpenACCDeclareDecl(const OpenACCDeclareDecl *D)
void VisitCompoundAssignOperator(const CompoundAssignOperator *CAO)
void visitParamCommandComment(const comments::ParamCommandComment *C, const comments::FullComment *FC)
void visitVerbatimBlockComment(const comments::VerbatimBlockComment *C, const comments::FullComment *)
void VisitAtomicExpr(const AtomicExpr *AE)
void VisitLoopControlStmt(const LoopControlStmt *LS)
void VisitUsingShadowDecl(const UsingShadowDecl *USD)
void VisitFloatingLiteral(const FloatingLiteral *FL)
void VisitTemplateTypeParmType(const TemplateTypeParmType *TTPT)
void VisitUsingDirectiveDecl(const UsingDirectiveDecl *UDD)
void VisitTemplateSpecializationType(const TemplateSpecializationType *TST)
void VisitWhileStmt(const WhileStmt *WS)
void VisitDeclarationTemplateArgument(const TemplateArgument &TA)
void VisitVarDecl(const VarDecl *VD)
void VisitEnumDecl(const EnumDecl *ED)
void VisitPackTemplateArgument(const TemplateArgument &TA)
void VisitTemplateExpansionTemplateArgument(const TemplateArgument &TA)
void visitTextComment(const comments::TextComment *C, const comments::FullComment *)
void VisitFieldDecl(const FieldDecl *FD)
void VisitCXXBindTemporaryExpr(const CXXBindTemporaryExpr *BTE)
void VisitIntegralTemplateArgument(const TemplateArgument &TA)
void VisitObjCSelectorExpr(const ObjCSelectorExpr *OSE)
void VisitSYCLUniqueStableNameExpr(const SYCLUniqueStableNameExpr *E)
void VisitDeclRefExpr(const DeclRefExpr *DRE)
void VisitNullPtrTemplateArgument(const TemplateArgument &TA)
void VisitNamespaceDecl(const NamespaceDecl *ND)
void VisitObjCIvarRefExpr(const ObjCIvarRefExpr *OIRE)
void visitVerbatimLineComment(const comments::VerbatimLineComment *C, const comments::FullComment *)
void VisitAutoType(const AutoType *AT)
void VisitObjCIvarDecl(const ObjCIvarDecl *D)
void VisitUnavailableAttr(const UnavailableAttr *UA)
void VisitMacroQualifiedType(const MacroQualifiedType *MQT)
void VisitObjCPropertyDecl(const ObjCPropertyDecl *D)
void VisitObjCMethodDecl(const ObjCMethodDecl *D)
void VisitStructuralValueTemplateArgument(const TemplateArgument &TA)
void visitTParamCommandComment(const comments::TParamCommandComment *C, const comments::FullComment *FC)
void VisitAddrLabelExpr(const AddrLabelExpr *ALE)
void VisitPredefinedExpr(const PredefinedExpr *PE)
void VisitAliasAttr(const AliasAttr *AA)
void VisitObjCCategoryImplDecl(const ObjCCategoryImplDecl *D)
void VisitPackExpansionType(const PackExpansionType *PET)
void VisitDependentSizedExtVectorType(const DependentSizedExtVectorType *VT)
void visitHTMLStartTagComment(const comments::HTMLStartTagComment *C, const comments::FullComment *)
void VisitSectionAttr(const SectionAttr *SA)
void VisitUsingType(const UsingType *TT)
void VisitSubstTemplateTypeParmType(const SubstTemplateTypeParmType *STTPT)
void VisitArrayType(const ArrayType *AT)
void VisitTypeTemplateArgument(const TemplateArgument &TA)
void VisitObjCBoxedExpr(const ObjCBoxedExpr *OBE)
void VisitObjCTypeParamDecl(const ObjCTypeParamDecl *D)
void VisitGenericSelectionExpr(const GenericSelectionExpr *GSE)
void VisitTemplateTemplateArgument(const TemplateArgument &TA)
void VisitCXXDefaultArgExpr(const CXXDefaultArgExpr *Node)
void VisitObjCBoolLiteralExpr(const ObjCBoolLiteralExpr *OBLE)
void VisitFixedPointLiteral(const FixedPointLiteral *FPL)
void VisitGotoStmt(const GotoStmt *GS)
void VisitCharacterLiteral(const CharacterLiteral *CL)
void VisitInitListExpr(const InitListExpr *ILE)
void VisitObjCProtocolDecl(const ObjCProtocolDecl *D)
void VisitTLSModelAttr(const TLSModelAttr *TA)
void VisitCompoundStmt(const CompoundStmt *IS)
void VisitHLSLBufferDecl(const HLSLBufferDecl *D)
void VisitCXXThisExpr(const CXXThisExpr *TE)
void VisitObjCPropertyRefExpr(const ObjCPropertyRefExpr *OPRE)
void VisitConstantArrayType(const ConstantArrayType *CAT)
void VisitObjCCompatibleAliasDecl(const ObjCCompatibleAliasDecl *D)
void VisitCXXNewExpr(const CXXNewExpr *NE)
void VisitOpenACCAsteriskSizeExpr(const OpenACCAsteriskSizeExpr *E)
void VisitObjCAtCatchStmt(const ObjCAtCatchStmt *OACS)
void VisitNullTemplateArgument(const TemplateArgument &TA)
void VisitCastExpr(const CastExpr *CE)
void VisitInjectedClassNameType(const InjectedClassNameType *ICNT)
JSONNodeDumper(raw_ostream &OS, const SourceManager &SrcMgr, ASTContext &Ctx, const PrintingPolicy &PrintPolicy, const comments::CommandTraits *Traits)
void VisitIfStmt(const IfStmt *IS)
void VisitUnaryOperator(const UnaryOperator *UO)
void visitInlineCommandComment(const comments::InlineCommandComment *C, const comments::FullComment *)
void VisitUnaryExprOrTypeTraitExpr(const UnaryExprOrTypeTraitExpr *TTE)
void VisitIntegerLiteral(const IntegerLiteral *IL)
void VisitUsingEnumDecl(const UsingEnumDecl *UED)
void VisitObjCMessageExpr(const ObjCMessageExpr *OME)
void VisitLambdaExpr(const LambdaExpr *LE)
void VisitFunctionType(const FunctionType *T)
void VisitRecordDecl(const RecordDecl *RD)
void VisitTypeAliasDecl(const TypeAliasDecl *TAD)
void VisitExpressionTemplateArgument(const TemplateArgument &TA)
void VisitNamedDecl(const NamedDecl *ND)
void VisitObjCCategoryDecl(const ObjCCategoryDecl *D)
void VisitFriendDecl(const FriendDecl *FD)
void VisitCXXDeleteExpr(const CXXDeleteExpr *DE)
void VisitMaterializeTemporaryExpr(const MaterializeTemporaryExpr *MTE)
void AddChild(Fn DoAddChild)
Add a child of the current node. Calls DoAddChild without arguments.
NodeStreamer(raw_ostream &OS)
void AddChild(StringRef Label, Fn DoAddChild)
Add a child of the current node with an optional label.
llvm::json::OStream JOS
Represents an unpacked "presumed" location which can be presented to the user.
A (possibly-)qualified type.
Definition TypeBase.h:937
Encodes a location in the source.
This class handles loading and caching of source files into memory.
A trivial tuple used to represent a source range.
Stmt - This represents one statement.
Definition Stmt.h:86
Represents a template argument.
The base class of all kinds of template declarations (e.g., class, function, etc.).
NamedDecl * getTemplatedDecl() const
Get the underlying, templated declaration.
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
Base wrapper for a particular "section" of type source info.
Definition TypeLoc.h:59
An operation on a type.
Definition TypeVisitor.h:64
The base class of the type hierarchy.
Definition TypeBase.h:1839
Declaration of a variable template.
This class provides information about commands that can be used in comments.
Any part of the comment.
Definition Comment.h:66
A full comment attached to a declaration, contains block content.
Definition Comment.h:1104
Public enums and private classes that are part of the SourceManager implementation.
The JSON file list parser is used to communicate input to InstallAPI.
bool isa(CodeGen::Address addr)
Definition Address.h:330
AccessSpecifier
A C++ access specifier (public, private, protected), plus the special value "none" which means differ...
Definition Specifiers.h:123
@ TSK_ExplicitInstantiationDefinition
This template specialization was instantiated from a template due to an explicit instantiation defini...
Definition Specifiers.h:206
@ TSK_ExplicitInstantiationDeclaration
This template specialization was instantiated from a template due to an explicit instantiation declar...
Definition Specifiers.h:202
@ TSK_ExplicitSpecialization
This template specialization was declared or defined by an explicit specialization (C++ [temp....
Definition Specifiers.h:198
@ TSK_ImplicitInstantiation
This template specialization was implicitly instantiated from a template.
Definition Specifiers.h:194
@ TSK_Undeclared
This template specialization was formed from a template-id but has not yet been declared,...
Definition Specifiers.h:191
int const char * function
Definition c++config.h:31
Describes how types, statements, expressions, and declarations should be printed.