From: Alexey Bataev Date: Fri, 28 Jun 2019 20:45:14 +0000 (+0000) Subject: [OPENMP]Improve analysis of implicit captures. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=96d351f27a1f1087f32fda53253ea29d083ef7ee;p=clang [OPENMP]Improve analysis of implicit captures. If the variable is used in the OpenMP region implicitly, we need to check the data-sharing attributes for such variables and generate implicit clauses for them. Patch improves analysis of such variables for better handling of data-sharing rules. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@364683 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/SemaOpenMP.cpp b/lib/Sema/SemaOpenMP.cpp index 6f71875366..57ce28a42c 100644 --- a/lib/Sema/SemaOpenMP.cpp +++ b/lib/Sema/SemaOpenMP.cpp @@ -2636,24 +2636,7 @@ class DSAAttrChecker final : public StmtVisitor { // Check implicitly captured variables. if (!S->hasAssociatedStmt() || !S->getAssociatedStmt()) return; - for (const CapturedStmt::Capture &Cap : - S->getInnermostCapturedStmt()->captures()) { - if (!Cap.capturesVariable()) - continue; - VarDecl *VD = Cap.getCapturedVar(); - // Do not try to map the variable if it or its sub-component was mapped - // already. - if (isOpenMPTargetExecutionDirective(Stack->getCurrentDirective()) && - Stack->checkMappableExprComponentListsForDecl( - VD, /*CurrentRegionOnly=*/true, - [](OMPClauseMappableExprCommon::MappableExprComponentListRef, - OpenMPClauseKind) { return true; })) - continue; - DeclRefExpr *DRE = buildDeclRefExpr( - SemaRef, VD, VD->getType().getNonLValueExprType(SemaRef.Context), - Cap.getLocation(), /*RefersToCapture=*/true); - Visit(DRE); - } + visitSubCaptures(S->getInnermostCapturedStmt()); } public: @@ -2669,7 +2652,10 @@ public: Visit(CED->getInit()); return; } - } + } else if (VD->isImplicit() || isa(VD)) + // Do not analyze internal variables and do not enclose them into + // implicit clauses. + return; VD = VD->getCanonicalDecl(); // Skip internally declared variables. if (VD->hasLocalStorage() && CS && !CS->capturesVariable(VD)) @@ -2921,6 +2907,25 @@ public: } } + void visitSubCaptures(CapturedStmt *S) { + for (const CapturedStmt::Capture &Cap : S->captures()) { + if (!Cap.capturesVariable() && !Cap.capturesVariableByCopy()) + continue; + VarDecl *VD = Cap.getCapturedVar(); + // Do not try to map the variable if it or its sub-component was mapped + // already. + if (isOpenMPTargetExecutionDirective(Stack->getCurrentDirective()) && + Stack->checkMappableExprComponentListsForDecl( + VD, /*CurrentRegionOnly=*/true, + [](OMPClauseMappableExprCommon::MappableExprComponentListRef, + OpenMPClauseKind) { return true; })) + continue; + DeclRefExpr *DRE = buildDeclRefExpr( + SemaRef, VD, VD->getType().getNonLValueExprType(SemaRef.Context), + Cap.getLocation(), /*RefersToCapture=*/true); + Visit(DRE); + } + } bool isErrorFound() const { return ErrorFound; } ArrayRef getImplicitFirstprivate() const { return ImplicitFirstprivate; @@ -4002,6 +4007,17 @@ StmtResult Sema::ActOnOpenMPExecutableDirective( while (--ThisCaptureLevel >= 0) S = cast(S)->getCapturedStmt(); DSAChecker.Visit(S); + if (!isOpenMPTargetDataManagementDirective(Kind) && + !isOpenMPTaskingDirective(Kind)) { + // Visit subcaptures to generate implicit clauses for captured vars. + auto *CS = cast(AStmt); + SmallVector CaptureRegions; + getOpenMPCaptureRegions(CaptureRegions, Kind); + // Ignore outer tasking regions for target directives. + if (CaptureRegions.size() > 1 && CaptureRegions.front() == OMPD_task) + CS = cast(CS->getCapturedStmt()); + DSAChecker.visitSubCaptures(CS); + } if (DSAChecker.isErrorFound()) return StmtError(); // Generate list of implicitly defined firstprivate variables. @@ -4384,11 +4400,13 @@ StmtResult Sema::ActOnOpenMPExecutableDirective( VarsWithInheritedDSA[P.getFirst()] = P.getSecond(); } for (const auto &P : VarsWithInheritedDSA) { + if (P.getFirst()->isImplicit() || isa(P.getFirst())) + continue; + ErrorFound = true; Diag(P.second->getExprLoc(), diag::err_omp_no_dsa_for_variable) << P.first << P.second->getSourceRange(); Diag(DSAStack->getDefaultDSALocation(), diag::note_omp_default_dsa_none); } - ErrorFound = !VarsWithInheritedDSA.empty() || ErrorFound; if (!AllowedNameModifiers.empty()) ErrorFound = checkIfClauses(*this, Kind, Clauses, AllowedNameModifiers) || diff --git a/test/OpenMP/distribute_parallel_for_default_messages.cpp b/test/OpenMP/distribute_parallel_for_default_messages.cpp index 19042ef8a5..892772b1e8 100644 --- a/test/OpenMP/distribute_parallel_for_default_messages.cpp +++ b/test/OpenMP/distribute_parallel_for_default_messages.cpp @@ -43,11 +43,11 @@ T tmain(T argc) { for (i = 0; i < argc; ++i) // expected-error 2 {{variable 'argc' must have explicitly specified data sharing attributes}} foo(); -#pragma omp parallel default(none) +#pragma omp parallel default(none) // expected-note 2 {{explicit data sharing attribute requested here}} #pragma omp target #pragma omp teams #pragma omp distribute parallel for default(shared) - for (i = 0; i < argc; ++i) + for (i = 0; i < argc; ++i) // expected-error 2 {{variable 'argc' must have explicitly specified data sharing attributes}} foo(); return T(); @@ -91,11 +91,11 @@ int main(int argc, char **argv) { for (i = 0; i < argc; ++i) // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}} foo(); -#pragma omp parallel default(none) +#pragma omp parallel default(none) // expected-note {{explicit data sharing attribute requested here}} #pragma omp target #pragma omp teams #pragma omp distribute parallel for default(shared) - for (i = 0; i < argc; ++i) + for (i = 0; i < argc; ++i) // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}} foo(); return (tmain(argc) + tmain(argv[0][0])); // expected-note {{in instantiation of function template specialization 'tmain' requested here}} expected-note {{in instantiation of function template specialization 'tmain' requested here}} diff --git a/test/OpenMP/distribute_parallel_for_simd_default_messages.cpp b/test/OpenMP/distribute_parallel_for_simd_default_messages.cpp index 80f88a17ce..3f00436181 100644 --- a/test/OpenMP/distribute_parallel_for_simd_default_messages.cpp +++ b/test/OpenMP/distribute_parallel_for_simd_default_messages.cpp @@ -43,11 +43,11 @@ T tmain(T argc) { for (i = 0; i < argc; ++i) // expected-error 2 {{variable 'argc' must have explicitly specified data sharing attributes}} foo(); -#pragma omp parallel default(none) +#pragma omp parallel default(none) // expected-note 4 {{explicit data sharing attribute requested here}} #pragma omp target #pragma omp teams #pragma omp distribute parallel for simd default(shared) - for (i = 0; i < argc; ++i) + for (i = 0; i < argc; ++i) // expected-error 2 {{variable 'argc' must have explicitly specified data sharing attributes}} expected-error 2 {{variable 'i' must have explicitly specified data sharing attributes}} foo(); return T(); @@ -91,11 +91,11 @@ int main(int argc, char **argv) { for (i = 0; i < argc; ++i) // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}} foo(); -#pragma omp parallel default(none) +#pragma omp parallel default(none) // expected-note 2 {{explicit data sharing attribute requested here}} #pragma omp target #pragma omp teams #pragma omp distribute parallel for simd default(shared) - for (i = 0; i < argc; ++i) + for (i = 0; i < argc; ++i) // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}} expected-error {{variable 'i' must have explicitly specified data sharing attributes}} foo(); return (tmain(argc) + tmain(argv[0][0])); // expected-note {{in instantiation of function template specialization 'tmain' requested here}} expected-note {{in instantiation of function template specialization 'tmain' requested here}} diff --git a/test/OpenMP/nvptx_lambda_capturing.cpp b/test/OpenMP/nvptx_lambda_capturing.cpp index d169897f52..8bf666736a 100644 --- a/test/OpenMP/nvptx_lambda_capturing.cpp +++ b/test/OpenMP/nvptx_lambda_capturing.cpp @@ -13,9 +13,9 @@ #define HEADER // HOST-DAG: = private unnamed_addr constant [11 x i64] [i64 4, i64 4, i64 0, i64 4, i64 40, i64 4, i64 4, i64 4, i64 8, i64 4, i64 4] -// HOST-DAG: = private unnamed_addr constant [11 x i64] [i64 547, i64 547, i64 544, i64 33, i64 673, i64 1407374883554064, i64 1407374883554064, i64 1407374883554064, i64 1407374883554064, i64 1407374883554064, i64 288] +// HOST-DAG: = private unnamed_addr constant [11 x i64] [i64 673, i64 673, i64 544, i64 33, i64 673, i64 1407374883554064, i64 1407374883554064, i64 1407374883554064, i64 1407374883554064, i64 1407374883554064, i64 288] // HOST-DAG: = private unnamed_addr constant [11 x i64] [i64 4, i64 4, i64 4, i64 0, i64 4, i64 40, i64 4, i64 4, i64 4, i64 8, i64 4] -// HOST-DAG: = private unnamed_addr constant [11 x i64] [i64 547, i64 547, i64 547, i64 544, i64 547, i64 673, i64 1688849860264720, i64 1688849860264720, i64 1688849860264720, i64 1688849860264720, i64 1688849860264720] +// HOST-DAG: = private unnamed_addr constant [11 x i64] [i64 673, i64 673, i64 673, i64 544, i64 673, i64 673, i64 1688849860264720, i64 1688849860264720, i64 1688849860264720, i64 1688849860264720, i64 1688849860264720] // HOST-DAG: = private unnamed_addr constant [3 x i64] [i64 4, i64 8, i64 8] // HOST-DAG: = private unnamed_addr constant [3 x i64] [i64 547, i64 673, i64 562949953422096] // HOST-DAG: = private unnamed_addr constant [3 x i64] [i64 4, i64 8, i64 8] diff --git a/test/OpenMP/target_parallel_for_default_messages.cpp b/test/OpenMP/target_parallel_for_default_messages.cpp index aba3b30067..87f6a5bde1 100644 --- a/test/OpenMP/target_parallel_for_default_messages.cpp +++ b/test/OpenMP/target_parallel_for_default_messages.cpp @@ -29,9 +29,9 @@ int main(int argc, char **argv) { for (i = 0; i < argc; ++i) // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}} foo(); -#pragma omp parallel default(none) +#pragma omp parallel default(none) // expected-note {{explicit data sharing attribute requested here}} #pragma omp target parallel for default(shared) - for (i = 0; i < argc; ++i) + for (i = 0; i < argc; ++i) // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}} foo(); return 0; diff --git a/test/OpenMP/target_parallel_for_simd_default_messages.cpp b/test/OpenMP/target_parallel_for_simd_default_messages.cpp index 4b634e5116..91e745d911 100644 --- a/test/OpenMP/target_parallel_for_simd_default_messages.cpp +++ b/test/OpenMP/target_parallel_for_simd_default_messages.cpp @@ -29,9 +29,9 @@ int main(int argc, char **argv) { for (i = 0; i < argc; ++i) // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}} foo(); -#pragma omp parallel default(none) +#pragma omp parallel default(none) // expected-note 2 {{explicit data sharing attribute requested here}} #pragma omp target parallel for simd default(shared) - for (i = 0; i < argc; ++i) + for (i = 0; i < argc; ++i) // expected-error {{variable 'i' must have explicitly specified data sharing attributes}} expected-error {{variable 'argc' must have explicitly specified data sharing attributes}} foo(); return 0; diff --git a/test/OpenMP/target_teams_distribute_firstprivate_messages.cpp b/test/OpenMP/target_teams_distribute_firstprivate_messages.cpp index 833f951b78..3e00beac7f 100644 --- a/test/OpenMP/target_teams_distribute_firstprivate_messages.cpp +++ b/test/OpenMP/target_teams_distribute_firstprivate_messages.cpp @@ -110,7 +110,7 @@ int main(int argc, char **argv) { for (i = 0; i < argc; ++i) foo(); #pragma omp target -#pragma omp teams distribute firstprivate(ca) // expected-error {{no matching constructor for initialization of 'S3'}} +#pragma omp teams distribute firstprivate(ca) // expected-error {{no matching constructor for initialization of 'S3'}} expected-warning {{Non-trivial type 'const S3 [5]' is mapped, only trivial types are guaranteed to be mapped correctly}} for (i = 0; i < argc; ++i) foo(); #pragma omp target teams distribute firstprivate(da) diff --git a/test/OpenMP/teams_distribute_firstprivate_messages.cpp b/test/OpenMP/teams_distribute_firstprivate_messages.cpp index 2bbe8d78dc..b1f60f1ecb 100644 --- a/test/OpenMP/teams_distribute_firstprivate_messages.cpp +++ b/test/OpenMP/teams_distribute_firstprivate_messages.cpp @@ -100,7 +100,7 @@ int main(int argc, char **argv) { for (i = 0; i < argc; ++i) foo(); #pragma omp target -#pragma omp teams distribute firstprivate (a, b, c, d, f) // expected-error {{firstprivate variable with incomplete type 'S1'}} +#pragma omp teams distribute firstprivate (a, b, c, d, f) // expected-error {{firstprivate variable with incomplete type 'S1'}} expected-error {{incomplete type 'S1' where a complete type is required}} for (i = 0; i < argc; ++i) foo(); #pragma omp target diff --git a/test/OpenMP/teams_distribute_lastprivate_messages.cpp b/test/OpenMP/teams_distribute_lastprivate_messages.cpp index 76f7139870..35231edbe8 100644 --- a/test/OpenMP/teams_distribute_lastprivate_messages.cpp +++ b/test/OpenMP/teams_distribute_lastprivate_messages.cpp @@ -194,7 +194,7 @@ int main(int argc, char **argv) { for (i = 0; i < argc; ++i) foo(); #pragma omp target -#pragma omp teams distribute lastprivate(a, b, c, d, f) // expected-error {{lastprivate variable with incomplete type 'S1'}} expected-error 1 {{const-qualified variable without mutable fields cannot be lastprivate}} expected-error 2 {{const-qualified variable cannot be lastprivate}} +#pragma omp teams distribute lastprivate(a, b, c, d, f) // expected-error {{lastprivate variable with incomplete type 'S1'}} expected-error 1 {{const-qualified variable without mutable fields cannot be lastprivate}} expected-error 2 {{const-qualified variable cannot be lastprivate}} expected-error {{incomplete type 'S1' where a complete type is required}} for (i = 0; i < argc; ++i) foo(); #pragma omp target diff --git a/test/OpenMP/teams_distribute_parallel_for_firstprivate_messages.cpp b/test/OpenMP/teams_distribute_parallel_for_firstprivate_messages.cpp index 35ef9792c4..922658e6dd 100644 --- a/test/OpenMP/teams_distribute_parallel_for_firstprivate_messages.cpp +++ b/test/OpenMP/teams_distribute_parallel_for_firstprivate_messages.cpp @@ -100,7 +100,7 @@ int main(int argc, char **argv) { for (i = 0; i < argc; ++i) foo(); #pragma omp target -#pragma omp teams distribute parallel for firstprivate (a, b, c, d, f) // expected-error {{firstprivate variable with incomplete type 'S1'}} +#pragma omp teams distribute parallel for firstprivate (a, b, c, d, f) // expected-error {{firstprivate variable with incomplete type 'S1'}} expected-error {{incomplete type 'S1' where a complete type is required}} for (i = 0; i < argc; ++i) foo(); #pragma omp target diff --git a/test/OpenMP/teams_distribute_parallel_for_lastprivate_messages.cpp b/test/OpenMP/teams_distribute_parallel_for_lastprivate_messages.cpp index 6207efadb1..22d8e6ad71 100644 --- a/test/OpenMP/teams_distribute_parallel_for_lastprivate_messages.cpp +++ b/test/OpenMP/teams_distribute_parallel_for_lastprivate_messages.cpp @@ -194,7 +194,7 @@ int main(int argc, char **argv) { for (i = 0; i < argc; ++i) foo(); #pragma omp target -#pragma omp teams distribute parallel for lastprivate(a, b, c, d, f) // expected-error {{lastprivate variable with incomplete type 'S1'}} expected-error 1 {{const-qualified variable without mutable fields cannot be lastprivate}} expected-error 2 {{const-qualified variable cannot be lastprivate}} +#pragma omp teams distribute parallel for lastprivate(a, b, c, d, f) // expected-error {{lastprivate variable with incomplete type 'S1'}} expected-error 1 {{const-qualified variable without mutable fields cannot be lastprivate}} expected-error 2 {{const-qualified variable cannot be lastprivate}} expected-error {{incomplete type 'S1' where a complete type is required}} for (i = 0; i < argc; ++i) foo(); #pragma omp target diff --git a/test/OpenMP/teams_distribute_parallel_for_reduction_messages.cpp b/test/OpenMP/teams_distribute_parallel_for_reduction_messages.cpp index 5c982462c5..cc7a4c668b 100644 --- a/test/OpenMP/teams_distribute_parallel_for_reduction_messages.cpp +++ b/test/OpenMP/teams_distribute_parallel_for_reduction_messages.cpp @@ -243,10 +243,10 @@ int main(int argc, char **argv) { #pragma omp teams distribute parallel for reduction(^ : S1) // expected-error {{'S1' does not refer to a value}} for (int j=0; j<100; j++) foo(); #pragma omp target -#pragma omp teams distribute parallel for reduction(+ : a, b, c, d, f) // expected-error {{a reduction list item with incomplete type 'S1'}} expected-error 2 {{const-qualified variable cannot be reduction}} expected-error {{'operator+' is a private member of 'S2'}} +#pragma omp teams distribute parallel for reduction(+ : a, b, c, d, f) // expected-error {{a reduction list item with incomplete type 'S1'}} expected-error 2 {{const-qualified variable cannot be reduction}} expected-error {{'operator+' is a private member of 'S2'}} expected-error {{incomplete type 'S1' where a complete type is required}} for (int j=0; j<100; j++) foo(); #pragma omp target -#pragma omp teams distribute parallel for reduction(min : a, b, c, d, f) // expected-error {{a reduction list item with incomplete type 'S1'}} expected-error 2 {{arguments of OpenMP clause 'reduction' for 'min' or 'max' must be of arithmetic type}} expected-error 2 {{const-qualified variable cannot be reduction}} +#pragma omp teams distribute parallel for reduction(min : a, b, c, d, f) // expected-error {{a reduction list item with incomplete type 'S1'}} expected-error 2 {{arguments of OpenMP clause 'reduction' for 'min' or 'max' must be of arithmetic type}} expected-error 2 {{const-qualified variable cannot be reduction}} expected-error {{incomplete type 'S1' where a complete type is required}} for (int j=0; j<100; j++) foo(); #pragma omp target #pragma omp teams distribute parallel for reduction(max : h.b) // expected-error {{expected variable name, array element or array section}} diff --git a/test/OpenMP/teams_distribute_parallel_for_simd_aligned_messages.cpp b/test/OpenMP/teams_distribute_parallel_for_simd_aligned_messages.cpp index 8fc21a086f..a8f14cb61f 100644 --- a/test/OpenMP/teams_distribute_parallel_for_simd_aligned_messages.cpp +++ b/test/OpenMP/teams_distribute_parallel_for_simd_aligned_messages.cpp @@ -253,7 +253,7 @@ int main(int argc, char **argv) { for (int k = 0; k < argc; ++k) ++k; #pragma omp target -#pragma omp teams distribute parallel for simd aligned (a, b) // expected-error {{argument of aligned clause should be array, pointer, reference to array or reference to pointer, not 'S1'}} expected-error {{argument of aligned clause should be array, pointer, reference to array or reference to pointer, not 'S2'}} +#pragma omp teams distribute parallel for simd aligned (a, b) // expected-error {{argument of aligned clause should be array, pointer, reference to array or reference to pointer, not 'S1'}} expected-error {{argument of aligned clause should be array, pointer, reference to array or reference to pointer, not 'S2'}} expected-error {{incomplete type 'S1' where a complete type is required}} expected-warning {{Non-trivial type 'const S2' is mapped, only trivial types are guaranteed to be mapped correctly}} for (int k = 0; k < argc; ++k) ++k; #pragma omp target diff --git a/test/OpenMP/teams_distribute_parallel_for_simd_firstprivate_messages.cpp b/test/OpenMP/teams_distribute_parallel_for_simd_firstprivate_messages.cpp index 611e9b808f..182c21423a 100644 --- a/test/OpenMP/teams_distribute_parallel_for_simd_firstprivate_messages.cpp +++ b/test/OpenMP/teams_distribute_parallel_for_simd_firstprivate_messages.cpp @@ -100,7 +100,7 @@ int main(int argc, char **argv) { for (i = 0; i < argc; ++i) foo(); #pragma omp target -#pragma omp teams distribute parallel for simd firstprivate (a, b, c, d, f) // expected-error {{firstprivate variable with incomplete type 'S1'}} +#pragma omp teams distribute parallel for simd firstprivate (a, b, c, d, f) // expected-error {{firstprivate variable with incomplete type 'S1'}} expected-error {{incomplete type 'S1' where a complete type is required}} for (i = 0; i < argc; ++i) foo(); #pragma omp target diff --git a/test/OpenMP/teams_distribute_parallel_for_simd_lastprivate_messages.cpp b/test/OpenMP/teams_distribute_parallel_for_simd_lastprivate_messages.cpp index f123f90243..d0f6775c57 100644 --- a/test/OpenMP/teams_distribute_parallel_for_simd_lastprivate_messages.cpp +++ b/test/OpenMP/teams_distribute_parallel_for_simd_lastprivate_messages.cpp @@ -194,7 +194,7 @@ int main(int argc, char **argv) { for (i = 0; i < argc; ++i) foo(); #pragma omp target -#pragma omp teams distribute parallel for simd lastprivate(a, b, c, d, f) // expected-error {{lastprivate variable with incomplete type 'S1'}} expected-error 1 {{const-qualified variable without mutable fields cannot be lastprivate}} expected-error 2 {{const-qualified variable cannot be lastprivate}} +#pragma omp teams distribute parallel for simd lastprivate(a, b, c, d, f) // expected-error {{lastprivate variable with incomplete type 'S1'}} expected-error 1 {{const-qualified variable without mutable fields cannot be lastprivate}} expected-error 2 {{const-qualified variable cannot be lastprivate}} expected-error {{incomplete type 'S1' where a complete type is required}} for (i = 0; i < argc; ++i) foo(); #pragma omp target diff --git a/test/OpenMP/teams_distribute_parallel_for_simd_linear_messages.cpp b/test/OpenMP/teams_distribute_parallel_for_simd_linear_messages.cpp index 798aa56559..44e42c624d 100644 --- a/test/OpenMP/teams_distribute_parallel_for_simd_linear_messages.cpp +++ b/test/OpenMP/teams_distribute_parallel_for_simd_linear_messages.cpp @@ -251,7 +251,7 @@ int main(int argc, char **argv) { #pragma omp target -#pragma omp teams distribute parallel for simd linear (a, b) // expected-error {{linear variable with incomplete type 'S1'}} expected-error {{argument of a linear clause should be of integral or pointer type, not 'S2'}} +#pragma omp teams distribute parallel for simd linear (a, b) // expected-error {{linear variable with incomplete type 'S1'}} expected-error {{argument of a linear clause should be of integral or pointer type, not 'S2'}} expected-error {{incomplete type 'S1' where a complete type is required}} expected-warning {{Non-trivial type 'const S2' is mapped, only trivial types are guaranteed to be mapped correctly}} for (int k = 0; k < argc; ++k) ++k; #pragma omp target @@ -259,7 +259,7 @@ int main(int argc, char **argv) { for (int k = 0; k < argc; ++k) ++k; #pragma omp target -#pragma omp teams distribute parallel for simd linear(e, g) // expected-error {{argument of a linear clause should be of integral or pointer type, not 'S4'}} expected-error {{argument of a linear clause should be of integral or pointer type, not 'S5'}} +#pragma omp teams distribute parallel for simd linear(e, g) // expected-error {{argument of a linear clause should be of integral or pointer type, not 'S4'}} expected-error {{argument of a linear clause should be of integral or pointer type, not 'S5'}} expected-warning {{Non-trivial type 'S4' is mapped, only trivial types are guaranteed to be mapped correctly}} expected-warning {{Non-trivial type 'S5' is mapped, only trivial types are guaranteed to be mapped correctly}} for (int k = 0; k < argc; ++k) ++k; #pragma omp target diff --git a/test/OpenMP/teams_distribute_parallel_for_simd_reduction_messages.cpp b/test/OpenMP/teams_distribute_parallel_for_simd_reduction_messages.cpp index 1efd4b05ca..82854a7cb6 100644 --- a/test/OpenMP/teams_distribute_parallel_for_simd_reduction_messages.cpp +++ b/test/OpenMP/teams_distribute_parallel_for_simd_reduction_messages.cpp @@ -243,10 +243,10 @@ int main(int argc, char **argv) { #pragma omp teams distribute parallel for simd reduction(^ : S1) // expected-error {{'S1' does not refer to a value}} for (int j=0; j<100; j++) foo(); #pragma omp target -#pragma omp teams distribute parallel for simd reduction(+ : a, b, c, d, f) // expected-error {{a reduction list item with incomplete type 'S1'}} expected-error 2 {{const-qualified variable cannot be reduction}} expected-error {{'operator+' is a private member of 'S2'}} +#pragma omp teams distribute parallel for simd reduction(+ : a, b, c, d, f) // expected-error {{a reduction list item with incomplete type 'S1'}} expected-error 2 {{const-qualified variable cannot be reduction}} expected-error {{'operator+' is a private member of 'S2'}} expected-error {{incomplete type 'S1' where a complete type is required}} for (int j=0; j<100; j++) foo(); #pragma omp target -#pragma omp teams distribute parallel for simd reduction(min : a, b, c, d, f) // expected-error {{a reduction list item with incomplete type 'S1'}} expected-error 2 {{arguments of OpenMP clause 'reduction' for 'min' or 'max' must be of arithmetic type}} expected-error 2 {{const-qualified variable cannot be reduction}} +#pragma omp teams distribute parallel for simd reduction(min : a, b, c, d, f) // expected-error {{a reduction list item with incomplete type 'S1'}} expected-error 2 {{arguments of OpenMP clause 'reduction' for 'min' or 'max' must be of arithmetic type}} expected-error 2 {{const-qualified variable cannot be reduction}} expected-error {{incomplete type 'S1' where a complete type is required}} for (int j=0; j<100; j++) foo(); #pragma omp target #pragma omp teams distribute parallel for simd reduction(max : h.b) // expected-error {{expected variable name, array element or array section}} diff --git a/test/OpenMP/teams_distribute_reduction_messages.cpp b/test/OpenMP/teams_distribute_reduction_messages.cpp index da86638ba0..6b209c7797 100644 --- a/test/OpenMP/teams_distribute_reduction_messages.cpp +++ b/test/OpenMP/teams_distribute_reduction_messages.cpp @@ -249,10 +249,10 @@ int main(int argc, char **argv) { #pragma omp teams distribute reduction(^ : S1) // expected-error {{'S1' does not refer to a value}} for (int j=0; j<100; j++) foo(); #pragma omp target -#pragma omp teams distribute reduction(+ : a, b, c, d, f) // expected-error {{a reduction list item with incomplete type 'S1'}} expected-error 2 {{const-qualified variable cannot be reduction}} expected-error {{'operator+' is a private member of 'S2'}} +#pragma omp teams distribute reduction(+ : a, b, c, d, f) // expected-error {{a reduction list item with incomplete type 'S1'}} expected-error 2 {{const-qualified variable cannot be reduction}} expected-error {{'operator+' is a private member of 'S2'}} expected-error {{incomplete type 'S1' where a complete type is required}} for (int j=0; j<100; j++) foo(); #pragma omp target -#pragma omp teams distribute reduction(min : a, b, c, d, f) // expected-error {{a reduction list item with incomplete type 'S1'}} expected-error 2 {{arguments of OpenMP clause 'reduction' for 'min' or 'max' must be of arithmetic type}} expected-error 2 {{const-qualified variable cannot be reduction}} +#pragma omp teams distribute reduction(min : a, b, c, d, f) // expected-error {{a reduction list item with incomplete type 'S1'}} expected-error 2 {{arguments of OpenMP clause 'reduction' for 'min' or 'max' must be of arithmetic type}} expected-error 2 {{const-qualified variable cannot be reduction}} expected-error {{incomplete type 'S1' where a complete type is required}} for (int j=0; j<100; j++) foo(); #pragma omp target #pragma omp teams distribute reduction(max : h.b) // expected-error {{expected variable name, array element or array section}} diff --git a/test/OpenMP/teams_distribute_simd_aligned_messages.cpp b/test/OpenMP/teams_distribute_simd_aligned_messages.cpp index 34227c659a..f745aaad7f 100644 --- a/test/OpenMP/teams_distribute_simd_aligned_messages.cpp +++ b/test/OpenMP/teams_distribute_simd_aligned_messages.cpp @@ -253,7 +253,7 @@ int main(int argc, char **argv) { for (int k = 0; k < argc; ++k) ++k; #pragma omp target -#pragma omp teams distribute simd aligned (a, b) // expected-error {{argument of aligned clause should be array, pointer, reference to array or reference to pointer, not 'S1'}} expected-error {{argument of aligned clause should be array, pointer, reference to array or reference to pointer, not 'S2'}} +#pragma omp teams distribute simd aligned (a, b) // expected-error {{argument of aligned clause should be array, pointer, reference to array or reference to pointer, not 'S1'}} expected-error {{argument of aligned clause should be array, pointer, reference to array or reference to pointer, not 'S2'}} expected-error {{incomplete type 'S1' where a complete type is required}} expected-warning {{Non-trivial type 'const S2' is mapped, only trivial types are guaranteed to be mapped correctly}} for (int k = 0; k < argc; ++k) ++k; #pragma omp target diff --git a/test/OpenMP/teams_distribute_simd_firstprivate_messages.cpp b/test/OpenMP/teams_distribute_simd_firstprivate_messages.cpp index 08a461a467..8ea499f2f8 100644 --- a/test/OpenMP/teams_distribute_simd_firstprivate_messages.cpp +++ b/test/OpenMP/teams_distribute_simd_firstprivate_messages.cpp @@ -100,7 +100,7 @@ int main(int argc, char **argv) { for (i = 0; i < argc; ++i) foo(); #pragma omp target -#pragma omp teams distribute simd firstprivate (a, b, c, d, f) // expected-error {{firstprivate variable with incomplete type 'S1'}} +#pragma omp teams distribute simd firstprivate (a, b, c, d, f) // expected-error {{firstprivate variable with incomplete type 'S1'}} expected-error {{incomplete type 'S1' where a complete type is required}} for (i = 0; i < argc; ++i) foo(); #pragma omp target diff --git a/test/OpenMP/teams_distribute_simd_lastprivate_messages.cpp b/test/OpenMP/teams_distribute_simd_lastprivate_messages.cpp index 4feda4be2b..3a7f0d2f4c 100644 --- a/test/OpenMP/teams_distribute_simd_lastprivate_messages.cpp +++ b/test/OpenMP/teams_distribute_simd_lastprivate_messages.cpp @@ -194,7 +194,7 @@ int main(int argc, char **argv) { for (i = 0; i < argc; ++i) foo(); #pragma omp target -#pragma omp teams distribute simd lastprivate(a, b, c, d, f) // expected-error {{lastprivate variable with incomplete type 'S1'}} expected-error 1 {{const-qualified variable without mutable fields cannot be lastprivate}} expected-error 2 {{const-qualified variable cannot be lastprivate}} +#pragma omp teams distribute simd lastprivate(a, b, c, d, f) // expected-error {{lastprivate variable with incomplete type 'S1'}} expected-error 1 {{const-qualified variable without mutable fields cannot be lastprivate}} expected-error 2 {{const-qualified variable cannot be lastprivate}} expected-error {{incomplete type 'S1' where a complete type is required}} for (i = 0; i < argc; ++i) foo(); #pragma omp target diff --git a/test/OpenMP/teams_distribute_simd_linear_messages.cpp b/test/OpenMP/teams_distribute_simd_linear_messages.cpp index 43fe1a4239..91b358f5ce 100644 --- a/test/OpenMP/teams_distribute_simd_linear_messages.cpp +++ b/test/OpenMP/teams_distribute_simd_linear_messages.cpp @@ -251,7 +251,7 @@ int main(int argc, char **argv) { #pragma omp target -#pragma omp teams distribute simd linear (a, b) // expected-error {{linear variable with incomplete type 'S1'}} expected-error {{argument of a linear clause should be of integral or pointer type, not 'S2'}} +#pragma omp teams distribute simd linear (a, b) // expected-error {{incomplete type 'S1' where a complete type is required}} expected-error {{linear variable with incomplete type 'S1'}} expected-error {{argument of a linear clause should be of integral or pointer type, not 'S2'}} expected-warning {{Non-trivial type 'const S2' is mapped, only trivial types are guaranteed to be mapped correctly}} for (int k = 0; k < argc; ++k) ++k; #pragma omp target @@ -259,7 +259,7 @@ int main(int argc, char **argv) { for (int k = 0; k < argc; ++k) ++k; #pragma omp target -#pragma omp teams distribute simd linear(e, g) // expected-error {{argument of a linear clause should be of integral or pointer type, not 'S4'}} expected-error {{argument of a linear clause should be of integral or pointer type, not 'S5'}} +#pragma omp teams distribute simd linear(e, g) // expected-error {{argument of a linear clause should be of integral or pointer type, not 'S4'}} expected-error {{argument of a linear clause should be of integral or pointer type, not 'S5'}} expected-warning {{Non-trivial type 'S4' is mapped, only trivial types are guaranteed to be mapped correctly}} expected-warning {{Non-trivial type 'S5' is mapped, only trivial types are guaranteed to be mapped correctly}} for (int k = 0; k < argc; ++k) ++k; #pragma omp target diff --git a/test/OpenMP/teams_distribute_simd_reduction_messages.cpp b/test/OpenMP/teams_distribute_simd_reduction_messages.cpp index fbe73e1f1e..826de05219 100644 --- a/test/OpenMP/teams_distribute_simd_reduction_messages.cpp +++ b/test/OpenMP/teams_distribute_simd_reduction_messages.cpp @@ -243,10 +243,10 @@ int main(int argc, char **argv) { #pragma omp teams distribute simd reduction(^ : S1) // expected-error {{'S1' does not refer to a value}} for (int j=0; j<100; j++) foo(); #pragma omp target -#pragma omp teams distribute simd reduction(+ : a, b, c, d, f) // expected-error {{a reduction list item with incomplete type 'S1'}} expected-error 2 {{const-qualified variable cannot be reduction}} expected-error {{'operator+' is a private member of 'S2'}} +#pragma omp teams distribute simd reduction(+ : a, b, c, d, f) // expected-error {{incomplete type 'S1' where a complete type is required}} expected-error {{a reduction list item with incomplete type 'S1'}} expected-error 2 {{const-qualified variable cannot be reduction}} expected-error {{'operator+' is a private member of 'S2'}} for (int j=0; j<100; j++) foo(); #pragma omp target -#pragma omp teams distribute simd reduction(min : a, b, c, d, f) // expected-error {{a reduction list item with incomplete type 'S1'}} expected-error 2 {{arguments of OpenMP clause 'reduction' for 'min' or 'max' must be of arithmetic type}} expected-error 2 {{const-qualified variable cannot be reduction}} +#pragma omp teams distribute simd reduction(min : a, b, c, d, f) // expected-error {{incomplete type 'S1' where a complete type is required}} expected-error {{a reduction list item with incomplete type 'S1'}} expected-error 2 {{arguments of OpenMP clause 'reduction' for 'min' or 'max' must be of arithmetic type}} expected-error 2 {{const-qualified variable cannot be reduction}} for (int j=0; j<100; j++) foo(); #pragma omp target #pragma omp teams distribute simd reduction(max : h.b) // expected-error {{expected variable name, array element or array section}} diff --git a/test/OpenMP/teams_firstprivate_messages.cpp b/test/OpenMP/teams_firstprivate_messages.cpp index f04827708a..9bc5eeac6e 100644 --- a/test/OpenMP/teams_firstprivate_messages.cpp +++ b/test/OpenMP/teams_firstprivate_messages.cpp @@ -92,7 +92,7 @@ int main(int argc, char **argv) { #pragma omp teams firstprivate(S1) // expected-error {{'S1' does not refer to a value}} foo(); #pragma omp target -#pragma omp teams firstprivate(a, b, c, d, f) // expected-error {{firstprivate variable with incomplete type 'S1'}} +#pragma omp teams firstprivate(a, b, c, d, f) // expected-error {{incomplete type 'S1' where a complete type is required}} expected-error {{firstprivate variable with incomplete type 'S1'}} foo(); #pragma omp target #pragma omp teams firstprivate(argv[1]) // expected-error {{expected variable name}} diff --git a/test/OpenMP/teams_reduction_messages.cpp b/test/OpenMP/teams_reduction_messages.cpp index 558d766e70..d9219cfbbb 100644 --- a/test/OpenMP/teams_reduction_messages.cpp +++ b/test/OpenMP/teams_reduction_messages.cpp @@ -262,10 +262,10 @@ int main(int argc, char **argv) { #pragma omp teams reduction(^ : S1) // expected-error {{'S1' does not refer to a value}} foo(); #pragma omp target -#pragma omp teams reduction(+ : a, b, c, d, f) // expected-error {{a reduction list item with incomplete type 'S1'}} expected-error 2 {{const-qualified variable cannot be reduction}} expected-error {{'operator+' is a private member of 'S2'}} +#pragma omp teams reduction(+ : a, b, c, d, f) // expected-error {{incomplete type 'S1' where a complete type is required}} expected-error {{a reduction list item with incomplete type 'S1'}} expected-error 2 {{const-qualified variable cannot be reduction}} expected-error {{'operator+' is a private member of 'S2'}} foo(); #pragma omp target -#pragma omp teams reduction(min : a, b, c, d, f) // expected-error {{a reduction list item with incomplete type 'S1'}} expected-error 2 {{arguments of OpenMP clause 'reduction' for 'min' or 'max' must be of arithmetic type}} expected-error 2 {{const-qualified variable cannot be reduction}} +#pragma omp teams reduction(min : a, b, c, d, f) // expected-error {{incomplete type 'S1' where a complete type is required}} expected-error {{a reduction list item with incomplete type 'S1'}} expected-error 2 {{arguments of OpenMP clause 'reduction' for 'min' or 'max' must be of arithmetic type}} expected-error 2 {{const-qualified variable cannot be reduction}} foo(); #pragma omp target #pragma omp teams reduction(max : h.b) // expected-error {{expected variable name, array element or array section}}