Internals: clean up begin blocks and lifetimes in foreach loops (#5306)

According to IEEE 1800-2023 12.7.3, the loop creates an implicit block
around it, containing declarations of the loop variables with automatic
lifetime.

No functional change intended.

Signed-off-by: Arkadiusz Kozdra <[email protected]>
This commit is contained in:
Arkadiusz Kozdra
2024-07-26 05:50:29 -04:00
committed by GitHub
parent b9e1d55262
commit 1600cc01a4
4 changed files with 7 additions and 5 deletions
+1
View File
@@ -1487,6 +1487,7 @@ class LinkDotFindVisitor final : public VNVisitor {
// We use an int type, this might get changed in V3Width when types resolve
argrefp = new AstVar{parserefp->fileline(), VVarType::BLOCKTEMP,
parserefp->name(), argp->findSigned32DType()};
argrefp->lifetime(VLifetime::AUTOMATIC);
parserefp->replaceWith(argrefp);
VL_DO_DANGLING(parserefp->deleteTree(), parserefp);
// Insert argref's name into symbol table