================
@@ -1472,6 +1483,30 @@ static void expandPresetsSpacesInParens(FormatStyle 
&Expanded) {
   Expanded.SpacesInParensOptions = {};
 }
 
+static void expandPresetsShortFunctionsOnSingleLine(FormatStyle &Expanded) {
+  if (Expanded.AllowShortFunctionsOnASingleLine == FormatStyle::SFS_Custom)
+    return;
+  // Reset all flags
+  Expanded.AllowShortFunctionsOnASingleLineOptions = {};
+
+  if (Expanded.AllowShortFunctionsOnASingleLine == FormatStyle::SFS_None)
+    return;
+
+  if (Expanded.AllowShortFunctionsOnASingleLine == FormatStyle::SFS_Empty ||
+      Expanded.AllowShortFunctionsOnASingleLine == FormatStyle::SFS_Inline) {
+    Expanded.AllowShortFunctionsOnASingleLineOptions.Empty = true;
+  }
+
+  if (Expanded.AllowShortFunctionsOnASingleLine == FormatStyle::SFS_Inline ||
+      Expanded.AllowShortFunctionsOnASingleLine ==
+          FormatStyle::SFS_InlineOnly) {
+    Expanded.AllowShortFunctionsOnASingleLineOptions.Inline = true;
+  }
+
+  if (Expanded.AllowShortFunctionsOnASingleLine == FormatStyle::SFS_All)
+    Expanded.AllowShortFunctionsOnASingleLineOptions.Other = true;
----------------
owenca wrote:

```suggestion
  switch (Expanded.AllowShortFunctionsOnASingleLine) {
  case FormatStyle::SFS_All:
    Expanded.AllowShortFunctionsOnASingleLineOptions.Inline = true;
    Expanded.AllowShortFunctionsOnASingleLineOptions.Other = true;
    [[fallthrough]];
  case FormatStyle::SFS_Empty:
    Expanded.AllowShortFunctionsOnASingleLineOptions.Empty = true;
    break;
  case FormatStyle::SFS_Inline:
    Expanded.AllowShortFunctionsOnASingleLineOptions.Empty = true;
    [[fallthrough]];
  case FormatStyle::SFS_InlineOnly:
    Expanded.AllowShortFunctionsOnASingleLineOptions.Inline = true;
  }
    break;
  default:
    break;
```
Use `switch` like other expansions.

https://github.com/llvm/llvm-project/pull/134337
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to