Skip to content

Commit

Permalink
Disable branch coverage for ternary operators on locals
Browse files Browse the repository at this point in the history
Signed-off-by: Krzysztof Bieganski <kbieganski@antmicro.com>
  • Loading branch information
kbieganski authored and tgorochowik committed Jan 22, 2025
1 parent 1c243e3 commit 7240454
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/V3Coverage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,11 @@ class CoverageVisitor final : public VNVisitor {
return;
}

if (nodep->condp()->exists([](AstVarRef* refp) { return refp->varp()->isFuncLocal(); })) {
// If the condition has locals, bail out. They won't be resolved in the fake always
return;
}

auto fakeIf = new AstIf(nodep->fileline(), nodep->condp()->cloneTree(true));
FileLine* newFl = new FileLine{nodep->fileline()};
auto always = new AstAlways{newFl, VAlwaysKwd::ALWAYS, nullptr, fakeIf};
Expand Down

0 comments on commit 7240454

Please sign in to comment.