[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:34:20 PST 2022


gedare added a comment.

A test case from the GitHub Issue https://github.com/llvm/llvm-project/issues/57250 is attached here: F25258989: test.c <https://reviews.llvm.org/F25258989>

When run without these changes, it yields:
clang-format -style="{BasedOnStyle: LLVM, AlignAfterOpenBracket: BlockIndent}" test.c

  int foo(void) {
    int x = (int
    )(100000 + 200000 + 100000 + 200000 + 100000 + 200000 + 100000 + 200000 +
      100000 + 200000 + 100000 + 200000 + 100000 + 200000 + 100000 + 200000 +
      100000 + 200000);
    int y = 100000 + 200000 + 100000 + 200000 + 100000 + 200000 + 100000 +
            200000 + 100000 + 200000 + 100000 + 200000 + 100000 + 200000 +
            100000 + 200000 + 100000 + 200000;
  }

When run with these changes, it yields:
clang-format -style="{BasedOnStyle: LLVM, AlignAfterOpenBracket: BlockIndent}" test.c

  int foo(void) {
    int x = (int)(100000 + 200000 + 100000 + 200000 + 100000 + 200000 + 100000 +
                  200000 + 100000 + 200000 + 100000 + 200000 + 100000 + 200000 +
                  100000 + 200000 + 100000 + 200000);
    int y = 100000 + 200000 + 100000 + 200000 + 100000 + 200000 + 100000 +
            200000 + 100000 + 200000 + 100000 + 200000 + 100000 + 200000 +
            100000 + 200000 + 100000 + 200000;
  }


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