Page MenuHomePhabricator

NFC: Implement AST node skipping in ParentMapContext
ClosedPublic

Authored by steveire on Jan 24 2020, 4:03 PM.

Details

Summary

This allows ASTContext to store only one parent map, rather than storing
an entire parent map for each traversal mode used.

This is therefore a partial revert of commit 0a717d5b (Make it possible
control matcher traversal kind with ASTContext, 2019-12-06).

Diff Detail

Event Timeline

steveire created this revision.Jan 24 2020, 4:03 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 24 2020, 4:03 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
steveire updated this revision to Diff 240318.Jan 24 2020, 4:09 PM

constness

Harbormaster completed remote builds in B44890: Diff 240318.
steveire retitled this revision from Implement AST node skipping in ParentMapContext to NFC: Implement AST node skipping in ParentMapContext.Jan 24 2020, 4:11 PM
rsmith accepted this revision.Jan 24 2020, 6:59 PM

This seems reasonable to me.

If you want to unify something about this and the Ignore* functions in Expr, maybe we could add a "classify" mechanism, so you could ask "what kind of node is this?" and get back an enumerated value that indicates whether it's semantic / syntactic / whatever. Then we could implement both this and the downward-skipping in terms of that.

This revision is now accepted and ready to land.Jan 24 2020, 6:59 PM

This seems reasonable to me.

If you want to unify something about this and the Ignore* functions in Expr, maybe we could add a "classify" mechanism, so you could ask "what kind of node is this?" and get back an enumerated value that indicates whether it's semantic / syntactic / whatever. Then we could implement both this and the downward-skipping in terms of that.

That seems like a reasonable future refactoring yes. I agree we can progress with this patch for now though.

This revision was automatically updated to reflect the committed changes.