This is an archive of the discontinued LLVM Phabricator instance.

[clang-format] Put '/**' and '*/' on own lines in multiline jsdocs
ClosedPublic

Authored by krasimir on Jul 20 2017, 7:48 AM.

Event Timeline

krasimir created this revision.Jul 20 2017, 7:48 AM
krasimir updated this revision to Diff 107510.Jul 20 2017, 7:51 AM
  • Remove empty test block
krasimir added a subscriber: cfe-commits.
mprobst added inline comments.Jul 20 2017, 8:06 AM
lib/Format/BreakableToken.cpp
435

I think I'd also enable this for at least Java. But tentatively I wonder - wouldn't just about every language do it like this for /** comments?

436

Wouldn't we also want to do this for /**blah, i.e. no whitespace after *?

436

Would we also want to do this for simple block comments, e.g. /*blah*/? That's a bit more tricky as they can be used inline, not sure about the corner cases there.

606

isn't this BreakPosition rather than length?

unittests/Format/FormatTestJS.cpp
136

do you need a test where the entire comment block is indented?

krasimir updated this revision to Diff 107539.Jul 20 2017, 9:43 AM
krasimir marked 3 inline comments as done.
  • Address review comments
krasimir marked 2 inline comments as done.Jul 20 2017, 9:44 AM
krasimir added inline comments.
lib/Format/BreakableToken.cpp
435

I agree for Java, but otherwise not. C++ is crazy with strange styles.

436

I explicitly check for a whitespace after the * to take care of strange stuff that is not javadoc, like ASCII art or lines like:

/********
 * #yolo
 */

I think we can decide for simple block comments later and leave them as-is for now.

606

It's both the BreakPosition and the BreakLength, because we're breaking starting from index 1.
Added a comment line (pun intended).

mprobst accepted this revision.Jul 20 2017, 10:30 AM
mprobst added inline comments.
lib/Format/BreakableToken.cpp
436

Makes sense. Maybe add some negative tests for such situations, to make sure we don't screw up the source?

This revision is now accepted and ready to land.Jul 20 2017, 10:30 AM
krasimir updated this revision to Diff 107593.Jul 20 2017, 3:25 PM
krasimir marked an inline comment as done.
  • Add negative tests
This revision was automatically updated to reflect the committed changes.