[PATCH] D64775: [Format/ObjC] Avoid breaking between unary operators and ObjC method invocations

Ben Hamilton via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 16 07:38:04 PDT 2019


benhamilton marked an inline comment as done.
benhamilton added inline comments.


================
Comment at: clang/lib/Format/TokenAnnotator.cpp:2427-2428
     return 50;
 
+  if (Left.is(TT_UnaryOperator) && Right.is(TT_ObjCMethodExpr))
+    return 60;
----------------
sammccall wrote:
> This looks a little suspicious only because it's so specific.
> 
> It seems like you'd *always* want a harsh penalty for breaking between a unary operator and its operand. @klimek does this look right, should we drop the `ObcJMethodExpr` requirement or is this case handled elsewhere?
I tried changing it to just `if (Left.is(TT_UnaryOperator))` and all the tests passed. I'll go for the gusto and assume this is fine.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D64775/new/

https://reviews.llvm.org/D64775





More information about the cfe-commits mailing list