clang  9.0.0
ASTDumper.h
Go to the documentation of this file.
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 
14 
15 namespace clang {
16 
17 class ASTDumper : public ASTNodeTraverser<ASTDumper, TextNodeDumper> {
18 
19  TextNodeDumper NodeDumper;
20 
21  raw_ostream &OS;
22 
23  const bool ShowColors;
24 
25 public:
26  ASTDumper(raw_ostream &OS, const comments::CommandTraits *Traits,
27  const SourceManager *SM)
28  : ASTDumper(OS, Traits, SM, SM && SM->getDiagnostics().getShowColors()) {}
29 
30  ASTDumper(raw_ostream &OS, const comments::CommandTraits *Traits,
31  const SourceManager *SM, bool ShowColors)
32  : ASTDumper(OS, Traits, SM, ShowColors, LangOptions()) {}
33  ASTDumper(raw_ostream &OS, const comments::CommandTraits *Traits,
34  const SourceManager *SM, bool ShowColors,
35  const PrintingPolicy &PrintPolicy)
36  : NodeDumper(OS, ShowColors, SM, PrintPolicy, Traits), OS(OS),
37  ShowColors(ShowColors) {}
38 
39  TextNodeDumper &doGetNodeDelegate() { return NodeDumper; }
40 
41  void dumpLookups(const DeclContext *DC, bool DumpDecls);
42 
43  template <typename SpecializationDecl>
44  void dumpTemplateDeclSpecialization(const SpecializationDecl *D,
45  bool DumpExplicitInst, bool DumpRefOnly);
46  template <typename TemplateDecl>
47  void dumpTemplateDecl(const TemplateDecl *D, bool DumpExplicitInst);
48 
52 };
53 
54 } // namespace clang
55 
56 #endif
Declaration of a variable template.
Describes how types, statements, expressions, and declarations should be printed. ...
Definition: PrettyPrinter.h:37
void dumpTemplateDeclSpecialization(const SpecializationDecl *D, bool DumpExplicitInst, bool DumpRefOnly)
Definition: ASTDumper.cpp:85
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
Definition: LangOptions.h:49
void VisitVarTemplateDecl(const VarTemplateDecl *D)
Definition: ASTDumper.cpp:148
void VisitFunctionTemplateDecl(const FunctionTemplateDecl *D)
Definition: ASTDumper.cpp:137
void dumpLookups(const DeclContext *DC, bool DumpDecls)
Definition: ASTDumper.cpp:25
const SourceManager & SM
Definition: Format.cpp:1572
This class provides information about commands that can be used in comments.
void dumpTemplateDecl(const TemplateDecl *D, bool DumpExplicitInst)
Definition: ASTDumper.cpp:127
ASTDumper(raw_ostream &OS, const comments::CommandTraits *Traits, const SourceManager *SM, bool ShowColors, const PrintingPolicy &PrintPolicy)
Definition: ASTDumper.h:33
ASTNodeTraverser traverses the Clang AST for dumping purposes.
Dataflow Directional Tag Classes.
ASTDumper(raw_ostream &OS, const comments::CommandTraits *Traits, const SourceManager *SM)
Definition: ASTDumper.h:26
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
Definition: DeclBase.h:1271
The base class of all kinds of template declarations (e.g., class, function, etc.).
Definition: DeclTemplate.h:403
ASTDumper(raw_ostream &OS, const comments::CommandTraits *Traits, const SourceManager *SM, bool ShowColors)
Definition: ASTDumper.h:30
Declaration of a class template.
void VisitClassTemplateDecl(const ClassTemplateDecl *D)
Definition: ASTDumper.cpp:144
TextNodeDumper & doGetNodeDelegate()
Definition: ASTDumper.h:39
This class handles loading and caching of source files into memory.
Declaration of a template function.