Clang AddIn for Visual Studio 2010

Hello all,

For anyone hacking with Clang on Windows alongside the MSVC toolchain (like
me!), I've put together a 'compiler bridge' that will let you build
executables from inside Visual Studio using Clang as a drop-in replacement
for the MSVC compiler.

It emulates (most of) the VS build pipeline and translates VC project
settings into arguments that Clang understands. Still early days, but so far
it can compile a modest range of test projects successfully (including some
DirectX bits and pieces). I've also added entries to the code window context
menu for doing static analysis on single files. Works a treat.

Source and built executables are available on GitHub:
https://github.com/ishani/ClangVSx

As the readme states, there are a few things you might need to patch in
Clang (has links to bug #s) to get Win32 apps building cleanly. Your mileage
will vary!

-h

That's really great. Writing such a plugin was on my todo list but I
am glad you did it before me.
I'll try your tool very soon.

You mention that a IUnknown hack is required to parse a DirectX
project. I suppose your hack is to add a "class IUnknown;" forward
declaration at the beginning. You can use the clang option
-fdelayed-template-parsing instead. The problem is that IUnknown is
used in template code before it is defined.

As for clang not be able to parse the MFC/ATL projects. Just to let
you know I am working on this problem now. At the pace I am going, I
estimate we are 2-3 months away from that goal.

Hi Francois,

Glad it might come in useful! Please feedback any problems or suggestions,
they will be warmly received.

Francois Pichet wrote:

You mention that a IUnknown hack is required to parse a DirectX
project. I suppose your hack is to add a "class IUnknown;" forward
declaration at the beginning. You can use the clang option
-fdelayed-template-parsing instead. The problem is that IUnknown is
used in template code before it is defined.

Excellent, thanks for the heads up, will give it a try.

Francois Pichet wrote:

As for clang not be able to parse the MFC/ATL projects. Just to let
you know I am working on this problem now. At the pace I am going, I
estimate we are 2-3 months away from that goal.

If there is anything I can do to help, let me know. Next on my list is to
develop out those bug-fixes mentioned in the readme and post them in as
patch contributions... would be good to have Clang interop with the MSVC
linker out-of-the-box with some more complex Win32 apps.

-h