diff options
author | Daniel Jasper <djasper@google.com> | 2013-11-23 14:27:27 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2013-11-23 14:27:27 +0000 |
commit | 4bf0d809938a993e3321d4f6e5097e854fe9bd53 (patch) | |
tree | 097218505873e35ba8f334cfd8527cba9b68b3d0 /clang/unittests/Format/FormatTest.cpp | |
parent | a2fde9484f98686d39f54618cf40b63dde92acf7 (diff) | |
download | bcm5719-llvm-4bf0d809938a993e3321d4f6e5097e854fe9bd53.tar.gz bcm5719-llvm-4bf0d809938a993e3321d4f6e5097e854fe9bd53.zip |
clang-format: Fix bug in ObjC method declaration formatting.
Also disallow breaking between "@" and "{" or "[".
Before:
- (NSAttributedString *)attributedStringForSegment:(NSUInteger)segment
index:(NSUInteger)index
attributes:(NSDictionary *)attributes
nonDigitAttributes:(NSDictionary *)
nonDigitAttributes;
[mailComposeViewController
setToRecipients:@
[ NSBundle.mainBundle.infoDictionary[@"ABBFeedbackEmail"] ]];
After:
- (NSAttributedString *)attributedStringForSegment:(NSUInteger)segment
index:(NSUInteger)index
attributes:(NSDictionary *)attributes
nonDigitAttributes:
(NSDictionary *)nonDigitAttributes;
[mailComposeViewController
setToRecipients:
@[ NSBundle.mainBundle.infoDictionary[@"ABBFeedbackEmail"] ]];
This fixes llvm.org/PR18030.
llvm-svn: 195550
Diffstat (limited to 'clang/unittests/Format/FormatTest.cpp')
-rw-r--r-- | clang/unittests/Format/FormatTest.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp index 5404c49a017..97444dde842 100644 --- a/clang/unittests/Format/FormatTest.cpp +++ b/clang/unittests/Format/FormatTest.cpp @@ -5751,6 +5751,14 @@ TEST_F(FormatTest, ObjCArrayLiterals) { " @\"aaaaaaaaaaaaaaaaa\",\n" " @\"aaaaaaaaaaaaaaaaa\",\n" "];"); + verifyFormat( + "- (NSAttributedString *)attributedStringForSegment:(NSUInteger)segment\n" + " index:(NSUInteger)index\n" + " nonDigitAttributes:\n" + " (NSDictionary *)noDigitAttributes;"); + verifyFormat( + "[someFunction someLooooooooooooongParameter:\n" + " @[ NSBundle.mainBundle.infoDictionary[@\"a\"] ]];"); } TEST_F(FormatTest, ReformatRegionAdjustsIndent) { |