[PATCH] D154467: [clang-format] Add Verilog suffixes to the scripts

sstwcw via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 4 16:50:54 PDT 2023


sstwcw created this revision.
Herald added projects: All, clang, clang-format.
Herald added a subscriber: cfe-commits.
Herald added reviewers: rymiel, HazardyKnusperkeks, owenpan, MyDeveloperDay.
sstwcw requested review of this revision.
Herald added a comment.

NOTE: Clang-Format Team Automated Review Comment

It looks like your clang-format review does not contain any unit tests, please try to ensure all code changes have a unit test (unless this is an `NFC` or refactoring, adding documentation etc..)

Add your unit tests in `clang/unittests/Format` and you can build with `ninja FormatTests`.  We recommend using the `verifyFormat(xxx)` format of unit tests rather than `EXPECT_EQ` as this will ensure you change is tolerant to random whitespace changes (see FormatTest.cpp as an example)

For situations where your change is altering the TokenAnnotator.cpp which can happen if you are trying to improve the annotation phase to ensure we are correctly identifying the type of a token, please add a token annotator test in `TokenAnnotatorTest.cpp`


I decided not to wait for D149088 <https://reviews.llvm.org/D149088> because it was taking a long time.

The capture group in the regexp was changed to non-capturing.  It
doesn't need to be captured.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D154467

Files:
  clang/tools/clang-format/clang-format-diff.py
  clang/tools/clang-format/git-clang-format


Index: clang/tools/clang-format/git-clang-format
===================================================================
--- clang/tools/clang-format/git-clang-format
+++ clang/tools/clang-format/git-clang-format
@@ -98,6 +98,7 @@
       'ts',  # TypeScript
       'cs',  # C Sharp
       'json',  # Json
+      'sv', 'svh', 'v', 'vh', # Verilog
       ])
 
   p = argparse.ArgumentParser(
Index: clang/tools/clang-format/clang-format-diff.py
===================================================================
--- clang/tools/clang-format/clang-format-diff.py
+++ clang/tools/clang-format/clang-format-diff.py
@@ -61,8 +61,8 @@
     parser.add_argument(
         "-iregex",
         metavar="PATTERN",
-        default=r".*\.(cpp|cc|c\+\+|cxx|cppm|ccm|cxxm|c\+\+m|c|cl|h|hh|hpp|hxx"
-        r"|m|mm|inc|js|ts|proto|protodevel|java|cs|json)",
+        default=r".*\.(?:cpp|cc|c\+\+|cxx|cppm|ccm|cxxm|c\+\+m|c|cl|h|hh|hpp"
+        r"|hxx|m|mm|inc|js|ts|proto|protodevel|java|cs|json|s?vh?)",
         help="custom pattern selecting file paths to reformat "
         "(case insensitive, overridden by -regex)",
     )


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D154467.537191.patch
Type: text/x-patch
Size: 1114 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230704/2a4ee6e3/attachment-0001.bin>


More information about the cfe-commits mailing list