Skip to content

Commit dfdfee3

Browse files
author
Raúl Peñacoba Veigas
committed
Do not assign dsa to inner lambda parameters.
Fix llvm#169
1 parent ef7d358 commit dfdfee3

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

clang/lib/Sema/SemaOmpSs.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -492,6 +492,14 @@ class DSAAttrChecker final : public StmtVisitor<DSAAttrChecker, void> {
492492
}
493493
}
494494

495+
void VisitLambdaExpr(LambdaExpr *E) {
496+
CXXMethodDecl *MD = E->getCallOperator();
497+
for (ParmVarDecl *param : MD->parameters()) {
498+
InnerDecls.insert(param);
499+
}
500+
Visit(E->getCompoundStmtBody());
501+
}
502+
495503
void VisitCXXCatchStmt(CXXCatchStmt *Node) {
496504
InnerDecls.insert(Node->getExceptionDecl());
497505
Visit(Node->getHandlerBlock());
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// RUN: %clang_cc1 -verify -fompss-2 -ast-dump -ferror-limit 100 %s | FileCheck %s
2+
// expected-no-diagnostics
3+
4+
// This test checks that lambda parameters are skipped
5+
// from implicit dsa analysis in the task body.
6+
// Before the fix, a deleted constructor error
7+
// will be shown because of firstprivatizing
8+
// 's'
9+
10+
struct S {
11+
S() = delete;
12+
~S();
13+
};
14+
15+
void foo(const S &s);
16+
17+
int main(){
18+
#pragma oss task //firstprivate(s)
19+
{
20+
auto l = [] (S &s){
21+
foo(s);
22+
};
23+
}
24+
}
25+
26+
// CHECK: OSSTaskDirective 0x{{.*}} <line:{{.*}}:{{.*}}, col:{{.*}}>
27+
// CHECK-NOT: OSSFirstprivateClause

0 commit comments

Comments
 (0)