[clang] [clang-format] Introduce "ReflowComments: IndentOnly" to re-indent comments without breaking internal structure (think Doxygen). (PR #96804)
Iuri Chaer via cfe-commits
cfe-commits at lists.llvm.org
Wed Aug 14 07:30:31 PDT 2024
================
@@ -493,9 +493,36 @@ TEST_F(FormatTestComments, AlignsBlockComments) {
TEST_F(FormatTestComments, CommentReflowingCanBeTurnedOff) {
FormatStyle Style = getLLVMStyleWithColumns(20);
- Style.ReflowComments = false;
- verifyFormat("// aaaaaaaaa aaaaaaaaaa aaaaaaaaaa", Style);
- verifyFormat("/* aaaaaaaaa aaaaaaaaaa aaaaaaaaaa */", Style);
+ Style.ReflowComments = FormatStyle::RCS_Never;
+ verifyNoChange("// aaaaaaaaa aaaaaaaaaa aaaaaaaaaa", Style);
+ verifyNoChange("/* aaaaaaaaa aaaaaaaaaa aaaaaaaaaa */", Style);
----------------
ichaer wrote:
Oh wow, so `verifyFormat()`, when called with a single code argument, will first check that it doesn't change, then it will apply a specific type of transformation and check that we format it back to what it was? That's a bit surprising.
It seems to me that in our case `messUp()` would remove duplicate spaces, and, if the string started with a single space, it would remove that as well... is that right? It looks to me like it's not changing anything, but if it did change things inside the comments (which, if my reading is correct, it could do) we would like for the test to fail. Are there more test cases you'd like me to add instead?
Same about [the comment below](https://github.com/llvm/llvm-project/pull/96804/files/1d653048fc9084be2f52fbd7aeb4bf3e0f9e7326#r1716525064).
https://github.com/llvm/llvm-project/pull/96804
More information about the cfe-commits
mailing list