[clang] [clang] Add support for MSVC force inline attrs (PR #185282)

Trung Nguyen via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 31 06:30:43 PDT 2026


================
@@ -934,7 +927,8 @@ def AlignNatural : InheritableAttr {
 
 def AlwaysInline : DeclOrStmtAttr {
   let Spellings = [GCC<"always_inline">, CXX11<"clang", "always_inline">,
-                   C23<"clang", "always_inline">, CustomKeyword<"__forceinline">];
+                   C23<"clang", "always_inline">, CustomKeyword<"__forceinline">,
+                   CXX11<"msvc", "forceinline">, C23<"msvc", "forceinline">];
----------------
trungnt2910 wrote:

`LangOpts` like `[[msvc::constexpr]]` would make more sense - I don't think we should artificially restrict this one to Microsoft targets. They might be useful for, say, compiling code written on Windows with `winelib` on Linux.

However, I am not sure how `LangOpts` could be applied to only a few specific spellings. Therefore, I am doing the guards in C++ instead.

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


More information about the cfe-commits mailing list