This is an archive of the discontinued LLVM Phabricator instance.

[AST Matchers] Update dump_ast_matchers.py to query only class index page.
ClosedPublic

Authored by jcking1034 on Oct 7 2021, 12:03 PM.

Details

Summary

It may be possible to avoid relying on accessing many individual class pages,
by instead scanning the class index page at
https://clang.llvm.org/doxygen/classes.html. This updates the script to do so,
and includes updates to LibASTMatchersReference.html generated by the
modified script.

Diff Detail

Event Timeline

jcking1034 created this revision.Oct 7 2021, 12:03 PM
jcking1034 requested review of this revision.Oct 7 2021, 12:03 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 7 2021, 12:03 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
jcking1034 retitled this revision from Update dump_ast_matchers.py to query only class index page. to Update `dump_ast_matchers.py` to query only class index page..Oct 7 2021, 12:03 PM
ymandel retitled this revision from Update `dump_ast_matchers.py` to query only class index page. to [AST Matchers] Update dump_ast_matchers.py to query only class index page..Oct 7 2021, 12:04 PM
ymandel edited reviewers, added: aaron.ballman; removed: ymandel.
ymandel added a subscriber: ymandel.

Aaron -- I'm not the right reviewer for this. I've put you as the reviewer, but feel free to re-route if there's someone better. Thanks!

aaron.ballman added inline comments.Oct 7 2021, 12:32 PM
clang/docs/tools/dump_ast_matchers.py
13

Do we need to handle an exception here if there are network issues?

jcking1034 updated this revision to Diff 378037.Oct 7 2021, 4:08 PM

Catch and reraise exceptions with an appropriate message.

jcking1034 added inline comments.Oct 7 2021, 4:09 PM
clang/docs/tools/dump_ast_matchers.py
13

Technically, if there is a network issue, any exceptions would cause the script to terminate. But I think you're right that we should handle this case more carefully.

aaron.ballman accepted this revision.Oct 8 2021, 5:18 AM
aaron.ballman added reviewers: sammccall, klimek.

LGTM, though I'll note I'm by no means a Python expert. I'm adding a few more AST matching folks in case they spot something I've missed, so please give this at least 24 hours before landing.

This revision is now accepted and ready to land.Oct 8 2021, 5:18 AM
sammccall accepted this revision.Oct 8 2021, 5:41 AM

Nice!

clang/docs/tools/dump_ast_matchers.py
48–53

While here I'd add a comment:

"""
Wrap a likely AST node name in a link to its clang docs.

We want to do this only if the page exists, in which case it will be referenced from the class index page.
"""

(You're only adding a bit of conceptual complexity here, but it looks like it's been built up over time...)

jcking1034 updated this revision to Diff 378236.Oct 8 2021, 8:30 AM

Add docstring to link_if_exists.

jcking1034 marked an inline comment as done.Oct 8 2021, 8:34 AM
jcking1034 updated this revision to Diff 378279.Oct 8 2021, 9:41 AM

Rebase onto master