[clang] [clang] Add `clang::behaves_like_std(...)` attribute (PR #76596)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 1 06:47:34 PST 2024


AaronBallman wrote:

One question I have is related to:

> Last year MSVC added [[msvc::intrinsic]] for us game devs [here](https://github.com/MicrosoftDocs/cpp-docs/blob/main/docs/cpp/attributes.md#msvcintrinsic). This was explicitly added as an attribute under the request of us since a lot of us have custom STLs.
Clang currently lacks such an attribute which means we can't fully move onto ClangCL until we have a similar facility. It would also be helpful to have this attribute for our other platforms which are mostly console vendors and mobile who supply their own fork of clang but more on that below.

Clang supports attributes in the `msvc` vendor namespace already (`[[msvc::no_unique_address]]`, `[[msvc::constexpr]]`) under `-fms-extensions` mode, so would a potential approach be supporting `[[msvc::intrinsic]]` for compatibility? (I realize that feature may not be ideal, but we do aim for cross-compiler compatibility for important use cases, so rather than redesign something similar-but-different, I think it may be more useful to implement the compatible extension first and build new functionality from there.)

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


More information about the cfe-commits mailing list