summaryrefslogtreecommitdiffstats
path: root/clang/lib/Format
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2013-07-11 21:02:56 +0000
committerDaniel Jasper <djasper@google.com>2013-07-11 21:02:56 +0000
commit718bd366cf85d9f24a839ce09c01d44de21ad058 (patch)
tree398ae7ec5173917eddca1f37592cf2eef937167d /clang/lib/Format
parentdb06b139fde5c1eea931b5bed35da589b8f430e2 (diff)
downloadbcm5719-llvm-718bd366cf85d9f24a839ce09c01d44de21ad058.tar.gz
bcm5719-llvm-718bd366cf85d9f24a839ce09c01d44de21ad058.zip
clang-format: Break before trailing annotations.
(if they are not function-like). Before: SomeFunction(aaaaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaaaa) OVERRIDE; After: SomeFunction(aaaaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaaaa) OVERRIDE; llvm-svn: 186117
Diffstat (limited to 'clang/lib/Format')
-rw-r--r--clang/lib/Format/TokenAnnotator.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp
index 14206445fac..259378157e8 100644
--- a/clang/lib/Format/TokenAnnotator.cpp
+++ b/clang/lib/Format/TokenAnnotator.cpp
@@ -1052,8 +1052,10 @@ unsigned TokenAnnotator::splitPenalty(const AnnotatedLine &Line,
return 150;
}
- // Breaking before a trailing 'const' is bad.
- if (Left.is(tok::r_paren) && Right.is(tok::kw_const))
+ // Breaking before a trailing 'const' or not-function-like annotation is bad.
+ if (Left.is(tok::r_paren) &&
+ (Right.is(tok::kw_const) || (Right.is(tok::identifier) && Right.Next &&
+ Right.Next->isNot(tok::l_paren))))
return 150;
// In for-loops, prefer breaking at ',' and ';'.
OpenPOWER on IntegriCloud