This is an archive of the discontinued LLVM Phabricator instance.

[clang] Fix JSON AST output when a filter is used
ClosedPublic

Authored by woodruffw on Aug 19 2021, 8:15 PM.

Details

Summary

Without this, the combination of -ast-dump=json and -ast-dump-filter FILTER produces invalid JSON: the first line is a string that says Dumping $SOME_DECL_NAME: .

Diff Detail

Event Timeline

woodruffw requested review of this revision.Aug 19 2021, 8:15 PM
woodruffw created this revision.
woodruffw updated this revision to Diff 367938.Aug 20 2021, 8:08 PM

Updated the AST dump tests for JSON to refute the presence of the Dumping prefix.

Also, updated the gen_ast_dump_json_test.py generator to work with Python 3 and to behave better without the presence of the Dumping: sentinels.

Gentle ping for review on this!

Another gentle ping for review.

woodruffw updated this revision to Diff 372595.Sep 14 2021, 5:15 PM

Increase the context for the patch.

Another gentle ping for review.

aaron.ballman accepted this revision.Sep 30 2021, 8:10 AM

The changes LGTM, though I'm not an expert in python.

This revision is now accepted and ready to land.Sep 30 2021, 8:10 AM
xgupta added a subscriber: xgupta.Oct 8 2021, 8:04 PM

@woodruffw Please rebase the patch. clang/test/AST/ast-dump-if-json.cpp testcase is not applying cleanly. If you don't commit access, I can commit on your behalf. Thanks.

woodruffw updated this revision to Diff 378476.Oct 9 2021, 2:11 PM

Resolve conflicts.

This revision was automatically updated to reflect the committed changes.