[PATCH] D119599: Add option to align compound assignments like `+=`
Björn Schäpers via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sat Feb 12 09:24:13 PST 2022
HazardyKnusperkeks added inline comments.
Comment at: clang/include/clang/Format/Format.h:151
+ /// When aligning assignments, whether compound assignments like
+ /// ``+=``'s are aligned along with ``=``'s.
> curdeius wrote:
> > You need to update the RST files when updating the doc comments here. Please use https://github.com/llvm/llvm-project/blob/main/clang/docs/tools/dump_format_style.py for that.
> I guess it is saying I need to say what version the option first appeared in. How do I know what version it will be?
The next major, currently 15.
If it would take to long to review we change the version in between. But since the branching for 14 has quite recently happened this is either going in 15, or not at all. :)
Comment at: clang/include/clang/Format/Format.h:157
+ /// a &= 2;
+ /// bbb = 2;
> HazardyKnusperkeks wrote:
> > curdeius wrote:
> > > I guess it would be complicated to avoid adding an additional space here. I mean, it could be:
> > > ```
> > > a &= 2;
> > > bbb = 2;
> > > ```
> > > And with 3-char operators, there's one more space.
> > That would be awesome, but it should be an option to turn off or on.
> > But I think this would really be complicated.
> I can do it either way. But I thought without the extra space the formatted code looked ugly, especially when mixing `>>=` and `=`. Which way do you prefer?
> a >>= 2;
> bbb = 2;
I would prefer an option, to be able to do both.
I think I would use the variant which is more compact, but can't say for sure until I really have the option and tried it.
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
More information about the cfe-commits