Open brevzin opened 1 year ago
We use clang-tblgen to generate the code to handle dumping text nodes but we do not have the same thing for dumping JSON nodes. I I think it would be a reasonable feature to support, however.
https://github.com/llvm/llvm-project/blob/5348a25377652c5e32f9a85754da7231cb9bf9f6/clang/utils/TableGen/ClangAttrEmitter.cpp#L4473 is where the logic lives for dumping textual nodes, and we'd need something similar for JSON.
This isn't quite good-first-issue
material because it involves tablegen, but it is a good first issue for anyone wanting to learn more about Clang's tablegen.
Consider this simple example:
If I do the normal
ast-dump
, you can see the typeClass
, with the memberint
, with the attached annotationmeow
:If I do
-ast-dump=json
, I get a JSON file that looks like this. It is 298 lines long, so I'll just snip the relevant part: what we get formember
:meow
does not appear here. I just get the range of tokens with their contents. This is correct (the attribute is is col 7:29 - that's all ofclang::annotate("meow")
, and walking the tree up I can get that it's on line 2), but it'd be nicer if I additionally got the actual annotate contents:"meow"
.