fixed getNameInLocation for module functions

This commit is contained in:
ALEXks
2026-02-05 15:01:05 +03:00
parent 076a0c9699
commit 025bbbe259
2 changed files with 19 additions and 3 deletions

View File

@@ -337,8 +337,13 @@ const set<SgSymbol*>& getModuleSymbols(SgStatement *func)
//if function or module in contains
auto cp = func->controlParent();
if (isSgProgHedrStmt(cp) || cp->variant() == MODULE_STMT)
{
getModuleSymbols(cp, symbs);
if (func->variant() == FUNC_HEDR)
symbs.insert(func->symbol());
}
symbolsForFunc[func->symbol()->identifier()] = symbs;
return symbs;
}
@@ -349,9 +354,19 @@ static void findSymbol(SgStatement* func, const string& varName, const string& l
for (const auto& s : getModuleSymbols(func))
{
SgSymbol* orig = OriginalSymbol(s);
printf("%s == %s\n", orig->identifier(), s->identifier());
//any suitable symbol can be used
if (orig->identifier() == varName && orig->scope()->symbol()->identifier() == locName)
altNames[s->identifier()] = s;
if (orig->variant() == FUNCTION_NAME)
{
if (orig->identifier() == varName)
altNames[s->identifier()] = s;
}
else
{
if (orig->identifier() == varName && orig->scope()->symbol()->identifier() == locName)
altNames[s->identifier()] = s;
}
}
}
@@ -369,6 +384,7 @@ SgSymbol* getNameInLocation(SgStatement* func, const string& varName, const stri
return altNames.begin()->second;
else {
__spf_print(1, "%s (%s %s) %s\n", func->symbol()->identifier(), clearName.c_str(), varName.c_str(), locName.c_str());
findSymbol(func, varName, locName, altNames);
printInternalError(convertFileName(__FILE__).c_str(), __LINE__);
}

View File

@@ -1,3 +1,3 @@
#pragma once
#define VERSION_SPF "2457"
#define VERSION_SPF "2458"