diff options
| author | Daniel Jasper <djasper@google.com> | 2013-05-31 10:09:55 +0000 |
|---|---|---|
| committer | Daniel Jasper <djasper@google.com> | 2013-05-31 10:09:55 +0000 |
| commit | eb48366d41a6dcca236f1e28aea61efd569a3374 (patch) | |
| tree | c0ceac42041ed0531f850f802e85048510e14fb9 /lib/Format/UnwrappedLineParser.cpp | |
| parent | 042ca3de1e8d723cb73ee4d9984509e4489a6bb7 (diff) | |
| download | clang-eb48366d41a6dcca236f1e28aea61efd569a3374.tar.gz clang-eb48366d41a6dcca236f1e28aea61efd569a3374.tar.bz2 clang-eb48366d41a6dcca236f1e28aea61efd569a3374.tar.xz | |
Fix detection/formatting of braced lists in ternary expressions.
Before:
foo = aaaaaaaaaaa ? vector<int> {
aaaaaaaaaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaa, aaaaa
}
: vector<int>{ bbbbbbbbbbbbbbbbbbbbbbbbbbb, bbbbbbbbbbbbbbbbbbbb, bbbbb };
After:
foo = aaaaaaaaaaa ? vector<int>{ aaaaaaaaaaaaaaaaaaaaaaaaaaa,
aaaaaaaaaaaaaaaaaaaa, aaaaa }
: vector<int>{ bbbbbbbbbbbbbbbbbbbbbbbbbbb,
bbbbbbbbbbbbbbbbbbbb, bbbbb };
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182992 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Format/UnwrappedLineParser.cpp')
| -rw-r--r-- | lib/Format/UnwrappedLineParser.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/Format/UnwrappedLineParser.cpp b/lib/Format/UnwrappedLineParser.cpp index 3b72bef601..618f54a518 100644 --- a/lib/Format/UnwrappedLineParser.cpp +++ b/lib/Format/UnwrappedLineParser.cpp @@ -264,8 +264,8 @@ void UnwrappedLineParser::calculateBraceTypes() { // Thus, if the parent is a braced init list, we consider all // brace blocks inside it braced init list. That works good enough // for now, but we will need to fix it to correctly handle lambdas. - if (NextTok->Tok.is(tok::comma) || NextTok->Tok.is(tok::semi) || - NextTok->Tok.is(tok::r_paren) || NextTok->Tok.is(tok::l_brace)) + if (NextTok->isOneOf(tok::comma, tok::semi, tok::r_paren, + tok::l_brace, tok::colon)) LBraces[LBraceStack.back()] = BS_BracedInit; else LBraces[LBraceStack.back()] = BS_Block; |
