Add ternary operator into branch coverage (#5880)

This commit is contained in:
Ryszard Rozak
2025-05-19 09:35:35 -04:00
committed by GitHub
parent ad08302e5f
commit bed0456eca
13 changed files with 1907 additions and 644 deletions
+11 -2
View File
@@ -203,9 +203,18 @@ class SliceVisitor final : public VNVisitor {
: elemIdx));
newp = new AstArraySel{nodep->fileline(), snodep->fromp()->cloneTree(false, needPure),
leOffset};
} else if (AstExprStmt* const snodep = VN_CAST(nodep, ExprStmt)) {
UINFO(9, " cloneExprStmt(" << elements << "," << elemIdx << ") " << nodep << endl);
AstNodeExpr* const resultSelp
= cloneAndSel(snodep->resultp(), elements, elemIdx, needPure);
if (snodep->stmtsp()) {
return new AstExprStmt{nodep->fileline(), snodep->stmtsp()->unlinkFrBackWithNext(),
resultSelp};
} else {
return resultSelp;
}
} else if (VN_IS(nodep, NodeVarRef) || VN_IS(nodep, NodeSel) || VN_IS(nodep, CMethodHard)
|| VN_IS(nodep, MemberSel) || VN_IS(nodep, ExprStmt)
|| VN_IS(nodep, StructSel)) {
|| VN_IS(nodep, MemberSel) || VN_IS(nodep, StructSel)) {
UINFO(9, " cloneSel(" << elements << "," << elemIdx << ") " << nodep << endl);
const int leOffset = !arrayp->rangep()->ascending()
? arrayp->rangep()->elementsConst() - 1 - elemIdx