[PATCH] D36956: [clang-format] Emit absolute splits before lines for comments

Daniel Jasper via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 21 23:51:05 PDT 2017


djasper added inline comments.


================
Comment at: lib/Format/BreakableToken.cpp:553
   StringRef TrimmedContent = Content[LineIndex].ltrim(Blanks);
-  return getReflowSplit(TrimmedContent, ReflowPrefix, PreviousEndColumn,
-                        ColumnLimit);
+  Split TrimmedSplit = getReflowSplit(TrimmedContent, ReflowPrefix,
+                                      PreviousEndColumn, ColumnLimit);
----------------
I think a split cannot be "Trimmed". Maybe "Result" or "NewSplit"?


================
Comment at: lib/Format/BreakableToken.cpp:557
+    return TrimmedSplit;
+  return Split(TrimmedSplit.first + Content[LineIndex].size() -
+                   TrimmedContent.size(),
----------------
Why do you create a new split instead of:

  TrimmedSplit += Content[LineIndex].size() - TrimmedContent.size();

?


================
Comment at: unittests/Format/FormatTestComments.cpp:2785
+TEST_F(FormatTestComments, NoCrush_Bug34236) {
+  // This is a test case from a crusher reported in bug 34236:
+  // https://bugs.llvm.org/show_bug.cgi?id=34236
----------------
s/crusher/crasher/

:-D

Also, I'd just remove " bug 34236", seems redundant.


https://reviews.llvm.org/D36956





More information about the cfe-commits mailing list