[all-commits] [llvm/llvm-project] df6f4b: [clang-format] Defer formatting of operator< to ho...

Emilia Dreamer via All-commits all-commits at lists.llvm.org
Thu Nov 17 01:39:09 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: df6f4b85138f86be73d58ff3f511df5306cc4b4d
      https://github.com/llvm/llvm-project/commit/df6f4b85138f86be73d58ff3f511df5306cc4b4d
  Author: Emilia Dreamer <emilia at rymiel.space>
  Date:   2022-11-17 (Thu, 17 Nov 2022)

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

  Log Message:
  -----------
  [clang-format] Defer formatting of operator< to honor paren spacing

I'm not exactly sure what the intent of that section of
`spaceRequiredBetween` is doing, it seems to handle templates and <<,
but the part which adds spaces before parens is way later, as part
of `spaceRequiredBeforeParens`.

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

Reviewed By: HazardyKnusperkeks, owenpan, MyDeveloperDay

Differential Revision: https://reviews.llvm.org/D137474


  Commit: 48a932e13e04a21f4422d962bf1bb4667a670e41
      https://github.com/llvm/llvm-project/commit/48a932e13e04a21f4422d962bf1bb4667a670e41
  Author: Emilia Dreamer <emilia at rymiel.space>
  Date:   2022-11-17 (Thu, 17 Nov 2022)

  Changed paths:
    M clang/lib/Format/WhitespaceManager.cpp
    M clang/unittests/Format/TokenAnnotatorTest.cpp

  Log Message:
  -----------
  [clang-format] Remove special case for kw_operator when aligning decls

This change breaks no existing tests but does fix the linked issue.
Declarations of operator overloads are annotated with
`TT_FunctionDeclarationName` on the `operator` keyword, which is already
being checked for when aligning, so the extra `kw_operator` doesn't seem
to be necessary. (just for reference, it was added in
rG92b397fb9d55ccdf4632c2b1b15b4a0ee417cf74 / 92b397fb9d55ccdf4632c2b1b15b4a0ee417cf74)

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

Reviewed By: HazardyKnusperkeks, owenpan

Differential Revision: https://reviews.llvm.org/D137223


Compare: https://github.com/llvm/llvm-project/compare/9729b6930b41...48a932e13e04


More information about the All-commits mailing list