summaryrefslogtreecommitdiffstats
path: root/clang/lib/Format/TokenAnnotator.cpp
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2017-02-06 10:55:49 +0000
committerDaniel Jasper <djasper@google.com>2017-02-06 10:55:49 +0000
commit2db1b4a177cb28527c36bde8d1db0a9cfdc1019f (patch)
treefcdda2061b41b65ec5a4ad8d8423683cf83d484f /clang/lib/Format/TokenAnnotator.cpp
parent60ca31dff8b9ea750156d41213f54ddf35be1f43 (diff)
downloadbcm5719-llvm-2db1b4a177cb28527c36bde8d1db0a9cfdc1019f.tar.gz
bcm5719-llvm-2db1b4a177cb28527c36bde8d1db0a9cfdc1019f.zip
clang-format: Fix bug with conflicting BreakBeforeBinaryOperations and AlignAfterOpenBracket
Fix for the formatting options combination of BreakBeforeBinaryOperators: All, AlignAfterOpenBracket: AlwaysBreak not handling long templates correctly. This patch allows a break after an opening left parenthesis, TemplateOpener, or bracket when both options are enabled. Patch by Daphne Pfister, thank you! Fixes llvm.org/PR30304. llvm-svn: 294179
Diffstat (limited to 'clang/lib/Format/TokenAnnotator.cpp')
-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 a462fbc5426..bfb74f0b962 100644
--- a/clang/lib/Format/TokenAnnotator.cpp
+++ b/clang/lib/Format/TokenAnnotator.cpp
@@ -2635,7 +2635,8 @@ bool TokenAnnotator::canBreakBefore(const AnnotatedLine &Line,
tok::colon, tok::l_square, tok::at) ||
(Left.is(tok::r_paren) &&
Right.isOneOf(tok::identifier, tok::kw_const)) ||
- (Left.is(tok::l_paren) && !Right.is(tok::r_paren));
+ (Left.is(tok::l_paren) && !Right.is(tok::r_paren)) ||
+ (Left.is(TT_TemplateOpener) && !Right.is(TT_TemplateCloser));
}
void TokenAnnotator::printDebugInfo(const AnnotatedLine &Line) {
OpenPOWER on IntegriCloud