fixed function names

This commit is contained in:
ALEXks
2024-03-23 11:17:16 +03:00
parent 24fe7b4bad
commit 84c8394ae7

View File

@@ -9,6 +9,7 @@
using std::vector; using std::vector;
using std::map; using std::map;
using std::set; using std::set;
using std::string;
static const char commonIntLetters[6] = { 'i', 'j', 'k', 'm', 'n', 'l' }; static const char commonIntLetters[6] = { 'i', 'j', 'k', 'm', 'n', 'l' };
@@ -131,6 +132,9 @@ static map<char, SgType*> FunctionImplicitCheck(SgStatement* function, const map
for (auto& var : allVars) for (auto& var : allVars)
{ {
if (string(var->identifier()) == function->symbol()->identifier())
continue;
vector<SgStatement*> _; vector<SgStatement*> _;
SgStatement* declaredInStatement = declaratedInStmt(var, &_, false); SgStatement* declaredInStatement = declaratedInStmt(var, &_, false);
if (declaredInStatement == NULL) if (declaredInStatement == NULL)
@@ -162,7 +166,11 @@ static map<char, SgType*> FunctionImplicitCheck(SgStatement* function, const map
st = st->lexNext(); st = st->lexNext();
} }
function->insertStmtAfter(*new SgStatement(IMPL_DECL), *function); auto implNone = new SgStatement(IMPL_DECL);
implNone->setlineNumber(function->lineNumber());
implNone->setFileName(function->fileName());
function->insertStmtAfter(*implNone, *function);
} }
allVars.clear(); allVars.clear();
@@ -173,6 +181,10 @@ static map<char, SgType*> FunctionImplicitCheck(SgStatement* function, const map
void ImplicitCheck(SgFile* file) void ImplicitCheck(SgFile* file)
{ {
if (file->filename() == std::string("add.f"))
{
file->unparsestdout();
}
map<SgStatement*, map<char, SgType*>> typesByFunctions; map<SgStatement*, map<char, SgType*>> typesByFunctions;
for (int func = 0; func < file->numberOfFunctions(); ++func) for (int func = 0; func < file->numberOfFunctions(); ++func)
@@ -182,4 +194,9 @@ void ImplicitCheck(SgFile* file)
} }
typesByFunctions.clear(); typesByFunctions.clear();
if (file->filename() == std::string("add.f"))
{
file->unparsestdout();
}
} }