[PATCH] D34030: Fix the postorder visting of the ClassTemplateSpecializationDecl nodes in the RecursiveASTVisitor.

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 4 15:17:34 PST 2018


rsmith accepted this revision.
rsmith added a comment.
This revision is now accepted and ready to land.

Generally this looks good.

Is there some way we can prevent this bug from recurring by construction (eg, by making a `return` ill-formed, or making it "just work")? Wrapping the code block in the `DEF_TRAVERSE_*` invocation in a lambda would help, but would probably significantly increase the compile-time (and possibly code size) cost of `RecursiveASTVisitor`, so I'd prefer a different solution if possible. We could move the post-code-block actions into the destructor of an RAII object, but then we can't suppress running them when the code block returns false. Ideas welcome.



================
Comment at: include/clang/AST/RecursiveASTVisitor.h:1587
   TRY_TO(TraverseType(D->getType()));
   return true;
 })
----------------
Same problem here?


================
Comment at: include/clang/AST/RecursiveASTVisitor.h:2430
   TRY_TO(TraverseDecl(S->getBlockDecl()));
   return true; // no child statements to loop through.
 })
----------------
Likewise.


https://reviews.llvm.org/D34030





More information about the cfe-commits mailing list