Clang/LLVM on Windows Update

Clang和LLVM团队已成功改善了工具链,使其能更好地构建与Visual C++兼容的原生Windows程序。除了调试信息和异常处理外,所有C++特性都已得到良好支持。最近的里程碑包括实现Microsoft兼容的记录布局,支持所有调用约定,完成运行时类型信息(RTTI),并实现了lambda表达式的支持。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Clang/LLVM on Windows Update

It’s time for an update on Clang’s support for building native Windows programs, compatible with Visual C++! We’ve been working hard over the last few months and have improved the toolchain in a variety of ways. All C++ features aside from debug info and exceptions should work well. This link provide more specific details. In February we reached an exciting milestone that we can self-host Clang and LLVM using clang-cl (without fallback), and both projects pass all of their tests! Additionally both Chrome and Firefox now compile successfully with fallback! Here are some of the highlights of recent improvements:

Microsoft compatible record layout is done! It’s been thoroughly fuzz tested and supports all Microsoft specific components such as virtual base table pointers, vtordisps, __declspec(align) and #pragma pack. This turned out to be a major effort due to subtle interactions between various features. For example, __declspec(align) and #pragma pack behave in an analogous manner to the gcc variants, but interact with each other in a different manner. Each version of Visual Studio changes the ABI slightly. As of today clang-cl is layout compatible with VS2013.

Clang now supports all of the calling conventions used up to VS2012. VS2013 added some new ones that we haven’t implemented yet. One of the other major compatibility challenges we overcame was passing C++ objects by value on 32-bit x86. Prior to this effort, LLVM modeled all outgoing arguments as SSA values, making it impossible to take the address of an argument to a call. It turns out that on Windows C++ objects passed by value are constructed directly into the argument memory used for the function call. Achieving 100% compatibility in this area required making fundamental changes to LLVM IR to allow us to compute this address.

Most recently support for run time type information (RTTI) was completed. With RTTI support, a larger set of programs and libraries (for example ICU) compile without fallback and dynamic_cast and typeid both work. RTTI support also brings along support for std::function. We also recently added support for lambdas so you can enjoy all of the C++11 functional goodness!

We invite you to try it out for yourself and, as always, we encourage everyone to file bugs!

Posted by Unknown at 8:34 PM

Labels: Clang

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值