gribozavr2 added inline comments.

================
Comment at: clang/lib/Tooling/Syntax/BuildTree.cpp:1048
+  syntax::Tree *ChildNode;
+  if (Expr *ChildExpr = dyn_cast<Expr>(Child)) {
+    // This is an expression in a statement position, consume the trailing
----------------
eduucaldas wrote:
> I thought this treatement of derived class should be done by 
> RecursiveASTVisitor 
> This is kinda the task of WalkUpFrom*, unfortunately WalkUpFromThis follows 
> the order:
> WalkUpFromBase;
> VisitThis;
> 
> And we would've wanted the opposite order:
> VisitThis
> WalkUpFromBase
> 
Unfortunately I don't see how to implement this behavior (cheaply) in the 
visitation methods of RecursiveASTVisitor. The crux of the issue is that we are 
inserting a syntax tree node (ExpressionStatement) that does not correspond to 
any semantic AST node. We want to do it for every Expr that appears in a Stmt 
position -- so we need to know the parent node, or in this case, more 
precisely, that this Expr node is in a Stmt position.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D81019



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to