as far as I understand, clang doesn't fully support the Microsoft
extensions yet. I know there are options like -fms-extensions and others
such as -fdelayed-template-parsing that can be useful. Still I gave it
try with an up-to-date version of clang (VS 2010) for a file that simply
#include <algorithm> and got quite a few errors.
If you include <algorithm> then you must explicitly pass -nobuiltininc
because some clang builtins don't mix well with VS 2010 headers.
clang -nobuiltininc test.cpp
should give no error.
I was told on IRC that there's been recent work in this area. So I'd
like to kindly ask if someone could provide an overview of the current
situation. Basically, an update of the statements from
http://llvm.org/docs/GettingStartedVS.html concerning the Microsoft
environment. Perhaps there's a more detailed list of what can be
expected, what is missing, what's currently on the way, where help is
The current state is that clang will parse all MSVC 2010 standard
headers, all the Windows SDK headers files ( -fsyntax-only).
As for the MSVC 2008 standard headers, clang will choke because on
some missing typename.
clang can *almost* parse most of the MFC code. (4 remaining issues)
I have been a little bit busy lately but I am planning to submit more
patches soon to get clang to parse VS 2008 headers and MFC code.
Notably I have a (almost ready) patch (really a hack!) to be able to
get around the missing typename in MSVC headers.
Unfortunately there is no doc really about what is missing to be more
MSVC compatible. If you want to help I suggest you pick a large MSVC
code base, try to parse it with clang and see the errors and submit
patches to fix them.
As for using clang for CodeGen and linking with MSVC libraries, C code
will work but for C++ there are a lot of works to do.