[PATCH] D115050: [clang-format] PR48916 PointerAlignment not working when using C++20 init-statement in for loop

Björn Schäpers via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 3 12:36:53 PST 2021


HazardyKnusperkeks added inline comments.


================
Comment at: clang/lib/Format/TokenAnnotator.cpp:3052
+    // & 1
+    if (Right.Tok.isLiteral())
+      return true;
----------------
MyDeveloperDay wrote:
> HazardyKnusperkeks wrote:
> > Is this valid code? Or did we just wrongly assign PointerOrReference? I'd say after that there can not be a literal in valid code, thus we do not need to handle it.
> Ok so as you see I broken out the compound statement, to be honest I find these compound if's unreadable and I can't for the life of me work out what case they are trying to handle. (I want to do this more)..
> 
> Please no one say doing it separately is slower! without measuring it..we are talking ns difference if anything at all.
> 
> I agree I truly believe we are mis assigning PointerOrReference/BinaryOperator this as I mentioned  in
> https://lists.llvm.org/pipermail/cfe-dev/2021-December/069486.html is a major issue and I think from time to time these rules try to correct that situation, in this case & is the logical operation on a reference.
I'm with you to split up these monsters!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D115050



More information about the cfe-commits mailing list