[PATCH] D56960: NFC: Implement GenericSelectionExpr::Association dump with Visitor

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 21 05:27:05 PST 2019


aaron.ballman added inline comments.


================
Comment at: lib/AST/ASTDumper.cpp:1476-1477
 
   for (unsigned I = 0, N = E->getNumAssocs(); I != N; ++I) {
-    dumpChild([=] {
-      const auto Assoc = E->getAssociation(I);
-      const TypeSourceInfo *TSI = Assoc.getTypeSourceInfo();
-      if (TSI) {
-        OS << "case ";
-        NodeDumper.dumpType(TSI->getType());
-      } else {
-        OS << "default";
-      }
-
-      if (Assoc.IsSelected())
-        OS << " selected";
-
-      if (TSI)
-        dumpTypeAsChild(TSI->getType());
-      dumpStmt(Assoc.getExpr());
-    });
+    Visit(E->getAssociation(I));
   }
----------------
aaron.ballman wrote:
> You can change this to be a range-based for loop over the associations to clean it up even further. `for (const auto *A = E->getAssocExprs())`
Ah, I see now that this is over the new `Association` objects, not the old `Expr *` objects. I'll add comments on the other review, but same guideline here.


Repository:
  rC Clang

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

https://reviews.llvm.org/D56960





More information about the cfe-commits mailing list