Support dynamic array elements in std::randomize (#6896)

This commit is contained in:
Ryszard Rozak
2026-01-08 09:02:28 -05:00
committed by GitHub
parent 6abfaf23a5
commit 97d5844f2e
3 changed files with 23 additions and 3 deletions
+5
View File
@@ -184,6 +184,8 @@ class RandomizeMarkVisitor final : public VNVisitor {
exprp = arrselp->fromp();
} else if (const AstStructSel* const strselp = VN_CAST(exprp, StructSel)) {
exprp = strselp->fromp();
} else if (const AstCMethodHard* const methodp = VN_CAST(exprp, CMethodHard)) {
exprp = methodp->fromp();
} else {
break;
}
@@ -359,6 +361,9 @@ class RandomizeMarkVisitor final : public VNVisitor {
} else if (AstStructSel* const structSelp = VN_CAST(exprp, StructSel)) {
exprp = structSelp->fromp();
continue; // Skip StructSel, continue traversing
} else if (AstCMethodHard* const methodp = VN_CAST(exprp, CMethodHard)) {
exprp = methodp->fromp();
continue;
} else if (AstVarRef* const varrefp = VN_CAST(exprp, VarRef)) {
randVarp = varrefp->varp();
varrefp->user1(true);