[PATCH] D48063: [clang-format] Discourage breaks in submessage entries, hard rule
Sam McCall via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jun 12 10:21:56 PDT 2018
sammccall accepted this revision.
sammccall added inline comments.
This revision is now accepted and ready to land.
================
Comment at: lib/Format/TokenAnnotator.cpp:3104
if (Left.is(tok::colon) && Left.isOneOf(TT_DictLiteral, TT_ObjCMethodExpr)) {
if ((Style.Language == FormatStyle::LK_Proto ||
Style.Language == FormatStyle::LK_TextProto) &&
----------------
It's really hard to follow the boolean logic here.
Can you break this up into multiple if statements with comments, or extract some named subexpressions or something? e.g.
```
if (proto or textproto) {
if (bool isSubmessage = ...)
return false;
if (right is string && !break before multiline)
return false;
return true;
}
Repository:
rC Clang
https://reviews.llvm.org/D48063
More information about the cfe-commits
mailing list