fixed implicit none and imterfaces insertion

This commit is contained in:
ALEXks
2024-05-13 10:37:59 +03:00
parent 4a13250d1c
commit 0b6a915753
3 changed files with 26 additions and 8 deletions

View File

@@ -960,10 +960,12 @@ static string getInterfaceBlock(SgStatement* func, const FuncParam& pars)
st = copy->lexNext();
while (st != last)
{
if (st->variant() == VAR_DECL
|| st->variant() == VAR_DECL_90
|| st->variant() == DIM_STAT
|| st->variant() == INTENT_STMT)
const int var = st->variant();
if (var == VAR_DECL
|| var == VAR_DECL_90
|| var == DIM_STAT
|| var == INTENT_STMT
|| var == EXTERN_STAT)
{
bool empty = filterFromList(st, idents);
if (empty)

View File

@@ -37,8 +37,12 @@ static void FindAllVars(SgExpression* expr, set<SgSymbol*>& allVars, set<SgSymbo
const int var = expr->variant();
if (var == VAR_REF || var == ARRAY_REF || var == FUNC_CALL)
allVars.insert(expr->symbol());
if (var == CONST_REF)
{
auto s = expr->symbol();
if ((s->attributes() & EXTERNAL_BIT) == 0)
allVars.insert(s);
}
else if (var == CONST_REF)
allVarsConst.insert(expr->symbol());
FindAllVars(expr->lhs(), allVars, allVarsConst);
@@ -183,7 +187,7 @@ static map<char, SgType*> FunctionImplicitCheck(SgStatement* function, const map
set<int> skip = { EXTERN_STAT };
for (auto st = function; st != endOfFunc && st->variant() != CONTAINS_STMT; st = st->lexNext())
for (auto st = function->lexNext(); st != endOfFunc && st->variant() != CONTAINS_STMT; st = st->lexNext())
{
if (skip.count(st->variant()))
continue;
@@ -195,6 +199,18 @@ static map<char, SgType*> FunctionImplicitCheck(SgStatement* function, const map
allVars.insert(isSgForStmt(st)->doName());
}
//add parameters
auto prog = isSgProgHedrStmt(function);
if (prog)
{
for (int z = 0; z < prog->numberOfParameters(); ++z)
{
auto s = prog->parameter(z);
if ((s->attributes() & EXTERNAL_BIT) == 0)
allVars.insert(s);
}
}
varsWithoutDecl = getVars(function->symbol()->identifier(), toRename, allVars, types);
varsWithoutDeclConst = getVars(function->symbol()->identifier(), toRename, allVarsConst, types);

View File

@@ -1,3 +1,3 @@
#pragma once
#define VERSION_SPF "2333"
#define VERSION_SPF "2334"