[all-commits] [llvm/llvm-project] b2c0c6: [clang-format]: Split alignment of declarations ar...

Gedare Bloom via All-commits all-commits at lists.llvm.org
Wed Jan 10 19:35:15 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b2c0c6f3f2741415d5257e16ca8d4083abe1b487
      https://github.com/llvm/llvm-project/commit/b2c0c6f3f2741415d5257e16ca8d4083abe1b487
  Author: Gedare Bloom <gedare at rtems.org>
  Date:   2024-01-10 (Wed, 10 Jan 2024)

  Changed paths:
    M clang/docs/ClangFormatStyleOptions.rst
    M clang/docs/ReleaseNotes.rst
    M clang/include/clang/Format/Format.h
    M clang/lib/Format/Format.cpp
    M clang/lib/Format/WhitespaceManager.cpp
    M clang/unittests/Format/ConfigParseTest.cpp
    M clang/unittests/Format/FormatTest.cpp

  Log Message:
  -----------
  [clang-format]: Split alignment of declarations around assignment (#69340)

Function pointers are detected as a type of declaration using
FunctionTypeLParen. They are aligned based on rules for
AlignConsecutiveDeclarations. When a function pointer is on the
right-hand side of an assignment, the alignment of the function pointer
can result in excessive whitespace padding due to the ordering of
alignment, as the alignment processes a line from left-to-right and
first aligns the declarations before and after the assignment operator,
and then aligns the assignment operator. Injection of whitespace by
alignment of declarations after the equal sign followed by alignment of
the equal sign results in the excessive whitespace.

Fixes #68079.




More information about the All-commits mailing list