r237568 - clang-format: Fix regression introduced by r237565.
Daniel Jasper
djasper at google.com
Mon May 18 07:12:24 PDT 2015
Author: djasper
Date: Mon May 18 09:12:24 2015
New Revision: 237568
URL: http://llvm.org/viewvc/llvm-project?rev=237568&view=rev
Log:
clang-format: Fix regression introduced by r237565.
Before:
class C : public D {
SomeClass SC { 2 };
};
After:
class C : public D {
SomeClass SC{2};
};
Modified:
cfe/trunk/lib/Format/UnwrappedLineParser.cpp
cfe/trunk/unittests/Format/FormatTest.cpp
Modified: cfe/trunk/lib/Format/UnwrappedLineParser.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/UnwrappedLineParser.cpp?rev=237568&r1=237567&r2=237568&view=diff
==============================================================================
--- cfe/trunk/lib/Format/UnwrappedLineParser.cpp (original)
+++ cfe/trunk/lib/Format/UnwrappedLineParser.cpp Mon May 18 09:12:24 2015
@@ -351,7 +351,8 @@ void UnwrappedLineParser::calculateBrace
NextTok->isOneOf(tok::comma, tok::period, tok::colon,
tok::r_paren, tok::r_square, tok::l_brace,
tok::l_paren, tok::ellipsis) ||
- (NextTok->is(tok::semi) && !ExpectClassBody) ||
+ (NextTok->is(tok::semi) &&
+ (!ExpectClassBody || LBraceStack.size() != 1)) ||
(NextTok->isBinaryOperator() && !NextIsObjCMethod);
}
if (ProbablyBracedList) {
Modified: cfe/trunk/unittests/Format/FormatTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTest.cpp?rev=237568&r1=237567&r2=237568&view=diff
==============================================================================
--- cfe/trunk/unittests/Format/FormatTest.cpp (original)
+++ cfe/trunk/unittests/Format/FormatTest.cpp Mon May 18 09:12:24 2015
@@ -6192,6 +6192,9 @@ TEST_F(FormatTest, LayoutCxx11BraceIniti
" aaaa,\n"
" },\n"
"};");
+ verifyFormat("class C : public D {\n"
+ " SomeClass SC{2};\n"
+ "};");
// In combination with BinPackParameters = false.
FormatStyle NoBinPacking = getLLVMStyle();
More information about the cfe-commits
mailing list