summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2013-08-01 13:46:58 +0000
committerDaniel Jasper <djasper@google.com>2013-08-01 13:46:58 +0000
commit9688ff197e99734015c4225de9ffe528c5ffdaec (patch)
tree9d5ddda540486c60881b9a9827c2abaf1d6ea051 /clang/lib
parentb1266b5447e566e79252ef2b026b9da142801de0 (diff)
downloadbcm5719-llvm-9688ff197e99734015c4225de9ffe528c5ffdaec.tar.gz
bcm5719-llvm-9688ff197e99734015c4225de9ffe528c5ffdaec.zip
clang-format: Improve line breaks in @property.
Before: @property(nonatomic, assign, readonly) NSString *looooooooooooooooooooooooooooongName; After: @property(nonatomic, assign, readonly) NSString *looooooooooooooooooooooooooooongName; llvm-svn: 187577
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Format/TokenAnnotator.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp
index b9d26ca5219..e0e24e27488 100644
--- a/clang/lib/Format/TokenAnnotator.cpp
+++ b/clang/lib/Format/TokenAnnotator.cpp
@@ -1060,7 +1060,7 @@ unsigned TokenAnnotator::splitPenalty(const AnnotatedLine &Line,
}
// Breaking before a trailing 'const' or not-function-like annotation is bad.
- if (Left.is(tok::r_paren) &&
+ if (Left.is(tok::r_paren) && Line.Type != LT_ObjCProperty &&
(Right.is(tok::kw_const) || (Right.is(tok::identifier) && Right.Next &&
Right.Next->isNot(tok::l_paren))))
return 150;
@@ -1253,6 +1253,8 @@ bool TokenAnnotator::canBreakBefore(const AnnotatedLine &Line,
return true;
if (Right.Type == TT_ObjCSelectorName)
return true;
+ if (Left.is(tok::r_paren) && Line.Type == LT_ObjCProperty)
+ return true;
if (Left.ClosesTemplateDeclaration)
return true;
if (Right.Type == TT_ConditionalExpr || Right.is(tok::question))
OpenPOWER on IntegriCloud