[PATCH] D80115: [clang-format] [PR45816] Add AlignConsecutiveBitFields

Jake Merdich via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon May 18 07:29:33 PDT 2020


JakeMerdichAMD added a comment.

Ironically, I independently made a near-identical change because my codebase needs this, and was going to upload it today. I won't post it now, but I stuck a copy on github if you're interested: https://github.com/JakeMerdichAMD/llvm-project/commit/6eec9ce0bb7732a519b765659422b72a9fa8aa67. I also have some more tests there, and will cross-check with this once the merge conflicts are fixed.



================
Comment at: clang/lib/Format/WhitespaceManager.cpp:98
   alignConsecutiveAssignments();
+  alignConsecutiveBitFields();
   alignTrailingComments();
----------------
This needs to be before assignments, because 'int foo : 3 = 1;' is valid in c++2a.


================
Comment at: clang/lib/Format/WhitespaceManager.cpp:588-590
+        return C.Tok->Previous->startsSequence(tok::identifier, tok::colon,
+                                               tok::numeric_constant);
+      },
----------------
TT_BitFieldColon should match this criteria exactly. 


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

https://reviews.llvm.org/D80115





More information about the cfe-commits mailing list