[all-commits] [llvm/llvm-project] 418b4a: [clang-format] Respect spaces in line comment sect...

kuzkry via All-commits all-commits at lists.llvm.org
Mon Mar 1 12:29:03 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 418b4a7b3158b47043c4c8891eb2e27966a55fa2
      https://github.com/llvm/llvm-project/commit/418b4a7b3158b47043c4c8891eb2e27966a55fa2
  Author: Björn Schäpers <bjoern at hazardy.de>
  Date:   2021-03-01 (Mon, 01 Mar 2021)

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

  Log Message:
  -----------
  [clang-format] Respect spaces in line comment section...

... without an active column limit.

Before line comments were not touched at all with ColumnLimit == 0.

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


  Commit: 6ca52815fb3cb32343b9a008fdf9f593da39f203
      https://github.com/llvm/llvm-project/commit/6ca52815fb3cb32343b9a008fdf9f593da39f203
  Author: Krystian Kuzniarek <krystian.kuzniarek at gmail.com>
  Date:   2021-03-01 (Mon, 01 Mar 2021)

  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/NamespaceEndCommentsFixer.cpp
    M clang/unittests/Format/NamespaceEndCommentsFixerTest.cpp

  Log Message:
  -----------
  [clang-format][PR47290] Add ShortNamespaceLines format option

clang-format documentation states that having enabled
FixNamespaceComments one may expect below code:

c++
namespace a {
foo();
}

to be turned into:

c++
namespace a {
foo();
} // namespace a

In reality, no "// namespace a" was added. The problem was too high
value of kShortNamespaceMaxLines, which is used while deciding whether
a namespace is long enough to be formatted.

As with 9163fe2, clang-format idempotence is preserved.

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


Compare: https://github.com/llvm/llvm-project/compare/8174f33dc9bf...6ca52815fb3c


More information about the All-commits mailing list