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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193153
91177308-0d34-0410-b5e6-
96231b3b80d8
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;
}
}
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) {