Clang with Microsoft CodeGen: A VS 2015 Update 1 Gem
It's just one facet of the recent Visual Studio 2015 Update 1 release, but it's one that Visual C++ developers are excited to deploy. The update also includes numerous fixes to the standard library.
The Visual C++ team has introduced a new toolset in preview aimed at allowing code written with Visual C++ to be compiled and parsed for a number of differing platforms and targets. Clang with Microsoft CodeGen is a compiler that pairs up an open source version of the Clang parser with Visual C++'s code generator, optimizer and compiler.
Dave Bartolomeo with the Visual C++ team writes in a blog post that the goal is to allow developers using Visual C++ to use "the same Clang parser that you use for other targets, while still taking advantage of the advanced optimizations from the Visual C++ optimizer when you build for Windows."
"Because the new toolset uses the same Clang parser used for non-Windows targets, you won't need to have annoying #ifdefs throughout the code just to account for differences between the compilers," explains Bartolomeo, in the post. "Also, your code can take advantage of language features that are not currently available in the Visual C++ compiler, including C99 complex types and C++14 extended constexpr support. And because the Clang-based compiler generates the same debug information format as the Visual C++ compiler, you'll still be able to debug your code with the same great Visual Studio debugger experience."
Related to Bartolomeo's post, a few days earlier Visual C++ team member Cody Miller blogged about support for C++ 11-variety constant expressions that are part of the Visual Studio 2015 Update 1 release. An issue that reared up its head during development, wrote Miller, was that the compiler was having a problem with emitting static initializers. "Although the compiler had enough information to emit fully instantiated types that could be loaded from the compiled executable, it didn't emit the fully instantiated types," he explained. "These types were instantiated and constructed at runtime, as most C++ objects traditionally have been." Update 1 ships with the issue resolved.
Visual Studio 2015 Update 1 also includes a vast list of fixes to the Visual C++ Standard Library, noted here and in several links embedded in that link.
You Tell 'Em, Readers: If you've read this far, know that Michael Domingo, Visual Studio Magazine Editor in Chief, is here to serve you, dear readers, and wants to get you the information you so richly deserve. What news, content, topics, issues do you want to see covered in Visual Studio Magazine? He's listening at [email protected].