-
Notifications
You must be signed in to change notification settings - Fork 335
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Proposal: Support compiling projects with Clang #1156
Comments
Relevant: microsoft/microsoft-ui-xaml#1045 (comment) The workaround I presented here might still work. Clang not showing up as a build tool is a side effect of the Project Reunion templates effectively creating a ""UWP"" project (from the view of the VS project system, not an actual UWP app) for some reason. My indications regarding coroutines are not useful anymore, as Clang implements C++20 coroutines now. |
Support for building with Clang is why I'm sticking with CMake as a build system for now. It's a PITA, and I'd much rather have official support for Clang/LLVM from within Visual Studio. |
That's |
clang-cl translates MSVC style arguments to something the "real" clang can interpret and will invoke it, this will obviously use the "real" clang frontend and LLVM for codegen (as the platform toolset's name indicates). Passing it What you're thinking of is Clang/C2, which hasn't been supported for quite some time now (and I haven't even found a way to use it in VS 2019, since it has been superseded by the largely superior clang-cl) |
OK, that's interesting. I missed that change, up until now I'd been thinking the For ref, in case anyone else is reading this: |
Scott Jones gave some insight into this in the January 2022 WinUI Community Call here: |
Proposal: Support compiling projects with Clang
Summary
A while ago, support for compiling C++ desktop apps with Clang was added to Visual Studio (see here, here and here). However, projects created using the Project Reunion Visual Studio Extension do not offer to use Clang as the project's platform toolset. Clang support should be extended for such projects.
Rationale
Project Reunion apps that are written in C++ must use C++/WinRT which means that the C++ code is standards conformant and hence theoretically compilable with any modern C++ compiler. Technically, the compiler shouldn't matter because the code will only run on Windows. But we have a C++ cross-platform codebase that targets Android, iOS and Windows and we do run into compatibility issues between Clang and Visual C++.
Code that compiles fine for Android and iOS with Clang fails to compile with Visual C++ for Windows. An example is a large
constexpr
array that compiles with Clang but not with Visual C++. We have opened a bug describing this issue more than two years ago but is still not fixed yet. Another example where the compiler matters is in its supported string size. The Visual C++ compiler emits compiler error C2026 if it deems a string to be too long. Clang uses a different, larger limit for strings and the bug I opened regarding this is even older but still not fixed.There are more examples where C++ compilers are incompatible although they target the same language standard and platform. It is not my intention to put any blame on the Visual C++ compiler team. They simply have more important things to do than fixing those edge case issues. But I want to point out that there are good reasons to compile a codebase with the same compiler everywhere. Although it shouldn't matter it actually does.
Therefore, please consider adding the option to compile projects created using the Project Reunion Visual Studio Extension with Clang.
The text was updated successfully, but these errors were encountered: