DVar.CKind = OMPC_private;
return DVar;
}
- }
- // OpenMP [2.9.1.1, Data-sharing Attribute Rules for Variables Referenced
- // in a Construct, C/C++, predetermined, p.4]
- // Static data members are shared.
- if (D->isStaticDataMember()) {
- // Variables with const-qualified type having no mutable member may be
- // listed in a firstprivate clause, even if they are static data members.
- DSAVarData DVarTemp = hasDSA(D, MatchesAnyClause(OMPC_firstprivate),
- MatchesAlways(), FromParent);
- if (DVarTemp.CKind == OMPC_firstprivate && DVarTemp.RefExpr)
+ // OpenMP [2.9.1.1, Data-sharing Attribute Rules for Variables Referenced
+ // in a Construct, C/C++, predetermined, p.4]
+ // Static data members are shared.
+ if (D->isStaticDataMember()) {
+ DVar.CKind = OMPC_shared;
return DVar;
+ }
- DVar.CKind = OMPC_shared;
- return DVar;
+ // OpenMP [2.9.1.1, Data-sharing Attribute Rules for Variables Referenced
+ // in a Construct, C/C++, predetermined, p.7]
+ // Variables with static storage duration that are declared in a scope
+ // inside the construct are shared.
+ if (D->isStaticLocal()) {
+ DVar.CKind = OMPC_shared;
+ return DVar;
+ }
}
QualType Type = D->getType().getNonReferenceType().getCanonicalType();
return DVar;
}
- // OpenMP [2.9.1.1, Data-sharing Attribute Rules for Variables Referenced
- // in a Construct, C/C++, predetermined, p.7]
- // Variables with static storage duration that are declared in a scope
- // inside the construct are shared.
- if (D->isStaticLocal()) {
- DVar.CKind = OMPC_shared;
- return DVar;
- }
-
// Explicitly specified attributes and local variables with predetermined
// attributes.
auto I = std::prev(StartI);
public:
S2() : a(0) {}
S2(S2 &s2) : a(s2.a) {}
- static float S2s; // expected-note {{static data member is predetermined as shared}}
+ static float S2s;
static const float S2sc;
};
const float S2::S2sc = 0; // expected-note {{static data member is predetermined as shared}}
#pragma omp parallel for lastprivate(xa) // OK
for (i = 0; i < argc; ++i)
foo();
-#pragma omp parallel for lastprivate(S2::S2s) // expected-error {{shared variable cannot be lastprivate}}
+#pragma omp parallel for lastprivate(S2::S2s)
for (i = 0; i < argc; ++i)
foo();
#pragma omp parallel for lastprivate(S2::S2sc) // expected-error {{shared variable cannot be lastprivate}}
public:
S2() : a(0) {}
S2(S2 &s2) : a(s2.a) {}
- static float S2s; // expected-note 2 {{static data member is predetermined as shared}}
+ static float S2s;
static const float S2sc;
};
const float S2::S2sc = 0; // expected-note 2 {{'S2sc' defined here}}
#pragma omp parallel for reduction(^ : fl) // expected-error {{variable of type 'float' is not valid for specified reduction operation}}
for (int i = 0; i < 10; ++i)
foo();
-#pragma omp parallel for reduction(&& : S2::S2s) // expected-error {{shared variable cannot be reduction}}
+#pragma omp parallel for reduction(&& : S2::S2s)
for (int i = 0; i < 10; ++i)
foo();
#pragma omp parallel for reduction(&& : S2::S2sc) // expected-error {{const-qualified variable cannot be reduction}}
#pragma omp parallel for reduction(^ : fl) // expected-error {{variable of type 'float' is not valid for specified reduction operation}}
for (int i = 0; i < 10; ++i)
foo();
-#pragma omp parallel for reduction(&& : S2::S2s) // expected-error {{shared variable cannot be reduction}}
+#pragma omp parallel for reduction(&& : S2::S2s)
for (int i = 0; i < 10; ++i)
foo();
#pragma omp parallel for reduction(&& : S2::S2sc) // expected-error {{const-qualified variable cannot be reduction}}
public:
S2() : a(0) {}
S2(S2 &s2) : a(s2.a) {}
- static float S2s; // expected-note {{static data member is predetermined as shared}}
+ static float S2s;
static const float S2sc;
};
const float S2::S2sc = 0; // expected-note {{static data member is predetermined as shared}}
#pragma omp parallel for simd lastprivate(xa) // OK
for (i = 0; i < argc; ++i)
foo();
-#pragma omp parallel for simd lastprivate(S2::S2s) // expected-error {{shared variable cannot be lastprivate}}
+#pragma omp parallel for simd lastprivate(S2::S2s)
for (i = 0; i < argc; ++i)
foo();
#pragma omp parallel for simd lastprivate(S2::S2sc) // expected-error {{shared variable cannot be lastprivate}}
public:
S2() : a(0) {}
S2(S2 &s2) : a(s2.a) {}
- static float S2s; // expected-note 2 {{static data member is predetermined as shared}}
+ static float S2s;
static const float S2sc;
};
const float S2::S2sc = 0; // expected-note 2 {{'S2sc' defined here}}
#pragma omp parallel for simd reduction(^ : fl) // expected-error {{variable of type 'float' is not valid for specified reduction operation}}
for (int i = 0; i < 10; ++i)
foo();
-#pragma omp parallel for simd reduction(&& : S2::S2s) // expected-error {{shared variable cannot be reduction}}
+#pragma omp parallel for simd reduction(&& : S2::S2s)
for (int i = 0; i < 10; ++i)
foo();
#pragma omp parallel for simd reduction(&& : S2::S2sc) // expected-error {{const-qualified variable cannot be reduction}}
#pragma omp parallel for simd reduction(^ : fl) // expected-error {{variable of type 'float' is not valid for specified reduction operation}}
for (int i = 0; i < 10; ++i)
foo();
-#pragma omp parallel for simd reduction(&& : S2::S2s) // expected-error {{shared variable cannot be reduction}}
+#pragma omp parallel for simd reduction(&& : S2::S2s)
for (int i = 0; i < 10; ++i)
foo();
#pragma omp parallel for simd reduction(&& : S2::S2sc) // expected-error {{const-qualified variable cannot be reduction}}
mutable int a;
public:
S2():a(0) { }
- static float S2s; // expected-note {{static data member is predetermined as shared}}
+ static float S2s;
};
const S2 b;
const S2 ba[5];
#pragma omp parallel private(ba)
#pragma omp parallel private(ca) // expected-error {{shared variable cannot be private}}
#pragma omp parallel private(da) // expected-error {{shared variable cannot be private}}
- #pragma omp parallel private(S2::S2s) // expected-error {{shared variable cannot be private}}
+ #pragma omp parallel private(S2::S2s)
#pragma omp parallel private(e, g) // expected-error {{calling a private constructor of class 'S4'}} expected-error {{calling a private constructor of class 'S5'}}
#pragma omp parallel private(threadvar) // expected-error {{threadprivate or thread local variable cannot be private}}
#pragma omp parallel shared(i), private(i) // expected-error {{shared variable cannot be private}} expected-note {{defined as shared}}
public:
S2() : a(0) {}
S2(S2 &s2) : a(s2.a) {}
- static float S2s; // expected-note 2 {{static data member is predetermined as shared}}
+ static float S2s;
static const float S2sc;
};
const float S2::S2sc = 0; // expected-note 2 {{'S2sc' defined here}}
foo();
#pragma omp parallel reduction(^ : fl) // expected-error {{variable of type 'float' is not valid for specified reduction operation}}
foo();
-#pragma omp parallel reduction(&& : S2::S2s) // expected-error {{shared variable cannot be reduction}}
+#pragma omp parallel reduction(&& : S2::S2s)
foo();
#pragma omp parallel reduction(&& : S2::S2sc) // expected-error {{const-qualified variable cannot be reduction}}
foo();
foo();
#pragma omp parallel reduction(^ : fl) // expected-error {{variable of type 'float' is not valid for specified reduction operation}}
foo();
-#pragma omp parallel reduction(&& : S2::S2s) // expected-error {{shared variable cannot be reduction}}
+#pragma omp parallel reduction(&& : S2::S2s)
foo();
#pragma omp parallel reduction(&& : S2::S2sc) // expected-error {{const-qualified variable cannot be reduction}}
foo();
public:
S2() : a(0) {}
S2(S2 &s2) : a(s2.a) {}
- static float S2s; // expected-note {{static data member is predetermined as shared}}
+ static float S2s;
static const float S2sc;
};
const float S2::S2sc = 0; // expected-note {{static data member is predetermined as shared}}
{
foo();
}
-#pragma omp parallel sections lastprivate(S2::S2s) // expected-error {{shared variable cannot be lastprivate}}
+#pragma omp parallel sections lastprivate(S2::S2s)
{
foo();
}
public:
S2() : a(0) {}
S2(S2 &s2) : a(s2.a) {}
- static float S2s; // expected-note 2 {{static data member is predetermined as shared}}
+ static float S2s;
static const float S2sc;
};
const float S2::S2sc = 0; // expected-note 2 {{'S2sc' defined here}}
{
foo();
}
-#pragma omp parallel sections reduction(&& : S2::S2s) // expected-error {{shared variable cannot be reduction}}
+#pragma omp parallel sections reduction(&& : S2::S2s)
{
foo();
}
{
foo();
}
-#pragma omp parallel sections reduction(&& : S2::S2s) // expected-error {{shared variable cannot be reduction}}
+#pragma omp parallel sections reduction(&& : S2::S2s)
{
foo();
}
public:
S2() : a(0) {}
- static float S2s; // expected-note {{static data member is predetermined as shared}}
+ static float S2s;
};
const S2 b;
const S2 ba[5];
#pragma omp task private(ba)
#pragma omp task private(ca) // expected-error {{shared variable cannot be private}}
#pragma omp task private(da) // expected-error {{shared variable cannot be private}}
-#pragma omp task private(S2::S2s) // expected-error {{shared variable cannot be private}}
+#pragma omp task private(S2::S2s)
#pragma omp task private(e, g) // expected-error {{calling a private constructor of class 'S4'}} expected-error {{calling a private constructor of class 'S5'}}
#pragma omp task private(threadvar) // expected-error {{threadprivate or thread local variable cannot be private}}
#pragma omp task shared(i), private(i) // expected-error {{shared variable cannot be private}} expected-note {{defined as shared}}
mutable int a;
public:
S2():a(0) { }
- static float S2s; // expected-note {{static data member is predetermined as shared}}
+ static float S2s;
};
const S2 b;
const S2 ba[5];
#pragma omp teams private(da) // expected-error {{shared variable cannot be private}}
foo();
#pragma omp target
- #pragma omp teams private(S2::S2s) // expected-error {{shared variable cannot be private}}
+ #pragma omp teams private(S2::S2s)
foo();
#pragma omp target
#pragma omp teams private(e, g) // expected-error {{calling a private constructor of class 'S4'}} expected-error {{calling a private constructor of class 'S5'}}
public:
S2() : a(0) {}
S2(S2 &s2) : a(s2.a) {}
- static float S2s; // expected-note 2 {{static data member is predetermined as shared}}
+ static float S2s;
static const float S2sc;
};
const float S2::S2sc = 0; // expected-note 2 {{'S2sc' defined here}}
#pragma omp teams reduction(^ : fl) // expected-error {{variable of type 'float' is not valid for specified reduction operation}}
foo();
#pragma omp target
-#pragma omp teams reduction(&& : S2::S2s) // expected-error {{shared variable cannot be reduction}}
+#pragma omp teams reduction(&& : S2::S2s)
foo();
#pragma omp target
#pragma omp teams reduction(&& : S2::S2sc) // expected-error {{const-qualified variable cannot be reduction}}
#pragma omp teams reduction(^ : fl) // expected-error {{variable of type 'float' is not valid for specified reduction operation}}
foo();
#pragma omp target
-#pragma omp teams reduction(&& : S2::S2s) // expected-error {{shared variable cannot be reduction}}
+#pragma omp teams reduction(&& : S2::S2s)
foo();
#pragma omp target
#pragma omp teams reduction(&& : S2::S2sc) // expected-error {{const-qualified variable cannot be reduction}}