fixed module utils

This commit is contained in:
ALEXks
2025-05-07 15:00:01 +03:00
committed by Egor Mayorov
parent fb93a5b1aa
commit 9ab4f8aba0
2 changed files with 14 additions and 5 deletions

View File

@@ -310,8 +310,17 @@ static void getModuleSymbols(SgStatement* func, set<SgSymbol*>& symbs)
SgSymbol* s = func->symbol()->next();
while (s)
{
if (IS_BY_USE(s) && s->scope() && s->scope()->symbol()->identifier() == currScope)
symbs.insert(s);
if (func->variant() == MODULE_STMT)
{
if (s->scope() && s->scope()->symbol() && s->scope()->symbol()->identifier())
if (s->scope()->symbol()->identifier() == currScope)
symbs.insert(s);
}
else
{
if (IS_BY_USE(s) && s->scope() && s->scope()->symbol()->identifier() == currScope)
symbs.insert(s);
}
s = s->next();
}
}
@@ -325,9 +334,9 @@ const set<SgSymbol*>& getModuleSymbols(SgStatement *func)
set<SgSymbol*> symbs;
getModuleSymbols(func, symbs);
//if function in contains
//if function or module in contains
auto cp = func->controlParent();
if (isSgProgHedrStmt(cp))
if (isSgProgHedrStmt(cp) || cp->variant() == MODULE_STMT)
getModuleSymbols(cp, symbs);
symbolsForFunc[func->symbol()->identifier()] = symbs;

View File

@@ -1,3 +1,3 @@
#pragma once
#define VERSION_SPF "2415"
#define VERSION_SPF "2416"