Skip to content

Commit a952ea3

Browse files
committed
Filter out variables which should not be params
Previously we collected all variables declared and used in for loops and made them into target region parameters. Now we check wether these variables where declared outside the target region first.
1 parent 483c414 commit a952ea3

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

clang/tools/sotoc/src/Visitors.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,11 @@ void FindTargetCodeVisitor::addTargetRegionArgs(
197197
for (const auto i : *FindLoopVisitor.getVarSet()) {
198198
DEBUGP("Iterating var set");
199199
// i->print(llvm::outs());
200+
if (Context.getSourceManager().isBeforeInTranslationUnit(
201+
S->getBeginLoc(),i->getSourceRange().getBegin())) {
202+
tmpSet.insert(i);
203+
continue;
204+
}
200205
for (auto j : *TCR->getOMPClauses()) {
201206
for (auto CC : j->children()) {
202207
if (auto CC_DeclRefExpr =

clang/tools/sotoc/test/arrays/a.out

-811 KB
Binary file not shown.

0 commit comments

Comments
 (0)