[PATCH] Unified token breaking logic for strings and block comments.

Manuel Klimek klimek at google.com
Sat Apr 13 04:44:09 PDT 2013


  Awesome. My gut tells me there's some more opportunity for simplification, but I'll need to look over it more closely for that, and it might be a good idea to first fold the line comment breakage into it, so LG.


================
Comment at: lib/Format/Format.cpp:857
@@ -968,1 +856,3 @@
 
+  class BreakableToken {
+  public:
----------------
Now that we have something that's modularized, how about we pull that into a different file called BreakableToken.h / BreakableToken.cpp?

================
Comment at: lib/Format/Format.cpp:864
@@ +863,3 @@
+    getLineLengthAfterSplit(unsigned LineIndex, unsigned TailOffset) = 0;
+    virtual unsigned getPrefixLength() = 0;
+    virtual unsigned getSuffixLength(unsigned LineIndex) = 0;
----------------
Not needed in interface. As is the one below.

================
Comment at: lib/Format/Format.cpp:1203
@@ +1202,3 @@
+         ++LineIndex) {
+      unsigned TokenLineSize = Token->getLine(LineIndex).size();
+      unsigned TailOffset = 0;
----------------
It also looks like technically we don't need getLine any more, as we just call size() on it?

================
Comment at: lib/Format/Format.cpp:1062
@@ +1061,3 @@
+      }
+
+
----------------
Nit: remove empty line.


http://llvm-reviews.chandlerc.com/D665

BRANCH
  svn

ARCANIST PROJECT
  clang



More information about the cfe-commits mailing list