krasimir added a comment.

Tried to add some comments around range computations. Most of the time it's 
about converting range offsets from local line-based values to 
start-of-token-based offsets.



================
Comment at: lib/Format/BreakableToken.cpp:279-280
+  return Content.size() >= 2 &&
+      Content != "clang-format on" &&
+      Content != "clang-format off" &&
+      !Content.endswith("\\") &&
----------------
klimek wrote:
> Can we now use delimitsRegion here?
Yep! Actually came up with even better alternative: we use switchesFormatting() 
below:


================
Comment at: lib/Format/ContinuationIndenter.cpp:1090-1092
+// Checks if Token delimits formatting regions, like /* clang-format off */.
+// Token must be a comment.
+static bool delimitsRegion(const FormatToken &Token) {
----------------
klimek wrote:
> delimitsRegion seems overly abstract. Perhaps switchesFormatting?
Yep. Also moved it to BreakableToken.h/.cpp so it can be used from both 
ContinuationIndenter::breakProtrudingToken and BreakableComment::mayReflow!


https://reviews.llvm.org/D28764



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to