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

Martin Probst via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 20 10:32:39 PDT 2017


mprobst accepted this revision.
mprobst added inline comments.
This revision is now accepted and ready to land.


================
Comment at: lib/Format/BreakableToken.cpp:436
+  if (Style.Language == FormatStyle::LK_JavaScript) {
+    if ((Lines[0] == "*" || Lines[0].startswith("* ")) && Lines.size() > 1) {
+      // This is a multiline jsdoc comment.
----------------
krasimir wrote:
> mprobst wrote:
> > mprobst wrote:
> > > Wouldn't we also want to do this for `/**blah`, i.e. no whitespace after `*`?
> > 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.
> 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.
Makes sense. Maybe add some negative tests for such situations, to make sure we don't screw up the source?


https://reviews.llvm.org/D35683





More information about the cfe-commits mailing list