[all-commits] [llvm/llvm-project] b7770b: [ClangFormat] Fix formatting bugs. (#76245)

r4nt via All-commits all-commits at lists.llvm.org
Thu Jan 11 04:28:57 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b7770befee37feca3d732d6daf9513c62f75c5f0
      https://github.com/llvm/llvm-project/commit/b7770befee37feca3d732d6daf9513c62f75c5f0
  Author: r4nt <klimek at google.com>
  Date:   2024-01-11 (Thu, 11 Jan 2024)

  Changed paths:
    M clang/lib/Format/FormatToken.h
    M clang/lib/Format/TokenAnnotator.cpp
    M clang/lib/Format/UnwrappedLineFormatter.cpp
    M clang/lib/Format/UnwrappedLineParser.cpp
    M clang/unittests/Format/FormatTestMacroExpansion.cpp

  Log Message:
  -----------
  [ClangFormat] Fix formatting bugs. (#76245)

1. There are multiple calls to addFakeParenthesis; move the guard to not
   assign fake parenthesis into the function to make sure we cover all
   calls.
2. MustBreakBefore can be set on a token in two cases: either during
   unwrapped line parsing, or later, during token annotation. We must
   keep the latter, but reset the former.
3. Added a test to document that the intended behavior of preferring not
   to break between a return type and a function identifier.
   For example, with MOCK_METHOD(r, n, a)=r n a, the code
   MOCK_METHOD(void, f, (int a, int b)) should prefer the same breaks as
   the expanded void f(int a, int b).




More information about the All-commits mailing list