[PATCH] D100762: [clang][cli] Extract AST dump format into extra option
Aaron Ballman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Apr 22 04:17:06 PDT 2021
aaron.ballman added a comment.
In D100762#2707823 <https://reviews.llvm.org/D100762#2707823>, @arichardson wrote:
> In D100762#2707812 <https://reviews.llvm.org/D100762#2707812>, @jansvoboda11 wrote:
>
>> If `-ast-dump=json` was a driver flag, it would be trivial to pass `-ast-dump -ast-dump-format json` to -cc1 instead. However, aliasing a single option to two options within the -cc1 argument parser isn't possible at the moment AFAIK. I can look into how much work adding that capability would be.
>>
>> @arichardson Can you point me to the external consumers?
>
> I just did the following search and saw that there are multiple stack overflow answers etc. recommending the use of `-Xclang -ast-dump=json`: https://www.google.com/search?q=%22-ast-dump%3Djson%22
>
> I am not sure how many actual consumers there are, but I think it would be good to keep this option to avoid surprises for users. While they probably shouldn't be using internal -cc1 options, this is the only documented way of getting an AST dump.
This gets used on Compiler Explorer as it's the only way to get a JSON dump from that interface. e.g., https://godbolt.org/z/3nf6fvfYz
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D100762/new/
https://reviews.llvm.org/D100762
More information about the cfe-commits
mailing list