diff options
Diffstat (limited to 'clang/lib/AST/ASTDumper.cpp')
| -rw-r--r-- | clang/lib/AST/ASTDumper.cpp | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/clang/lib/AST/ASTDumper.cpp b/clang/lib/AST/ASTDumper.cpp index ac3c652d470..5d6e18a4506 100644 --- a/clang/lib/AST/ASTDumper.cpp +++ b/clang/lib/AST/ASTDumper.cpp @@ -220,7 +220,7 @@ namespace { void dumpName(const NamedDecl *D); bool hasNodes(const DeclContext *DC); void dumpDeclContext(const DeclContext *DC); - void dumpLookups(const DeclContext *DC); + void dumpLookups(const DeclContext *DC, bool DumpDecls); void dumpAttr(const Attr *A); // C++ Utilities @@ -569,7 +569,7 @@ void ASTDumper::dumpDeclContext(const DeclContext *DC) { } } -void ASTDumper::dumpLookups(const DeclContext *DC) { +void ASTDumper::dumpLookups(const DeclContext *DC, bool DumpDecls) { IndentScope Indent(*this); OS << "StoredDeclsMap "; @@ -602,9 +602,26 @@ void ASTDumper::dumpLookups(const DeclContext *DC) { RI != RE; ++RI) { if (RI + 1 == RE) lastChild(); - dumpDeclRef(*RI); + + IndentScope LookupIndent(*this); + dumpBareDeclRef(*RI); + if ((*RI)->isHidden()) OS << " hidden"; + + // If requested, dump the redecl chain for this lookup. + if (DumpDecls) { + // Dump earliest decl first. + std::function<void(Decl*)> DumpPrev = [&](Decl *D) { + if (Decl *Prev = D->getPreviousDecl()) { + DumpPrev(Prev); + dumpDecl(Prev); + } + }; + DumpPrev(*RI); + lastChild(); + dumpDecl(*RI); + } } } @@ -2169,13 +2186,14 @@ LLVM_DUMP_METHOD void DeclContext::dumpLookups() const { dumpLookups(llvm::errs()); } -LLVM_DUMP_METHOD void DeclContext::dumpLookups(raw_ostream &OS) const { +LLVM_DUMP_METHOD void DeclContext::dumpLookups(raw_ostream &OS, + bool DumpDecls) const { const DeclContext *DC = this; while (!DC->isTranslationUnit()) DC = DC->getParent(); ASTContext &Ctx = cast<TranslationUnitDecl>(DC)->getASTContext(); ASTDumper P(OS, &Ctx.getCommentCommandTraits(), &Ctx.getSourceManager()); - P.dumpLookups(this); + P.dumpLookups(this, DumpDecls); } //===----------------------------------------------------------------------===// |

