This is an archive of the discontinued LLVM Phabricator instance.

[clang-format] Put ports on separate lines in Verilog module headers
ClosedPublic

Authored by sstwcw on Feb 11 2023, 12:23 PM.

Details

Summary

New:

module mh1
    (input var int in1,
     input var in2, in3,
     output tagged_st out);
endmodule

Old:

module mh1
    (input var int in1, input var in2, in3, output tagged_st out);
endmodule

getNextNonComment was modified to return a non-const pointer because
we needed to use it that way in verilogGroupDecl.

The comment on line 2620 was a typo. We corrected it while modifying
the function.

Diff Detail

Event Timeline

sstwcw created this revision.Feb 11 2023, 12:23 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 11 2023, 12:23 PM
sstwcw requested review of this revision.Feb 11 2023, 12:23 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 11 2023, 12:23 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
sstwcw added a project: Restricted Project.Feb 11 2023, 12:24 PM
MyDeveloperDay added inline comments.Feb 14 2023, 3:00 AM
clang/lib/Format/TokenAnnotator.cpp
2840

are we covering these cases in the unit tests

2850

are we covering these cases in the unit tests

4369

Is this an unrelated change? if not can you add an test

sstwcw marked 3 inline comments as done.Feb 17 2023, 7:54 AM
sstwcw added inline comments.
clang/lib/Format/TokenAnnotator.cpp
2840

I added a test on line 432.

2850

I added a test on line 374.

4369

I added a test on line 255.

sstwcw updated this revision to Diff 498376.Feb 17 2023, 7:55 AM
sstwcw marked 3 inline comments as done.
  • add tests
MyDeveloperDay accepted this revision.Feb 17 2023, 8:27 AM

Thank you for adding the tests, as I don't know Verilog then I can't really comment on the correctness, as you are mostly in your own scoped verilog functions, I'm fine with you improving the Verilog support, I don't personally see anything wrong with the touch points with other languages. I'm not sure if others have comments or if they have expertise in this area.

This revision is now accepted and ready to land.Feb 17 2023, 8:27 AM
owenpan added inline comments.Feb 18 2023, 2:08 AM
clang/lib/Format/TokenAnnotator.cpp
2665

And other places as well.

2806

And other places too.

sstwcw added inline comments.Feb 19 2023, 2:40 PM
clang/lib/Format/TokenAnnotator.cpp
2665

@HazardyKnusperkeks Do you agree? I remember you once said you preferred the nullptr style.

owenpan added inline comments.Feb 19 2023, 4:35 PM
clang/lib/Format/TokenAnnotator.cpp
2665

See D144355. Not using nullptr in conditionals was one of the first LLVM styles I had to get used to when I started contributing.

This revision was landed with ongoing or failed builds.Feb 19 2023, 7:34 PM
This revision was automatically updated to reflect the committed changes.
clang/lib/Format/TokenAnnotator.cpp
2665

Apart from Owens comment about the style guide. My personal preference is without nullptr, but I don't know if I maybe said otherwise sometime.