[PATCH] D55068: NFC: Simplify dumpStmt child handling

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 29 12:15:35 PST 2018


aaron.ballman added inline comments.


================
Comment at: lib/AST/ASTDumper.cpp:1987
 
+    ConstStmtVisitor<ASTDumper>::Visit(S);
+
----------------
Was there something special about calling the Visit methods directly and bailing out? Your code certainly looks reasonable, but I wonder if the output is changed because it goes through the `ConstStmtVisitor` instead of directly dispatching.


================
Comment at: lib/AST/ASTDumper.cpp:1990
     // Some statements have custom mechanisms for dumping their children.
-    if (const DeclStmt *DS = dyn_cast<DeclStmt>(S)) {
-      VisitDeclStmt(DS);
-      return;
-    }
-    if (const GenericSelectionExpr *GSE = dyn_cast<GenericSelectionExpr>(S)) {
-      VisitGenericSelectionExpr(GSE);
+    if (dyn_cast<DeclStmt>(S) || dyn_cast<GenericSelectionExpr>(S)) {
       return;
----------------
These should be `isa<>` checks instead of `dyn_cast<>` checks.


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55068/new/

https://reviews.llvm.org/D55068





More information about the cfe-commits mailing list