summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorManuel Klimek <klimek@google.com>2013-10-22 08:27:19 +0000
committerManuel Klimek <klimek@google.com>2013-10-22 08:27:19 +0000
commitf6fd3d3fcf7eeeca3cd5774db1f896838b2b56dd (patch)
tree62c5c5eab791fbee79032bc27d1b769fc55f5340 /clang
parent7855b38c0ede008ad61dfccd0b7b203e616afbde (diff)
downloadbcm5719-llvm-f6fd3d3fcf7eeeca3cd5774db1f896838b2b56dd.tar.gz
bcm5719-llvm-f6fd3d3fcf7eeeca3cd5774db1f896838b2b56dd.zip
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. llvm-svn: 193153
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/Format/UnwrappedLineParser.cpp1
-rw-r--r--clang/unittests/Format/FormatTest.cpp6
2 files changed, 6 insertions, 1 deletions
diff --git a/clang/lib/Format/UnwrappedLineParser.cpp b/clang/lib/Format/UnwrappedLineParser.cpp
index 949f5a308b2..e0b090f6abc 100644
--- a/clang/lib/Format/UnwrappedLineParser.cpp
+++ b/clang/lib/Format/UnwrappedLineParser.cpp
@@ -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;
}
}
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp
index a7de81b2678..20132f9cccc 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -2327,6 +2327,12 @@ TEST_F(FormatTest, LayoutStatementsAroundPreprocessorDirectives) {
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) {
OpenPOWER on IntegriCloud