[PATCH] D93490: [clang-format] PR48539 ReflowComments breaks Qt translation comments

Björn Schäpers via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 21 13:06:48 PST 2020


HazardyKnusperkeks added a comment.

So, I've tested a bit:

  //= Die ID
  //~ foo bar
  //~ EinWort Ein langer Text der fortgesetzt wird
  //: Dies ist ein langer Kommentar
  //: der umgebrochen wird
  tr("Foo");

Results in

  <message id="Die ID">
      <location filename="wid.cpp" line="9"/>
      <source>Foo</source>
      <extracomment>Dies ist ein langer Kommentar der umgebrochen wird</extracomment>
      <translation type="unfinished"></translation>
      <extra-EinWort>Ein langer Text der fortgesetzt wird</extra-EinWort>
      <extra-foo>bar</extra-foo>
  </message>

And breaking `//=` or `//~` as followed

  //= Die
  //= ID
  //~ foo bar
  //~ EinWort Ein langer Text der
  //~ fortgesetzt wird
  //: Dies ist ein langer Kommentar
  //: der umgebrochen wird
  tr("Foo");

changes the result

  <message id="ID">
      <location filename="wid.cpp" line="11"/>
      <source>Foo</source>
      <extracomment>Dies ist ein langer Kommentar der umgebrochen wird</extracomment>
      <translation type="unfinished"></translation>
      <extra-EinWort>Ein langer Text der</extra-EinWort>
      <extra-foo>bar</extra-foo>
      <extra-fortgesetzt>wird</extra-fortgesetzt>
  </message>

So my conclusion is `//:` can and should be wrapped like in this patch, but `//=` and `//~` should not be touched anyhow, this can be accomplished with the `CommentPragmas` Setting.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D93490/new/

https://reviews.llvm.org/D93490



More information about the cfe-commits mailing list