[all-commits] [llvm/llvm-project] f66d60: [clang-format] Fix wrong indentation after trailin...

Marek Kurdej via All-commits all-commits at lists.llvm.org
Wed Dec 22 23:22:24 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: f66d602c3f58bd8a312c79bb404eac9dabf1a730
      https://github.com/llvm/llvm-project/commit/f66d602c3f58bd8a312c79bb404eac9dabf1a730
  Author: Marek Kurdej <marek.kurdej+llvm.org at gmail.com>
  Date:   2021-12-23 (Thu, 23 Dec 2021)

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

  Log Message:
  -----------
  [clang-format] Fix wrong indentation after trailing requires clause.

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

Before this patch, clang-format would wrongly parse top-level entities (e.g. namespaces) and format:
```
template<int I>
constexpr void foo requires(I == 42) {}
namespace ns {
void foo() {}
}  // namespace ns
```
into:
``````
template<int I>
constexpr void foo requires(I == 42) {}
namespace ns {
  void foo() {}
}  // namespace ns
```
with configuration:
```
NamespaceIndentation: None
````

Reviewed By: MyDeveloperDay, HazardyKnusperkeks, owenpan

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




More information about the All-commits mailing list