Fix braced-list detection in lieu of trailing comments.
Before:
DoSomethingWithVector({
} /* No data */);
After:
DoSomethingWithVector({} /* No data */);
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185319 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Format/UnwrappedLineParser.cpp b/lib/Format/UnwrappedLineParser.cpp
index 1c2a8fe..170c892 100644
--- a/lib/Format/UnwrappedLineParser.cpp
+++ b/lib/Format/UnwrappedLineParser.cpp
@@ -255,7 +255,12 @@
SmallVector<unsigned, 8> LBraceStack;
assert(Tok->Tok.is(tok::l_brace));
do {
- FormatToken *NextTok = Tokens->getNextToken();
+ // Get next none-comment token.
+ FormatToken *NextTok;
+ do {
+ NextTok = Tokens->getNextToken();
+ } while (NextTok->is(tok::comment));
+
switch (Tok->Tok.getKind()) {
case tok::l_brace:
LBraceStack.push_back(Position);