[PATCH] Improve formatting of lambda functions.

Chandler Carruth chandlerc at gmail.com
Fri Jun 12 00:51:51 PDT 2015

I think we should do this, and I'll try to give a plausibly principled rationale.

We have two uses of {}s that I care about: braced init lists and blocks. For braced init lists, we routinely omit padding spaces around the {}s:

  foo({x, y z});
  return {{1, 2, 3}};

On the other hand, with every block example I can come up with, we have spaces around the {}s:

  if (...) {
  int f() {
  auto f() {
  auto f() -> int {
  [] {}, []() {}, []() mutable {}, []() -> int {}

It makes much more sense to me to have a space even in the presence of a pointer (or reference).



More information about the cfe-commits mailing list