21 #include "llvm/Support/raw_ostream.h" 22 using namespace clang;
26 NodeDumper.AddChild([=] {
27 OS <<
"StoredDeclsMap ";
28 NodeDumper.dumpBareDeclRef(cast<Decl>(DC));
33 NodeDumper.dumpPointer(cast<Decl>(Primary));
38 auto Range = getDeserialize()
41 for (
auto I = Range.begin(), E = Range.end(); I != E; ++I) {
45 NodeDumper.AddChild([=] {
46 OS <<
"DeclarationName ";
49 OS <<
'\'' << Name <<
'\'';
54 NodeDumper.AddChild([=] {
55 NodeDumper.dumpBareDeclRef(*RI);
57 if ((*RI)->isHidden())
63 std::function<void(Decl *)> DumpWithPrev = [&](
Decl *D) {
75 if (HasUndeserializedLookups) {
76 NodeDumper.AddChild([=] {
78 OS <<
"<undeserialized lookups>";
84 template <
typename SpecializationDecl>
86 bool DumpExplicitInst,
88 bool DumpedAny =
false;
89 for (
const auto *RedeclWithBadType : D->redecls()) {
93 auto *Redecl = dyn_cast<SpecializationDecl>(RedeclWithBadType);
97 assert(isa<CXXRecordDecl>(RedeclWithBadType) &&
98 "expected an injected-class-name");
102 switch (Redecl->getTemplateSpecializationKind()) {
105 if (!DumpExplicitInst)
111 NodeDumper.dumpDeclRef(Redecl);
123 NodeDumper.dumpDeclRef(D);
126 template <
typename TemplateDecl>
132 for (
const auto *Child : D->specializations())
133 dumpTemplateDeclSpecialization(Child, DumpExplicitInst,
141 dumpTemplateDecl(D,
true);
145 dumpTemplateDecl(D,
false);
149 dumpTemplateDecl(D,
false);
158 llvm::errs() << msg <<
": ";
171 LLVM_DUMP_METHOD
void Type::dump(llvm::raw_ostream &OS)
const {
181 LLVM_DUMP_METHOD
void Decl::dump(raw_ostream &OS,
bool Deserialize,
194 P.setDeserialize(Deserialize);
208 dumpLookups(llvm::errs());
213 bool Deserialize)
const {
217 ASTContext &Ctx = cast<TranslationUnitDecl>(DC)->getASTContext();
221 P.setDeserialize(Deserialize);
222 P.dumpLookups(
this, DumpDecls);
230 dump(llvm::errs(), SM);
249 ASTDumper P(llvm::errs(),
nullptr,
nullptr,
true);
258 dump(llvm::errs(),
nullptr,
nullptr);
279 ASTDumper D(llvm::errs(),
nullptr,
nullptr,
true);
Defines the clang::ASTContext interface.
A (possibly-)qualified type.
Defines the SourceManager interface.
Defines the clang::Module class, which describes a module in the source code.
Decl - This represents one declaration (or definition), e.g.
NamedDecl * getTemplatedDecl() const
Get the underlying, templated declaration.
Decl * getPreviousDecl()
Retrieve the previous declaration that declares the same entity as this declaration, or NULL if there is no previous declaration.
Declaration of a variable template.
bool hasExternalVisibleStorage() const
Whether this DeclContext has external storage containing additional declarations that are visible in ...
lookups_range noload_lookups(bool PreserveInternalState) const
void Visit(const Decl *D)
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
The results of name lookup within a DeclContext.
void dumpColor() const
dumpColor - same as dump(), but forces color highlighting.
void dumpTemplateDeclSpecialization(const SpecializationDecl *D, bool DumpExplicitInst, bool DumpRefOnly)
void VisitVarTemplateDecl(const VarTemplateDecl *D)
static void dump(llvm::raw_ostream &OS, StringRef FunctionName, ArrayRef< CounterExpression > Expressions, ArrayRef< CounterMappingRegion > Regions)
const clang::PrintingPolicy & getPrintingPolicy() const
static const TerminalColor DeclNameColor
DiagnosticsEngine & getDiagnostics() const
lookups_range lookups() const
void VisitFunctionTemplateDecl(const FunctionTemplateDecl *D)
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
bool isCanonicalDecl() const
Whether this particular Decl is a canonical one.
ASTDumpOutputFormat
Used to specify the format for printing AST dump information.
void dumpLookups(const DeclContext *DC, bool DumpDecls)
comments::CommandTraits & getCommentCommandTraits() const
DeclContext * getParent()
getParent - Returns the containing DeclContext.
This template specialization was implicitly instantiated from a template.
void dumpTemplateDecl(const TemplateDecl *D, bool DumpExplicitInst)
This template specialization was instantiated from a template due to an explicit instantiation defini...
This template specialization was formed from a template-id but has not yet been declared, defined, or instantiated.
Dataflow Directional Tag Classes.
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
The base class of all kinds of template declarations (e.g., class, function, etc.).
This template specialization was instantiated from a template due to an explicit instantiation declar...
The name of a declaration.
void dump() const
Dumps the specified AST fragment and all subtrees to llvm::errs().
This template specialization was declared or defined by an explicit specialization (C++ [temp...
SourceManager & getSourceManager()
Declaration of a class template.
void VisitClassTemplateDecl(const ClassTemplateDecl *D)
void dump(const char *s) const
DeclContext * getPrimaryContext()
getPrimaryContext - There may be many different declarations of the same entity (including forward de...
bool isTranslationUnit() const
This class handles loading and caching of source files into memory.
Defines enum values for all the target-independent builtin functions.
Declaration of a template function.
static const TerminalColor UndeserializedColor