[PATCH] Fix for corner cases in code handling leading "* " decorations in block comments
Manuel Klimek
klimek at google.com
Mon Jul 8 07:06:06 PDT 2013
lg
================
Comment at: lib/Format/BreakableToken.cpp:245
@@ +244,3 @@
+ // If the last line is empty, the closing "*/" will have a star.
+ if (i == e - 1 && Lines[i].empty())
+ continue;
----------------
I usually prefer i + 1 == e. I know here it doesn't make a difference but it takes a lot more time to figure out that it will always work thanks to how the condition is set up.
================
Comment at: lib/Format/BreakableToken.cpp:246
@@ +245,3 @@
+ if (i == e - 1 && Lines[i].empty())
+ continue;
+ while (!Lines[i].startswith(Decoration))
----------------
Can we also just 'break' since this must be the last line anyway?
================
Comment at: lib/Format/BreakableToken.cpp:375
@@ +374,3 @@
+ if (!LastLineNeedsDecoration) {
+ // If the last line is empty, we don't need a prefix, as the */ will
+ // line up with the decoration (if it exists).
----------------
Please adjust the comment to reflect the new reality :)
http://llvm-reviews.chandlerc.com/D1113
BRANCH
svn
ARCANIST PROJECT
clang
More information about the cfe-commits
mailing list