]> granicus.if.org Git - clang/commitdiff
[OPENMP]Improve error message for device unsupported types.
authorAlexey Bataev <a.bataev@hotmail.com>
Mon, 8 Jul 2019 19:21:54 +0000 (19:21 +0000)
committerAlexey Bataev <a.bataev@hotmail.com>
Mon, 8 Jul 2019 19:21:54 +0000 (19:21 +0000)
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

include/clang/Basic/DiagnosticSemaKinds.td
lib/Sema/SemaOpenMP.cpp
test/OpenMP/nvptx_unsupported_type_messages.cpp

index ef78f44d1424fbbe45fd50ff66fb1acef62c35e7..5fd191a030c2f33aeabc2e8212ec21ee6fec0f54 100644 (file)
@@ -9269,6 +9269,8 @@ def err_omp_invariant_or_linear_dependency : Error<
   "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 {
index 20afe1575dd204c063dcc99741e57d2baafd372e..3a02b6ae02f5dba43448067b1a87ab46d78b06de 100644 (file)
@@ -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<unsigned>(Context.getTypeSize(Ty)) << Ty
+        << Context.getTargetInfo().getTriple().str() << E->getSourceRange();
 }
 
 bool Sema::isOpenMPCapturedByRef(const ValueDecl *D, unsigned Level) const {
index 67f2e41ac4a96fb6f2bcb39aa94fe8c75dfbffe7..bffb014c5d321032b44e526084368d2b103e1a36 100644 (file)
@@ -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;}
 };