Add UNUSEDLOOP when unused loop is removed (#4926)

This commit is contained in:
Bartłomiej Chmiel
2024-03-07 08:33:49 -05:00
committed by GitHub
parent 6db149c588
commit 32f288084a
11 changed files with 396 additions and 21 deletions
+3
View File
@@ -3300,6 +3300,9 @@ class ConstVisitor final : public VNVisitor {
if (nodep->precondsp()) {
nodep->replaceWith(nodep->precondsp());
} else {
nodep->v3warn(UNUSEDLOOP,
"Loop condition is always false; body will never execute");
nodep->fileline()->modifyWarnOff(V3ErrorCode::UNUSEDLOOP, true);
nodep->unlinkFrBack();
}
VL_DO_DANGLING(pushDeletep(nodep), nodep);