[PATCH] D28764: [clang-format] Implement comment reflowing (v3)

Manuel Klimek via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 23 08:53:42 PST 2017


klimek added inline comments.


================
Comment at: lib/Format/BreakableToken.h:55-56
+///   been reformatted, and
+/// - replaceWhitespaceBefore, for executing the reflow using a whitespace
+///   manager.
+///
----------------
Shouldn't that be called insertBreakBefore for consistency then?

Also, perhaps we want to rename replaceWhitespace to cleanupWhitespace or compressWhitespace or something...


================
Comment at: lib/Format/ContinuationIndenter.cpp:1158-1159
+        CommentPragmasRegex.match(Current.TokenText.substr(2)) ||
+        Current.TokenText.substr(2).ltrim().startswith("clang-format on") ||
+        Current.TokenText.substr(2).ltrim().startswith("clang-format off"))
       return addMultilineToken(Current, State);
----------------
Generally, we shouldn't need those here, as those should be part of the Token.Finalized state.


================
Comment at: lib/Format/ContinuationIndenter.cpp:1220
+        RemainingTokenColumns = RemainingTokenColumns + 1 - Split.second;
+        ReflowInProgress = true;
         if (!DryRun)
----------------
Explain this part in a comment.


https://reviews.llvm.org/D28764





More information about the cfe-commits mailing list