summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/lib/Format/UnwrappedLineParser.cpp7
-rw-r--r--clang/unittests/Format/FormatTest.cpp1
2 files changed, 7 insertions, 1 deletions
diff --git a/clang/lib/Format/UnwrappedLineParser.cpp b/clang/lib/Format/UnwrappedLineParser.cpp
index 1c2a8fe4889..170c8926091 100644
--- a/clang/lib/Format/UnwrappedLineParser.cpp
+++ b/clang/lib/Format/UnwrappedLineParser.cpp
@@ -255,7 +255,12 @@ void UnwrappedLineParser::calculateBraceTypes() {
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);
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp
index 682aa522231..c4d9c6f573b 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -3641,6 +3641,7 @@ TEST_F(FormatTest, LayoutCxx11ConstructorBraceInitializers) {
" aaaaaaaaaaaaaaaaaaaa, aaaaa }\n"
" : vector<int>{ bbbbbbbbbbbbbbbbbbbbbbbbbbb,\n"
" bbbbbbbbbbbbbbbbbbbb, bbbbb };");
+ verifyFormat("DoSomethingWithVector({} /* No data */);");
FormatStyle NoSpaces = getLLVMStyle();
NoSpaces.SpacesInBracedLists = false;
OpenPOWER on IntegriCloud