[PATCH] D95782: [Syntax] Support condition for IfStmt.
Haojian Wu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Feb 4 00:29:46 PST 2021
hokein added inline comments.
================
Comment at: clang/lib/Tooling/Syntax/BuildTree.cpp:803
+ bool TraverseIfStmt(IfStmt *S) {
+ bool Result = [&, this]() {
----------------
sammccall wrote:
> is it clear to you what all this code is doing?
> It does seem to fit the pattern used elsewhere, it just looks pretty different than the RAVs I've seen in the pass (e.g. overriding WalkUp functions).
>
> It seems correct, but I think I'll need to study later.
this is also my first time to see the pattern of overriding WalkUp function etc.
The purpose of overriding the `TraverseIfStmt` is that the default implementation (which traverses the implicit condition expression which has the same location of the condition variable decl) seems to violate the invariant of foldNode (`fold should not crosses boundaries of existing subtrees`).
I think the `TraverseCXXForRangeStmt` below follows the same patten :)
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D95782/new/
https://reviews.llvm.org/D95782
More information about the cfe-commits
mailing list