[PATCH] D137762: [clang-format] avoid breaking )( with BlockIndent

Gedare Bloom via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 9 21:44:15 PST 2022


gedare added a comment.

Another test case for function pointers is here: F25259090: tmp.c <https://reviews.llvm.org/F25259090>

Before applying these changes, it is:

  clang-format -style="{BasedOnStyle: LLVM, AlignAfterOpenBracket: BlockIndent}" tmp.c
  int foo(long l) { return l; }
  
  int main() {
    int (*abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ012345679
    )(long) = foo;
  
    (*abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ012345679
    )(100000000000L);
  }

After applying these changes, it is:

  clang-format -style="{BasedOnStyle: LLVM, AlignAfterOpenBracket: BlockIndent}" tmp.c
  int foo(long l) { return l; }
  
  int main() {
    int (*abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ012345679)(
        long
    ) = foo;
  
    (*abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ012345679)(
        100000000000L
    );
  }

The function pointer declaration is still a little strange-looking, but I believe it is more in line with the intent behind the BlockIndent style.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D137762/new/

https://reviews.llvm.org/D137762



More information about the cfe-commits mailing list