[all-commits] [llvm/llvm-project] fa6025: [clang-format] Don't confuse initializer equal sig...

Emilia Kond via All-commits all-commits at lists.llvm.org
Mon Jan 22 04:57:49 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: fa6025e25b5754e8cf39169e3a7085b57ea35de5
      https://github.com/llvm/llvm-project/commit/fa6025e25b5754e8cf39169e3a7085b57ea35de5
  Author: Emilia Kond <emilia at rymiel.space>
  Date:   2024-01-22 (Mon, 22 Jan 2024)

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

  Log Message:
  -----------
  [clang-format] Don't confuse initializer equal signs in for loops (#77712)

clang-format has logic to align declarations of multiple variables of
the same type, aligning them at the equals sign. This logic is applied
in for loops as well. However, this alignment logic also erroneously
affected the equals signs of designated initializers.

This patch forbids alignment if the token 2 tokens back from the equals
sign is a designated initializer period.

Fixes https://github.com/llvm/llvm-project/issues/73902




More information about the All-commits mailing list