Issue 161654
Summary [clang-format] `AlignAfterOpenBracket: BlockIndent` fails if bracket starts before `ContinuationIndentWidth`
Labels clang-format
Assignees
Reporter Alunderin
    This is most easily seen on functions with `AlwaysBreakAfterReturnType` enabled or on constructors with short class names.

Given this config:
```yaml
AlignAfterOpenBracket: BlockIndent
AlwaysBreakAfterReturnType: TopLevel
```

This formats as expected:
```cpp
void
LogE(
    std::string_view message,
 std::source_location loc = std::source_location::current()
) {
 std::println(std::cerr, "{}({}): {}", loc.file_name(), loc.line(), message);
}
```

With one less character in the function name, it formats like this:
```cpp
void
Log(std::string_view message,
 std::source_location loc = std::source_location::current()) {
 std::println(std::cerr, "{}({}): {}", loc.file_name(), loc.line(), message);
}
```

It seemingly falls back to using `AlignAfterOpenBracket: DontAlign` if the opening bracket starts before the value of `ContinuationIndentWidth` (`4` by default).

*Tested with version `18.1.3 (Ubuntu)` and `22.0.0git (commit 3c39187)`*
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to