[PATCH] D35296: [clang-format] Keep level of comment before an empty line

Daniel Jasper via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 12 08:09:38 PDT 2017


djasper accepted this revision.
djasper added a comment.
This revision is now accepted and ready to land.

Some small comments, otherwise looks good.



================
Comment at: lib/Format/TokenAnnotator.cpp:1706
+    if (NextNonCommentLine && CommentLine) {
+      bool UpdateLevel = NextNonCommentLine->First->NewlinesBefore <= 1 &&
+                         NextNonCommentLine->First->OriginalColumn ==
----------------
Add a comment a long the lines of:

  // If the comment is currently aligned with the line immediately following it,
  // that's probably intentional and we should keep it.

And maybe rename s/UpdateLevel/AlignedWithNextLine/


================
Comment at: unittests/Format/FormatTest.cpp:855
+            "  }\n"
+            "});", getLLVMStyle()));
   verifyFormat("switch (a) {\n"
----------------
Please format this with clang-format.


https://reviews.llvm.org/D35296





More information about the cfe-commits mailing list