Author: steveire Date: Sun Dec 9 05:20:43 2018 New Revision: 348716 URL: http://llvm.org/viewvc/llvm-project?rev=348716&view=rev Log: Inline hasNodes into only caller
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=348716&r1=348715&r2=348716&view=diff ============================================================================== --- cfe/trunk/lib/AST/ASTDumper.cpp (original) +++ cfe/trunk/lib/AST/ASTDumper.cpp Sun Dec 9 05:20:43 2018 @@ -91,7 +91,6 @@ namespace { void dumpTypeAsChild(const Type *T); void dumpDeclRef(const Decl *Node, const char *Label = nullptr); void dumpBareDeclRef(const Decl *Node) { NodeDumper.dumpBareDeclRef(Node); } - bool hasNodes(const DeclContext *DC); void dumpDeclContext(const DeclContext *DC); void dumpLookups(const DeclContext *DC, bool DumpDecls); void dumpAttr(const Attr *A); @@ -539,15 +538,6 @@ void ASTDumper::dumpDeclRef(const Decl * }); } -bool ASTDumper::hasNodes(const DeclContext *DC) { - if (!DC) - return false; - - return DC->hasExternalLexicalStorage() || - (Deserialize ? DC->decls_begin() != DC->decls_end() - : DC->noload_decls_begin() != DC->noload_decls_end()); -} - void ASTDumper::dumpDeclContext(const DeclContext *DC) { if (!DC) return; @@ -833,9 +823,14 @@ void ASTDumper::dumpDecl(const Decl *D) dumpComment(Comment, Comment); // Decls within functions are visited by the body. - if (!isa<FunctionDecl>(*D) && !isa<ObjCMethodDecl>(*D) && - hasNodes(dyn_cast<DeclContext>(D))) - dumpDeclContext(cast<DeclContext>(D)); + if (!isa<FunctionDecl>(*D) && !isa<ObjCMethodDecl>(*D)) { + auto DC = dyn_cast<DeclContext>(D); + if (DC && + (DC->hasExternalLexicalStorage() || + (Deserialize ? DC->decls_begin() != DC->decls_end() + : DC->noload_decls_begin() != DC->noload_decls_end()))) + dumpDeclContext(DC); + } }); } _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits