summaryrefslogtreecommitdiffstats
path: root/clang/lib/Format
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2015-05-17 07:27:09 +0000
committerDaniel Jasper <djasper@google.com>2015-05-17 07:27:09 +0000
commit2fd16632bc25cc1c7246f4f6ce7cd45240c06ead (patch)
treee03b13af9f6d1c7b85681c5ba3647d1beff5c898 /clang/lib/Format
parent270c5257e610337a52fcc34efbd002ae81e45442 (diff)
downloadbcm5719-llvm-2fd16632bc25cc1c7246f4f6ce7cd45240c06ead.tar.gz
bcm5719-llvm-2fd16632bc25cc1c7246f4f6ce7cd45240c06ead.zip
clang-format: Improve line wrapping around << operators.
Generally, clang-format tries to keep label-value pairs on a single line for stream operators. However, we should not do that if there is just a single such pair, as that doesn't help much. Before: llvm::errs() << "aaaaaaaaaaaa: " << aaaaaaa(aaaaaaaaa, aaaaaaaaa); After: llvm::errs() << "aaaaaaaaaaaa: " << aaaaaaa(aaaaaaaaa, aaaaaaaaa); Also remove old test case that was testing actual behavior any more. llvm-svn: 237535
Diffstat (limited to 'clang/lib/Format')
-rw-r--r--clang/lib/Format/TokenAnnotator.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp
index d61f5b81ba7..94de217eb8e 100644
--- a/clang/lib/Format/TokenAnnotator.cpp
+++ b/clang/lib/Format/TokenAnnotator.cpp
@@ -1685,7 +1685,8 @@ unsigned TokenAnnotator::splitPenalty(const AnnotatedLine &Line,
return 50;
if (Right.is(tok::lessless)) {
- if (Left.is(tok::string_literal)) {
+ if (Left.is(tok::string_literal) &&
+ (!Right.LastOperator || Right.OperatorIndex != 1)) {
StringRef Content = Left.TokenText;
if (Content.startswith("\""))
Content = Content.drop_front(1);
OpenPOWER on IntegriCloud