[clang] [Clang] Implement -fkeep-inline-functions (PR #218533)

Hubert Tong via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 24 17:49:39 PDT 2026


================
@@ -0,0 +1,42 @@
+// -fkeep-inline-functions has an effect without optimization, although it is
+// primarily useful with optimization enabled.
+
+// RUN: %clang_cc1 -O2 -fkeep-inline-functions -emit-llvm %s -o - -triple x86_64-unknown-linux-gnu | FileCheck %s
+// RUN: %clang_cc1 -O0 -fkeep-inline-functions -emit-llvm %s -o - -triple x86_64-unknown-linux-gnu | FileCheck %s
+// RUN: %clang_cc1 -O2 -fkeep-inline-functions -emit-llvm %s -o - -triple powerpc64-ibm-aix-xcoff | FileCheck %s
+// RUN: %clang_cc1 -O2 -fkeep-inline-functions -fgnu89-inline -emit-llvm %s -o - -triple powerpc64-ibm-aix-xcoff | FileCheck %s --check-prefix=CHECK-GNU89
+
+// Retained:
+//   f1  static inline
+//   f2  plain inline under -fgnu89-inline
+//   f5  C99 external definition with external linkage
+//       retained under both C99 and -fgnu89-inline
----------------
hubert-reinterpretcast wrote:

```suggestion
//   f5  C99 external definition with external linkage;
//       considered plain inline under -fgnu89-inline
```

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


More information about the cfe-commits mailing list