[PATCH] D20382: Add postorder support to RecursiveASTVisitor

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 27 12:18:28 PDT 2016

rsmith added inline comments.

Comment at: include/clang/AST/RecursiveASTVisitor.h:630-635
@@ -593,1 +629,8 @@
+  if (getDerived().shouldTraversePostOrder()) {
+    for (auto Iter = ReverseLocalQueue.rbegin();
+         Iter != ReverseLocalQueue.rend(); ++Iter) {
+      TRY_TO(PostVisitStmt(*Iter));
+    }
+  }
Does this really give a postorder traversal rather than some kind of postorder / reverse preorder hybrid (based on whether we use data recursion or regular recursion for different parts of the graph)?

I would expect the right way to handle this would be to call `PostVisitStmt` from the `if (Visited)` branch above, where we call `dataTraverseStmtPost`.


More information about the cfe-commits mailing list