llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
28.87k stars 11.93k forks source link

Latest ObjC breaking priority causes weird formatting #18404

Closed llvmbot closed 10 years ago

llvmbot commented 10 years ago
Bugzilla Link 18030
Resolution FIXED
Resolved on Nov 23, 2013 08:27
Version trunk
OS All
Reporter LLVM Bugzilla Contributor

Extended Description

This is about r195440 clang-format: Improve formatting of ObjC method expressions.

Generally I agree that normally we should keep arguments stick to colon, but I think it does not work as intended.

(1) really weird indent when breaking before type (cast), shouldn't type (cast) have higher penalty than ObjC colon?

---------------------------- WAS -------------------------------------

---------------------------- WAS -------------------------------------

(2) Why it is tearing @[ apart, @[ and @{ should not be breakable at all, also indent is somehow weird.

---------------------------- WAS ------------------------------------- [mailComposeViewController setToRecipients: @[ NSBundle.mainBundle.infoDictionary[@"ABBFeedbackEmail"] ]]; ---------------------------- NOW ------------------------------------- [mailComposeViewController setToRecipients:@ [ NSBundle.mainBundle.infoDictionary[@"ABBFeedbackEmail"] ]];

---------------------------- WAS ------------------------------------- _navigationSegmentedControl = [[UISegmentedControl alloc] initWithItems: @[ [[UIImage imageNamed:@"NavUpWhite"] ABB_buttonIcon], [[UIImage imageNamed:@"NavDownWhite"] ABB_buttonIcon] ]]; ---------------------------- NOW ------------------------------------- _navigationSegmentedControl = [[UISegmentedControl alloc] initWithItems:@ [ [[UIImage imageNamed:@"NavUpWhite"] ABB_buttonIcon], [[UIImage imageNamed:@"NavDownWhite"] ABB_buttonIcon] ]];

llvmbot commented 10 years ago

Fixed in r195550.