[clang] [clang-format] Handle C# where clause in SeparateDefinitionBlocks (PR #139034)

Owen Pan via cfe-commits cfe-commits at lists.llvm.org
Thu May 8 19:11:18 PDT 2025


================
@@ -137,6 +137,12 @@ void DefinitionBlockSeparator::separateBlocks(
     const auto MayPrecedeDefinition = [&](const int Direction = -1) {
       assert(Direction >= -1);
       assert(Direction <= 1);
+
+      if (Style.isCSharp() &&
+          Lines[OpeningLineIndex]->First->is(TT_CSharpGenericTypeConstraint)) {
+        return true;
+      }
----------------
owenca wrote:

```suggestion
      if (Lines[OpeningLineIndex]->First->is(TT_CSharpGenericTypeConstraint))
        return true;
```

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


More information about the cfe-commits mailing list