r365374 - [OPENMP]Improve error message for device unsupported types.
Alexey Bataev via cfe-commits
cfe-commits at lists.llvm.org
Mon Jul 8 12:21:54 PDT 2019
Author: abataev
Date: Mon Jul 8 12:21:54 2019
New Revision: 365374
URL: http://llvm.org/viewvc/llvm-project?rev=365374&view=rev
Log:
[OPENMP]Improve error message for device unsupported types.
Provide more data to the user in the error message about unsupported
type for device compilation.
Modified:
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/lib/Sema/SemaOpenMP.cpp
cfe/trunk/test/OpenMP/nvptx_unsupported_type_messages.cpp
Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=365374&r1=365373&r2=365374&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Mon Jul 8 12:21:54 2019
@@ -9269,6 +9269,8 @@ def err_omp_invariant_or_linear_dependen
"expected loop invariant expression or '<invariant1> * %0 + <invariant2>' 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 {
Modified: cfe/trunk/lib/Sema/SemaOpenMP.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOpenMP.cpp?rev=365374&r1=365373&r2=365374&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaOpenMP.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOpenMP.cpp Mon Jul 8 12:21:54 2019
@@ -1593,8 +1593,9 @@ void Sema::checkOpenMPDeviceExpr(const 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<unsigned>(Context.getTypeSize(Ty)) << Ty
+ << Context.getTargetInfo().getTriple().str() << E->getSourceRange();
}
bool Sema::isOpenMPCapturedByRef(const ValueDecl *D, unsigned Level) const {
Modified: cfe/trunk/test/OpenMP/nvptx_unsupported_type_messages.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/nvptx_unsupported_type_messages.cpp?rev=365374&r1=365373&r2=365374&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/nvptx_unsupported_type_messages.cpp (original)
+++ cfe/trunk/test/OpenMP/nvptx_unsupported_type_messages.cpp Mon Jul 8 12:21:54 2019
@@ -14,9 +14,9 @@ struct T {
char c;
T() : a(12), f(15) {}
#ifndef _ARCH_PPC
-// expected-error at +4 {{'__float128' is not supported on this target}}
+// expected-error at +4 {{host requires 128 bit size '__float128' type support, but device 'nvptx64-unknown-unknown' does not support it}}
#else
-// expected-error at +2 {{'long double' is not supported on this target}}
+// expected-error at +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;}
};
More information about the cfe-commits
mailing list