summaryrefslogtreecommitdiffstats
path: root/clang/lib/Format
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2016-12-13 10:05:03 +0000
committerDaniel Jasper <djasper@google.com>2016-12-13 10:05:03 +0000
commite4ada024b0442639907f2005dc4b735b05d225bc (patch)
treef8d2f1eaf7e07bad2e742933463d172e91b4d664 /clang/lib/Format
parente7be4a004b8a0c26841e3726f201e132187db1fe (diff)
downloadbcm5719-llvm-e4ada024b0442639907f2005dc4b735b05d225bc.tar.gz
bcm5719-llvm-e4ada024b0442639907f2005dc4b735b05d225bc.zip
clang-format: Improve braced-list detection.
Before: vector<int> v { 12 } GUARDED_BY(mutex); After: vector<int> v{12} GUARDED_BY(mutex); llvm-svn: 289525
Diffstat (limited to 'clang/lib/Format')
-rw-r--r--clang/lib/Format/UnwrappedLineParser.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/clang/lib/Format/UnwrappedLineParser.cpp b/clang/lib/Format/UnwrappedLineParser.cpp
index 52278d151e7..84e06d05c73 100644
--- a/clang/lib/Format/UnwrappedLineParser.cpp
+++ b/clang/lib/Format/UnwrappedLineParser.cpp
@@ -360,8 +360,6 @@ void UnwrappedLineParser::calculateBraceTypes(bool ExpectClassBody) {
// BlockKind later if we parse a braced list (where all blocks
// inside are by default braced lists), or when we explicitly detect
// blocks (for example while parsing lambdas).
- //
- // We exclude + and - as they can be ObjC visibility modifiers.
ProbablyBracedList =
(Style.Language == FormatStyle::LK_JavaScript &&
NextTok->isOneOf(Keywords.kw_of, Keywords.kw_in,
@@ -369,6 +367,8 @@ void UnwrappedLineParser::calculateBraceTypes(bool ExpectClassBody) {
NextTok->isOneOf(tok::comma, tok::period, tok::colon,
tok::r_paren, tok::r_square, tok::l_brace,
tok::l_square, tok::l_paren, tok::ellipsis) ||
+ (NextTok->is(tok::identifier) &&
+ !PrevTok->isOneOf(tok::semi, tok::r_brace, tok::l_brace)) ||
(NextTok->is(tok::semi) &&
(!ExpectClassBody || LBraceStack.size() != 1)) ||
(NextTok->isBinaryOperator() && !NextIsObjCMethod);
OpenPOWER on IntegriCloud