[all-commits] [llvm/llvm-project] 5a4ddb: [clang-format] [PR45639] clang-format splits up th...

MyDeveloperDay via All-commits all-commits at lists.llvm.org
Thu May 7 14:02:39 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 5a4ddbd69db2b0e09398214510501d0e59a0c30b
      https://github.com/llvm/llvm-project/commit/5a4ddbd69db2b0e09398214510501d0e59a0c30b
  Author: mydeveloperday <mydeveloperday at gmail.com>
  Date:   2020-05-07 (Thu, 07 May 2020)

  Changed paths:
    M clang/lib/Format/TokenAnnotator.cpp
    M clang/unittests/Format/FormatTest.cpp

  Log Message:
  -----------
  [clang-format] [PR45639] clang-format splits up the brackets of C++17 attribute [[ ]] when used with the first parameter

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

clang-format incorrectly splits the `[[` in a long argument list

```
void SomeLongClassName::ALongMethodNameInThatClass([[maybe_unused]] const shared_ptr<ALongTypeName>& argumentNameForThat
LongType) {

}
```

becomes

```
void SomeLongClassName::ALongMethodNameInThatClass([
    [maybe_unused]] const shared_ptr<ALongTypeName> &argumentNameForThatLongType) {

}
```

leaving one `[` on the previous line

For a function with just 1 very long argument, clang-format chooses to split between the `[[`,

This revision prevents the slip between the two `[` and the second `[`

Reviewed By: krasimir

Subscribers: cfe-commits

Tags: #clang, #clang-format

Differential Revision: https://reviews.llvm.org/D79401




More information about the All-commits mailing list