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