Fix foreach and pre/post increment in functions (#3613).

This commit is contained in:
Wilson Snyder
2022-10-18 20:04:09 -04:00
parent 2723223884
commit b930d0731a
5 changed files with 23 additions and 3 deletions
+1 -1
View File
@@ -175,7 +175,7 @@ private:
// Find all var->varscope mappings, for later cleanup
for (AstNode* stmtp = nodep->varsp(); stmtp; stmtp = stmtp->nextp()) {
if (AstVarScope* const vscp = VN_CAST(stmtp, VarScope)) {
if (vscp->varp()->isFuncLocal()) {
if (vscp->varp()->isFuncLocal() || vscp->varp()->isUsedLoopIdx()) {
UINFO(9, " funcvsc " << vscp << endl);
m_varToScopeMap.insert(
std::make_pair(std::make_pair(nodep, vscp->varp()), vscp));