Skip to content

Commit 2c41a06

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. (cherry picked from commit d060eef)
1 parent ccc36ed commit 2c41a06

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
@@ -661,7 +661,7 @@ struct CoverageMapping : public ASTWalker {
661661
assignCounter(E);
662662
} else if (auto *IE = dyn_cast<IfExpr>(E)) {
663663
CounterExpr &ThenCounter = assignCounter(IE->getThenExpr());
664-
if (Parent.isNull() || RegionStack.empty())
664+
if (RegionStack.empty())
665665
assignCounter(IE->getElseExpr());
666666
else
667667
assignCounter(IE->getElseExpr(),

0 commit comments

Comments
 (0)