fixed implicit pass
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -74,3 +74,5 @@ sapfor/experts/Sapfor_2017/Sapc++/Sapc++/x64/
|
|||||||
sapfor/experts/Sapfor_2017/Sapc++/x64/
|
sapfor/experts/Sapfor_2017/Sapc++/x64/
|
||||||
|
|
||||||
/build
|
/build
|
||||||
|
|
||||||
|
sapfor/experts/Sapfor_2017/out/
|
||||||
|
|||||||
@@ -2432,7 +2432,7 @@ int main(int argc, char **argv)
|
|||||||
int numVar = 0;
|
int numVar = 0;
|
||||||
|
|
||||||
out_free_form = 0; // F90 style out
|
out_free_form = 0; // F90 style out
|
||||||
out_upper_case = 1;
|
out_upper_case = 0;
|
||||||
out_line_unlimit = 0;
|
out_line_unlimit = 0;
|
||||||
|
|
||||||
bool printText = false;
|
bool printText = false;
|
||||||
|
|||||||
@@ -1010,7 +1010,7 @@ void commonTransfer(const map<string, vector<FuncInfo*>>& allFuncInfo, const map
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static string changeData(const string data, const map<string, string>& constSymVars, const map<string, string>& locVars)
|
static string changeData(const string& data, const map<string, string>& constSymVars, const map<string, string>& locVars)
|
||||||
{
|
{
|
||||||
int curChar = 0;
|
int curChar = 0;
|
||||||
string ident = "";
|
string ident = "";
|
||||||
|
|||||||
@@ -39,7 +39,12 @@ static void FindAllVars(SgExpression* expr, set<SgSymbol*>& allVars, set<SgSymbo
|
|||||||
if (var == VAR_REF || var == ARRAY_REF || var == FUNC_CALL)
|
if (var == VAR_REF || var == ARRAY_REF || var == FUNC_CALL)
|
||||||
{
|
{
|
||||||
auto s = expr->symbol();
|
auto s = expr->symbol();
|
||||||
if ((s->attributes() & EXTERNAL_BIT) == 0)
|
if ((s->attributes() & EXTERNAL_BIT))
|
||||||
|
{
|
||||||
|
if (var == FUNC_CALL)
|
||||||
|
allVars.insert(s);
|
||||||
|
}
|
||||||
|
else
|
||||||
allVars.insert(s);
|
allVars.insert(s);
|
||||||
}
|
}
|
||||||
else if (var == CONST_REF)
|
else if (var == CONST_REF)
|
||||||
@@ -187,11 +192,27 @@ static map<char, SgType*> FunctionImplicitCheck(SgStatement* function, const map
|
|||||||
|
|
||||||
set<int> skip = { EXTERN_STAT };
|
set<int> skip = { EXTERN_STAT };
|
||||||
|
|
||||||
|
set<SgSymbol*> allDataSymbols;
|
||||||
|
for (auto s = function->symbol()->next(); s; s = s->next())
|
||||||
|
if (s->attributes() & DATA_BIT)
|
||||||
|
allDataSymbols.insert(s);
|
||||||
|
|
||||||
for (auto st = function->lexNext(); 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()))
|
if (skip.count(st->variant()))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if (st->variant() == DATA_DECL)
|
||||||
|
{
|
||||||
|
const string str = st->expr(0)->thellnd->entry.string_val;
|
||||||
|
|
||||||
|
for (auto& data : allDataSymbols)
|
||||||
|
{
|
||||||
|
if (str.find(data->identifier()) != string::npos)
|
||||||
|
allVars.insert(data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (int i = 0; i < 3; ++i)
|
for (int i = 0; i < 3; ++i)
|
||||||
FindAllVars(st->expr(i), allVars, allVarsConst);
|
FindAllVars(st->expr(i), allVars, allVarsConst);
|
||||||
|
|
||||||
@@ -216,6 +237,8 @@ static map<char, SgType*> FunctionImplicitCheck(SgStatement* function, const map
|
|||||||
|
|
||||||
if (!hasImplicitNone)
|
if (!hasImplicitNone)
|
||||||
{
|
{
|
||||||
|
vector<SgStatement*> macro;
|
||||||
|
|
||||||
for (auto st = function->lexNext();
|
for (auto st = function->lexNext();
|
||||||
st != endOfFunc && st->variant() != CONTAINS_STMT && isSgExecutableStatement(st) == NULL;
|
st != endOfFunc && st->variant() != CONTAINS_STMT && isSgExecutableStatement(st) == NULL;
|
||||||
)
|
)
|
||||||
@@ -226,6 +249,12 @@ static map<char, SgType*> FunctionImplicitCheck(SgStatement* function, const map
|
|||||||
st = st->lexNext();
|
st = st->lexNext();
|
||||||
tmpStatement->deleteStmt();
|
tmpStatement->deleteStmt();
|
||||||
}
|
}
|
||||||
|
else if (st->variant() == STMTFN_STAT)
|
||||||
|
{
|
||||||
|
auto stat = st;
|
||||||
|
st = st->lexNext();
|
||||||
|
macro.push_back(stat->extractStmt());
|
||||||
|
}
|
||||||
else
|
else
|
||||||
st = st->lexNext();
|
st = st->lexNext();
|
||||||
}
|
}
|
||||||
@@ -253,6 +282,18 @@ static map<char, SgType*> FunctionImplicitCheck(SgStatement* function, const map
|
|||||||
auto declList = makeDeclaration(varsWithoutDeclConst, NULL);
|
auto declList = makeDeclaration(varsWithoutDeclConst, NULL);
|
||||||
for (auto& decl : declList)
|
for (auto& decl : declList)
|
||||||
insertPlace->insertStmtAfter(*decl, *function);
|
insertPlace->insertStmtAfter(*decl, *function);
|
||||||
|
|
||||||
|
if (macro.size())
|
||||||
|
{
|
||||||
|
while (!isSgExecutableStatement(insertPlace) && insertPlace != NULL)
|
||||||
|
insertPlace = insertPlace->lexNext();
|
||||||
|
|
||||||
|
if (insertPlace == NULL)
|
||||||
|
printInternalError(convertFileName(__FILE__).c_str(), __LINE__);
|
||||||
|
|
||||||
|
for (auto& elem : macro)
|
||||||
|
insertPlace->insertStmtBefore(*elem, *function);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto& s : toRename)
|
for (auto& s : toRename)
|
||||||
|
|||||||
@@ -1002,13 +1002,15 @@ static bool findSymbol(SgExpression *declLst, const string &toFind)
|
|||||||
if (ex->symbol()->identifier() == toFind)
|
if (ex->symbol()->identifier() == toFind)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
if (ex->lhs())
|
if (ex->lhs())
|
||||||
exs.push(ex->lhs());
|
exs.push(ex->lhs());
|
||||||
|
|
||||||
if (ex->rhs())
|
if (ex->rhs())
|
||||||
exs.push(ex->rhs());
|
exs.push(ex->rhs());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#define VERSION_SPF "2336"
|
#define VERSION_SPF "2337"
|
||||||
|
|||||||
Reference in New Issue
Block a user