diff --git a/sapfor/experts/Sapfor_2017/_src/GraphCall/graph_calls.cpp b/sapfor/experts/Sapfor_2017/_src/GraphCall/graph_calls.cpp index a9690cb..3e87159 100644 --- a/sapfor/experts/Sapfor_2017/_src/GraphCall/graph_calls.cpp +++ b/sapfor/experts/Sapfor_2017/_src/GraphCall/graph_calls.cpp @@ -1344,7 +1344,7 @@ static bool matchCallAndDefinition(const FuncParam &funcParDef, const FuncParam& messages[file].push_back(Messages(NOTE, line, bufR, bufE, 1013)); __spf_print(1, "Function '%s': different type of call and def parameter %d\n", funcName.c_str(), i + 1); } - result = false; + //result = false; } } else //TODO diff --git a/sapfor/experts/Sapfor_2017/_src/Inliner/inliner.cpp b/sapfor/experts/Sapfor_2017/_src/Inliner/inliner.cpp index b4f34f3..83bd024 100644 --- a/sapfor/experts/Sapfor_2017/_src/Inliner/inliner.cpp +++ b/sapfor/experts/Sapfor_2017/_src/Inliner/inliner.cpp @@ -211,6 +211,40 @@ static inline SgSymbol* createSymbAndDecl(const string& funcName, const string& return newS; } +static SgStatement* findDuplicateInHidden(SgStatement* data) +{ + SgStatement* clone = NULL; + + auto itF = hiddenData.find(current_file->filename()); + if (itF == hiddenData.end()) + printInternalError(convertFileName(__FILE__).c_str(), __LINE__); + + for (auto& func : itF->second) + { + if (func->fileName() != string(data->fileName())) + continue; + + SgStatement* st = func->lexNext(); + SgStatement* last = func->lastNodeOfStmt(); + + while (st != last) + { + if (data->lineNumber() == st->lineNumber() && data->variant() == st->variant()) + { + clone = st; + break; + } + st = st->lexNext(); + } + + if (clone) + break; + } + + checkNull(clone, convertFileName(__FILE__).c_str(), __LINE__); + return clone; +} + static SgValueExp* oneExpr = NULL; static SgValueExp* zeroExpr = NULL; @@ -237,11 +271,14 @@ static vector getLowBounds(SgSymbol* arrayS) int consistInAllocates = 0; const string origName = OriginalSymbol(copyFrom)->identifier(); - for (auto& data : getAttributes(decl, set{ ALLOCATE_STMT })) + for (auto data : getAttributes(decl, set{ ALLOCATE_STMT })) { if (data->variant() != ALLOCATE_STMT) continue; + if (data->getFileId() != current_file_id) + data = findDuplicateInHidden(data); + SgExpression* iter = data->expr(0); while (iter) diff --git a/sapfor/experts/Sapfor_2017/_src/Utils/SgUtils.cpp b/sapfor/experts/Sapfor_2017/_src/Utils/SgUtils.cpp index 3ff6596..b6559c4 100644 --- a/sapfor/experts/Sapfor_2017/_src/Utils/SgUtils.cpp +++ b/sapfor/experts/Sapfor_2017/_src/Utils/SgUtils.cpp @@ -4218,7 +4218,7 @@ SgProject* createProject(const char* proj_name, for (int z = 0; z < project->numberOfFiles(); ++z) - removeExecutableFromModuleDeclaration(&(project->file(z)), filesInProj); + removeExecutableFromModuleDeclaration(&(project->file(z)), filesInProj, hiddenData[project->file(z).filename()]); for (int z = 0; z < project->numberOfFiles(); ++z) { diff --git a/sapfor/experts/Sapfor_2017/_src/Utils/version.h b/sapfor/experts/Sapfor_2017/_src/Utils/version.h index 4f79ab5..302e96c 100644 --- a/sapfor/experts/Sapfor_2017/_src/Utils/version.h +++ b/sapfor/experts/Sapfor_2017/_src/Utils/version.h @@ -1,3 +1,3 @@ #pragma once -#define VERSION_SPF "2232" +#define VERSION_SPF "2234" diff --git a/sapfor/experts/Sapfor_2017/_src/VerificationCode/CorrectVarDecl.cpp b/sapfor/experts/Sapfor_2017/_src/VerificationCode/CorrectVarDecl.cpp index a7f7572..7c1a4be 100644 --- a/sapfor/experts/Sapfor_2017/_src/VerificationCode/CorrectVarDecl.cpp +++ b/sapfor/experts/Sapfor_2017/_src/VerificationCode/CorrectVarDecl.cpp @@ -1153,7 +1153,7 @@ void replaceStructuresToSimpleTypes(SgFile *file) } } -void removeExecutableFromModuleDeclaration(SgFile *current, const set &filesInProj) +void removeExecutableFromModuleDeclaration(SgFile *current, const set &filesInProj, vector& hiddenData) { const string currF = current->filename(); set moduleInFile; @@ -1164,14 +1164,14 @@ void removeExecutableFromModuleDeclaration(SgFile *current, const set &f moduleInFile.insert(st->fileName()); } - vector toDel; + vector toMove; for (SgStatement* st = current->firstStatement(); st; st = st->lexNext()) { if (isSgProgHedrStmt(st)) if (moduleInFile.find(st->fileName()) != moduleInFile.end()) - toDel.push_back(st); + toMove.push_back(st); } - for (auto& elem : toDel) - elem->deleteStmt(); + for (auto& elem : toMove) + hiddenData.push_back(elem->extractStmt()); } diff --git a/sapfor/experts/Sapfor_2017/_src/VerificationCode/verifications.h b/sapfor/experts/Sapfor_2017/_src/VerificationCode/verifications.h index e1525b2..65a6fc5 100644 --- a/sapfor/experts/Sapfor_2017/_src/VerificationCode/verifications.h +++ b/sapfor/experts/Sapfor_2017/_src/VerificationCode/verifications.h @@ -49,7 +49,7 @@ void replaceDerivedAssigns(SgFile *file, SgStatement *stToCopy, SgStatement *ins bool isDerivedAssign(SgStatement *st); std::map createDerivedTypeDeclMap(SgStatement *forS); void fillUseStatement(SgStatement* st, std::set& useMod, std::map>>& modByUse, std::map>>& modByUseOnly); -void removeExecutableFromModuleDeclaration(SgFile* current, const std::set& filesInProj); +void removeExecutableFromModuleDeclaration(SgFile* current, const std::set& filesInProj, std::vector& hiddenData); bool needToReplaceInterfaceName(SgStatement* interf); std::string getOrigName(const std::string& file, const std::string& s); \ No newline at end of file