[clang] [clang-format] Add BreakBeforeTemplateCloser option (PR #118046)

via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 6 10:46:33 PST 2025


leijurv wrote:

> Can this option be used to format any template like std::remove_cv_t<add_common_cv_reference<std::common_type_t<std::decay_t, std::decay_t>,T0,T1>>;?

Yes! In fact, that exact case is tested.

https://github.com/llvm/llvm-project/commit/d2b45ce100d641a8f1690e30843bb9c5ea71ab86#diff-3f6f57cda9809a57c5b79e22b4181b3f3aaac7216262d0ef44108f39b0443e9bR11276-R11290

```c++
  // Test from https://github.com/llvm/llvm-project/issues/80049:
  verifyFormat(
      "using type = std::remove_cv_t<\n"
      "    add_common_cv_reference<\n"
      "        std::common_type_t<std::decay_t<T0>, std::decay_t<T1>>,\n"
      "        T0,\n"
      "        T1\n"
      "    >\n"
      ">;",
      "using type = std::remove_cv_t<\n"
      "    add_common_cv_reference<\n"
      "        std::common_type_t<std::decay_t<T0>, std::decay_t<T1>>,\n"
      "        T0,\n"
      "        T1>>;",
      Style);
```

https://github.com/llvm/llvm-project/pull/118046


More information about the cfe-commits mailing list