summaryrefslogtreecommitdiffstats
path: root/clang/lib/Format
diff options
context:
space:
mode:
authorOwen Pan <owenpiano@gmail.com>2019-09-10 23:26:45 +0000
committerOwen Pan <owenpiano@gmail.com>2019-09-10 23:26:45 +0000
commitd40ddb9df26b4a8b5cf8ad7c920a9acccb98a13c (patch)
treead5f9d08d0efcf0cd9320a70c737ecebc7160e41 /clang/lib/Format
parent2af5b193d5e51409e20b85b62efdf743069ebb31 (diff)
downloadbcm5719-llvm-d40ddb9df26b4a8b5cf8ad7c920a9acccb98a13c.tar.gz
bcm5719-llvm-d40ddb9df26b4a8b5cf8ad7c920a9acccb98a13c.zip
[clang-format] Apply BAS_AlwaysBreak to C++11 braced lists
See PR18455. Differential Revision: https://reviews.llvm.org/D67395 llvm-svn: 371571
Diffstat (limited to 'clang/lib/Format')
-rw-r--r--clang/lib/Format/ContinuationIndenter.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/clang/lib/Format/ContinuationIndenter.cpp b/clang/lib/Format/ContinuationIndenter.cpp
index 61aeb853c41..ede6a797122 100644
--- a/clang/lib/Format/ContinuationIndenter.cpp
+++ b/clang/lib/Format/ContinuationIndenter.cpp
@@ -606,7 +606,9 @@ void ContinuationIndenter::addTokenOnCurrentLine(LineState &State, bool DryRun,
// disallowing any further line breaks if there is no line break after the
// opening parenthesis. Don't break if it doesn't conserve columns.
if (Style.AlignAfterOpenBracket == FormatStyle::BAS_AlwaysBreak &&
- Previous.isOneOf(tok::l_paren, TT_TemplateOpener, tok::l_square) &&
+ (Previous.isOneOf(tok::l_paren, TT_TemplateOpener, tok::l_square) ||
+ (Previous.is(tok::l_brace) && Previous.BlockKind != BK_Block &&
+ Style.Cpp11BracedListStyle)) &&
State.Column > getNewLineColumn(State) &&
(!Previous.Previous || !Previous.Previous->isOneOf(
tok::kw_for, tok::kw_while, tok::kw_switch)) &&
OpenPOWER on IntegriCloud