This commit changes the condition of requiring comment to start with
alphabet characters to make no change only for a certain set of
characters, currently horizontal whitespace and punctuation characters.
Details
Details
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Comment Actions
It appears that this caused a regression by adding an additional space of indentation to line comments in some cases:
% cat test.cc # (before) // Comment int i; % clang-format -style=google test.cc // Comment int i;
@ksyx could you please take a look?
Comment Actions
I did not reproduce it in latest main branch. This problem may in relate to this issue which have recently been fixed: https://github.com/llvm/llvm-project/issues/53844
Comment Actions
Thank you!
Turns out the original source wasn't using an ascii space for the comment indentation but a unicode [c2 a0] no-break space:
2f 2f c2 a0 43 6f 6d 6d 65 6e 74 0a 69 6e 74 20 |//..Comment.int |
IMO we shouldn't aim to handle non-ascii spaces for indentation in clang-format; the new behavior on this example is fine.