From 570b297673f58f05bac25b797e90fa9dbc37fe43 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 9 Dec 2018 13:18:55 +0000 Subject: [PATCH] Inline dumpFullComment into callers It causes confusion over whether it or dumpComment is the more important. It is easier to refactor with fewer utility methods. llvm-svn: 348715 --- clang/lib/AST/ASTDumper.cpp | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/clang/lib/AST/ASTDumper.cpp b/clang/lib/AST/ASTDumper.cpp index 1ac604b17976..78f8a9e328a6 100644 --- a/clang/lib/AST/ASTDumper.cpp +++ b/clang/lib/AST/ASTDumper.cpp @@ -84,7 +84,6 @@ namespace { void dumpDecl(const Decl *D); void dumpStmt(const Stmt *S); - void dumpFullComment(const FullComment *C); // Utilities void dumpType(QualType T) { NodeDumper.dumpType(T); } @@ -831,7 +830,7 @@ void ASTDumper::dumpDecl(const Decl *D) { if (const FullComment *Comment = D->getASTContext().getLocalCommentForDeclUncached(D)) - dumpFullComment(Comment); + dumpComment(Comment, Comment); // Decls within functions are visited by the body. if (!isa(*D) && !isa(*D) && @@ -2304,12 +2303,6 @@ const char *ASTDumper::getCommandName(unsigned CommandID) { return ""; } -void ASTDumper::dumpFullComment(const FullComment *C) { - if (!C) - return; - dumpComment(C, C); -} - void ASTDumper::dumpComment(const Comment *C, const FullComment *FC) { dumpChild([=] { if (!C) { @@ -2547,12 +2540,16 @@ LLVM_DUMP_METHOD void Comment::dump(const ASTContext &Context) const { void Comment::dump(raw_ostream &OS, const CommandTraits *Traits, const SourceManager *SM) const { const FullComment *FC = dyn_cast(this); + if (!FC) + return; ASTDumper D(OS, Traits, SM); - D.dumpFullComment(FC); + D.dumpComment(FC, FC); } LLVM_DUMP_METHOD void Comment::dumpColor() const { const FullComment *FC = dyn_cast(this); + if (!FC) + return; ASTDumper D(llvm::errs(), nullptr, nullptr, /*ShowColors*/true); - D.dumpFullComment(FC); + D.dumpComment(FC, FC); }