r348715 - Inline dumpFullComment into callers

Stephen Kelly via cfe-commits cfe-commits at lists.llvm.org
Sun Dec 9 05:18:55 PST 2018


Author: steveire
Date: Sun Dec  9 05:18:55 2018
New Revision: 348715

URL: http://llvm.org/viewvc/llvm-project?rev=348715&view=rev
Log:
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.

Modified:
    cfe/trunk/lib/AST/ASTDumper.cpp

Modified: cfe/trunk/lib/AST/ASTDumper.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTDumper.cpp?rev=348715&r1=348714&r2=348715&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ASTDumper.cpp (original)
+++ cfe/trunk/lib/AST/ASTDumper.cpp Sun Dec  9 05:18:55 2018
@@ -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<FunctionDecl>(*D) && !isa<ObjCMethodDecl>(*D) &&
@@ -2304,12 +2303,6 @@ const char *ASTDumper::getCommandName(un
   return "<not a builtin command>";
 }
 
-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(cons
 void Comment::dump(raw_ostream &OS, const CommandTraits *Traits,
                    const SourceManager *SM) const {
   const FullComment *FC = dyn_cast<FullComment>(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<FullComment>(this);
+  if (!FC)
+    return;
   ASTDumper D(llvm::errs(), nullptr, nullptr, /*ShowColors*/true);
-  D.dumpFullComment(FC);
+  D.dumpComment(FC, FC);
 }




More information about the cfe-commits mailing list