1 | //===--- ASTDumper.h - Dumping implementation for ASTs --------------------===// |
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 | #ifndef LLVM_CLANG_AST_ASTDUMPER_H |
10 | #define LLVM_CLANG_AST_ASTDUMPER_H |
11 | |
12 | #include "clang/AST/ASTNodeTraverser.h" |
13 | #include "clang/AST/TextNodeDumper.h" |
14 | #include "clang/Basic/SourceManager.h" |
15 | |
16 | namespace clang { |
17 | |
18 | class ASTDumper : public ASTNodeTraverser<ASTDumper, TextNodeDumper> { |
19 | |
20 | TextNodeDumper NodeDumper; |
21 | |
22 | raw_ostream &OS; |
23 | |
24 | const bool ShowColors; |
25 | |
26 | public: |
27 | ASTDumper(raw_ostream &OS, const ASTContext &Context, bool ShowColors) |
28 | : NodeDumper(OS, Context, ShowColors), OS(OS), ShowColors(ShowColors) {} |
29 | |
30 | ASTDumper(raw_ostream &OS, bool ShowColors) |
31 | : NodeDumper(OS, ShowColors), OS(OS), ShowColors(ShowColors) {} |
32 | |
33 | TextNodeDumper &doGetNodeDelegate() { return NodeDumper; } |
34 | |
35 | void dumpInvalidDeclContext(const DeclContext *DC); |
36 | void dumpLookups(const DeclContext *DC, bool DumpDecls); |
37 | |
38 | template <typename SpecializationDecl> |
39 | void dumpTemplateDeclSpecialization(const SpecializationDecl *D, |
40 | bool DumpExplicitInst, bool DumpRefOnly); |
41 | template <typename TemplateDecl> |
42 | void dumpTemplateDecl(const TemplateDecl *D, bool DumpExplicitInst); |
43 | |
44 | void VisitFunctionTemplateDecl(const FunctionTemplateDecl *D); |
45 | void VisitClassTemplateDecl(const ClassTemplateDecl *D); |
46 | void VisitVarTemplateDecl(const VarTemplateDecl *D); |
47 | }; |
48 | |
49 | } // namespace clang |
50 | |
51 | #endif |
52 | |