[clang] [clang] Add support for MSVC force inline attrs (PR #185282)
Trung Nguyen via cfe-commits
cfe-commits at lists.llvm.org
Fri May 22 16:25:41 PDT 2026
================
@@ -5181,6 +5181,18 @@ OptimizeNoneAttr *Sema::mergeOptimizeNoneAttr(Decl *D,
}
static void handleAlwaysInlineAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
+ AlwaysInlineAttr AIA(S.Context, AL);
+ if (!S.getLangOpts().MicrosoftExt &&
----------------
trungnt2910 wrote:
> That's expected behavior -- we diagnose when attributes are ignored. You get the same behavior with other attributes: https://godbolt.org/z/sGn87r3o6
`[[msvc::constexpr]]` is a weird semi-undocumented attribute - it is not specified on the official Microsoft Docs and only explained on the [Visual Studio Feedback](https://developercommunity.visualstudio.com/t/10259132#T-N10259447) page when a LLVM contributor specifically asked them about it.
Many other less esoteric `[[msvc::` attributes are left unguarded, such as the opposite of the newly added attributes, `[[msvc::noinline]]`: https://godbolt.org/z/W8519n6d1
https://github.com/llvm/llvm-project/pull/185282
More information about the cfe-commits
mailing list