[PATCH] D151747: [llvm-jd] introduces a new tool for diffing JSON

Christopher Di Bella via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 30 12:58:07 PDT 2023


cjdb created this revision.
cjdb added reviewers: aaron.ballman, denik, jroelofs.
Herald added subscribers: mgrang, hiraditya.
Herald added a project: All.
cjdb requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

llvm-jd is a C++ port of [jd], which is a JSON diff tool. It supports the subset
that we need for LLVM.

FileCheck is well-suited to output that follows a particular sequence and where
delta outputs are fairly readable upon inspection. Our JSON output can sometimes
appear in different orders, and due to the structuring of JSON, it's often
difficult to work out where in the JSON object something is. llvm-jd is able to
report the exact position of a diff more directly, and can also take order (or
lack thereof) into account.

[llvm-jd] adds UI I/O

[llvm-jd] adds scalar support

[llvm-jd] adds array support

[llvm-jd] adds object support

[llvm-jd] fixes the output so there's no space between commas

[llvm-jd] sets the return code for diffs to 1

[llvm-jd] adds multiset capabilities

jd supports multisets, which allow us to test JSON arrays without regard
for order.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D151747

Files:
  llvm/CMakeLists.txt
  llvm/docs/llvm-jd.rst
  llvm/include/llvm/ADT/STLExtras.h
  llvm/include/llvm/Support/JSON.h
  llvm/lib/Support/JSON.cpp
  llvm/test/jd/array.txt
  llvm/test/jd/bool.txt
  llvm/test/jd/mset.txt
  llvm/test/jd/number.txt
  llvm/test/jd/object.txt
  llvm/test/jd/string.txt
  llvm/utils/llvm-jd/CMakeLists.txt
  llvm/utils/llvm-jd/README.rst
  llvm/utils/llvm-jd/llvm-jd.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D151747.526753.patch
Type: text/x-patch
Size: 46832 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230530/424a1d92/attachment.bin>


More information about the llvm-commits mailing list