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

Hans Wennborg via cfe-dev cfe-dev at lists.llvm.org
Tue Dec 8 13:52:52 PST 2015


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


More information about the cfe-dev mailing list