Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 32c45b50 authored by Alexey Bataev's avatar Alexey Bataev
Browse files

[OPENMP] Fix detection of explicit data-sharing attributes in templates.

Fixes a bug with analysis of data-sharing attributes in templates.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@268020 91177308-0d34-0410-b5e6-96231b3b80d8
parent 0e2d28ae
No related branches found
No related tags found
No related merge requests found
......@@ -1416,6 +1416,9 @@ class DSAAttrChecker : public StmtVisitor<DSAAttrChecker, void> {
public:
void VisitDeclRefExpr(DeclRefExpr *E) {
if (E->isTypeDependent() || E->isValueDependent() ||
E->containsUnexpandedParameterPack() || E->isInstantiationDependent())
return;
if (auto *VD = dyn_cast<VarDecl>(E->getDecl())) {
// Skip internally declared variables.
if (VD->isLocalVarDecl() && !CS->capturesVariable(VD))
......@@ -1464,6 +1467,9 @@ public:
}
}
void VisitMemberExpr(MemberExpr *E) {
if (E->isTypeDependent() || E->isValueDependent() ||
E->containsUnexpandedParameterPack() || E->isInstantiationDependent())
return;
if (isa<CXXThisExpr>(E->getBase()->IgnoreParens())) {
if (auto *FD = dyn_cast<FieldDecl>(E->getMemberDecl())) {
auto DVar = Stack->getTopDSA(FD, false);
......
......@@ -7,6 +7,17 @@ bool foobool(int argc) {
return argc;
}
template <typename T>
struct S {
T b;
S(T a, T c) {
#pragma omp task default(none) firstprivate(a, b)
a = b = c; // expected-error {{variable 'c' must have explicitly specified data sharing attributes}}
}
};
S<int> s(3, 4); // expected-note {{in instantiation of member function 'S<int>::S' requested here}}
struct S1; // expected-note {{declared here}} expected-note{{forward declaration of 'S1'}}
extern S1 a;
class S2 {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment