Expanding AlignConsecutiveAssignments to compound assignments.
Details
- Reviewers
rsmith krasimir klimek djasper PDoakORNL rymiel HazardyKnusperkeks MyDeveloperDay kristina - Group Reviewers
Restricted Project
Diff Detail
- Repository
- rC Clang
Event Timeline
include/clang/Format/Format.h | ||
---|---|---|
85 | Please add tests for these. Also it's not clear from these examples how would a block of lines using assigments spanning different number of columns would be alined, as in: aaa = 1; bb += 2; c <<= 3; vs. aaa = 1; bb += 2; c <<= 3; I think this might deserve discussion by itself before this patch can get in (personally, I'm in favor of the first version where the right hand sides are alined). |
Is anyone still working on this or is a new author needed?
For what's it worth it, I'm in favor of the first version (right hand aligned) for different sized operators.
A matching bug exists at: https://bugs.llvm.org/show_bug.cgi?id=31681
Your review contains a change to clang/include/clang/Format/Format.h but does not contain an update to ClangFormatStyleOptions.rst
ClangFormatStyleOptions.rst is generated via clang/docs/tools/dump_format_style.py, please run this to regenerate the .rst
You can validate that the rst is valid by running.
./docs/tools/dump_format_style.py mkdir -p html /usr/bin/sphinx-build -n ./docs ./html
It looks like your clang-format review does not contain any unit tests, please try to ensure all code changes have a unit test (unless this is an NFC or refactoring, adding documentation etc..)
Add your unit tests in clang/unittests/Format and you can build with ninja FormatTests. We recommend using the verifyFormat(xxx) format of unit tests rather than EXPECT_EQ as this will ensure you change is tolerant to random whitespace changes (see FormatTest.cpp as an example)
For situations where your change is altering the TokenAnnotator.cpp which can happen if you are trying to improve the annotation phase to ensure we are correctly identifying the type of a token, please add a token annotator test in TokenAnnotatorTest.cpp
Please add tests for these. Also it's not clear from these examples how would a block of lines using assigments spanning different number of columns would be alined, as in:
vs.
I think this might deserve discussion by itself before this patch can get in (personally, I'm in favor of the first version where the right hand sides are alined).