[Openmp-commits] [openmp] [flang] [mlir] [lldb] [clang-tools-extra] [llvm] [libcxx] [lld] [compiler-rt] [clang] [clang] Add `intrin0.h` header to mimic `intrin0.h` used by MSVC STL for clang-cl (PR #75711)

Max Winkler via Openmp-commits openmp-commits at lists.llvm.org
Wed Jan 10 08:55:42 PST 2024


MaxEW707 wrote:

> Users (Chromium included) use recent versions of Clang that are not vendored by Microsoft. Users can also use the LLVM OSS releases. I think most users probably won't notice the compile time regression, and it will silently go away the next time the update MSVC, but if they do and they care (and this should be in the release notes), it would be nice to have a macro to get the old behavior. 

I thought of another solution this morning that can work. Looks like we already have precedent with redefining macros in clang's interposing MSVC headers. `vadefs.h` for example.

MSVC STL would like to replace [_STL_INTRIN_HEADER](https://github.com/microsoft/STL/blob/main/stl/inc/yvals_core.h#L2038) macro with just `#include <intrin0.h>` when they support the version of clang shipped with `intrin0.h`.

We could provide our own `yvals_core.h` header like so:
```
#include_next <yvals_core.h>

#if defined(_MSC_VER_) && defined(_STL_INTRIN_HEADER)
#undef _STL_INTRIN_HEADER
#define _STL_INTRIN_HEADER #include <intrin0.h>
#endif
```

This should also fix users upgrading clang while still building against an older MSVC STL. Once MSVC STL moves forward we can probably remove this interposing header sometime in the future.

https://github.com/llvm/llvm-project/pull/75711


More information about the Openmp-commits mailing list