[PATCH] D33589: clang-format: consider not splitting tokens in optimization

Francois Ferrand via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri May 26 03:25:35 PDT 2017


Typz added a comment.

Still some issues with the patch, I would need some feedback first:

- Is this approach desirable, as a relatively easy fix?
- Or should this be fixed with a complete refactoring of the way the strings/comments are split, making multiple tokens out of them to let them be reflown 'directly' by the optimizing line formatter? (keep the optimizer, but changes the whole way comments are handled, and need to move all the information about the comment block and its relfowing into LineState)
- Or should the breakProtrudingToken() actually perform a "local" optimization of the splits? (keeps the same overall structure, but requires writing another optimizer)



================
Comment at: unittests/Format/FormatTest.cpp:8571
+            "        */",
+            format("int a; /* first line second line third line */", Style));
+}
----------------
This is not working as expected, format return:

  int a; /* first line
            * second *
            line third
            * line */

Any clue how things could go so wrong?


https://reviews.llvm.org/D33589





More information about the cfe-commits mailing list