[cfe-dev] Extracting Clang AST on Windows from Visual Studio solution

Daniel Dilts diltsman at gmail.com
Thu Oct 2 16:16:55 PDT 2014


You can download a Windows build of clang from http://llvm.org/builds/.
This will give you the option in Visual Studio of selecting LLVM/Clang as
the tool chain.  Since this is something along the lines of a plugin it
likely doesn't work for the Express version of visual studio, but it will
work for the Professional and higher versions.

On Thu, Oct 2, 2014 at 3:39 PM, Evgeny Karataev <karataev.evgeny at gmail.com>
wrote:

> Hello Daniel,
>
> Thank you for your reply. I think ClangVSx project (
> https://github.com/ishani/ClangVSx) does exactly what you wrote.
>
> I was just curious if you know if it is possible to substitute a wrapper
> around clang as c compiler in VS somehow?
>
> Such approach works for me with makefile build setup. For example, this
> works:
> make CC=path/to/clang_wrapper.bat
>
> Where clang_wrapper.bat first runs clang with -ast-dump option and
> redirects it to a text file, and then runs clang normally to compile source
> code.
>
> Thank you.
> Best Regards,
> Evgeny
>
> Best Regards,
> Evgeny Karataev
>
> On Thu, Oct 2, 2014 at 5:05 PM, Daniel Dilts <diltsman at gmail.com> wrote:
>
>> It is possible to write a Visual Studio plugin that uses the
>> project/solution information to figure out the set of compile commands to
>> build the project.  At that point you could pass that information to clang
>> and write the output to a file, stdout, etc.
>>
>> On Thu, Oct 2, 2014 at 11:04 AM, Evgeny Karataev <
>> karataev.evgeny at gmail.com> wrote:
>>
>>> Hello,
>>>
>>> I have posted the question below on the cfe-user mailing list, but
>>> didn't get any reply. So I posting it here in hope of any help:
>>>
>>> I am able to dump Clang AST for a single .c or .cpp file with following
>>> command in Windows command prompt:
>>> clang -cc1 -ast-dump -I path_to_MinWG_inlcude source_file.c >
>>> clang_ast_file.txt
>>>
>>> My question is whether it is possible to extract Clang ASTs for all
>>> source files for all projects in a Visual Studio solution without
>>> transforming each project into makefile based build?
>>>
>>> Thank you for any help in advance.
>>>
>>> P.S.: If this is the wrong place to ask this question, please point me
>>> to the correct place. Thank you.
>>>
>>> Best Regards,
>>> Evgeny Karataev
>>>
>>>
>>> _______________________________________________
>>> cfe-dev mailing list
>>> cfe-dev at cs.uiuc.edu
>>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20141002/57aea695/attachment.html>


More information about the cfe-dev mailing list