[PATCH] D90221: Include attribute details when dumping AST in JSON

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 27 10:42:25 PDT 2020


aaron.ballman added a comment.

In D90221#2356110 <https://reviews.llvm.org/D90221#2356110>, @aronsky wrote:

> In D90221#2356062 <https://reviews.llvm.org/D90221#2356062>, @lebedev.ri wrote:
>
>> Are there tests missing?
>
> Quite possible. I followed the trail of the existing functions to figure out the difference between JSON and textual dumping, and tried replicating everything in a manner similar to the existing code. I haven't run into any tests, but that's probably because I wasn't looking for those. I'll add the appropriate tests ASAP.

FWIW, the tests for dumping JSON live in `clang\test\AST` and typically have a `-json` extension on them. There is a helper script named `gen_ast_dump_json_test.py` that can be used to generate the expected output from the test.



================
Comment at: clang/lib/AST/JSONNodeDumper.cpp:309-313
+void JSONNodeDumper::dumpBareDeclRef(const Decl *D) { writeBareDeclRef(D); }
+
+void JSONNodeDumper::dumpType(QualType QT) {
+  JOS.attribute("type", createQualType(QT));
+}
----------------
Can you explain why you had to add these two functions?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D90221/new/

https://reviews.llvm.org/D90221



More information about the cfe-commits mailing list