[all-commits] [llvm/llvm-project] 63d665: [clang-format] Fix support for ObjC blocks with po...

Egor Zhdan via All-commits all-commits at lists.llvm.org
Mon Jul 17 06:48:06 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 63d6659a045d2e014d53ae890eec8b3cd96e5805
      https://github.com/llvm/llvm-project/commit/63d6659a045d2e014d53ae890eec8b3cd96e5805
  Author: Jared Grubb <jaredgrubb+github at gmail.com>
  Date:   2023-07-17 (Mon, 17 Jul 2023)

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

  Log Message:
  -----------
  [clang-format] Fix support for ObjC blocks with pointer return types

The ObjC-block detection code only supports a single token as the return type. Add support to detect pointers, too (ObjC has lots of object-pointers).

For example, using `BasedOnStyle: WebKit`, the following is stable output:

```
int* p = ^int*(void)
{ //
    return nullptr;
}
();
```

After the patch, this is stable:

```
int* p = ^int*(void) { //
    return nullptr;
}();
```

Differential Review: https://reviews.llvm.org/D146434




More information about the All-commits mailing list