Clang 3.8 in the May release of Clang with Microsoft CodeGen

Yuriy Solodkyy

This blog post written by Dave Bartolomeo, Yuriy Solodkyy, and Andrew Pardoe

We have just released our fifth out-of-band update of Clang/C2 toolset. As always, this release has been driven by your feedback. While we’ve heard a lot of feature requests the one’s we’ve heard most frequently are that you want Clang 3.8 and you want x64-hosted compilers. We’re happy to say that we’re shipping both Clang 3.8 and x64-hosted compilers in the May 2016 release.

Clang 3.8 is the latest official release of Clang. Moving to Clang 3.8 brings in roughly six months of features and bug fixes from the Clang community. We’ve also added x64-hosted versions of the Clang/C2 compiler toolset. This enables you to compile projects that require more memory than x86 can provide. The x64 Clang/C2 toolset also gives more compatibility with projects that compile with the x64-hosted MSVC toolset.

This post focuses on changes since the last release. For a more detailed discussion of the Clang/C2 toolset please read “Clang with Microsoft CodeGen (March 2016) released” and any of the posts tagged with the keyword “clang”.

This release revises the version of C2.dll to 19.0.25317.0.

How to enable the x64-hosted Clang/C2 compiler

To change your Visual Studio project to use the x64-hosted tools, you need to set the ‘PreferredToolArchitecture’ MSBuild property to ‘x64’. This will set your project to use the x64-hosted version of the entire C++ toolset, whether you’re using Clang/C2 or the MSVC compiler.

There is currently no method to force the 64-bit tools in Visual Studio so you have to edit your .vcxproj file. Insert the following after the <Import...Microsoft.Cpp.Defaults line:

  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
  <PropertyGroup>
    <PreferredToolArchitecture>x64</PreferredToolArchitecture>
  </PropertyGroup>

The edit needs to be made after importing the properties file as it may get changed in one of the files it imports based on your host architecture. If you use -v (Enable Verbose mode in the IDE) in your compiler options, you’ll see the full path to clang.exe in the output–make sure it includes the amd64 subdirectory.

There are more details about this technique in this Stack Overflow post: How to make Visual Studio use the native amd64 toolchain.

If you use a build system other than MSBuild, you’ll need to get your build system to pick up clang.exe from ‘C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\Clang 3.7\bin\amd64\{x86|amd64|arm}\clang.exe’ instead of ‘C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\Clang 3.7\bin\x86\{x86|amd64|arm}\clang.exe’

How to get this update

Through VS Notifications

If you already have the March 2016 update of Clang/C2 installed you should receive a notification in the VS Notifications pane that this update is available. Click on that notification to begin the installation process.

notification2

 

Use the VS installer

  • Navigate to Control Panel->Programs->Programs and Features
  • Right click on “Microsoft Visual Studio Enterprise 2015″
  • Click “Change”
  • Click “Modify”
  • Select “Clang with Microsoft Codegen”. Select the May 2016 release. The previous release is marked as “Deprecated”.
  • Note: Because of very recent changes to the Visual Studio “15” installer, this version of Clang/C2 is only available on Visual Studio 2015, not the next version of Visual Studio.

Create new project

When creating a new project you should see an option for two Clang projects in the Cross Platform section of the Visual C++ templates. Selecting one of these should install or update your Clang/C2 tools to the latest version. Note that we are in the process of removing the version number from the description due to maintenance issues.

newproject

Bug Reporting

When submitting bug reports that are specific to Clang/C2 (i.e. they are not reproducible in Clang/LLVM), make sure to:

  • Submit your issues at https://connect.microsoft.com/VisualStudio
  • Prefix your bug report title with [Clang/C2]
  • When applicable, make sure to include preprocessed source(s) and associated run script(s) that are reported when you encounter an internal compiler error. Search for the string “PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:” in your build log.

As always, we’re eager for you to try out the changes and give us feedback in the comments, by email at clangc2@microsoft.com, or through any of the usual channels: User Voice, Suggestions, Connect (for bugs), or even Send-A-Smile. We love hearing from you!

0 comments

Discussion is closed.

Feedback usabilla icon