[all-commits] [llvm/llvm-project] 975d56: [clang-tidy] Add new check readability-trailing-co...

Baranov Victor via All-commits all-commits at lists.llvm.org
Sat Jan 31 11:44:07 PST 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 975d56272e353d6a9772de53de4270c0617b01a2
      https://github.com/llvm/llvm-project/commit/975d56272e353d6a9772de53de4270c0617b01a2
  Author: Baranov Victor <bar.victor.2002 at gmail.com>
  Date:   2026-01-31 (Sat, 31 Jan 2026)

  Changed paths:
    M clang-tools-extra/clang-tidy/readability/CMakeLists.txt
    M clang-tools-extra/clang-tidy/readability/ReadabilityTidyModule.cpp
    A clang-tools-extra/clang-tidy/readability/TrailingCommaCheck.cpp
    A clang-tools-extra/clang-tidy/readability/TrailingCommaCheck.h
    M clang-tools-extra/docs/ReleaseNotes.rst
    M clang-tools-extra/docs/clang-tidy/checks/list.rst
    A clang-tools-extra/docs/clang-tidy/checks/readability/trailing-comma.rst
    A clang-tools-extra/test/clang-tidy/checkers/readability/trailing-comma-cxx11.cpp
    A clang-tools-extra/test/clang-tidy/checkers/readability/trailing-comma-cxx20-remove.cpp
    A clang-tools-extra/test/clang-tidy/checkers/readability/trailing-comma-cxx20.cpp
    A clang-tools-extra/test/clang-tidy/checkers/readability/trailing-comma-remove.cpp
    A clang-tools-extra/test/clang-tidy/checkers/readability/trailing-comma-wrong-config.cpp
    A clang-tools-extra/test/clang-tidy/checkers/readability/trailing-comma.c
    A clang-tools-extra/test/clang-tidy/checkers/readability/trailing-comma.cpp

  Log Message:
  -----------
  [clang-tidy] Add new check readability-trailing-comma (#173669)

clang-format has a couple of similar options:

https://clang.llvm.org/docs/ClangFormatStyleOptions.html#enumtrailingcomma
- add trailing commas for enum

https://clang.llvm.org/docs/ClangFormatStyleOptions.html#inserttrailingcommas
- add trailing commas for C++
but generally they are marked with such warning:

> Warning
>
> Setting this option to any value other than Leave could lead to
incorrect code formatting due to clang-format’s lack of complete
semantic information. As such, extra care should be taken to review code
changes made by this option.

clang-tidy on the other hand has all semantic information, thus can
(hopefully) provide 0 false-positives.

Note that we have already overlapping checks in clang-format/clang-tidy
like:
https://clang.llvm.org/docs/ClangFormatStyleOptions.html#insertbraces vs
https://clang.llvm.org/extra/clang-tidy/checks/readability/braces-around-statements.html



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list