[PATCH] Multi-line comment alignment

Daniel Jasper djasper at google.com
Thu Mar 14 08:51:55 PDT 2013


  A few nits, otherwise looks good. Thanks!


================
Comment at: lib/Format/Format.cpp:131
@@ -130,11 +130,3 @@
             Spaces + WhitespaceStartColumn + Tok.FormatTok.TokenLength) {
-          Comments.push_back(StoredComment());
-          Comments.back().Tok = Tok.FormatTok;
-          Comments.back().Spaces = Spaces;
-          Comments.back().NewLines = NewLines;
-          if (NewLines == 0)
-            Comments.back().MinColumn = WhitespaceStartColumn + Spaces;
-          else
-            Comments.back().MinColumn = Spaces;
-          Comments.back().MaxColumn =
-              Style.ColumnLimit - Tok.FormatTok.TokenLength;
+          StoredComment SC;
+          SC.Tok = Tok.FormatTok;
----------------
I am not a big fan of two-letter variable names and we don't really use them within clang-format. How about "Comment"?

================
Comment at: lib/Format/Format.cpp:195
@@ -193,1 +194,3 @@
 private:
+  void alignBlockComment(const FormatToken &Tok, int BaseIndent) {
+    SourceLocation TokenLoc = Tok.Tok.getLocation();
----------------
I think this is more "indentBlockComment" than "alignBlockComment"..

================
Comment at: lib/Format/Format.cpp:198
@@ +197,3 @@
+    const char *Start = SourceMgr.getCharacterData(TokenLoc);
+    const char *Cur = Start;
+
----------------
We use "Currrent" everywhere else in clang-format. I don't feel strongly, but I value consistency.


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

BRANCH
  svn

ARCANIST PROJECT
  clang



More information about the cfe-commits mailing list