しばやん雑記

Azure とメイドさんが大好きなフリーランスのプログラマーのブログ

Visual Studio 2015 Preview では LLVM / Clang が使えるようになっている話

タイトルは釣りっぽいですが、実際に若干釣りです。Visual Studio 2015 Preview で追加された C++ の Cross Platform Mobile Native Tool をインストールすると、Android 向けに Clang 3.4 が使えるようになりました。

ちゃんとプラットフォームツールセットには Clang 3.4 の文字があります。

f:id:shiba-yan:20141115185430p:plain

設定ダイアログも Clang 専用に作られているみたいなので、ターゲットにする C や C++ のバージョンを任意に選択できたりします。

f:id:shiba-yan:20141115185442p:plain

なので設定を少し変えるだけで constexpr などが普通に使えるようになっています。コマンドラインオプションを見ているだけで、ちょっと不思議な気分に。

f:id:shiba-yan:20141115192657p:plain

正直 constexpr など C++11/14 などの知識が全然無いため、Sprout C++ Library Wiki にあった VC++ ではコンパイルが通らないコードで試してみました。

コンパイラ性能比較 - Sprout C++ Library Wiki

Boost 1.33 で知識が止まってるのは、流石にちょっとやばい。ひとまずは詳しい人にお任せしたい気分(

一応 Visual C++ チームのブログに少しだけ記述があるので、関連する部分だけ引用してきました。

C++ is attractive because it offers portability and a chance to reuse the same code on different platforms. With Visual Studio 2015 Preview, modern application developers can use the Visual C++ tool chain (c1xx, c2) to target Microsoft Windows Platforms and Clang / LLVM for targeting Android (with plans to support iOS in the near future).

Visual Studio 2015 Preview is Now Available - Visual C++ Team Blog - Site Home - MSDN Blogs

Visual Studio 2015 Preview (download here) introduces support for developers to be able to build cross-platform mobile native (C/C++) binaries targeting Windows platforms (through the Visual C++ toolchain C1xx/C2) and the Android platform (through Clang/LLVM toolchain).

Cross-Platform Mobile Development with Visual C++ - Visual C++ Team Blog - Site Home - MSDN Blogs

iOS のサポートも将来的に考えられているとのことで、LLVM / Clang の導入はそういった意味でも必須だったのでしょう。ちなみに Windows 向けには今までの MS 謹製 C++ コンパイラが使われるので注意。