Ericson2314 wrote:
In Nix (github.com/nixos/nix) I am getting formatting like
```c++
auto variant = scheme == "auto" ?
(StoreReference::Variant{Specified::Auto{}})
:
(StoreReference::Variant{Specified::Specified{
.scheme = getString,
.authority =
getString(valueAt(obj, "authority")),
}});
```
and I am not really sure why, but I gather it might have something to do with
this.
IMO a key rule of formatting to me is that it should not depend on the the
exact lengths of identifiers and literals. Making the `:` in match `?` when `?`
like this is a no-go because the horizontal position of `?` matches `variant`,
`scheme`, and `"auto"`. Whereas something like
```c++
auto variant = scheme == "auto"
? (StoreReference::Variant{Specified::Auto{}})
: (StoreReference::Variant{Specified::Specified{
.scheme = getString,
.authority = getString(valueAt(obj, "authority")),
}});
```
doesn't depend on those things, and so is a a valid choice.
I would hope there would at least be some combination of settings to enforce
this invariant.
https://github.com/llvm/llvm-project/pull/100860
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits