From d387dcde60a0381895ffe43d3ef817a98c0459fe Mon Sep 17 00:00:00 2001 From: Zahira Ammarguellat Date: Mon, 27 Jan 2025 07:00:38 -0800 Subject: [PATCH] Addressed review suggestions and replaced declare_target_messages.cpp with the DEFINE version one. --- clang/test/OpenMP/declare_mapper_messages.c | 11 +++- clang/test/OpenMP/declare_target_messages.cpp | 54 +++++++++++-------- .../declare_target_variables_ast_print.cpp | 1 + 3 files changed, 41 insertions(+), 25 deletions(-) diff --git a/clang/test/OpenMP/declare_mapper_messages.c b/clang/test/OpenMP/declare_mapper_messages.c index c8b369b1c464d4..22386892273110 100644 --- a/clang/test/OpenMP/declare_mapper_messages.c +++ b/clang/test/OpenMP/declare_mapper_messages.c @@ -82,9 +82,16 @@ int fun(int arg) { #pragma omp target map(mapper(aa) :vv) // omp50-error {{missing map type}} omp51-error {{missing map type}} omp52-error {{missing map type}} omp51-simd-error {{missing map type}} {} #endif -#pragma omp target map(mapper(aa) to:d) // expected-error {{mapper type must be of struct, union or class type}} omp52-error{{missing ',' after map type modifier}} omp60-error{{missing ',' after map type modifier}} omp60-simd-error{{missing ',' after map type modifier}} +// expected-error@+4 {{mapper type must be of struct, union or class type}} +// omp52-error@+3 {{missing ',' after map type modifier}} +// omp60-error@+2 {{missing ',' after map type modifier}} +// omp60-simd-error@+1 {{missing ',' after map type modifier}} +#pragma omp target map(mapper(aa) to:d) {} -#pragma omp target map(mapper(aa) to:vv) map(close mapper(aa) from:v1) map(mapper(aa) to:arr[0]) // omp52-error 4 {{missing ',' after map type modifier}} omp60-error 4 {{missing ',' after map type modifier}} omp60-simd-error 4 {{missing ',' after map type modifier}} +// omp52-error@+3 4 {{missing ',' after map type modifier}} +// omp60-error@+2 4 {{missing ',' after map type modifier}} +// omp60-simd-error@+1 4 {{missing ',' after map type modifier}} +#pragma omp target map(mapper(aa) to:vv) map(close mapper(aa) from:v1) map(mapper(aa) to:arr[0]) {} #pragma omp target update to(mapper) // expected-error {{expected '(' after 'mapper'}} expected-error {{expected expression}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}} diff --git a/clang/test/OpenMP/declare_target_messages.cpp b/clang/test/OpenMP/declare_target_messages.cpp index a8cca5ca11c1c9..0d2af3668a2eb0 100644 --- a/clang/test/OpenMP/declare_target_messages.cpp +++ b/clang/test/OpenMP/declare_target_messages.cpp @@ -1,26 +1,34 @@ -// RUN: %clang_cc1 -triple x86_64-apple-macos10.7.0 -verify=expected,omp45,omp45-to-51,omp45-to-51-var,omp45-to-51-clause,omp45-to-51-clause -fopenmp -fopenmp-version=45 -fnoopenmp-use-tls -ferror-limit 100 -o - %s -// RUN: %clang_cc1 -triple x86_64-apple-macos10.7.0 -verify=expected,omp5,ompvar,omp45-to-51,omp5-and-51,omp5-or-later,omp5-or-later-var,omp45-to-51-var,omp45-to-51-clause,host5,host-5-and-51,no-host5-and-51 -fopenmp -fopenmp-version=50 -fopenmp-targets=x86_64-apple-macos10.7.0 -fnoopenmp-use-tls -ferror-limit 100 -o - %s -// RUN: %clang_cc1 -triple x86_64-apple-macos10.7.0 -verify=expected,omp52,ompvar,omp5-or-later,omp5-or-later-var -fopenmp -fopenmp-version=60 -fopenmp-targets=x86_64-apple-macos10.7.0 -fnoopenmp-use-tls -ferror-limit 100 -o - %s -// RUN: %clang_cc1 -triple x86_64-apple-macos10.7.0 -verify=expected,omp5,ompvar,omp45-to-51,omp5-and-51,omp5-or-later,omp5-or-later-var,omp45-to-51-var,omp45-to-51-clause,host-5-and-51,no-host5-and-51,dev5 -fopenmp -fopenmp-version=50 -fopenmp-is-target-device -fopenmp-targets=x86_64-apple-macos10.7.0 -aux-triple x86_64-apple-macos10.7.0 -fnoopenmp-use-tls -ferror-limit 100 -o - %s -// RUN: %clang_cc1 -triple x86_64-apple-macos10.7.0 -verify=expected,omp52,ompvar,omp5-or-later,omp5-or-later-var -fopenmp -fopenmp-version=60 -fopenmp-is-target-device -fopenmp-targets=x86_64-apple-macos10.7.0 -aux-triple x86_64-apple-macos10.7.0 -fnoopenmp-use-tls -ferror-limit 100 -o - %s - -// RUN: %clang_cc1 -triple x86_64-apple-macos10.7.0 -verify=expected,omp5,ompvar,omp45-to-51,omp5-and-51,omp5-or-later,omp5-or-later-var,omp45-to-51-var,omp45-to-51-clause,host5,host-5-and-51,no-host5-and-51 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=x86_64-apple-macos10.7.0 -fnoopenmp-use-tls -ferror-limit 100 -o - %s -// RUN: %clang_cc1 -triple x86_64-apple-macos10.7.0 -verify=expected,omp52,ompvar,omp5-or-later,omp5-or-later-var -fopenmp-simd -fopenmp-version=60 -fopenmp-targets=x86_64-apple-macos10.7.0 -fnoopenmp-use-tls -ferror-limit 100 -o - %s -// RUN: %clang_cc1 -triple x86_64-apple-macos10.7.0 -verify=expected,omp5,ompvar,omp45-to-51,omp5-and-51,omp5-or-later,omp5-or-later-var,omp45-to-51-var,omp45-to-51-clause,host5,host-5-and-51,no-host5-and-51 -fopenmp-simd -fopenmp-version=50 -fopenmp-is-target-device -fopenmp-targets=x86_64-apple-macos10.7.0 -fnoopenmp-use-tls -ferror-limit 100 -o - %s -// RUN: %clang_cc1 -triple x86_64-apple-macos10.7.0 -verify=expected,omp52,ompvar,omp5-or-later,omp5-or-later-var -fopenmp-simd -fopenmp-version=60 -fopenmp-is-target-device -fopenmp-targets=x86_64-apple-macos10.7.0 -fnoopenmp-use-tls -ferror-limit 100 -o - %s - -// RUN: %clang_cc1 -triple x86_64-apple-macos10.7.0 -verify=expected,omp45,omp45-to-51,omp45-to-51-var,omp45-to-51-clause -fopenmp-version=45 -fopenmp-simd -fnoopenmp-use-tls -ferror-limit 100 -o - %s -// RUN: %clang_cc1 -triple x86_64-apple-macos10.7.0 -verify=expected,omp51,ompvar,omp45-to-51,omp5-and-51,omp5-or-later,omp5-or-later-var,omp45-to-51-var,omp45-to-51-clause,host-5-and-51,no-host5-and-51 -fopenmp -fnoopenmp-use-tls -ferror-limit 100 -o - %s -// RUN: %clang_cc1 -triple x86_64-apple-macos10.7.0 -verify=expected,omp51,ompvar,omp45-to-51,omp5-and-51,omp5-or-later,omp5-or-later-var,omp45-to-51-var,omp45-to-51-clause,host-5-and-51,no-host5-and-51 -fopenmp -fnoopenmp-use-tls -ferror-limit 100 -DTESTEND=1 -o - %s -// RUN: %clang_cc1 -triple x86_64-apple-macos10.7.0 -verify=expected,omp51,ompvar,omp45-to-51,omp5-and-51,omp5-or-later,omp5-or-later-var,omp45-to-51-var,omp45-to-51-clause,host-5-and-51,no-host5-and-51 -fopenmp -fnoopenmp-use-tls -ferror-limit 100 -I%S/Inputs -DTESTENDINC=1 -o - %s -// RUN: %clang_cc1 -triple x86_64-apple-macos10.7.0 -verify=expected,omp51,ompvar,omp45-to-51,omp5-and-51,omp5-or-later,omp5-or-later-var,omp45-to-51-var,omp45-to-51-clause,host-5-and-51,no-host5-and-51 -fopenmp-simd -fnoopenmp-use-tls -ferror-limit 100 -o - %s - -// RUN: %clang_cc1 -triple x86_64-apple-macos10.7.0 -verify=expected,omp52,ompvar,omp5-or-later,omp5-or-later-var -fopenmp -fopenmp-version=52 -DVERBOSE_MODE=1 -fnoopenmp-use-tls -ferror-limit 100 -o - %s -// RUN: %clang_cc1 -triple x86_64-apple-macos10.7.0 -verify=expected,omp52,ompvar,omp5-or-later,omp5-or-later-var -fopenmp -fopenmp-version=60 -DVERBOSE_MODE=1 -fnoopenmp-use-tls -ferror-limit 100 -o - %s - -// RUN: %clang_cc1 -triple x86_64-apple-macos10.7.0 -verify=expected,omp5,ompvar,omp45-to-51,omp5-and-51,omp5-or-later,omp5-or-later-var,omp45-to-51-var,omp45-to-51-clause,host-5-and-51,no-host5-and-51 -fopenmp -fopenmp-version=50 -fnoopenmp-use-tls -ferror-limit 100 -o - %s -// RUN: %clang_cc1 -triple x86_64-apple-macos10.7.0 -verify=expected,omp51,ompvar,omp45-to-51,omp5-and-51,omp5-or-later,omp5-or-later-var,omp45-to-51-var,omp45-to-51-clause,host-5-and-51,no-host5-and-51 -fopenmp -fnoopenmp-use-tls -ferror-limit 100 -o - %s -// RUN: %clang_cc1 -triple x86_64-apple-macos10.7.0 -verify=expected,omp52,ompvar,omp5-or-later,omp5-or-later-var -fopenmp -fopenmp-version=60 -fnoopenmp-use-tls -ferror-limit 100 -o - %s +// DEFINE: %{common_opts_mac} = -triple x86_64-apple-macos10.7.0 +// DEFINE: %{limit} = -fnoopenmp-use-tls -ferror-limit 100 +// DEFINE: %{target_mac} = -fopenmp-targets=x86_64-apple-macos10.7.0 +// DEFINE: %{aux_triple} = -aux-triple x86_64-apple-macos10.7.0 +// DEFINE: %{openmp45} = -fopenmp -fopenmp-version=45 +// DEFINE: %{openmp50} = -fopenmp -fopenmp-version=50 +// DEFINE: %{openmp60} = -fopenmp -fopenmp-version=60 + +// RUN: %clang_cc1 %{common_opts_mac} -verify=expected,omp45,omp45-to-51,omp45-to-51-var,omp45-to-51-clause,omp45-to-51-clause %{openmp45} %{limit} -o - %s +// RUN: %clang_cc1 %{common_opts_mac} -verify=expected,omp5,ompvar,omp45-to-51,omp5-and-51,omp5-or-later,omp5-or-later-var,omp45-to-51-var,omp45-to-51-clause,host5,host-5-and-51,no-host5-and-51 %{openmp50} %{target_mac} %{limit} -o - %s +// RUN: %clang_cc1 %{common_opts_mac} -verify=expected,omp52,ompvar,omp5-or-later,omp5-or-later-var %{openmp60} %{target_mac} %{limit} -o - %s +// RUN: %clang_cc1 %{common_opts_mac} -verify=expected,omp5,ompvar,omp45-to-51,omp5-and-51,omp5-or-later,omp5-or-later-var,omp45-to-51-var,omp45-to-51-clause,host-5-and-51,no-host5-and-51,dev5 %{openmp50} -fopenmp-is-target-device %{target_mac} %{aux_triple} %{limit} -o - %s +// RUN: %clang_cc1 %{common_opts_mac} -verify=expected,omp52,ompvar,omp5-or-later,omp5-or-later-var %{openmp60} -fopenmp-is-target-device %{target_mac} %{aux_triple} %{limit} -o - %s + +// RUN: %clang_cc1 %{common_opts_mac} -verify=expected,omp5,ompvar,omp45-to-51,omp5-and-51,omp5-or-later,omp5-or-later-var,omp45-to-51-var,omp45-to-51-clause,host5,host-5-and-51,no-host5-and-51 -fopenmp-simd -fopenmp-version=50 %{target_mac} %{limit} -o - %s +// RUN: %clang_cc1 %{common_opts_mac} -verify=expected,omp52,ompvar,omp5-or-later,omp5-or-later-var -fopenmp-simd -fopenmp-version=60 %{target_mac} %{limit} -o - %s +// RUN: %clang_cc1 %{common_opts_mac} -verify=expected,omp5,ompvar,omp45-to-51,omp5-and-51,omp5-or-later,omp5-or-later-var,omp45-to-51-var,omp45-to-51-clause,host5,host-5-and-51,no-host5-and-51 -fopenmp-simd -fopenmp-version=50 -fopenmp-is-target-device %{target_mac} %{limit} -o - %s +// RUN: %clang_cc1 %{common_opts_mac} -verify=expected,omp52,ompvar,omp5-or-later,omp5-or-later-var -fopenmp-simd -fopenmp-version=60 -fopenmp-is-target-device %{target_mac} %{limit} -o - %s + +// RUN: %clang_cc1 %{common_opts_mac} -verify=expected,omp45,omp45-to-51,omp45-to-51-var,omp45-to-51-clause -fopenmp-version=45 -fopenmp-simd %{limit} -o - %s +// RUN: %clang_cc1 %{common_opts_mac} -verify=expected,omp51,ompvar,omp45-to-51,omp5-and-51,omp5-or-later,omp5-or-later-var,omp45-to-51-var,omp45-to-51-clause,host-5-and-51,no-host5-and-51 -fopenmp %{limit} -o - %s +// RUN: %clang_cc1 %{common_opts_mac} -verify=expected,omp51,ompvar,omp45-to-51,omp5-and-51,omp5-or-later,omp5-or-later-var,omp45-to-51-var,omp45-to-51-clause,host-5-and-51,no-host5-and-51 -fopenmp %{limit} -DTESTEND=1 -o - %s +// RUN: %clang_cc1 %{common_opts_mac} -verify=expected,omp51,ompvar,omp45-to-51,omp5-and-51,omp5-or-later,omp5-or-later-var,omp45-to-51-var,omp45-to-51-clause,host-5-and-51,no-host5-and-51 -fopenmp %{limit} -I%S/Inputs -DTESTENDINC=1 -o - %s +// RUN: %clang_cc1 %{common_opts_mac} -verify=expected,omp51,ompvar,omp45-to-51,omp5-and-51,omp5-or-later,omp5-or-later-var,omp45-to-51-var,omp45-to-51-clause,host-5-and-51,no-host5-and-51 -fopenmp-simd %{limit} -o - %s + +// RUN: %clang_cc1 %{common_opts_mac} -verify=expected,omp52,ompvar,omp5-or-later,omp5-or-later-var -fopenmp -fopenmp-version=52 -DVERBOSE_MODE=1 %{limit} -o - %s +// RUN: %clang_cc1 %{common_opts_mac} -verify=expected,omp52,ompvar,omp5-or-later,omp5-or-later-var %{openmp60} -DVERBOSE_MODE=1 %{limit} -o - %s + +// RUN: %clang_cc1 %{common_opts_mac} -verify=expected,omp5,ompvar,omp45-to-51,omp5-and-51,omp5-or-later,omp5-or-later-var,omp45-to-51-var,omp45-to-51-clause,host-5-and-51,no-host5-and-51 %{openmp50} %{limit} -o - %s +// RUN: %clang_cc1 %{common_opts_mac} -verify=expected,omp51,ompvar,omp45-to-51,omp5-and-51,omp5-or-later,omp5-or-later-var,omp45-to-51-var,omp45-to-51-clause,host-5-and-51,no-host5-and-51 -fopenmp %{limit} -o - %s +// RUN: %clang_cc1 %{common_opts_mac} -verify=expected,omp52,ompvar,omp5-or-later,omp5-or-later-var %{openmp60} %{limit} -o - %s // expected-error@+1 {{unexpected OpenMP directive '#pragma omp end declare target'}} diff --git a/clang/test/OpenMP/declare_target_variables_ast_print.cpp b/clang/test/OpenMP/declare_target_variables_ast_print.cpp index a108dad791f39e..cd5dfea56f8f35 100644 --- a/clang/test/OpenMP/declare_target_variables_ast_print.cpp +++ b/clang/test/OpenMP/declare_target_variables_ast_print.cpp @@ -124,3 +124,4 @@ target *S1 = &S; // CHECK-NEXT: #pragma omp declare target // CHECK-NEXT: target *S1 = &S; // CHECK-NEXT: #pragma omp end declare target +