https://bugs.llvm.org/show_bug.cgi?id=48906

            Bug ID: 48906
           Summary: Excessive breaks around return-type-requirement with
                    BraceWrapping: AfterFunction: true or
                    AfterControlStatement: MultiLine
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Formatter
          Assignee: unassignedclangb...@nondot.org
          Reporter: johel...@gmail.com
                CC: djas...@google.com, johel...@gmail.com,
                    kli...@google.com, llvm-bugs@lists.llvm.org

This was mentioned in [D79773](https://reviews.llvm.org/D79773#2138304).

> Since a compound requirement is neither a control statement nor a function, I 
> suppose it might eventually need its own BraceWrapping nested configuration 
> flag. For now, I'd prefer if they never break.

---

Input and expected formatted result:
```C++
template <typename T>
concept EqualityComparable = requires(T a, T b) {
  { a == b } -> bool;
};
```

.clang-format:
```
BraceWrapping:
  AfterFunction: true
BreakBeforeBraces: Custom
```

Actual output:
```C++
template <typename T>
concept EqualityComparable = requires(T a, T b)
{
  {
    a == b
    } -> bool;
};
```

.clang-format:
```
BraceWrapping:
  AfterControlStatement: MultiLine
BreakBeforeBraces: Custom
```

Actual output:
```C++
template <typename T>
concept EqualityComparable = requires(T a, T b) {
  {
    a == b
    } -> bool;
};
```

---

.clang-format:
```
BraceWrapping:
  AfterFunction: true
BreakBeforeBraces: Custom
```

Input and expected formatted result:
```C++
template <typename T> void f(T) requires requires(T a, T b) {
  { a == b } -> bool;
}
{}
```

Actual output:
```C++
template <typename T> void f(T) requires requires(T a, T b)
{
  {
    a == b
    } -> bool;
} {}
```

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to