[PATCH] D100762: [clang][cli] Extract AST dump format into extra option

Alexander Richardson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 22 02:30:30 PDT 2021


arichardson added a comment.

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.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100762



More information about the llvm-commits mailing list