This is an archive of the discontinued LLVM Phabricator instance.

[clang-format] Add option for having one port per line in Verilog
ClosedPublic

Authored by sstwcw on Mar 31 2023, 7:32 AM.

Details

Summary

We added the option VerilogBreakBetweenInstancePorts to put ports on
separate lines in module instantiations. We made it default to true
because style guides mostly recommend it that way for example:

https://github.com/lowRISC/style-guides/blob/master/VerilogCodingStyle.md#module-instantiation

Diff Detail

Event Timeline

sstwcw created this revision.Mar 31 2023, 7:32 AM
Herald added projects: Restricted Project, Restricted Project, Restricted Project. · View Herald TranscriptMar 31 2023, 7:32 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
sstwcw requested review of this revision.Mar 31 2023, 7:32 AM
NOTE: Clang-Format Team Automated Review Comment

Your review contains a change to clang/include/clang/Format/Format.h but does not contain an update to ClangFormatStyleOptions.rst

ClangFormatStyleOptions.rst is generated via clang/docs/tools/dump_format_style.py, please run this to regenerate the .rst

You can validate that the rst is valid by running.

./docs/tools/dump_format_style.py
mkdir -p html
/usr/bin/sphinx-build -n ./docs ./html
sstwcw retitled this revision from [clang-format] Add option for having one port on a line in Verilog to [clang-format] Add option for having one port per line in Verilog.Mar 31 2023, 7:36 AM
sstwcw updated this revision to Diff 510038.Mar 31 2023, 7:39 AM

Generate doc

HazardyKnusperkeks requested changes to this revision.Mar 31 2023, 1:03 PM
HazardyKnusperkeks added inline comments.
clang/include/clang/Format/Format.h
4185

Can you put the true vs. false in the doc, like on other options?

4192

V after U

clang/lib/Format/TokenAnnotator.cpp
1150
1156–1163

I won't read that.

I think you should go with multiple if statements.

This revision now requires changes to proceed.Mar 31 2023, 1:03 PM
sstwcw updated this revision to Diff 510244.Apr 1 2023, 10:03 AM
sstwcw marked 2 inline comments as done.
  • Use shorter conditions
sstwcw marked 2 inline comments as done.Apr 1 2023, 10:04 AM
owenpan added inline comments.Apr 1 2023, 4:32 PM
clang/lib/Format/TokenAnnotator.cpp
1149–1191

Can you make it a function or lambda with early returns?

This revision is now accepted and ready to land.Apr 2 2023, 12:09 PM
sstwcw updated this revision to Diff 510385.Apr 2 2023, 8:28 PM
  • Use lambda
This revision was landed with ongoing or failed builds.Apr 4 2023, 7:52 AM
This revision was automatically updated to reflect the committed changes.