| Issue |
55473
|
| Summary |
[clang-format] AlignAfterOpenBracket: BlockIndent: weird close-bracket when ')' or qualifiers exceeds ColumnLimit
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
svs590
|
Hello!
I'm using clang-format 14 with option ```AlignAfterOpenBracket: BlockIndent``` and I found strange сlosing brackets behavior when close bracket or following qualifiers exceed ```ColumnLimit```. This case appears when ```return-type``` + ```function-name``` + ```arguments``` can place on one line, but ```) + qualifiers``` cannot.
Here is an example of .clang-format file:
```
# BasedOnStyle: LLVM
AlignAfterOpenBracket: BlockIndent
AllowAllArgumentsOnNextLine: true
AllowShortFunctionsOnASingleLine: Empty
BinPackArguments: false
BinPackParameters: false
BreakBeforeBraces: Custom
BraceWrapping:
AfterFunction: false
ColumnLimit: 82
ContinuationIndentWidth: 4
IndentWidth: 4
PenaltyReturnTypeOnItsOwnLine: 41
PointerAlignment: Right
SpaceAroundPointerQualifiers: Both
TabWidth : 4
UseTab : Never
...
```
Here is an **example** when ```AlignAfterOpenBracket: BlockIndent``` **works fine**:
```
std::string some_function(const std::string &a, const std::string &b) noexcept {
// Some code here...
}
std::string some_function(
const std::string &a,
const std::string &b,
const std::string &c,
const std::string &d
) noexcept {
// Some code here...
}
void check_range(const std::size_t &idx) noexcept {
// Some code here...
}
```
Everything is just as I expected.
But if I increase function name length or add some function attributes (e.g. MACRO), then I have weird behavior: only ```) + qualifiers``` places on the next line.
**Example:**
```
void check_range_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(const std::size_t &idx
) {
// Some code here...
}
void check_range_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(const std::size_t &idx
) noexcept {
// Some code here...
}
CXX17_NODISCARD CXX20_CONSTEXPR void check_range(const std::size_t &idx
) noexcept {
// Some code here...
}
```
**Expected:**
```
void check_range_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(
const std::size_t &idx
) {
// Some code here...
}
void check_range_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(
const std::size_t &idx
) noexcept {
// Some code here...
}
CXX17_NODISCARD CXX20_CONSTEXPR void check_range(
const std::size_t &idx
) noexcept {
// Some code here...
}
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs