[cfe-dev] Using clang-cl with -emit-ast

Daniel Kats via cfe-dev cfe-dev at lists.llvm.org
Tue Dec 8 13:56:41 PST 2015


I sent another email about the -ast-dump, but basically the Python clang
bindings aren't able to read it from disk after it's been saved.

Details in this stackoverflow question:
https://stackoverflow.com/questions/34162906/parsing-ast-generated-by-clang-with-clang-python-bindings

I will get started with implementing exposing the flag. Hopefully I'll have
a patch in the next few days :)

On Tue, 8 Dec 2015 at 16:53 Hans Wennborg <hans at chromium.org> wrote:

> If you just want to look at the AST, you can use -Xclang -ast-dump.
>
> If you really need -emit-ast from clang-cl, the way to expose it would
> be add Flags<[CoreOption]> to emit_ast in
> include/clang/Driver/Options.td, and check that it works. If it does,
> you can send a patch for it :-)
>
>  - Hans
>
> On Tue, Dec 8, 2015 at 1:42 PM, Daniel Kats <dbkats at gmail.com> wrote:
> > I'm using clang on Windows to generate an AST from header files for some
> > driver research I'm doing for my Ph.D. I found setting environment flags
> to
> > be a pain. What would be necessary to expose this flag from clang-cl?
> >
> > On Tue, 8 Dec 2015 at 16:17 Hans Wennborg <hans at chromium.org> wrote:
> >>
> >> Hi Daniel,
> >>
> >> On Tue, Dec 8, 2015 at 11:46 AM, Daniel Kats via cfe-dev
> >> <cfe-dev at lists.llvm.org> wrote:
> >> > How to call clang-cl with -emit-ast command-line argument? I tried
> >> > -Xclang
> >> > -emit-ast and got "unknown argument: -emit-ast"
> >>
> >> It doesn't work with -Xclang, because -emit-ast is a driver flag, not
> >> a frontend flag.
> >>
> >> clang-cl could probably expose this flag if it's useful, but in
> >> general its focus is on MSVC-compatible flags. What do you need it
> >> for?
> >>
> >>  - Hans
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20151208/e11ebdeb/attachment.html>


More information about the cfe-dev mailing list