Issue 55458
Summary readability-braces-around-statements doesn't work on single-line if statements
Labels
Assignees
Reporter kuszmaul
    If I write
```
if (predicate) foo();
```
I don't get a readability-braces-around-statements warning.

If I write

```
if (predicate) {
  foo();
}
```
I do.

The documentation at https://clang.llvm.org/extra/clang-tidy/checks/readability-braces-around-statements.html says that the default value 0 for `ShortStatementLines` means that braces will be added to all statements not having them already.

I wondered whether I understood the definition of the number-of-lines value for `ShortStatementLines`. I checked and in the second case I get a warning for `ShortStatementLines` set to 1, but not it's set to 2. So it seems like in my first case, the number of lines is in fact 0, and the check ought to be triggered.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to