[clang] [clang-format]: Add `StaticInlineOnly` and `StaticInline` options to `ShortFunctionStyle` (PR #133598)

Björn Schäpers via cfe-commits cfe-commits at lists.llvm.org
Sat Mar 29 14:22:14 PDT 2025


================
@@ -335,6 +336,32 @@ class LineJoiner {
         }
       }
 
+      if (Style.AllowShortFunctionsOnASingleLine ==
+              FormatStyle::SFS_StaticInlineOnly ||
+          Style.AllowShortFunctionsOnASingleLine ==
+              FormatStyle::SFS_StaticInline) {
+        // Check if the current line belongs to a static inline function
+        const auto *FirstNonCommentToken =
+            TheLine ? TheLine->getFirstNonComment() : nullptr;
+
+        // Look for 'static' and 'inline' keywords in any order
----------------
HazardyKnusperkeks wrote:

```suggestion
        // Look for 'static' and 'inline' keywords in any order.
```

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


More information about the cfe-commits mailing list