[PATCH] D70119: Improve gen_ast_dump_json_test.py

Alexander Richardson via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 12 04:16:24 PST 2019


arichardson created this revision.
arichardson added reviewers: aaron.ballman, rsmith.
Herald added subscribers: cfe-commits, mgorny.
Herald added a project: clang.

It is now possible to use --update to update the CHECK: lines instead of
generating a new file and the --clang/--opts/--filters arguments are no
longer required.
It should address all the issues listed in D69564 <https://reviews.llvm.org/D69564>

This is a series of 7 small commits, but it's probably easier to review the squashed diff.

---

Add a --update flag to gen_ast_dump_json_test.py

This will allow updating the JSON tests for new format changes. Instead of
simply appending the JSON to the input file, the script will now make a
copy of the input file up to the "CHECK lines have been autogenerated"
disclaimer and then append the new JSON.

---

Parse RUN: line for gen_ast_dump_json_test.py with --update

---

Infer --filters flags when using gen_ast_dump_json_test.py --update

---

Skip manual tests when using gen_ast_dump_json_tests.py --update

---

[gen_ast_dump_json_test.py] Copy to binary directory to omit --clang argument

The script will now check if a clang binary exists in the same directory
and default to that instead of requiring a --clang argument. The script
is copied to the clang build directory using CMake configure_file() with
COPYONLY. This ensures that the version in the build directory is updated
any time the source version changes.

---

[gen_ast_dump_json_test.py] Allow updating multiple files in one go

With this change it is possible to update all JSON dump tests using the
following command:
python $LLVM_BINDIR/gen_ast_dump_json_test.py --update --source $LLVM_SRC/clang/test/AST/*-json.*

---

[NFC] Regenerate ast-dump-json tests

Only changes are whitespace and line endings.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D70119

Files:
  clang/test/AST/ast-dump-decl-json.m
  clang/test/AST/ast-dump-expr-json.c
  clang/test/AST/gen_ast_dump_json_test.py
  clang/test/CMakeLists.txt

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D70119.228856.patch
Type: text/x-patch
Size: 403357 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20191112/a23115bf/attachment-0001.bin>


More information about the cfe-commits mailing list