diff options
Diffstat (limited to 'clang/lib/CodeGen/CoverageMappingGen.cpp')
-rw-r--r-- | clang/lib/CodeGen/CoverageMappingGen.cpp | 26 |
1 files changed, 6 insertions, 20 deletions
diff --git a/clang/lib/CodeGen/CoverageMappingGen.cpp b/clang/lib/CodeGen/CoverageMappingGen.cpp index ce39b72..38d16e6 100644 --- a/clang/lib/CodeGen/CoverageMappingGen.cpp +++ b/clang/lib/CodeGen/CoverageMappingGen.cpp @@ -966,11 +966,8 @@ struct CounterCoverageMappingBuilder // The old behavior of SingleByte is unaware of Branches. // Will be pruned after the migration of SingleByte. - if (llvm::EnableSingleByteCoverage) { - assert(SkipCntForOld && - "SingleByte must provide SkipCntForOld as a fake Skipped count."); + if (llvm::EnableSingleByteCoverage && SkipCntForOld) return {ExecCnt, *SkipCntForOld}; - } BranchCounterPair Counters = {ExecCnt, Builder.subtract(ParentCnt, ExecCnt)}; @@ -2093,12 +2090,7 @@ struct CounterCoverageMappingBuilder extendRegion(S->getCond()); Counter ParentCount = getRegion().getCounter(); - auto [ThenCount, ElseCount] = - (llvm::EnableSingleByteCoverage - ? BranchCounterPair{getRegionCounter(S->getThen()), - (S->getElse() ? getRegionCounter(S->getElse()) - : Counter::getZero())} - : getBranchCounterPair(S, ParentCount)); + auto [ThenCount, ElseCount] = getBranchCounterPair(S, ParentCount); // Emitting a counter for the condition makes it easier to interpret the // counter for the body when looking at the coverage. @@ -2123,26 +2115,20 @@ struct CounterCoverageMappingBuilder fillGapAreaWithCount(Gap->getBegin(), Gap->getEnd(), ElseCount); extendRegion(Else); - Counter ElseOutCount = propagateCounts(ElseCount, Else); - if (!llvm::EnableSingleByteCoverage) - OutCount = addCounters(OutCount, ElseOutCount); + OutCount = addCounters(OutCount, propagateCounts(ElseCount, Else)); if (ThenHasTerminateStmt) HasTerminateStmt = true; - } else if (!llvm::EnableSingleByteCoverage) + } else OutCount = addCounters(OutCount, ElseCount); - if (llvm::EnableSingleByteCoverage) - OutCount = getRegionCounter(S); - if (!IsCounterEqual(OutCount, ParentCount)) { pushRegion(OutCount); GapRegionCounter = OutCount; } - if (!llvm::EnableSingleByteCoverage) - // Create Branch Region around condition. - createBranchRegion(S->getCond(), ThenCount, ElseCount); + // Create Branch Region around condition. + createBranchRegion(S->getCond(), ThenCount, ElseCount); } void VisitCXXTryStmt(const CXXTryStmt *S) { |