diff options
50 files changed, 465 insertions, 45 deletions
diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp index 6082daffef7..fed0ac77b84 100644 --- a/clang/lib/Sema/SemaOpenMP.cpp +++ b/clang/lib/Sema/SemaOpenMP.cpp @@ -238,6 +238,7 @@ bool isParallelOrTaskRegion(OpenMPDirectiveKind DKind) { DSAStackTy::DSAVarData DSAStackTy::getDSA(StackTy::reverse_iterator Iter, VarDecl *D) { + D = D->getCanonicalDecl(); DSAVarData DVar; if (Iter == std::prev(Stack.rend())) { // OpenMP [2.9.1.1, Data-sharing Attribute Rules for Variables Referenced @@ -342,6 +343,7 @@ DSAStackTy::DSAVarData DSAStackTy::getDSA(StackTy::reverse_iterator Iter, DeclRefExpr *DSAStackTy::addUniqueAligned(VarDecl *D, DeclRefExpr *NewDE) { assert(Stack.size() > 1 && "Data sharing attributes stack is empty"); + D = D->getCanonicalDecl(); auto It = Stack.back().AlignedMap.find(D); if (It == Stack.back().AlignedMap.end()) { assert(NewDE && "Unexpected nullptr expr to be added into aligned map"); @@ -355,6 +357,7 @@ DeclRefExpr *DSAStackTy::addUniqueAligned(VarDecl *D, DeclRefExpr *NewDE) { } void DSAStackTy::addDSA(VarDecl *D, DeclRefExpr *E, OpenMPClauseKind A) { + D = D->getCanonicalDecl(); if (A == OMPC_threadprivate) { Stack[0].SharingMap[D].Attributes = A; Stack[0].SharingMap[D].RefExpr = E; @@ -366,6 +369,7 @@ void DSAStackTy::addDSA(VarDecl *D, DeclRefExpr *E, OpenMPClauseKind A) { } bool DSAStackTy::isOpenMPLocal(VarDecl *D, StackTy::reverse_iterator Iter) { + D = D->getCanonicalDecl(); if (Stack.size() > 2) { reverse_iterator I = Iter, E = std::prev(Stack.rend()); Scope *TopScope = nullptr; @@ -385,6 +389,7 @@ bool DSAStackTy::isOpenMPLocal(VarDecl *D, StackTy::reverse_iterator Iter) { } DSAStackTy::DSAVarData DSAStackTy::getTopDSA(VarDecl *D, bool FromParent) { + D = D->getCanonicalDecl(); DSAVarData DVar; // OpenMP [2.9.1.1, Data-sharing Attribute Rules for Variables Referenced @@ -477,6 +482,7 @@ DSAStackTy::DSAVarData DSAStackTy::getTopDSA(VarDecl *D, bool FromParent) { } DSAStackTy::DSAVarData DSAStackTy::getImplicitDSA(VarDecl *D, bool FromParent) { + D = D->getCanonicalDecl(); auto StartI = Stack.rbegin(); auto EndI = std::prev(Stack.rend()); if (FromParent && StartI != EndI) { @@ -489,6 +495,7 @@ template <class ClausesPredicate, class DirectivesPredicate> DSAStackTy::DSAVarData DSAStackTy::hasDSA(VarDecl *D, ClausesPredicate CPred, DirectivesPredicate DPred, bool FromParent) { + D = D->getCanonicalDecl(); auto StartI = std::next(Stack.rbegin()); auto EndI = std::prev(Stack.rend()); if (FromParent && StartI != EndI) { @@ -508,6 +515,7 @@ template <class ClausesPredicate, class DirectivesPredicate> DSAStackTy::DSAVarData DSAStackTy::hasInnermostDSA(VarDecl *D, ClausesPredicate CPred, DirectivesPredicate DPred, bool FromParent) { + D = D->getCanonicalDecl(); auto StartI = std::next(Stack.rbegin()); auto EndI = std::prev(Stack.rend()); if (FromParent && StartI != EndI) { @@ -546,6 +554,7 @@ void Sema::InitDataSharingAttributesStack() { bool Sema::IsOpenMPCapturedVar(VarDecl *VD) { assert(LangOpts.OpenMP && "OpenMP is not allowed"); + VD = VD->getCanonicalDecl(); if (DSAStack->getCurrentDirective() != OMPD_unknown) { auto DVarPrivate = DSAStack->getTopDSA(VD, /*FromParent=*/false); if (DVarPrivate.CKind != OMPC_unknown && isOpenMPPrivate(DVarPrivate.CKind)) @@ -757,7 +766,7 @@ ExprResult Sema::ActOnOpenMPIdExpression(Scope *CurScope, // OpenMP [2.9.2, Restrictions, C/C++, p.2-6] // A threadprivate directive must lexically precede all references to any // of the variables in its list. - if (VD->isUsed() && !DSAStack->isThreadPrivate(CanonicalVD)) { + if (VD->isUsed() && !DSAStack->isThreadPrivate(VD)) { Diag(Id.getLoc(), diag::err_omp_var_used) << getOpenMPDirectiveName(OMPD_threadprivate) << VD; return ExprError(); diff --git a/clang/test/OpenMP/for_firstprivate_messages.cpp b/clang/test/OpenMP/for_firstprivate_messages.cpp index 2c68b9c9b23..a7333718c59 100644 --- a/clang/test/OpenMP/for_firstprivate_messages.cpp +++ b/clang/test/OpenMP/for_firstprivate_messages.cpp @@ -152,6 +152,14 @@ int foomain(int argc, char **argv) { return 0; } +namespace A { +double x; +#pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}} +} +namespace B { +using A::x; +} + int main(int argc, char **argv) { const int d = 5; const int da[5] = {0}; @@ -288,6 +296,10 @@ int main(int argc, char **argv) { #pragma omp for firstprivate(i) // expected-error {{firstprivate variable must be shared}} for (i = 0; i < argc; ++i) foo(); +#pragma omp parallel +#pragma omp for firstprivate(B::x) // expected-error {{threadprivate or thread local variable cannot be firstprivate}} + for (i = 0; i < argc; ++i) + foo(); return foomain<S4, S5>(argc, argv); // expected-note {{in instantiation of function template specialization 'foomain<S4, S5>' requested here}} } diff --git a/clang/test/OpenMP/for_lastprivate_messages.cpp b/clang/test/OpenMP/for_lastprivate_messages.cpp index d4e4ca7315d..632ed8446c4 100644 --- a/clang/test/OpenMP/for_lastprivate_messages.cpp +++ b/clang/test/OpenMP/for_lastprivate_messages.cpp @@ -142,6 +142,14 @@ int foomain(int argc, char **argv) { return 0; } +namespace A { +double x; +#pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}} +} +namespace B { +using A::x; +} + int main(int argc, char **argv) { const int d = 5; // expected-note {{constant variable is predetermined as shared}} const int da[5] = {0}; // expected-note {{constant variable is predetermined as shared}} @@ -237,6 +245,10 @@ int main(int argc, char **argv) { for (i = 0; i < argc; ++i) foo(); #pragma omp parallel +#pragma omp for lastprivate(B::x) // expected-error {{threadprivate or thread local variable cannot be lastprivate}} + for (i = 0; i < argc; ++i) + foo(); +#pragma omp parallel #pragma omp for private(xa), lastprivate(xa) // expected-error {{private variable cannot be lastprivate}} expected-note {{defined as private}} for (i = 0; i < argc; ++i) foo(); diff --git a/clang/test/OpenMP/for_private_messages.cpp b/clang/test/OpenMP/for_private_messages.cpp index 45c8683cfa8..635a17d6e54 100644 --- a/clang/test/OpenMP/for_private_messages.cpp +++ b/clang/test/OpenMP/for_private_messages.cpp @@ -108,6 +108,14 @@ int foomain(I argc, C **argv) { return 0; } +namespace A { +double x; +#pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}} +} +namespace B { +using A::x; +} + int main(int argc, char **argv) { S4 e(4); S5 g(5); @@ -149,6 +157,9 @@ int main(int argc, char **argv) { #pragma omp for private(h) // expected-error {{threadprivate or thread local variable cannot be private}} for (int k = 0; k < argc; ++k) ++k; +#pragma omp for private(B::x) // expected-error {{threadprivate or thread local variable cannot be private}} + for (int k = 0; k < argc; ++k) + ++k; #pragma omp for shared(i) // expected-error {{unexpected OpenMP clause 'shared' in directive '#pragma omp for'}} for (int k = 0; k < argc; ++k) ++k; diff --git a/clang/test/OpenMP/for_reduction_messages.cpp b/clang/test/OpenMP/for_reduction_messages.cpp index b438d4a53f7..5ebb7b79512 100644 --- a/clang/test/OpenMP/for_reduction_messages.cpp +++ b/clang/test/OpenMP/for_reduction_messages.cpp @@ -204,6 +204,14 @@ T tmain(T argc) { return T(); } +namespace A { +double x; +#pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}} +} +namespace B { +using A::x; +} + int main(int argc, char **argv) { const int d = 5; // expected-note 2 {{'d' defined here}} const int da[5] = {0}; // expected-note {{'da' defined here}} @@ -313,6 +321,10 @@ int main(int argc, char **argv) { for (int i = 0; i < 10; ++i) foo(); #pragma omp parallel +#pragma omp for reduction(+ : B::x, k) // expected-error {{threadprivate or thread local variable cannot be reduction}} + for (int i = 0; i < 10; ++i) + foo(); +#pragma omp parallel #pragma omp for reduction(+ : o) // expected-error {{no viable overloaded '='}} for (int i = 0; i < 10; ++i) foo(); diff --git a/clang/test/OpenMP/for_simd_firstprivate_messages.cpp b/clang/test/OpenMP/for_simd_firstprivate_messages.cpp index 1345bfc9886..194656b13f6 100644 --- a/clang/test/OpenMP/for_simd_firstprivate_messages.cpp +++ b/clang/test/OpenMP/for_simd_firstprivate_messages.cpp @@ -152,6 +152,14 @@ int foomain(int argc, char **argv) { return 0; } +namespace A { +double x; +#pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}} +} +namespace B { +using A::x; +} + int main(int argc, char **argv) { const int d = 5; const int da[5] = {0}; @@ -247,6 +255,10 @@ int main(int argc, char **argv) { for (i = 0; i < argc; ++i) foo(); #pragma omp parallel +#pragma omp for simd firstprivate(B::x) // expected-error {{threadprivate or thread local variable cannot be firstprivate}} + for (i = 0; i < argc; ++i) + foo(); +#pragma omp parallel #pragma omp for simd private(xa), firstprivate(xa) // expected-error {{private variable cannot be firstprivate}} expected-note {{defined as private}} for (i = 0; i < argc; ++i) foo(); diff --git a/clang/test/OpenMP/for_simd_lastprivate_messages.cpp b/clang/test/OpenMP/for_simd_lastprivate_messages.cpp index 1400c646de0..8eff052c518 100644 --- a/clang/test/OpenMP/for_simd_lastprivate_messages.cpp +++ b/clang/test/OpenMP/for_simd_lastprivate_messages.cpp @@ -142,6 +142,14 @@ int foomain(int argc, char **argv) { return 0; } +namespace A { +double x; +#pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}} +} +namespace B { +using A::x; +} + int main(int argc, char **argv) { const int d = 5; // expected-note {{constant variable is predetermined as shared}} const int da[5] = {0}; // expected-note {{constant variable is predetermined as shared}} @@ -233,7 +241,7 @@ int main(int argc, char **argv) { for (i = 0; i < argc; ++i) foo(); #pragma omp parallel -#pragma omp for simd lastprivate(h) // expected-error {{threadprivate or thread local variable cannot be lastprivate}} +#pragma omp for simd lastprivate(h, B::x) // expected-error 2 {{threadprivate or thread local variable cannot be lastprivate}} for (i = 0; i < argc; ++i) foo(); #pragma omp parallel diff --git a/clang/test/OpenMP/for_simd_linear_messages.cpp b/clang/test/OpenMP/for_simd_linear_messages.cpp index 9a935c3fdf2..705c9f538c1 100644 --- a/clang/test/OpenMP/for_simd_linear_messages.cpp +++ b/clang/test/OpenMP/for_simd_linear_messages.cpp @@ -148,6 +148,14 @@ template<class I, class C> int foomain(I argc, C **argv) { return 0; } +namespace A { +double x; +#pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}} +} +namespace C { +using A::x; +} + int main(int argc, char **argv) { double darr[100]; // expected-note@+1 {{in instantiation of function template specialization 'test_template<-4, double, int>' requested here}} @@ -185,7 +193,7 @@ int main(int argc, char **argv) { // expected-error@+1 {{argument of a linear clause should be of integral or pointer type, not 'S5'}} #pragma omp for simd linear(e, g) for (int k = 0; k < argc; ++k) ++k; - #pragma omp for simd linear(h) // expected-error {{threadprivate or thread local variable cannot be linear}} + #pragma omp for simd linear(h, C::x) // expected-error 2 {{threadprivate or thread local variable cannot be linear}} for (int k = 0; k < argc; ++k) ++k; #pragma omp parallel { diff --git a/clang/test/OpenMP/for_simd_private_messages.cpp b/clang/test/OpenMP/for_simd_private_messages.cpp index 016a5ec6b58..3f7cb268e2b 100644 --- a/clang/test/OpenMP/for_simd_private_messages.cpp +++ b/clang/test/OpenMP/for_simd_private_messages.cpp @@ -108,6 +108,14 @@ int foomain(I argc, C **argv) { return 0; } +namespace A { +double x; +#pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}} +} +namespace B { +using A::x; +} + int main(int argc, char **argv) { S4 e(4); S5 g(5); @@ -146,7 +154,7 @@ int main(int argc, char **argv) { #pragma omp for simd private(e, g) // expected-error {{calling a private constructor of class 'S4'}} expected-error {{calling a private constructor of class 'S5'}} for (int k = 0; k < argc; ++k) ++k; -#pragma omp for simd private(h) // expected-error {{threadprivate or thread local variable cannot be private}} +#pragma omp for simd private(h, B::x) // expected-error 2 {{threadprivate or thread local variable cannot be private}} for (int k = 0; k < argc; ++k) ++k; #pragma omp for simd shared(i) // expected-error {{unexpected OpenMP clause 'shared' in directive '#pragma omp for simd'}} diff --git a/clang/test/OpenMP/for_simd_reduction_messages.cpp b/clang/test/OpenMP/for_simd_reduction_messages.cpp index 97b6bfca358..b4099d538a0 100644 --- a/clang/test/OpenMP/for_simd_reduction_messages.cpp +++ b/clang/test/OpenMP/for_simd_reduction_messages.cpp @@ -204,6 +204,14 @@ T tmain(T argc) { return T(); } +namespace A { +double x; +#pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}} +} +namespace B { +using A::x; +} + int main(int argc, char **argv) { const int d = 5; // expected-note 2 {{'d' defined here}} const int da[5] = {0}; // expected-note {{'da' defined here}} @@ -309,7 +317,7 @@ int main(int argc, char **argv) { for (int i = 0; i < 10; ++i) foo(); #pragma omp parallel -#pragma omp for simd reduction(+ : h, k) // expected-error {{threadprivate or thread local variable cannot be reduction}} +#pragma omp for simd reduction(+ : h, k, B::x) // expected-error 2 {{threadprivate or thread local variable cannot be reduction}} for (int i = 0; i < 10; ++i) foo(); #pragma omp parallel diff --git a/clang/test/OpenMP/parallel_copyin_messages.cpp b/clang/test/OpenMP/parallel_copyin_messages.cpp index 9ae3ffae65d..4a9fa2add47 100644 --- a/clang/test/OpenMP/parallel_copyin_messages.cpp +++ b/clang/test/OpenMP/parallel_copyin_messages.cpp @@ -40,6 +40,13 @@ public: static T s; }; +namespace A { +double x; +#pragma omp threadprivate(x) +} +namespace B { +using A::x; +} S2 k; S3 h; @@ -61,6 +68,7 @@ int main(int argc, char **argv) { #pragma omp parallel copyin(i) // expected-error {{copyin variable must be threadprivate}} #pragma omp parallel copyin(m) // expected-error {{'operator=' is a private member of 'S5'}} #pragma omp parallel copyin(ST<int>::s) // expected-error {{copyin variable must be threadprivate}} + #pragma omp parallel copyin(B::x) foo(); return 0; diff --git a/clang/test/OpenMP/parallel_firstprivate_messages.cpp b/clang/test/OpenMP/parallel_firstprivate_messages.cpp index 7d1e3593500..fe534b40891 100644 --- a/clang/test/OpenMP/parallel_firstprivate_messages.cpp +++ b/clang/test/OpenMP/parallel_firstprivate_messages.cpp @@ -47,6 +47,14 @@ public: S3 h; #pragma omp threadprivate(h) // expected-note {{defined as threadprivate or thread local}} +namespace A { +double x; +#pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}} +} +namespace B { +using A::x; +} + int main(int argc, char **argv) { const int d = 5; const int da[5] = { 0 }; @@ -70,7 +78,7 @@ int main(int argc, char **argv) { #pragma omp parallel firstprivate(S2::S2s) #pragma omp parallel firstprivate(S2::S2sc) #pragma omp parallel firstprivate(e, g) // expected-error {{calling a private constructor of class 'S4'}} expected-error {{calling a private constructor of class 'S5'}} - #pragma omp parallel firstprivate(h) // expected-error {{threadprivate or thread local variable cannot be firstprivate}} + #pragma omp parallel firstprivate(h, B::x) // expected-error 2 {{threadprivate or thread local variable cannot be firstprivate}} #pragma omp parallel private(i), firstprivate(i) // expected-error {{private variable cannot be firstprivate}} expected-note{{defined as private}} foo(); #pragma omp parallel shared(i) diff --git a/clang/test/OpenMP/parallel_for_copyin_messages.cpp b/clang/test/OpenMP/parallel_for_copyin_messages.cpp index bdf024ead84..f1368e98b8e 100644 --- a/clang/test/OpenMP/parallel_for_copyin_messages.cpp +++ b/clang/test/OpenMP/parallel_for_copyin_messages.cpp @@ -50,6 +50,14 @@ S4 l(3); S5 m(4); #pragma omp threadprivate(h, k, l, m) +namespace A { +double x; +#pragma omp threadprivate(x) +} +namespace B { +using A::x; +} + int main(int argc, char **argv) { int i; #pragma omp parallel for copyin // expected-error {{expected '(' after 'copyin'}} @@ -85,7 +93,7 @@ int main(int argc, char **argv) { #pragma omp parallel for copyin(m) // expected-error {{'operator=' is a private member of 'S5'}} for (i = 0; i < argc; ++i) foo(); -#pragma omp parallel for copyin(ST < int > ::s) // expected-error {{copyin variable must be threadprivate}} +#pragma omp parallel for copyin(ST<int>::s, B::x) // expected-error {{copyin variable must be threadprivate}} for (i = 0; i < argc; ++i) foo(); diff --git a/clang/test/OpenMP/parallel_for_firstprivate_messages.cpp b/clang/test/OpenMP/parallel_for_firstprivate_messages.cpp index b4958733dec..37239bc2057 100644 --- a/clang/test/OpenMP/parallel_for_firstprivate_messages.cpp +++ b/clang/test/OpenMP/parallel_for_firstprivate_messages.cpp @@ -137,6 +137,14 @@ int foomain(int argc, char **argv) { return 0; } +namespace A { +double x; +#pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}} +} +namespace B { +using A::x; +} + int main(int argc, char **argv) { const int d = 5; const int da[5] = {0}; @@ -207,7 +215,7 @@ int main(int argc, char **argv) { #pragma omp parallel for firstprivate(m) // OK for (i = 0; i < argc; ++i) foo(); -#pragma omp parallel for firstprivate(h) // expected-error {{threadprivate or thread local variable cannot be firstprivate}} +#pragma omp parallel for firstprivate(h, B::x) // expected-error 2 {{threadprivate or thread local variable cannot be firstprivate}} for (i = 0; i < argc; ++i) foo(); #pragma omp parallel for private(xa), firstprivate(xa) // expected-error {{private variable cannot be firstprivate}} expected-note {{defined as private}} diff --git a/clang/test/OpenMP/parallel_for_lastprivate_messages.cpp b/clang/test/OpenMP/parallel_for_lastprivate_messages.cpp index 86bf9a80b41..6f0945a860b 100644 --- a/clang/test/OpenMP/parallel_for_lastprivate_messages.cpp +++ b/clang/test/OpenMP/parallel_for_lastprivate_messages.cpp @@ -128,6 +128,14 @@ int foomain(int argc, char **argv) { return 0; } +namespace A { +double x; +#pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}} +} +namespace B { +using A::x; +} + int main(int argc, char **argv) { const int d = 5; // expected-note {{constant variable is predetermined as shared}} const int da[5] = {0}; // expected-note {{constant variable is predetermined as shared}} @@ -198,7 +206,7 @@ int main(int argc, char **argv) { #pragma omp parallel for lastprivate(m) // expected-error {{'operator=' is a private member of 'S3'}} for (i = 0; i < argc; ++i) foo(); -#pragma omp parallel for lastprivate(h) // expected-error {{threadprivate or thread local variable cannot be lastprivate}} +#pragma omp parallel for lastprivate(h, B::x) // expected-error 2 {{threadprivate or thread local variable cannot be lastprivate}} for (i = 0; i < argc; ++i) foo(); #pragma omp parallel for private(xa), lastprivate(xa) // expected-error {{private variable cannot be lastprivate}} expected-note {{defined as private}} diff --git a/clang/test/OpenMP/parallel_for_private_messages.cpp b/clang/test/OpenMP/parallel_for_private_messages.cpp index 31b84588de0..8d0ba629b83 100644 --- a/clang/test/OpenMP/parallel_for_private_messages.cpp +++ b/clang/test/OpenMP/parallel_for_private_messages.cpp @@ -108,6 +108,14 @@ int foomain(I argc, C **argv) { return 0; } +namespace A { +double x; +#pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}} +} +namespace B { +using A::x; +} + int main(int argc, char **argv) { S4 e(4); S5 g(5); @@ -146,7 +154,7 @@ int main(int argc, char **argv) { #pragma omp parallel for private(e, g) // expected-error {{calling a private constructor of class 'S4'}} expected-error {{calling a private constructor of class 'S5'}} for (int k = 0; k < argc; ++k) ++k; -#pragma omp parallel for private(h) // expected-error {{threadprivate or thread local variable cannot be private}} +#pragma omp parallel for private(h, B::x) // expected-error 2 {{threadprivate or thread local variable cannot be private}} for (int k = 0; k < argc; ++k) ++k; #pragma omp parallel for nowait // expected-error {{unexpected OpenMP clause 'nowait' in directive '#pragma omp parallel for'}} diff --git a/clang/test/OpenMP/parallel_for_reduction_messages.cpp b/clang/test/OpenMP/parallel_for_reduction_messages.cpp index 7d112da1924..1f6075761df 100644 --- a/clang/test/OpenMP/parallel_for_reduction_messages.cpp +++ b/clang/test/OpenMP/parallel_for_reduction_messages.cpp @@ -177,6 +177,14 @@ T tmain(T argc) { return T(); } +namespace A { +double x; +#pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}} +} +namespace B { +using A::x; +} + int main(int argc, char **argv) { const int d = 5; // expected-note 2 {{'d' defined here}} const int da[5] = {0}; // expected-note {{'da' defined here}} @@ -258,7 +266,7 @@ int main(int argc, char **argv) { #pragma omp parallel for reduction(& : e, g) // expected-error {{calling a private constructor of class 'S4'}} expected-error {{invalid operands to binary expression ('S4' and 'S4')}} expected-error {{calling a private constructor of class 'S5'}} expected-error {{invalid operands to binary expression ('S5' and 'S5')}} for (int i = 0; i < 10; ++i) foo(); -#pragma omp parallel for reduction(+ : h, k) // expected-error {{threadprivate or thread local variable cannot be reduction}} +#pragma omp parallel for reduction(+ : h, k, B::x) // expected-error 2 {{threadprivate or thread local variable cannot be reduction}} for (int i = 0; i < 10; ++i) foo(); #pragma omp parallel for reduction(+ : o) // expected-error {{no viable overloaded '='}} diff --git a/clang/test/OpenMP/parallel_for_simd_copyin_messages.cpp b/clang/test/OpenMP/parallel_for_simd_copyin_messages.cpp index 1b7e681bddf..9ddd92d4173 100644 --- a/clang/test/OpenMP/parallel_for_simd_copyin_messages.cpp +++ b/clang/test/OpenMP/parallel_for_simd_copyin_messages.cpp @@ -50,6 +50,14 @@ S4 l(3); S5 m(4); #pragma omp threadprivate(h, k, l, m) +namespace A { +double x; +#pragma omp threadprivate(x) +} +namespace B { +using A::x; +} + int main(int argc, char **argv) { int i; #pragma omp parallel for simd copyin // expected-error {{expected '(' after 'copyin'}} @@ -85,7 +93,7 @@ int main(int argc, char **argv) { #pragma omp parallel for simd copyin(m) // expected-error {{'operator=' is a private member of 'S5'}} for (i = 0; i < argc; ++i) foo(); -#pragma omp parallel for simd copyin(ST < int > ::s) // expected-error {{copyin variable must be threadprivate}} +#pragma omp parallel for simd copyin(ST < int > ::s, B::x) // expected-error {{copyin variable must be threadprivate}} for (i = 0; i < argc; ++i) foo(); diff --git a/clang/test/OpenMP/parallel_for_simd_firstprivate_messages.cpp b/clang/test/OpenMP/parallel_for_simd_firstprivate_messages.cpp index 876d422e634..ef74e3c6647 100644 --- a/clang/test/OpenMP/parallel_for_simd_firstprivate_messages.cpp +++ b/clang/test/OpenMP/parallel_for_simd_firstprivate_messages.cpp @@ -136,6 +136,14 @@ int foomain(int argc, char **argv) { return 0; } +namespace A { +double x; +#pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}} +} +namespace B { +using A::x; +} + int main(int argc, char **argv) { const int d = 5; const int da[5] = {0}; @@ -206,7 +214,7 @@ int main(int argc, char **argv) { #pragma omp parallel for simd firstprivate(m) // OK for (i = 0; i < argc; ++i) foo(); -#pragma omp parallel for simd firstprivate(h) // expected-error {{threadprivate or thread local variable cannot be firstprivate}} +#pragma omp parallel for simd firstprivate(h, B::x) // expected-error 2 {{threadprivate or thread local variable cannot be firstprivate}} for (i = 0; i < argc; ++i) foo(); #pragma omp parallel for simd private(xa), firstprivate(xa) // expected-error {{private variable cannot be firstprivate}} expected-note {{defined as private}} diff --git a/clang/test/OpenMP/parallel_for_simd_lastprivate_messages.cpp b/clang/test/OpenMP/parallel_for_simd_lastprivate_messages.cpp index 9f85c12c1dd..64d6ccc7ad1 100644 --- a/clang/test/OpenMP/parallel_for_simd_lastprivate_messages.cpp +++ b/clang/test/OpenMP/parallel_for_simd_lastprivate_messages.cpp @@ -127,6 +127,14 @@ int foomain(int argc, char **argv) { return 0; } +namespace A { +double x; +#pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}} +} +namespace B { +using A::x; +} + int main(int argc, char **argv) { const int d = 5; // expected-note {{constant variable is predetermined as shared}} const int da[5] = {0}; // expected-note {{constant variable is predetermined as shared}} @@ -197,7 +205,7 @@ int main(int argc, char **argv) { #pragma omp parallel for simd lastprivate(m) // expected-error {{'operator=' is a private member of 'S3'}} for (i = 0; i < argc; ++i) foo(); -#pragma omp parallel for simd lastprivate(h) // expected-error {{threadprivate or thread local variable cannot be lastprivate}} +#pragma omp parallel for simd lastprivate(h, B::x) // expected-error 2 {{threadprivate or thread local variable cannot be lastprivate}} for (i = 0; i < argc; ++i) foo(); #pragma omp parallel for simd private(xa), lastprivate(xa) // expected-error {{private variable cannot be lastprivate}} expected-note {{defined as private}} diff --git a/clang/test/OpenMP/parallel_for_simd_linear_messages.cpp b/clang/test/OpenMP/parallel_for_simd_linear_messages.cpp index 3918de2681d..7dcaca0c3e6 100644 --- a/clang/test/OpenMP/parallel_for_simd_linear_messages.cpp +++ b/clang/test/OpenMP/parallel_for_simd_linear_messages.cpp @@ -148,6 +148,14 @@ template<class I, class C> int foomain(I argc, C **argv) { return 0; } +namespace A { +double x; +#pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}} +} +namespace C { +using A::x; +} + int main(int argc, char **argv) { double darr[100]; // expected-note@+1 {{in instantiation of function template specialization 'test_template<-4, double, int>' requested here}} @@ -185,7 +193,7 @@ int main(int argc, char **argv) { // expected-error@+1 {{argument of a linear clause should be of integral or pointer type, not 'S5'}} #pragma omp parallel for simd linear(e, g) for (int k = 0; k < argc; ++k) ++k; - #pragma omp parallel for simd linear(h) // expected-error {{threadprivate or thread local variable cannot be linear}} + #pragma omp parallel for simd linear(h, C::x) // expected-error 2 {{threadprivate or thread local variable cannot be linear}} for (int k = 0; k < argc; ++k) ++k; #pragma omp parallel { diff --git a/clang/test/OpenMP/parallel_for_simd_private_messages.cpp b/clang/test/OpenMP/parallel_for_simd_private_messages.cpp index 67d88131864..f2719d92b7c 100644 --- a/clang/test/OpenMP/parallel_for_simd_private_messages.cpp +++ b/clang/test/OpenMP/parallel_for_simd_private_messages.cpp @@ -108,6 +108,14 @@ int foomain(I argc, C **argv) { return 0; } +namespace A { +double x; +#pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}} +} +namespace B { +using A::x; +} + int main(int argc, char **argv) { S4 e(4); S5 g(5); @@ -146,7 +154,7 @@ int main(int argc, char **argv) { #pragma omp parallel for simd private(e, g) // expected-error {{calling a private constructor of class 'S4'}} expected-error {{calling a private constructor of class 'S5'}} for (int k = 0; k < argc; ++k) ++k; -#pragma omp parallel for simd private(h) // expected-error {{threadprivate or thread local variable cannot be private}} +#pragma omp parallel for simd private(h, B::x) // expected-error 2 {{threadprivate or thread local variable cannot be private}} for (int k = 0; k < argc; ++k) ++k; #pragma omp parallel for simd nowait // expected-error {{unexpected OpenMP clause 'nowait' in directive '#pragma omp parallel for simd'}} diff --git a/clang/test/OpenMP/parallel_for_simd_reduction_messages.cpp b/clang/test/OpenMP/parallel_for_simd_reduction_messages.cpp index c58d56cd0f6..f92a9cc42cc 100644 --- a/clang/test/OpenMP/parallel_for_simd_reduction_messages.cpp +++ b/clang/test/OpenMP/parallel_for_simd_reduction_messages.cpp @@ -177,6 +177,14 @@ T tmain(T argc) { return T(); } +namespace A { +double x; +#pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}} +} +namespace B { +using A::x; +} + int main(int argc, char **argv) { const int d = 5; // expected-note 2 {{'d' defined here}} const int da[5] = {0}; // expected-note {{'da' defined here}} @@ -258,7 +266,7 @@ int main(int argc, char **argv) { #pragma omp parallel for simd reduction(& : e, g) // expected-error {{calling a private constructor of class 'S4'}} expected-error {{invalid operands to binary expression ('S4' and 'S4')}} expected-error {{calling a private constructor of class 'S5'}} expected-error {{invalid operands to binary expression ('S5' and 'S5')}} for (int i = 0; i < 10; ++i) foo(); -#pragma omp parallel for simd reduction(+ : h, k) // expected-error {{threadprivate or thread local variable cannot be reduction}} +#pragma omp parallel for simd reduction(+ : h, k, B::x) // expected-error 2 {{threadprivate or thread local variable cannot be reduction}} for (int i = 0; i < 10; ++i) foo(); #pragma omp parallel for simd reduction(+ : o) // expected-error {{no viable overloaded '='}} diff --git a/clang/test/OpenMP/parallel_private_messages.cpp b/clang/test/OpenMP/parallel_private_messages.cpp index 74949ba3434..850b4031750 100644 --- a/clang/test/OpenMP/parallel_private_messages.cpp +++ b/clang/test/OpenMP/parallel_private_messages.cpp @@ -41,6 +41,14 @@ public: int threadvar; #pragma omp threadprivate(threadvar) // expected-note {{defined as threadprivate or thread local}} +namespace A { +double x; +#pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}} +} +namespace B { +using A::x; +} + int main(int argc, char **argv) { const int d = 5; // expected-note {{constant variable is predetermined as shared}} const int da[5] = { 0 }; // expected-note {{constant variable is predetermined as shared}} @@ -63,7 +71,7 @@ int main(int argc, char **argv) { #pragma omp parallel private(da) // 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 private(threadvar, B::x) // expected-error 2 {{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}} foo(); #pragma omp parallel firstprivate(i) private(i) // expected-error {{firstprivate variable cannot be private}} expected-note {{defined as firstprivate}} diff --git a/clang/test/OpenMP/parallel_reduction_messages.cpp b/clang/test/OpenMP/parallel_reduction_messages.cpp index 347626d52f9..f6883d280bd 100644 --- a/clang/test/OpenMP/parallel_reduction_messages.cpp +++ b/clang/test/OpenMP/parallel_reduction_messages.cpp @@ -150,6 +150,14 @@ T tmain(T argc) { return T(); } +namespace A { +double x; +#pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}} +} +namespace B { +using A::x; +} + int main(int argc, char **argv) { const int d = 5; // expected-note 2 {{'d' defined here}} const int da[5] = {0}; // expected-note {{'da' defined here}} @@ -208,7 +216,7 @@ int main(int argc, char **argv) { foo(); #pragma omp parallel reduction(& : e, g) // expected-error {{calling a private constructor of class 'S4'}} expected-error {{nvalid operands to binary expression ('S4' and 'S4')}} expected-error {{calling a private constructor of class 'S5'}} expected-error {{invalid operands to binary expression ('S5' and 'S5')}} foo(); -#pragma omp parallel reduction(+ : h, k) // expected-error {{threadprivate or thread local variable cannot be reduction}} +#pragma omp parallel reduction(+ : h, k, B::x) // expected-error 2 {{threadprivate or thread local variable cannot be reduction}} foo(); #pragma omp parallel reduction(+ : o) // expected-error {{no viable overloaded '='}} foo(); diff --git a/clang/test/OpenMP/parallel_sections_copyin_messages.cpp b/clang/test/OpenMP/parallel_sections_copyin_messages.cpp index 2642ebb81c6..d76e580c957 100644 --- a/clang/test/OpenMP/parallel_sections_copyin_messages.cpp +++ b/clang/test/OpenMP/parallel_sections_copyin_messages.cpp @@ -50,6 +50,14 @@ S4 l(3); S5 m(4); #pragma omp threadprivate(h, k, l, m) +namespace A { +double x; +#pragma omp threadprivate(x) +} +namespace B { +using A::x; +} + int main(int argc, char **argv) { int i; #pragma omp parallel sections copyin // expected-error {{expected '(' after 'copyin'}} @@ -96,7 +104,7 @@ int main(int argc, char **argv) { { foo(); } -#pragma omp parallel sections copyin(ST < int > ::s) // expected-error {{copyin variable must be threadprivate}} +#pragma omp parallel sections copyin(ST < int > ::s, B::x) // expected-error {{copyin variable must be threadprivate}} { foo(); } diff --git a/clang/test/OpenMP/parallel_sections_firstprivate_messages.cpp b/clang/test/OpenMP/parallel_sections_firstprivate_messages.cpp index 2d27b1a600d..23ae12888fe 100644 --- a/clang/test/OpenMP/parallel_sections_firstprivate_messages.cpp +++ b/clang/test/OpenMP/parallel_sections_firstprivate_messages.cpp @@ -155,6 +155,14 @@ int foomain(int argc, char **argv) { return 0; } +namespace A { +double x; +#pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}} +} +namespace B { +using A::x; +} + int main(int argc, char **argv) { const int d = 5; const int da[5] = {0}; @@ -245,7 +253,7 @@ int main(int argc, char **argv) { { foo(); } -#pragma omp parallel sections firstprivate(h) // expected-error {{threadprivate or thread local variable cannot be firstprivate}} +#pragma omp parallel sections firstprivate(h, B::x) // expected-error 2 {{threadprivate or thread local variable cannot be firstprivate}} { foo(); } diff --git a/clang/test/OpenMP/parallel_sections_lastprivate_messages.cpp b/clang/test/OpenMP/parallel_sections_lastprivate_messages.cpp index fd358b2106b..067a5979d13 100644 --- a/clang/test/OpenMP/parallel_sections_lastprivate_messages.cpp +++ b/clang/test/OpenMP/parallel_sections_lastprivate_messages.cpp @@ -142,6 +142,14 @@ int foomain(int argc, char **argv) { return 0; } +namespace A { +double x; +#pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}} +} +namespace B { +using A::x; +} + int main(int argc, char **argv) { const int d = 5; // expected-note {{constant variable is predetermined as shared}} const int da[5] = {0}; // expected-note {{constant variable is predetermined as shared}} @@ -232,7 +240,7 @@ int main(int argc, char **argv) { { foo(); } -#pragma omp parallel sections lastprivate(h) // expected-error {{threadprivate or thread local variable cannot be lastprivate}} +#pragma omp parallel sections lastprivate(h, B::x) // expected-error 2 {{threadprivate or thread local variable cannot be lastprivate}} { foo(); } diff --git a/clang/test/OpenMP/parallel_sections_private_messages.cpp b/clang/test/OpenMP/parallel_sections_private_messages.cpp index e0b7488e516..47c904dea7a 100644 --- a/clang/test/OpenMP/parallel_sections_private_messages.cpp +++ b/clang/test/OpenMP/parallel_sections_private_messages.cpp @@ -123,6 +123,14 @@ int foomain(I argc, C **argv) { return 0; } +namespace A { +double x; +#pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}} +} +namespace B { +using A::x; +} + int main(int argc, char **argv) { S4 e(4); S5 g(5); @@ -172,7 +180,7 @@ int main(int argc, char **argv) { { foo(); } -#pragma omp parallel sections private(h) // expected-error {{threadprivate or thread local variable cannot be private}} +#pragma omp parallel sections private(h, B::x) // expected-error 2 {{threadprivate or thread local variable cannot be private}} { foo(); } diff --git a/clang/test/OpenMP/parallel_sections_reduction_messages.cpp b/clang/test/OpenMP/parallel_sections_reduction_messages.cpp index d73f53bc051..d152f49d0d5 100644 --- a/clang/test/OpenMP/parallel_sections_reduction_messages.cpp +++ b/clang/test/OpenMP/parallel_sections_reduction_messages.cpp @@ -208,6 +208,14 @@ T tmain(T argc) { return T(); } +namespace A { +double x; +#pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}} +} +namespace B { +using A::x; +} + int main(int argc, char **argv) { const int d = 5; // expected-note 2 {{'d' defined here}} const int da[5] = {0}; // expected-note {{'da' defined here}} @@ -312,7 +320,7 @@ int main(int argc, char **argv) { { foo(); } -#pragma omp parallel sections reduction(+ : h, k) // expected-error {{threadprivate or thread local variable cannot be reduction}} +#pragma omp parallel sections reduction(+ : h, k, B::x) // expected-error 2 {{threadprivate or thread local variable cannot be reduction}} { foo(); } diff --git a/clang/test/OpenMP/parallel_sections_shared_messages.cpp b/clang/test/OpenMP/parallel_sections_shared_messages.cpp index d4915c8eaa4..0f7a147fc77 100644 --- a/clang/test/OpenMP/parallel_sections_shared_messages.cpp +++ b/clang/test/OpenMP/parallel_sections_shared_messages.cpp @@ -48,6 +48,14 @@ public: S3 h; #pragma omp threadprivate(h) // expected-note {{defined as threadprivate or thread local}} +namespace A { +double x; +#pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}} +} +namespace B { +using A::x; +} + int main(int argc, char **argv) { const int d = 5; const int da[5] = {0}; @@ -83,7 +91,7 @@ int main(int argc, char **argv) { { foo(); } #pragma omp parallel sections shared(e, g) { foo(); } -#pragma omp parallel sections shared(h) // expected-error {{threadprivate or thread local variable cannot be shared}} +#pragma omp parallel sections shared(h, B::x) // expected-error 2 {{threadprivate or thread local variable cannot be shared}} { foo(); } #pragma omp parallel sections private(i), shared(i) // expected-error {{private variable cannot be shared}} expected-note {{defined as private}} { foo(); } diff --git a/clang/test/OpenMP/parallel_shared_messages.cpp b/clang/test/OpenMP/parallel_shared_messages.cpp index 8363989439b..7cbc791ac90 100644 --- a/clang/test/OpenMP/parallel_shared_messages.cpp +++ b/clang/test/OpenMP/parallel_shared_messages.cpp @@ -44,6 +44,14 @@ public: S3 h; #pragma omp threadprivate(h) // expected-note {{defined as threadprivate or thread local}} +namespace A { +double x; +#pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}} +} +namespace B { +using A::x; +} + int main(int argc, char **argv) { const int d = 5; const int da[5] = { 0 }; @@ -65,7 +73,7 @@ int main(int argc, char **argv) { #pragma omp parallel shared(ca) #pragma omp parallel shared(da) #pragma omp parallel shared(e, g) - #pragma omp parallel shared(h) // expected-error {{threadprivate or thread local variable cannot be shared}} + #pragma omp parallel shared(h, B::x) // expected-error 2 {{threadprivate or thread local variable cannot be shared}} #pragma omp parallel private(i), shared(i) // expected-error {{private variable cannot be shared}} expected-note {{defined as private}} foo(); #pragma omp parallel firstprivate(i), shared(i) // expected-error {{firstprivate variable cannot be shared}} expected-note {{defined as firstprivate}} diff --git a/clang/test/OpenMP/sections_firstprivate_messages.cpp b/clang/test/OpenMP/sections_firstprivate_messages.cpp index ecee45900fe..6f9f502821d 100644 --- a/clang/test/OpenMP/sections_firstprivate_messages.cpp +++ b/clang/test/OpenMP/sections_firstprivate_messages.cpp @@ -170,6 +170,14 @@ int foomain(int argc, char **argv) { return 0; } +namespace A { +double x; +#pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}} +} +namespace B { +using A::x; +} + int main(int argc, char **argv) { const int d = 5; const int da[5] = {0}; @@ -281,7 +289,7 @@ int main(int argc, char **argv) { foo(); } #pragma omp parallel -#pragma omp sections firstprivate(h) // expected-error {{threadprivate or thread local variable cannot be firstprivate}} +#pragma omp sections firstprivate(h, B::x) // expected-error 2 {{threadprivate or thread local variable cannot be firstprivate}} { foo(); } diff --git a/clang/test/OpenMP/sections_lastprivate_messages.cpp b/clang/test/OpenMP/sections_lastprivate_messages.cpp index 13640f61077..f513d89de87 100644 --- a/clang/test/OpenMP/sections_lastprivate_messages.cpp +++ b/clang/test/OpenMP/sections_lastprivate_messages.cpp @@ -156,6 +156,14 @@ int foomain(int argc, char **argv) { return 0; } +namespace A { +double x; +#pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}} +} +namespace B { +using A::x; +} + int main(int argc, char **argv) { const int d = 5; // expected-note {{constant variable is predetermined as shared}} const int da[5] = {0}; // expected-note {{constant variable is predetermined as shared}} @@ -267,7 +275,7 @@ int main(int argc, char **argv) { foo(); } #pragma omp parallel -#pragma omp sections lastprivate(h) // expected-error {{threadprivate or thread local variable cannot be lastprivate}} +#pragma omp sections lastprivate(h, B::x) // expected-error 2 {{threadprivate or thread local variable cannot be lastprivate}} { foo(); } diff --git a/clang/test/OpenMP/sections_private_messages.cpp b/clang/test/OpenMP/sections_private_messages.cpp index 8b330bf7105..ea5fe39c080 100644 --- a/clang/test/OpenMP/sections_private_messages.cpp +++ b/clang/test/OpenMP/sections_private_messages.cpp @@ -123,6 +123,14 @@ int foomain(I argc, C **argv) { return 0; } +namespace A { +double x; +#pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}} +} +namespace B { +using A::x; +} + int main(int argc, char **argv) { S4 e(4); S5 g(5); @@ -172,7 +180,7 @@ int main(int argc, char **argv) { { foo(); } -#pragma omp sections private(h) // expected-error {{threadprivate or thread local variable cannot be private}} +#pragma omp sections private(h, B::x) // expected-error 2 {{threadprivate or thread local variable cannot be private}} { foo(); } diff --git a/clang/test/OpenMP/sections_reduction_messages.cpp b/clang/test/OpenMP/sections_reduction_messages.cpp index d6ed7101ea5..656093757ae 100644 --- a/clang/test/OpenMP/sections_reduction_messages.cpp +++ b/clang/test/OpenMP/sections_reduction_messages.cpp @@ -235,6 +235,14 @@ T tmain(T argc) { return T(); } +namespace A { +double x; +#pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}} +} +namespace B { +using A::x; +} + int main(int argc, char **argv) { const int d = 5; // expected-note 2 {{'d' defined here}} const int da[5] = {0}; // expected-note {{'da' defined here}} @@ -363,7 +371,7 @@ int main(int argc, char **argv) { foo(); } #pragma omp parallel -#pragma omp sections reduction(+ : h, k) // expected-error {{threadprivate or thread local variable cannot be reduction}} +#pragma omp sections reduction(+ : h, k, B::x) // expected-error 2 {{threadprivate or thread local variable cannot be reduction}} { foo(); } diff --git a/clang/test/OpenMP/simd_lastprivate_messages.cpp b/clang/test/OpenMP/simd_lastprivate_messages.cpp index 33871813b88..24cee01cd90 100644 --- a/clang/test/OpenMP/simd_lastprivate_messages.cpp +++ b/clang/test/OpenMP/simd_lastprivate_messages.cpp @@ -53,6 +53,14 @@ public: S3 h; #pragma omp threadprivate(h) // expected-note 2 {{defined as threadprivate or thread local}} +namespace A { +double x; +#pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}} +} +namespace B { +using A::x; +} + template <class I, class C> int foomain(I argc, C **argv) { I e(4); @@ -92,7 +100,7 @@ int foomain(I argc, C **argv) { #pragma omp simd lastprivate(e, g) for (int k = 0; k < argc; ++k) ++k; -#pragma omp simd lastprivate(h) // expected-error {{threadprivate or thread local variable cannot be lastprivate}} +#pragma omp simd lastprivate(h, B::x) // expected-error 2 {{threadprivate or thread local variable cannot be lastprivate}} for (int k = 0; k < argc; ++k) ++k; #pragma omp simd firstprivate(i) // expected-error {{unexpected OpenMP clause 'firstprivate' in directive '#pragma omp simd'}} diff --git a/clang/test/OpenMP/simd_linear_messages.cpp b/clang/test/OpenMP/simd_linear_messages.cpp index b8b78310799..94780fdaa4e 100644 --- a/clang/test/OpenMP/simd_linear_messages.cpp +++ b/clang/test/OpenMP/simd_linear_messages.cpp @@ -148,6 +148,14 @@ template<class I, class C> int foomain(I argc, C **argv) { return 0; } +namespace A { +double x; +#pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}} +} +namespace C { +using A::x; +} + int main(int argc, char **argv) { double darr[100]; // expected-note@+1 {{in instantiation of function template specialization 'test_template<-4, double, int>' requested here}} @@ -177,7 +185,7 @@ int main(int argc, char **argv) { for (int k = 0; k < argc; ++k) ++k; // expected-error@+2 {{linear variable with incomplete type 'S1'}} // expected-error@+1 {{const-qualified variable cannot be linear}} - #pragma omp simd linear (a, b) + #pragma omp simd linear(a, b) for (int k = 0; k < argc; ++k) ++k; #pragma omp simd linear (argv[1]) // expected-error {{expected variable name}} for (int k = 0; k < argc; ++k) ++k; @@ -185,7 +193,7 @@ int main(int argc, char **argv) { // expected-error@+1 {{argument of a linear clause should be of integral or pointer type, not 'S5'}} #pragma omp simd linear(e, g) for (int k = 0; k < argc; ++k) ++k; - #pragma omp simd linear(h) // expected-error {{threadprivate or thread local variable cannot be linear}} + #pragma omp simd linear(h, C::x) // expected-error 2 {{threadprivate or thread local variable cannot be linear}} for (int k = 0; k < argc; ++k) ++k; #pragma omp parallel { diff --git a/clang/test/OpenMP/simd_private_messages.cpp b/clang/test/OpenMP/simd_private_messages.cpp index 56922e888b9..47e6e315964 100644 --- a/clang/test/OpenMP/simd_private_messages.cpp +++ b/clang/test/OpenMP/simd_private_messages.cpp @@ -85,6 +85,14 @@ template<class I, class C> int foomain(I argc, C **argv) { return 0; } +namespace A { +double x; +#pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}} +} +namespace B { +using A::x; +} + int main(int argc, char **argv) { S4 e(4); S5 g(5); @@ -112,7 +120,7 @@ int main(int argc, char **argv) { for (int k = 0; k < argc; ++k) ++k; #pragma omp simd private(e, g) // expected-error {{calling a private constructor of class 'S4'}} expected-error {{calling a private constructor of class 'S5'}} for (int k = 0; k < argc; ++k) ++k; - #pragma omp simd private(h) // expected-error {{threadprivate or thread local variable cannot be private}} + #pragma omp simd private(h, B::x) // expected-error 2 {{threadprivate or thread local variable cannot be private}} for (int k = 0; k < argc; ++k) ++k; #pragma omp simd shared(i) // expected-error {{unexpected OpenMP clause 'shared' in directive '#pragma omp simd'}} for (int k = 0; k < argc; ++k) ++k; diff --git a/clang/test/OpenMP/simd_reduction_messages.cpp b/clang/test/OpenMP/simd_reduction_messages.cpp index 1bf39cb9caf..530f7434e12 100644 --- a/clang/test/OpenMP/simd_reduction_messages.cpp +++ b/clang/test/OpenMP/simd_reduction_messages.cpp @@ -180,6 +180,14 @@ T tmain(T argc) { return T(); } +namespace A { +double x; +#pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}} +} +namespace B { +using A::x; +} + int main(int argc, char **argv) { const int d = 5; // expected-note 2 {{'d' defined here}} const int da[5] = {0}; // expected-note {{'da' defined here}} @@ -261,7 +269,7 @@ int main(int argc, char **argv) { #pragma omp simd reduction(& : e, g) // expected-error {{calling a private constructor of class 'S4'}} expected-error {{invalid operands to binary expression ('S4' and 'S4')}} expected-error {{calling a private constructor of class 'S5'}} expected-error {{invalid operands to binary expression ('S5' and 'S5')}} for (int i = 0; i < 10; ++i) foo(); -#pragma omp simd reduction(+ : h, k) // expected-error {{threadprivate or thread local variable cannot be reduction}} +#pragma omp simd reduction(+ : h, k, B::x) // expected-error 2 {{threadprivate or thread local variable cannot be reduction}} for (int i = 0; i < 10; ++i) foo(); #pragma omp simd reduction(+ : o) // expected-error {{no viable overloaded '='}} diff --git a/clang/test/OpenMP/single_copyprivate_messages.cpp b/clang/test/OpenMP/single_copyprivate_messages.cpp index de51bc6b615..793b4d5d0a5 100644 --- a/clang/test/OpenMP/single_copyprivate_messages.cpp +++ b/clang/test/OpenMP/single_copyprivate_messages.cpp @@ -105,6 +105,14 @@ T tmain(T argc, C **argv) { return T(); } +namespace A { +double x; +#pragma omp threadprivate(x) +} +namespace B { +using A::x; +} + int main(int argc, char **argv) { int i; static int intA; @@ -121,7 +129,7 @@ int main(int argc, char **argv) { #pragma omp parallel #pragma omp single copyprivate(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}} #pragma omp parallel -#pragma omp single copyprivate(l) // expected-error {{'operator=' is a private member of 'S4'}} +#pragma omp single copyprivate(l, B::x) // expected-error {{'operator=' is a private member of 'S4'}} #pragma omp parallel #pragma omp single copyprivate(S1) // expected-error {{'S1' does not refer to a value}} #pragma omp parallel diff --git a/clang/test/OpenMP/single_firstprivate_messages.cpp b/clang/test/OpenMP/single_firstprivate_messages.cpp index 9f6f1608354..b4c4712ee2a 100644 --- a/clang/test/OpenMP/single_firstprivate_messages.cpp +++ b/clang/test/OpenMP/single_firstprivate_messages.cpp @@ -132,6 +132,14 @@ int foomain(int argc, char **argv) { return 0; } +namespace A { +double x; +#pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}} +} +namespace B { +using A::x; +} + int main(int argc, char **argv) { const int d = 5; const int da[5] = {0}; @@ -203,7 +211,7 @@ int main(int argc, char **argv) { #pragma omp single firstprivate(m) // OK foo(); #pragma omp parallel -#pragma omp single firstprivate(h) // expected-error {{threadprivate or thread local variable cannot be firstprivate}} +#pragma omp single firstprivate(h, B::x) // expected-error 2 {{threadprivate or thread local variable cannot be firstprivate}} foo(); #pragma omp parallel #pragma omp single private(xa), firstprivate(xa) // expected-error {{private variable cannot be firstprivate}} expected-note {{defined as private}} diff --git a/clang/test/OpenMP/single_private_messages.cpp b/clang/test/OpenMP/single_private_messages.cpp index 8bdc48f1a50..964fc3a849a 100644 --- a/clang/test/OpenMP/single_private_messages.cpp +++ b/clang/test/OpenMP/single_private_messages.cpp @@ -91,6 +91,14 @@ int foomain(I argc, C **argv) { return 0; } +namespace A { +double x; +#pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}} +} +namespace B { +using A::x; +} + int main(int argc, char **argv) { S4 e(4); S5 g(5); @@ -118,7 +126,7 @@ int main(int argc, char **argv) { foo(); #pragma omp single private(e, g) // expected-error {{calling a private constructor of class 'S4'}} expected-error {{calling a private constructor of class 'S5'}} foo(); -#pragma omp single private(h) // expected-error {{threadprivate or thread local variable cannot be private}} +#pragma omp single private(h, B::x) // expected-error 2 {{threadprivate or thread local variable cannot be private}} foo(); #pragma omp single shared(i) // expected-error {{unexpected OpenMP clause 'shared' in directive '#pragma omp single'}} foo(); diff --git a/clang/test/OpenMP/task_firstprivate_messages.cpp b/clang/test/OpenMP/task_firstprivate_messages.cpp index 6c5ccfca57b..c3c2ae053ee 100644 --- a/clang/test/OpenMP/task_firstprivate_messages.cpp +++ b/clang/test/OpenMP/task_firstprivate_messages.cpp @@ -51,6 +51,14 @@ public: S3 h; #pragma omp threadprivate(h) // expected-note {{defined as threadprivate or thread local}} +namespace A { +double x; +#pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}} +} +namespace B { +using A::x; +} + int main(int argc, char **argv) { const int d = 5; const int da[5] = {0}; @@ -74,7 +82,7 @@ int main(int argc, char **argv) { #pragma omp task firstprivate(S2::S2s) #pragma omp task firstprivate(S2::S2sc) #pragma omp task firstprivate(e, g) // expected-error 2 {{calling a private constructor of class 'S4'}} expected-error 2 {{calling a private constructor of class 'S5'}} -#pragma omp task firstprivate(h) // expected-error {{threadprivate or thread local variable cannot be firstprivate}} +#pragma omp task firstprivate(h, B::x) // expected-error 2 {{threadprivate or thread local variable cannot be firstprivate}} #pragma omp task private(i), firstprivate(i) // expected-error {{private variable cannot be firstprivate}} expected-note{{defined as private}} foo(); #pragma omp task shared(i) diff --git a/clang/test/OpenMP/task_private_messages.cpp b/clang/test/OpenMP/task_private_messages.cpp index 0352694d579..bf2a24a4a0c 100644 --- a/clang/test/OpenMP/task_private_messages.cpp +++ b/clang/test/OpenMP/task_private_messages.cpp @@ -45,6 +45,14 @@ public: int threadvar; #pragma omp threadprivate(threadvar) // expected-note {{defined as threadprivate or thread local}} +namespace A { +double x; +#pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}} +} +namespace B { +using A::x; +} + int main(int argc, char **argv) { const int d = 5; // expected-note {{constant variable is predetermined as shared}} const int da[5] = {0}; // expected-note {{constant variable is predetermined as shared}} @@ -67,7 +75,7 @@ int main(int argc, char **argv) { #pragma omp task private(da) // 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 private(threadvar, B::x) // expected-error 2 {{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}} foo(); #pragma omp task firstprivate(i) private(i) // expected-error {{firstprivate variable cannot be private}} expected-note {{defined as firstprivate}} diff --git a/clang/test/OpenMP/task_shared_messages.cpp b/clang/test/OpenMP/task_shared_messages.cpp index 747923721b9..2dda25a78b0 100644 --- a/clang/test/OpenMP/task_shared_messages.cpp +++ b/clang/test/OpenMP/task_shared_messages.cpp @@ -48,6 +48,14 @@ public: S3 h; #pragma omp threadprivate(h) // expected-note {{defined as threadprivate or thread local}} +namespace A { +double x; +#pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}} +} +namespace B { +using A::x; +} + int main(int argc, char **argv) { const int d = 5; const int da[5] = {0}; @@ -83,7 +91,7 @@ int main(int argc, char **argv) { foo(); #pragma omp task shared(e, g) foo(); -#pragma omp task shared(h) // expected-error {{threadprivate or thread local variable cannot be shared}} +#pragma omp task shared(h, B::x) // expected-error 2 {{threadprivate or thread local variable cannot be shared}} foo(); #pragma omp task private(i), shared(i) // expected-error {{private variable cannot be shared}} expected-note {{defined as private}} foo(); diff --git a/clang/test/OpenMP/teams_firstprivate_messages.cpp b/clang/test/OpenMP/teams_firstprivate_messages.cpp index 3d4a21999ee..c18a22f36ef 100644 --- a/clang/test/OpenMP/teams_firstprivate_messages.cpp +++ b/clang/test/OpenMP/teams_firstprivate_messages.cpp @@ -49,6 +49,14 @@ public: S3 h; #pragma omp threadprivate(h) // expected-note {{defined as threadprivate or thread local}} +namespace A { +double x; +#pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}} +} +namespace B { +using A::x; +} + int main(int argc, char **argv) { const int d = 5; const int da[5] = {0}; @@ -105,7 +113,7 @@ int main(int argc, char **argv) { #pragma omp teams firstprivate(e, g) // expected-error {{calling a private constructor of class 'S4'}} expected-error {{calling a private constructor of class 'S5'}} foo(); #pragma omp target -#pragma omp teams firstprivate(h) // expected-error {{threadprivate or thread local variable cannot be firstprivate}} +#pragma omp teams firstprivate(h, B::x) // expected-error 2 {{threadprivate or thread local variable cannot be firstprivate}} foo(); #pragma omp target #pragma omp teams private(i), firstprivate(i) // expected-error {{private variable cannot be firstprivate}} expected-note{{defined as private}} diff --git a/clang/test/OpenMP/teams_private_messages.cpp b/clang/test/OpenMP/teams_private_messages.cpp index 65caaed381b..771b8d3405d 100644 --- a/clang/test/OpenMP/teams_private_messages.cpp +++ b/clang/test/OpenMP/teams_private_messages.cpp @@ -41,6 +41,14 @@ public: int threadvar; #pragma omp threadprivate(threadvar) // expected-note {{defined as threadprivate or thread local}} +namespace A { +double x; +#pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}} +} +namespace B { +using A::x; +} + int main(int argc, char **argv) { const int d = 5; // expected-note {{constant variable is predetermined as shared}} const int da[5] = { 0 }; // expected-note {{constant variable is predetermined as shared}} @@ -94,7 +102,7 @@ int main(int argc, char **argv) { #pragma omp teams private(e, g) // expected-error {{calling a private constructor of class 'S4'}} expected-error {{calling a private constructor of class 'S5'}} foo(); #pragma omp target - #pragma omp teams private(threadvar) // expected-error {{threadprivate or thread local variable cannot be private}} + #pragma omp teams private(threadvar, B::x) // expected-error 2 {{threadprivate or thread local variable cannot be private}} foo(); #pragma omp target #pragma omp teams shared(i), private(i) // expected-error {{shared variable cannot be private}} expected-note {{defined as shared}} diff --git a/clang/test/OpenMP/teams_reduction_messages.cpp b/clang/test/OpenMP/teams_reduction_messages.cpp index adf8a194ca0..df2c2e801f8 100644 --- a/clang/test/OpenMP/teams_reduction_messages.cpp +++ b/clang/test/OpenMP/teams_reduction_messages.cpp @@ -183,6 +183,14 @@ T tmain(T argc) { return T(); } +namespace A { +double x; +#pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}} +} +namespace B { +using A::x; +} + int main(int argc, char **argv) { const int d = 5; // expected-note 2 {{'d' defined here}} const int da[5] = {0}; // expected-note {{'da' defined here}} @@ -265,7 +273,7 @@ int main(int argc, char **argv) { #pragma omp teams reduction(& : e, g) // expected-error {{calling a private constructor of class 'S4'}} expected-error {{invalid operands to binary expression ('S4' and 'S4')}} expected-error {{calling a private constructor of class 'S5'}} expected-error {{invalid operands to binary expression ('S5' and 'S5')}} foo(); #pragma omp target -#pragma omp teams reduction(+ : h, k) // expected-error {{threadprivate or thread local variable cannot be reduction}} +#pragma omp teams reduction(+ : h, k, B::x) // expected-error 2 {{threadprivate or thread local variable cannot be reduction}} foo(); #pragma omp target #pragma omp teams reduction(+ : o) // expected-error {{no viable overloaded '='}} diff --git a/clang/test/OpenMP/teams_shared_messages.cpp b/clang/test/OpenMP/teams_shared_messages.cpp index ce2f917e207..630f449f07b 100644 --- a/clang/test/OpenMP/teams_shared_messages.cpp +++ b/clang/test/OpenMP/teams_shared_messages.cpp @@ -44,6 +44,14 @@ public: S3 h; #pragma omp threadprivate(h) // expected-note {{defined as threadprivate or thread local}} +namespace A { +double x; +#pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}} +} +namespace B { +using A::x; +} + int main(int argc, char **argv) { const int d = 5; const int da[5] = { 0 }; @@ -94,7 +102,7 @@ int main(int argc, char **argv) { #pragma omp teams shared(e, g) foo(); #pragma omp target - #pragma omp teams shared(h) // expected-error {{threadprivate or thread local variable cannot be shared}} + #pragma omp teams shared(h, B::x) // expected-error 2 {{threadprivate or thread local variable cannot be shared}} foo(); #pragma omp target #pragma omp teams private(i), shared(i) // expected-error {{private variable cannot be shared}} expected-note {{defined as private}} |