[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 07:36:11 PDT 2026


================
@@ -0,0 +1,16 @@
+// RUN: %clang_cc1 -std=c++23 -emit-llvm %s -triple x86_64-pc-windows-msvc -o - | FileCheck %s
+
+[[msvc::forceinline]] void func() {}
+
+void call_func() {
+// CHECK-LABEL: @"?call_func@@YAXXZ"()
+// CHECK-NOT: call void @"?func@@YAXXZ"()
+  func();
+}
+
+void call_lambda() {
+// CHECK-LABEL: @"?call_lambda@@YAXXZ"()
+// CHECK-NOT: call void @"??R<lambda_
----------------
trungnt2910 wrote:

Updated the tests to check for the attributes instead.

I still feel that this is not testing the actual thing we need (which is the call site vanishing) - it will be a false pass if something is wrong with the attribute and the function did not get inlined.

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


More information about the cfe-commits mailing list