[PATCH] D142891: [clang-format] Recognize Verilog non-blocking assignment

Björn Schäpers via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 31 12:10:20 PST 2023


HazardyKnusperkeks added inline comments.


================
Comment at: clang/lib/Format/WhitespaceManager.cpp:839-846
         return Style.AlignConsecutiveAssignments.AlignCompound
                    ? C.Tok->getPrecedence() == prec::Assignment
-                   : C.Tok->is(tok::equal);
+                   : C.Tok->is(tok::equal) ||
+                         // In Verilog the '<=' is not a compound assignment,
+                         // thus it is aligned even when the AlignCompound
+                         // option is not set.
+                         (Style.isVerilog() && C.Tok->is(tok::lessequal) &&
----------------
Do you need the extra case, or could you just activate `AlignCompound`?

If you do, can you please add parens, the precedence of `?` and `:` in combination with `||` is at least for me not 100% clear.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D142891



More information about the cfe-commits mailing list