r283460 - [OpenMP] Check if the template specialization is mappable instead of specialized template Differential Revision: https://reviews.llvm.org/D25252
Richard Smith via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 6 09:09:46 PDT 2016
LGTM
On 6 Oct 2016 8:58 am, "David Sheinkman via cfe-commits" <
cfe-commits at lists.llvm.org> wrote:
> Author: davidsh
> Date: Thu Oct 6 10:47:36 2016
> New Revision: 283460
>
> URL: http://llvm.org/viewvc/llvm-project?rev=283460&view=rev
> Log:
> [OpenMP] Check if the template specialization is mappable instead of
> specialized template Differential Revision: https://reviews.llvm.org/
> D25252
>
> Modified:
> cfe/trunk/lib/Sema/SemaOpenMP.cpp
> cfe/trunk/test/OpenMP/target_map_messages.cpp
>
> Modified: cfe/trunk/lib/Sema/SemaOpenMP.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/
> SemaOpenMP.cpp?rev=283460&r1=283459&r2=283460&view=diff
> ============================================================
> ==================
> --- cfe/trunk/lib/Sema/SemaOpenMP.cpp (original)
> +++ cfe/trunk/lib/Sema/SemaOpenMP.cpp Thu Oct 6 10:47:36 2016
> @@ -10523,9 +10523,6 @@ static bool IsCXXRecordForMappable(Sema
> if (!RD || RD->isInvalidDecl())
> return true;
>
> - if (auto *CTSD = dyn_cast<ClassTemplateSpecializationDecl>(RD))
> - if (auto *CTD = CTSD->getSpecializedTemplate())
> - RD = CTD->getTemplatedDecl();
> auto QTy = SemaRef.Context.getRecordType(RD);
> if (RD->isDynamicClass()) {
> SemaRef.Diag(Loc, diag::err_omp_not_mappable_type) << QTy;
>
> Modified: cfe/trunk/test/OpenMP/target_map_messages.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/
> target_map_messages.cpp?rev=283460&r1=283459&r2=283460&view=diff
> ============================================================
> ==================
> --- cfe/trunk/test/OpenMP/target_map_messages.cpp (original)
> +++ cfe/trunk/test/OpenMP/target_map_messages.cpp Thu Oct 6 10:47:36 2016
> @@ -347,6 +347,15 @@ public:
> S5(int v):a(v) { }
> };
>
> +template <class T>
> +struct S6;
> +
> +template<>
> +struct S6<int> // expected-note {{mappable type cannot be polymorphic}}
> +{
> + virtual void foo();
> +};
> +
> S3 h;
> #pragma omp threadprivate(h) // expected-note 2 {{defined as
> threadprivate or thread local}}
>
> @@ -451,6 +460,7 @@ int main(int argc, char **argv) {
> int i;
> int &j = i;
> int *k = &j;
> + S6<int> m;
> int x;
> int y;
> int to, tofrom, always;
> @@ -513,6 +523,8 @@ int main(int argc, char **argv) {
> {}
> #pragma omp target firstprivate(j) map(j) // expected-error
> {{firstprivate variable cannot be in a map clause in '#pragma omp target'
> directive}} expected-note {{defined as firstprivate}}
> {}
> +#pragma omp target map(m) // expected-error {{type 'S6<int>' is not
> mappable to target}}
> + {}
> return tmain<int, 3>(argc)+tmain<from, 4>(argc); // expected-note {{in
> instantiation of function template specialization 'tmain<int, 3>' requested
> here}} expected-note {{in instantiation of function template specialization
> 'tmain<int, 4>' requested here}}
> }
> #endif
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20161006/91bac8f1/attachment.html>
More information about the cfe-commits
mailing list