This is an archive of the discontinued LLVM Phabricator instance.

[Syntax] Support condition for IfStmt.
ClosedPublic

Authored by hokein on Feb 1 2021, 6:26 AM.

Diff Detail

Event Timeline

hokein requested review of this revision.Feb 1 2021, 6:26 AM
hokein created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptFeb 1 2021, 6:26 AM
sammccall accepted this revision.Feb 1 2021, 8:49 AM
sammccall added inline comments.
clang/lib/Tooling/Syntax/BuildTree.cpp
803

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 revision is now accepted and ready to land.Feb 1 2021, 8:49 AM
hokein added inline comments.Feb 4 2021, 12:29 AM
clang/lib/Tooling/Syntax/BuildTree.cpp
803

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 :)

This revision was landed with ongoing or failed builds.Feb 4 2021, 12:30 AM
This revision was automatically updated to reflect the committed changes.