[PATCH] D115069: [clang-format][NFC] Merge another two calls to isOneOf

MyDeveloperDay via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Dec 4 07:03:57 PST 2021

MyDeveloperDay accepted this revision.
MyDeveloperDay added inline comments.
This revision is now accepted and ready to land.

Comment at: clang/lib/Format/ContinuationIndenter.cpp:1294-1296
+      Previous->isOneOf(tok::l_paren, tok::comma, tok::colon, TT_BinaryOperator,
+                        TT_ConditionalExpr) &&
       !Previous->isOneOf(TT_DictLiteral, TT_ObjCMethodExpr)) {
HazardyKnusperkeks wrote:
> curdeius wrote:
> > Unrelated to your change, it only shed light on this:
> > This condition looks strange to me. How can `Previous` be at the same time two different `TokenType`s (?), for instance, both `TT_BinaryOperator` and `TT_DictLiteral`?
> > 
> > Shouldn't it be this?
> Yeah, I will update it.
This is in my view one of the reasons why I personally like it when we comment the condition with an example and don't have these huge compound expressions.

Often they are covering corner cases. (we should call them out)

  rG LLVM Github Monorepo



More information about the cfe-commits mailing list