Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
I've been sniped! (but only because i spent hours discussing with people if the error is pedantically valid, which it turns out it is)
I was wondering why you didn't assign yourself. :) When I saw the bug report, I immediately remembered D134853#3829710 and knew it was indeed a bug. As this one is an invalid-code-generation bug, I wanted it fixed ASAP.
clang/lib/Format/TokenAnnotator.cpp | ||
---|---|---|
3896 | Add a comment what that is? Without the bug report I'd not know what that sequence would be. |
clang/lib/Format/TokenAnnotator.cpp | ||
---|---|---|
3896 | I could do that, but the github issue is linked in the summary above and will be in the commit message. In general, I don't like unnecessary comments littered in the source. They can become outdated, out of place, misleading, and even wrong. How about giving an example as shown above? |
I wonder if this can be fixed more generally by using TokenConcatenation::AvoidConcat to determine whether clang-format should require a space between two tokens. This is the logic that clang -E uses when printing preprocessed tokens to avoid token splices. For example, that should also stop clang-format breaking the last line of this:
struct A; void operator<=(A, A); template<void(A, A)> struct B {}; B<operator<= > b;
clang/lib/Format/TokenAnnotator.cpp | ||
---|---|---|
3896 | Does clang-format have any formatting modes where it would leave out spaces around + or -? The same issue arises with things like 0xe + n, where removing the space between the 0xe and the + results in a token splice. |
Probabtly not as clang-format uses the raw lexer that doesn't involve the preprocessor, which seems to be required by TokenConcatenation.
clang/lib/Format/TokenAnnotator.cpp | ||
---|---|---|
3896 | No. I was aware of them and had made sure clang-format already handled them correctly. |
I don't know but will go with whatever you, @MyDeveloperDay and @HazardyKnusperkeks prefer.
I'd vote in favor, letting a code breaking bug knowingly in the most current (or to come? I don't follow that.) version would be let's say not nice.
clang/lib/Format/TokenAnnotator.cpp | ||
---|---|---|
3896 |
If you do a git blame you can come to the commit and thus to the bug, but if you are just reading, at least I don't blame all the lines. There I think a comment is nice, and your proposal is a really nice one. |
Add a comment what that is? Without the bug report I'd not know what that sequence would be.