Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
I'll test it tomorrow but probably a define with a hash as the last character may do the job and show the faulty behaviour.
Indeed, I get the hash on the 2nd line merged into the first one in this test case:
verifyFormat("/* comment */ #define A (parentheses)\n" "#");
But! It's unrelated to whether PreviousWasComment is updated inside the loop or not.
Actually it should not be important because # always starts a preprocessor macro and no other statement (at least in C and C++).
On the other hand, FirstNonCommentOnLine should be updated in the loop but I still don't have a test case for this (again, because there's no statement that starts with #).
Interestingly, the problem I encountered with the test case above doesn't happen when there's a new line after #:
verifyFormat("/* comment */ #define A (parentheses)\n" "#\n");
Anyway, this merging happens due to something else, but I don't know yet what exactly.
Investigating...
clang/lib/Format/UnwrappedLineParser.cpp | ||
---|---|---|
3614 | There it is again. ;) The if is the same as above, isn't it? |
I really don't like bitwise operations on bool. Hit some nasty bugs at my job.