Skip to content

Commit d060eef

Browse files
committed
[Coverage] Simplify a check (NFC)
When handling ternary expressions, we check that an active region exists before attempting to access its counter. It's not necessary to check that the parent AST node is null, and also that the region stack is empty. The second check is stronger than the first one.
1 parent 7094a64 commit d060eef

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/SILGen/SILGenProfiling.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -641,7 +641,7 @@ struct CoverageMapping : public ASTWalker {
641641
assignCounter(E);
642642
} else if (auto *IE = dyn_cast<IfExpr>(E)) {
643643
CounterExpr &ThenCounter = assignCounter(IE->getThenExpr());
644-
if (Parent.isNull() || RegionStack.empty())
644+
if (RegionStack.empty())
645645
assignCounter(IE->getElseExpr());
646646
else
647647
assignCounter(IE->getElseExpr(),

0 commit comments

Comments
 (0)