r193153 - Remove incorrect assert.
Manuel Klimek
klimek at google.com
Tue Oct 22 01:27:19 PDT 2013
Author: klimek
Date: Tue Oct 22 03:27:19 2013
New Revision: 193153
URL: http://llvm.org/viewvc/llvm-project?rev=193153&view=rev
Log:
Remove incorrect assert.
If we run into the second preprocessor branch chain, the first branch
chain might have already set the maximum branch count on that level to
something > 0.
Fixes PR17645.
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=193153&r1=193152&r2=193153&view=diff
==============================================================================
--- cfe/trunk/lib/Format/UnwrappedLineParser.cpp (original)
+++ cfe/trunk/lib/Format/UnwrappedLineParser.cpp Tue Oct 22 03:27:19 2013
@@ -485,7 +485,6 @@ void UnwrappedLineParser::parsePPEndIf()
assert(PPBranchLevel < (int)PPLevelBranchIndex.size());
if (PPBranchLevel >= 0 && !PPChainBranchIndex.empty()) {
if (PPChainBranchIndex.top() + 1 > PPLevelBranchCount[PPBranchLevel]) {
- assert(PPLevelBranchCount[PPBranchLevel] == 0);
PPLevelBranchCount[PPBranchLevel] = PPChainBranchIndex.top() + 1;
}
}
Modified: cfe/trunk/unittests/Format/FormatTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTest.cpp?rev=193153&r1=193152&r2=193153&view=diff
==============================================================================
--- cfe/trunk/unittests/Format/FormatTest.cpp (original)
+++ cfe/trunk/unittests/Format/FormatTest.cpp Tue Oct 22 03:27:19 2013
@@ -2327,6 +2327,12 @@ TEST_F(FormatTest, LayoutStatementsAroun
getLLVMStyleWithColumns(28));
verifyFormat("#if 1\n"
"int i;");
+ verifyFormat(
+ "#if 1\n"
+ "#endif\n"
+ "#if 1\n"
+ "#else\n"
+ "#endif\n");
}
TEST_F(FormatTest, FormatsJoinedLinesOnSubsequentRuns) {
More information about the cfe-commits
mailing list