Skip to content

Commit

Permalink
Skip branch coverage inside functions
Browse files Browse the repository at this point in the history
  • Loading branch information
tgorochowik committed Dec 27, 2024
1 parent 8d008c7 commit 7fb9fa4
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/V3Coverage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,11 @@ class CoverageVisitor final : public VNVisitor {
}
iterateChildren(nodep);
}
void visit(AstFunc* nodep) override {
VL_RESTORER(m_state);
m_state.m_on = false;
iterateChildren(nodep);
}

void visit(AstNodeProcedure* nodep) override { iterateProcedure(nodep); }
void visit(AstWhile* nodep) override { iterateProcedure(nodep); }
Expand Down Expand Up @@ -405,6 +410,10 @@ class CoverageVisitor final : public VNVisitor {
void visit(AstCond* nodep) override {
UINFO(4, " COND: " << nodep << endl);

if (!m_state.m_on) {
return;
}

// Current method cannot run coverage for impure statements
if (!nodep->condp()->isPure()) {
return;
Expand Down

0 comments on commit 7fb9fa4

Please sign in to comment.