[PATCH] D126845: [clang-format] Handle Verilog numbers and operators

Björn Schäpers via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 2 03:27:56 PDT 2022


HazardyKnusperkeks added inline comments.


================
Comment at: clang/lib/Format/FormatToken.h:138
   TYPE(CSharpGenericTypeConstraintComma)                                       \
+  TYPE(VerilogNumberBase) /* for the base in a number literal, not including   \
+                             the quote */                                      \
----------------
One should move the CSharp stuff, since all other languages are sorted correctly. So I'd say please move above the CSharp.


================
Comment at: clang/lib/Format/FormatToken.h:1421
+  // Symbols in Verilog that don't exist in C++.
+  IdentifierInfo *quote;
+
----------------
apostrophe


================
Comment at: clang/lib/Format/FormatTokenLexer.cpp:247
+                          TT_BinaryOperator))
+      return;
+    // Module paths in specify blocks and implications in properties.
----------------
I think here are braces needed.


================
Comment at: clang/unittests/Format/FormatTestVerilog.cpp:163
 
+TEST_F(FormatTestVerilog, Operators) {
+  // Test that unary operators are not followed by space.
----------------
You should add token annotator tests to see if the tokens are parsed as you want to. Formatting mostly follows.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D126845



More information about the cfe-commits mailing list