Today Microsoft release Update 1 for Visual Studio 2015. It includes option to use clang frontend for compiler!
I tried to compile latest Handmade Hero - but it's not very easy :(
First of all - all the build.bat must be rewritten. Clang MSVC ships with doesn't provide clang-cl.exe which would understand MSVC style options. Also it doesn't understand link options, so compile and link commands must be split and executed separately. IDE integration of course is much simpler (just change one combo-box in project properties and that's it).
When I patched build.bat, there was couple of issues - it doesn't have _WriteBarrier definition, only declaration. Declaration is commented out in intrin.h:
| //static __inline__ void __DEFAULT_FN_ATTRS
//__attribute__((__deprecated__("use other intrinsics or C++11 atomics instead")))
//_WriteBarrier(void) {
// __asm__ volatile ("" : : : "memory");
//}
|
But that is easily patchable (just replace WriteBarrier with inline asm). After that I could at least build win32_handmade.exe and simple_preprocessor.exe files. But there are problems with compiling handmade_optimized.cpp file. Compiler fails with internal error:
https://gist.github.com/mmozeiko/e8f11c6041c7c0008842
No idea why they don't support _mm_cvtps_epi32 intrinsic.
But anyways. We're getting closer for using clang :) It's pretty cool - it produces much better warning/error messages from compiler than MSVC.
Backend for is still the same, so no changes in codegen (I'm guessing for compatibility reasons).