From 85aaee900bd6624fa0f6b9cace5c1eb8498c572c Mon Sep 17 00:00:00 2001 From: ALEXks Date: Thu, 28 Dec 2023 20:41:31 +0300 Subject: [PATCH] fixed omp analysis --- .../DirectiveProcessing/directive_parser.cpp | 28 +++++++++++++++++-- .../experts/Sapfor_2017/_src/Utils/version.h | 2 +- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/sapfor/experts/Sapfor_2017/_src/DirectiveProcessing/directive_parser.cpp b/sapfor/experts/Sapfor_2017/_src/DirectiveProcessing/directive_parser.cpp index 9e35898..029fd3b 100644 --- a/sapfor/experts/Sapfor_2017/_src/DirectiveProcessing/directive_parser.cpp +++ b/sapfor/experts/Sapfor_2017/_src/DirectiveProcessing/directive_parser.cpp @@ -721,6 +721,27 @@ static inline void addToAttribute(SgStatement* st, int var, vectorvariant() != FOR_NODE) + return false; + + SgStatement* lastNode = st->lastNodeOfStmt(); + for (SgStatement* op = st->lexNext(); st != lastNode; st = st->lexNext()) + { + if (st->variant() == ASSIGN_STAT) + { + SgExpression* ex = st->expr(0); + if (ex->variant() == ARRAY_REF || ex->variant() == VAR_REF) + if (var == ex->symbol()->identifier()) + return true; + } + } + return false; +} + vector parseOmpDirs(void* stIn, const set &globalPriv, bool forDo) { SgStatement* st = (SgStatement*)stIn; @@ -825,8 +846,11 @@ vector parseOmpDirs(void* stIn, const set &globalPriv, bool forD { vector list; for (auto& var : globalPriv) - list.push_back(new SgVarRefExp(findSymbolOrCreate(current_file, var, NULL, getFuncStat(st)))); - addToAttribute(st, ACC_PRIVATE_OP, list); + if (is_private_in_do(st, var)) + list.push_back(new SgVarRefExp(findSymbolOrCreate(current_file, var, NULL, getFuncStat(st)))); + + if (list.size()) + addToAttribute(st, ACC_PRIVATE_OP, list); } } diff --git a/sapfor/experts/Sapfor_2017/_src/Utils/version.h b/sapfor/experts/Sapfor_2017/_src/Utils/version.h index 5d8326d..bbe67a9 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 "2262" +#define VERSION_SPF "2263"