Give iterated variables in foreach loops VAUTOM lifetimes (#4265)

Signed-off-by: Krzysztof Boronski <kboronski@antmicro.com>
This commit is contained in:
Krzysztof Boroński 2023-06-02 17:16:42 +02:00 committed by GitHub
parent 0e24f36fef
commit 545caba720
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4680,6 +4680,7 @@ private:
FileLine* const fl = varp->fileline();
auto* const whilep = new AstWhile{
fl, condp, bodysp, new AstAssign{fl, new AstVarRef{fl, varp, VAccess::WRITE}, incp}};
varp->lifetime(VLifetime::AUTOMATIC);
AstNode* const stmtsp = varp; // New statements for under new Begin
stmtsp->addNext(new AstAssign{fl, new AstVarRef{fl, varp, VAccess::WRITE}, leftp});
stmtsp->addNext(whilep);