curdeius added a comment.

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...


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D118924/new/

https://reviews.llvm.org/D118924

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to