From: Alexey Bataev Date: Mon, 8 Jul 2019 19:21:54 +0000 (+0000) Subject: [OPENMP]Improve error message for device unsupported types. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4954a61788404e46ee302afee6dac049970d02a1;p=clang [OPENMP]Improve error message for device unsupported types. Provide more data to the user in the error message about unsupported type for device compilation. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@365374 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Basic/DiagnosticSemaKinds.td b/include/clang/Basic/DiagnosticSemaKinds.td index ef78f44d14..5fd191a030 100644 --- a/include/clang/Basic/DiagnosticSemaKinds.td +++ b/include/clang/Basic/DiagnosticSemaKinds.td @@ -9269,6 +9269,8 @@ def err_omp_invariant_or_linear_dependency : Error< "expected loop invariant expression or ' * %0 + ' kind of expression">; def err_omp_wrong_dependency_iterator_type : Error< "expected an integer or a pointer type of the outer loop counter '%0' for non-rectangular nests">; +def err_omp_unsupported_type : Error < + "host requires %0 bit size %1 type support, but device '%2' does not support it">; } // end of OpenMP category let CategoryName = "Related Result Type Issue" in { diff --git a/lib/Sema/SemaOpenMP.cpp b/lib/Sema/SemaOpenMP.cpp index 20afe1575d..3a02b6ae02 100644 --- a/lib/Sema/SemaOpenMP.cpp +++ b/lib/Sema/SemaOpenMP.cpp @@ -1593,8 +1593,9 @@ void Sema::checkOpenMPDeviceExpr(const Expr *E) { !Context.getTargetInfo().hasFloat128Type()) || (Ty->isIntegerType() && Context.getTypeSize(Ty) == 128 && !Context.getTargetInfo().hasInt128Type())) - targetDiag(E->getExprLoc(), diag::err_type_unsupported) - << Ty << E->getSourceRange(); + targetDiag(E->getExprLoc(), diag::err_omp_unsupported_type) + << static_cast(Context.getTypeSize(Ty)) << Ty + << Context.getTargetInfo().getTriple().str() << E->getSourceRange(); } bool Sema::isOpenMPCapturedByRef(const ValueDecl *D, unsigned Level) const { diff --git a/test/OpenMP/nvptx_unsupported_type_messages.cpp b/test/OpenMP/nvptx_unsupported_type_messages.cpp index 67f2e41ac4..bffb014c5d 100644 --- a/test/OpenMP/nvptx_unsupported_type_messages.cpp +++ b/test/OpenMP/nvptx_unsupported_type_messages.cpp @@ -14,9 +14,9 @@ struct T { char c; T() : a(12), f(15) {} #ifndef _ARCH_PPC -// expected-error@+4 {{'__float128' is not supported on this target}} +// expected-error@+4 {{host requires 128 bit size '__float128' type support, but device 'nvptx64-unknown-unknown' does not support it}} #else -// expected-error@+2 {{'long double' is not supported on this target}} +// expected-error@+2 {{host requires 128 bit size 'long double' type support, but device 'nvptx64-unknown-unknown' does not support it}} #endif T &operator+(T &b) { f += b.a; return *this;} };