[PATCH] D30487: ClangFormat - Add option to break before inheritance separation operator in class declaration
Daniel Jasper via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Mar 9 08:31:19 PST 2017
djasper accepted this revision.
djasper added a comment.
This revision is now accepted and ready to land.
A few nits, otherwise looks good.
================
Comment at: include/clang/Format/Format.h:426
+ /// \brief If ``true``, in the class inheritance expression clang-format will
+ /// break before operands ``:`` and ``,`` only if there is multiple
+ /// inheritance.
----------------
Please remove "operands" and "only". I think they can be confusing.
================
Comment at: include/clang/Format/Format.h:852
ColumnLimit == R.ColumnLimit && CommentPragmas == R.CommentPragmas &&
+ BreakBeforeInhertianceComma ==
+ R.BreakBeforeInhertianceComma &&
----------------
Looks like it might fit on one line now :)
================
Comment at: lib/Format/ContinuationIndenter.cpp:355
+ if (Current.is(TT_InheritanceColon))
+ State.Stack.back().NoLineBreak = true;
----------------
Can you leave a comment here:
// Don't break within the inheritance declaration unless the ":" is on a new line.
================
Comment at: lib/Format/ContinuationIndenter.cpp:750
+ if (NextNonComment->isOneOf(TT_InheritanceColon, TT_InheritanceComma))
+ return State.FirstIndent + Style.ContinuationIndentWidth;
if (Previous.is(tok::r_paren) && !Current.isBinaryOperator() &&
----------------
Please merge these into the one about TT_CtorInitializerComma, i.e.:
if (NextNonComment->isOneOf(TT_CtorInitializerColon, TT_InheritanceColon,
TT_InheritanceComma))
return State.FirstIndent + Style.ConstructorInitializerIndentWidth;
Repository:
rL LLVM
https://reviews.llvm.org/D30487
More information about the cfe-commits
mailing list